Merge pull request #62 from michaelnmmeyer/master
Reduce the size of the binary.
This commit is contained in:
commit
ec0daa50bb
@ -7,9 +7,9 @@ disallow_intree_builds()
|
|||||||
project (utf8proc C)
|
project (utf8proc C)
|
||||||
|
|
||||||
# Be sure to also update these in Makefile!
|
# Be sure to also update these in Makefile!
|
||||||
set(SO_MAJOR 1)
|
set(SO_MAJOR 2)
|
||||||
set(SO_MINOR 3)
|
set(SO_MINOR 0)
|
||||||
set(SO_PATCH 1)
|
set(SO_PATCH 0)
|
||||||
|
|
||||||
add_definitions (
|
add_definitions (
|
||||||
-DUTF8PROC_EXPORTS
|
-DUTF8PROC_EXPORTS
|
||||||
|
|||||||
6
MANIFEST
6
MANIFEST
@ -2,6 +2,6 @@ include/
|
|||||||
include/utf8proc.h
|
include/utf8proc.h
|
||||||
lib/
|
lib/
|
||||||
lib/libutf8proc.a
|
lib/libutf8proc.a
|
||||||
lib/libutf8proc.so -> libutf8proc.so.1.3.1
|
lib/libutf8proc.so -> libutf8proc.so.2.0.0
|
||||||
lib/libutf8proc.so.1 -> libutf8proc.so.1.3.1
|
lib/libutf8proc.so.2 -> libutf8proc.so.2.0.0
|
||||||
lib/libutf8proc.so.1.3.1
|
lib/libutf8proc.so.2.0.0
|
||||||
|
|||||||
6
Makefile
6
Makefile
@ -19,9 +19,9 @@ UCFLAGS = $(CFLAGS) $(PICFLAG) $(C99FLAG) $(WCFLAGS) -DUTF8PROC_EXPORTS
|
|||||||
# not API compatibility: MAJOR should be incremented whenever *binary*
|
# not API compatibility: MAJOR should be incremented whenever *binary*
|
||||||
# compatibility is broken, even if the API is backward-compatible
|
# compatibility is broken, even if the API is backward-compatible
|
||||||
# Be sure to also update these in MANIFEST and CMakeLists.txt!
|
# Be sure to also update these in MANIFEST and CMakeLists.txt!
|
||||||
MAJOR=1
|
MAJOR=2
|
||||||
MINOR=3
|
MINOR=0
|
||||||
PATCH=1
|
PATCH=0
|
||||||
|
|
||||||
OS := $(shell uname)
|
OS := $(shell uname)
|
||||||
ifeq ($(OS),Darwin) # MacOS X
|
ifeq ($(OS),Darwin) # MacOS X
|
||||||
|
|||||||
@ -116,13 +116,14 @@ def str2c(string, prefix)
|
|||||||
return "UTF8PROC_#{prefix}_#{string.upcase}"
|
return "UTF8PROC_#{prefix}_#{string.upcase}"
|
||||||
end
|
end
|
||||||
def ary2c(array)
|
def ary2c(array)
|
||||||
return "NULL" if array.nil?
|
return "UINT16_MAX" if array.nil?
|
||||||
unless $int_array_indicies[array]
|
unless $int_array_indicies[array]
|
||||||
$int_array_indicies[array] = $int_array.length
|
$int_array_indicies[array] = $int_array.length
|
||||||
array.each { |entry| $int_array << entry }
|
array.each { |entry| $int_array << entry }
|
||||||
$int_array << -1
|
$int_array << -1
|
||||||
end
|
end
|
||||||
return "utf8proc_sequences + #{$int_array_indicies[array]}"
|
raise "Array index out of bound" if $int_array_indicies[array] >= 65535
|
||||||
|
return "#{$int_array_indicies[array]}"
|
||||||
end
|
end
|
||||||
|
|
||||||
class UnicodeChar
|
class UnicodeChar
|
||||||
@ -305,7 +306,7 @@ end
|
|||||||
$stdout << "};\n\n"
|
$stdout << "};\n\n"
|
||||||
|
|
||||||
$stdout << "const utf8proc_property_t utf8proc_properties[] = {\n"
|
$stdout << "const utf8proc_property_t utf8proc_properties[] = {\n"
|
||||||
$stdout << " {0, 0, 0, 0, NULL, NULL, -1, -1, -1, -1, -1, false,false,false,false, UTF8PROC_BOUNDCLASS_OTHER, 0},\n"
|
$stdout << " {0, 0, 0, 0, UINT16_MAX, UINT16_MAX, -1, -1, -1, -1, -1, false,false,false,false, UTF8PROC_BOUNDCLASS_OTHER, 0},\n"
|
||||||
properties.each { |line|
|
properties.each { |line|
|
||||||
$stdout << line
|
$stdout << line
|
||||||
}
|
}
|
||||||
|
|||||||
@ -357,10 +357,10 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_decompose_char(utf8proc_int32_t uc,
|
|||||||
category == UTF8PROC_CATEGORY_ME) return 0;
|
category == UTF8PROC_CATEGORY_ME) return 0;
|
||||||
}
|
}
|
||||||
if (options & UTF8PROC_CASEFOLD) {
|
if (options & UTF8PROC_CASEFOLD) {
|
||||||
if (property->casefold_mapping) {
|
if (property->casefold_mapping != UINT16_MAX) {
|
||||||
const utf8proc_int32_t *casefold_entry;
|
const utf8proc_int32_t *casefold_entry;
|
||||||
utf8proc_ssize_t written = 0;
|
utf8proc_ssize_t written = 0;
|
||||||
for (casefold_entry = property->casefold_mapping;
|
for (casefold_entry = &utf8proc_sequences[property->casefold_mapping];
|
||||||
*casefold_entry >= 0; casefold_entry++) {
|
*casefold_entry >= 0; casefold_entry++) {
|
||||||
written += utf8proc_decompose_char(*casefold_entry, dst+written,
|
written += utf8proc_decompose_char(*casefold_entry, dst+written,
|
||||||
(bufsize > written) ? (bufsize - written) : 0, options,
|
(bufsize > written) ? (bufsize - written) : 0, options,
|
||||||
@ -371,11 +371,11 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_decompose_char(utf8proc_int32_t uc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (options & (UTF8PROC_COMPOSE|UTF8PROC_DECOMPOSE)) {
|
if (options & (UTF8PROC_COMPOSE|UTF8PROC_DECOMPOSE)) {
|
||||||
if (property->decomp_mapping &&
|
if (property->decomp_mapping != UINT16_MAX &&
|
||||||
(!property->decomp_type || (options & UTF8PROC_COMPAT))) {
|
(!property->decomp_type || (options & UTF8PROC_COMPAT))) {
|
||||||
const utf8proc_int32_t *decomp_entry;
|
const utf8proc_int32_t *decomp_entry;
|
||||||
utf8proc_ssize_t written = 0;
|
utf8proc_ssize_t written = 0;
|
||||||
for (decomp_entry = property->decomp_mapping;
|
for (decomp_entry = &utf8proc_sequences[property->decomp_mapping];
|
||||||
*decomp_entry >= 0; decomp_entry++) {
|
*decomp_entry >= 0; decomp_entry++) {
|
||||||
written += utf8proc_decompose_char(*decomp_entry, dst+written,
|
written += utf8proc_decompose_char(*decomp_entry, dst+written,
|
||||||
(bufsize > written) ? (bufsize - written) : 0, options,
|
(bufsize > written) ? (bufsize - written) : 0, options,
|
||||||
|
|||||||
@ -132,6 +132,10 @@ extern "C" {
|
|||||||
#define SSIZE_MAX ((size_t)SIZE_MAX/2)
|
#define SSIZE_MAX ((size_t)SIZE_MAX/2)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef UINT16_MAX
|
||||||
|
# define UINT16_MAX ~(utf8proc_uint16_t)0
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Option flags used by several functions in the library.
|
* Option flags used by several functions in the library.
|
||||||
*/
|
*/
|
||||||
@ -238,8 +242,8 @@ typedef struct utf8proc_property_struct {
|
|||||||
* @see utf8proc_decomp_type_t.
|
* @see utf8proc_decomp_type_t.
|
||||||
*/
|
*/
|
||||||
utf8proc_propval_t decomp_type;
|
utf8proc_propval_t decomp_type;
|
||||||
const utf8proc_int32_t *decomp_mapping;
|
utf8proc_uint16_t decomp_mapping;
|
||||||
const utf8proc_int32_t *casefold_mapping;
|
utf8proc_uint16_t casefold_mapping;
|
||||||
utf8proc_int32_t uppercase_mapping;
|
utf8proc_int32_t uppercase_mapping;
|
||||||
utf8proc_int32_t lowercase_mapping;
|
utf8proc_int32_t lowercase_mapping;
|
||||||
utf8proc_int32_t titlecase_mapping;
|
utf8proc_int32_t titlecase_mapping;
|
||||||
|
|||||||
13336
utf8proc_data.c
13336
utf8proc_data.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user