Skip to content

Commit 454f601

Browse files
committed
Merge branch 'master' of https://github.com/JuliaLang/utf8proc
2 parents eb39b06 + abf8160 commit 454f601

File tree

5 files changed

+16
-2
lines changed

5 files changed

+16
-2
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ AR?=ar
55
CC?=gcc
66
INSTALL=install
77
FIND=find
8+
PERL=perl
89

910
# compiler settings
1011
CFLAGS ?= -O2
@@ -154,7 +155,7 @@ test/custom: test/custom.c test/tests.o utf8proc.o utf8proc.h test/tests.h
154155
$(CC) $(UCFLAGS) $(LDFLAGS) test/custom.c test/tests.o utf8proc.o -o $@
155156

156157
test/misc: test/misc.c test/tests.o utf8proc.o utf8proc.h test/tests.h
157-
$(CC) $(UCFLAGS) $(LDFLAGS) test/misc.c test/tests.o utf8proc.o -o $@
158+
$(CC) $(UCFLAGS) $(LDFLAGS) -DUNICODE_VERSION='"'`$(PERL) -ne "/^UNICODE_VERSION=/ and print $$';" data/Makefile`'"' test/misc.c test/tests.o utf8proc.o -o $@
158159

159160
check: test/normtest data/NormalizationTest.txt test/graphemetest data/GraphemeBreakTest.txt test/printproperty test/case test/custom test/charwidth test/misc test/valid test/iterate bench/bench.c bench/util.c bench/util.h utf8proc.o
160161
$(MAKE) -C bench

data/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ utf8proc_data.c.new: data_generator.rb UnicodeData.txt GraphemeBreakProperty.txt
2121
CharWidths.txt: charwidths.jl EastAsianWidth.txt
2222
$(JULIA) charwidths.jl > $@
2323

24-
# Unicode data version
24+
# Unicode data version (must also update utf8proc_unicode_version function)
2525
UNICODE_VERSION=12.0.0
2626

2727
UnicodeData.txt:

test/misc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ int main(void)
4141
{
4242
issue128();
4343
issue102();
44+
#ifdef UNICODE_VERSION
45+
printf("Unicode version: Makefile has %s, has API %s\n", UNICODE_VERSION, utf8proc_unicode_version());
46+
check(!strcmp(UNICODE_VERSION, utf8proc_unicode_version()), "utf8proc_unicode_version mismatch");
47+
#endif
4448
printf("Misc tests SUCCEEDED.\n");
4549
return 0;
4650
}

utf8proc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ UTF8PROC_DLLEXPORT const char *utf8proc_version(void) {
100100
return STRINGIZE(UTF8PROC_VERSION_MAJOR) "." STRINGIZE(UTF8PROC_VERSION_MINOR) "." STRINGIZE(UTF8PROC_VERSION_PATCH) "";
101101
}
102102

103+
UTF8PROC_DLLEXPORT const char *utf8proc_unicode_version(void) {
104+
return "12.0.0";
105+
}
106+
103107
UTF8PROC_DLLEXPORT const char *utf8proc_errmsg(utf8proc_ssize_t errcode) {
104108
switch (errcode) {
105109
case UTF8PROC_ERROR_NOMEM:

utf8proc.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,11 @@ UTF8PROC_DLLEXPORT extern const utf8proc_int8_t utf8proc_utf8class[256];
408408
*/
409409
UTF8PROC_DLLEXPORT const char *utf8proc_version(void);
410410

411+
/**
412+
* Returns the utf8proc supported Unicode version as a string MAJOR.MINOR.PATCH.
413+
*/
414+
UTF8PROC_DLLEXPORT const char *utf8proc_unicode_version(void);
415+
411416
/**
412417
* Returns an informative error string for the given utf8proc error code
413418
* (e.g. the error codes returned by @ref utf8proc_map).

0 commit comments

Comments
 (0)