diff options
author | Jinkun Jang <jinkun.jang@samsung.com> | 2013-03-13 01:46:36 +0900 |
---|---|---|
committer | Jinkun Jang <jinkun.jang@samsung.com> | 2013-03-13 01:46:36 +0900 |
commit | cbeafc4c99f331567f8fbbcd32478c4aa7788d93 (patch) | |
tree | b0aaa78c39a87131f4b3784520f374d9ed8c3aab | |
parent | 435816bd751d03b64fcac5bf856cd6cf2219f494 (diff) | |
download | libslp-db-util-cbeafc4c99f331567f8fbbcd32478c4aa7788d93.tar.gz libslp-db-util-cbeafc4c99f331567f8fbbcd32478c4aa7788d93.tar.bz2 libslp-db-util-cbeafc4c99f331567f8fbbcd32478c4aa7788d93.zip |
Tizen 2.1 base
31 files changed, 1803 insertions, 1780 deletions
@@ -1,3 +1,3 @@ -Hakjoo Ko <hakjoo.ko@samsung.com>
-Hyungdeuk Kim <hd3.kim@samsung.com>
-
+SeungYeup Kim <sy2004.kim at samsung dot com> +HyungDeuk Kim <hd3.kim at samsung dot com> +HakJoo Ko <hakjoo.ko at samsung dot com> diff --git a/CMakeLists.txt b/CMakeLists.txt index f79f5e4..85b926e 100644..100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ SET(INCLUDEDIR "\${prefix}/include/db-util") SET(VERSION_MAJOR 0) SET(VERSION "${VERSION_MAJOR}.1.0") -SET(SRCS collation.c convert.c util_func.c) +SET(SRCS util_func.c collation.c) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) @@ -16,6 +16,8 @@ INCLUDE(FindPkgConfig) pkg_check_modules(pkgs REQUIRED sqlite3 dlog + glib-2.0 + icu-i18n ) FOREACH(flag ${pkgs_CFLAGS}) @@ -23,15 +25,17 @@ FOREACH(flag ${pkgs_CFLAGS}) ENDFOREACH(flag) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -ldl -g") -#SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -finstrument-functions") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"") +ADD_DEFINITIONS("-DDB_UTIL_USING_PLATFORM_DBG") +ADD_DEFINITIONS("-DDB_UTIL_ENABLE_TRACE") +##ADD_DEFINITIONS("-DDB_UTIL_ENABLE_DEVDEBUG") ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) -TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} -lpthread -ldl) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} -ldl) SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR}) SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION}) @@ -39,9 +43,8 @@ CONFIGURE_FILE(db-util.pc.in db-util.pc @ONLY) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib COMPONENT RuntimeLibraries) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/db-util.pc DESTINATION lib/pkgconfig) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/db-util-common.h DESTINATION include/db-util) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/db-util.h DESTINATION include/db-util) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/collation.h DESTINATION include/db-util) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/convert.h DESTINATION include/db-util) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/db-util-common.h DESTINATION include/db-util) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/util-func.h DESTINATION include/db-util) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/collation.h DESTINATION include/db-util) diff --git a/LICENSE.APLv2 b/LICENSE.APLv2 new file mode 100755 index 0000000..d645695 --- /dev/null +++ b/LICENSE.APLv2 @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. @@ -0,0 +1,3 @@ +Copyright (c) Samsung Electronics Co., Ltd. All rights reserved. +Except as noted, this software is licensed under Apache License, Version 2. +Please, see the LICENSE.APLv2 file for Apache License terms and conditions. diff --git a/TC/build.sh b/TC/build.sh new file mode 100755 index 0000000..c488da0 --- /dev/null +++ b/TC/build.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +export TET_INSTALL_PATH=/home/deuk/repository/tetware/TETware # local tetware path +export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target +export PATH=$TET_TARGET_PATH/bin:$PATH +export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH +export TET_ROOT=$TET_TARGET_PATH + +export TET_SUITE_ROOT=`pwd` +FILE_NAME_EXTENSION=`date +%s` + +RESULT_DIR=results +HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal + +mkdir -p $RESULT_DIR + +tcc -c -p ./ +tcc -b -j $JOURNAL_RESULT -p ./ +grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/execute.sh b/TC/execute.sh new file mode 100755 index 0000000..21021c0 --- /dev/null +++ b/TC/execute.sh @@ -0,0 +1,19 @@ +#!/bin/sh +export TET_INSTALL_PATH=/mnt/nfs/tetware/TETware +export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target +export PATH=$TET_TARGET_PATH/bin:$PATH +export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH + +export TET_ROOT=$TET_TARGET_PATH + +export TET_SUITE_ROOT=`pwd` +FILE_NAME_EXTENSION=`date +%s` + +RESULT_DIR=results +HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal + +mkdir -p $RESULT_DIR + +tcc -e -j $JOURNAL_RESULT -p ./ +grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/tet_code b/TC/tet_code new file mode 100755 index 0000000..a2cf6c1 --- /dev/null +++ b/TC/tet_code @@ -0,0 +1,12 @@ +# TET reserved codes +0 "PASS" +1 "FAIL" +2 "UNRESOLVED" +3 "NOTINUSE" +4 "UNSUPPORTED" +5 "UNTESTED" +6 "UNINITIATED" +7 "NORESULT" + +# Test suite additional codes +33 "INSPECT" diff --git a/TC/tet_scen b/TC/tet_scen new file mode 100755 index 0000000..43cbc9b --- /dev/null +++ b/TC/tet_scen @@ -0,0 +1,7 @@ +all + ^TEST +##### Scenarios for TEST ##### + +# Test scenario +TEST + :include:/unit/tslist diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg new file mode 100755 index 0000000..a584acd --- /dev/null +++ b/TC/tetbuild.cfg @@ -0,0 +1,2 @@ +TET_OUTPUT_CAPTURE=False +TET_BUILD_TOOL=make diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg new file mode 100755 index 0000000..c66eda4 --- /dev/null +++ b/TC/tetclean.cfg @@ -0,0 +1,2 @@ +TET_OUTPUT_CAPTURE=False +TET_CLEAN_TOOL=make clean diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg new file mode 100755 index 0000000..0d9d39a --- /dev/null +++ b/TC/tetexec.cfg @@ -0,0 +1 @@ +TET_OUTPUT_CAPTURE=False diff --git a/TC/unit/Makefile b/TC/unit/Makefile new file mode 100755 index 0000000..e82feb8 --- /dev/null +++ b/TC/unit/Makefile @@ -0,0 +1,25 @@ +CC ?= gcc + +TARGETS = utc_ApplicationFW_db_util_close \ + utc_ApplicationFW_db_util_open \ + utc_ApplicationFW_db_util_open_with_options \ + +PKGS = sqlite3 dlog db-util + +LDFLAGS = `pkg-config --libs $(PKGS)` +LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o +LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s +LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s +LDFLAGS += -pthread + +CFLAGS = -I. `pkg-config --cflags $(PKGS)` +CFLAGS += -I$(TET_ROOT)/inc/tet3 +CFLAGS += -Wall + +all: $(TARGETS) + +$(TARGETS): %: %.c + $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) + +clean: + rm -f $(TARGETS) diff --git a/TC/unit/tc_gen.sh b/TC/unit/tc_gen.sh new file mode 100755 index 0000000..54f482d --- /dev/null +++ b/TC/unit/tc_gen.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +TMPSTR=$0 +SCRIPT=${TMPSTR##*/} + +if [ $# -lt 2 ]; then + echo "Usage) $SCRIPT module_name api_name" + exit 1 +fi + +MODULE=$1 +API=$2 +TEMPLATE=utc_MODULE_API_func.c.in +TESTCASE=utc_${MODULE}_${API}_func + +sed -e ' + s^@API@^'"$API"'^g + s^@MODULE@^'"$MODULE"'^g + ' $TEMPLATE > $TESTCASE.c + +if [ ! -e "$TESTCASE.c" ]; then + echo "Failed" + exit 1 +fi +echo "Testcase file is $TESTCASE.c" +echo "Done" +echo "please put \"$TESTCASE\" as Target in Makefile" +echo "please put \"/unit/$TESTCASE\" in tslist" diff --git a/TC/unit/tslist b/TC/unit/tslist new file mode 100755 index 0000000..c221828 --- /dev/null +++ b/TC/unit/tslist @@ -0,0 +1,3 @@ +/unit/utc_ApplicationFW_db_util_close +/unit/utc_ApplicationFW_db_util_open +/unit/utc_ApplicationFW_db_util_open_with_options diff --git a/TC/unit/utc_ApplicationFW_db_util_close.c b/TC/unit/utc_ApplicationFW_db_util_close.c new file mode 100755 index 0000000..3c6f855 --- /dev/null +++ b/TC/unit/utc_ApplicationFW_db_util_close.c @@ -0,0 +1,114 @@ +/* + * libslp-db-util + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko <hakjoo.ko@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include <tet_api.h> +#include <db-util.h> + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_ApplicationFW_db_util_close_func_01(void); +static void utc_ApplicationFW_db_util_close_func_02(void); + +static sqlite3* db_hd = NULL; +char* db_path = "/opt/test.db"; + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_ApplicationFW_db_util_close_func_01, POSITIVE_TC_IDX }, + { utc_ApplicationFW_db_util_close_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ +} + +static void cleanup(void) +{ +} + +/** + * @brief Positive test case of db_util_close() + */ +static void utc_ApplicationFW_db_util_close_func_01(void) +{ + int r = 0; + + r = db_util_open(db_path, &db_hd, 0); + if (r != SQLITE_OK) { + tet_infoline("db_util_close() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + + r = db_util_close(db_hd); + if (r != SQLITE_OK) { + tet_infoline("db_util_close() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + db_hd = NULL; + + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of ug_init db_util_close() + */ +static void utc_ApplicationFW_db_util_close_func_02(void) +{ + int r = 0; + sqlite3_stmt *db_stmt = NULL; + + db_hd = NULL; + + r = db_util_open(db_path, &db_hd, 0); + if (r != SQLITE_OK) { + tet_infoline("db_util_close() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + + r = sqlite3_prepare(db_hd, "create table test(id int);", -1, &db_stmt, NULL); + if (r != SQLITE_OK) { + tet_infoline("db_util_close() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + + r = db_util_close(db_hd); + if (r == SQLITE_OK) { + tet_infoline("db_util_close() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + diff --git a/TC/unit/utc_ApplicationFW_db_util_open.c b/TC/unit/utc_ApplicationFW_db_util_open.c new file mode 100755 index 0000000..feb9780 --- /dev/null +++ b/TC/unit/utc_ApplicationFW_db_util_open.c @@ -0,0 +1,96 @@ +/* + * libslp-db-util + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko <hakjoo.ko@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include <tet_api.h> +#include <db-util.h> + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_ApplicationFW_db_util_open_func_01(void); +static void utc_ApplicationFW_db_util_open_func_02(void); + +static sqlite3* db_hd = NULL; +char* db_path = "test.db"; + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_ApplicationFW_db_util_open_func_01, POSITIVE_TC_IDX }, + { utc_ApplicationFW_db_util_open_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ +} + +static void cleanup(void) +{ + db_util_close(db_hd); +} + +/** + * @brief Positive test case of db_util_open() + */ +static void utc_ApplicationFW_db_util_open_func_01(void) +{ + int r = 0; + + r = db_util_open(db_path, &db_hd, 0); + if (r != SQLITE_OK) { + tet_infoline("db_util_open() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of ug_init db_util_open() + */ +static void utc_ApplicationFW_db_util_open_func_02(void) +{ + int r = 0; + + r = db_util_open(NULL, &db_hd, 0); + if (r == SQLITE_OK) { + tet_infoline("db_util_open() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + + r = db_util_open(db_path, NULL, 0); + if (r == SQLITE_OK) { + tet_infoline("db_util_open() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} diff --git a/TC/unit/utc_ApplicationFW_db_util_open_with_options.c b/TC/unit/utc_ApplicationFW_db_util_open_with_options.c new file mode 100755 index 0000000..7c7b5ef --- /dev/null +++ b/TC/unit/utc_ApplicationFW_db_util_open_with_options.c @@ -0,0 +1,114 @@ +/* + * libslp-db-util + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko <hakjoo.ko@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include <tet_api.h> +#include <db-util.h> + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_ApplicationFW_db_util_open_with_options_func_01(void); +static void utc_ApplicationFW_db_util_open_with_options_func_02(void); + +static sqlite3* db_hd = NULL; +char* db_path = "/opt/test.db"; + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_ApplicationFW_db_util_open_with_options_func_01, POSITIVE_TC_IDX }, + { utc_ApplicationFW_db_util_open_with_options_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ +} + +static void cleanup(void) +{ + db_util_close(db_hd); +} + +/** + * @brief Positive test case of db_util_open_with_options() + */ +static void utc_ApplicationFW_db_util_open_with_options_func_01(void) +{ + int r = 0; + + r = db_util_open_with_options(db_path, &db_hd, SQLITE_OPEN_READWRITE, NULL); + if (r != SQLITE_OK) { + tet_infoline("db_util_open() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of ug_init db_util_open_with_options() + */ +static void utc_ApplicationFW_db_util_open_with_options_func_02(void) +{ + int r = 0; + + r = db_util_open_with_options(NULL, &db_hd, SQLITE_OPEN_READWRITE, NULL); + if (r == SQLITE_OK) { + tet_infoline("db_util_open() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + + r = db_util_open_with_options(db_path, NULL, SQLITE_OPEN_READWRITE, NULL); + if (r == SQLITE_OK) { + tet_infoline("db_util_open() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + + r = db_util_open_with_options(db_path, &db_hd, 0, NULL); + if (r == SQLITE_OK) { + tet_infoline("db_util_open() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + + unlink(db_path); + + r = db_util_open_with_options(db_path, &db_hd, SQLITE_OPEN_READONLY, NULL); + if (r == SQLITE_OK) { + tet_infoline("db_util_open() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + + tet_result(TET_PASS); +} + + diff --git a/TC/unit/utc_MODULE_API_func.c.in b/TC/unit/utc_MODULE_API_func.c.in new file mode 100755 index 0000000..e9629be --- /dev/null +++ b/TC/unit/utc_MODULE_API_func.c.in @@ -0,0 +1,62 @@ +#include <tet_api.h> + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_@MODULE@_@API@_func_01(void); +static void utc_@MODULE@_@API@_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_@MODULE@_@API@_func_01, POSITIVE_TC_IDX }, + { utc_@MODULE@_@API@_func_02, NEGATIVE_TC_IDX }, +}; + +static void startup(void) +{ +} + +static void cleanup(void) +{ +} + +/** + * @brief Positive test case of @API@() + */ +static void utc_@MODULE@_@API@_func_01(void) +{ + int r = 0; + + r = @API@(...); + + if (r<0) { + tet_infoline("@API@() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of ug_init @API@() + */ +static void utc_@MODULE@_@API@_func_02(void) +{ + int r = 0; + + r = @API@(...); + + if (r>=0) { + tet_infoline("@API@() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} diff --git a/collation.c b/collation.c index 29062e4..64c7a25 100755 --- a/collation.c +++ b/collation.c @@ -18,1726 +18,541 @@ * limitations under the License. * */ - +#include <string.h> #include <math.h> #include <wchar.h> #include <wctype.h> -#include <stdio.h> -#include "collation.h" -#include "string.h" -#include "stdlib.h" -typedef unsigned short DB_UINT16; -typedef unsigned int DB_UINT32; -typedef unsigned short DB_WCHAR; +#include <unistd.h> +#include <glib.h> -#define WSC_UNICODE_TO_ALPHA_ORDER_COUNT 491+59 -#define WSC_CAP_TO_SMALL_OFFSET 0x0020 +#include <dlfcn.h> -/* It represents the alphabetical order of unicode. */ -/* Note : A collation table should be ascending order by unicode! */ -typedef struct { - DB_UINT16 wchCode; - DB_UINT32 uAlphabeticalOrder; - -} UnicodeToAlphaOrder; - -/* Alpha order for unicode characters */ - -/* - CAP = Capital letter - SMA = Small letter - - LIG = Ligature - AFR = African - - DIA = Diaresis - STR = Stroke - BAR = Bar - CED = Cedilla - ACU = Acute - GRA = Grave - CIR = Circumflex - RIN = Ring above - TIL = Tilde - MAC = Macron - BRE = Breve - DOU = Double Acute - OGO = Ogonek - DOM = Dot middle - DOA = Dot above - DOL = Dotless - CAR = Caron - HOR = Horn - ACL = Accented Ligature - APO = Preceded by apostrophe - -*/ +#include <unicode/utypes.h> +#include <unicode/ucol.h> +#include <unicode/uiter.h> +#include <unicode/ustring.h> -enum { - /* Null value : Added by SYKim (2005-07-18) */ - ALP_ORDER_NULL = 0x0000, - /* CJK Unified ideographs */ - ALP_ORDER_CJK_UNIFIED = 0x0001, - /* CJK Symbols and Punctuations */ - ALP_ORDER_CJK_SYMBOLS = 0x0010, - /* Thai characters */ - ALP_ORDER_THAI_CHARS = 0x0100, - /* digits */ - ALP_ORDER_DIGIT_ZERO = 0x1200, - ALP_ORDER_DIGIT_ONE = 0x1201, - ALP_ORDER_DIGIT_TWO = 0x1202, - ALP_ORDER_DIGIT_THREE = 0x1203, - ALP_ORDER_DIGIT_FOUR = 0x1204, - ALP_ORDER_DIGIT_FIVE = 0x1205, - ALP_ORDER_DIGIT_SIX = 0x1206, - ALP_ORDER_DIGIT_SEVEN = 0x1207, - ALP_ORDER_DIGIT_EIGHT = 0x1208, - ALP_ORDER_DIGIT_NINE = 0x1209, - - /* Cyrillic characters */ - ALP_ORDER_CYRILLIC_CAP_A = 0xF300, - ALP_ORDER_CYRILLIC_SMA_A = 0xF301, - ALP_ORDER_CYRILLIC_CAP_BE = 0xF302, - ALP_ORDER_CYRILLIC_SMA_BE = 0xF303, - ALP_ORDER_CYRILLIC_CAP_VE = 0xF304, - ALP_ORDER_CYRILLIC_SMA_VE = 0xF305, - ALP_ORDER_CYRILLIC_CAP_GHE = 0xF306, - ALP_ORDER_CYRILLIC_SMA_GHE = 0xF307, - ALP_ORDER_CYRILLIC_CAP_DE = 0xF308, - ALP_ORDER_CYRILLIC_SMA_DE = 0xF309, - ALP_ORDER_CYRILLIC_CAP_IE = 0xF30A, - ALP_ORDER_CYRILLIC_SMA_IE = 0xF30B, - ALP_ORDER_CYRILLIC_CAP_ZHE = 0xF30C, - ALP_ORDER_CYRILLIC_SMA_ZHE = 0xF30D, - ALP_ORDER_CYRILLIC_CAP_ZE = 0xF30E, - ALP_ORDER_CYRILLIC_SMA_ZE = 0xF30F, - ALP_ORDER_CYRILLIC_CAP_I = 0xF310, - ALP_ORDER_CYRILLIC_SMA_I = 0xF311, - ALP_ORDER_CYRILLIC_CAP_SHORT_I = 0xF312, - ALP_ORDER_CYRILLIC_SMA_SHORT_I = 0xF313, - ALP_ORDER_CYRILLIC_CAP_KA = 0xF314, - ALP_ORDER_CYRILLIC_SMA_KA = 0xF315, - ALP_ORDER_CYRILLIC_CAP_EL = 0xF316, - ALP_ORDER_CYRILLIC_SMA_EL = 0xF317, - ALP_ORDER_CYRILLIC_CAP_EM = 0xF318, - ALP_ORDER_CYRILLIC_SMA_EM = 0xF319, - ALP_ORDER_CYRILLIC_CAP_EN = 0xF31A, - ALP_ORDER_CYRILLIC_SMA_EN = 0xF31B, - ALP_ORDER_CYRILLIC_CAP_O = 0xF31C, - ALP_ORDER_CYRILLIC_SMA_O = 0xF31D, - ALP_ORDER_CYRILLIC_CAP_PE = 0xF31E, - ALP_ORDER_CYRILLIC_SMA_PE = 0xF31F, - ALP_ORDER_CYRILLIC_CAP_ER = 0xF320, - ALP_ORDER_CYRILLIC_SMA_ER = 0xF321, - ALP_ORDER_CYRILLIC_CAP_ES = 0xF322, - ALP_ORDER_CYRILLIC_SMA_ES = 0xF323, - ALP_ORDER_CYRILLIC_CAP_TE = 0xF324, - ALP_ORDER_CYRILLIC_SMA_TE = 0xF325, - ALP_ORDER_CYRILLIC_CAP_U = 0xF326, - ALP_ORDER_CYRILLIC_SMA_U = 0xF327, - ALP_ORDER_CYRILLIC_CAP_EF = 0xF328, - ALP_ORDER_CYRILLIC_SMA_EF = 0xF329, - ALP_ORDER_CYRILLIC_CAP_HA = 0xF32A, - ALP_ORDER_CYRILLIC_SMA_HA = 0xF32B, - ALP_ORDER_CYRILLIC_CAP_TSE = 0xF32C, - ALP_ORDER_CYRILLIC_SMA_TSE = 0xF32D, - ALP_ORDER_CYRILLIC_CAP_CHE = 0xF32E, - ALP_ORDER_CYRILLIC_SMA_CHE = 0xF32F, - ALP_ORDER_CYRILLIC_CAP_SHA = 0xF330, - ALP_ORDER_CYRILLIC_SMA_SHA = 0xF331, - ALP_ORDER_CYRILLIC_CAP_SHCHA = 0xF332, - ALP_ORDER_CYRILLIC_SMA_SHCHA = 0xF333, - ALP_ORDER_CYRILLIC_CAP_HARD_SIGN = 0xF334, - ALP_ORDER_CYRILLIC_SMA_HARD_SIGN = 0xF335, - ALP_ORDER_CYRILLIC_CAP_YERU = 0xF336, - ALP_ORDER_CYRILLIC_SMA_YERU = 0xF337, - ALP_ORDER_CYRILLIC_CAP_SOFT_SIGN = 0xF338, - ALP_ORDER_CYRILLIC_SMA_SOFT_SIGN = 0xF339, - ALP_ORDER_CYRILLIC_CAP_E = 0xF33A, - ALP_ORDER_CYRILLIC_SMA_E = 0xF33B, - ALP_ORDER_CYRILLIC_CAP_YU = 0xF33C, - ALP_ORDER_CYRILLIC_SMA_YU = 0xF33D, - ALP_ORDER_CYRILLIC_CAP_YA = 0xF33E, - ALP_ORDER_CYRILLIC_SMA_YA = 0xF33F, - - /* Greek characters */ - ALP_ORDER_GREEK_CAP_ALPHA = 0x2400, - ALP_ORDER_GREEK_SMA_ALPHA = 0x2401, - ALP_ORDER_GREEK_CAP_BETA = 0x2402, - ALP_ORDER_GREEK_SMA_BETA = 0x2403, - ALP_ORDER_GREEK_CAP_GAMMA = 0x4404, - ALP_ORDER_GREEK_SMA_GAMMA = 0x4405, - ALP_ORDER_GREEK_CAP_DELTA = 0x3406, - ALP_ORDER_GREEK_SMA_DELTA = 0x3407, - ALP_ORDER_GREEK_CAP_EPSILON = 0x3408, - ALP_ORDER_GREEK_SMA_EPSILON = 0x3409, - ALP_ORDER_GREEK_CAP_ZETA = 0x940A, - ALP_ORDER_GREEK_SMA_ZETA = 0x940B, - ALP_ORDER_GREEK_CAP_ETA = 0x440C, - ALP_ORDER_GREEK_SMA_ETA = 0x440D, - ALP_ORDER_GREEK_CAP_THETA = 0x740E, - ALP_ORDER_GREEK_SMA_THETA = 0x740F, - ALP_ORDER_GREEK_CAP_IOTA = 0x4410, - ALP_ORDER_GREEK_SMA_IOTA = 0x4411, - ALP_ORDER_GREEK_CAP_KAPPA = 0x5412, - ALP_ORDER_GREEK_SMA_KAPPA = 0x5413, - ALP_ORDER_GREEK_CAP_LAMDA = 0x5414, - ALP_ORDER_GREEK_SMA_LAMDA = 0x5415, - ALP_ORDER_GREEK_CAP_MU = 0x6416, - ALP_ORDER_GREEK_SMA_MU = 0x6417, - ALP_ORDER_GREEK_CAP_NU = 0x6418, - ALP_ORDER_GREEK_SMA_NU = 0x6419, - ALP_ORDER_GREEK_CAP_XI = 0x941A, - ALP_ORDER_GREEK_SMA_XI = 0x941B, - ALP_ORDER_GREEK_CAP_OMICRON = 0x641C, - ALP_ORDER_GREEK_SMA_OMICRON = 0x641D, - ALP_ORDER_GREEK_CAP_PI = 0x741E, - ALP_ORDER_GREEK_SMA_PI = 0x741F, - ALP_ORDER_GREEK_CAP_RHO = 0x7420, - ALP_ORDER_GREEK_SMA_RHO = 0x7421, - ALP_ORDER_GREEK_CAP_SIGMA = 0x7422, - ALP_ORDER_GREEK_SMA_SIGMA = 0x7423, - ALP_ORDER_GREEK_CAP_TAU = 0x8424, - ALP_ORDER_GREEK_SMA_TAU = 0x8425, - ALP_ORDER_GREEK_CAP_UPSILON = 0x9426, - ALP_ORDER_GREEK_SMA_UPSILON = 0x9427, - ALP_ORDER_GREEK_CAP_PHI = 0x3428, - ALP_ORDER_GREEK_SMA_PHI = 0x3429, - ALP_ORDER_GREEK_CAP_CHI = 0x942A, - ALP_ORDER_GREEK_SMA_CHI = 0x942B, - ALP_ORDER_GREEK_CAP_PSI = 0x942C, - ALP_ORDER_GREEK_SMA_PSI = 0x942D, - ALP_ORDER_GREEK_CAP_OMEGA = 0x942E, - ALP_ORDER_GREEK_SMA_OMEGA = 0x942F, - - /* ISO-Latin characters */ - ALP_ORDER_ISOLAT_CAP_A = 0x2800, - ALP_ORDER_ISOLAT_SMA_A = 0x2801, - ALP_ORDER_ISOLAT_CAP_A_DIA = 0x2802, - ALP_ORDER_ISOLAT_SMA_A_DIA = 0x2802, - ALP_ORDER_ISOLAT_CAP_A_ACU = 0x2804, - ALP_ORDER_ISOLAT_SMA_A_ACU = 0x2804, - ALP_ORDER_ISOLAT_CAP_A_GRA = 0x2806, - ALP_ORDER_ISOLAT_SMA_A_GRA = 0x2806, - ALP_ORDER_ISOLAT_CAP_A_CIR = 0x2808, - ALP_ORDER_ISOLAT_SMA_A_CIR = 0x2808, - ALP_ORDER_ISOLAT_CAP_A_RIN = 0x280A, - ALP_ORDER_ISOLAT_SMA_A_RIN = 0x280A, - ALP_ORDER_ISOLAT_CAP_A_TIL = 0x280C, - ALP_ORDER_ISOLAT_SMA_A_TIL = 0x280C, - ALP_ORDER_ISOLAT_CAP_A_MAC = 0x280E, - ALP_ORDER_ISOLAT_SMA_A_MAC = 0x280E, - ALP_ORDER_ISOLAT_CAP_A_BRE = 0x2810, - ALP_ORDER_ISOLAT_SMA_A_BRE = 0x2810, - ALP_ORDER_ISOLAT_CAP_A_OGO = 0x2812, - ALP_ORDER_ISOLAT_SMA_A_OGO = 0x2812, - ALP_ORDER_ISOLAT_CAP_A_CAR = 0x2814, - ALP_ORDER_ISOLAT_SMA_A_CAR = 0x2814, - ALP_ORDER_ISOLAT_CAP_A_DIA_MAC = 0x2816, - ALP_ORDER_ISOLAT_SMA_A_DIA_MAC = 0x2816, - ALP_ORDER_ISOLAT_CAP_A_RIN_ACU = 0x2818, - ALP_ORDER_ISOLAT_SMA_A_RIN_ACU = 0x2818, - ALP_ORDER_ISOLAT_CAP_A_DOA_MAC = 0x281A, - ALP_ORDER_ISOLAT_SMA_A_DOA_MAC = 0x281A, - - ALP_ORDER_ISOLAT_CAP_LIG_AE = 0x281C, - ALP_ORDER_ISOLAT_SMA_LIG_AE = 0x281C, - ALP_ORDER_ISOLAT_CAP_LIG_AE_ACU = 0x281E, - ALP_ORDER_ISOLAT_SMA_LIG_AE_ACU = 0x281E, - ALP_ORDER_ISOLAT_CAP_LIG_AE_MAC = 0x2820, - ALP_ORDER_ISOLAT_SMA_LIG_AE_MAC = 0x2820, - - ALP_ORDER_ISOLAT_CAP_B = 0x2822, - ALP_ORDER_ISOLAT_SMA_B = 0x2823, - ALP_ORDER_ISOLAT_SMA_B_STR = 0x2822, - - ALP_ORDER_ISOLAT_CAP_C = 0x2825, - ALP_ORDER_ISOLAT_SMA_C = 0x2826, - ALP_ORDER_ISOLAT_CAP_C_CED = 0x2827, - ALP_ORDER_ISOLAT_SMA_C_CED = 0x2828, - ALP_ORDER_ISOLAT_CAP_C_ACU = 0x2829, - ALP_ORDER_ISOLAT_SMA_C_ACU = 0x2829, - ALP_ORDER_ISOLAT_CAP_C_CIR = 0x282B, - ALP_ORDER_ISOLAT_SMA_C_CIR = 0x282B, - ALP_ORDER_ISOLAT_CAP_C_DOA = 0x282D, - ALP_ORDER_ISOLAT_SMA_C_DOA = 0x282D, - ALP_ORDER_ISOLAT_CAP_C_CAR = 0x282F, - ALP_ORDER_ISOLAT_SMA_C_CAR = 0x282F, - - ALP_ORDER_ISOLAT_CAP_D = 0x3831, - ALP_ORDER_ISOLAT_SMA_D = 0x3832, - ALP_ORDER_ISOLAT_CAP_D_STR = 0x3833, - ALP_ORDER_ISOLAT_SMA_D_STR = 0x3833, - ALP_ORDER_ISOLAT_CAP_D_CAR = 0x3835, - ALP_ORDER_ISOLAT_SMA_D_CAR = 0x3835, - ALP_ORDER_ISOLAT_CAP_AFR_D = 0x3835, - - ALP_ORDER_ISOLAT_CAP_LIG_DZ = 0x3838, - ALP_ORDER_ISOLAT_CAP_D_SMA_Z = 0x3838, - ALP_ORDER_ISOLAT_SMA_LIG_DZ = 0x3838, - ALP_ORDER_ISOLAT_CAP_LIG_DZ_CAR = 0x383B, - ALP_ORDER_ISOLAT_CAP_D_SMA_Z_CAR = 0x383B, - ALP_ORDER_ISOLAT_SMA_LIG_DZ_CAR = 0x383B, - - ALP_ORDER_ISOLAT_CAP_E = 0x383E, - ALP_ORDER_ISOLAT_SMA_E = 0x383F, - ALP_ORDER_ISOLAT_CAP_E_DIA = 0x3840, - ALP_ORDER_ISOLAT_SMA_E_DIA = 0x3840, - ALP_ORDER_ISOLAT_CAP_E_ACU = 0x3842, - ALP_ORDER_ISOLAT_SMA_E_ACU = 0x3842, - ALP_ORDER_ISOLAT_CAP_E_GRA = 0x3844, - ALP_ORDER_ISOLAT_SMA_E_GRA = 0x3844, - ALP_ORDER_ISOLAT_CAP_E_CIR = 0x3846, - ALP_ORDER_ISOLAT_SMA_E_CIR = 0x3846, - ALP_ORDER_ISOLAT_CAP_E_MAC = 0x3848, - ALP_ORDER_ISOLAT_SMA_E_MAC = 0x3848, - ALP_ORDER_ISOLAT_CAP_E_BRE = 0x384A, - ALP_ORDER_ISOLAT_SMA_E_BRE = 0x384A, - ALP_ORDER_ISOLAT_CAP_E_OGO = 0x384C, - ALP_ORDER_ISOLAT_SMA_E_OGO = 0x384C, - ALP_ORDER_ISOLAT_CAP_E_DOA = 0x384E, - ALP_ORDER_ISOLAT_SMA_E_DOA = 0x384F, - ALP_ORDER_ISOLAT_CAP_E_CAR = 0x3850, - ALP_ORDER_ISOLAT_SMA_E_CAR = 0x3850, - - ALP_ORDER_ISOLAT_CAP_F = 0x3852, - ALP_ORDER_ISOLAT_SMA_F = 0x3853, - - ALP_ORDER_ISOLAT_CAP_G = 0x4854, - ALP_ORDER_ISOLAT_SMA_G = 0x4855, - ALP_ORDER_ISOLAT_CAP_G_STR = 0x4856, - ALP_ORDER_ISOLAT_SMA_G_STR = 0x4856, - ALP_ORDER_ISOLAT_CAP_G_CED = 0x4858, - ALP_ORDER_ISOLAT_SMA_G_CED = 0x4858, - ALP_ORDER_ISOLAT_CAP_G_ACU = 0x485A, - ALP_ORDER_ISOLAT_SMA_G_ACU = 0x485A, - ALP_ORDER_ISOLAT_CAP_G_CIR = 0x485C, - ALP_ORDER_ISOLAT_SMA_G_CIR = 0x485C, - ALP_ORDER_ISOLAT_CAP_G_BRE = 0x485E, - ALP_ORDER_ISOLAT_SMA_G_BRE = 0x485E, - ALP_ORDER_ISOLAT_CAP_G_DOA = 0x4860, - ALP_ORDER_ISOLAT_SMA_G_DOA = 0x4860, - ALP_ORDER_ISOLAT_CAP_G_CAR = 0x4862, - ALP_ORDER_ISOLAT_SMA_G_CAR = 0x4862, - - ALP_ORDER_ISOLAT_CAP_H = 0x4864, - ALP_ORDER_ISOLAT_SMA_H = 0x4865, - ALP_ORDER_ISOLAT_CAP_H_STR = 0x4866, - ALP_ORDER_ISOLAT_SMA_H_STR = 0x4866, - ALP_ORDER_ISOLAT_CAP_H_CIR = 0x4868, - ALP_ORDER_ISOLAT_SMA_H_CIR = 0x4868, - - ALP_ORDER_ISOLAT_CAP_I = 0x486A, - ALP_ORDER_ISOLAT_SMA_I = 0x486B, - ALP_ORDER_ISOLAT_CAP_I_DIA = 0x486C, - ALP_ORDER_ISOLAT_SMA_I_DIA = 0x486C, - ALP_ORDER_ISOLAT_CAP_I_STR = 0x486E, - ALP_ORDER_ISOLAT_CAP_I_ACU = 0x486F, - ALP_ORDER_ISOLAT_SMA_I_ACU = 0x4870, - ALP_ORDER_ISOLAT_CAP_I_GRA = 0x4870, - ALP_ORDER_ISOLAT_SMA_I_GRA = 0x4872, - ALP_ORDER_ISOLAT_CAP_I_CIR = 0x4873, - ALP_ORDER_ISOLAT_SMA_I_CIR = 0x4873, - ALP_ORDER_ISOLAT_CAP_I_TIL = 0x4875, - ALP_ORDER_ISOLAT_SMA_I_TIL = 0x4875, - ALP_ORDER_ISOLAT_CAP_I_MAC = 0x4877, - ALP_ORDER_ISOLAT_SMA_I_MAC = 0x4877, - ALP_ORDER_ISOLAT_CAP_I_BRE = 0x4879, - ALP_ORDER_ISOLAT_SMA_I_BRE = 0x4879, - ALP_ORDER_ISOLAT_CAP_I_OGO = 0x487B, - ALP_ORDER_ISOLAT_SMA_I_OGO = 0x487B, - ALP_ORDER_ISOLAT_CAP_I_DOA = 0x487D, - ALP_ORDER_ISOLAT_SMA_I_DOL = 0x487E, - ALP_ORDER_ISOLAT_CAP_I_CAR = 0x487F, - ALP_ORDER_ISOLAT_SMA_I_CAR = 0x487F, - - ALP_ORDER_ISOLAT_CAP_LIG_IJ = 0x4881, - ALP_ORDER_ISOLAT_SMA_LIG_IJ = 0x4881, - - ALP_ORDER_ISOLAT_CAP_J = 0x5883, - ALP_ORDER_ISOLAT_SMA_J = 0x5884, - ALP_ORDER_ISOLAT_CAP_J_CED = 0x5885, - ALP_ORDER_ISOLAT_SMA_J_CED = 0x5885, - ALP_ORDER_ISOLAT_CAP_J_CIR = 0x5887, - ALP_ORDER_ISOLAT_SMA_J_CIR = 0x5887, - ALP_ORDER_ISOLAT_SMA_J_CAR = 0x5889, - - ALP_ORDER_ISOLAT_CAP_K = 0x588A, - ALP_ORDER_ISOLAT_SMA_K = 0x588B, - ALP_ORDER_ISOLAT_CAP_K_CAR = 0x588C, - ALP_ORDER_ISOLAT_SMA_K_CAR = 0x588C, - - ALP_ORDER_ISOLAT_CAP_L = 0x588E, - ALP_ORDER_ISOLAT_SMA_L = 0x588F, - ALP_ORDER_ISOLAT_CAP_L_STR = 0x5890, - ALP_ORDER_ISOLAT_SMA_L_STR = 0x5890, - ALP_ORDER_ISOLAT_SMA_L_BAR = 0x5892, - ALP_ORDER_ISOLAT_CAP_L_CED = 0x5893, - ALP_ORDER_ISOLAT_SMA_L_CED = 0x5893, - ALP_ORDER_ISOLAT_CAP_L_ACU = 0x5895, - ALP_ORDER_ISOLAT_SMA_L_ACU = 0x5895, - ALP_ORDER_ISOLAT_CAP_L_DOM = 0x5897, - ALP_ORDER_ISOLAT_SMA_L_DOM = 0x5897, - ALP_ORDER_ISOLAT_CAP_L_CAR = 0x5899, - ALP_ORDER_ISOLAT_SMA_L_CAR = 0x5899, - - ALP_ORDER_ISOLAT_CAP_LIG_LJ = 0x589B, - ALP_ORDER_ISOLAT_CAP_L_SMA_J = 0x589B, - ALP_ORDER_ISOLAT_SMA_LIG_LJ = 0x589B, - - ALP_ORDER_ISOLAT_CAP_M = 0x689E, - ALP_ORDER_ISOLAT_SMA_M = 0x689F, - - ALP_ORDER_ISOLAT_CAP_N = 0x68A0, - ALP_ORDER_ISOLAT_SMA_N = 0x68A1, - ALP_ORDER_ISOLAT_CAP_N_CED = 0x68A2, - ALP_ORDER_ISOLAT_SMA_N_CED = 0x68A2, - ALP_ORDER_ISOLAT_CAP_N_ACU = 0x68A4, - ALP_ORDER_ISOLAT_SMA_N_ACU = 0x68A4, - ALP_ORDER_ISOLAT_CAP_N_TIL = 0x68A6, - ALP_ORDER_ISOLAT_SMA_N_TIL = 0x68A6, - ALP_ORDER_ISOLAT_CAP_N_CAR = 0x68A8, - ALP_ORDER_ISOLAT_SMA_N_CAR = 0x68A8, - ALP_ORDER_ISOLAT_SMA_N_APO = 0x68AA, - - ALP_ORDER_ISOLAT_CAP_LIG_NJ = 0x68AB, - ALP_ORDER_ISOLAT_CAP_N_SMA_J = 0x68AB, - ALP_ORDER_ISOLAT_SMA_LIG_NJ = 0x68AB, - - ALP_ORDER_ISOLAT_CAP_O = 0x68AE, - ALP_ORDER_ISOLAT_SMA_O = 0x68AF, - ALP_ORDER_ISOLAT_CAP_O_DIA = 0x68B0, - ALP_ORDER_ISOLAT_SMA_O_DIA = 0x68B0, - ALP_ORDER_ISOLAT_CAP_O_STR = 0x68B2, - ALP_ORDER_ISOLAT_SMA_O_STR = 0x68B2, - ALP_ORDER_ISOLAT_CAP_O_ACU = 0x68B4, - ALP_ORDER_ISOLAT_SMA_O_ACU = 0x68B4, - ALP_ORDER_ISOLAT_CAP_O_GRA = 0x68B6, - ALP_ORDER_ISOLAT_SMA_O_GRA = 0x68B6, - ALP_ORDER_ISOLAT_CAP_O_CIR = 0x68B8, - ALP_ORDER_ISOLAT_SMA_O_CIR = 0x68B8, - ALP_ORDER_ISOLAT_CAP_O_TIL = 0x68BA, - ALP_ORDER_ISOLAT_SMA_O_TIL = 0x68BA, - ALP_ORDER_ISOLAT_CAP_O_MAC = 0x68BC, - ALP_ORDER_ISOLAT_SMA_O_MAC = 0x68BC, - ALP_ORDER_ISOLAT_CAP_O_BRE = 0x68BE, - ALP_ORDER_ISOLAT_SMA_O_BRE = 0x68BE, - ALP_ORDER_ISOLAT_CAP_O_DOU = 0x68C0, - ALP_ORDER_ISOLAT_SMA_O_DOU = 0x68C0, - ALP_ORDER_ISOLAT_CAP_O_OGO = 0x68C2, - ALP_ORDER_ISOLAT_SMA_O_OGO = 0x68C2, - ALP_ORDER_ISOLAT_CAP_O_CAR = 0x68C4, - ALP_ORDER_ISOLAT_SMA_O_CAR = 0x68C4, - ALP_ORDER_ISOLAT_CAP_O_HOR = 0x68C6, - ALP_ORDER_ISOLAT_SMA_O_HOR = 0x68C6, - ALP_ORDER_ISOLAT_CAP_O_STR_ACU = 0x68C8, - ALP_ORDER_ISOLAT_SMA_O_STR_ACU = 0x68C8, - ALP_ORDER_ISOLAT_CAP_O_OGO_MAC = 0x68CA, - ALP_ORDER_ISOLAT_SMA_O_OGO_MAC = 0x68CA, - - ALP_ORDER_ISOLAT_CAP_LIG_OE = 0x68CC, - ALP_ORDER_ISOLAT_SMA_LIG_OE = 0x68CC, - - ALP_ORDER_ISOLAT_CAP_P = 0x78CE, - ALP_ORDER_ISOLAT_SMA_P = 0x78CF, - - ALP_ORDER_ISOLAT_CAP_Q = 0x78D0, - ALP_ORDER_ISOLAT_SMA_Q = 0x78D1, - - ALP_ORDER_ISOLAT_CAP_R = 0x78D2, - ALP_ORDER_ISOLAT_SMA_R = 0x78D3, - ALP_ORDER_ISOLAT_CAP_R_CED = 0x78D4, - ALP_ORDER_ISOLAT_SMA_R_CED = 0x78D4, - ALP_ORDER_ISOLAT_CAP_R_ACU = 0x78D6, - ALP_ORDER_ISOLAT_SMA_R_ACU = 0x78D6, - ALP_ORDER_ISOLAT_CAP_R_CAR = 0x78D8, - ALP_ORDER_ISOLAT_SMA_R_CAR = 0x78D8, - - ALP_ORDER_ISOLAT_CAP_S = 0x78DA, - ALP_ORDER_ISOLAT_SMA_S = 0x78DB, - ALP_ORDER_ISOLAT_CAP_S_CED = 0x78DC, - ALP_ORDER_ISOLAT_SMA_S_CED = 0x78DC, - ALP_ORDER_ISOLAT_CAP_S_ACU = 0x78DE, - ALP_ORDER_ISOLAT_SMA_S_ACU = 0x78DF, - ALP_ORDER_ISOLAT_CAP_S_CIR = 0x78E0, - ALP_ORDER_ISOLAT_SMA_S_CIR = 0x78E0, - ALP_ORDER_ISOLAT_CAP_S_CAR = 0x78E2, - ALP_ORDER_ISOLAT_SMA_S_CAR = 0x78E2, - ALP_ORDER_ISOLAT_SMA_SHARP_S = 0x78E4, - ALP_ORDER_ISOLAT_SMA_LONG_S = 0x78E5, - - ALP_ORDER_ISOLAT_CAP_T = 0x88E6, - ALP_ORDER_ISOLAT_SMA_T = 0x88E7, - ALP_ORDER_ISOLAT_CAP_T_STR = 0x88E8, - ALP_ORDER_ISOLAT_SMA_T_STR = 0x88E8, - ALP_ORDER_ISOLAT_CAP_T_CED = 0x88EA, - ALP_ORDER_ISOLAT_SMA_T_CED = 0x88EA, - ALP_ORDER_ISOLAT_CAP_T_CAR = 0x88EC, - ALP_ORDER_ISOLAT_SMA_T_CAR = 0x88EC, - - ALP_ORDER_ISOLAT_CAP_U = 0x88EE, - ALP_ORDER_ISOLAT_SMA_U = 0x88EF, - ALP_ORDER_ISOLAT_CAP_U_DIA = 0x88F0, - ALP_ORDER_ISOLAT_SMA_U_DIA = 0x88F0, - ALP_ORDER_ISOLAT_CAP_U_ACU = 0x88F2, - ALP_ORDER_ISOLAT_SMA_U_ACU = 0x88F2, - ALP_ORDER_ISOLAT_CAP_U_GRA = 0x88F4, - ALP_ORDER_ISOLAT_SMA_U_GRA = 0x88F4, - ALP_ORDER_ISOLAT_CAP_U_CIR = 0x88F6, - ALP_ORDER_ISOLAT_SMA_U_CIR = 0x88F6, - ALP_ORDER_ISOLAT_CAP_U_RIN = 0x88F8, - ALP_ORDER_ISOLAT_SMA_U_RIN = 0x88F8, - ALP_ORDER_ISOLAT_CAP_U_TIL = 0x88FA, - ALP_ORDER_ISOLAT_SMA_U_TIL = 0x88FA, - ALP_ORDER_ISOLAT_CAP_U_MAC = 0x88FC, - ALP_ORDER_ISOLAT_SMA_U_MAC = 0x88FC, - ALP_ORDER_ISOLAT_CAP_U_BRE = 0x88FE, - ALP_ORDER_ISOLAT_SMA_U_BRE = 0x88FE, - ALP_ORDER_ISOLAT_CAP_U_DOU = 0x8900, - ALP_ORDER_ISOLAT_SMA_U_DOU = 0x8900, - ALP_ORDER_ISOLAT_CAP_U_OGO = 0x8902, - ALP_ORDER_ISOLAT_SMA_U_OGO = 0x8902, - ALP_ORDER_ISOLAT_CAP_U_CAR = 0x8904, - ALP_ORDER_ISOLAT_SMA_U_CAR = 0x8904, - ALP_ORDER_ISOLAT_CAP_U_HOR = 0x8906, - ALP_ORDER_ISOLAT_SMA_U_HOR = 0x8906, - ALP_ORDER_ISOLAT_CAP_U_DIA_ACU = 0x8908, - ALP_ORDER_ISOLAT_SMA_U_DIA_ACU = 0x8908, - ALP_ORDER_ISOLAT_CAP_U_DIA_GRA = 0x890A, - ALP_ORDER_ISOLAT_SMA_U_DIA_GRA = 0x890A, - ALP_ORDER_ISOLAT_CAP_U_DIA_MAC = 0x890C, - ALP_ORDER_ISOLAT_SMA_U_DIA_MAC = 0x890C, - ALP_ORDER_ISOLAT_CAP_U_DIA_CAR = 0x890E, - ALP_ORDER_ISOLAT_SMA_U_DIA_CAR = 0x890E, - - ALP_ORDER_ISOLAT_CAP_V = 0x8910, - ALP_ORDER_ISOLAT_SMA_V = 0x8911, - - ALP_ORDER_ISOLAT_CAP_W = 0x9912, - ALP_ORDER_ISOLAT_SMA_W = 0x9913, - ALP_ORDER_ISOLAT_CAP_W_CIR = 0x9914, - ALP_ORDER_ISOLAT_SMA_W_CIR = 0x9914, - - ALP_ORDER_ISOLAT_CAP_X = 0x9916, - ALP_ORDER_ISOLAT_SMA_X = 0x9917, - - ALP_ORDER_ISOLAT_CAP_Y = 0x9918, - ALP_ORDER_ISOLAT_SMA_Y = 0x9919, - ALP_ORDER_ISOLAT_CAP_Y_DIA = 0x991A, - ALP_ORDER_ISOLAT_SMA_Y_DIA = 0x991A, - ALP_ORDER_ISOLAT_CAP_Y_ACU = 0x991C, - ALP_ORDER_ISOLAT_SMA_Y_ACU = 0x991C, - ALP_ORDER_ISOLAT_CAP_Y_CIR = 0x991E, - ALP_ORDER_ISOLAT_SMA_Y_CIR = 0x991E, - - ALP_ORDER_ISOLAT_CAP_Z = 0x9920, - ALP_ORDER_ISOLAT_SMA_Z = 0x9921, - ALP_ORDER_ISOLAT_CAP_Z_STR = 0x9922, - ALP_ORDER_ISOLAT_SMA_Z_STR = 0x9922, - ALP_ORDER_ISOLAT_CAP_Z_ACU = 0x9924, - ALP_ORDER_ISOLAT_SMA_Z_ACU = 0x9924, - ALP_ORDER_ISOLAT_CAP_Z_DOA = 0x9926, - ALP_ORDER_ISOLAT_SMA_Z_DOA = 0x9926, - ALP_ORDER_ISOLAT_CAP_Z_CAR = 0x9928, - ALP_ORDER_ISOLAT_SMA_Z_CAR = 0x9929, - - /* Symbols and punctation */ - ALP_ORDER_SYMB_COMMERCIAL_AT = 0x1E00, - ALP_ORDER_SYMB_POUND_SIGN = 0x1E01, - ALP_ORDER_SYMB_DOLLAR_SIGN = 0x1E02, - ALP_ORDER_SYMB_CENT_SIGN = 0xFE03, - ALP_ORDER_SYMB_YEN_SIGN = 0x1E04, - ALP_ORDER_SYMB_SPACE = 0x1E05, - ALP_ORDER_SYMB_NO_BREAK_SPACE = 0xFE06, - ALP_ORDER_SYMB_LOW_LINE = 0xFE07, - ALP_ORDER_SYMB_EXCLAMATION_MARK = 0x0E08, - ALP_ORDER_SYMB_QUOTATION_MARK = 0x0E09, - ALP_ORDER_SYMB_NUMBER_SIGN = 0x1E0A, - ALP_ORDER_SYMB_CURRENCY_SIGN = 0x1E0B, - ALP_ORDER_SYMB_PERCENT_SIGN = 0x0E0C, - ALP_ORDER_SYMB_AMPERSAND = 0x1E0D, - ALP_ORDER_SYMB_APOSTROPHE = 0x0E0E, - ALP_ORDER_SYMB_LEFT_PARENTHESIS = 0x1E0F, - ALP_ORDER_SYMB_RIGHT_PARENTHESIS = 0x1E10, - ALP_ORDER_SYMB_LEFT_SQUARE_BRACKET = 0xFE11, - ALP_ORDER_SYMB_RIGHT_SQUARE_BRACKET = 0xFE12, - ALP_ORDER_SYMB_LEFT_CURLY_BRACKET = 0xFE13, - ALP_ORDER_SYMB_RIGHT_CURLY_BRACKET = 0xFE14, - ALP_ORDER_SYMB_LEFT_POINTING_DBL_ANGLE_QUOTE_MARK = 0xFE15, - ALP_ORDER_SYMB_RIGHT_POINTING_DBL_ANGLE_QUOTE_MARK = 0xFE16, - ALP_ORDER_SYMB_ASTERISK = 0x0E17, - ALP_ORDER_SYMB_PLUS_SIGN = 0x0E18, - ALP_ORDER_SYMB_PLUS_MINUS_SIGN = 0xFE19, - ALP_ORDER_SYMB_COMMA = 0x0E1A, - ALP_ORDER_SYMB_HYPHEN_MINUS = 0x0E1B, - ALP_ORDER_SYMB_FULL_STOP = 0x0E1C, - ALP_ORDER_SYMB_MULTIPLICATION_SIGN = 0xFE1D, - ALP_ORDER_SYMB_DIVISION_SIGN = 0xFE1E, - ALP_ORDER_SYMB_VERTICAL_LINE = 0xFE1F, - ALP_ORDER_SYMB_BROKEN_BAR = 0xFE20, - ALP_ORDER_SYMB_SOLIDUS = 0x0E21, - ALP_ORDER_SYMB_REVERSED_SOLIDUS = 0xFE22, - ALP_ORDER_SYMB_COLON = 0x0E23, - ALP_ORDER_SYMB_SEMICOLON = 0xF0E4, - ALP_ORDER_SYMB_LESS_THAN_SIGN = 0x1E25, - ALP_ORDER_SYMB_EQUALS_SIGN = 0x1E26, - ALP_ORDER_SYMB_GREATER_THAN_SIGN = 0x1E27, - ALP_ORDER_SYMB_QUESTION_MARK = 0x0E28, - ALP_ORDER_SYMB_INVERTED_EXCLAMATION_MARK = 0x0E29, - ALP_ORDER_SYMB_SECTION_SIGN = 0x1E2A, - ALP_ORDER_SYMB_INVERTED_QUESTION_MARK = 0x0E2B, - ALP_ORDER_SYMB_COPYRIGHT_SIGN = 0xFE2C, - ALP_ORDER_SYMB_REGISTERED_SIGN = 0xFE2D, - ALP_ORDER_SYMB_VULGAR_FRACTION_ONE_QUARTER = 0xFE2E, - ALP_ORDER_SYMB_VULGAR_FRACTION_ONE_HALF = 0xFE2F, - ALP_ORDER_SYMB_VULGAR_FRACTION_THREE_QUARTER = 0xFE30, - ALP_ORDER_SYMB_SUPERSCRIPT_ONE = 0xFE31, - ALP_ORDER_SYMB_SUPERSCRIPT_TWO = 0xFE32, - ALP_ORDER_SYMB_SUPERSCRIPT_THREE = 0xFE33, - ALP_ORDER_SYMB_DEGREE_SIGN = 0xFE34, - ALP_ORDER_SYMB_MICRO_SIGN = 0xFE35, - ALP_ORDER_SYMB_NOT_SIGN = 0xFE36, - ALP_ORDER_SYMB_SOFT_HYPHEN = 0xFE37, - ALP_ORDER_SYMB_MASCULINE_ORDINAL_INDICATOR = 0xFE38, - ALP_ORDER_SYMB_FEMININE_ORDINAL_INDICATOR = 0xFE39, - ALP_ORDER_SYMB_DIARESIS = 0xFE3A, - ALP_ORDER_SYMB_CEDILLA = 0xFE3B, - ALP_ORDER_SYMB_ACUTE_ACCENT = 0xFE3C, - ALP_ORDER_SYMB_GRAVE_ACCENT = 0xFE3D, - ALP_ORDER_SYMB_CIRCUMFLEX_ACCENT = 0xFE3E, - ALP_ORDER_SYMB_TILDE = 0xFE3F, - ALP_ORDER_SYMB_MACRON = 0xFE40, - ALP_ORDER_SYMB_MIDDLE_DOT = 0xFE41, - - ALP_ORDER_HALFWIDTH_KATAKANA_MIDDLE_DOT = 0xFF65, - ALP_ORDER_HALFWIDTH_KATAKANA_SMALL_A = 0xFF67, - ALP_ORDER_HALFWIDTH_KATAKANA_SMALL_I = 0xFF68, - ALP_ORDER_HALFWIDTH_KATAKANA_SMALL_U = 0xFF69, - ALP_ORDER_HALFWIDTH_KATAKANA_SMALL_E = 0xFF6A, - ALP_ORDER_HALFWIDTH_KATAKANA_SMALL_O = 0xFF6B, - ALP_ORDER_HALFWIDTH_KATAKANA_SMALL_YA = 0xFF6C, - ALP_ORDER_HALFWIDTH_KATAKANA_SMALL_YU = 0xFF6D, - ALP_ORDER_HALFWIDTH_KATAKANA_SMALL_YO = 0xFF6E, - ALP_ORDER_HALFWIDTH_KATAKANA_SMALL_TU = 0xFF6F, - ALP_ORDER_HALFWIDTH_KATAKANA_HIRAGANA_SOUND_MARK = 0xFF70, - ALP_ORDER_HALFWIDTH_KATAKANA_A = 0xFF71, - ALP_ORDER_HALFWIDTH_KATAKANA_I = 0xFF72, - ALP_ORDER_HALFWIDTH_KATAKANA_U = 0xFF73, - ALP_ORDER_HALFWIDTH_KATAKANA_E = 0xFF74, - ALP_ORDER_HALFWIDTH_KATAKANA_O = 0xFF75, - ALP_ORDER_HALFWIDTH_KATAKANA_KA = 0xFF76, - ALP_ORDER_HALFWIDTH_KATAKANA_KI = 0xFF77, - ALP_ORDER_HALFWIDTH_KATAKANA_KU = 0xFF78, - ALP_ORDER_HALFWIDTH_KATAKANA_KE = 0xFF79, - ALP_ORDER_HALFWIDTH_KATAKANA_KO = 0xFF7A, - ALP_ORDER_HALFWIDTH_KATAKANA_SA = 0xFF7B, - ALP_ORDER_HALFWIDTH_KATAKANA_SI = 0xFF7C, - ALP_ORDER_HALFWIDTH_KATAKANA_SU = 0XFF7D, - ALP_ORDER_HALFWIDTH_KATAKANA_SE = 0xFF7E, - ALP_ORDER_HALFWIDTH_KATAKANA_SO = 0xFF7F, - ALP_ORDER_HALFWIDTH_KATAKANA_TA = 0XFF80, - ALP_ORDER_HALFWIDTH_KATAKANA_TI = 0xFF81, - ALP_ORDER_HALFWIDTH_KATAKANA_TU = 0xFF82, - ALP_ORDER_HALFWIDTH_KATAKANA_TE = 0xFF83, - ALP_ORDER_HALFWIDTH_KATAKANA_TO = 0xFF84, - ALP_ORDER_HALFWIDTH_KATAKANA_NA = 0xFF85, - ALP_ORDER_HALFWIDTH_KATAKANA_NI = 0xFF86, - ALP_ORDER_HALFWIDTH_KATAKANA_NU = 0xFF87, - ALP_ORDER_HALFWIDTH_KATAKANA_NE = 0xFF88, - ALP_ORDER_HALFWIDTH_KATAKANA_NO = 0xFF89, - ALP_ORDER_HALFWIDTH_KATAKANA_HA = 0xFF8A, - ALP_ORDER_HALFWIDTH_KATAKANA_HI = 0xFF8B, - ALP_ORDER_HALFWIDTH_KATAKANA_HU = 0xFF8C, - ALP_ORDER_HALFWIDTH_KATAKANA_HE = 0xFF8D, - ALP_ORDER_HALFWIDTH_KATAKANA_HO = 0xFF8E, - ALP_ORDER_HALFWIDTH_KATAKANA_MA = 0xFF8F, - ALP_ORDER_HALFWIDTH_KATAKANA_MI = 0xFF90, - ALP_ORDER_HALFWIDTH_KATAKANA_MU = 0xFF91, - ALP_ORDER_HALFWIDTH_KATAKANA_ME = 0xFF92, - ALP_ORDER_HALFWIDTH_KATAKANA_MO = 0xFF93, - ALP_ORDER_HALFWIDTH_KATAKANA_YA = 0xFF94, - ALP_ORDER_HALFWIDTH_KATAKANA_YU = 0xFF95, - ALP_ORDER_HALFWIDTH_KATAKANA_YO = 0xFF96, - ALP_ORDER_HALFWIDTH_KATAKANA_RA = 0xFF97, - ALP_ORDER_HALFWIDTH_KATAKANA_RI = 0xFF98, - ALP_ORDER_HALFWIDTH_KATAKANA_RU = 0xFF99, - ALP_ORDER_HALFWIDTH_KATAKANA_RE = 0xFF9A, - ALP_ORDER_HALFWIDTH_KATAKANA_RO = 0xFF9B, - ALP_ORDER_HALFWIDTH_KATAKANA_WA = 0xFF9C, - ALP_ORDER_HALFWIDTH_KATAKANA_WO = 0xFF9D, - ALP_ORDER_HALFWIDTH_KATAKANA_N = 0xFF9E, - ALP_ORDER_HALFWIDTH_KATAKANA_VOICED_SOUND_MARK = 0xFF9F, - ALP_ORDER_HALFWIDTH_KATAKANA_SEMI_VOICED_SOUND_MARK = 0xFFA0, - - /* Control characters */ - ALP_ORDER_CTRL_LINE_FEED = 0xFFFB, - ALP_ORDER_CTRL_CARRIAGE_RETURN = 0xFFFC, - ALP_ORDER_CTRL_DEVICE_CONTROL_1 = 0xFFFD, - ALP_ORDER_CTRL_ESCAPE = 0xFFFE, - - ALP_ORDER_UNDEFINED_WEIGHT = 0xFFFF -}; +#include "collation.h" -const UnicodeToAlphaOrder - garUnicodeToAlphaOrderTable[WSC_UNICODE_TO_ALPHA_ORDER_COUNT] = { - {0x0000, ALP_ORDER_NULL}, - {0x000A, ALP_ORDER_CTRL_LINE_FEED}, - {0x000D, ALP_ORDER_CTRL_CARRIAGE_RETURN}, - {0x0011, ALP_ORDER_CTRL_DEVICE_CONTROL_1}, - {0x001B, ALP_ORDER_CTRL_ESCAPE}, - {0x0020, ALP_ORDER_SYMB_SPACE}, - {0x0021, ALP_ORDER_SYMB_EXCLAMATION_MARK}, - {0x0022, ALP_ORDER_SYMB_QUOTATION_MARK}, - {0x0023, ALP_ORDER_SYMB_NUMBER_SIGN}, - {0x0024, ALP_ORDER_SYMB_DOLLAR_SIGN}, - {0x0025, ALP_ORDER_SYMB_PERCENT_SIGN}, - {0x0026, ALP_ORDER_SYMB_AMPERSAND}, - {0x0027, ALP_ORDER_SYMB_APOSTROPHE}, - {0x0028, ALP_ORDER_SYMB_LEFT_PARENTHESIS}, - {0x0029, ALP_ORDER_SYMB_RIGHT_PARENTHESIS}, - {0x002A, ALP_ORDER_SYMB_ASTERISK}, - {0x002B, ALP_ORDER_SYMB_PLUS_SIGN}, - {0x002C, ALP_ORDER_SYMB_COMMA}, - {0x002D, ALP_ORDER_SYMB_HYPHEN_MINUS}, - {0x002E, ALP_ORDER_SYMB_FULL_STOP}, - {0x002F, ALP_ORDER_SYMB_SOLIDUS}, - {0x0030, ALP_ORDER_DIGIT_ZERO}, - {0x0031, ALP_ORDER_DIGIT_ONE}, - {0x0032, ALP_ORDER_DIGIT_TWO}, - {0x0033, ALP_ORDER_DIGIT_THREE}, - {0x0034, ALP_ORDER_DIGIT_FOUR}, - {0x0035, ALP_ORDER_DIGIT_FIVE}, - {0x0036, ALP_ORDER_DIGIT_SIX}, - {0x0037, ALP_ORDER_DIGIT_SEVEN}, - {0x0038, ALP_ORDER_DIGIT_EIGHT}, - {0x0039, ALP_ORDER_DIGIT_NINE}, - {0x003A, ALP_ORDER_SYMB_COLON}, - {0x003B, ALP_ORDER_SYMB_SEMICOLON}, - {0x003C, ALP_ORDER_SYMB_LESS_THAN_SIGN}, - {0x003D, ALP_ORDER_SYMB_EQUALS_SIGN}, - {0x003E, ALP_ORDER_SYMB_GREATER_THAN_SIGN}, - {0x003F, ALP_ORDER_SYMB_QUESTION_MARK}, - {0x0040, ALP_ORDER_SYMB_COMMERCIAL_AT}, - {0x0041, ALP_ORDER_ISOLAT_CAP_A}, - {0x0042, ALP_ORDER_ISOLAT_CAP_B}, - {0x0043, ALP_ORDER_ISOLAT_CAP_C}, - {0x0044, ALP_ORDER_ISOLAT_CAP_D}, - {0x0045, ALP_ORDER_ISOLAT_CAP_E}, - {0x0046, ALP_ORDER_ISOLAT_CAP_F}, - {0x0047, ALP_ORDER_ISOLAT_CAP_G}, - {0x0048, ALP_ORDER_ISOLAT_CAP_H}, - {0x0049, ALP_ORDER_ISOLAT_CAP_I}, - {0x004A, ALP_ORDER_ISOLAT_CAP_J}, - {0x004B, ALP_ORDER_ISOLAT_CAP_K}, - {0x004C, ALP_ORDER_ISOLAT_CAP_L}, - {0x004D, ALP_ORDER_ISOLAT_CAP_M}, - {0x004E, ALP_ORDER_ISOLAT_CAP_N}, - {0x004F, ALP_ORDER_ISOLAT_CAP_O}, - {0x0050, ALP_ORDER_ISOLAT_CAP_P}, - {0x0051, ALP_ORDER_ISOLAT_CAP_Q}, - {0x0052, ALP_ORDER_ISOLAT_CAP_R}, - {0x0053, ALP_ORDER_ISOLAT_CAP_S}, - {0x0054, ALP_ORDER_ISOLAT_CAP_T}, - {0x0055, ALP_ORDER_ISOLAT_CAP_U}, - {0x0056, ALP_ORDER_ISOLAT_CAP_V}, - {0x0057, ALP_ORDER_ISOLAT_CAP_W}, - {0x0058, ALP_ORDER_ISOLAT_CAP_X}, - {0x0059, ALP_ORDER_ISOLAT_CAP_Y}, - {0x005A, ALP_ORDER_ISOLAT_CAP_Z}, - {0x005B, ALP_ORDER_SYMB_LEFT_SQUARE_BRACKET}, - {0x005C, ALP_ORDER_SYMB_REVERSED_SOLIDUS}, - {0x005D, ALP_ORDER_SYMB_RIGHT_SQUARE_BRACKET}, - {0x005E, ALP_ORDER_SYMB_CIRCUMFLEX_ACCENT}, - {0x005F, ALP_ORDER_SYMB_LOW_LINE}, - {0x0060, ALP_ORDER_SYMB_GRAVE_ACCENT}, - {0x0061, ALP_ORDER_ISOLAT_SMA_A}, - {0x0062, ALP_ORDER_ISOLAT_SMA_B}, - {0x0063, ALP_ORDER_ISOLAT_SMA_C}, - {0x0064, ALP_ORDER_ISOLAT_SMA_D}, - {0x0065, ALP_ORDER_ISOLAT_SMA_E}, - {0x0066, ALP_ORDER_ISOLAT_SMA_F}, - {0x0067, ALP_ORDER_ISOLAT_SMA_G}, - {0x0068, ALP_ORDER_ISOLAT_SMA_H}, - {0x0069, ALP_ORDER_ISOLAT_SMA_I}, - {0x006A, ALP_ORDER_ISOLAT_SMA_J}, - {0x006B, ALP_ORDER_ISOLAT_SMA_K}, - {0x006C, ALP_ORDER_ISOLAT_SMA_L}, - {0x006D, ALP_ORDER_ISOLAT_SMA_M}, - {0x006E, ALP_ORDER_ISOLAT_SMA_N}, - {0x006F, ALP_ORDER_ISOLAT_SMA_O}, - {0x0070, ALP_ORDER_ISOLAT_SMA_P}, - {0x0071, ALP_ORDER_ISOLAT_SMA_Q}, - {0x0072, ALP_ORDER_ISOLAT_SMA_R}, - {0x0073, ALP_ORDER_ISOLAT_SMA_S}, - {0x0074, ALP_ORDER_ISOLAT_SMA_T}, - {0x0075, ALP_ORDER_ISOLAT_SMA_U}, - {0x0076, ALP_ORDER_ISOLAT_SMA_V}, - {0x0077, ALP_ORDER_ISOLAT_SMA_W}, - {0x0078, ALP_ORDER_ISOLAT_SMA_X}, - {0x0079, ALP_ORDER_ISOLAT_SMA_Y}, - {0x007A, ALP_ORDER_ISOLAT_SMA_Z}, - {0x007B, ALP_ORDER_SYMB_LEFT_CURLY_BRACKET}, - {0x007C, ALP_ORDER_SYMB_VERTICAL_LINE}, - {0x007D, ALP_ORDER_SYMB_RIGHT_CURLY_BRACKET}, - {0x007E, ALP_ORDER_SYMB_TILDE}, - {0x00A0, ALP_ORDER_SYMB_NO_BREAK_SPACE}, - {0x00A1, ALP_ORDER_SYMB_INVERTED_EXCLAMATION_MARK}, - {0x00A2, ALP_ORDER_SYMB_CENT_SIGN}, - {0x00A3, ALP_ORDER_SYMB_POUND_SIGN}, - {0x00A4, ALP_ORDER_SYMB_CURRENCY_SIGN}, - {0x00A5, ALP_ORDER_SYMB_YEN_SIGN}, - {0x00A6, ALP_ORDER_SYMB_BROKEN_BAR}, - {0x00A7, ALP_ORDER_SYMB_SECTION_SIGN}, - {0x00A8, ALP_ORDER_SYMB_DIARESIS}, - {0x00A9, ALP_ORDER_SYMB_COPYRIGHT_SIGN}, - {0x00AA, ALP_ORDER_SYMB_FEMININE_ORDINAL_INDICATOR}, - {0x00AB, ALP_ORDER_SYMB_LEFT_POINTING_DBL_ANGLE_QUOTE_MARK}, - {0x00AC, ALP_ORDER_SYMB_NOT_SIGN}, - {0x00AD, ALP_ORDER_SYMB_SOFT_HYPHEN}, - {0x00AE, ALP_ORDER_SYMB_REGISTERED_SIGN}, - {0x00AF, ALP_ORDER_SYMB_MACRON}, - {0x00B0, ALP_ORDER_SYMB_DEGREE_SIGN}, - {0x00B1, ALP_ORDER_SYMB_PLUS_MINUS_SIGN}, - {0x00B2, ALP_ORDER_SYMB_SUPERSCRIPT_TWO}, - {0x00B3, ALP_ORDER_SYMB_SUPERSCRIPT_THREE}, - {0x00B4, ALP_ORDER_SYMB_ACUTE_ACCENT}, - {0x00B6, ALP_ORDER_SYMB_MICRO_SIGN}, - {0x00B7, ALP_ORDER_SYMB_MIDDLE_DOT}, - {0x00B8, ALP_ORDER_SYMB_CEDILLA}, - {0x00B9, ALP_ORDER_SYMB_SUPERSCRIPT_ONE}, - {0x00BA, ALP_ORDER_SYMB_MASCULINE_ORDINAL_INDICATOR}, - {0x00BB, ALP_ORDER_SYMB_RIGHT_POINTING_DBL_ANGLE_QUOTE_MARK}, - {0x00BC, ALP_ORDER_SYMB_VULGAR_FRACTION_ONE_QUARTER}, - {0x00BD, ALP_ORDER_SYMB_VULGAR_FRACTION_ONE_HALF}, - {0x00BE, ALP_ORDER_SYMB_VULGAR_FRACTION_THREE_QUARTER}, - {0x00BF, ALP_ORDER_SYMB_INVERTED_QUESTION_MARK}, - {0x00C0, ALP_ORDER_ISOLAT_CAP_A_GRA}, - {0x00C1, ALP_ORDER_ISOLAT_CAP_A_ACU}, - {0x00C2, ALP_ORDER_ISOLAT_CAP_A_CIR}, - {0x00C3, ALP_ORDER_ISOLAT_CAP_A_TIL}, - {0x00C4, ALP_ORDER_ISOLAT_CAP_A_DIA}, - {0x00C5, ALP_ORDER_ISOLAT_CAP_A_RIN}, - {0x00C6, ALP_ORDER_ISOLAT_CAP_LIG_AE}, - {0x00C7, ALP_ORDER_ISOLAT_CAP_C_CED}, - {0x00C8, ALP_ORDER_ISOLAT_CAP_E_GRA}, - {0x00C9, ALP_ORDER_ISOLAT_CAP_E_ACU}, - {0x00CA, ALP_ORDER_ISOLAT_CAP_E_CIR}, - {0x00CB, ALP_ORDER_ISOLAT_CAP_E_DIA}, - {0x00CC, ALP_ORDER_ISOLAT_CAP_I_GRA}, - {0x00CD, ALP_ORDER_ISOLAT_CAP_I_ACU}, - {0x00CE, ALP_ORDER_ISOLAT_CAP_I_CIR}, - {0x00CF, ALP_ORDER_ISOLAT_CAP_I_DIA}, - {0x00D1, ALP_ORDER_ISOLAT_CAP_N_TIL}, - {0x00D2, ALP_ORDER_ISOLAT_CAP_O_GRA}, - {0x00D3, ALP_ORDER_ISOLAT_CAP_O_ACU}, - {0x00D4, ALP_ORDER_ISOLAT_CAP_O_CIR}, - {0x00D5, ALP_ORDER_ISOLAT_CAP_O_TIL}, - {0x00D6, ALP_ORDER_ISOLAT_CAP_O_DIA}, - {0x00D7, ALP_ORDER_SYMB_MULTIPLICATION_SIGN}, - {0x00D8, ALP_ORDER_ISOLAT_CAP_O_STR}, - {0x00D9, ALP_ORDER_ISOLAT_CAP_U_GRA}, - {0x00DA, ALP_ORDER_ISOLAT_CAP_U_ACU}, - {0x00DB, ALP_ORDER_ISOLAT_CAP_U_CIR}, - {0x00DC, ALP_ORDER_ISOLAT_CAP_U_DIA}, - {0x00DD, ALP_ORDER_ISOLAT_CAP_Y_ACU}, - {0x00DF, ALP_ORDER_ISOLAT_SMA_SHARP_S}, - {0x00E0, ALP_ORDER_ISOLAT_SMA_A_GRA}, - {0x00E1, ALP_ORDER_ISOLAT_SMA_A_ACU}, - {0x00E2, ALP_ORDER_ISOLAT_SMA_A_CIR}, - {0x00E3, ALP_ORDER_ISOLAT_SMA_A_TIL}, - {0x00E4, ALP_ORDER_ISOLAT_SMA_A_DIA}, - {0x00E5, ALP_ORDER_ISOLAT_SMA_A_RIN}, - {0x00E6, ALP_ORDER_ISOLAT_SMA_LIG_AE}, - {0x00E7, ALP_ORDER_ISOLAT_SMA_C_CED}, - {0x00E8, ALP_ORDER_ISOLAT_SMA_E_GRA}, - {0x00E9, ALP_ORDER_ISOLAT_SMA_E_ACU}, - {0x00EA, ALP_ORDER_ISOLAT_SMA_E_CIR}, - {0x00EB, ALP_ORDER_ISOLAT_SMA_E_DIA}, - {0x00EC, ALP_ORDER_ISOLAT_SMA_I_GRA}, - {0x00ED, ALP_ORDER_ISOLAT_SMA_I_ACU}, - {0x00EE, ALP_ORDER_ISOLAT_SMA_I_CIR}, - {0x00EF, ALP_ORDER_ISOLAT_SMA_I_DIA}, - {0x00F1, ALP_ORDER_ISOLAT_SMA_N_TIL}, - {0x00F2, ALP_ORDER_ISOLAT_SMA_O_GRA}, - {0x00F3, ALP_ORDER_ISOLAT_SMA_O_ACU}, - {0x00F4, ALP_ORDER_ISOLAT_SMA_O_CIR}, - {0x00F5, ALP_ORDER_ISOLAT_SMA_O_TIL}, - {0x00F6, ALP_ORDER_ISOLAT_SMA_O_DIA}, - {0x00F7, ALP_ORDER_SYMB_DIVISION_SIGN}, - {0x00F8, ALP_ORDER_ISOLAT_SMA_O_STR}, - {0x00F9, ALP_ORDER_ISOLAT_SMA_U_GRA}, - {0x00FA, ALP_ORDER_ISOLAT_SMA_U_ACU}, - {0x00FB, ALP_ORDER_ISOLAT_SMA_U_CIR}, - {0x00FC, ALP_ORDER_ISOLAT_SMA_U_DIA}, - {0x00FD, ALP_ORDER_ISOLAT_SMA_Y_ACU}, - {0x00FF, ALP_ORDER_ISOLAT_SMA_Y_DIA}, - {0x0100, ALP_ORDER_ISOLAT_CAP_A_MAC}, - {0x0101, ALP_ORDER_ISOLAT_SMA_A_MAC}, - {0x0102, ALP_ORDER_ISOLAT_CAP_A_BRE}, - {0x0103, ALP_ORDER_ISOLAT_SMA_A_BRE}, - {0x0104, ALP_ORDER_ISOLAT_CAP_A_OGO}, - {0x0105, ALP_ORDER_ISOLAT_SMA_A_OGO}, - {0x0106, ALP_ORDER_ISOLAT_CAP_C_ACU}, - {0x0107, ALP_ORDER_ISOLAT_SMA_C_ACU}, - {0x0108, ALP_ORDER_ISOLAT_CAP_C_CIR}, - {0x0109, ALP_ORDER_ISOLAT_SMA_C_CIR}, - {0x010A, ALP_ORDER_ISOLAT_CAP_C_DOA}, - {0x010B, ALP_ORDER_ISOLAT_SMA_C_DOA}, - {0x010C, ALP_ORDER_ISOLAT_CAP_C_CAR}, - {0x010D, ALP_ORDER_ISOLAT_SMA_C_CAR}, - {0x010E, ALP_ORDER_ISOLAT_CAP_D_CAR}, - {0x010F, ALP_ORDER_ISOLAT_SMA_D_CAR}, - {0x0110, ALP_ORDER_ISOLAT_CAP_D_STR}, - {0x0111, ALP_ORDER_ISOLAT_SMA_D_STR}, - {0x0112, ALP_ORDER_ISOLAT_CAP_E_MAC}, - {0x0113, ALP_ORDER_ISOLAT_SMA_E_MAC}, - {0x0114, ALP_ORDER_ISOLAT_CAP_E_BRE}, - {0x0115, ALP_ORDER_ISOLAT_SMA_E_BRE}, - {0x0116, ALP_ORDER_ISOLAT_CAP_E_DOA}, - {0x0117, ALP_ORDER_ISOLAT_SMA_E_DOA}, - {0x0118, ALP_ORDER_ISOLAT_CAP_E_OGO}, - {0x0119, ALP_ORDER_ISOLAT_SMA_E_OGO}, - {0x011A, ALP_ORDER_ISOLAT_CAP_E_CAR}, - {0x011B, ALP_ORDER_ISOLAT_SMA_E_CAR}, - {0x011C, ALP_ORDER_ISOLAT_CAP_G_CIR}, - {0x011D, ALP_ORDER_ISOLAT_SMA_G_CIR}, - {0x011E, ALP_ORDER_ISOLAT_CAP_G_BRE}, - {0x011F, ALP_ORDER_ISOLAT_SMA_G_BRE}, - {0x0120, ALP_ORDER_ISOLAT_CAP_G_DOA}, - {0x0121, ALP_ORDER_ISOLAT_SMA_G_DOA}, - {0x0122, ALP_ORDER_ISOLAT_CAP_G_CED}, - {0x0123, ALP_ORDER_ISOLAT_SMA_G_CED}, - {0x0124, ALP_ORDER_ISOLAT_CAP_H_CIR}, - {0x0125, ALP_ORDER_ISOLAT_SMA_H_CIR}, - {0x0126, ALP_ORDER_ISOLAT_CAP_H_STR}, - {0x0127, ALP_ORDER_ISOLAT_SMA_H_STR}, - {0x0128, ALP_ORDER_ISOLAT_CAP_I_TIL}, - {0x0129, ALP_ORDER_ISOLAT_SMA_I_TIL}, - {0x012A, ALP_ORDER_ISOLAT_CAP_I_MAC}, - {0x012B, ALP_ORDER_ISOLAT_SMA_I_MAC}, - {0x012C, ALP_ORDER_ISOLAT_CAP_I_BRE}, - {0x012D, ALP_ORDER_ISOLAT_SMA_I_BRE}, - {0x012E, ALP_ORDER_ISOLAT_CAP_I_OGO}, - {0x012F, ALP_ORDER_ISOLAT_SMA_I_OGO}, - {0x0130, ALP_ORDER_ISOLAT_CAP_I_DOA}, - {0x0131, ALP_ORDER_ISOLAT_SMA_I_DOL}, - {0x0132, ALP_ORDER_ISOLAT_CAP_LIG_IJ}, - {0x0133, ALP_ORDER_ISOLAT_SMA_LIG_IJ}, - {0x0134, ALP_ORDER_ISOLAT_CAP_J_CIR}, - {0x0135, ALP_ORDER_ISOLAT_SMA_J_CIR}, - {0x0136, ALP_ORDER_ISOLAT_CAP_J_CED}, - {0x0137, ALP_ORDER_ISOLAT_SMA_J_CED}, - {0x0139, ALP_ORDER_ISOLAT_CAP_L_ACU}, - {0x013A, ALP_ORDER_ISOLAT_SMA_L_ACU}, - {0x013B, ALP_ORDER_ISOLAT_CAP_L_CED}, - {0x013C, ALP_ORDER_ISOLAT_SMA_L_CED}, - {0x013D, ALP_ORDER_ISOLAT_CAP_L_CAR}, - {0x013E, ALP_ORDER_ISOLAT_SMA_L_CAR}, - {0x013F, ALP_ORDER_ISOLAT_CAP_L_DOM}, - {0x0140, ALP_ORDER_ISOLAT_SMA_L_DOM}, - {0x0141, ALP_ORDER_ISOLAT_CAP_L_STR}, - {0x0142, ALP_ORDER_ISOLAT_SMA_L_STR}, - {0x0143, ALP_ORDER_ISOLAT_CAP_N_ACU}, - {0x0144, ALP_ORDER_ISOLAT_SMA_N_ACU}, - {0x0145, ALP_ORDER_ISOLAT_CAP_N_CED}, - {0x0146, ALP_ORDER_ISOLAT_SMA_N_CED}, - {0x0147, ALP_ORDER_ISOLAT_CAP_N_CAR}, - {0x0148, ALP_ORDER_ISOLAT_SMA_N_CAR}, - {0x0149, ALP_ORDER_ISOLAT_SMA_N_APO}, - {0x014C, ALP_ORDER_ISOLAT_CAP_O_MAC}, - {0x014D, ALP_ORDER_ISOLAT_SMA_O_MAC}, - {0x014E, ALP_ORDER_ISOLAT_CAP_O_BRE}, - {0x014F, ALP_ORDER_ISOLAT_SMA_O_BRE}, - {0x0150, ALP_ORDER_ISOLAT_CAP_O_DOU}, - {0x0151, ALP_ORDER_ISOLAT_SMA_O_DOU}, - {0x0152, ALP_ORDER_ISOLAT_CAP_LIG_OE}, - {0x0153, ALP_ORDER_ISOLAT_SMA_LIG_OE}, - {0x0154, ALP_ORDER_ISOLAT_CAP_R_ACU}, - {0x0155, ALP_ORDER_ISOLAT_SMA_R_ACU}, - {0x0156, ALP_ORDER_ISOLAT_CAP_R_CED}, - {0x0157, ALP_ORDER_ISOLAT_SMA_R_CED}, - {0x0158, ALP_ORDER_ISOLAT_CAP_R_CAR}, - {0x0159, ALP_ORDER_ISOLAT_SMA_R_CAR}, - {0x015A, ALP_ORDER_ISOLAT_CAP_S_ACU}, - {0x015B, ALP_ORDER_ISOLAT_SMA_S_ACU}, - {0x015C, ALP_ORDER_ISOLAT_CAP_S_CIR}, - {0x015D, ALP_ORDER_ISOLAT_SMA_S_CIR}, - {0x015E, ALP_ORDER_ISOLAT_CAP_S_CED}, - {0x015F, ALP_ORDER_ISOLAT_SMA_S_CED}, - {0x0160, ALP_ORDER_ISOLAT_CAP_S_CAR}, - {0x0161, ALP_ORDER_ISOLAT_SMA_S_CAR}, - {0x0162, ALP_ORDER_ISOLAT_CAP_T_CED}, - {0x0163, ALP_ORDER_ISOLAT_SMA_T_CED}, - {0x0164, ALP_ORDER_ISOLAT_CAP_T_CAR}, - {0x0165, ALP_ORDER_ISOLAT_SMA_T_CAR}, - {0x0166, ALP_ORDER_ISOLAT_CAP_T_STR}, - {0x0167, ALP_ORDER_ISOLAT_SMA_T_STR}, - {0x0168, ALP_ORDER_ISOLAT_CAP_U_TIL}, - {0x0169, ALP_ORDER_ISOLAT_SMA_U_TIL}, - {0x016A, ALP_ORDER_ISOLAT_CAP_U_MAC}, - {0x016B, ALP_ORDER_ISOLAT_SMA_U_MAC}, - {0x016C, ALP_ORDER_ISOLAT_CAP_U_BRE}, - {0x016D, ALP_ORDER_ISOLAT_SMA_U_BRE}, - {0x016E, ALP_ORDER_ISOLAT_CAP_U_RIN}, - {0x016F, ALP_ORDER_ISOLAT_SMA_U_RIN}, - {0x0170, ALP_ORDER_ISOLAT_CAP_U_DOU}, - {0x0171, ALP_ORDER_ISOLAT_SMA_U_DOU}, - {0x0172, ALP_ORDER_ISOLAT_CAP_U_OGO}, - {0x0173, ALP_ORDER_ISOLAT_SMA_U_OGO}, - {0x0174, ALP_ORDER_ISOLAT_CAP_W_CIR}, - {0x0175, ALP_ORDER_ISOLAT_SMA_W_CIR}, - {0x0176, ALP_ORDER_ISOLAT_CAP_Y_CIR}, - {0x0177, ALP_ORDER_ISOLAT_SMA_Y_CIR}, - {0x0178, ALP_ORDER_ISOLAT_CAP_Y_DIA}, - {0x0179, ALP_ORDER_ISOLAT_CAP_Z_ACU}, - {0x017A, ALP_ORDER_ISOLAT_SMA_Z_ACU}, - {0x017B, ALP_ORDER_ISOLAT_CAP_Z_DOA}, - {0x017C, ALP_ORDER_ISOLAT_SMA_Z_DOA}, - {0x017D, ALP_ORDER_ISOLAT_CAP_Z_CAR}, - {0x017E, ALP_ORDER_ISOLAT_SMA_Z_CAR}, - {0x017F, ALP_ORDER_ISOLAT_SMA_LONG_S}, - {0x0180, ALP_ORDER_ISOLAT_SMA_B_STR}, - {0x0189, ALP_ORDER_ISOLAT_CAP_AFR_D}, - {0x0197, ALP_ORDER_ISOLAT_CAP_I_STR}, - {0x019A, ALP_ORDER_ISOLAT_SMA_L_BAR}, - {0x01A0, ALP_ORDER_ISOLAT_CAP_O_HOR}, - {0x01A1, ALP_ORDER_ISOLAT_SMA_O_HOR}, - {0x01AF, ALP_ORDER_ISOLAT_CAP_U_HOR}, - {0x01B0, ALP_ORDER_ISOLAT_SMA_U_HOR}, - {0x01B5, ALP_ORDER_ISOLAT_CAP_Z_STR}, - {0x01B6, ALP_ORDER_ISOLAT_SMA_Z_STR}, - {0x01C4, ALP_ORDER_ISOLAT_CAP_LIG_DZ_CAR}, - {0x01C5, ALP_ORDER_ISOLAT_CAP_D_SMA_Z_CAR}, - {0x01C6, ALP_ORDER_ISOLAT_SMA_LIG_DZ_CAR}, - {0x01C7, ALP_ORDER_ISOLAT_CAP_LIG_LJ}, - {0x01C8, ALP_ORDER_ISOLAT_CAP_L_SMA_J}, - {0x01C9, ALP_ORDER_ISOLAT_SMA_LIG_LJ}, - {0x01CA, ALP_ORDER_ISOLAT_CAP_LIG_NJ}, - {0x01CB, ALP_ORDER_ISOLAT_CAP_N_SMA_J}, - {0x01CC, ALP_ORDER_ISOLAT_SMA_LIG_NJ}, - {0x01CD, ALP_ORDER_ISOLAT_CAP_A_CAR}, - {0x01CE, ALP_ORDER_ISOLAT_SMA_A_CAR}, - {0x01CF, ALP_ORDER_ISOLAT_CAP_I_CAR}, - {0x01D0, ALP_ORDER_ISOLAT_SMA_I_CAR}, - {0x01D1, ALP_ORDER_ISOLAT_CAP_O_CAR}, - {0x01D2, ALP_ORDER_ISOLAT_SMA_O_CAR}, - {0x01D3, ALP_ORDER_ISOLAT_CAP_U_CAR}, - {0x01D4, ALP_ORDER_ISOLAT_SMA_U_CAR}, - {0x01D5, ALP_ORDER_ISOLAT_CAP_U_DIA_MAC}, - {0x01D6, ALP_ORDER_ISOLAT_SMA_U_DIA_MAC}, - {0x01D7, ALP_ORDER_ISOLAT_CAP_U_DIA_ACU}, - {0x01D8, ALP_ORDER_ISOLAT_SMA_U_DIA_ACU}, - {0x01D9, ALP_ORDER_ISOLAT_CAP_U_DIA_CAR}, - {0x01DA, ALP_ORDER_ISOLAT_SMA_U_DIA_CAR}, - {0x01DB, ALP_ORDER_ISOLAT_CAP_U_DIA_GRA}, - {0x01DC, ALP_ORDER_ISOLAT_SMA_U_DIA_GRA}, - {0x01DE, ALP_ORDER_ISOLAT_CAP_A_DIA_MAC}, - {0x01DF, ALP_ORDER_ISOLAT_SMA_A_DIA_MAC}, - {0x01E0, ALP_ORDER_ISOLAT_CAP_A_DOA_MAC}, - {0x01E1, ALP_ORDER_ISOLAT_SMA_A_DOA_MAC}, - {0x01E2, ALP_ORDER_ISOLAT_CAP_LIG_AE_MAC}, - {0x01E3, ALP_ORDER_ISOLAT_SMA_LIG_AE_MAC}, - {0x01E4, ALP_ORDER_ISOLAT_CAP_G_STR}, - {0x01E5, ALP_ORDER_ISOLAT_SMA_G_STR}, - {0x01E6, ALP_ORDER_ISOLAT_CAP_G_CAR}, - {0x01E7, ALP_ORDER_ISOLAT_SMA_G_CAR}, - {0x01E8, ALP_ORDER_ISOLAT_CAP_K_CAR}, - {0x01E9, ALP_ORDER_ISOLAT_SMA_K_CAR}, - {0x01EA, ALP_ORDER_ISOLAT_CAP_O_OGO}, - {0x01EB, ALP_ORDER_ISOLAT_SMA_O_OGO}, - {0x01EC, ALP_ORDER_ISOLAT_CAP_O_OGO_MAC}, - {0x01ED, ALP_ORDER_ISOLAT_SMA_O_OGO_MAC}, - {0x01F0, ALP_ORDER_ISOLAT_SMA_J_CAR}, - {0x01F1, ALP_ORDER_ISOLAT_CAP_LIG_DZ}, - {0x01F2, ALP_ORDER_ISOLAT_CAP_D_SMA_Z}, - {0x01F3, ALP_ORDER_ISOLAT_SMA_LIG_DZ}, - {0x01F4, ALP_ORDER_ISOLAT_CAP_G_ACU}, - {0x01F5, ALP_ORDER_ISOLAT_SMA_G_ACU}, - {0x01FA, ALP_ORDER_ISOLAT_CAP_A_RIN_ACU}, - {0x01FB, ALP_ORDER_ISOLAT_SMA_A_RIN_ACU}, - {0x01FC, ALP_ORDER_ISOLAT_CAP_LIG_AE_ACU}, - {0x01FD, ALP_ORDER_ISOLAT_SMA_LIG_AE_ACU}, - {0x01FE, ALP_ORDER_ISOLAT_CAP_O_STR_ACU}, - {0x01FF, ALP_ORDER_ISOLAT_SMA_O_STR_ACU}, - {0x0391, ALP_ORDER_GREEK_CAP_ALPHA}, - {0x0392, ALP_ORDER_GREEK_CAP_BETA}, - {0x0393, ALP_ORDER_GREEK_CAP_GAMMA}, - {0x0394, ALP_ORDER_GREEK_CAP_DELTA}, - {0x0395, ALP_ORDER_GREEK_CAP_EPSILON}, - {0x0396, ALP_ORDER_GREEK_CAP_ZETA}, - {0x0397, ALP_ORDER_GREEK_CAP_ETA}, - {0x0398, ALP_ORDER_GREEK_CAP_THETA}, - {0x0399, ALP_ORDER_GREEK_CAP_IOTA}, - {0x039A, ALP_ORDER_GREEK_CAP_KAPPA}, - {0x039B, ALP_ORDER_GREEK_CAP_LAMDA}, - {0x039C, ALP_ORDER_GREEK_CAP_MU}, - {0x039D, ALP_ORDER_GREEK_CAP_NU}, - {0x039E, ALP_ORDER_GREEK_CAP_XI}, - {0x039F, ALP_ORDER_GREEK_CAP_OMICRON}, - {0x03A0, ALP_ORDER_GREEK_CAP_PI}, - {0x03A1, ALP_ORDER_GREEK_CAP_RHO}, - {0x03A3, ALP_ORDER_GREEK_CAP_SIGMA}, - {0x03A4, ALP_ORDER_GREEK_CAP_TAU}, - {0x03A5, ALP_ORDER_GREEK_CAP_UPSILON}, - {0x03A6, ALP_ORDER_GREEK_CAP_PHI}, - {0x03A7, ALP_ORDER_GREEK_CAP_CHI}, - {0x03A8, ALP_ORDER_GREEK_CAP_PSI}, - {0x03A9, ALP_ORDER_GREEK_CAP_OMEGA}, - {0x03B1, ALP_ORDER_GREEK_SMA_ALPHA}, - {0x03B2, ALP_ORDER_GREEK_SMA_BETA}, - {0x03B3, ALP_ORDER_GREEK_SMA_GAMMA}, - {0x03B4, ALP_ORDER_GREEK_SMA_DELTA}, - {0x03B5, ALP_ORDER_GREEK_SMA_EPSILON}, - {0x03B6, ALP_ORDER_GREEK_SMA_ZETA}, - {0x03B7, ALP_ORDER_GREEK_SMA_ETA}, - {0x03B8, ALP_ORDER_GREEK_SMA_THETA}, - {0x03B9, ALP_ORDER_GREEK_SMA_IOTA}, - {0x03BA, ALP_ORDER_GREEK_SMA_KAPPA}, - {0x03BB, ALP_ORDER_GREEK_SMA_LAMDA}, - {0x03BC, ALP_ORDER_GREEK_SMA_MU}, - {0x03BD, ALP_ORDER_GREEK_SMA_NU}, - {0x03BE, ALP_ORDER_GREEK_SMA_XI}, - {0x03BF, ALP_ORDER_GREEK_SMA_OMICRON}, - {0x03C0, ALP_ORDER_GREEK_SMA_PI}, - {0x03C1, ALP_ORDER_GREEK_SMA_RHO}, - {0x03C3, ALP_ORDER_GREEK_SMA_SIGMA}, - {0x03C4, ALP_ORDER_GREEK_SMA_TAU}, - {0x03C5, ALP_ORDER_GREEK_SMA_UPSILON}, - {0x03C6, ALP_ORDER_GREEK_SMA_PHI}, - {0x03C7, ALP_ORDER_GREEK_SMA_CHI}, - {0x03C8, ALP_ORDER_GREEK_SMA_PSI}, - {0x03C9, ALP_ORDER_GREEK_SMA_OMEGA}, - {0x0410, ALP_ORDER_CYRILLIC_CAP_A}, - {0x0411, ALP_ORDER_CYRILLIC_CAP_BE}, - {0x0412, ALP_ORDER_CYRILLIC_CAP_VE}, - {0x0413, ALP_ORDER_CYRILLIC_CAP_GHE}, - {0x0414, ALP_ORDER_CYRILLIC_CAP_DE}, - {0x0415, ALP_ORDER_CYRILLIC_CAP_IE}, - {0x0416, ALP_ORDER_CYRILLIC_CAP_ZHE}, - {0x0417, ALP_ORDER_CYRILLIC_CAP_ZE}, - {0x0418, ALP_ORDER_CYRILLIC_CAP_I}, - {0x0419, ALP_ORDER_CYRILLIC_CAP_SHORT_I}, - {0x041A, ALP_ORDER_CYRILLIC_CAP_KA}, - {0x041B, ALP_ORDER_CYRILLIC_CAP_EL}, - {0x041C, ALP_ORDER_CYRILLIC_CAP_EM}, - {0x041D, ALP_ORDER_CYRILLIC_CAP_EN}, - {0x041E, ALP_ORDER_CYRILLIC_CAP_O}, - {0x041F, ALP_ORDER_CYRILLIC_CAP_PE}, - {0x0420, ALP_ORDER_CYRILLIC_CAP_ER}, - {0x0421, ALP_ORDER_CYRILLIC_CAP_ES}, - {0x0422, ALP_ORDER_CYRILLIC_CAP_TE}, - {0x0423, ALP_ORDER_CYRILLIC_CAP_U}, - {0x0424, ALP_ORDER_CYRILLIC_CAP_EF}, - {0x0425, ALP_ORDER_CYRILLIC_CAP_HA}, - {0x0426, ALP_ORDER_CYRILLIC_CAP_TSE}, - {0x0427, ALP_ORDER_CYRILLIC_CAP_CHE}, - {0x0428, ALP_ORDER_CYRILLIC_CAP_SHA}, - {0x0429, ALP_ORDER_CYRILLIC_CAP_SHCHA}, - {0x042A, ALP_ORDER_CYRILLIC_CAP_HARD_SIGN}, - {0x042B, ALP_ORDER_CYRILLIC_CAP_YERU}, - {0x042C, ALP_ORDER_CYRILLIC_CAP_SOFT_SIGN}, - {0x042D, ALP_ORDER_CYRILLIC_CAP_E}, - {0x042E, ALP_ORDER_CYRILLIC_CAP_YU}, - {0x042F, ALP_ORDER_CYRILLIC_CAP_YA}, - {0x0430, ALP_ORDER_CYRILLIC_SMA_A}, - {0x0431, ALP_ORDER_CYRILLIC_SMA_BE}, - {0x0432, ALP_ORDER_CYRILLIC_SMA_VE}, - {0x0433, ALP_ORDER_CYRILLIC_SMA_GHE}, - {0x0434, ALP_ORDER_CYRILLIC_SMA_DE}, - {0x0435, ALP_ORDER_CYRILLIC_SMA_IE}, - {0x0436, ALP_ORDER_CYRILLIC_SMA_ZHE}, - {0x0437, ALP_ORDER_CYRILLIC_SMA_ZE}, - {0x0438, ALP_ORDER_CYRILLIC_SMA_I}, - {0x0439, ALP_ORDER_CYRILLIC_SMA_SHORT_I}, - {0x043A, ALP_ORDER_CYRILLIC_SMA_KA}, - {0x043B, ALP_ORDER_CYRILLIC_SMA_EL}, - {0x043C, ALP_ORDER_CYRILLIC_SMA_EM}, - {0x043D, ALP_ORDER_CYRILLIC_SMA_EN}, - {0x043E, ALP_ORDER_CYRILLIC_SMA_O}, - {0x043F, ALP_ORDER_CYRILLIC_SMA_PE}, - {0x0440, ALP_ORDER_CYRILLIC_SMA_ER}, - {0x0441, ALP_ORDER_CYRILLIC_SMA_ES}, - {0x0442, ALP_ORDER_CYRILLIC_SMA_TE}, - {0x0443, ALP_ORDER_CYRILLIC_SMA_U}, - {0x0444, ALP_ORDER_CYRILLIC_SMA_EF}, - {0x0445, ALP_ORDER_CYRILLIC_SMA_HA}, - {0x0446, ALP_ORDER_CYRILLIC_SMA_TSE}, - {0x0447, ALP_ORDER_CYRILLIC_SMA_CHE}, - {0x0448, ALP_ORDER_CYRILLIC_SMA_SHA}, - {0x0449, ALP_ORDER_CYRILLIC_SMA_SHCHA}, - {0x044A, ALP_ORDER_CYRILLIC_SMA_HARD_SIGN}, - {0x044B, ALP_ORDER_CYRILLIC_SMA_YERU}, - {0x044C, ALP_ORDER_CYRILLIC_SMA_SOFT_SIGN}, - {0x044D, ALP_ORDER_CYRILLIC_SMA_E}, - {0x044E, ALP_ORDER_CYRILLIC_SMA_YU}, - {0x044F, ALP_ORDER_CYRILLIC_SMA_YA}, - - {0xFF65, ALP_ORDER_HALFWIDTH_KATAKANA_MIDDLE_DOT}, - {0xFF66, ALP_ORDER_HALFWIDTH_KATAKANA_WO}, - {0xFF67, ALP_ORDER_HALFWIDTH_KATAKANA_SMALL_A}, - {0xFF68, ALP_ORDER_HALFWIDTH_KATAKANA_SMALL_I}, - {0xFF69, ALP_ORDER_HALFWIDTH_KATAKANA_SMALL_U}, - {0xFF6A, ALP_ORDER_HALFWIDTH_KATAKANA_SMALL_E}, - {0xFF6B, ALP_ORDER_HALFWIDTH_KATAKANA_SMALL_O}, - {0xFF6C, ALP_ORDER_HALFWIDTH_KATAKANA_SMALL_YA}, - {0xFF6D, ALP_ORDER_HALFWIDTH_KATAKANA_SMALL_YU}, - {0xFF6E, ALP_ORDER_HALFWIDTH_KATAKANA_SMALL_YO}, - {0xFF6F, ALP_ORDER_HALFWIDTH_KATAKANA_SMALL_TU}, - {0xFF70, ALP_ORDER_HALFWIDTH_KATAKANA_HIRAGANA_SOUND_MARK}, - {0xFF71, ALP_ORDER_HALFWIDTH_KATAKANA_A}, - {0xFF72, ALP_ORDER_HALFWIDTH_KATAKANA_I}, - {0xFF73, ALP_ORDER_HALFWIDTH_KATAKANA_U}, - {0xFF74, ALP_ORDER_HALFWIDTH_KATAKANA_E}, - {0xFF75, ALP_ORDER_HALFWIDTH_KATAKANA_O}, - {0xFF76, ALP_ORDER_HALFWIDTH_KATAKANA_KA}, - {0xFF77, ALP_ORDER_HALFWIDTH_KATAKANA_KI}, - {0xFF78, ALP_ORDER_HALFWIDTH_KATAKANA_KU}, - {0xFF79, ALP_ORDER_HALFWIDTH_KATAKANA_KE}, - {0xFF7A, ALP_ORDER_HALFWIDTH_KATAKANA_KO}, - {0xFF7B, ALP_ORDER_HALFWIDTH_KATAKANA_SA}, - {0xFF7C, ALP_ORDER_HALFWIDTH_KATAKANA_SI}, - {0xFF7D, ALP_ORDER_HALFWIDTH_KATAKANA_SU}, - {0xFF7E, ALP_ORDER_HALFWIDTH_KATAKANA_SE}, - {0xFF7F, ALP_ORDER_HALFWIDTH_KATAKANA_SO}, - {0xFF80, ALP_ORDER_HALFWIDTH_KATAKANA_TA}, - {0xFF81, ALP_ORDER_HALFWIDTH_KATAKANA_TI}, - {0xFF82, ALP_ORDER_HALFWIDTH_KATAKANA_TU}, - {0xFF83, ALP_ORDER_HALFWIDTH_KATAKANA_TE}, - {0xFF84, ALP_ORDER_HALFWIDTH_KATAKANA_TO}, - {0xFF85, ALP_ORDER_HALFWIDTH_KATAKANA_NA}, - {0xFF86, ALP_ORDER_HALFWIDTH_KATAKANA_NI}, - {0xFF87, ALP_ORDER_HALFWIDTH_KATAKANA_NU}, - {0xFF88, ALP_ORDER_HALFWIDTH_KATAKANA_NE}, - {0xFF89, ALP_ORDER_HALFWIDTH_KATAKANA_NO}, - {0xFF8A, ALP_ORDER_HALFWIDTH_KATAKANA_HA}, - {0xFF8B, ALP_ORDER_HALFWIDTH_KATAKANA_HI}, - {0xFF8C, ALP_ORDER_HALFWIDTH_KATAKANA_HU}, - {0xFF8D, ALP_ORDER_HALFWIDTH_KATAKANA_HE}, - {0xFF8E, ALP_ORDER_HALFWIDTH_KATAKANA_HO}, - {0xFF8F, ALP_ORDER_HALFWIDTH_KATAKANA_MA}, - {0xFF90, ALP_ORDER_HALFWIDTH_KATAKANA_MI}, - {0xFF91, ALP_ORDER_HALFWIDTH_KATAKANA_MU}, - {0xFF92, ALP_ORDER_HALFWIDTH_KATAKANA_ME}, - {0xFF93, ALP_ORDER_HALFWIDTH_KATAKANA_MO}, - {0xFF94, ALP_ORDER_HALFWIDTH_KATAKANA_YA}, - {0xFF95, ALP_ORDER_HALFWIDTH_KATAKANA_YU}, - {0xFF96, ALP_ORDER_HALFWIDTH_KATAKANA_YO}, - {0xFF97, ALP_ORDER_HALFWIDTH_KATAKANA_RA}, - {0xFF98, ALP_ORDER_HALFWIDTH_KATAKANA_RI}, - {0xFF99, ALP_ORDER_HALFWIDTH_KATAKANA_RU}, - {0xFF9A, ALP_ORDER_HALFWIDTH_KATAKANA_RE}, - {0xFF9B, ALP_ORDER_HALFWIDTH_KATAKANA_RO}, - {0xFF9C, ALP_ORDER_HALFWIDTH_KATAKANA_WA}, - {0xFF9D, ALP_ORDER_HALFWIDTH_KATAKANA_N}, - {0xFF9E, ALP_ORDER_HALFWIDTH_KATAKANA_VOICED_SOUND_MARK}, - {0xFF9F, ALP_ORDER_HALFWIDTH_KATAKANA_SEMI_VOICED_SOUND_MARK} -}; +#include "db-util-debug.h" -static UnicodeToAlphaOrder *gpUnicodeToAlphaOrderTable = - (UnicodeToAlphaOrder *)garUnicodeToAlphaOrderTable; -static DB_UINT16 gLineCntInUniToAlpahOrderTable = - WSC_UNICODE_TO_ALPHA_ORDER_COUNT; - -int sc_strcmp_user1(const char *str1, const char *str2); -int sc_strcmp_user2(const char *str1, const char *str2); -int sc_strcmp_user3(const char *str1, const char *str2); - -int sc_strncmp_user1(const char *s1, const char *s2, int n); -int sc_strncmp_user2(const char *s1, const char *s2, int n); -int sc_strncmp_user3(const char *s1, const char *s2, int n); - -char *sc_strstr_user1(const char *haystack, const char *needle); -char *sc_strstr_user2(const char *haystack, const char *needle); -char *sc_strstr_user3(const char *haystack, const char *needle); - -char *sc_strchr_user1(const char *string, const char *pEnd, int ch); -char *sc_strchr_user2(const char *string, const char *pEnd, int ch); -char *sc_strchr_user3(const char *string, const char *pEnd, int ch); - -int AcWStrCaseCollate(const DB_UINT16 *ws1, const DB_UINT16 *ws2); -int AcWStrnCaseCollate(const DB_UINT16 *ws1, const DB_UINT16 *ws2, - size_t count); -DB_UINT16 *AcWcsCasestr(const DB_UINT16 *s1, const DB_UINT16 *s2); -size_t AcWcslen(const wchar_t *s); -DB_UINT16 AcWCharlwr(DB_UINT16 wchCode); - -/*! \breif compare the string pointed to by s1 to the string pointed to by s2 - ************************************ - * \param str1(in) : - * \param str2(in) : - ************************************ - * \return - ************************************ - * \note ³»ºÎ ¾Ë°í¸®Áò - * - 20061206 ÇÔ¼ö »ý¼º - * - TODO : - * Æ÷Æýà »ç¿ëÀÚ°¡ ¼öÁ¤ÇÒ ¼ö ÀÖ´Ù - *****************************************************************************/ -/* UNICODE¿¡ ´ëÇؼ Case InsensitiveÇÏ°Ô µ¿ÀÛ */ -/* sc_strdcmp(str1, str2);¿Í µ¿ÀÏÇÑ µ¿ÀÛ */ -int sc_strcmp_user1(const char *str1, const char *str2) -{ - return AcWStrCaseCollate((const DB_UINT16 *)str1, - (const DB_UINT16 *)str2); -} +#define DB_UTIL_RETV_IF(cond,ret) \ + do {\ + if(cond) {\ + DB_UTIL_TRACE_WARNING("\x1b[33m[%s()][RET_IF]\x1b[0m",__FUNCTION__);\ + return ret;\ + }\ + }while(0) -int sc_strcmp_user2(const char *str1, const char *str2) -{ - return AcWStrCaseCollate((const DB_UINT16 *)str1, - (const DB_UINT16 *)str2); -} +#define DB_UTIL_RET_IF(cond) \ + do {\ + if(cond) {\ + DB_UTIL_TRACE_WARNING("\x1b[33m[%s()][RET_IF]\x1b[0m",__FUNCTION__);\ + return;\ + }\ + }while(0) -int sc_strcmp_user3(const char *str1, const char *str2) -{ - return 1; -} +#define DB_UTIL_ERR_COL_FUNC_RET DB_UTIL_ERROR -/*****************************************************************************/ -/* sc_strncmp_user1 */ - -/*! \breif compare the string pointed to by s1 to the string pointed to by s2 - * in n- bytes - ************************************ - * \param s1(in) : - * \param s2(in) : - * \param n(in) : - ************************************ - * \return - ************************************ - * \note ³»ºÎ ¾Ë°í¸®Áò - * - 20061206 ÇÔ¼ö »ý¼º - * - TODO : - * Æ÷Æýà »ç¿ëÀÚ°¡ ¼öÁ¤ÇÒ ¼ö ÀÖ´Ù - *****************************************************************************/ -/* UNICODE¿¡ ´ëÇؼ Case InsensitiveÇÏ°Ô µ¿ÀÛ */ -/* sc_strndcmp(s1, s2, n)¿Í µ¿ÀÏÇÑ µ¿ÀÛ */ -int sc_strncmp_user1(const char *s1, const char *s2, int n) -{ - return AcWStrnCaseCollate((const DB_UINT16 *)s1, (const DB_UINT16 *)s2, - n); -} - -int sc_strncmp_user2(const char *s1, const char *s2, int n) -{ - return AcWStrnCaseCollate((const DB_UINT16 *)s1, (const DB_UINT16 *)s2, - n); -} - -int sc_strncmp_user3(const char *s1, const char *s2, int n) -{ - return 1; -} +enum { + DB_UTIL_ERR_DLOPEN = -10, + DB_UTIL_ERR_DLSYM, + DB_UTIL_ERR_ENV, + DB_UTIL_ERR_ICU, + DB_UTIL_ERR_PARAM +}; -/*****************************************************************************/ -/*! sc_strchr_user1 */ -/*! \breif locate the first occurrence of ch in the string - ************************************ - * \param string(in): - * \param pEnd(in) : - * \param ch(in) : - ************************************ - * \return - ************************************ - * \note ³»ºÎ ¾Ë°í¸®Áò - * like operation¿¡¼ »ç¿ëµÊ - * - 20061206 ÇÔ¼ö »ý¼º - * - TODO : - * Æ÷Æýà »ç¿ëÀÚ°¡ ¼öÁ¤ÇÒ ¼ö ÀÖ´Ù - **********************************************************************/ -/* UNICODE¿¡ ´ëÇؼ Case InsensitiveÇÏ°Ô µ¿ÀÛ */ -char *sc_strchr_user1(const char *string, const char *pEnd, int ch) -{ - DB_UINT16 *wstr1; - DB_UINT16 *tmp_wstr; - wint_t wstr2 = towupper((DB_UINT16)pEnd); - int string_len; - DB_WCHAR *ptr; +enum { + DB_UTIL_CMP_SC, + /* Loop comparison */ + DB_UTIL_CMP_LC +}; - if (wstr2 == (DB_UINT16)'\0') - return NULL; +#define ICU_FUNC_CNT 8 - string_len = wcslen((wchar_t *) string); +typedef UCollator* (*ICU_UCOL_OPEN)(const char *, UErrorCode *); +typedef void (*ICU_UCOL_CLOSE)(UCollator *); +typedef void (*ICU_UCOL_SETSTRENGTH)(UCollator *, UCollationStrength); +typedef UCollationResult (*ICU_UCOL_STRCOLL)(const UCollator *, const UChar *, int32_t, const UChar *, int32_t); +typedef UCollationResult (*ICU_UCOL_STRCOLLITER)(const UCollator *, UCharIterator *, UCharIterator *, UErrorCode *); +typedef void (*ICU_UITER_SETUTF8)(UCharIterator *, const char *, int32_t); +typedef void (*ICU_ULOC_SETDEFAULT)(const char* localeID, UErrorCode* status); +typedef const char* (*ICU_ULOC_GETDEFAULT)(void); - wstr1 = (DB_UINT16 *)malloc(sizeof(DB_UINT16)*(string_len + 1)); - if (!wstr1) - return NULL; +typedef struct { + ICU_UCOL_OPEN icu_ucol_open; + ICU_UCOL_CLOSE icu_ucol_close; + ICU_UCOL_STRCOLL icu_ucol_strcoll; + ICU_UCOL_STRCOLLITER icu_ucol_strcollIter; + ICU_UCOL_SETSTRENGTH icu_ucol_setStrength; + ICU_UITER_SETUTF8 icu_uiter_setUTF8; + ICU_ULOC_SETDEFAULT icu_uloc_setDefault; + ICU_ULOC_GETDEFAULT icu_uloc_getDefault; +} db_util_icu_func_t; - memset(wstr1, 0x00, sizeof(DB_UINT16)*(string_len + 1)); +db_util_icu_func_t icu_symbol; - ptr = (DB_WCHAR *) string; - tmp_wstr = wstr1; - for (; *ptr; ++ptr, ++tmp_wstr) - *tmp_wstr = (DB_UINT16)*ptr; - tmp_wstr = wstr1; +void *g_dl_icu_handle = NULL; - for (; *tmp_wstr; tmp_wstr++, string++) { - if (towupper(*tmp_wstr) == wstr2) { - free(wstr1); +#ifdef DB_UTIL_ENABLE_DEVDEBUG +static char *strtoutf8(const UChar * unichars, int len); +#endif - return (char *)string; +static int __db_util_dl_load_icu() +{ + void *handle = NULL; + void *icu_handle[ICU_FUNC_CNT] = { 0 }; + char *dl_error; + int i = 0; + + const char *ICU_API[] = { + "ucol_open", + "ucol_close", + "ucol_strcoll", + "ucol_strcollIter", + "ucol_setStrength", + "uiter_setUTF8", + "uloc_setDefault", + "uloc_getDefault" + }; + + if(g_dl_icu_handle == NULL) { + g_dl_icu_handle = dlopen("libicui18n.so", RTLD_LAZY | RTLD_GLOBAL); + if(g_dl_icu_handle == NULL) { + DB_UTIL_TRACE_WARNING("dlopen icu so fail"); + return DB_UTIL_ERR_DLOPEN; } } - free(wstr1); - - return NULL; -} + for (i = 0; i < ICU_FUNC_CNT; i++) { + handle = dlsym(g_dl_icu_handle, ICU_API[i]); + if ((dl_error = dlerror()) != NULL) { + DB_UTIL_TRACE_WARNING("dlsym(%s) is failed for %s", + dl_error, ICU_API[i]); + return DB_UTIL_ERR_DLSYM; + } + icu_handle[i] = handle; + } -char *sc_strchr_user2(const char *string, const char *pEnd, int ch) -{ - return NULL; -} + memcpy((void*)&icu_symbol, (const void*)icu_handle, sizeof(icu_handle)); -char *sc_strchr_user3(const char *string, const char *pEnd, int ch) -{ - return NULL; + return DB_UTIL_OK; } -/* End of JINKI_COLLATION */ - -char *sc_strstr_user1(const char *haystack, const char *needle) +/* The collating function must return an integer that is negative, zero or positive */ +static int __db_util_collate_icu_16(void *ucol, int str1_len, const void *str1, int str2_len, const void *str2) { - return (char *)AcWcsCasestr((DB_UINT16 *)haystack, (DB_UINT16 *)needle); -} +#ifdef DB_UTIL_ENABLE_DEVDEBUG + DB_UTIL_TRACE_DEBUG("__db_util_collate_icu_16 func start \n"); + + UChar* tmp_v1 = (UChar *)str1; + UChar* tmp_v2 = (UChar *)str2; + char* utf8_v1 = strtoutf8(tmp_v1, str1_len); + char* utf8_v2 = strtoutf8(tmp_v2, str2_len); + + DB_UTIL_TRACE_DEBUG("v1(%d) : %s\n", str1_len, utf8_v1); + DB_UTIL_TRACE_DEBUG("v2(%d) : %s\n", str2_len, utf8_v2); +#endif + + DB_UTIL_RETV_IF(icu_symbol.icu_ucol_strcoll == NULL, DB_UTIL_ERR_COL_FUNC_RET); + + UCollationResult result = icu_symbol.icu_ucol_strcoll( + (UCollator *) ucol, + (const UChar *) str1, str1_len, + (const UChar *) str2, str2_len); + +#ifdef DB_UTIL_ENABLE_DEVDEBUG + if(utf8_v1) + free(utf8_v1); + if(utf8_v2) + free(utf8_v2); + + if (result == UCOL_LESS) { + DB_UTIL_TRACE_DEBUG("less \n"); + } else if (result == UCOL_GREATER) { + DB_UTIL_TRACE_DEBUG("greater \n"); + } else { + DB_UTIL_TRACE_DEBUG("equal \n"); + } +#endif -char *sc_strstr_user2(const char *haystack, const char *needle) -{ - return NULL; + return result; } -char *sc_strstr_user3(const char *haystack, const char *needle) +/* The collating function must return an integer that is negative, zero or positive */ +static int __db_util_collate_icu_16_lc(void *ucol, int str1_len, const void *str1, int str2_len, const void *str2) { - return NULL; -} +#ifdef DB_UTIL_ENABLE_DEVDEBUG + DB_UTIL_TRACE_DEBUG("__db_util_collate_icu_16_lc func start \n"); -/* AcWStrColl.c AcWStrColl.c AcWStrColl.c AcWStrColl.c - AcWStrColl.c AcWStrColl.c AcWStrColl.c AcWStrColl.c */ + UChar* tmp_v1 = (UChar *)str1; + UChar* tmp_v2 = (UChar *)str2; -int -__CmpUnicodeToAlphaOrder(const UnicodeToAlphaOrder *pEle1, - const UnicodeToAlphaOrder *pEle2) -{ - return ((pEle1->wchCode) - (pEle2->wchCode)); -} + char* utf8_v1 = strtoutf8(tmp_v1, str1_len); + char* utf8_v2 = strtoutf8(tmp_v2, str2_len); -DB_UINT16 __GetAlphabeticalCaseOrderByUnicode(DB_UINT16 wchCode) -{ - UnicodeToAlphaOrder key = { 0 }; - UnicodeToAlphaOrder *pFindElement = NULL; - - if ((wchCode >= 0x0041 && wchCode <= 0x005A) - || (wchCode >= 0x00C0 && wchCode <= 0x00D6) || (wchCode >= 0x00D8 - && wchCode <= - 0x00DD) - || (wchCode >= 0x0391 && wchCode <= 0x03A9) || (wchCode >= 0x0410 - && wchCode <= - 0x042F)) { - wchCode = wchCode + WSC_CAP_TO_SMALL_OFFSET; - } + DB_UTIL_TRACE_DEBUG("v1(%d) : %s\n", str1_len, utf8_v1); + DB_UTIL_TRACE_DEBUG("v2(%d) : %s\n", str2_len, utf8_v2); - key.wchCode = wchCode; + if(utf8_v1) + free(utf8_v1); + if(utf8_v2) + free(utf8_v2); +#endif - pFindElement = - bsearch(&key, gpUnicodeToAlphaOrderTable, - gLineCntInUniToAlpahOrderTable, sizeof(UnicodeToAlphaOrder), - (int (*)(const void *, const void *)) - __CmpUnicodeToAlphaOrder); + UCollationResult result = 0; - if (pFindElement != NULL) - return pFindElement->uAlphabeticalOrder; + UChar* str_to = (UChar *)str1; + UChar* str_from = (UChar *)str1; - return ALP_ORDER_UNDEFINED_WEIGHT; -} + int i; -/** - * @purpose : This function compares two strings in alphabetical order without - Case-Sensitive. A collation table that is set by - SetUnicodeToAlphaOrederTable is used to compare two strings - ( To Convert Lowcase ). If either char in compared two strings - has not a corresponding alphabetical oreder, comparison is done - by unicode order for these two characters. - * @param : ws1[In] : Null-terminated strings to compare. - ws2[In]: Null-terminated strings to compare. - * @return : This function returns a value indicating the relationship of - string1 to string2, as follows. - Return Value Relationship of string1 to string2 - < 0 string1 less than string2 - 0 string1 identical to string2 - > 0 string1 greater than string2 - * @author: Jayoun Lee - */ + DB_UTIL_RETV_IF(icu_symbol.icu_ucol_strcoll == NULL, DB_UTIL_ERR_COL_FUNC_RET); -int AcWStrCaseCollate(const DB_UINT16 *ws1, const DB_UINT16 *ws2) -{ - int ret = 0; - DB_UINT16 nCmp1, nCmp2; - - if (!((int)ws1 & 0x1) && !((int)ws2 & 0x1)) { - /* 2-byte aligned */ - - nCmp1 = __GetAlphabeticalCaseOrderByUnicode(*ws1); - nCmp2 = __GetAlphabeticalCaseOrderByUnicode(*ws2); - - /* SYKim : The one which is not defined in the table is ALWAYS - have larger number than the one which is defined in the table */ - if ((nCmp1 == ALP_ORDER_UNDEFINED_WEIGHT) - && (nCmp2 == ALP_ORDER_UNDEFINED_WEIGHT)) { - nCmp1 = *ws1; - nCmp2 = *ws2; - } else if ((nCmp1 == ALP_ORDER_UNDEFINED_WEIGHT) - && (nCmp2 != ALP_ORDER_UNDEFINED_WEIGHT)) { - nCmp1 = 1; - nCmp2 = 0; - } else if ((nCmp1 != ALP_ORDER_UNDEFINED_WEIGHT) - && (nCmp2 == ALP_ORDER_UNDEFINED_WEIGHT)) { - nCmp1 = 0; - nCmp2 = 1; + if(str1_len> str2_len) { + for(i=0;i<str2_len;i=i+2) { + str_to++; } - while (((ret = (int)(nCmp1 - nCmp2)) == 0) && *ws2) { - - ++ws1; - ++ws2; - nCmp1 = __GetAlphabeticalCaseOrderByUnicode(*ws1); - nCmp2 = __GetAlphabeticalCaseOrderByUnicode(*ws2); - - if ((nCmp1 == ALP_ORDER_UNDEFINED_WEIGHT) - || (nCmp2 == ALP_ORDER_UNDEFINED_WEIGHT)) { - nCmp1 = *ws1; - nCmp2 = *ws2; + while((int)(str_to-(UChar*)str1) <= str1_len) { + result = icu_symbol.icu_ucol_strcoll( + (UCollator *) ucol, + (UChar *) str_from, str_to-str_from, + (const UChar *) str2, str2_len); + + if (result == UCOL_EQUAL) + { +#ifdef DB_UTIL_ENABLE_DEVDEBUG + DB_UTIL_TRACE_DEBUG("equal \n"); +#endif + return UCOL_EQUAL; } + + str_to++; + str_from++; } } else { - /* not-aligned, byte to byte approach - slow */ - char *pc1 = (char *)ws1; - char *pc2 = (char *)ws2; - - while (!ret && (*pc2 || *(pc2 + 1))) { - DB_UINT16 wc1 = - (*(pc1 + 1) << 8) + ((*pc1 >> 8) & 0xFF); - DB_UINT16 wc2 = - (*(pc2 + 1) << 8) + ((*pc2 >> 8) & 0xFF); - - nCmp1 = __GetAlphabeticalCaseOrderByUnicode(wc1); - nCmp2 = __GetAlphabeticalCaseOrderByUnicode(wc2); - - /*SYKim : The one which is not defined in the table is - ALWAYS have larger number than the one which is defined - in the table. */ - if ((nCmp1 == ALP_ORDER_UNDEFINED_WEIGHT) - && (nCmp2 == ALP_ORDER_UNDEFINED_WEIGHT)) { - nCmp1 = wc1; - nCmp2 = wc2; - } else if ((nCmp1 == ALP_ORDER_UNDEFINED_WEIGHT) - && (nCmp2 != ALP_ORDER_UNDEFINED_WEIGHT)) { - nCmp1 = 1; - nCmp2 = 0; - } else if ((nCmp1 != ALP_ORDER_UNDEFINED_WEIGHT) - && (nCmp2 == ALP_ORDER_UNDEFINED_WEIGHT)) { - nCmp1 = 0; - nCmp2 = 1; - } + result = icu_symbol.icu_ucol_strcoll( + (UCollator *) ucol, + (const UChar *) str1, str1_len, + (const UChar *) str2, str2_len); + } - ret = nCmp1 - nCmp2; +#ifdef DB_UTIL_ENABLE_DEVDEBUG + if (result == UCOL_LESS) { + DB_UTIL_TRACE_DEBUG("less \n"); + } else if (result == UCOL_GREATER) { + DB_UTIL_TRACE_DEBUG("greater \n"); + } else if (result == UCOL_EQUAL) { + DB_UTIL_TRACE_DEBUG("equal \n"); + } else { + DB_UTIL_TRACE_DEBUG("compare error : %d \n", result); + } +#endif - pc1 += 2; - pc2 += 2; - } + return result; +} + +/* The collating function must return an integer that is negative, zero or positive */ +static int __db_util_collate_icu_8(void *ucol, int str1_len, const void *str1, int str2_len, const void *str2) +{ + UCharIterator uiter1, uiter2; + UErrorCode error = U_ZERO_ERROR; + +#ifdef DB_UTIL_ENABLE_DEVDEBUG + DB_UTIL_TRACE_DEBUG("__db_util_collate_icu_8 func start \n"); + DB_UTIL_TRACE_DEBUG("v1(%d) : %s, v2(%d) : %s \n", str1_len, (char*)str1, str2_len, (char*)str2); +#endif + + DB_UTIL_RETV_IF(icu_symbol.icu_uiter_setUTF8 == NULL, DB_UTIL_ERR_COL_FUNC_RET); + DB_UTIL_RETV_IF(icu_symbol.icu_ucol_strcollIter == NULL, DB_UTIL_ERR_COL_FUNC_RET); + + icu_symbol.icu_uiter_setUTF8(&uiter1, (const char *) str1, str1_len); + icu_symbol.icu_uiter_setUTF8(&uiter2, (const char *) str2, str2_len); + + UCollationResult result = icu_symbol.icu_ucol_strcollIter( + (UCollator *) ucol, + &uiter1, + &uiter2, + &error); + if(U_FAILURE(error)) { + DB_UTIL_TRACE_ERROR("__db_util_collate_icu_8 ucol_strcollIter error: %d\n", error); + return DB_UTIL_ERR_COL_FUNC_RET; } - return (ret); +#ifdef DB_UTIL_ENABLE_DEVDEBUG + if (result == UCOL_LESS) { + DB_UTIL_TRACE_DEBUG("less \n"); + } else if (result == UCOL_GREATER) { + DB_UTIL_TRACE_DEBUG("greater \n"); + } else { + DB_UTIL_TRACE_DEBUG("equal \n"); + } +#endif + + return result; } - /* - * @purpose : This function compares two strings in alphabetical order without - Case-Sensitive. A collation table that is set by - SetUnicodeToAlphaOrederTable is used to compare two strings - ( To Convert Lowcase ). If either char in compared two strings - has not a corresponding alphabetical order, comparison is done - by unicode order for these two characters. - * @param : ws1[In] : Null-terminated strings to compare. - ws2[In]: Null-terminated strings to compare. - count[In]: the initial number of characters to compare - * @return : This function returns a value indicating the relationship of - string1 to string2, as follows. - Return Value Relationship of string1 to string2 - < 0 string1 less than string2 - 0 string1 identical to string2 - > 0 string1 greater than string2 - * @author: Jayoun Lee - */ - -int AcWStrnCaseCollate(const DB_UINT16 *ws1, const DB_UINT16 *ws2, size_t count) +static int __db_util_collate_icu_8_lc(void *ucol, int str1_len, const void *str1, int str2_len, const void *str2) { - DB_UINT16 nCmp1, nCmp2; - - if (!count) - return 0; - - if (!((DB_UINT16)ws1 & 0x1) && !((DB_UINT16)ws2 & 0x1)) { - /* 2-byte aligned */ - nCmp1 = __GetAlphabeticalCaseOrderByUnicode(*ws1); - nCmp2 = __GetAlphabeticalCaseOrderByUnicode(*ws2); - - /* SYKim : The one which is not defined in the table is ALWAYS - have larger number than the one which is defined in the table. */ - if ((nCmp1 == ALP_ORDER_UNDEFINED_WEIGHT) - && (nCmp2 == ALP_ORDER_UNDEFINED_WEIGHT)) { - nCmp1 = *ws1; - nCmp2 = *ws2; - } else if ((nCmp1 == ALP_ORDER_UNDEFINED_WEIGHT) - && (nCmp2 != ALP_ORDER_UNDEFINED_WEIGHT)) { - nCmp1 = 1; - nCmp2 = 0; - } else if ((nCmp1 != ALP_ORDER_UNDEFINED_WEIGHT) - && (nCmp2 == ALP_ORDER_UNDEFINED_WEIGHT)) { - nCmp1 = 0; - nCmp2 = 1; + UCharIterator uiter1, uiter2; + UErrorCode error = U_ZERO_ERROR; + UCollationResult result = 0; + char* str_from = (char*)str1; + char* str_to = (char*)str1; + glong v1_char_len, v2_char_len; + int ret, i; + +#ifdef DB_UTIL_ENABLE_DEVDEBUG + DB_UTIL_TRACE_DEBUG("__db_util_collate_icu_8_lc func start \n"); + DB_UTIL_TRACE_DEBUG("v1(%d) : %s, v2(%d) : %s \n", str1_len, (char*)str1, str2_len, (char*)str2); +#endif + + DB_UTIL_RETV_IF(icu_symbol.icu_uiter_setUTF8 == NULL, DB_UTIL_ERR_COL_FUNC_RET); + DB_UTIL_RETV_IF(icu_symbol.icu_ucol_strcollIter == NULL, DB_UTIL_ERR_COL_FUNC_RET); + + icu_symbol.icu_uiter_setUTF8(&uiter2, (const char *) str2, str2_len); + + v1_char_len = g_utf8_strlen((gchar *)str1,-1); + v2_char_len = g_utf8_strlen((gchar *)str2,-1); + + if(v1_char_len > v2_char_len) { + for(i=0;i<v2_char_len;i++) { + str_to = g_utf8_next_char(str_to); } - while (--count && *ws1 && nCmp1 == nCmp2) { - ws1++; - ws2++; - - nCmp1 = __GetAlphabeticalCaseOrderByUnicode(*ws1); - nCmp2 = __GetAlphabeticalCaseOrderByUnicode(*ws2); - - /* SYKim : The one which is not defined in the table is - ALWAYS have larger number than the one which is - defined in the table. */ - if ((nCmp1 == ALP_ORDER_UNDEFINED_WEIGHT) - && (nCmp2 == ALP_ORDER_UNDEFINED_WEIGHT)) { - nCmp1 = *ws1; - nCmp2 = *ws2; - } else if ((nCmp1 == ALP_ORDER_UNDEFINED_WEIGHT) - && (nCmp2 != ALP_ORDER_UNDEFINED_WEIGHT)) { - nCmp1 = 1; - nCmp2 = 0; - } else if ((nCmp1 != ALP_ORDER_UNDEFINED_WEIGHT) - && (nCmp2 == ALP_ORDER_UNDEFINED_WEIGHT)) { - nCmp1 = 0; - nCmp2 = 1; + while((int)(str_to-(char*)str1) <= str1_len) { + icu_symbol.icu_uiter_setUTF8( + &uiter1, + (const char *) str_from, + str_to - str_from); + + result = icu_symbol.icu_ucol_strcollIter( + (UCollator *) ucol, + &uiter1, + &uiter2, + &error); + if (U_FAILURE(error)) { + DB_UTIL_TRACE_ERROR("__db_util_collate_icu_8_lc ucol_strcollIter error: %d\n", error); + return DB_UTIL_ERR_COL_FUNC_RET; } - } - return (int)(nCmp1 - nCmp2); - } else { - /* not-aligned, byte to byte approach - slow */ - char *pc1 = (char *)ws1; - char *pc2 = (char *)ws2; - - while (--count && (*pc1 || *pc1 + 1)) { - DB_UINT16 wc1 = - (*(pc1 + 1) << 8) + ((*pc1 >> 8) & 0xFF); - DB_UINT16 wc2 = - (*(pc2 + 1) << 8) + ((*pc2 >> 8) & 0xFF); - - nCmp1 = __GetAlphabeticalCaseOrderByUnicode(wc1); - nCmp2 = __GetAlphabeticalCaseOrderByUnicode(wc2); - - /* SYKim : The one which is not defined in the table is - ALWAYS have larger number than the one which is defined - in the table.*/ - - if ((nCmp1 == ALP_ORDER_UNDEFINED_WEIGHT) - && (nCmp2 == ALP_ORDER_UNDEFINED_WEIGHT)) { - nCmp1 = wc1; - nCmp2 = wc2; - } else if ((nCmp1 == ALP_ORDER_UNDEFINED_WEIGHT) - && (nCmp2 != ALP_ORDER_UNDEFINED_WEIGHT)) { - nCmp1 = 1; - nCmp2 = 0; - } else if ((nCmp1 != ALP_ORDER_UNDEFINED_WEIGHT) - && (nCmp2 == ALP_ORDER_UNDEFINED_WEIGHT)) { - nCmp1 = 0; - nCmp2 = 1; + if(result == UCOL_EQUAL) +#ifdef DB_UTIL_ENABLE_DEVDEBUG + { + DB_UTIL_TRACE_DEBUG("equal \n"); + return UCOL_EQUAL; } - if (nCmp1 != nCmp2) { - return ((int)nCmp1 - nCmp2); - } - pc1 += 2; - pc2 += 2; +#else + return UCOL_EQUAL; +#endif + + str_to = g_utf8_next_char(str_to); + str_from = g_utf8_next_char(str_from); + } + } + else + { + icu_symbol.icu_uiter_setUTF8( + &uiter1, + (const char *) str1, + str1_len); + + result = icu_symbol.icu_ucol_strcollIter( + (UCollator *) ucol, + &uiter1, + &uiter2, + &error); + if (U_FAILURE(error)) { + DB_UTIL_TRACE_ERROR("__db_util_collate_icu_8_lc ucol_strcollIter error: %d\n", error); + return DB_UTIL_ERR_COL_FUNC_RET; } - return 0; } + +#ifdef DB_UTIL_ENABLE_DEVDEBUG + if (result == UCOL_LESS) + { + DB_UTIL_TRACE_DEBUG("less \n"); + } + else if (result == UCOL_GREATER) + { + DB_UTIL_TRACE_DEBUG("greater \n"); + } + else if(result == UCOL_EQUAL) + { + DB_UTIL_TRACE_DEBUG("equal \n"); + } + else + { + DB_UTIL_TRACE_DEBUG("compare error : %d\n", result); + } +#endif + + return result; } -DB_UINT16 *AcWcsCasestr(const DB_UINT16 *s1, const DB_UINT16 *s2) +static void __db_util_collate_icu_close(void* ucol) { - const DB_UINT16 *p; - const DB_UINT16 *q; - const DB_UINT16 *r; + DB_UTIL_TRACE_DEBUG("close icu collator\n"); - if (!*s2) { - /* LINTED interface specification */ - return (DB_UINT16 *)s1; - } - /*vodakk upgrade 2005.10.03 */ - if (AcWcslen((wchar_t *)s1) < AcWcslen((wchar_t *)s2)) - return NULL; + DB_UTIL_RET_IF(icu_symbol.icu_ucol_close == NULL); - p = s1; - q = s2; - while (*p) { - q = s2; - r = p; - while (*q) { - if (AcWCharlwr(*r) != AcWCharlwr(*q)) - break; - q++; - r++; - } - if (!*q) { - /* LINTED interface specification */ - return (DB_UINT16 *)p; - } - p++; - } - return NULL; + icu_symbol.icu_ucol_close((UCollator *) ucol); } -size_t AcWcslen(const wchar_t *s) +static int __db_util_collation_create(sqlite3* db_handle, char* locale, char* collator_name, UCollationStrength ucol_strength_value, int utf_type, int cmp_type) { - if (!((int)s & 0x1)) { - /* 2-byte aligned */ - wchar_t *temp = (wchar_t *)s; - - while (*temp++) { - /* DO NOTHING */ ; + int err; + UErrorCode status = U_ZERO_ERROR; + + DB_UTIL_RETV_IF(icu_symbol.icu_ucol_open == NULL, DB_UTIL_ERR_DLSYM); + DB_UTIL_RETV_IF(icu_symbol.icu_ucol_setStrength == NULL, DB_UTIL_ERR_DLSYM); + + UCollator* ucol = icu_symbol.icu_ucol_open(locale, &status); + if(status == U_USING_DEFAULT_WARNING) { + DB_UTIL_TRACE_ERROR("ucol_open success with default collate option\n"); + } else if (U_FAILURE(status)) { + DB_UTIL_TRACE_ERROR("ucol_open fail : %d \n", status); + return DB_UTIL_ERR_ICU; + } +#ifdef DB_UTIL_ENABLE_DEVDEBUG + else + { + DB_UTIL_TRACE_DEBUG("ucol_open success : %d \n", status); + } +#endif + + if(ucol_strength_value) { + icu_symbol.icu_ucol_setStrength(ucol, ucol_strength_value); + if (U_FAILURE(status)) { + DB_UTIL_TRACE_ERROR("ucol_setStrength fail : %d \n", status); + return DB_UTIL_ERR_ICU; + } else { + DB_UTIL_TRACE_DEBUG("ucol_setStrength success \n"); } + } - return ((size_t) (temp - s - 1)); + if(utf_type == DB_UTIL_COL_UTF8) { + if(cmp_type == DB_UTIL_CMP_LC) { + err = sqlite3_create_collation_v2(db_handle, collator_name, SQLITE_UTF8, ucol, + __db_util_collate_icu_8_lc, (void(*)(void*))__db_util_collate_icu_close); + } else { + err = sqlite3_create_collation_v2(db_handle, collator_name, SQLITE_UTF8, ucol, + __db_util_collate_icu_8, (void(*)(void*))__db_util_collate_icu_close); + } + } else if(utf_type == DB_UTIL_COL_UTF16) { + if(cmp_type == DB_UTIL_CMP_LC) { + err = sqlite3_create_collation_v2(db_handle, collator_name, SQLITE_UTF16, ucol, + __db_util_collate_icu_16_lc, (void(*)(void*))__db_util_collate_icu_close); + } else { + err = sqlite3_create_collation_v2(db_handle, collator_name, SQLITE_UTF16, ucol, + __db_util_collate_icu_16, (void(*)(void*))__db_util_collate_icu_close); + } } else { - /* not-aligned, byte to byte approach - slow */ - unsigned char *temp = (unsigned char *)s; + DB_UTIL_TRACE_ERROR("wrong utf_type param value : %d\n", utf_type); + return DB_UTIL_ERR_PARAM; + } - while (*temp || *(temp + 1)) { - temp += 2; - } - return ((size_t) (temp - (unsigned char *)s) / 2); + if (err != SQLITE_OK) { + DB_UTIL_TRACE_ERROR("sqlite3_create_collation_v2 fail : %d \n", err); + __db_util_collate_icu_close((void*)ucol); + return err; + } else { + DB_UTIL_TRACE_DEBUG("sqlite3_create_collation_v2 success \n"); + return DB_UTIL_OK; } } -DB_UINT16 AcWCharlwr(DB_UINT16 wchCode) +int db_util_create_collation( + PARAM_IN sqlite3 *db_handle, + PARAM_IN db_util_collate_type type, + PARAM_IN db_util_collate_textrep text_type, + PARAM_IN char* col_name) { - if (wchCode >= 0x0041 && wchCode <= 0x005A) { - wchCode = wchCode + WSC_CAP_TO_SMALL_OFFSET; + int ret = DB_UTIL_OK; + UErrorCode status = U_ZERO_ERROR; + char *dl_error = NULL; + const char* locale = NULL; + + DB_UTIL_TRACE_DEBUG("db_util_create_collation start"); + + ret = __db_util_dl_load_icu(); + DB_UTIL_RETV_IF(ret != DB_UTIL_OK, DB_UTIL_ERROR); + + /* get current locale */ + icu_symbol.icu_uloc_setDefault((const char*)getenv("LC_COLLATE"), &status); + locale = icu_symbol.icu_uloc_getDefault(); + if(locale == NULL) { + DB_UTIL_TRACE_WARNING("Fail to get current locale : %d", DB_UTIL_ERR_ENV); + return DB_UTIL_ERROR; + } + DB_UTIL_TRACE_DEBUG("locale : %s", locale); + +#ifdef ENABLE_COL_KO_IC + if((db_util_collate_type == DB_UTIL_COL_KO_IC) || + (db_util_collate_type == DB_UTIL_COL_KO_IC_LC)) { + if(strncmp(locale, "ko", 2) != 0) { + DB_UTIL_TRACE_WARNING("collate type is not match with current locale : %d", DB_UTIL_ERR_ENV); + return DB_UTIL_ERROR; + } + } +#endif + + switch(type) { + case DB_UTIL_COL_UCA : + ret = __db_util_collation_create(db_handle, NULL, col_name, UCOL_SECONDARY, text_type, DB_UTIL_CMP_SC); + break; + case DB_UTIL_COL_LS_AS_CI : + ret = __db_util_collation_create(db_handle, (char*)locale, col_name, UCOL_SECONDARY, text_type, DB_UTIL_CMP_SC); + break; + case DB_UTIL_COL_LS_AI_CI : + ret = __db_util_collation_create(db_handle, (char*)locale, col_name, UCOL_PRIMARY, text_type, DB_UTIL_CMP_SC); + break; + case DB_UTIL_COL_LS_AI_CI_LC : + ret = __db_util_collation_create(db_handle, (char*)locale, col_name, UCOL_PRIMARY, text_type, DB_UTIL_CMP_LC); + break; +#ifdef ENABLE_COL_KO_IC + case DB_UTIL_COL_KO_IC : + ret = __db_util_collation_create(db_handle, (char*)locale, col_name, UCOL_PRIMARY, text_type, DB_UTIL_CMP_SC); + break; + case DB_UTIL_COL_KO_IC_LC : + ret = __db_util_collation_create(db_handle, (char*)locale, col_name, UCOL_PRIMARY, text_type, DB_UTIL_CMP_LC); + break; +#endif + default : + DB_UTIL_TRACE_WARNING("wrong collate input type"); } - return wchCode; + + if(ret != DB_UTIL_OK) + ret = DB_UTIL_ERROR; + + return ret; } -int dbutil_collation(void *data, int l1, const void *s1, int l2, const void *s2) +#ifdef DB_UTIL_ENABLE_DEVDEBUG + +static char *strtoutf8(const UChar * unichars, int len) { - int i = 0, j; - char *str1; - char *str2; - str1 = (char *)calloc(1, l1 + 2); - str2 = (char *)calloc(1, l2 + 2); - memcpy(str1, s1, l1); - memcpy(str2, s2, l2); - i = AcWStrCaseCollate((const DB_UINT16 *)str1, (const DB_UINT16 *)str2); - free(str1); - free(str2); - return i; + DB_UTIL_TRACE_WARNING("strtoutf8 start"); + + int lenstr, lenutf8; + char *pstr = NULL; + UErrorCode status = U_ZERO_ERROR; + + lenstr = lenutf8 = 0; + lenstr = sizeof(char) * 4 * (len + 1); + pstr = (char *)malloc(lenstr); + if (!pstr)return NULL; + u_strToUTF8(pstr, lenstr, &lenutf8, unichars, len, &status); + if (U_FAILURE(status)) { + DB_UTIL_TRACE_WARNING("u_strToUTF8 failed in strtoutf8 :%s\n", + u_errorName(status)); + return NULL; + } + DB_UTIL_TRACE_WARNING("strtoutf8 out : %s", pstr); + return pstr; } + +#endif + diff --git a/db-util.pc.in b/db-util.pc.in index b512bcf..44bff63 100644 --- a/db-util.pc.in +++ b/db-util.pc.in @@ -8,6 +8,6 @@ includedir=@INCLUDEDIR@ Name: db-util Description: DB Utility Version: @VERSION@ -Requires: sqlite3 +Requires: sqlite3 dlog glib-2.0 icu-i18n Libs: -L${libdir} -lSLP-db-util Cflags: -I${includedir} diff --git a/debian/changelog b/debian/changelog index ec69756..3635448 100644..100755 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,359 @@ +libslp-db-util (0.1.0-52) unstable; urgency=low + + * disable return err for collation function + * Git: 165.213.180.234:slp/pkgs/l/libslp-db-util + * Tag: libslp-db-util_0.1.0-52 + + -- Hyungdeuk Kim <hd3.kim@samsung.com> Tue, 5 Jun 2012 19:00:37 +0900 + +libslp-db-util (0.1.0-51) unstable; urgency=low + + * match spec file for obs + * Git: 165.213.180.234:slp/pkgs/l/libslp-db-util + * Tag: libslp-db-util_0.1.0-51 + + -- Hyungdeuk Kim <hd3.kim@samsung.com> Mon, 28 May 2012 11:00:37 +0900 + +libslp-db-util (0.1.0-50) unstable; urgency=low + + * add collation api + * set localized collator at db_util_open api + * Git: 165.213.180.234:slp/pkgs/l/libslp-db-util + * Tag: libslp-db-util_0.1.0-50 + + -- Hyungdeuk Kim <hd3.kim@samsung.com> Sun, 27 May 2012 17:00:37 +0900 + +libslp-db-util (0.1.0-49) unstable; urgency=low + + * add export api define + * Git: 165.213.180.234:slp/pkgs/l/libslp-db-util + * Tag: libslp-db-util_0.1.0-49 + + -- Hyungdeuk Kim <hd3.kim@samsung.com> Thu, 15 Mar 2012 20:00:37 +0900 + +libslp-db-util (0.1.0-48) unstable; urgency=low + + * remove unused apis and header file + * Git: 165.213.180.234:slp/pkgs/l/libslp-db-util + * Tag: libslp-db-util_0.1.0-48 + + -- Hyungdeuk Kim <hd3.kim@samsung.com> Thu, 15 Mar 2012 17:00:37 +0900 + +libslp-db-util (0.1.0-47) unstable; urgency=low + + * deprecate unused apis + * Git: 165.213.180.234:slp/pkgs/l/libslp-db-util + * Tag: libslp-db-util_0.1.0-47 + + -- Hyungdeuk Kim <hd3.kim@samsung.com> Mon, 12 Mar 2012 16:40:37 +0900 + +libslp-db-util (0.1.0-46) unstable; urgency=low + + * add TC files + * insert code to check input param + * Git: 165.213.180.234:slp/pkgs/l/libslp-db-util + * Tag: libslp-db-util_0.1.0-46 + + -- Hyungdeuk Kim <hd3.kim@samsung.com> Wed, 15 Feb 2012 14:40:37 +0900 + libslp-db-util (0.1.0-45) unstable; urgency=low - * Initial Release. - * Git: pkgs/l/libslp-db-util + * remove unnecessary files + * Git: 165.213.180.234:slp/pkgs/l/libslp-db-util * Tag: libslp-db-util_0.1.0-45 - -- Hyungdeuk Kim <hd3.kim@samsung.com> Wed, 07 Dec 2011 14:40:37 +0900 + -- Hyungdeuk Kim <hd3.kim@samsung.com> Fri, 02 Dec 2011 16:40:37 +0900 + +libslp-db-util (0.1.0-44) unstable; urgency=low + + * change busy handler time loop logic + * disable change journal mode option + * Git: 165.213.180.234:slp/pkgs/l/libslp-db-util + * Tag: libslp-db-util_0.1.0-44 + + -- Hyungdeuk Kim <hd3.kim@samsung.com> Tue, 15 Nov 2011 17:40:37 +0900 + +libslp-db-util (0.1.0-43) unstable; urgency=low + + * change busy handler time from 100ms to 1.5s + * disable change journal mode option + * Git: 165.213.180.234:slp/pkgs/l/libslp-db-util + * Tag: libslp-db-util_0.1.0-43 + + -- Hyungdeuk Kim <hd3.kim@samsung.com> Thu, 11 Nov 2011 17:40:37 +0900 + +libslp-db-util (0.1.0-42) unstable; urgency=low + + * change boilerplate + * Git: 165.213.180.234:slp/pkgs/l/libslp-db-util + * Tag: libslp-db-util_0.1.0-42 + + -- Hyungdeuk Kim <hd3.kim@samsung.com> Thu, 3 Nov 2011 17:40:37 +0900 + +libslp-db-util (0.1.0-41) unstable; urgency=low + + * apply indent & checkpath + * Git: 165.213.180.234:slp/pkgs/l/libslp-db-util + * Tag: libslp-db-util_0.1.0-41 + + -- Hyungdeuk Kim <hd3.kim@samsung.com> Tue, 26 May 2011 17:40:37 +0900 + +libslp-db-util (0.1.0-40) unstable; urgency=low + + * edit boilerplate + * Git: 165.213.180.234:slp/pkgs/l/libslp-db-util + * Tag: libslp-db-util_0.1.0-40 + + -- Hyungdeuk Kim <hd3.kim@samsung.com> Wed, 13 May 2011 17:40:37 +0900 + +libslp-db-util (0.1.0-39) unstable; urgency=low + + * add boilerplate to code + * Git: 165.213.180.234:slp/pkgs/l/libslp-db-util + * Tag: libslp-db-util_0.1.0-39 + + -- Hyungdeuk Kim <hd3.kim@samsung.com> Wed, 13 May 2011 16:40:37 +0900 + +libslp-db-util (0.1.0-38) unstable; urgency=low + + * change the procedure for db conection + * Git: 165.213.180.234:slp/pkgs/l/libslp-db-util + * Tag: libslp-db-util_0.1.0-38 + + -- Jinkun Jang <jinkun.jang@samsung.com> Wed, 04 May 2011 10:40:37 +0900 + +libslp-db-util (0.1.0-37) unstable; urgency=low + + * change == to = + * Git: 165.213.180.234:slp/pkgs/l/libslp-db-util + * Tag: libslp-db-util_0.1.0-37 + + -- Jinkun Jang <jinkun.jang@samsung.com> Wed, 15 Dec 2010 10:18:37 +0900 + +libslp-db-util (0.1.0-36) unstable; urgency=low + + * modify postinst + * Git: 165.213.180.234:slp/pkgs/l/libslp-db-util + * Tag: libslp-db-util_0.1.0-36 + + -- Jinkun.jang <jinkun.jang@samsung.com> Wed, 08 Dec 2010 20:04:32 +0900 + +libslp-db-util (0.1.0-35) unstable; urgency=low + + * add postinst + * Git: 165.213.180.234:slp/pkgs/l/libslp-db-util + * Tag: libslp-db-util_0.1.0-35 + + -- Jinkun.jang <jinkun.jang@samsung.com> Wed, 08 Dec 2010 19:00:58 +0900 + +libslp-db-util (0.1.0-34) unstable; urgency=low + + * add dependency for SQLite3 command package + * Git: 165.213.180.234:/git/slp/pkgs/libslp-db-util + * Tag: libslp-db-util_0.1.0-34 + + -- Jinkun Jang <jinkun.jang@samsung.com> Fri, 12 Nov 2010 10:20:03 +0900 + +libslp-db-util (0.1.0-33) unstable; urgency=low + + * add copyright + * Git: 165.213.180.234:/git/slp/pkgs/libslp-db-util + * Tag: libslp-db-util_0.1.0-33 + + -- Jinkun Jang <jinkun.jang@samsung.com> Wed, 27 Oct 2010 13:49:59 +0900 + +libslp-db-util (0.1.0-32) unstable; urgency=low + + * modified CMakeLists.txt for renaming so files + * Git: 165.213.180.234:/git/slp/pkgs/libslp-db-util + * Tag: libslp-db-util_0.1.0-32 + + -- Jinkun Jang <jinkun.jang@samsung.com> Thu, 21 Oct 2010 15:52:46 +0900 + +libslp-db-util (0.1.0-31) unstable; urgency=low + + * remove lucene trriger + * Git: 165.213.180.234:/git/slp/pkgs/libslp-db-util + * Tag: libslp-db-util_0.1.0-31 + + -- Jinkun Jang <jinkun.jang@samsung.com> Mon, 30 Aug 2010 16:01:53 +0900 + +libslp-db-util (0.1.0-30) unstable; urgency=low + + * remove @internal tag from header files + * Git: 165.213.180.234:/git/slp/pkgs/libslp-db-util + * Tag: libslp-db-util_0.1.0-30 + + -- Jinkun Jang <jinkun.jang@samsung.com> Thu, 22 Jul 2010 20:04:15 +0900 + +libslp-db-util (0.1.0-29) unstable; urgency=low + + * modify debian control file for "XB-Public-Package: no" + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libslp-db-util-0 + * Tag: libslp-db-util_0.1.0-29 + + -- Jinkun Jang <jinkun.jang@samsung.com> Mon, 12 Jul 2010 14:50:52 +0900 + +libslp-db-util (0.1.0-28) unstable; urgency=low + + * add maintainer + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libslp-db-util-0 + * Tag: libslp-db-util_0.1.0-28 + + -- Jinkun Jang <jinkun.jang@samsung.com> Thu, 08 Jul 2010 15:41:29 +0900 + +libslp-db-util (0.1.0-27) unstable; urgency=low + + * move header files to /usr/include/db-util + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libslp-db-util-0 + * Tag: libslp-db-util_0.1.0-27 + + -- jinkun.jang <jinkun.jang@samsung.com> Thu, 17 Jun 2010 12:59:35 +0900 + +libslp-db-util (0.1.0-26) unstable; urgency=low + + * modify db-util.pc for dependency information + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libslp-db-util-0 + * Tag: libslp-db-util_0.1.0-26 + + -- jinkun.jang <jinkun.jang@samsung.com> Tue, 01 Jun 2010 20:57:04 +0900 + +libslp-db-util (0.1.0-25) unstable; urgency=low + + * add samsung copyright + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libslp-db-util-0 + * Tag: libslp-db-util_0.1.0-25 + + -- jinkun.jang <jinkun.jang@samsung.com> Thu, 27 May 2010 12:39:42 +0900 + +libslp-db-util (0.1.0-24) unstable; urgency=low + + * remove libslp-db-util-0.postinst for file owner & permission + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libslp-db-util-0 + * Tag: libslp-db-util_0.1.0-24 + + -- jinkun.jang <jinkun.jang@samsung.com> Tue, 11 May 2010 11:27:33 +0900 + +libslp-db-util (0.1.0-23) unstable; urgency=low + + * add libslp-db-util-0.postinst for file owner & permission + * add EXPORT_API for db_util_open_with_options() + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libslp-db-util-0 + * Tag: libslp-db-util_0.1.0-23 + + -- jinkun.jang <jinkun.jang@samsung.com> Thu, 15 Apr 2010 09:22:41 +0900 + +libslp-db-util (0.1.0-22) unstable; urgency=low + + * add db_util_open_with_options() interface for sqlite3_open_v2() + * add SET_TARGET_PROPERTIES() + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libslp-db-util-0 + * Tag: libslp-db-util_0.1.0-22 + + -- jinkun.jang <jinkun.jang@samsung.com> Tue, 13 Apr 2010 09:01:01 +0900 + +libslp-db-util (0.1.0-21) unstable; urgency=low + + * modify header files for c++ guard & hardcoded constants + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libslp-db-util-0 + * Tag: libslp-db-util_0.1.0-21 + + -- jinkun.jang <jinkun.jang@samsung.com> Tue, 06 Apr 2010 11:18:18 +0900 + +libslp-db-util (0.1.0-20) unstable; urgency=low + + * remove DOS style lin endings + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libslp-db-util-0 + * Tag: libslp-db-util_0.1.0-20 + + -- jinkun.jang <jinkun.jang@samsung.com> Mon, 05 Apr 2010 14:03:35 +0900 + +libslp-db-util (0.1.0-19) unstable; urgency=low + + * upgrade toochain + + -- jinkun.jang <jinkun.jang@samsung.com> Thu, 25 Mar 2010 15:48:13 +0900 + +libslp-db-util (0.1.0-18) unstable; urgency=low + + * add Busy handler for db_util_open() + + -- jinkun.jang <jinkun.jang@samsung.com> Mon, 08 Mar 2010 17:09:31 +0900 + +libslp-db-util (0.1.0-17) unstable; urgency=low + + * chage section from non-free to main + + -- jinkun.jang <jinkun.jang@samsung.com> Mon, 08 Mar 2010 09:25:38 +0900 + +libslp-db-util (0.1.0-16) unstable; urgency=low + + * change section to non-free + + -- jinkun.jang <jinkun.jang@samsung.com> Fri, 26 Feb 2010 10:57:46 +0900 + +libslp-db-util (0.1.0-15) unstable; urgency=low + + * add '\0' to last character of _szDBPath in util_func.c + + -- jinkun.jang <jinkun.jang@samsung.com> Tue, 23 Feb 2010 21:10:20 +0900 + +libslp-db-util (0.1.0-14) unstable; urgency=low + + * Enable PERSIST journal mode + + -- Sangjung Woo <sangjung.woo@samsung.com> Wed, 3 Feb 2010 19:37:24 +0900 + +libslp-db-util (0.1.0-13) unstable; urgency=low + + * Add lucene-index-trigger function + + -- Sangjung Woo <sangjung.woo@samsung.com> Tue, 2 Feb 2010 20:37:24 +0900 + +libslp-db-util (0.1.0-12) unstable; urgency=low + + * Add Doxygen comments + + -- Sangjung Woo <sangjung.woo@samsung.com> Tue, 2 Feb 2010 16:37:24 +0900 + +libslp-db-util (0.1.0-11) unstable; urgency=low + + * Modify control file for dependency with other package + + -- jinkun jang <jinkun.jang@samsung.com> Wed, 27 Jan 2010 14:37:24 +0900 + +libslp-db-util (0.1.0-10) unstable; urgency=low + + * Modify db_util_close() function + + -- Sangjung Woo <sangjung.woo@samsung.com> Wed, 27 Jan 2010 10:00:51 +0900 + +libslp-db-util (0.1.0-9) unstable; urgency=low + + * PC file changed from SLP-db-util.pc to db-util.pc + + -- jinkun jang <jinkun.jang@samsung.com> Tue, 26 Jan 2010 18:33:51 +0900 + +libslp-db-util (0.1.0-4) unstable; urgency=low + + * Add debug package + + -- Sangjung Woo <sangjung.woo@samsung.com> Thu, 21 Dec 2009 12:00:03 +0900 + +libslp-db-util (0.1.0-3) unstable; urgency=low + + * Add db_util_open() and db_util_close() + + -- Sangjung Woo <sangjung.woo@samsung.com> Wen, 20 Dec 2009 17:22:03 +0900 + +libslp-db-util (0.1.0-2) unstable; urgency=low + + * Rollbacked. + + -- Sangjung Woo <sangjung.woo@samsung.com> Thur, 19 Dec 2009 10:22:03 +0900 + +libslp-db-util (0.1.0) unstable; urgency=low + + * Initial Release. + + -- Sangjung Woo <sangjung.woo@samsung.com> Thur, 10 Dec 2009 10:22:03 +0900 diff --git a/debian/control b/debian/control index cfa75b8..298c924 100644..100755 --- a/debian/control +++ b/debian/control @@ -3,19 +3,19 @@ Section: main Priority: optional Maintainer: Hyungdeuk Kim <hd3.kim@samsung.com> Hakjoo ko <hakjoo.ko@samsung.com> Uploaders: Hyungdeuk Kim <hd3.kim.@smasung.com> Hakjoo Ko <hakjoo.ko@samsung.com> -Build-Depends: debhelper (>= 5), autotools-dev, libsqlite3-dev, dlog-dev +Build-Depends: debhelper (>= 5), autotools-dev, libsqlite3-dev, dlog-dev, libglib2.0-dev, libicu-dev Standards-Version: 0.1.0 Package: libslp-db-util-dev Section: main Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, libslp-db-util-0 (= ${Source-Version}), libsqlite3-dev, dlog-dev +Depends: ${shlibs:Depends}, ${misc:Depends}, libslp-db-util-0 (= ${Source-Version}), libsqlite3-dev, dlog-dev, libglib2.0-dev, libicu-dev Description: libslp-db-util-dev package Package: libslp-db-util-0 Section: main Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, libsqlite3-0, sqlite3, libdlog-0 +Depends: ${shlibs:Depends}, ${misc:Depends}, libsqlite3-0, sqlite3, libdlog-0, libglib2.0-0 Description: libslp-db-util package Package: libslp-db-util-dbg diff --git a/debian/rules b/debian/rules index 444de5e..ad831a0 100755 --- a/debian/rules +++ b/debian/rules @@ -11,7 +11,7 @@ CFLAGS ?= -Wall -g CXXFLAGS ?= -Wall -g -LDFLAGS ?= +LDFLAGS ?= PREFIX ?= /usr DATADIR ?= /opt @@ -35,7 +35,7 @@ configure-stamp: build: build-stamp -build-stamp: configure-stamp +build-stamp: configure-stamp dh_testdir # Add here commands to compile the package. @@ -69,12 +69,12 @@ clean: rm -f $${f%.in}; \ done - dh_clean + dh_clean install: build dh_testdir dh_testroot - dh_clean -k + dh_prep dh_installdirs # Add here commands to install the package into debian/wavplayer. @@ -89,12 +89,12 @@ binary-indep: build install binary-arch: build install dh_testdir dh_testroot - dh_installchangelogs - dh_installdocs +# dh_installchangelogs +# dh_installdocs dh_installexamples dh_install --sourcedir=debian/tmp # dh_installmenu -# dh_installdebconf +# dh_installdebconf # dh_installlogrotate # dh_installemacsen # dh_installpam diff --git a/include/collation.h b/include/collation.h index 0e8450a..dff9c53 100755 --- a/include/collation.h +++ b/include/collation.h @@ -19,8 +19,8 @@ * */ -#ifndef __COLLATION_H__ -#define __COLLATION_H__ +#ifndef __DBUTIL_COLLATION_H__ +#define __DBUTIL_COLLATION_H__ #ifdef __cplusplus extern "C" { @@ -28,25 +28,95 @@ extern "C" { #include <db-util-common.h> -/** -* @defgroup StorageFW Storage Framework -* In order to support applications using DB -*/ +/* + * Collations Types + * + * These types are intended for use in the + * 2nd parameter to the [db_util_create_collation()] interface. + * The meanings of the various types is shown below. + * + * [DB_UTIL_COL_UCA] + * Unicode Collation Algorithm / Locale InSensitive / Accent Sensitive / Case Insensitive + * This type will be mostly used in 'ORDER BY' clause of sql for sorted list. + * + * [DB_UTIL_COL_LS_AS_CI] + * Locale Sensitive / Accent Sensitive / Case Insensitive + * This type will be mostly used in 'ORDER BY' clause of sql for sorted list. + * + * [DB_UTIL_COL_LS_AI_CI] + * Locale Sensitive / Accent Insensitive / Case Insensitive + * This type will be mostly used for '=' operator comparison in 'WHERE' clause. + + * [DB_UTIL_COL_LS_AI_CI_LC] + * Locale Sensitive / Accent Insensitive / Loop Comparison + * This type will be mostly used for 'LIKE' operator comparison in 'WHERE' clause. + * + * [DB_UTIL_COL_KR_IC] + * Locale Sensitive / Korea / Initial(leading) Consonant + * Compares string data using initial(leading) consonant for korea locale. + * This type will be mostly used for '=' operator comparison in 'WHERE' clause. + * + * [DB_UTIL_COL_KR_IC_LC] + * Locale Sensitive / Korea / Initial(leading) Consonant / Loop Comparison + * Compares string data using initial(leading) consonant for korea locale. + * This type will be mostly used for 'LIKE' operator comparison in 'WHERE' clause. + */ + +typedef enum { + DB_UTIL_COL_UCA, + DB_UTIL_COL_LS_AS_CI, + DB_UTIL_COL_LS_AI_CI, + DB_UTIL_COL_LS_AI_CI_LC, + DB_UTIL_COL_KO_IC, + DB_UTIL_COL_KO_IC_LC +} db_util_collate_type; + +/* + * Text Encodings + * + * These encodings are intended for use in the + * 3rd parameter to the [db_util_create_collation()] interface. + */ +typedef enum { + DB_UTIL_COL_UTF8 = SQLITE_UTF8, + DB_UTIL_COL_UTF16 = SQLITE_UTF16 +} db_util_collate_textrep; + /** * @defgroup DB_UTIL * @ingroup StorageFW * @{ */ -EXPORT_API int dbutil_collation(void *data, int l1, const void *s1, - int l2, const void *s2); + +/** + * @fn int db_util_create_collation(sqlite3 *db_handle, db_util_collate_type type, db_util_collate_textrep text_type, char* col_name); + * This function defines a new collating sequences with the database connection specified as the firtst argument. + * This function is needed to be invoked after [db_util_open()]. + * + * @param[in] Db connection handle to create collation with + * @param[in] Collation type. This value must be one of the [db_util_collate_type] + * @param[in] Encoding of text passed to the collating function callback + * @param[in] The name of collation(UTF-8 string) + * return This function returns DB_UTIL_OK or error code on failure + * @exception None + * @remarks None + * @pre Database connected + * @post None + * @code + */ +EXPORT_API int db_util_create_collation( + PARAM_IN sqlite3 *db_handle, + PARAM_IN db_util_collate_type type, + PARAM_IN db_util_collate_textrep text_type, + PARAM_IN char* col_name +); + /** *@} */ -#define COLLATION "Collation" - #ifdef __cplusplus } #endif -#endif /* __COLLATION_H__ */ +#endif /* __DBUTIL_COLLATION_H__ */ diff --git a/include/db-util-common.h b/include/db-util-common.h index 11d4915..4229d5a 100755 --- a/include/db-util-common.h +++ b/include/db-util-common.h @@ -27,6 +27,7 @@ extern "C" { #endif #include <stdio.h> +#include <stdlib.h> #include <stdbool.h> #include <sqlite3.h> @@ -34,6 +35,20 @@ extern "C" { #define EXPORT_API __attribute__ ((visibility("default"))) #endif +#ifndef PARAM_IN +#define PARAM_IN +#endif + +#ifndef PARAM_OUT +#define PARAM_OUT +#endif + +typedef enum { + DB_UTIL_ERROR = SQLITE_ERROR, + DB_UTIL_OK = SQLITE_OK, +} db_util_err; + + #ifdef __cplusplus } #endif diff --git a/include/db-util-debug.h b/include/db-util-debug.h index ca5def0..c7b226b 100755 --- a/include/db-util-debug.h +++ b/include/db-util-debug.h @@ -19,14 +19,11 @@ * */ -#ifndef __DBUTIL_DEBUG_H_ -#define __DBUTIL_DEBUG_H_ +#ifndef __DB_UTIL_DEBUG_H_ +#define __DB_UTIL_DEBUG_H_ #include <stdio.h> -#define DBUTIL_USING_PLATFORM_DBG -#define DBUTIL_ENABLE_TRACE - -#ifdef DBUTIL_USING_PLATFORM_DBG +#ifdef DB_UTIL_USING_PLATFORM_DBG #include <dlog.h> #ifdef LOG_TAG #undef LOG_TAG @@ -34,27 +31,27 @@ #define LOG_TAG "DBUTIL" #endif -#ifdef DBUTIL_ENABLE_TRACE +#ifdef DB_UTIL_ENABLE_TRACE - #ifdef DBUTIL_USING_PLATFORM_DBG + #ifdef DB_UTIL_USING_PLATFORM_DBG - #define DBUTIL_TRACE_DEBUG LOGD - #define DBUTIL_TRACE_WARNING LOGW - #define DBUTIL_TRACE_ERROR LOGE + #define DB_UTIL_TRACE_DEBUG LOGD + #define DB_UTIL_TRACE_WARNING LOGW + #define DB_UTIL_TRACE_ERROR LOGE #else - #define DBUTIL_TRACE_DEBUG(fmt, arg...) \ + #define DB_UTIL_TRACE_DEBUG(fmt, arg...) \ do {\ fprintf(stderr,"[DBUTIL]\033[0;32mDEBUG: " fmt "\033[0m\t%s:%d\n", ##arg, strrchr(__FILE__, '/')+1, __LINE__);\ }while(0); - #define DBUTIL_TRACE_WARNING(fmt, arg...) \ + #define DB_UTIL_TRACE_WARNING(fmt, arg...) \ do {\ fprintf(stderr,"[DBUTIL]\033[0;33mWARRING: " fmt "\033[0m\t%s:%d\n", ##arg, strrchr(__FILE__, '/')+1, __LINE__);\ }while(0); - #define DBUTIL_TRACE_ERROR(fmt, arg...) \ + #define DB_UTIL_TRACE_ERROR(fmt, arg...) \ do {\ fprintf(stderr, "[DBUTIL]\033[0;31mERROR: " fmt "\033[0m\t%s:%d\n", ##arg, strrchr(__FILE__, '/')+1, __LINE__);\ }while(0); @@ -63,10 +60,10 @@ #else - #define DBUTIL_TRACE_DEBUG(fmt, arg...) - #define DBUTIL_TRACE_WARNING(fmt, arg...) - #define DBUTIL_TRACE_ERROR(fmt, arg...) - + #define DB_UTIL_TRACE_DEBUG(fmt, arg...) + #define DB_UTIL_TRACE_WARNING(fmt, arg...) + #define DB_UTIL_TRACE_ERROR(fmt, arg...) + #endif -#endif /* __DBUTIL_DEBUG_H_ */ +#endif /* __DB_UTIL_DEBUG_H_ */ diff --git a/include/db-util.h b/include/db-util.h index 68fbd37..36b47c6 100755 --- a/include/db-util.h +++ b/include/db-util.h @@ -26,9 +26,8 @@ extern "C" { #endif -#include "collation.h" -#include "convert.h" #include "util-func.h" +#include "collation.h" #ifdef __cplusplus } diff --git a/include/util-func.h b/include/util-func.h index 6ad6c39..951584d 100755 --- a/include/util-func.h +++ b/include/util-func.h @@ -41,12 +41,49 @@ extern "C" { * @ingroup StorageFW * @{ */ + + + +/** + * @brief invoke sqlite3_open with platform common configuration + * @details register busy handler, create localized collation + * @param [in] database file name (UTF-8) + * @param [out] SQLite database handle + * @param [in] option value + * @return sqlite3 function return value will be returned + * @see db_util_open_with_options() + * @see db_util_close() + * + */ EXPORT_API int db_util_open(const char *pszFilePath, sqlite3 **ppDB, - int nOption); + int nOption); + +/** + * @brief invoke sqlite3_open_v2 with platform common configuration + * @details register busy handler, create localized collation + * @param [in] database file name (UTF-8) + * @param [out] SQLite database handle + * @param [in] sqlite3_open_v2 flags + * @param [in] Name of VFS module to use + * @return sqlite3 function return value will be returned + * @see db_util_open() + * @see db_util_close() + * + */ EXPORT_API int db_util_open_with_options(const char *pszFilePath, - sqlite3 **ppDB, int flags, - const char *zVfs); + sqlite3 **ppDB, int flags, + const char *zVfs); + +/** + * @brief closing a database connection + * @param [in] SQLite database handle + * @return sqlite3_close function return value will be returned + * @see db_util_open() + * @see db_util_open_with_options() + * + */ EXPORT_API int db_util_close(sqlite3 *ppDB); + /** *@} */ diff --git a/libSLP-db-util.manifest b/libSLP-db-util.manifest new file mode 100644 index 0000000..97e8c31 --- /dev/null +++ b/libSLP-db-util.manifest @@ -0,0 +1,5 @@ +<manifest> + <request> + <domain name="_"/> + </request> +</manifest> diff --git a/packaging/libslp-db-util.spec b/packaging/libslp-db-util.spec index 36bb1ce..8c897a3 100644..100755 --- a/packaging/libslp-db-util.spec +++ b/packaging/libslp-db-util.spec @@ -1,68 +1,68 @@ - Name: libslp-db-util Summary: DB Utility -Version: 0.1.0 -Release: 2.1 -Group: TO_BE/FILLED_IN -License: TO BE FILLED IN -Source0: libslp-db-util-%{version}.tar.bz2 +Version: 0.1.1 +Release: 4 +Group: System/Libraries +License: Apache License, Version 2.0 +Source0: %{name}-%{version}.tar.gz Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig BuildRequires: cmake BuildRequires: pkgconfig(sqlite3) - +BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(icu-i18n) %description -libslp-db-util-dev package - - %package devel Summary: Devel package for libslp-db-util (devel) Group: Development/Libraries Requires: %{name} = %{version}-%{release} -Requires: pkgconfig(sqlite3) %description devel -heynoti API (devel) - %prep %setup -q -n %{name}-%{version} - %build cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} - make %{?jobs:-j%jobs} %install rm -rf %{buildroot} %make_install - - - - -%post -p /sbin/ldconfig +mkdir -p %{buildroot}/usr/share/license +install LICENSE.APLv2 %{buildroot}/usr/share/license/%{name} + +%post +/sbin/ldconfig +if [ ! -d /opt/dbspace ] +then + mkdir -p /opt/dbspace +fi +if [ ! -d /opt/usr/dbspace ] +then + mkdir -p /opt/usr/dbspace +fi +chown :5000 /opt/dbspace +chmod 775 /opt/dbspace +chown :5000 /opt/usr/dbspace +chmod 775 /opt/usr/dbspace %postun -p /sbin/ldconfig - - - - %files +%manifest libSLP-db-util.manifest %defattr(-,root,root,-) -%doc COPYING +%{_libdir}/libSLP-db-util.so %{_libdir}/libSLP-db-util.so.0 %{_libdir}/libSLP-db-util.so.0.1.0 - +/usr/share/license/%{name} %files devel %defattr(-,root,root,-) -#%{_prefix}/bin/test_db %{_includedir}/db-util/*.h %{_libdir}/pkgconfig/db-util.pc -%{_libdir}/libSLP-db-util.so diff --git a/util_func.c b/util_func.c index 2465cb3..ba242f3 100755 --- a/util_func.c +++ b/util_func.c @@ -19,105 +19,125 @@ * */ -#include <util-func.h> #include <string.h> #include <unistd.h> +#include "util-func.h" +#include "collation.h" #include "db-util-debug.h" -#define BUFSIZE 512 -static char _szDBPath[BUFSIZE] = { 0, }; - -static int db_util_busyhandler(void *pData, int count) +static int __db_util_busyhandler(void *pData, int count) { if(5 - count > 0) { - DBUTIL_TRACE_DEBUG("Busy Handler Called! : PID(%d) / CNT(%d)\n", getpid(), count+1); + DB_UTIL_TRACE_DEBUG("Busy Handler Called! : PID(%d) / CNT(%d)\n", getpid(), count+1); usleep((count+1)*100000); return 1; } else { - DBUTIL_TRACE_DEBUG("Busy Handler will be returned SQLITE_BUSY error : PID(%d) \n", getpid()); + DB_UTIL_TRACE_DEBUG("Busy Handler will be returned SQLITE_BUSY error : PID(%d) \n", getpid()); return 0; } } -int db_util_open(const char *pszFilePath, sqlite3 **ppDB, int nOption) +static int __db_util_open(sqlite3 *ppDB) { - char *pszErrorMsg = NULL; - - /* Save DB Path & Option */ - strncpy(_szDBPath, pszFilePath, strlen(pszFilePath)); - _szDBPath[strlen(pszFilePath)] = '\0'; - - /* Open DB */ - int rc = sqlite3_open(pszFilePath, ppDB); - if (SQLITE_OK != rc) { - return rc; + int rc = 0; + + if(ppDB == NULL) { + DB_UTIL_TRACE_WARNING("Invalid input param error"); + return DB_UTIL_ERROR; } - + /* Register Busy handler */ - rc = sqlite3_busy_handler(*ppDB, db_util_busyhandler, NULL); + rc = sqlite3_busy_handler(ppDB, __db_util_busyhandler, NULL); if (SQLITE_OK != rc) { - printf("Fail to register busy handler\n"); - sqlite3_close(*ppDB); + DB_UTIL_TRACE_WARNING("Fail to register busy handler\n"); + sqlite3_close(ppDB); return rc; } -#if SET_PERSIST_JOURNAL_MODE +#ifdef SET_PERSIST_JOURNAL_MODE + /* Code to change default journal mode of sqlite3 is enabled so this option is disabled */ /* Enable persist journal mode */ - rc = sqlite3_exec(*ppDB, "PRAGMA journal_mode = PERSIST", + rc = sqlite3_exec(ppDB, "PRAGMA journal_mode = PERSIST", NULL, NULL, &pszErrorMsg); if (SQLITE_OK != rc) { - DBUTIL_TRACE_WARNING("Fail to change journal mode: %d, %d, %s, %s\n", sqlite3_errcode(*ppDB), sqlite3_extended_errcode(*ppDB), pszErrorMsg, sqlite3_errmsg(*ppDB)); + DB_UTIL_TRACE_WARNING("Fail to change journal mode: %d, %d, %s, %s\n", + sqlite3_errcode(ppDB), + sqlite3_extended_errcode(ppDB), + pszErrorMsg, + sqlite3_errmsg(ppDB)); sqlite3_free(pszErrorMsg); - sqlite3_close(*ppDB); + sqlite3_close(ppDB); return rc; } #endif - return rc; + + db_util_create_collation(ppDB, DB_UTIL_COL_LS_AS_CI, + DB_UTIL_COL_UTF8, "localized"); +#if 0 + if (DB_UTIL_OK != rc) { + DB_UTIL_TRACE_WARNING("Fail to create collation"); + return rc; + } +#endif + + return DB_UTIL_OK; } -int db_util_open_with_options(const char *pszFilePath, sqlite3 **ppDB, - int flags, const char *zVfs) +int db_util_open(const char *pszFilePath, sqlite3 **ppDB, int nOption) { char *pszErrorMsg = NULL; - - /* Save DB Path & Option */ - strncpy(_szDBPath, pszFilePath, strlen(pszFilePath)); - _szDBPath[strlen(pszFilePath)] = '\0'; - + + if((pszFilePath == NULL) || (ppDB == NULL)) { + DB_UTIL_TRACE_WARNING("Invalid input param error"); + return DB_UTIL_ERROR; + } + /* Open DB */ - int rc = sqlite3_open_v2(pszFilePath, ppDB, flags, zVfs); + int rc = sqlite3_open(pszFilePath, ppDB); if (SQLITE_OK != rc) { return rc; } - - /* Register Busy handler */ - rc = sqlite3_busy_handler(*ppDB, db_util_busyhandler, NULL); - if (SQLITE_OK != rc) { - printf("Fail to register busy handler\n"); - sqlite3_close(*ppDB); - return rc; + + rc = __db_util_open(*ppDB); + + return rc; +} + +int db_util_open_with_options(const char *pszFilePath, sqlite3 **ppDB, + int flags, const char *zVfs) +{ + char *pszErrorMsg = NULL; + + if((pszFilePath == NULL) || (ppDB == NULL)) { + DB_UTIL_TRACE_WARNING("sqlite3 handle null error"); + return DB_UTIL_ERROR; } - -#if SET_PERSIST_JOURNAL_MODE - /* Enable persist journal mode */ - rc = sqlite3_exec(*ppDB, "PRAGMA journal_mode = PERSIST", - NULL, NULL, &pszErrorMsg); + + /* Open DB */ + int rc = sqlite3_open_v2(pszFilePath, ppDB, flags, zVfs); if (SQLITE_OK != rc) { - DBUTIL_TRACE_WARNING("Fail to change journal mode: %s\n", pszErrorMsg); - sqlite3_free(pszErrorMsg); - sqlite3_close(*ppDB); return rc; } -#endif + + rc = __db_util_open(*ppDB); + return rc; } int db_util_close(sqlite3 *ppDB) { + char *pszErrorMsg = NULL; + /* Close DB */ int rc = sqlite3_close(ppDB); - return rc; + if (SQLITE_OK != rc) { + DB_UTIL_TRACE_WARNING("Fail to change journal mode: %s\n", pszErrorMsg); + sqlite3_free(pszErrorMsg); + return rc; + } + + return DB_UTIL_OK; } |