]> granicus.if.org Git - multimarkdown/commitdiff
ADDED: Support checking character types in extended ASCII range
authorFletcher T. Penney <fletcher@fletcherpenney.net>
Sat, 21 Jan 2017 02:42:26 +0000 (21:42 -0500)
committerFletcher T. Penney <fletcher@fletcherpenney.net>
Sat, 21 Jan 2017 02:42:26 +0000 (21:42 -0500)
src/char.c
src/char_lookup.c

index f9d12592f401598acb8702d52124413eda47f82e..1791bdac3f5675ee99512b86e0d3ebb0042e54cc 100644 (file)
@@ -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,
-  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
+  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
 };
 
 
index 200e68203cc9d699261e56652bb0122078b25b98..c932c7d7eddbe7761c48dfb579194b3b1c02547e 100644 (file)
@@ -70,8 +70,6 @@ int main( int argc, char** argv ) {
        unsigned char table[256] = {0};
 
        // Define punctuation
-       // TODO: Need to go through extended ASCII codes for 
-       // additional whitespace characters
        punctuation('.');
        punctuation('!');
        punctuation('?');
@@ -114,8 +112,6 @@ int main( int argc, char** argv ) {
 
 
        // Define whitespace
-       // TODO: Need to go through extended ASCII codes for 
-       // additional whitespace characters
        whitespace(' ');
        whitespace('\t');
 
@@ -133,8 +129,6 @@ int main( int argc, char** argv ) {
        }
 
        // Define alpha
-       // TODO: Need to go through extended ASCII codes for 
-       // additional alpha characters
        for (char i = 'a'; i <= 'z'; ++i)
        {
                alpha(i);
@@ -144,6 +138,65 @@ int main( int argc, char** argv ) {
                alpha(i);
        }
 
+
+       // Extended ASCII
+
+       // Punctuation ranges
+       for (int i = 132; i < 138; ++i) {
+               punctuation(i);
+       }
+
+       for (int i = 145; i < 156; ++i) {
+               punctuation(i);
+       }
+
+       for (int i = 161; i < 192; ++i) {
+               punctuation(i);
+       }
+
+
+       // Alphanumeric ranges
+       for (int i = 192; i < 215; ++i) {
+               alpha(i);
+       }
+
+       for (int i = 216; i < 247; ++i) {
+               alpha(i);
+       }
+
+       for (int i = 248; i < 256; ++i) {
+               alpha(i);
+       }
+
+       // Isolated extended ASCII characters
+       for (int i = 128; i < 256; ++i) {
+               switch (i) {
+                       case 128:
+                       case 130:
+                       case 139:
+                       case 215:
+                       case 247:
+                               punctuation(i);
+                               break;
+                       case 160:
+                               whitespace(i);
+                               break;
+                       case 131:
+                       case 138:
+                       case 140:
+                       case 142:
+                       case 156:
+                       case 158:
+                       case 159:
+                               alpha(i);
+                               break;
+                       default:
+                               break;
+               }
+       }
+
+
+
        // Print output as 16 x 16 table
        for (int i = 0; i < 16; ++i)
        {