- Complete the implementation of heap functions
[wine/multimedia.git] / dlls / crtdll / crtdll.h
blob8f4caa690cb671812949d2ed75538a5252e03b07
1 #ifndef __WINE_CRTDLL_H
2 #define __WINE_CRTDLL_H
4 #include "config.h"
5 #include "windef.h"
6 #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>
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
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)
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
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
58 /* _access() bit flags FIXME: incomplete */
59 #define W_OK 2
61 /* windows.h RAND_MAX is smaller than normal RAND_MAX */
62 #define CRTDLL_RAND_MAX 0x7fff
64 /* heap function constants */
65 #define _HEAPEMPTY -1
66 #define _HEAPOK -2
67 #define _HEAPBADBEGIN -3
68 #define _HEAPBADNODE -4
69 #define _HEAPEND -5
70 #define _HEAPBADPTR -6
71 #define _FREEENTRY 0
72 #define _USEDENTRY 1
74 /* CRTDLL Globals */
75 extern INT CRTDLL_doserrno;
76 extern INT CRTDLL_errno;
79 /* Binary compatable structures, types and defines used
80 * by CRTDLL. These should move to external header files,
81 * and in some cases need be renamed (CRTDLL_FILE!) to defs
82 * as used by lcc/bcc/watcom/vc++ etc, in order to get source
83 * compatability for winelib.
86 typedef struct _crtfile
88 CHAR* _ptr;
89 INT _cnt;
90 CHAR* _base;
91 INT _flag;
92 INT _file; /* fd */
93 int _charbuf;
94 int _bufsiz;
95 char *_tmpfname;
96 } CRTDLL_FILE;
98 /* file._flag flags */
99 #define _IOREAD 0x0001
100 #define _IOWRT 0x0002
101 #define _IOEOF 0x0010
102 #define _IOERR 0x0020
103 #define _IORW 0x0080
104 #define _IOAPPEND 0x0200
106 #define SEEK_SET 0
107 #define SEEK_CUR 1
108 #define SEEK_END 2
110 #define EOF -1
112 extern CRTDLL_FILE __CRTDLL_iob[3];
114 #define CRTDLL_stdin (&__CRTDLL_iob[0])
115 #define CRTDLL_stdout (&__CRTDLL_iob[1])
116 #define CRTDLL_stderr (&__CRTDLL_iob[2])
118 typedef struct _find_t
120 unsigned attrib;
121 time_t time_create; /* -1 when N/A */
122 time_t time_access; /* -1 when N/A */
123 time_t time_write;
124 unsigned long size; /* FIXME: 64 bit ??*/
125 char name[MAX_PATH];
126 } find_t;
128 typedef struct _diskfree_t {
129 unsigned num_clusters;
130 unsigned available;
131 unsigned cluster_sectors;
132 unsigned sector_bytes;
133 } diskfree_t;
135 struct _stat
137 UINT16 st_dev;
138 UINT16 st_ino;
139 UINT16 st_mode;
140 INT16 st_nlink;
141 INT16 st_uid;
142 INT16 st_gid;
143 UINT st_rdev;
144 INT st_size;
145 INT st_atime;
146 INT st_mtime;
147 INT st_ctime;
150 struct _timeb
152 time_t time;
153 UINT16 millitm;
154 INT16 timezone;
155 INT16 dstflag;
158 typedef long fpos_t;
160 struct complex
162 double real;
163 double imaginary;
166 typedef struct _heapinfo
168 int * _pentry;
169 size_t _size;
170 int _useflag;
171 } _HEAPINFO;
173 typedef VOID (*sig_handler_type)(VOID);
175 typedef VOID (*new_handler_type)(VOID);
177 typedef VOID (*_INITTERMFUN)();
179 typedef VOID (*atexit_function)(VOID);
181 typedef INT (__cdecl *comp_func)(LPVOID *,LPVOID *);
183 /* CRTDLL functions */
185 /* CRTDLL_dir.c */
186 INT __cdecl CRTDLL__chdir( LPCSTR newdir );
187 BOOL __cdecl CRTDLL__chdrive( INT newdrive );
188 INT __cdecl CRTDLL__findclose( DWORD hand );
189 DWORD __cdecl CRTDLL__findfirst( LPCSTR fspec, find_t* ft );
190 INT __cdecl CRTDLL__findnext( DWORD hand, find_t * ft );
191 CHAR* __cdecl CRTDLL__getcwd( LPSTR buf, INT size );
192 CHAR* __cdecl CRTDLL__getdcwd( INT drive,LPSTR buf, INT size );
193 UINT __cdecl CRTDLL__getdiskfree( UINT disk, diskfree_t* d );
194 INT __cdecl CRTDLL__getdrive( VOID );
195 INT __cdecl CRTDLL__mkdir( LPCSTR newdir );
196 INT __cdecl CRTDLL__rmdir( LPSTR dir );
198 /* CRTDLL_exit.c */
199 INT __cdecl CRTDLL__abnormal_termination( VOID );
200 VOID __cdecl CRTDLL__amsg_exit( INT err );
201 VOID __cdecl CRTDLL__assert( LPVOID str, LPVOID file, UINT line );
202 VOID __cdecl CRTDLL__c_exit( VOID );
203 VOID __cdecl CRTDLL__cexit( VOID );
204 void __cdecl CRTDLL_exit( DWORD ret );
205 VOID __cdecl CRTDLL__exit( LONG ret );
206 VOID __cdecl CRTDLL_abort( VOID );
207 INT __cdecl CRTDLL_atexit( atexit_function x );
208 atexit_function __cdecl CRTDLL__onexit( atexit_function func);
210 /* CRTDLL_file.c */
211 CRTDLL_FILE* __cdecl CRTDLL__iob( VOID );
212 CRTDLL_FILE* __cdecl CRTDLL__fsopen( LPCSTR path, LPCSTR mode, INT share );
213 CRTDLL_FILE* __cdecl CRTDLL__fdopen( INT fd, LPCSTR mode );
214 CRTDLL_FILE* __cdecl CRTDLL_fopen( LPCSTR path, LPCSTR mode );
215 CRTDLL_FILE* __cdecl CRTDLL_freopen( LPCSTR path,LPCSTR mode,CRTDLL_FILE* f );
216 INT __cdecl CRTDLL__fgetchar( VOID );
217 DWORD __cdecl CRTDLL_fread( LPVOID ptr,INT size,INT nmemb,CRTDLL_FILE* file );
218 INT __cdecl CRTDLL_fscanf( CRTDLL_FILE* stream, LPSTR format, ... );
219 INT __cdecl CRTDLL__filbuf( CRTDLL_FILE* file );
220 INT __cdecl CRTDLL__fileno( CRTDLL_FILE* file );
221 INT __cdecl CRTDLL__flsbuf( INT c, CRTDLL_FILE* file );
222 INT __cdecl CRTDLL__fputchar( INT c );
223 INT __cdecl CRTDLL__flushall( VOID );
224 INT __cdecl CRTDLL__fcloseall( VOID );
225 LONG __cdecl CRTDLL__lseek( INT fd, LONG offset, INT whence );
226 LONG __cdecl CRTDLL_fseek( CRTDLL_FILE* file, LONG offset, INT whence );
227 VOID __cdecl CRTDLL_rewind( CRTDLL_FILE* file );
228 INT __cdecl CRTDLL_fsetpos( CRTDLL_FILE* file, fpos_t *pos );
229 LONG __cdecl CRTDLL_ftell( CRTDLL_FILE* file );
230 UINT __cdecl CRTDLL_fwrite( LPCVOID ptr,INT size,INT nmemb,CRTDLL_FILE*file);
231 INT __cdecl CRTDLL_setbuf( CRTDLL_FILE* file, LPSTR buf );
232 INT __cdecl CRTDLL__open_osfhandle( HANDLE osfhandle, INT flags );
233 INT __cdecl CRTDLL_vfprintf( CRTDLL_FILE* file, LPCSTR format,va_list args);
234 INT __cdecl CRTDLL_fprintf( CRTDLL_FILE* file, LPCSTR format, ... );
235 INT __cdecl CRTDLL__read( INT fd, LPVOID buf, UINT count );
236 UINT __cdecl CRTDLL__write( INT fd,LPCVOID buf,UINT count );
237 INT __cdecl CRTDLL__access( LPCSTR filename, INT mode );
238 INT __cdecl CRTDLL_fflush( CRTDLL_FILE* file );
239 INT __cdecl CRTDLL_fputc( INT c, CRTDLL_FILE* file );
240 VOID __cdecl CRTDLL_putchar( INT x );
241 INT __cdecl CRTDLL_fputs( LPCSTR s, CRTDLL_FILE* file );
242 INT __cdecl CRTDLL_puts( LPCSTR s );
243 INT __cdecl CRTDLL_putc( INT c, CRTDLL_FILE* file );
244 INT __cdecl CRTDLL_fgetc( CRTDLL_FILE* file );
245 INT __cdecl CRTDLL_getchar( VOID );
246 INT __cdecl CRTDLL_getc( CRTDLL_FILE* file );
247 CHAR* __cdecl CRTDLL_fgets( LPSTR s, INT size, CRTDLL_FILE* file );
248 LPSTR __cdecl CRTDLL_gets( LPSTR buf );
249 INT __cdecl CRTDLL_fclose( CRTDLL_FILE* file );
250 INT __cdecl CTRDLL__creat( LPCSTR path, INT flags );
251 INT __cdecl CRTDLL__eof( INT fd );
252 LONG __cdecl CRTDLL__tell(INT fd);
253 INT __cdecl CRTDLL__umask(INT umask);
254 INT __cdecl CRTDLL__unlink( LPCSTR pathname );
255 INT __cdecl CRTDLL_rename( LPCSTR oldpath,LPCSTR newpath );
256 int __cdecl CRTDLL__stat( LPCSTR filename, struct _stat * buf );
257 INT __cdecl CRTDLL__open( LPCSTR path,INT flags );
258 INT __cdecl CRTDLL__close( INT fd );
259 INT __cdecl CRTDLL_feof( CRTDLL_FILE* file );
260 INT __cdecl CRTDLL__setmode( INT fh,INT mode );
261 INT __cdecl CRTDLL_remove( LPCSTR path );
262 INT __cdecl CRTDLL__commit( INT fd );
263 INT __cdecl CRTDLL__fstat( int file, struct _stat* buf );
264 HANDLE __cdecl CRTDLL__get_osfhandle( INT fd );
266 /* CRTDLL_main.c */
267 DWORD __cdecl CRTDLL__initterm( _INITTERMFUN *start,_INITTERMFUN *end );
268 VOID __cdecl CRTDLL__global_unwind2( PEXCEPTION_FRAME frame );
269 VOID __cdecl CRTDLL__local_unwind2( PEXCEPTION_FRAME endframe, DWORD nr );
270 INT __cdecl CRTDLL__setjmp( LPDWORD *jmpbuf );
271 VOID __cdecl CRTDLL_srand( DWORD seed );
272 INT __cdecl CRTDLL__isatty(INT fd);
273 VOID __cdecl CRTDLL__beep( UINT freq, UINT duration );
274 INT __cdecl CRTDLL_rand( VOID );
275 UINT __cdecl CRTDLL__rotl( UINT x,INT shift );
276 DWORD __cdecl CRTDLL__lrotl( DWORD x,INT shift );
277 DWORD __cdecl CRTDLL__lrotr( DWORD x,INT shift );
278 DWORD __cdecl CRTDLL__rotr( UINT x,INT shift );
279 INT __cdecl CRTDLL__mbsicmp( unsigned char *x,unsigned char *y );
280 INT __cdecl CRTDLL_vswprintf( LPWSTR buffer, LPCWSTR spec, va_list args );
281 VOID __cdecl CRTDLL_longjmp( jmp_buf env, int val );
282 LPSTR __cdecl CRTDLL_setlocale( INT category,LPCSTR locale );
283 BOOL __cdecl CRTDLL__isctype( CHAR x,CHAR type );
284 LPSTR __cdecl CRTDLL__fullpath( LPSTR buf, LPCSTR name, INT size );
285 VOID __cdecl CRTDLL__splitpath( LPCSTR path, LPSTR drive, LPSTR directory,
286 LPSTR filename, LPSTR extension );
287 LPINT __cdecl CRTDLL__errno( VOID );
288 LPINT __cdecl CRTDLL___doserrno( VOID );
289 LPCSTR**__cdecl CRTDLL__sys_errlist( VOID );
290 VOID __cdecl CRTDLL_perror( LPCSTR err );
291 LPSTR __cdecl CRTDLL__strerror( LPCSTR err );
292 LPSTR __cdecl CRTDLL_strerror( INT err );
293 LPSTR __cdecl CRTDLL__tempnam( LPCSTR dir, LPCSTR prefix );
294 LPSTR __cdecl CRTDLL_tmpnam( LPSTR s );
295 LPVOID __cdecl CRTDLL_signal( INT sig, sig_handler_type ptr );
296 VOID __cdecl CRTDLL__sleep( ULONG timeout );
297 LPSTR __cdecl CRTDLL_getenv( LPCSTR name );
298 LPSTR __cdecl CRTDLL__mbsrchr( LPSTR s,CHAR x );
299 VOID __cdecl CRTDLL___dllonexit ( VOID );
300 VOID __cdecl CRTDLL__mbccpy( LPSTR dest, LPSTR src );
301 INT __cdecl CRTDLL___isascii( INT c );
302 INT __cdecl CRTDLL___toascii( INT c );
303 INT __cdecl CRTDLL_iswascii( LONG c );
304 INT __cdecl CRTDLL___iscsym( LONG c );
305 INT __cdecl CRTDLL___iscsymf( LONG c );
306 INT __cdecl CRTDLL__loaddll( LPSTR dllname );
307 INT __cdecl CRTDLL__unloaddll( HANDLE dll );
308 WCHAR* __cdecl CRTDLL__itow( INT value,WCHAR* out,INT base );
309 WCHAR* __cdecl CRTDLL__ltow( LONG value,WCHAR* out,INT base );
310 WCHAR* __cdecl CRTDLL__ultow(ULONG value,WCHAR* out,INT base);
311 CHAR __cdecl CRTDLL__toupper( CHAR c );
312 CHAR __cdecl CRTDLL__tolower( CHAR c );
313 double __cdecl CRTDLL__cabs( struct complex c );
314 double __cdecl CRTDLL__chgsign( double d );
315 UINT __cdecl CRTDLL__control87( UINT, UINT );
316 UINT __cdecl CRTDLL__controlfp( UINT, UINT );
317 double __cdecl CRTDLL__copysign(double x, double sign);
318 INT __cdecl CRTDLL__finite( double d );
319 VOID __cdecl CRTDLL__fpreset( void );
320 INT __cdecl CRTDLL__isnan( double d );
321 LPVOID __cdecl CRTDLL__lsearch( LPVOID match, LPVOID start, LPUINT array_size,
322 UINT elem_size, comp_func cf );
324 /* CRTDLL_mem.c */
325 LPVOID __cdecl CRTDLL_new( DWORD size );
326 VOID __cdecl CRTDLL_delete( LPVOID ptr );
327 new_handler_type __cdecl CRTDLL_set_new_handler( new_handler_type func );
328 INT __cdecl CRTDLL__heapchk( VOID );
329 INT __cdecl CRTDLL__heapmin( VOID );
330 INT __cdecl CRTDLL__heapset( UINT value );
331 INT __cdecl CRTDLL__heapwalk( struct _heapinfo *next );
332 LPVOID __cdecl CRTDLL__expand( LPVOID ptr, INT size );
333 LONG __cdecl CRTDLL__msize( LPVOID mem );
334 LPVOID __cdecl CRTDLL_calloc( DWORD size, DWORD count );
335 VOID __cdecl CRTDLL_free( LPVOID ptr );
336 LPVOID __cdecl CRTDLL_malloc( DWORD size );
337 LPVOID __cdecl CRTDLL_realloc( VOID *ptr, DWORD size );
339 /* CRTDLL_spawn.c */
340 HANDLE __cdecl CRTDLL__spawnve( INT flags, LPSTR name, LPSTR *argv, LPSTR *envv);
341 INT __cdecl CRTDLL_system( LPSTR x );
343 /* CRTDLL_str.c */
344 LPSTR __cdecl CRTDLL__strdec( LPSTR str1, LPSTR str2 );
345 LPSTR __cdecl CRTDLL__strdup( LPCSTR ptr );
346 LPSTR __cdecl CRTDLL__strinc( LPSTR str );
347 UINT __cdecl CRTDLL__strnextc( LPCSTR str );
348 LPSTR __cdecl CRTDLL__strninc( LPSTR str, INT n );
349 LPSTR __cdecl CRTDLL__strnset( LPSTR str, INT c, INT len );
350 LPSTR __cdecl CRTDLL__strrev ( LPSTR str );
351 LPSTR __cdecl CRTDLL__strset ( LPSTR str, INT set );
352 LONG __cdecl CRTDLL__strncnt( LPSTR str, LONG max );
353 LPSTR __cdecl CRTDLL__strspnp( LPSTR str1, LPSTR str2 );
354 VOID __cdecl CRTDLL__swab( LPSTR src, LPSTR dst, INT len );
356 /* CRTDLL_time.c */
357 LPSTR __cdecl CRTDLL__strdate ( LPSTR date );
358 LPSTR __cdecl CRTDLL__strtime ( LPSTR date );
359 clock_t __cdecl CRTDLL_clock ( void );
360 double __cdecl CRTDLL_difftime ( time_t time1, time_t time2 );
361 time_t __cdecl CRTDLL_time ( time_t *timeptr );
363 /* mbstring.c */
364 LPSTR __cdecl CRTDLL__mbsinc( LPCSTR str );
365 INT __cdecl CRTDLL__mbslen( LPCSTR str );
366 INT __cdecl CRTDLL_mbtowc( WCHAR *dst, LPCSTR str, INT n );
367 LPWSTR __cdecl CRTDLL__wcsdup( LPCWSTR str );
368 INT __cdecl CRTDLL__wcsicoll( LPCWSTR str1, LPCWSTR str2 );
369 LPWSTR __cdecl CRTDLL__wcsnset( LPWSTR str, WCHAR c, INT n );
370 LPWSTR __cdecl CRTDLL__wcsrev( LPWSTR str );
371 LPWSTR __cdecl CRTDLL__wcsset( LPWSTR str, WCHAR c );
372 DWORD __cdecl CRTDLL_wcscoll( LPCWSTR str1, LPCWSTR str2 );
373 LPWSTR __cdecl CRTDLL_wcspbrk( LPCWSTR str, LPCWSTR accept );
374 INT __cdecl CRTDLL_wctomb( LPSTR dst, WCHAR ch );
376 /* wcstring.c */
377 INT __cdecl CRTDLL_iswalnum( WCHAR wc );
378 INT __cdecl CRTDLL_iswalpha( WCHAR wc );
379 INT __cdecl CRTDLL_iswcntrl( WCHAR wc );
380 INT __cdecl CRTDLL_iswdigit( WCHAR wc );
381 INT __cdecl CRTDLL_iswgraph( WCHAR wc );
382 INT __cdecl CRTDLL_iswlower( WCHAR wc );
383 INT __cdecl CRTDLL_iswprint( WCHAR wc );
384 INT __cdecl CRTDLL_iswpunct( WCHAR wc );
385 INT __cdecl CRTDLL_iswspace( WCHAR wc );
386 INT __cdecl CRTDLL_iswupper( WCHAR wc );
387 INT __cdecl CRTDLL_iswxdigit( WCHAR wc );
389 /* INTERNAL: Shared internal functions */
390 void __CRTDLL__set_errno(ULONG err);
391 LPSTR __CRTDLL__strndup(LPSTR buf, INT size);
392 VOID __CRTDLL__init_io(VOID);
394 #endif /* __WINE_CRTDLL_H */