source: trunk/src/crtdll/crtinc.h@ 1212

Last change on this file since 1212 was 1207, checked in by sandervl, 26 years ago

Update by Jens Weissner

File size: 8.7 KB
Line 
1/* $Id: crtinc.h,v 1.6 1999-10-09 09:39:13 sandervl Exp $ */
2
3/* Definitions for the CRTDLL library (CRTDLL.DLL)
4 *
5 * Copyright 1999 Jens Wiessner
6 */
7
8#define MB_LEN_MAX 2
9#ifndef MAX_PATHNAME_LEN
10#define MAX_PATHNAME_LEN 260
11#endif
12
13// Errno Defs
14#define EAGAIN 11 /* Resource temporarily unavailable */
15#define EINVAL 22 /* Invalid argument */
16
17
18// MBC Defs
19#define _MBC_SINGLE 0
20#define _MBC_LEAD 1
21#define _MBC_TRAIL 2
22#define _MBC_ILLEGAL -1
23
24#define _MB_CP_SBCS 0
25#define _MB_CP_OEM -2
26#define _MB_CP_ANSI -3
27#define _MB_CP_LOCALE -4
28
29#define _KNJ_M ((char)0x01) /* Non-punctuation of Kana-set */
30#define _KNJ_P ((char)0x02) /* Punctuation of Kana-set */
31#define _KNJ_1 ((char)0x04) /* Legal 1st byte of double byte stream */
32#define _KNJ_2 ((char)0x08) /* Legal 2nd btye of double byte stream */
33
34#define ___ 0
35#define _1_ _KNJ_1 /* Legal 1st byte of double byte code */
36#define __2 _KNJ_2 /* Legal 2nd byte of double byte code */
37#define _M_ _KNJ_M /* Non-puntuation in Kana-set */
38#define _P_ _KNJ_P /* Punctuation of Kana-set */
39#define _12 (_1_|__2)
40#define _M2 (_M_|__2)
41#define _P2 (_P_|__2)
42
43#define CASE_DIFF (0x8281 - 0x8260)
44
45// Defs
46#define DOSFS_GetFullName(a,b,c) strcpy(c,a)
47
48#if defined(__GNUC__) && defined(__i386__)
49#define USING_REAL_FPU
50#define DO_FPU(x,y) __asm__ __volatile__( x " %0;fwait" : "=m" (y) : )
51#define POP_FPU(x) DO_FPU("fstpl",x)
52#endif
53
54typedef struct
55{
56 HANDLE handle;
57 int pad[7];
58} CRTDLL_FILE, *PCRTDLL_FILE;
59
60
61/* Definition of a full DOS file name */
62typedef struct
63{
64 char long_name[MAX_PATHNAME_LEN]; /* Long pathname in Unix format */
65 char short_name[MAX_PATHNAME_LEN]; /* Short pathname in DOS 8.3 format */
66 int drive;
67} DOS_FULL_NAME;
68
69
70#ifndef _DISKFREE_T_DEFINED
71#define _DISKFREE_T_DEFINED
72#define _DISKFREE_T_DEFINED_
73struct _diskfree_t {
74 unsigned total_clusters;
75 unsigned avail_clusters;
76 unsigned sectors_per_cluster;
77 unsigned bytes_per_sector;
78};
79#define diskfree_t _diskfree_t
80#endif
81
82
83typedef VOID (*new_handler_type)(VOID);
84typedef void (*_INITTERMFUN)();
85
86
87CRTDLL_FILE CRTDLL_iob[3];
88
89static CRTDLL_FILE * const CRTDLL_stdin = &CRTDLL_iob[0];
90static CRTDLL_FILE * const CRTDLL_stdout = &CRTDLL_iob[1];
91static CRTDLL_FILE * const CRTDLL_stderr = &CRTDLL_iob[2];
92static new_handler_type new_handler;
93
94double *CRTDLL_HUGE_dll; /* CRTDLL.20 */
95UINT CRTDLL_argc_dll; /* CRTDLL.23 */
96LPSTR *CRTDLL_argv_dll; /* CRTDLL.24 */
97int CRTDLL_mb_cur_max_dll; /* CRTDLL.31 */
98LPSTR CRTDLL_acmdln_dll; /* CRTDLL.38 */
99UINT CRTDLL_basemajor_dll; /* CRTDLL.42 */
100UINT CRTDLL_baseminor_dll; /* CRTDLL.43 */
101UINT CRTDLL_baseversion_dll; /* CRTDLL.44 */
102UINT CRTDLL_commode_dll; /* CRTDLL.59 */
103UCHAR *CRTDLL_cpumode_dll; /* CRTDLL.64 */
104USHORT *CRTDLL_ctype; /* CRTDLL.68 */
105UINT CRTDLL_daylight_dll; /* CRTDLL.70 */
106LPSTR CRTDLL_environ_dll; /* CRTDLL.75 */
107LPSTR CRTDLL_fileinfo_dll; /* CRTDLL.95 */
108UINT CRTDLL_fmode_dll; /* CRTDLL.104 */
109LPSTR CRTDLL_mbctype; /* CRTDLL.193 */
110UINT CRTDLL_osmajor_dll; /* CRTDLL.239 */
111UINT CRTDLL_osminor_dll; /* CRTDLL.240 */
112UINT CRTDLL_osmode_dll; /* CRTDLL.241 */
113UINT CRTDLL_osver_dll; /* CRTDLL.242 */
114UINT CRTDLL_osversion_dll; /* CRTDLL.243 */
115USHORT CRTDLL_pctype_dll[] = {0,0}; /* CRTDLL.245 */
116LPSTR CRTDLL_pgmptr_dll; /* CRTDLL.246 */
117USHORT *CRTDLL_pwctype_dll; /* CRTDLL.253 */
118UINT CRTDLL_sys_errlist; /* CRTDLL.300 */
119UINT CRTDLL_sys_nerr_dll; /* CRTDLL.301 */
120UINT CRTDLL_timezone_dll; /* CRTDLL.304 */
121LPSTR CRTDLL_tzname; /* CRTDLL.307 */
122UINT CRTDLL_winmajor_dll; /* CRTDLL.326 */
123UINT CRTDLL_winminor_dll; /* CRTDLL.327 */
124UINT CRTDLL_winver_dll; /* CRTDLL.328 */
125
126
127
128
129CRTDLL_FILE * CDECL CRTDLL__fdopen(INT handle, LPCSTR mode);
130INT CDECL NTDLL__wcsicmp( LPCWSTR str1, LPCWSTR str2 );
131INT CDECL CRTDLL_vfprintf( CRTDLL_FILE *file, LPSTR format, va_list args );
132VOID * CDECL CRTDLL_malloc(DWORD size);
133long CDECL CRTDLL__lseek(int handle,long offset,int origin);
134long CDECL CRTDLL__filelength( int i );
135VOID CDECL CRTDLL__exit(DWORD ret);
136INT CDECL CRTDLL_isalnum(int i);
137int CDECL CRTDLL_isgraph(int i);
138int CDECL CRTDLL__access(const char *path,int mode);
139int CDECL CRTDLL__getch(void);
140size_t CDECL CRTDLL_fread( void *ptr, size_t size, size_t n, FILE *fp );
141int CDECL CRTDLL__mbbtype( unsigned char c, int type );
142LPSTR CDECL CRTDLL__mbsinc( LPCSTR str );
143int CDECL CRTDLL__ismbbkalnum( unsigned int c );
144int CDECL CRTDLL__ismbbkana( unsigned int c );
145int CDECL CRTDLL__ismbbalpha( unsigned int c );
146int CDECL CRTDLL__ismbbtrail( unsigned int c );
147int CDECL CRTDLL__ismbblead( unsigned int c );
148char * CDECL CRTDLL_getenv( const char *name );
149
150//
151// Definitions for internal functions
152//
153int __set_errno (int error);
154unsigned int _mbbtoupper(unsigned int c);
155unsigned int _mbbtolower(unsigned int c);
156size_t _mbclen2(const unsigned int s);
157
158
159//
160// MBC Includes
161//
162static unsigned short han_to_zen_ascii_table[0x5f] = {
163 0x8140, 0x8149, 0x8168, 0x8194, 0x8190, 0x8193, 0x8195, 0x8166,
164 0x8169, 0x816a, 0x8196, 0x817b, 0x8143, 0x817c, 0x8144, 0x815e,
165 0x824f, 0x8250, 0x8251, 0x8252, 0x8253, 0x8254, 0x8255, 0x8256,
166 0x8257, 0x8258, 0x8146, 0x8147, 0x8183, 0x8181, 0x8184, 0x8148,
167 0x8197, 0x8260, 0x8261, 0x8262, 0x8263, 0x8264, 0x8265, 0x8266,
168 0x8267, 0x8268, 0x8269, 0x826a, 0x826b, 0x826c, 0x826d, 0x826e,
169 0x826f, 0x8270, 0x8271, 0x8272, 0x8273, 0x8274, 0x8275, 0x8276,
170 0x8277, 0x8278, 0x8279, 0x816d, 0x818f, 0x816e, 0x814f, 0x8151,
171 0x8165, 0x8281, 0x8282, 0x8283, 0x8284, 0x8285, 0x8286, 0x8287,
172 0x8288, 0x8289, 0x828a, 0x828b, 0x828c, 0x828d, 0x828e, 0x828f,
173 0x8290, 0x8291, 0x8292, 0x8293, 0x8294, 0x8295, 0x8296, 0x8297,
174 0x8298, 0x8299, 0x829a, 0x816f, 0x8162, 0x8170, 0x8150
175};
176static unsigned short han_to_zen_kana_table[0x40] = {
177 0x8140, 0x8142, 0x8175, 0x8176, 0x8141, 0x8145, 0x8392, 0x8340,
178 0x8342, 0x8344, 0x8346, 0x8348, 0x8383, 0x8385, 0x8387, 0x8362,
179 0x815b, 0x8341, 0x8343, 0x8345, 0x8347, 0x8349, 0x834a, 0x834c,
180 0x834e, 0x8350, 0x8352, 0x8354, 0x8356, 0x8358, 0x835a, 0x835c,
181 0x835e, 0x8360, 0x8363, 0x8365, 0x8367, 0x8369, 0x836a, 0x836b,
182 0x836c, 0x836d, 0x836e, 0x8371, 0x8374, 0x8377, 0x837a, 0x837d,
183 0x837e, 0x8380, 0x8381, 0x8382, 0x8384, 0x8386, 0x8388, 0x8389,
184 0x838a, 0x838b, 0x838c, 0x838d, 0x838f, 0x8393, 0x814a, 0x814b
185};
186static unsigned char zen_to_han_kana_table[0x8396-0x8340+1] = {
187 0xa7, 0xb1, 0xa8, 0xb2, 0xa9, 0xb3, 0xaa, 0xb4,
188 0xab, 0xb5, 0xb6, 0xb6, 0xb7, 0xb7, 0xb8, 0xb8,
189 0xb9, 0xb9, 0xba, 0xba, 0xbb, 0xbb, 0xbc, 0xbc,
190 0xbd, 0xbd, 0xbe, 0xbe, 0xbf, 0xbf, 0xc0, 0xc0,
191 0xc1, 0xc1, 0xaf, 0xc2, 0xc2, 0xc3, 0xc3, 0xc4,
192 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xca,
193 0xca, 0xcb, 0xcb, 0xcb, 0xcc, 0xcc, 0xcc, 0xcd,
194 0xcd, 0xcd, 0xce, 0xce, 0xce, 0xcf, 0xd0, 0,
195 0xd1, 0xd2, 0xd3, 0xac, 0xd4, 0xad, 0xd5, 0xae,
196 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdc,
197 0xb2, 0xb4, 0xa6, 0xdd, 0xb3, 0xb6, 0xb9
198};
199#define ZTOH_SYMBOLS 9
200static unsigned short zen_to_han_symbol_table_1[ZTOH_SYMBOLS] = {
201 0x8142, 0x8175, 0x8176, 0x8141, 0x8145, 0x815b, 0x814a, 0x814b
202};
203static unsigned char zen_to_han_symbol_table_2[ZTOH_SYMBOLS] = {
204 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xb0, 0xde, 0xdf
205};
206#define ISKANA(c) ((c) >= 0xa1 && (c) <= 0xdf)
207#define JISHIRA(c) ((c) >= 0x829f && (c) <= 0x82f1)
208#define JISKANA(c) ((c) >= 0x8340 && (c) <= 0x8396 && (c) != 0x837f)
209#define JTOKANA(c) ((c) <= 0x82dd ? (c) + 0xa1 : (c) + 0xa2)
210
211char _jctype[257] = {
212/*-1*/ ___,
213/*0x*/ ___,___,___,___,___,___,___,___,___,___,___,___,___,___,___,___,
214/*1x*/ ___,___,___,___,___,___,___,___,___,___,___,___,___,___,___,___,
215/*2x*/ ___,___,___,___,___,___,___,___,___,___,___,___,___,___,___,___,
216/*3x*/ ___,___,___,___,___,___,___,___,___,___,___,___,___,___,___,___,
217/*4x*/ __2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,
218/*5x*/ __2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,
219/*6x*/ __2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,
220/*7x*/ __2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,___,
221/*8x*/ __2,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,
222/*9x*/ _12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,
223/*Ax*/ __2,_P2,_P2,_P2,_P2,_P2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,
224/*Bx*/ _M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,
225/*Cx*/ _M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,
226/*Dx*/ _M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,
227/*Ex*/ _12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,
228/*Fx*/ _12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,___,___,___
229};
Note: See TracBrowser for help on using the repository browser.