:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[reactos.git] / include / crtdll / internal / file.h
1 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
2
3 #ifndef __dj_include_libc_file_h__
4 #define __dj_include_libc_file_h__
5
6 #include <crtdll/stdio.h>
7 #include <crtdll/fcntl.h>
8
9
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13
14 #ifndef __dj_ENFORCE_ANSI_FREESTANDING
15
16 #ifndef __STRICT_ANSI__
17
18 #ifndef _POSIX_SOURCE
19
20 #ifndef _IORMONCL
21 #define _IORMONCL 004000  /* remove on close, for temp files */
22 #endif
23 /* if _flag & _IORMONCL, ._name_to_remove needs freeing */
24
25 #ifndef _IOUNGETC
26 #define _IOUNGETC 010000  /* there is an ungetc'ed character in the buffer */
27 #endif
28
29
30 // might need check for IO_APPEND aswell
31 #define OPEN4WRITING(f) ((((f)->_flag & _IOWRT) == _IOWRT ) )
32
33 #define OPEN4READING(f) ((((f)->_flag & _IOREAD) == _IOREAD ) )
34
35 // might need check for IO_APPEND aswell
36 #define WRITE_STREAM(f) ((((f)->_flag & _IOWRT) == _IOWRT ) )
37
38 #define READ_STREAM(f) ((((f)->_flag & _IOREAD) == _IOREAD ) )
39
40
41 char __validfp (FILE *f);
42
43 int __set_errno(int err);
44 void *filehnd(int fn);
45
46 char __is_text_file(FILE *p);
47
48 int __fileno_alloc(void *hFile, int mode);
49
50 int _doprnt(const char *fmt, va_list args, FILE *f);
51 int _doscan(FILE *iop, const char *fmt, va_list argp);
52
53
54 int __fileno_dup2( int handle1, int handle2 );
55 int __fileno_setmode(int _fd, int _newmode);
56 int __fileno_close(int _fd);
57
58 void sigabort_handler(int sig);
59
60 #include <windows.h>
61
62 void UnixTimeToFileTime( time_t unix_time, FILETIME *filetime, DWORD remainder );
63 time_t FileTimeToUnixTime( const FILETIME *filetime, DWORD *remainder );
64
65
66 #endif /* !_POSIX_SOURCE */
67 #endif /* !__STRICT_ANSI__ */
68 #endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
69
70 #ifndef __dj_ENFORCE_FUNCTION_CALLS
71 #endif /* !__dj_ENFORCE_FUNCTION_CALLS */
72
73
74 #define __FILE_REC_MAX 20
75 typedef struct __file_rec 
76 {
77    struct __file_rec *next;
78    int count;
79    FILE *files[__FILE_REC_MAX];
80 } __file_rec;
81
82 extern __file_rec *__file_rec_list;
83
84
85 #ifdef __cplusplus
86 }
87 #endif
88
89
90 #endif /* __dj_include_libc_file_h__ */
91
92
93