File: charset.c

package info (click to toggle)
cc65 2.19-2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 20,268 kB
  • sloc: ansic: 117,151; asm: 66,339; pascal: 4,248; makefile: 1,009; perl: 607
file content (93 lines) | stat: -rw-r--r-- 3,523 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
  !!DESCRIPTION!! basic ASCII character test
  !!ORIGIN!!      testsuite
  !!LICENCE!!     Public Domain
  !!AUTHOR!!      Groepaz/Hitmen
*/

#include <stdio.h>

#if 0

/* this kind of line-continuation for strings doesnt work properly for cc65 */

const unsigned char characters[]={
        /*0123456789abcdef0123456789abcdef*/
        /* iso646-us control-characters */
        "                                "      /* 00-1f */
        /* iso646-us printable characters */
        " !\"#$%&'()*+,-./"                     /* 20-2f !"#$%&'()*+,-./ */
        "0123456789"                            /* 30-39 0123456789      */
        ":;<=>?@"                               /* 3a-40 :;<=>?@         */
        "ABCDEFGHIJKLMNOPQRSTUVWXYZ"            /* 41-5a A-Z             */
        "[\\]^_`"                               /* 5b-60 [\]^_`          */
        "abcdefghijklmnopqrstuvwxyz"            /* 61-7a a-z             */
        "{|}~ "                                 /* 7b-7f {|}~            */
        /* iso8859-15 extended characters */
};

#endif

const unsigned char characters[]={
        /*0123456789abcdef0123456789abcdef*/
        /* iso646-us control-characters */
        /* 00-1f */
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        /* iso646-us printable characters */
        /* 20-2f !"#$%&'()*+,-./ */
        ' ','!','"','#','$','%','&','\'','(',')','*','+',',','-','.','/',
        /* 30-39 0123456789      */
        '0','1','2','3','4','5','6','7','8','9',
        /* 3a-40 :;<=>?@         */
        ':',';','<','=','>','?','@',
        /* 41-5a A-Z             */
        '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',
        /* 5b-60 [\]^_`          */
        '[','\\',']','^','_','`',
        /* 61-7a a-z             */
        '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',
        /* 7b-7f {|}~            */
        '{','|','}','~',' '
        /* iso8859-15 extended characters */
};

void printchars(unsigned char a,unsigned char b){
        for(b++;a!=b;a++)
/*                printf("%02x ",a); */
/*                printf("%02x ",characters[a]); */
                printf("%c",characters[a]);
        printf("\n");
}

int main(void) {
        printf("characters:\n\n");
        printchars(0x61,0x7a);
        printchars(0x41,0x5a);
        printf("numbers:\n\n");
        printchars(0x30,0x39);
        printf("other:\n\n");
        printchars(0x20,0x2f);
        /*printchars(0x3a,0x40);*/
        printchars(0x3a,0x3f);
        /*printchars(0x5b,0x60);*/
        /*printchars(0x7b,0x7f);*/
        printf("\n\n");
        printf("slash:               '%c'\n",'/');
        printf("backslash:           '%c'\n",'\\');
        printf("curly braces open:   '%c'\n",'{');
        printf("curly braces close:  '%c'\n",'}');
        printf("square braces open:  '%c'\n",'[');
        printf("square braces close: '%c'\n",']');
        printf("underscore:          '%c'\n",'_');
        printf("tilde:               '%c'\n",'~');
        printf("pipe:                '%c'\n",'|');
        printf("apostroph:           '%c'\n",'\'');
        printf("single quote         '%c'\n",'`');
        printf("xor                  '%c'\n",'^');
        printf("at                   '%c'\n",'@');

        return 0;
}