]> pd.if.org Git - pdclib.old/blob - platform/win32/functions/_PDCLIB/_PDCLIB_stdinit.c
PDCLIB-25 #resolve #comment Made ctype, wctype and codec data const.(This may be...
[pdclib.old] / platform / win32 / functions / _PDCLIB / _PDCLIB_stdinit.c
1 /* $Id$ */
2
3 /* _PDCLIB_stdinit
4
5    This file is part of the Public Domain C Library (PDCLib).
6    Permission is granted to use, modify, and / or redistribute at will.
7 */
8
9 /* This is an example initialization of stdin, stdout and stderr to the integer
10    file descriptors 0, 1, and 2, respectively. This applies for a great variety
11    of operating systems, including POSIX compliant ones.
12 */
13
14 #include <stdio.h>
15 #include <locale.h>
16 #include <limits.h>
17
18 #ifndef REGTEST
19 #include <_PDCLIB_io.h>
20 #include <_PDCLIB_locale.h>
21 #include <_PDCLIB_encoding.h>
22
23 extern const _PDCLIB_fileops_t _PDCLIB_fileops;
24
25 /* In a POSIX system, stdin / stdout / stderr are equivalent to the (int) file
26    descriptors 0, 1, and 2 respectively.
27 */
28 /* TODO: This is proof-of-concept, requires finetuning. */
29 static char _PDCLIB_sin_buffer[BUFSIZ];
30 static char _PDCLIB_sout_buffer[BUFSIZ];
31 static char _PDCLIB_serr_buffer[BUFSIZ];
32
33 static unsigned char _PDCLIB_sin_ungetbuf[_PDCLIB_UNGETCBUFSIZE];
34 static unsigned char _PDCLIB_sout_ungetbuf[_PDCLIB_UNGETCBUFSIZE];
35 static unsigned char _PDCLIB_serr_ungetbuf[_PDCLIB_UNGETCBUFSIZE];
36
37 static FILE _PDCLIB_serr = { 
38     .ops        = &_PDCLIB_fileops, 
39     .buffer     = _PDCLIB_serr_buffer, 
40     .bufsize    = BUFSIZ, 
41     .bufidx     = 0, 
42     .bufend     = 0, 
43     .ungetidx   = 0, 
44     .ungetbuf   = _PDCLIB_serr_ungetbuf, 
45     .status     = _IONBF | _PDCLIB_FWRITE | _PDCLIB_STATIC, 
46     .filename   = NULL, 
47     .next       = NULL,
48 };
49 static FILE _PDCLIB_sout = { 
50     .ops        = &_PDCLIB_fileops, 
51     .buffer     = _PDCLIB_sout_buffer, 
52     .bufsize    = BUFSIZ, 
53     .bufidx     = 0, 
54     .bufend     = 0, 
55     .ungetidx   = 0, 
56     .ungetbuf   = _PDCLIB_sout_ungetbuf, 
57     .status     = _IOLBF | _PDCLIB_FWRITE | _PDCLIB_STATIC, 
58     .filename   = NULL, 
59     .next       = &_PDCLIB_serr 
60 };
61 static FILE _PDCLIB_sin  = { 
62     .ops        = &_PDCLIB_fileops, 
63     .buffer     = _PDCLIB_sin_buffer, 
64     .bufsize    = BUFSIZ, 
65     .bufidx     = 0, 
66     .bufend     = 0, 
67     .ungetidx   = 0, 
68     .ungetbuf   = _PDCLIB_sin_ungetbuf, 
69     .status     = _IOLBF | _PDCLIB_FREAD | _PDCLIB_STATIC, 
70     .filename   = NULL, 
71     .next       = &_PDCLIB_sout 
72 };
73
74
75 FILE* stdin  = &_PDCLIB_sin;
76 FILE* stdout = &_PDCLIB_sout;
77 FILE* stderr = &_PDCLIB_serr;
78
79 /* FIXME: This approach is a possible attack vector. */
80 FILE* _PDCLIB_filelist = &_PDCLIB_sin;
81
82 tss_t _PDCLIB_locale_tss;
83
84 /* "C" locale - defaulting to ASCII-7.
85    1 kByte (+ 4 byte) of <ctype.h> data.
86    Each line: flags, lowercase, uppercase, collation.
87 */
88 static const _PDCLIB_ctype_t global_ctype[] = {
89     { /* EOF */    0,    0,    0,    0 },
90     { /* NUL */ _PDCLIB_CTYPE_CNTRL,                                             0x00, 0x00, 0x00 },
91     { /* SOH */ _PDCLIB_CTYPE_CNTRL,                                             0x01, 0x01, 0x01 },
92     { /* STX */ _PDCLIB_CTYPE_CNTRL,                                             0x02, 0x02, 0x02 },
93     { /* ETX */ _PDCLIB_CTYPE_CNTRL,                                             0x03, 0x03, 0x03 },
94     { /* EOT */ _PDCLIB_CTYPE_CNTRL,                                             0x04, 0x04, 0x04 },
95     { /* ENQ */ _PDCLIB_CTYPE_CNTRL,                                             0x05, 0x05, 0x05 },
96     { /* ACK */ _PDCLIB_CTYPE_CNTRL,                                             0x06, 0x06, 0x06 },
97     { /* BEL */ _PDCLIB_CTYPE_CNTRL,                                             0x07, 0x07, 0x07 },
98     { /*  BS */ _PDCLIB_CTYPE_CNTRL,                                             0x08, 0x08, 0x08 },
99     { /*  HT */ _PDCLIB_CTYPE_CNTRL | _PDCLIB_CTYPE_BLANK | _PDCLIB_CTYPE_SPACE, 0x09, 0x09, 0x09 },
100     { /*  LF */ _PDCLIB_CTYPE_CNTRL | _PDCLIB_CTYPE_SPACE,                       0x0A, 0x0A, 0x0A },
101     { /*  VT */ _PDCLIB_CTYPE_CNTRL | _PDCLIB_CTYPE_SPACE,                       0x0B, 0x0B, 0x0B },
102     { /*  FF */ _PDCLIB_CTYPE_CNTRL | _PDCLIB_CTYPE_SPACE,                       0x0C, 0x0C, 0x0C },
103     { /*  CR */ _PDCLIB_CTYPE_CNTRL | _PDCLIB_CTYPE_SPACE,                       0x0D, 0x0D, 0x0D },
104     { /*  SO */ _PDCLIB_CTYPE_CNTRL,                                             0x0E, 0x0E, 0x0E },
105     { /*  SI */ _PDCLIB_CTYPE_CNTRL,                                             0x0F, 0x0F, 0x0F },
106     { /* DLE */ _PDCLIB_CTYPE_CNTRL,                                             0x10, 0x10, 0x10 },
107     { /* DC1 */ _PDCLIB_CTYPE_CNTRL,                                             0x11, 0x11, 0x11 },
108     { /* DC2 */ _PDCLIB_CTYPE_CNTRL,                                             0x12, 0x12, 0x12 },
109     { /* DC3 */ _PDCLIB_CTYPE_CNTRL,                                             0x13, 0x13, 0x13 },
110     { /* DC4 */ _PDCLIB_CTYPE_CNTRL,                                             0x14, 0x14, 0x14 },
111     { /* NAK */ _PDCLIB_CTYPE_CNTRL,                                             0x15, 0x15, 0x15 },
112     { /* SYN */ _PDCLIB_CTYPE_CNTRL,                                             0x16, 0x16, 0x16 },
113     { /* ETB */ _PDCLIB_CTYPE_CNTRL,                                             0x17, 0x17, 0x17 },
114     { /* CAN */ _PDCLIB_CTYPE_CNTRL,                                             0x18, 0x18, 0x18 },
115     { /*  EM */ _PDCLIB_CTYPE_CNTRL,                                             0x19, 0x19, 0x19 },
116     { /* SUB */ _PDCLIB_CTYPE_CNTRL,                                             0x1A, 0x1A, 0x1A },
117     { /* ESC */ _PDCLIB_CTYPE_CNTRL,                                             0x1B, 0x1B, 0x1B },
118     { /*  FS */ _PDCLIB_CTYPE_CNTRL,                                             0x1C, 0x1C, 0x1C },
119     { /*  GS */ _PDCLIB_CTYPE_CNTRL,                                             0x1D, 0x1D, 0x1D },
120     { /*  RS */ _PDCLIB_CTYPE_CNTRL,                                             0x1E, 0x1E, 0x1E },
121     { /*  US */ _PDCLIB_CTYPE_CNTRL,                                             0x1F, 0x1F, 0x1F },
122     { /*  SP */ _PDCLIB_CTYPE_BLANK | _PDCLIB_CTYPE_SPACE,                       0x20, 0x20, 0x20 },
123     { /* '!' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x21, 0x21, 0x21 },
124     { /* '"' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x22, 0x22, 0x22 },
125     { /* '#' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x23, 0x23, 0x23 },
126     { /* '$' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x24, 0x24, 0x24 },
127     { /* '%' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x25, 0x25, 0x25 },
128     { /* '&' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x26, 0x26, 0x26 },
129     { /* ''' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x27, 0x27, 0x27 },
130     { /* '(' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x28, 0x28, 0x28 },
131     { /* ')' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x29, 0x29, 0x29 },
132     { /* '*' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x2A, 0x2A, 0x2A },
133     { /* '+' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x2B, 0x2B, 0x2B },
134     { /* ',' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x2C, 0x2C, 0x2C },
135     { /* '-' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x2D, 0x2D, 0x2D },
136     { /* '.' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x2E, 0x2E, 0x2E },
137     { /* '/' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x2F, 0x2F, 0x2F },
138     { /* '0' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_DIGIT | _PDCLIB_CTYPE_XDIGT, 0x30, 0x30, 0x30 },
139     { /* '1' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_DIGIT | _PDCLIB_CTYPE_XDIGT, 0x31, 0x31, 0x31 },
140     { /* '2' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_DIGIT | _PDCLIB_CTYPE_XDIGT, 0x32, 0x32, 0x32 },
141     { /* '3' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_DIGIT | _PDCLIB_CTYPE_XDIGT, 0x33, 0x33, 0x33 },
142     { /* '4' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_DIGIT | _PDCLIB_CTYPE_XDIGT, 0x34, 0x34, 0x34 },
143     { /* '5' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_DIGIT | _PDCLIB_CTYPE_XDIGT, 0x35, 0x35, 0x35 },
144     { /* '6' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_DIGIT | _PDCLIB_CTYPE_XDIGT, 0x36, 0x36, 0x36 },
145     { /* '7' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_DIGIT | _PDCLIB_CTYPE_XDIGT, 0x37, 0x37, 0x37 },
146     { /* '8' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_DIGIT | _PDCLIB_CTYPE_XDIGT, 0x38, 0x38, 0x38 },
147     { /* '9' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_DIGIT | _PDCLIB_CTYPE_XDIGT, 0x39, 0x39, 0x39 },
148     { /* ':' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x3A, 0x3A, 0x3A },
149     { /* ';' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x3B, 0x3B, 0x3B },
150     { /* '<' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x3C, 0x3C, 0x3C },
151     { /* '=' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x3D, 0x3D, 0x3D },
152     { /* '>' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x3E, 0x3E, 0x3E },
153     { /* '?' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x3F, 0x3F, 0x3F },
154     { /* '@' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x40, 0x40, 0x40 },
155     { /* 'A' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER | _PDCLIB_CTYPE_XDIGT, 0x41, 0x61, 0x41 },
156     { /* 'B' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER | _PDCLIB_CTYPE_XDIGT, 0x42, 0x62, 0x42 },
157     { /* 'C' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER | _PDCLIB_CTYPE_XDIGT, 0x43, 0x63, 0x43 },
158     { /* 'D' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER | _PDCLIB_CTYPE_XDIGT, 0x44, 0x64, 0x44 },
159     { /* 'E' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER | _PDCLIB_CTYPE_XDIGT, 0x45, 0x65, 0x45 },
160     { /* 'F' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER | _PDCLIB_CTYPE_XDIGT, 0x46, 0x66, 0x46 },
161     { /* 'G' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x47, 0x67, 0x47 },
162     { /* 'H' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x48, 0x68, 0x48 },
163     { /* 'I' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x49, 0x69, 0x49 },
164     { /* 'J' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x4A, 0x6A, 0x4A },
165     { /* 'K' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x4B, 0x6B, 0x4B },
166     { /* 'L' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x4C, 0x6C, 0x4C },
167     { /* 'M' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x4D, 0x6D, 0x4D },
168     { /* 'N' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x4E, 0x6E, 0x4E },
169     { /* 'O' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x4F, 0x6F, 0x4F },
170     { /* 'P' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x50, 0x70, 0x50 },
171     { /* 'Q' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x51, 0x71, 0x51 },
172     { /* 'R' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x52, 0x72, 0x52 },
173     { /* 'S' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x53, 0x73, 0x53 },
174     { /* 'T' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x54, 0x74, 0x54 },
175     { /* 'U' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x55, 0x75, 0x55 },
176     { /* 'V' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x56, 0x76, 0x56 },
177     { /* 'W' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x57, 0x77, 0x57 },
178     { /* 'X' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x58, 0x78, 0x58 },
179     { /* 'Y' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x59, 0x79, 0x59 },
180     { /* 'Z' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x5A, 0x7A, 0x5A },
181     { /* '[' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x5B, 0x5B, 0x5B },
182     { /* '\' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x5C, 0x5C, 0x5C },
183     { /* ']' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x5D, 0x5D, 0x5D },
184     { /* '^' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x5E, 0x5E, 0x5E },
185     { /* '_' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x5F, 0x5F, 0x5F },
186     { /* '`' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x60, 0x60, 0x60 },
187     { /* 'a' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER | _PDCLIB_CTYPE_XDIGT, 0x41, 0x61, 0x61 },
188     { /* 'b' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER | _PDCLIB_CTYPE_XDIGT, 0x42, 0x62, 0x62 },
189     { /* 'c' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER | _PDCLIB_CTYPE_XDIGT, 0x43, 0x63, 0x63 },
190     { /* 'd' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER | _PDCLIB_CTYPE_XDIGT, 0x44, 0x64, 0x64 },
191     { /* 'e' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER | _PDCLIB_CTYPE_XDIGT, 0x45, 0x65, 0x65 },
192     { /* 'f' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER | _PDCLIB_CTYPE_XDIGT, 0x46, 0x66, 0x66 },
193     { /* 'g' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x47, 0x67, 0x67 },
194     { /* 'h' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x48, 0x68, 0x68 },
195     { /* 'i' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x49, 0x69, 0x69 },
196     { /* 'j' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x4A, 0x6A, 0x6A },
197     { /* 'k' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x4B, 0x6B, 0x6B },
198     { /* 'l' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x4C, 0x6C, 0x6C },
199     { /* 'm' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x4D, 0x6D, 0x6D },
200     { /* 'n' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x4E, 0x6E, 0x6E },
201     { /* 'o' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x4F, 0x6F, 0x6F },
202     { /* 'p' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x50, 0x70, 0x70 },
203     { /* 'q' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x51, 0x71, 0x71 },
204     { /* 'r' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x52, 0x72, 0x72 },
205     { /* 's' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x53, 0x73, 0x73 },
206     { /* 't' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x54, 0x74, 0x74 },
207     { /* 'u' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x55, 0x75, 0x75 },
208     { /* 'v' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x56, 0x76, 0x76 },
209     { /* 'w' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x57, 0x77, 0x77 },
210     { /* 'x' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x58, 0x78, 0x78 },
211     { /* 'y' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x59, 0x79, 0x79 },
212     { /* 'z' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x5A, 0x7A, 0x7A },
213     { /* '{' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x7B, 0x7B, 0x7B },
214     { /* '|' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x7C, 0x7C, 0x7C },
215     { /* '}' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x7D, 0x7D, 0x7D },
216     { /* '~' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x7E, 0x7E, 0x7E },
217     { /* DEL */ _PDCLIB_CTYPE_CNTRL,                                             0x7F, 0x7F, 0x7F },
218     { 0x00, 0x80, 0x80, 0x80 },
219     { 0x00, 0x81, 0x81, 0x81 },
220     { 0x00, 0x82, 0x82, 0x82 },
221     { 0x00, 0x83, 0x83, 0x83 },
222     { 0x00, 0x84, 0x84, 0x84 },
223     { 0x00, 0x85, 0x85, 0x85 },
224     { 0x00, 0x86, 0x86, 0x86 },
225     { 0x00, 0x87, 0x87, 0x87 },
226     { 0x00, 0x88, 0x88, 0x88 },
227     { 0x00, 0x89, 0x89, 0x89 },
228     { 0x00, 0x8A, 0x8A, 0x8A },
229     { 0x00, 0x8B, 0x8B, 0x8B },
230     { 0x00, 0x8C, 0x8C, 0x8C },
231     { 0x00, 0x8D, 0x8D, 0x8D },
232     { 0x00, 0x8E, 0x8E, 0x8E },
233     { 0x00, 0x8F, 0x8F, 0x8F },
234     { 0x00, 0x90, 0x90, 0x90 },
235     { 0x00, 0x91, 0x91, 0x91 },
236     { 0x00, 0x92, 0x92, 0x92 },
237     { 0x00, 0x93, 0x93, 0x93 },
238     { 0x00, 0x94, 0x94, 0x94 },
239     { 0x00, 0x95, 0x95, 0x95 },
240     { 0x00, 0x96, 0x96, 0x96 },
241     { 0x00, 0x97, 0x97, 0x97 },
242     { 0x00, 0x98, 0x98, 0x98 },
243     { 0x00, 0x99, 0x99, 0x99 },
244     { 0x00, 0x9A, 0x9A, 0x9A },
245     { 0x00, 0x9B, 0x9B, 0x9B },
246     { 0x00, 0x9C, 0x9C, 0x9C },
247     { 0x00, 0x9D, 0x9D, 0x9D },
248     { 0x00, 0x9E, 0x9E, 0x9E },
249     { 0x00, 0x9F, 0x9F, 0x9F },
250     { 0x00, 0xA0, 0xA0, 0xA0 },
251     { 0x00, 0xA1, 0xA1, 0xA1 },
252     { 0x00, 0xA2, 0xA2, 0xA2 },
253     { 0x00, 0xA3, 0xA3, 0xA3 },
254     { 0x00, 0xA4, 0xA4, 0xA4 },
255     { 0x00, 0xA5, 0xA5, 0xA5 },
256     { 0x00, 0xA6, 0xA6, 0xA6 },
257     { 0x00, 0xA7, 0xA7, 0xA7 },
258     { 0x00, 0xA8, 0xA8, 0xA8 },
259     { 0x00, 0xA9, 0xA9, 0xA9 },
260     { 0x00, 0xAA, 0xAA, 0xAA },
261     { 0x00, 0xAB, 0xAB, 0xAB },
262     { 0x00, 0xAC, 0xAC, 0xAC },
263     { 0x00, 0xAD, 0xAD, 0xAD },
264     { 0x00, 0xAE, 0xAE, 0xAE },
265     { 0x00, 0xAF, 0xAF, 0xAF },
266     { 0x00, 0xB0, 0xB0, 0xB0 },
267     { 0x00, 0xB1, 0xB1, 0xB1 },
268     { 0x00, 0xB2, 0xB2, 0xB2 },
269     { 0x00, 0xB3, 0xB3, 0xB3 },
270     { 0x00, 0xB4, 0xB4, 0xB4 },
271     { 0x00, 0xB5, 0xB5, 0xB5 },
272     { 0x00, 0xB6, 0xB6, 0xB6 },
273     { 0x00, 0xB7, 0xB7, 0xB7 },
274     { 0x00, 0xB8, 0xB8, 0xB8 },
275     { 0x00, 0xB9, 0xB9, 0xB9 },
276     { 0x00, 0xBA, 0xBA, 0xBA },
277     { 0x00, 0xBB, 0xBB, 0xBB },
278     { 0x00, 0xBC, 0xBC, 0xBC },
279     { 0x00, 0xBD, 0xBD, 0xBD },
280     { 0x00, 0xBE, 0xBE, 0xBE },
281     { 0x00, 0xBF, 0xBF, 0xBF },
282     { 0x00, 0xC0, 0xC0, 0xC0 },
283     { 0x00, 0xC1, 0xC1, 0xC1 },
284     { 0x00, 0xC2, 0xC2, 0xC2 },
285     { 0x00, 0xC3, 0xC3, 0xC3 },
286     { 0x00, 0xC4, 0xC4, 0xC4 },
287     { 0x00, 0xC5, 0xC5, 0xC5 },
288     { 0x00, 0xC6, 0xC6, 0xC6 },
289     { 0x00, 0xC7, 0xC7, 0xC7 },
290     { 0x00, 0xC8, 0xC8, 0xC8 },
291     { 0x00, 0xC9, 0xC9, 0xC9 },
292     { 0x00, 0xCA, 0xCA, 0xCA },
293     { 0x00, 0xCB, 0xCB, 0xCB },
294     { 0x00, 0xCC, 0xCC, 0xCC },
295     { 0x00, 0xCD, 0xCD, 0xCD },
296     { 0x00, 0xCE, 0xCE, 0xCE },
297     { 0x00, 0xCF, 0xCF, 0xCF },
298     { 0x00, 0xD0, 0xD0, 0xD0 },
299     { 0x00, 0xD1, 0xD1, 0xD1 },
300     { 0x00, 0xD2, 0xD2, 0xD2 },
301     { 0x00, 0xD3, 0xD3, 0xD3 },
302     { 0x00, 0xD4, 0xD4, 0xD4 },
303     { 0x00, 0xD5, 0xD5, 0xD5 },
304     { 0x00, 0xD6, 0xD6, 0xD6 },
305     { 0x00, 0xD7, 0xD7, 0xD7 },
306     { 0x00, 0xD8, 0xD8, 0xD8 },
307     { 0x00, 0xD9, 0xD9, 0xD9 },
308     { 0x00, 0xDA, 0xDA, 0xDA },
309     { 0x00, 0xDB, 0xDB, 0xDB },
310     { 0x00, 0xDC, 0xDC, 0xDC },
311     { 0x00, 0xDD, 0xDD, 0xDD },
312     { 0x00, 0xDE, 0xDE, 0xDE },
313     { 0x00, 0xDF, 0xDF, 0xDF },
314     { 0x00, 0xE0, 0xE0, 0xE0 },
315     { 0x00, 0xE1, 0xE1, 0xE1 },
316     { 0x00, 0xE2, 0xE2, 0xE2 },
317     { 0x00, 0xE3, 0xE3, 0xE3 },
318     { 0x00, 0xE4, 0xE4, 0xE4 },
319     { 0x00, 0xE5, 0xE5, 0xE5 },
320     { 0x00, 0xE6, 0xE6, 0xE6 },
321     { 0x00, 0xE7, 0xE7, 0xE7 },
322     { 0x00, 0xE8, 0xE8, 0xE8 },
323     { 0x00, 0xE9, 0xE9, 0xE9 },
324     { 0x00, 0xEA, 0xEA, 0xEA },
325     { 0x00, 0xEB, 0xEB, 0xEB },
326     { 0x00, 0xEC, 0xEC, 0xEC },
327     { 0x00, 0xED, 0xED, 0xED },
328     { 0x00, 0xEE, 0xEE, 0xEE },
329     { 0x00, 0xEF, 0xEF, 0xEF },
330     { 0x00, 0xF0, 0xF0, 0xF0 },
331     { 0x00, 0xF1, 0xF1, 0xF1 },
332     { 0x00, 0xF2, 0xF2, 0xF2 },
333     { 0x00, 0xF3, 0xF3, 0xF3 },
334     { 0x00, 0xF4, 0xF4, 0xF4 },
335     { 0x00, 0xF5, 0xF5, 0xF5 },
336     { 0x00, 0xF6, 0xF6, 0xF6 },
337     { 0x00, 0xF7, 0xF7, 0xF7 },
338     { 0x00, 0xF8, 0xF8, 0xF8 },
339     { 0x00, 0xF9, 0xF9, 0xF9 },
340     { 0x00, 0xFA, 0xFA, 0xFA },
341     { 0x00, 0xFB, 0xFB, 0xFB },
342     { 0x00, 0xFC, 0xFC, 0xFC },
343     { 0x00, 0xFD, 0xFD, 0xFD },
344     { 0x00, 0xFE, 0xFE, 0xFE },
345     { 0x00, 0xFF, 0xFF, 0xFF }
346 };
347
348 extern const struct _PDCLIB_charcodec _PDCLIB_ascii_codec;
349 struct _PDCLIB_locale _PDCLIB_global_locale = {
350     ._Codec = &_PDCLIB_ascii_codec,
351     ._Conv  = { 
352         /* decimal_point      */ (char *)".",
353         /* thousands_sep      */ (char *)"",
354         /* grouping           */ (char *)"",
355         /* mon_decimal_point  */ (char *)"",
356         /* mon_thousands_sep  */ (char *)"",
357         /* mon_grouping       */ (char *)"",
358         /* positive_sign      */ (char *)"",
359         /* negative_sign      */ (char *)"",
360         /* currency_symbol    */ (char *)"",
361         /* int_curr_symbol    */ (char *)"",
362         /* frac_digits        */ CHAR_MAX,
363         /* p_cs_precedes      */ CHAR_MAX,
364         /* n_cs_precedes      */ CHAR_MAX,
365         /* p_sep_by_space     */ CHAR_MAX,
366         /* n_sep_by_space     */ CHAR_MAX,
367         /* p_sign_posn        */ CHAR_MAX,
368         /* n_sign_posn        */ CHAR_MAX,
369         /* int_frac_digits    */ CHAR_MAX,
370         /* int_p_cs_precedes  */ CHAR_MAX,
371         /* int_n_cs_precedes  */ CHAR_MAX,
372         /* int_p_sep_by_space */ CHAR_MAX,
373         /* int_n_sep_by_space */ CHAR_MAX,
374         /* int_p_sign_posn    */ CHAR_MAX,
375         /* int_n_sign_posn    */ CHAR_MAX,
376     },
377     ._CType = &global_ctype[1],
378     ._ErrnoStr = {
379         /* no error */ (char *)"",
380         /* ERANGE   */ (char *)"ERANGE (Range error)",
381         /* EDOM     */ (char *)"EDOM (Domain error)",
382         /* EILSEQ   */ (char *)"EILSEQ (Illegal sequence)"
383     },
384 };
385 #endif
386
387 #ifdef TEST
388 #include <_PDCLIB_test.h>
389
390 int main( void )
391 {
392     /* Testing covered by several other testdrivers using stdin / stdout / 
393        stderr.
394     */
395     return TEST_RESULTS;
396 }
397
398 #endif