Browse Source

Merge pull request #62 from michaelnmmeyer/master

Reduce the size of the binary.
pull/66/head
Steven G. Johnson 9 years ago
parent
commit
ec0daa50bb
  1. 6
      CMakeLists.txt
  2. 6
      MANIFEST
  3. 6
      Makefile
  4. 7
      data/data_generator.rb
  5. 8
      utf8proc.c
  6. 8
      utf8proc.h
  7. 13336
      utf8proc_data.c

6
CMakeLists.txt

@ -7,9 +7,9 @@ disallow_intree_builds()
project (utf8proc C)
# Be sure to also update these in Makefile!
set(SO_MAJOR 1)
set(SO_MINOR 3)
set(SO_PATCH 1)
set(SO_MAJOR 2)
set(SO_MINOR 0)
set(SO_PATCH 0)
add_definitions (
-DUTF8PROC_EXPORTS

6
MANIFEST

@ -2,6 +2,6 @@ include/
include/utf8proc.h
lib/
lib/libutf8proc.a
lib/libutf8proc.so -> libutf8proc.so.1.3.1
lib/libutf8proc.so.1 -> libutf8proc.so.1.3.1
lib/libutf8proc.so.1.3.1
lib/libutf8proc.so -> libutf8proc.so.2.0.0
lib/libutf8proc.so.2 -> libutf8proc.so.2.0.0
lib/libutf8proc.so.2.0.0

6
Makefile

@ -19,9 +19,9 @@ UCFLAGS = $(CFLAGS) $(PICFLAG) $(C99FLAG) $(WCFLAGS) -DUTF8PROC_EXPORTS
# not API compatibility: MAJOR should be incremented whenever *binary*
# compatibility is broken, even if the API is backward-compatible
# Be sure to also update these in MANIFEST and CMakeLists.txt!
MAJOR=1
MINOR=3
PATCH=1
MAJOR=2
MINOR=0
PATCH=0
OS := $(shell uname)
ifeq ($(OS),Darwin) # MacOS X

7
data/data_generator.rb

@ -116,13 +116,14 @@ def str2c(string, prefix)
return "UTF8PROC_#{prefix}_#{string.upcase}"
end
def ary2c(array)
return "NULL" if array.nil?
return "UINT16_MAX" if array.nil?
unless $int_array_indicies[array]
$int_array_indicies[array] = $int_array.length
array.each { |entry| $int_array << entry }
$int_array << -1
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
class UnicodeChar
@ -305,7 +306,7 @@ end
$stdout << "};\n\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|
$stdout << line
}

8
utf8proc.c

@ -357,10 +357,10 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_decompose_char(utf8proc_int32_t uc,
category == UTF8PROC_CATEGORY_ME) return 0;
}
if (options & UTF8PROC_CASEFOLD) {
if (property->casefold_mapping) {
if (property->casefold_mapping != UINT16_MAX) {
const utf8proc_int32_t *casefold_entry;
utf8proc_ssize_t written = 0;
for (casefold_entry = property->casefold_mapping;
for (casefold_entry = &utf8proc_sequences[property->casefold_mapping];
*casefold_entry >= 0; casefold_entry++) {
written += utf8proc_decompose_char(*casefold_entry, dst+written,
(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 (property->decomp_mapping &&
if (property->decomp_mapping != UINT16_MAX &&
(!property->decomp_type || (options & UTF8PROC_COMPAT))) {
const utf8proc_int32_t *decomp_entry;
utf8proc_ssize_t written = 0;
for (decomp_entry = property->decomp_mapping;
for (decomp_entry = &utf8proc_sequences[property->decomp_mapping];
*decomp_entry >= 0; decomp_entry++) {
written += utf8proc_decompose_char(*decomp_entry, dst+written,
(bufsize > written) ? (bufsize - written) : 0, options,

8
utf8proc.h

@ -132,6 +132,10 @@ extern "C" {
#define SSIZE_MAX ((size_t)SIZE_MAX/2)
#endif
#ifndef UINT16_MAX
# define UINT16_MAX ~(utf8proc_uint16_t)0
#endif
/**
* Option flags used by several functions in the library.
*/
@ -238,8 +242,8 @@ typedef struct utf8proc_property_struct {
* @see utf8proc_decomp_type_t.
*/
utf8proc_propval_t decomp_type;
const utf8proc_int32_t *decomp_mapping;
const utf8proc_int32_t *casefold_mapping;
utf8proc_uint16_t decomp_mapping;
utf8proc_uint16_t casefold_mapping;
utf8proc_int32_t uppercase_mapping;
utf8proc_int32_t lowercase_mapping;
utf8proc_int32_t titlecase_mapping;

13336
utf8proc_data.c

File diff suppressed because it is too large
Loading…
Cancel
Save