author | Wuzzy <almikes@aol.com> |
Thu, 04 May 2017 16:49:34 +0200 | |
changeset 12407 | 8cc070640fd1 |
parent 11682 | 2c21bc80c95d |
child 14934 | 68e1783762bc |
permissions | -rw-r--r-- |
7983 | 1 |
#ifndef FILEIO_H_ |
2 |
#define FILEIO_H_ |
|
3 |
||
4 |
#include <stdio.h> |
|
8047
25a4daa6473c
cleanup headers, remove -I . from rtl lib to save a few warnings
koda
parents:
7983
diff
changeset
|
5 |
#include "Types.h" |
7983 | 6 |
#include "misc.h" |
7 |
||
8 |
extern int FileMode; |
|
9 |
||
10 |
typedef enum{ |
|
11 |
IO_NO_ERROR = 0, |
|
12 |
IO_ERROR_DUMMY = 1 |
|
13 |
}io_result_t; |
|
14 |
||
15 |
extern io_result_t IOResult; |
|
16 |
||
17 |
typedef struct{ |
|
18 |
FILE *fp; |
|
19 |
const char* mode; |
|
20 |
char file_name[256]; |
|
21 |
int eof; |
|
22 |
int record_len; |
|
23 |
}file_wrapper_t; |
|
24 |
||
25 |
typedef file_wrapper_t* File; |
|
26 |
typedef File Text; |
|
27 |
typedef Text TextFile; |
|
28 |
||
29 |
void __attribute__((overloadable)) fpcrtl_readLn(File f); |
|
30 |
#define fpcrtl_readLn1(f) fpcrtl_readLn(f) |
|
31 |
||
32 |
void __attribute__((overloadable)) fpcrtl_readLn__vars(File f, Integer *i); |
|
33 |
void __attribute__((overloadable)) fpcrtl_readLn__vars(File f, LongWord *i); |
|
34 |
void __attribute__((overloadable)) fpcrtl_readLn__vars(File f, string255 *s); |
|
35 |
#define fpcrtl_readLn2(f, t) fpcrtl_readLn__vars(f, &(t)) |
|
36 |
||
37 |
#define fpcrtl_readLn(...) macro_dispatcher(fpcrtl_readLn, __VA_ARGS__)(__VA_ARGS__) |
|
38 |
||
39 |
||
40 |
void fpcrtl_blockRead__vars(File f, void *buf, Integer count, Integer *result); |
|
41 |
#define fpcrtl_blockRead(f, buf, count, result) fpcrtl_blockRead__vars(f, &(buf), count, &(result)) |
|
42 |
#define fpcrtl_BlockRead fpcrtl_blockRead |
|
43 |
||
44 |
#define fpcrtl_assign(f, name) fpcrtl_assign__vars(&f, name) |
|
45 |
void fpcrtl_assign__vars(File *f, string255 name); |
|
46 |
||
47 |
boolean fpcrtl_eof(File f); |
|
48 |
||
49 |
void fpcrtl_reset1(File f); |
|
50 |
void fpcrtl_reset2(File f, Integer l); |
|
51 |
#define fpcrtl_reset1(f) fpcrtl_reset1(f) |
|
52 |
#define fpcrtl_reset2(f, l) fpcrtl_reset2(f, l) |
|
53 |
#define fpcrtl_reset(...) macro_dispatcher(fpcrtl_reset, __VA_ARGS__)(__VA_ARGS__) |
|
54 |
||
55 |
void fpcrtl_close(File f); |
|
56 |
||
57 |
void __attribute__((overloadable)) fpcrtl_rewrite(File f); |
|
58 |
void __attribute__((overloadable)) fpcrtl_rewrite(File f, Integer l); |
|
59 |
||
60 |
void __attribute__((overloadable)) fpcrtl_flush(Text f); |
|
61 |
void __attribute__((overloadable)) fpcrtl_flush(FILE *f); |
|
62 |
||
63 |
void __attribute__((overloadable)) fpcrtl_write(File f, string255 s); |
|
64 |
void __attribute__((overloadable)) fpcrtl_write(FILE *f, string255 s); |
|
65 |
void __attribute__((overloadable)) fpcrtl_writeLn(File f, string255 s); |
|
66 |
void __attribute__((overloadable)) fpcrtl_writeLn(FILE *f, string255 s); |
|
67 |
||
68 |
void fpcrtl_blockWrite__vars(File f, const void *buf, Integer count, Integer *result); |
|
69 |
#define fpcrtl_blockWrite(f, buf, count, result) fpcrtl_blockWrite__vars(f, &(buf), count, &(result)) |
|
70 |
#define fpcrtl_BlockWrite fpcrtl_blockWrite |
|
71 |
||
72 |
bool fpcrtl_directoryExists(string255 dir); |
|
73 |
#define fpcrtl_DirectoryExists fpcrtl_directoryExists |
|
74 |
||
75 |
bool fpcrtl_fileExists(string255 filename); |
|
76 |
#define fpcrtl_FileExists fpcrtl_fileExists |
|
77 |
||
11682 | 78 |
char * fpcrtl_getCurrentDir(void); |
79 |
#define fpcrtl_GetCurrentDir fpcrtl_getCurrentDir |
|
80 |
||
7983 | 81 |
#endif /* FILEIO_H_ */ |