aboutsummaryrefslogtreecommitdiff
path: root/xscii.c
diff options
context:
space:
mode:
authorxolatile2025-04-29 14:56:34 +0200
committerxolatile2025-04-29 14:56:34 +0200
commit58073e11b73013569564dad22c617984046e6841 (patch)
tree701a013ec93d179533b45f7e898ede8a9bf0cd34 /xscii.c
downloadxolatile-xscii-58073e11b73013569564dad22c617984046e6841.tar.xz
xolatile-xscii-58073e11b73013569564dad22c617984046e6841.tar.zst
Added most complex program ever...HEADmaster
Diffstat (limited to 'xscii.c')
-rwxr-xr-xxscii.c114
1 files changed, 114 insertions, 0 deletions
diff --git a/xscii.c b/xscii.c
new file mode 100755
index 0000000..3af1e1d
--- /dev/null
+++ b/xscii.c
@@ -0,0 +1,114 @@
+/// _ _
+/// __ _____ ___(_|_)
+/// \ \/ / __|/ __| | |
+/// > <\__ \ (__| | |
+/// /_/\_\___/\___|_|_|
+///
+/// Copyright (c) 1997 - Ognjen 'xolatile' Milan Robovic
+///
+/// xolatile@chud.cyou - xscii - Extremely robust, complex and memory safe program to output ASCII table to terminal.
+///
+/// This program is free software, free as in freedom and as in free beer, you can redistribute it and/or modify it under the terms of the GNU
+/// General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version if you wish...
+///
+/// This program is distributed in the hope that it will be useful, but it is probably not, and without any warranty, without even the implied
+/// warranty of merchantability or fitness for a particular purpose, because it is pointless. Please see the GNU (Geenoo) General Public License
+/// for more details, if you dare, it is a lot of text that nobody wants to read...
+
+#include "xtandard.h"
+
+static procedure echo_base (integer index, integer base, integer colour, integer effect) {
+ print ("/0 | /-");
+
+ echo_colour (colour, effect);
+
+ if (base == 2) {
+ echo (format_to_string (index, 0, base, 7, '0'));
+ } else if (base == 8) {
+ echo (format_to_string (index, 0, base, 3, '0'));
+ } else if (base == 16) {
+ echo (format_to_string (index, 0, base, 2, '0'));
+ } else {
+ echo (format_to_string (index, 0, base, 3, ' '));
+ }
+
+ echo_cancel ();
+}
+
+static procedure echo_code (integer index) {
+ character * code [] = {
+ "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI",
+ "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US",
+ " "
+ };
+
+ if (index == 127) {
+ print ("/0 | /4DEL/-");
+ } else if (character_is_visible (index) == false) {
+ print ("/0 | /4%s/-", code [index]);
+ if (string_length (code [index]) == 2) {
+ echo (" ");
+ }
+ } else {
+ print ("/0 | /4%c /-", index);
+ }
+}
+
+static procedure echo_name (integer index) {
+ character * name [] = {
+ "Null", "Start of heading", "Start of text", "End of text",
+ "End of transmission", "Enquiry", "Acknowledge", "Bell",
+ "Backspace", "Horizontal tab", "Line feed", "Vertical tab",
+ "Form feed", "Carriage return", "Shift out", "Shift in",
+ "Data link escape", "Device control 1", "Device control 2", "Device control 3",
+ "Device control 4", "Negative acknowledge", "Synchronous idle", "End transmission block",
+ "Cancel", "End of medium", "Substitute", "Escape",
+ "File separator", "Group separator", "Record separator", "Unit separator",
+ "Space", "Exclamation mark", "Speech mark", "Number sign",
+ "Dollar sign", "Percent", "Ampersand", "Quote",
+ "Open parenthesis", "Close parenthesis", "Asterisk", "Plus",
+ "Comma", "Minus", "Period", "Slash",
+ "Zero", "One", "Two", "Three",
+ "Four", "Five", "Six", "Seven",
+ "Eight", "Nine", "Colon", "Semicolon",
+ "Open angled bracket", "Equal", "Close angled bracket", "Question mark",
+ "At sign", "Uppercase A", "Uppercase B", "Uppercase C",
+ "Uppercase D", "Uppercase E", "Uppercase F", "Uppercase G",
+ "Uppercase H", "Uppercase I", "Uppercase J", "Uppercase K",
+ "Uppercase L", "Uppercase M", "Uppercase N", "Uppercase O",
+ "Uppercase P", "Uppercase Q", "Uppercase R", "Uppercase S",
+ "Uppercase T", "Uppercase U", "Uppercase V", "Uppercase W",
+ "Uppercase X", "Uppercase Y", "Uppercase Z", "Opening bracket",
+ "Backslash", "Closing bracket", "Caret", "Underscore",
+ "Grave", "Lowercase a", "Lowercase b", "Lowercase c",
+ "Lowercase d", "Lowercase e", "Lowercase f", "Lowercase g",
+ "Lowercase h", "Lowercase i", "Lowercase j", "Lowercase k",
+ "Lowercase l", "Lowercase m", "Lowercase n", "Lowercase o",
+ "Lowercase p", "Lowercase q", "Lowercase r", "Lowercase s",
+ "Lowercase t", "Lowercase u", "Lowercase v", "Lowercase w",
+ "Lowercase x", "Lowercase y", "Lowercase z", "Opening brace",
+ "Vertical bar", "Closing brace", "Tilde", "Delete"
+ };
+
+ print ("/0 | /5%s/-", name [index]);
+
+ output (" ", 24 - string_length (name [index]));
+}
+
+integer main (none) {
+ for (integer index = 0; index < 128; ++index) {
+ echo_base (index, 2, colour_white, effect_normal);
+ echo_base (index, 8, colour_cyan, effect_normal);
+ echo_base (index, 10, colour_cyan, effect_italic);
+ echo_base (index, 16, colour_cyan, effect_bold);
+
+ echo_code (index);
+ echo_name (index);
+
+ if (index % 2 != 0) {
+ echo ("\n");
+ }
+ }
+
+ return (log_success);
+}