source: trunk/src/crtdll/crtdll.h@ 5280

Last change on this file since 5280 was 4667, checked in by phaller, 25 years ago

Major move towards WINE CRTDLL, mixture between both code branches

File size: 14.3 KB
Line 
1#ifndef __WINE_CRTDLL_H
2#define __WINE_CRTDLL_H
3
4#include "config.h"
5#include "windef.h"
6/* @@@PH #include "wine/windef16.h" */
7#include "debugtools.h"
8#include "winbase.h"
9#include "winerror.h"
10#include "winnls.h"
11#include <time.h>
12#include <stdarg.h>
13#include <setjmp.h>
14
15
16#define CRTDLL_LC_ALL 0
17#define CRTDLL_LC_COLLATE 1
18#define CRTDLL_LC_CTYPE 2
19#define CRTDLL_LC_MONETARY 3
20#define CRTDLL_LC_NUMERIC 4
21#define CRTDLL_LC_TIME 5
22#define CRTDLL_LC_MIN LC_ALL
23#define CRTDLL_LC_MAX LC_TIME
24
25/* ctype defines */
26#define CRTDLL_UPPER 0x1
27#define CRTDLL_LOWER 0x2
28#define CRTDLL_DIGIT 0x4
29#define CRTDLL_SPACE 0x8
30#define CRTDLL_PUNCT 0x10
31#define CRTDLL_CONTROL 0x20
32#define CRTDLL_BLANK 0x40
33#define CRTDLL_HEX 0x80
34#define CRTDLL_LEADBYTE 0x8000
35#define CRTDLL_ALPHA (0x0100|CRTDLL_UPPER|CRTDLL_LOWER)
36
37/* stat() mode bits */
38#define _S_IFMT 0170000
39#define _S_IFREG 0100000
40#define _S_IFDIR 0040000
41#define _S_IFCHR 0020000
42#define _S_IFIFO 0010000
43#define _S_IREAD 0000400
44#define _S_IWRITE 0000200
45#define _S_IEXEC 0000100
46
47/* _open modes */
48#define _O_RDONLY 0x0000
49#define _O_WRONLY 0x0001
50#define _O_RDWR 0x0002
51#define _O_APPEND 0x0008
52#define _O_CREAT 0x0100
53#define _O_TRUNC 0x0200
54#define _O_EXCL 0x0400
55#define _O_TEXT 0x4000
56#define _O_BINARY 0x8000
57
58/* _access() bit flags FIXME: incomplete */
59#define W_OK 2
60
61/* windows.h RAND_MAX is smaller than normal RAND_MAX */
62#define CRTDLL_RAND_MAX 0x7fff
63
64/* heap function constants */
65
66#ifdef _HEAPEMPTY
67#undef _HEAPEMPTY
68#endif
69
70#ifdef _HEAPOK
71#undef _HEAPOK
72#endif
73
74#ifdef _HEAPBADBEGIN
75#undef _HEAPBADBEGIN
76#endif
77
78#ifdef _HEAPBADNODE
79#undef _HEAPBADNODE
80#endif
81
82#ifdef _HEAPEND
83#undef _HEAPEND
84#endif
85
86#ifdef _HEAPBADPTR
87#undef _HEAPBADPTR
88#endif
89
90#ifdef _FREEENTRY
91#undef _FREEENTRY
92#endif
93
94#ifdef _USEDENTRY
95#undef _USEDENTRY
96#endif
97
98#define _HEAPEMPTY -1
99#define _HEAPOK -2
100#define _HEAPBADBEGIN -3
101#define _HEAPBADNODE -4
102#define _HEAPEND -5
103#define _HEAPBADPTR -6
104#define _FREEENTRY 0
105#define _USEDENTRY 1
106
107/* CRTDLL Globals */
108extern INT CRTDLL_doserrno;
109extern INT CRTDLL_errno;
110
111
112/* Binary compatable structures, types and defines used
113 * by CRTDLL. These should move to external header files,
114 * and in some cases need be renamed (CRTDLL_FILE!) to defs
115 * as used by lcc/bcc/watcom/vc++ etc, in order to get source
116 * compatability for winelib.
117 */
118
119typedef struct _crtfile
120{
121 CHAR* _ptr;
122 INT _cnt;
123 CHAR* _base;
124 INT _flag;
125 INT _file; /* fd */
126 int _charbuf;
127 int _bufsiz;
128 char *_tmpfname;
129} CRTDLL_FILE;
130
131/* file._flag flags */
132#ifdef _IOEOF
133#undef _IOEOF
134#endif
135
136#ifdef _IOERR
137#undef _IOERR
138#endif
139
140#ifdef EOF
141#undef EOF
142#endif
143
144#define _IOREAD 0x0001
145#define _IOWRT 0x0002
146#define _IOEOF 0x0010
147#define _IOERR 0x0020
148#define _IORW 0x0080
149#define _IOAPPEND 0x0200
150
151#define SEEK_SET 0
152#define SEEK_CUR 1
153#define SEEK_END 2
154
155#define EOF -1
156
157extern CRTDLL_FILE __CRTDLL_iob[3];
158
159#define CRTDLL_stdin (&__CRTDLL_iob[0])
160#define CRTDLL_stdout (&__CRTDLL_iob[1])
161#define CRTDLL_stderr (&__CRTDLL_iob[2])
162
163typedef struct _find_t
164{
165 unsigned attrib;
166 time_t time_create; /* -1 when N/A */
167 time_t time_access; /* -1 when N/A */
168 time_t time_write;
169 unsigned long size; /* FIXME: 64 bit ??*/
170 char name[MAX_PATH];
171} find_t;
172
173typedef struct _diskfree_t {
174 unsigned num_clusters;
175 unsigned available;
176 unsigned cluster_sectors;
177 unsigned sector_bytes;
178} diskfree_t;
179
180struct _stat
181{
182 UINT16 st_dev;
183 UINT16 st_ino;
184 UINT16 st_mode;
185 INT16 st_nlink;
186 INT16 st_uid;
187 INT16 st_gid;
188 UINT st_rdev;
189 INT st_size;
190 INT st_atime;
191 INT st_mtime;
192 INT st_ctime;
193};
194
195struct _timeb
196{
197 time_t time;
198 UINT16 millitm;
199 INT16 timezone;
200 INT16 dstflag;
201};
202
203typedef long __CRTDLL_fpos_t;
204struct __CRTDLL_complex
205{
206 double real;
207 double imaginary;
208};
209
210typedef struct _heapinfo
211{
212 int * _pentry;
213 size_t _size;
214 int _useflag;
215} _HEAPINFO;
216
217typedef VOID (*sig_handler_type)(VOID);
218
219typedef VOID (*new_handler_type)(VOID);
220
221typedef VOID (*_INITTERMFUN)();
222
223typedef VOID (*atexit_function)(VOID);
224
225/* @@@PH typedef INT (__cdecl *comp_func)(LPVOID *,LPVOID *); */
226typedef INT (* _cdecl comp_func)(LPVOID *,LPVOID *);
227
228/* CRTDLL functions */
229
230/* CRTDLL_dir.c */
231INT __cdecl CRTDLL__chdir( LPCSTR newdir );
232BOOL __cdecl CRTDLL__chdrive( INT newdrive );
233INT __cdecl CRTDLL__findclose( DWORD hand );
234DWORD __cdecl CRTDLL__findfirst( LPCSTR fspec, find_t* ft );
235INT __cdecl CRTDLL__findnext( DWORD hand, find_t * ft );
236CHAR* __cdecl CRTDLL__getcwd( LPSTR buf, INT size );
237CHAR* __cdecl CRTDLL__getdcwd( INT drive,LPSTR buf, INT size );
238UINT __cdecl CRTDLL__getdiskfree( UINT disk, diskfree_t* d );
239INT __cdecl CRTDLL__getdrive( VOID );
240INT __cdecl CRTDLL__mkdir( LPCSTR newdir );
241INT __cdecl CRTDLL__rmdir( LPSTR dir );
242
243/* CRTDLL_exit.c */
244INT __cdecl CRTDLL__abnormal_termination( VOID );
245VOID __cdecl CRTDLL__amsg_exit( INT err );
246VOID __cdecl CRTDLL__assert( LPVOID str, LPVOID file, UINT line );
247// @@@PH VOID __cdecl CRTDLL__c_exit( VOID );
248VOID __cdecl CRTDLL__c_exit( INT ret );
249// @@@PH VOID __cdecl CRTDLL__cexit( VOID );
250VOID __cdecl CRTDLL__cexit( INT ret );
251void __cdecl CRTDLL_exit( DWORD ret );
252VOID __cdecl CRTDLL__exit( LONG ret );
253VOID __cdecl CRTDLL_abort( VOID );
254INT __cdecl CRTDLL_atexit( atexit_function x );
255atexit_function __cdecl CRTDLL__onexit( atexit_function func);
256
257/* CRTDLL_file.c */
258CRTDLL_FILE* __cdecl CRTDLL__iob( VOID );
259CRTDLL_FILE* __cdecl CRTDLL__fsopen( LPCSTR path, LPCSTR mode, INT share );
260CRTDLL_FILE* __cdecl CRTDLL__fdopen( INT fd, LPCSTR mode );
261CRTDLL_FILE* __cdecl CRTDLL_fopen( LPCSTR path, LPCSTR mode );
262CRTDLL_FILE* __cdecl CRTDLL_freopen( LPCSTR path,LPCSTR mode,CRTDLL_FILE* f );
263INT __cdecl CRTDLL__fgetchar( VOID );
264DWORD __cdecl CRTDLL_fread( LPVOID ptr,INT size,INT nmemb,CRTDLL_FILE* file );
265INT __cdecl CRTDLL_fscanf( CRTDLL_FILE* stream, LPSTR format, ... );
266INT __cdecl CRTDLL__filbuf( CRTDLL_FILE* file );
267INT __cdecl CRTDLL__fileno( CRTDLL_FILE* file );
268INT __cdecl CRTDLL__flsbuf( INT c, CRTDLL_FILE* file );
269INT __cdecl CRTDLL__fputchar( INT c );
270INT __cdecl CRTDLL__flushall( VOID );
271INT __cdecl CRTDLL__fcloseall( VOID );
272LONG __cdecl CRTDLL__lseek( INT fd, LONG offset, INT whence );
273LONG __cdecl CRTDLL_fseek( CRTDLL_FILE* file, LONG offset, INT whence );
274VOID __cdecl CRTDLL_rewind( CRTDLL_FILE* file );
275INT __cdecl CRTDLL_fsetpos( CRTDLL_FILE* file, __CRTDLL_fpos_t *pos );
276LONG __cdecl CRTDLL_ftell( CRTDLL_FILE* file );
277UINT __cdecl CRTDLL_fwrite( LPCVOID ptr,INT size,INT nmemb,CRTDLL_FILE*file);
278INT __cdecl CRTDLL_setbuf( CRTDLL_FILE* file, LPSTR buf );
279INT __cdecl CRTDLL__open_osfhandle( HANDLE osfhandle, INT flags );
280INT __cdecl CRTDLL_vfprintf( CRTDLL_FILE* file, LPCSTR format,va_list args);
281INT __cdecl CRTDLL_fprintf( CRTDLL_FILE* file, LPCSTR format, ... );
282INT __cdecl CRTDLL__read( INT fd, LPVOID buf, UINT count );
283UINT __cdecl CRTDLL__write( INT fd,LPCVOID buf,UINT count );
284INT __cdecl CRTDLL__access( LPCSTR filename, INT mode );
285INT __cdecl CRTDLL_fflush( CRTDLL_FILE* file );
286INT __cdecl CRTDLL_fputc( INT c, CRTDLL_FILE* file );
287VOID __cdecl CRTDLL_putchar( INT x );
288INT __cdecl CRTDLL_fputs( LPCSTR s, CRTDLL_FILE* file );
289INT __cdecl CRTDLL_puts( LPCSTR s );
290INT __cdecl CRTDLL_putc( INT c, CRTDLL_FILE* file );
291INT __cdecl CRTDLL_fgetc( CRTDLL_FILE* file );
292INT __cdecl CRTDLL_getchar( VOID );
293INT __cdecl CRTDLL_getc( CRTDLL_FILE* file );
294CHAR* __cdecl CRTDLL_fgets( LPSTR s, INT size, CRTDLL_FILE* file );
295LPSTR __cdecl CRTDLL_gets( LPSTR buf );
296INT __cdecl CRTDLL_fclose( CRTDLL_FILE* file );
297INT __cdecl CTRDLL__creat( LPCSTR path, INT flags );
298INT __cdecl CRTDLL__eof( INT fd );
299LONG __cdecl CRTDLL__tell(INT fd);
300INT __cdecl CRTDLL__umask(INT umask);
301INT __cdecl CRTDLL__unlink( LPCSTR pathname );
302INT __cdecl CRTDLL_rename( LPCSTR oldpath,LPCSTR newpath );
303int __cdecl CRTDLL__stat( LPCSTR filename, struct _stat * buf );
304INT __cdecl CRTDLL__open( LPCSTR path,INT flags );
305INT __cdecl CRTDLL__close( INT fd );
306INT __cdecl CRTDLL_feof( CRTDLL_FILE* file );
307INT __cdecl CRTDLL__setmode( INT fh,INT mode );
308INT __cdecl CRTDLL_remove( LPCSTR path );
309INT __cdecl CRTDLL__commit( INT fd );
310INT __cdecl CRTDLL__fstat( int file, struct _stat* buf );
311HANDLE __cdecl CRTDLL__get_osfhandle( INT fd );
312
313/* CRTDLL_main.c */
314DWORD __cdecl CRTDLL__initterm( _INITTERMFUN *start,_INITTERMFUN *end );
315VOID __cdecl CRTDLL__global_unwind2( PEXCEPTION_FRAME frame );
316VOID __cdecl CRTDLL__local_unwind2( PEXCEPTION_FRAME endframe, DWORD nr );
317INT __cdecl CRTDLL__setjmp( LPDWORD *jmpbuf );
318VOID __cdecl CRTDLL_srand( DWORD seed );
319INT __cdecl CRTDLL__isatty(INT fd);
320VOID __cdecl CRTDLL__beep( UINT freq, UINT duration );
321INT __cdecl CRTDLL_rand( VOID );
322UINT __cdecl CRTDLL__rotl( UINT x,INT shift );
323DWORD __cdecl CRTDLL__lrotl( DWORD x,INT shift );
324DWORD __cdecl CRTDLL__lrotr( DWORD x,INT shift );
325DWORD __cdecl CRTDLL__rotr( UINT x,INT shift );
326INT __cdecl CRTDLL__mbsicmp( unsigned char *x,unsigned char *y );
327INT __cdecl CRTDLL_vswprintf( LPWSTR buffer, LPCWSTR spec, va_list args );
328VOID __cdecl CRTDLL_longjmp( jmp_buf env, int val );
329LPSTR __cdecl CRTDLL_setlocale( INT category,LPCSTR locale );
330BOOL __cdecl CRTDLL__isctype( CHAR x,CHAR type );
331LPSTR __cdecl CRTDLL__fullpath( LPSTR buf, LPCSTR name, INT size );
332VOID __cdecl CRTDLL__splitpath( LPCSTR path, LPSTR drive, LPSTR directory,
333 LPSTR filename, LPSTR extension );
334LPINT __cdecl CRTDLL__errno( VOID );
335LPINT __cdecl CRTDLL___doserrno( VOID );
336LPCSTR**__cdecl CRTDLL__sys_errlist( VOID );
337VOID __cdecl CRTDLL_perror( LPCSTR err );
338LPSTR __cdecl CRTDLL__strerror( LPCSTR err );
339LPSTR __cdecl CRTDLL_strerror( INT err );
340LPSTR __cdecl CRTDLL__tempnam( LPCSTR dir, LPCSTR prefix );
341LPSTR __cdecl CRTDLL_tmpnam( LPSTR s );
342LPVOID __cdecl CRTDLL_signal( INT sig, sig_handler_type ptr );
343VOID __cdecl CRTDLL__sleep( ULONG timeout );
344LPSTR __cdecl CRTDLL_getenv( LPCSTR name );
345LPSTR __cdecl CRTDLL__mbsrchr( LPSTR s,CHAR x );
346VOID __cdecl CRTDLL___dllonexit ( VOID );
347VOID __cdecl CRTDLL__mbccpy( LPSTR dest, LPSTR src );
348INT __cdecl CRTDLL___isascii( INT c );
349INT __cdecl CRTDLL___toascii( INT c );
350INT __cdecl CRTDLL_iswascii( LONG c );
351INT __cdecl CRTDLL___iscsym( LONG c );
352INT __cdecl CRTDLL___iscsymf( LONG c );
353INT __cdecl CRTDLL__loaddll( LPSTR dllname );
354INT __cdecl CRTDLL__unloaddll( HANDLE dll );
355WCHAR* __cdecl CRTDLL__itow( INT value,WCHAR* out,INT base );
356WCHAR* __cdecl CRTDLL__ltow( LONG value,WCHAR* out,INT base );
357WCHAR* __cdecl CRTDLL__ultow(ULONG value,WCHAR* out,INT base);
358CHAR __cdecl CRTDLL__toupper( CHAR c );
359CHAR __cdecl CRTDLL__tolower( CHAR c );
360double __cdecl CRTDLL__cabs( struct __CRTDLL_complex c );
361double __cdecl CRTDLL__chgsign( double d );
362UINT __cdecl CRTDLL__control87( UINT, UINT );
363UINT __cdecl CRTDLL__controlfp( UINT, UINT );
364double __cdecl CRTDLL__copysign(double x, double sign);
365INT __cdecl CRTDLL__finite( double d );
366VOID __cdecl CRTDLL__fpreset( void );
367INT __cdecl CRTDLL__isnan( double d );
368LPVOID __cdecl CRTDLL__lsearch( LPVOID match, LPVOID start, LPUINT array_size,
369 UINT elem_size, comp_func cf );
370
371/* CRTDLL_mem.c */
372LPVOID __cdecl CRTDLL_new( DWORD size );
373VOID __cdecl CRTDLL_delete( LPVOID ptr );
374new_handler_type __cdecl CRTDLL_set_new_handler( new_handler_type func );
375INT __cdecl CRTDLL__heapchk( VOID );
376INT __cdecl CRTDLL__heapmin( VOID );
377INT __cdecl CRTDLL__heapset( UINT value );
378INT __cdecl CRTDLL__heapwalk( struct _heapinfo *next );
379LPVOID __cdecl CRTDLL__expand( LPVOID ptr, INT size );
380LONG __cdecl CRTDLL__msize( LPVOID mem );
381LPVOID __cdecl CRTDLL_calloc( DWORD size, DWORD count );
382VOID __cdecl CRTDLL_free( LPVOID ptr );
383LPVOID __cdecl CRTDLL_malloc( DWORD size );
384LPVOID __cdecl CRTDLL_realloc( VOID *ptr, DWORD size );
385
386/* CRTDLL_spawn.c */
387HANDLE __cdecl CRTDLL__spawnve( INT flags, LPSTR name, LPSTR *argv, LPSTR *envv);
388INT __cdecl CRTDLL_system( LPSTR x );
389
390/* CRTDLL_str.c */
391LPSTR __cdecl CRTDLL__strdec( LPSTR str1, LPSTR str2 );
392LPSTR __cdecl CRTDLL__strdup( LPCSTR ptr );
393LPSTR __cdecl CRTDLL__strinc( LPSTR str );
394UINT __cdecl CRTDLL__strnextc( LPCSTR str );
395LPSTR __cdecl CRTDLL__strninc( LPSTR str, INT n );
396LPSTR __cdecl CRTDLL__strnset( LPSTR str, INT c, INT len );
397LPSTR __cdecl CRTDLL__strrev ( LPSTR str );
398LPSTR __cdecl CRTDLL__strset ( LPSTR str, INT set );
399LONG __cdecl CRTDLL__strncnt( LPSTR str, LONG max );
400LPSTR __cdecl CRTDLL__strspnp( LPSTR str1, LPSTR str2 );
401VOID __cdecl CRTDLL__swab( LPSTR src, LPSTR dst, INT len );
402
403/* CRTDLL_time.c */
404LPSTR __cdecl CRTDLL__strdate ( LPSTR date );
405LPSTR __cdecl CRTDLL__strtime ( LPSTR date );
406clock_t __cdecl CRTDLL_clock ( void );
407double __cdecl CRTDLL_difftime ( time_t time1, time_t time2 );
408time_t __cdecl CRTDLL_time ( time_t *timeptr );
409
410/* mbstring.c */
411LPSTR __cdecl CRTDLL__mbsinc( LPCSTR str );
412INT __cdecl CRTDLL__mbslen( LPCSTR str );
413INT __cdecl CRTDLL_mbtowc( WCHAR *dst, LPCSTR str, INT n );
414LPWSTR __cdecl CRTDLL__wcsdup( LPCWSTR str );
415INT __cdecl CRTDLL__wcsicoll( LPCWSTR str1, LPCWSTR str2 );
416LPWSTR __cdecl CRTDLL__wcsnset( LPWSTR str, WCHAR c, INT n );
417LPWSTR __cdecl CRTDLL__wcsrev( LPWSTR str );
418LPWSTR __cdecl CRTDLL__wcsset( LPWSTR str, WCHAR c );
419DWORD __cdecl CRTDLL_wcscoll( LPCWSTR str1, LPCWSTR str2 );
420LPWSTR __cdecl CRTDLL_wcspbrk( LPCWSTR str, LPCWSTR accept );
421INT __cdecl CRTDLL_wctomb( LPSTR dst, WCHAR ch );
422
423/* wcstring.c */
424INT __cdecl CRTDLL_iswalnum( WCHAR wc );
425INT __cdecl CRTDLL_iswalpha( WCHAR wc );
426INT __cdecl CRTDLL_iswcntrl( WCHAR wc );
427INT __cdecl CRTDLL_iswdigit( WCHAR wc );
428INT __cdecl CRTDLL_iswgraph( WCHAR wc );
429INT __cdecl CRTDLL_iswlower( WCHAR wc );
430INT __cdecl CRTDLL_iswprint( WCHAR wc );
431INT __cdecl CRTDLL_iswpunct( WCHAR wc );
432INT __cdecl CRTDLL_iswspace( WCHAR wc );
433INT __cdecl CRTDLL_iswupper( WCHAR wc );
434INT __cdecl CRTDLL_iswxdigit( WCHAR wc );
435
436/* INTERNAL: Shared internal functions */
437void __CRTDLL__set_errno(ULONG err);
438LPSTR __CRTDLL__strndup(LPSTR buf, INT size);
439VOID __CRTDLL__init_io(VOID);
440
441#endif /* __WINE_CRTDLL_H */
Note: See TracBrowser for help on using the repository browser.