File: fileio.h

package info (click to toggle)
hedgewars 1.0.3-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 219,040 kB
  • sloc: pascal: 54,830; cpp: 27,224; ansic: 22,809; java: 8,210; haskell: 6,797; xml: 3,076; sh: 580; objc: 113; python: 105; makefile: 32
file content (87 lines) | stat: -rw-r--r-- 3,741 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#ifndef FILEIO_H_
#define FILEIO_H_

#include <stdio.h>
#include "Types.h"
#include "misc.h"

extern        int                                       FileMode;

typedef enum{
    IO_NO_ERROR = 0,
    IO_ERROR_DUMMY = 1
}io_result_t;

extern        io_result_t                               IOResult;

typedef struct{
    FILE        *fp;
    const char* mode;
    char        file_name[256];
    int         eof;
    int            record_len;
}file_wrapper_t;

typedef     file_wrapper_t*                             File;
typedef     File                                        Text;
typedef     Text                                        TextFile;

void        __attribute__((overloadable))               fpcrtl_readLn(File f);
#define     fpcrtl_readLn1(f)                           fpcrtl_readLn(f)

void        __attribute__((overloadable))               fpcrtl_readLn__vars(File f, Integer *i);
void        __attribute__((overloadable))               fpcrtl_readLn__vars(File f, LongWord *i);
void        __attribute__((overloadable))               fpcrtl_readLn__vars(File f, string255 *s);
#define     fpcrtl_readLn2(f, t)                        fpcrtl_readLn__vars(f, &(t))

#define     fpcrtl_readLn(...)                          macro_dispatcher(fpcrtl_readLn, __VA_ARGS__)(__VA_ARGS__)


void        fpcrtl_blockRead__vars(File f, void *buf, Integer count, Integer *result);
#define     fpcrtl_blockRead(f, buf, count, result)     fpcrtl_blockRead__vars(f, &(buf), count, &(result))
#define     fpcrtl_BlockRead                            fpcrtl_blockRead

#define     fpcrtl_assign(f, name)                      fpcrtl_assign__vars(&f, name)
void        fpcrtl_assign__vars(File *f, string255 name);

boolean     fpcrtl_eof(File f);

void        fpcrtl_reset1(File f);
void        fpcrtl_reset2(File f, Integer l);
#define     fpcrtl_reset1(f)                            fpcrtl_reset1(f)
#define     fpcrtl_reset2(f, l)                         fpcrtl_reset2(f, l)
#define     fpcrtl_reset(...)                           macro_dispatcher(fpcrtl_reset, __VA_ARGS__)(__VA_ARGS__)

void        fpcrtl_close(File f);

void        __attribute__((overloadable))               fpcrtl_rewrite(File f);
void        __attribute__((overloadable))               fpcrtl_rewrite(File f, Integer l);

void        __attribute__((overloadable))               fpcrtl_flush(Text f);
void        __attribute__((overloadable))               fpcrtl_flush(FILE *f);

void        __attribute__((overloadable))               fpcrtl_write(File f, string255 s);
void        __attribute__((overloadable))               fpcrtl_write(FILE *f, string255 s);
void        __attribute__((overloadable))               fpcrtl_writeLn(File f, string255 s);
void        __attribute__((overloadable))               fpcrtl_writeLn(FILE *f, string255 s);

void        fpcrtl_blockWrite__vars(File f, const void *buf, Integer count, Integer *result);
#define     fpcrtl_blockWrite(f, buf, count, result)    fpcrtl_blockWrite__vars(f, &(buf), count, &(result))
#define     fpcrtl_BlockWrite                           fpcrtl_blockWrite

bool        fpcrtl_directoryExists(string255 dir);
#define     fpcrtl_DirectoryExists                      fpcrtl_directoryExists

bool        fpcrtl_fileExists(string255 filename);
#define     fpcrtl_FileExists                           fpcrtl_fileExists

char *      fpcrtl_getCurrentDir(void);
#define     fpcrtl_GetCurrentDir                        fpcrtl_getCurrentDir

Int64       fpcrtl_fileSize(File f);
#define     fpcrtl_FileSize                             fpcrtl_fileSize

bool        fpcrtl_deleteFile(string255 filename);
#define     fpcrtl_DeleteFile                           fpcrtl_deleteFile

#endif /* FILEIO_H_ */