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