summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2009-10-27 00:09:15 +0000
committerDimitri Sokolyuk <demon@dim13.org>2009-10-27 00:09:15 +0000
commit58af8c275c2fcf4907351e1d2609e24f431ae64a (patch)
tree6a006e95ac2be48c0f24817bf22643872c9aae5d
parentdf906013d4d3d4fd31d9ba2b1472487bd33b2130 (diff)
more chars
-rw-r--r--7seg.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/7seg.c b/7seg.c
index f2dcc77..8e4dae9 100644
--- a/7seg.c
+++ b/7seg.c
@@ -15,13 +15,15 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-char allowed[] = "0123456789:.-ABCDEFabcdef";
+char allowed[] = " 0123456789:;.,-ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char *seg[][3] = {
+ [' '] = { " ", " ", " " },
['0'] = { " _ ", "| |", "|_|" },
['1'] = { " ", " |", " |" },
['2'] = { " _ ", " _|", "|_ " },
@@ -33,7 +35,9 @@ char *seg[][3] = {
['8'] = { " _ ", "|_|", "|_|" },
['9'] = { " _ ", "|_|", " _|" },
[':'] = { " ", " * ", " * " },
+ [';'] = { " ", " * ", " / " },
['.'] = { " ", " ", " * " },
+ [','] = { " ", " ", " / " },
['-'] = { " ", " _ ", " " },
['A'] = { " _ ", "|_|", "| |" },
['B'] = { " ", "|_ ", "|_|" },
@@ -41,12 +45,26 @@ char *seg[][3] = {
['D'] = { " ", " _|", "|_|" },
['E'] = { " _ ", "|_ ", "|_ " },
['F'] = { " _ ", "|_ ", "| " },
- ['a'] = { " _ ", "|_|", "| |" },
- ['b'] = { " ", "|_ ", "|_|" },
- ['c'] = { " _ ", "| ", "|_ " },
- ['d'] = { " ", " _|", "|_|" },
- ['e'] = { " _ ", "|_ ", "|_ " },
- ['f'] = { " _ ", "|_ ", "| " },
+ ['G'] = { " _ ", "| ", "|_|" },
+ ['H'] = { " ", "|_ ", "| |" },
+ ['I'] = { " ", " ", " |" },
+ ['J'] = { " ", " |", "|_|" },
+ ['K'] = { " _ ", "|_ ", "| |" },
+ ['L'] = { " ", "| ", "|_ " },
+ ['M'] = { " _ ", "| |", "| |" },
+ ['N'] = { " ", " _ ", "| |" },
+ ['O'] = { " ", " _ ", "|_|" },
+ ['P'] = { " _ ", "|_|", "| " },
+ ['Q'] = { " _ ", "|_|", " |" },
+ ['R'] = { " ", " _ ", "| " },
+ ['S'] = { " ", "|_ ", " _|" },
+ ['T'] = { " ", "|_ ", "|_ " },
+ ['U'] = { " ", " ", "|_|" },
+ ['V'] = { " ", "| |", "|_|" },
+ ['W'] = { " ", "| |", " _ " },
+ ['X'] = { " ", "|_|", "| |" },
+ ['Y'] = { " ", "|_|", " _|" },
+ ['Z'] = { " _ ", " |", "|_ " },
};
char **
@@ -54,7 +72,7 @@ sevenseg(char *s)
{
size_t sz;
char **t, *p;
- int i;
+ int i, c;
sz = 3 * strlen(s) + 1;
@@ -62,8 +80,9 @@ sevenseg(char *s)
for (i = 0; i < 3; i++) {
t[i] = calloc(sz, sizeof(char));
for (p = s; *p; p++) {
- if (strchr(allowed, *p) != NULL)
- strlcat(t[i], seg[(int)*p][i], sz);
+ c = toupper(*p);
+ if (strchr(allowed, c) != NULL)
+ strlcat(t[i], seg[c][i], sz);
}
}