From 1232487f582f9c2cb6b7f9aa2211f2f26dd31380 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Tue, 25 Jul 2023 01:44:10 -0700 Subject: [PATCH] char table in rust --- src/charset.rs | 225 +++++++++++++++++++++++++++++++++++++++++++++++++ src/lib.rs | 1 + 2 files changed, 226 insertions(+) create mode 100644 src/charset.rs diff --git a/src/charset.rs b/src/charset.rs new file mode 100644 index 0000000..fafe9b6 --- /dev/null +++ b/src/charset.rs @@ -0,0 +1,225 @@ +// Total characters in charTable[] array. +//#define CHAR_COUNT 218 + +// Character table representing the character set know as CP437 used by +// the original IBM PC - https://en.wikipedia.org/wiki/Code_page_437 +const CHAR_TABLE: [&[u8]; 218] = [ + b"!", + b"\"", + b"#", + b"$", + b"%", + b"&", + b"'", + b"(", + b")", + b"*", + b"+", + b",", + b"-", + b"~", + b".", + b"/", + b":", + b";", + b"<", + b"=", + b">", + b"?", + b"[", + b"\\", + b"]", + b"_", + b"{", + b"}", + b"A", + b"B", + b"C", + b"D", + b"E", + b"F", + b"G", + b"H", + b"I", + b"J", + b"K", + b"L", + b"M", + b"N", + b"O", + b"P", + b"Q", + b"R", + b"S", + b"T", + b"U", + b"V", + b"W", + b"X", + b"Y", + b"Z", + b"a", + b"b", + b"c", + b"d", + b"e", + b"f", + b"g", + b"h", + b"i", + b"j", + b"k", + b"l", + b"m", + b"n", + b"o", + b"p", + b"q", + b"r", + b"s", + b"t", + b"u", + b"v", + b"w", + b"x", + b"y", + b"z", + b"0", + b"1", + b"2", + b"3", + b"4", + b"5", + b"6", + b"7", + b"8", + b"9", + b"\xc3\x87", + b"\xc3\xbc", + b"\xc3\xa9", + b"\xc3\xa2", + b"\xc3\xa4", + b"\xc3\xa0", + b"\xc3\xa5", + b"\xc3\xa7", + b"\xc3\xaa", + b"\xc3\xab", + b"\xc3\xa8", + b"\xc3\xaf", + b"\xc3\xae", + b"\xc3\xac", + b"\xc3\x84", + b"\xc3\x85", + b"\xc3\x89", + b"\xc3\xa6", + b"\xc3\x86", + b"\xc3\xb4", + b"\xc3\xb6", + b"\xc3\xb2", + b"\xc3\xbb", + b"\xc3\xb9", + b"\xc3\xbf", + b"\xc3\x96", + b"\xc3\x9c", + b"\xc2\xa2", + b"\xc2\xa3", + b"\xc2\xa5", + b"\xc6\x92", + b"\xc3\xa1", + b"\xc3\xad", + b"\xc3\xb3", + b"\xc3\xba", + b"\xc3\xb1", + b"\xc3\x91", + b"\xc2\xaa", + b"\xc2\xba", + b"\xc2\xbf", + b"\xc2\xac", + b"\xc2\xbd", + b"\xc2\xbc", + b"\xc2\xa1", + b"\xc2\xab", + b"\xc2\xbb", + b"\xce\xb1", + b"\xc3\x9f", + b"\xce\x93", + b"\xcf\x80", + b"\xce\xa3", + b"\xcf\x83", + b"\xc2\xb5", + b"\xcf\x84", + b"\xce\xa6", + b"\xce\x98", + b"\xce\xa9", + b"\xce\xb4", + b"\xcf\x86", + b"\xce\xb5", + b"\xc2\xb1", + b"\xc3\xb7", + b"\xc2\xb0", + b"\xc2\xb7", + b"\xc2\xb2", + b"\xc2\xb6", + b"\xe2\x8c\x90", + b"\xe2\x82\xa7", + b"\xe2\x96\x91", + b"\xe2\x96\x92", + b"\xe2\x96\x93", + b"\xe2\x94\x82", + b"\xe2\x94\xa4", + b"\xe2\x95\xa1", + b"\xe2\x95\xa2", + b"\xe2\x95\x96", + b"\xe2\x95\x95", + b"\xe2\x95\xa3", + b"\xe2\x95\x91", + b"\xe2\x95\x97", + b"\xe2\x95\x9d", + b"\xe2\x95\x9c", + b"\xe2\x95\x9b", + b"\xe2\x94\x90", + b"\xe2\x94\x94", + b"\xe2\x94\xb4", + b"\xe2\x94\xac", + b"\xe2\x94\x9c", + b"\xe2\x94\x80", + b"\xe2\x94\xbc", + b"\xe2\x95\x9e", + b"\xe2\x95\x9f", + b"\xe2\x95\x9a", + b"\xe2\x95\x94", + b"\xe2\x95\xa9", + b"\xe2\x95\xa6", + b"\xe2\x95\xa0", + b"\xe2\x95\x90", + b"\xe2\x95\xac", + b"\xe2\x95\xa7", + b"\xe2\x95\xa8", + b"\xe2\x95\xa4", + b"\xe2\x95\xa7", + b"\xe2\x95\x99", + b"\xe2\x95\x98", + b"\xe2\x95\x92", + b"\xe2\x95\x93", + b"\xe2\x95\xab", + b"\xe2\x95\xaa", + b"\xe2\x94\x98", + b"\xe2\x94\x8c", + b"\xe2\x96\x88", + b"\xe2\x96\x84", + b"\xe2\x96\x8c", + b"\xe2\x96\x90", + b"\xe2\x96\x80", + b"\xe2\x88\x9e", + b"\xe2\x88\xa9", + b"\xe2\x89\xa1", + b"\xe2\x89\xa5", + b"\xe2\x89\xa4", + b"\xe2\x8c\xa0", + b"\xe2\x8c\xa1", + b"\xe2\x89\x88", + b"\xe2\x88\x99", + b"\xe2\x88\x9a", + b"\xe2\x81\xbf", + b"\xe2\x96\xa0", +]; diff --git a/src/lib.rs b/src/lib.rs index f9f6086..8b22c98 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,5 @@ mod args; +mod charset; mod color; use libc::{c_char, c_int, c_uchar, c_void};