]> git.sur5r.net Git - cc65/blob - test/ref/charset.c
Merge pull request #135 from ikorb/patch1
[cc65] / test / ref / charset.c
1 /*
2   !!DESCRIPTION!! basic ASCII character test
3   !!ORIGIN!!      testsuite
4   !!LICENCE!!     Public Domain
5   !!AUTHOR!!      Groepaz/Hitmen
6 */
7
8 #include <stdio.h>
9
10 #if 0
11
12 /* this kind of line-continuation for strings doesnt work properly for cc65 */
13
14 const unsigned char characters[]={
15         /*0123456789abcdef0123456789abcdef*/
16         /* iso646-us control-characters */
17         "                                "      /* 00-1f */
18         /* iso646-us printable characters */
19         " !\"#$%&'()*+,-./"                     /* 20-2f !"#$%&'()*+,-./ */
20         "0123456789"                            /* 30-39 0123456789      */
21         ":;<=>?@"                               /* 3a-40 :;<=>?@         */
22         "ABCDEFGHIJKLMNOPQRSTUVWXYZ"            /* 41-5a A-Z             */
23         "[\\]^_`"                               /* 5b-60 [\]^_`          */
24         "abcdefghijklmnopqrstuvwxyz"            /* 61-7a a-z             */
25         "{|}~ "                                 /* 7b-7f {|}~            */
26         /* iso8859-15 extended characters */
27 };
28
29 #endif
30
31 const unsigned char characters[]={
32         /*0123456789abcdef0123456789abcdef*/
33         /* iso646-us control-characters */
34         /* 00-1f */
35         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
36         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
37         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
38         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
39         /* iso646-us printable characters */
40         /* 20-2f !"#$%&'()*+,-./ */
41         ' ','!','"','#','$','%','&','\'','(',')','*','+',',','-','.','/',
42         /* 30-39 0123456789      */
43         '0','1','2','3','4','5','6','7','8','9',
44         /* 3a-40 :;<=>?@         */
45         ':',';','<','=','>','?','@',
46         /* 41-5a A-Z             */
47         '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',
48         /* 5b-60 [\]^_`          */
49         '[','\\',']','^','_','`',
50         /* 61-7a a-z             */
51         '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',
52         /* 7b-7f {|}~            */
53         '{','|','}','~',' '
54         /* iso8859-15 extended characters */
55 };
56
57 void printchars(unsigned char a,unsigned char b){
58         for(b++;a!=b;a++)
59 /*                printf("%02x ",a); */
60 /*                printf("%02x ",characters[a]); */
61                 printf("%c",characters[a]);
62         printf("\n");
63 }
64
65 int main(void) {
66         printf("characters:\n\n");
67         printchars(0x61,0x7a);
68         printchars(0x41,0x5a);
69         printf("numbers:\n\n");
70         printchars(0x30,0x39);
71         printf("other:\n\n");
72         printchars(0x20,0x2f);
73         /*printchars(0x3a,0x40);*/
74         printchars(0x3a,0x3f);
75         /*printchars(0x5b,0x60);*/
76         /*printchars(0x7b,0x7f);*/
77         printf("\n\n");
78         printf("slash:               '%c'\n",'/');
79         printf("backslash:           '%c'\n",'\\');
80         printf("curly braces open:   '%c'\n",'{');
81         printf("curly braces close:  '%c'\n",'}');
82         printf("square braces open:  '%c'\n",'[');
83         printf("square braces close: '%c'\n",']');
84         printf("underscore:          '%c'\n",'_');
85         printf("tilde:               '%c'\n",'~');
86         printf("pipe:                '%c'\n",'|');
87         printf("apostroph:           '%c'\n",'\'');
88         printf("single quote         '%c'\n",'`');
89         printf("xor                  '%c'\n",'^');
90         printf("at                   '%c'\n",'@');
91
92         return 0;
93 }