commit f8a61f15e3b490e3d0f162a81431fd40f0c06441 Author: Emil Williams Date: Tue Dec 12 18:58:45 2023 +0000 init diff --git a/README b/README new file mode 100644 index 0000000..7c65e0a --- /dev/null +++ b/README @@ -0,0 +1,7 @@ +It just dumps ascii data to stdout. +Files are already included in the git. + +Building is simple, + sh ./build.sh; + +Public Domain. diff --git a/ascii.c b/ascii.c new file mode 100644 index 0000000..a551811 --- /dev/null +++ b/ascii.c @@ -0,0 +1,21 @@ +/* ascii.c - The ASCII Table */ +#include +#include + +int main(void) +{ + unsigned int c; + const char codes[32][4] = + { "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", "BS", "TAB", "LF", + "VT", "FF", "CR", "SO", "SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", + "SYN", "ETB", "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US" }; + puts(" DEC HEX OCT"); + for (c = 0; c < 127; ++c) { + if (c == 127) + { printf( "DEL %4u %4x %4o\n", c, c, c); } + else if (c > 31) + { printf("'%c' %4u %4x %4o\n", (char16_t) c, c, c, c); } + else + { printf( "%3s %4u %4x %4o\n", codes[c], c, c, c); } + } +} diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..9434eef --- /dev/null +++ b/build.sh @@ -0,0 +1,5 @@ +#!/bin/sh +OPTION=-O2 -Wall -Wextra -Wpedantic -s +cc $OPTION -o ascii ascii.c && ./ascii > table +cc $OPTION -DRAW -o ascii ascii.c && ./ascii > raw +rm -f ascii diff --git a/raw b/raw new file mode 100644 index 0000000..a668f38 Binary files /dev/null and b/raw differ diff --git a/table b/table new file mode 100644 index 0000000..6c8b4e4 --- /dev/null +++ b/table @@ -0,0 +1,128 @@ + DEC HEX OCT +NUL 0 0 0 +SOH 1 1 1 +STX 2 2 2 +ETX 3 3 3 +EOT 4 4 4 +ENQ 5 5 5 +ACK 6 6 6 +BEL 7 7 7 + BS 8 8 10 +TAB 9 9 11 + LF 10 a 12 + VT 11 b 13 + FF 12 c 14 + CR 13 d 15 + SO 14 e 16 + SI 15 f 17 +DLE 16 10 20 +DC1 17 11 21 +DC2 18 12 22 +DC3 19 13 23 +DC4 20 14 24 +NAK 21 15 25 +SYN 22 16 26 +ETB 23 17 27 +CAN 24 18 30 + EM 25 19 31 +SUB 26 1a 32 +ESC 27 1b 33 + FS 28 1c 34 + GS 29 1d 35 + RS 30 1e 36 + US 31 1f 37 +' ' 32 20 40 +'!' 33 21 41 +'"' 34 22 42 +'#' 35 23 43 +'$' 36 24 44 +'%' 37 25 45 +'&' 38 26 46 +''' 39 27 47 +'(' 40 28 50 +')' 41 29 51 +'*' 42 2a 52 +'+' 43 2b 53 +',' 44 2c 54 +'-' 45 2d 55 +'.' 46 2e 56 +'/' 47 2f 57 +'0' 48 30 60 +'1' 49 31 61 +'2' 50 32 62 +'3' 51 33 63 +'4' 52 34 64 +'5' 53 35 65 +'6' 54 36 66 +'7' 55 37 67 +'8' 56 38 70 +'9' 57 39 71 +':' 58 3a 72 +';' 59 3b 73 +'<' 60 3c 74 +'=' 61 3d 75 +'>' 62 3e 76 +'?' 63 3f 77 +'@' 64 40 100 +'A' 65 41 101 +'B' 66 42 102 +'C' 67 43 103 +'D' 68 44 104 +'E' 69 45 105 +'F' 70 46 106 +'G' 71 47 107 +'H' 72 48 110 +'I' 73 49 111 +'J' 74 4a 112 +'K' 75 4b 113 +'L' 76 4c 114 +'M' 77 4d 115 +'N' 78 4e 116 +'O' 79 4f 117 +'P' 80 50 120 +'Q' 81 51 121 +'R' 82 52 122 +'S' 83 53 123 +'T' 84 54 124 +'U' 85 55 125 +'V' 86 56 126 +'W' 87 57 127 +'X' 88 58 130 +'Y' 89 59 131 +'Z' 90 5a 132 +'[' 91 5b 133 +'\' 92 5c 134 +']' 93 5d 135 +'^' 94 5e 136 +'_' 95 5f 137 +'`' 96 60 140 +'a' 97 61 141 +'b' 98 62 142 +'c' 99 63 143 +'d' 100 64 144 +'e' 101 65 145 +'f' 102 66 146 +'g' 103 67 147 +'h' 104 68 150 +'i' 105 69 151 +'j' 106 6a 152 +'k' 107 6b 153 +'l' 108 6c 154 +'m' 109 6d 155 +'n' 110 6e 156 +'o' 111 6f 157 +'p' 112 70 160 +'q' 113 71 161 +'r' 114 72 162 +'s' 115 73 163 +'t' 116 74 164 +'u' 117 75 165 +'v' 118 76 166 +'w' 119 77 167 +'x' 120 78 170 +'y' 121 79 171 +'z' 122 7a 172 +'{' 123 7b 173 +'|' 124 7c 174 +'}' 125 7d 175 +'~' 126 7e 176