You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2010/10/18 00:32:19 UTC
[lucy-commits] svn commit: r1023591 - in /incubator/lucy/trunk/import: LICENSE NOTICE
core/KinoSearch/Util/StringHelper.c core/KinoSearch/Util/StringHelper2.c
Author: marvin
Date: Sun Oct 17 22:32:18 2010
New Revision: 1023591
URL: http://svn.apache.org/viewvc?rev=1023591&view=rev
Log:
Break out materials derived from ICU4C into a separate file. Add the required
texts to LICENSE and NOTICE. (break_out_icu4c.patch from LUCY-123)
Added:
incubator/lucy/trunk/import/core/KinoSearch/Util/StringHelper2.c
- copied, changed from r1023578, incubator/lucy/trunk/import/core/KinoSearch/Util/StringHelper.c
Modified:
incubator/lucy/trunk/import/LICENSE
incubator/lucy/trunk/import/NOTICE
incubator/lucy/trunk/import/core/KinoSearch/Util/StringHelper.c
Modified: incubator/lucy/trunk/import/LICENSE
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/LICENSE?rev=1023591&r1=1023590&r2=1023591&view=diff
==============================================================================
--- incubator/lucy/trunk/import/LICENSE (original)
+++ incubator/lucy/trunk/import/LICENSE Sun Oct 17 22:32:18 2010
@@ -200,3 +200,42 @@
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.
+
+Some code in core/KinoSearch/Util/StringHelper2.c was derived from ICU4C,
+available from <http://icu-project.org/>. Here is the license for those
+materials:
+
+ ICU License - ICU 1.8.1 and later
+
+ COPYRIGHT AND PERMISSION NOTICE
+
+ Copyright (c) 1995-2010 International Business Machines Corporation and others
+
+ All rights reserved.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, and/or sell
+ copies of the Software, and to permit persons
+ to whom the Software is furnished to do so, provided that the above
+ copyright notice(s) and this permission notice appear in all copies
+ of the Software and that both the above copyright notice(s) and this
+ permission notice appear in supporting documentation.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL
+ THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM,
+ OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
+ RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+ USE OR PERFORMANCE OF THIS SOFTWARE.
+
+ Except as contained in this notice, the name of a copyright holder shall not be
+ used in advertising or otherwise to promote the sale, use or other dealings in
+ this Software without prior written authorization of the copyright holder.
+
+ All trademarks and registered trademarks mentioned herein are the property
+ of their respective owners.
+
Modified: incubator/lucy/trunk/import/NOTICE
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/NOTICE?rev=1023591&r1=1023590&r2=1023591&view=diff
==============================================================================
--- incubator/lucy/trunk/import/NOTICE (original)
+++ incubator/lucy/trunk/import/NOTICE Sun Oct 17 22:32:18 2010
@@ -3,3 +3,7 @@ Copyright 2010 The Apache Software Found
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
+
+This software contains code derived from ICU4C, Copyright (c) 1995-2010
+International Business Machines Corporation and others.
+
Modified: incubator/lucy/trunk/import/core/KinoSearch/Util/StringHelper.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/core/KinoSearch/Util/StringHelper.c?rev=1023591&r1=1023590&r2=1023591&view=diff
==============================================================================
--- incubator/lucy/trunk/import/core/KinoSearch/Util/StringHelper.c (original)
+++ incubator/lucy/trunk/import/core/KinoSearch/Util/StringHelper.c Sun Oct 17 22:32:18 2010
@@ -8,71 +8,6 @@
#include "KinoSearch/Object/Err.h"
#include "KinoSearch/Util/Memory.h"
-// The content of the following table is derived from the
-// "utf8_countTrailBytes" table in ICU4C 4.4.1.
-
-/*
-ICU License - ICU 1.8.1 and later
-
-COPYRIGHT AND PERMISSION NOTICE
-
-Copyright (c) 1995-2010 International Business Machines Corporation and others
-
-All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-the rights to use, copy, modify, merge, publish, distribute, and/or sell
-copies of the Software, and to permit persons
-to whom the Software is furnished to do so, provided that the above
-copyright notice(s) and this permission notice appear in all copies
-of the Software and that both the above copyright notice(s) and this
-permission notice appear in supporting documentation.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL
-THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM,
-OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
-NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
-USE OR PERFORMANCE OF THIS SOFTWARE.
-
-Except as contained in this notice, the name of a copyright holder shall not be
-used in advertising or otherwise to promote the sale, use or other dealings in
-this Software without prior written authorization of the copyright holder.
-
-All trademarks and registered trademarks mentioned herein are the property of their respective owners.
-*/
-
-const uint8_t kino_StrHelp_UTF8_COUNT[] = {
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 4, 4, 4, 4, 4,
- 4, 4, 4, /* illegal in Unicode */
- 5, 5, 5, 5, /* illegal in Unicode */
- 6, 6, /* illegal in Unicode */
- 7, 7 /* illegal bytes 0xfe and 0xff */
-};
-
int32_t
StrHelp_overlap(const char *a, const char *b, size_t a_len, size_t b_len)
{
Copied: incubator/lucy/trunk/import/core/KinoSearch/Util/StringHelper2.c (from r1023578, incubator/lucy/trunk/import/core/KinoSearch/Util/StringHelper.c)
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/import/core/KinoSearch/Util/StringHelper2.c?p2=incubator/lucy/trunk/import/core/KinoSearch/Util/StringHelper2.c&p1=incubator/lucy/trunk/import/core/KinoSearch/Util/StringHelper.c&r1=1023578&r2=1023591&rev=1023591&view=diff
==============================================================================
--- incubator/lucy/trunk/import/core/KinoSearch/Util/StringHelper.c (original)
+++ incubator/lucy/trunk/import/core/KinoSearch/Util/StringHelper2.c Sun Oct 17 22:32:18 2010
@@ -1,12 +1,4 @@
-#define C_KINO_STRINGHELPER
-#include <string.h>
-
-#define KINO_USE_SHORT_NAMES
-#define CHY_USE_SHORT_NAMES
-
-#include "KinoSearch/Util/StringHelper.h"
-#include "KinoSearch/Object/Err.h"
-#include "KinoSearch/Util/Memory.h"
+#include <charmony.h>
// The content of the following table is derived from the
// "utf8_countTrailBytes" table in ICU4C 4.4.1.
@@ -73,211 +65,3 @@ const uint8_t kino_StrHelp_UTF8_COUNT[]
7, 7 /* illegal bytes 0xfe and 0xff */
};
-int32_t
-StrHelp_overlap(const char *a, const char *b, size_t a_len, size_t b_len)
-{
- size_t i;
- const size_t len = a_len <= b_len ? a_len : b_len;
-
- for (i = 0; i < len; i++) {
- if (*a++ != *b++) { break; }
- }
- return i;
-}
-
-static const char base36_chars[] = "0123456789abcdefghijklmnopqrstuvwxyz";
-
-uint32_t
-StrHelp_to_base36(uint64_t num, void *buffer)
-{
- char my_buf[StrHelp_MAX_BASE36_BYTES];
- char *buf = my_buf + StrHelp_MAX_BASE36_BYTES - 1;
- char *end = buf;
-
- // Null terminate.
- *buf = '\0';
-
- // Convert to base 36 characters.
- do {
- *(--buf) = base36_chars[ num % 36 ];
- num /= 36;
- } while (num > 0);
-
- {
- uint32_t size = end - buf;
- memcpy(buffer, buf, size + 1);
- return size;
- }
-}
-
-uint32_t
-StrHelp_encode_utf8_char(uint32_t code_point, void *buffer)
-{
- uint8_t *buf = (uint8_t*)buffer;
- if (code_point <= 0x7F) { // ASCII
- buf[0] = (uint8_t)code_point;
- return 1;
- }
- else if (code_point <= 0x07FF) { // 2 byte range
- buf[0] = (uint8_t)(0xC0 | (code_point >> 6));
- buf[1] = (uint8_t)(0x80 | (code_point & 0x3f));
- return 2;
- }
- else if (code_point <= 0xFFFF) { // 3 byte range
- buf[0] = (uint8_t)(0xE0 | ( code_point >> 12 ));
- buf[1] = (uint8_t)(0x80 | ((code_point >> 6) & 0x3F));
- buf[2] = (uint8_t)(0x80 | ( code_point & 0x3f));
- return 3;
- }
- else if (code_point <= 0x10FFFF) { // 4 byte range
- buf[0] = (uint8_t)(0xF0 | ( code_point >> 18 ));
- buf[1] = (uint8_t)(0x80 | ((code_point >> 12) & 0x3F));
- buf[2] = (uint8_t)(0x80 | ((code_point >> 6 ) & 0x3F));
- buf[3] = (uint8_t)(0x80 | ( code_point & 0x3f));
- return 4;
- }
- else {
- THROW(ERR, "Illegal Unicode code point: %u32", code_point);
- UNREACHABLE_RETURN(uint32_t);
- }
-}
-
-// The list of code points in this function is chosen based on the White_Space
-// property in http://www.unicode.org/Public/UNIDATA/PropList.txt
-
-/*
-
-EXHIBIT 1 UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
-
-Unicode Data Files include all data files under the directories
-http://www.unicode.org/Public/, http://www.unicode.org/reports/, and
-http://www.unicode.org/cldr/data/ . Unicode Software includes any source code
-published in the Unicode Standard or under the directories
-http://www.unicode.org/Public/, http://www.unicode.org/reports/, and
-http://www.unicode.org/cldr/data/.
-
-NOTICE TO USER: Carefully read the following legal agreement. BY DOWNLOADING,
-INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S DATA FILES ("DATA
-FILES"), AND/OR SOFTWARE ("SOFTWARE"), YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO
-BE BOUND BY, ALL OF THE TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT
-AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR
-SOFTWARE.
-
-COPYRIGHT AND PERMISSION NOTICE
-
-Copyright 1991-2010 Unicode, Inc. All rights reserved. Distributed under the
-Terms of Use in http://www.unicode.org/copyright.html.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-the Unicode data files and any associated documentation (the "Data Files") or
-Unicode software and any associated documentation (the "Software") to deal in
-the Data Files or Software without restriction, including without limitation
-the rights to use, copy, modify, merge, publish, distribute, and/or sell copies
-of the Data Files or Software, and to permit persons to whom the Data Files or
-Software are furnished to do so, provided that (a) the above copyright
-notice(s) and this permission notice appear with all copies of the Data Files
-or Software, (b) both the above copyright notice(s) and this permission notice
-appear in associated documentation, and (c) there is clear notice in each
-modified Data File or in the Software as well as in the documentation
-associated with the Data File(s) or Software that the data or software has been
-modified.
-
-THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD
-PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
-THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
-DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
-OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR
-SOFTWARE.
-
-Except as contained in this notice, the name of a copyright holder shall not be
-used in advertising or otherwise to promote the sale, use or other dealings in
-these Data Files or Software without prior written authorization of the
-copyright holder.
-
-Unicode and the Unicode logo are trademarks of Unicode, Inc., and may be
-registered in some jurisdictions. All other trademarks and registered
-trademarks mentioned herein are the property of their respective owners.
-
-*/
-
-bool_t
-StrHelp_is_whitespace(uint32_t code_point)
-{
- switch (code_point) {
- // <control-0009>..<control-000D>
- case 0x0009: case 0x000A: case 0x000B: case 0x000C: case 0x000D:
- case 0x0020: // SPACE
- case 0x0085: // <control-0085>
- case 0x00A0: // NO-BREAK SPACE
- case 0x1680: // OGHAM SPACE MARK
- case 0x180E: // MONGOLIAN VOWEL SEPARATOR
- // EN QUAD..HAIR SPACE
- case 0x2000: case 0x2001: case 0x2002: case 0x2003: case 0x2004:
- case 0x2005: case 0x2006: case 0x2007: case 0x2008: case 0x2009:
- case 0x200A:
- case 0x2028: // LINE SEPARATOR
- case 0x2029: // PARAGRAPH SEPARATOR
- case 0x202F: // NARROW NO-BREAK SPACE
- case 0x205F: // MEDIUM MATHEMATICAL SPACE
- case 0x3000: // IDEOGRAPHIC SPACE
- return true;
-
- default:
- return false;
- }
-}
-
-uint32_t
-StrHelp_decode_utf8_char(const char *ptr)
-{
- const uint8_t *const string = (const uint8_t*)ptr;
- uint32_t retval = *string;
- int bytes = StrHelp_UTF8_COUNT[retval];
-
- switch (bytes & 0x7) {
- case 1:
- break;
-
- case 2:
- retval = ((retval & 0x1F) << 6)
- | (string[1] & 0x3F);
- break;
-
- case 3:
- retval = ((retval & 0x0F) << 12)
- | ((string[1] & 0x3F) << 6)
- | (string[2] & 0x3F);
- break;
-
- case 4:
- retval = ((retval & 0x07) << 18)
- | ((string[1] & 0x3F) << 12)
- | ((string[2] & 0x3F) << 6)
- | (string[3] & 0x3F);
- break;
-
- default:
- THROW(ERR, "Invalid UTF-8 header byte: %x32", retval);
- }
-
- return retval;
-}
-
-const char*
-StrHelp_back_utf8_char(const char *ptr, char *start)
-{
- while (--ptr >= start) {
- if ((*ptr & 0xC0) != 0x80) { return ptr; }
- }
- return NULL;
-}
-
-/* Copyright 2006-2010 Marvin Humphrey
- *
- * This program is free software; you can redistribute it and/or modify
- * under the same terms as Perl itself.
- */
-