From 0a3b890d890fe76a6b84a1d3fc3e2c79b316d73d Mon Sep 17 00:00:00 2001 From: "Fletcher T. Penney" Date: Fri, 12 May 2017 20:04:16 -0400 Subject: [PATCH] CHANGED: Extended ASCII support interferes with UTF-8 support -- disable it --- Sources/libMultiMarkdown/char.c | 16 ++++++++-------- Sources/libMultiMarkdown/char.h | 4 ++++ Sources/libMultiMarkdown/char_lookup.c | 5 +++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Sources/libMultiMarkdown/char.c b/Sources/libMultiMarkdown/char.c index 1791bda..f9d1259 100644 --- a/Sources/libMultiMarkdown/char.c +++ b/Sources/libMultiMarkdown/char.c @@ -67,14 +67,14 @@ static unsigned char smart_char_type[256] = { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 0, - 2, 0, 2, 4, 2, 2, 2, 2, 2, 2, 4, 2, 4, 0, 4, 0, - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 0, 4, 4, - 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, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; diff --git a/Sources/libMultiMarkdown/char.h b/Sources/libMultiMarkdown/char.h index acd50af..f14ae50 100644 --- a/Sources/libMultiMarkdown/char.h +++ b/Sources/libMultiMarkdown/char.h @@ -103,5 +103,9 @@ int char_is_whitespace_or_line_ending_or_punctuation(char c); // Is byte a UTF-8 continuation byte #define char_is_continuation_byte(x) ((x & 0xC0) == 0x80) +// Is byte the first byte of a multibyte UTF-8 sequence? +#define char_is_lead_multibyte(x) ((x & 0xC0) == 0xC0) + + #endif diff --git a/Sources/libMultiMarkdown/char_lookup.c b/Sources/libMultiMarkdown/char_lookup.c index c932c7d..bcf59db 100644 --- a/Sources/libMultiMarkdown/char_lookup.c +++ b/Sources/libMultiMarkdown/char_lookup.c @@ -65,6 +65,7 @@ #define digit(x) table[x] |= CHAR_DIGIT #define line_ending(x) table[x] |= CHAR_LINE_ENDING +#define USE_EXTENDED_ASCII_disabled 1 int main( int argc, char** argv ) { unsigned char table[256] = {0}; @@ -140,7 +141,7 @@ int main( int argc, char** argv ) { // Extended ASCII - +#ifdef USE_EXTENDED_ASCII // Punctuation ranges for (int i = 132; i < 138; ++i) { punctuation(i); @@ -194,7 +195,7 @@ int main( int argc, char** argv ) { break; } } - +#endif // Print output as 16 x 16 table -- 2.50.1