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
88
89
90
91
92
93
94
95
96
97
98
|
#ifdef OF_NINTENDO_DS
# include <stdbool.h>
# include <filesystem.h>
#endif
#ifdef OF_AMIGAOS
# ifdef OF_AMIGAOS4
# define __USE_INLINE__
# define __NOLIBBASE__
# define __NOGLOBALIFACE__
# endif
# include <proto/exec.h>
# include <proto/dos.h>
#endif
#ifndef O_BINARY
# define O_BINARY 0
#endif
#ifndef O_CLOEXEC
# define O_CLOEXEC 0
#endif
#ifndef O_EXCL
# define O_EXCL 0
#endif
#ifndef O_EXLOCK
# define O_EXLOCK 0
#endif
#ifndef OF_AMIGAOS
# define closeHandle(h) close(h)
#else
# ifdef OF_AMIGAOS4
extern struct ExecIFace *IExec;
static struct Library *DOSBase = NULL;
static struct DOSIFace *IDOS = NULL;
# endif
struct of_file_handle {
of_file_handle_t previous, next;
BPTR handle;
bool append;
} *firstHandle = NULL;
static void
|
<
<
<
<
<
<
<
<
<
<
<
|
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
|
#ifdef OF_NINTENDO_DS
# include <stdbool.h>
# include <filesystem.h>
#endif
#ifdef OF_AMIGAOS
# include <proto/exec.h>
# include <proto/dos.h>
#endif
#ifndef O_BINARY
# define O_BINARY 0
#endif
#ifndef O_CLOEXEC
# define O_CLOEXEC 0
#endif
#ifndef O_EXCL
# define O_EXCL 0
#endif
#ifndef O_EXLOCK
# define O_EXLOCK 0
#endif
#ifndef OF_AMIGAOS
# define closeHandle(h) close(h)
#else
struct of_file_handle {
of_file_handle_t previous, next;
BPTR handle;
bool append;
} *firstHandle = NULL;
static void
|
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
}
OF_DESTRUCTOR()
{
for (of_file_handle_t iter = firstHandle; iter != NULL;
iter = iter->next)
Close(iter->handle);
# ifdef OF_AMIGAOS4
if (IDOS != NULL)
DropInterface((struct Interface *)IDOS);
if (DOSBase != NULL)
CloseLibrary(DOSBase);
# endif
}
#endif
#ifndef OF_AMIGAOS
static int
parseMode(const char *mode)
{
|
<
<
<
<
<
<
<
<
|
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
}
OF_DESTRUCTOR()
{
for (of_file_handle_t iter = firstHandle; iter != NULL;
iter = iter->next)
Close(iter->handle);
}
#endif
#ifndef OF_AMIGAOS
static int
parseMode(const char *mode)
{
|
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
|
#endif
#ifdef OF_NINTENDO_DS
if (!nitroFSInit(NULL))
@throw [OFInitializationFailedException
exceptionWithClass: self];
#endif
#ifdef OF_AMIGAOS4
if ((DOSBase = OpenLibrary("dos.library", 36)) == NULL)
@throw [OFInitializationFailedException
exceptionWithClass: self];
if ((IDOS = (struct DOSIFace *)
GetInterface(DOSBase, "main", 1, NULL)) == NULL)
@throw [OFInitializationFailedException
exceptionWithClass: self];
#endif
}
+ (instancetype)fileWithPath: (OFString *)path
mode: (OFString *)mode
{
return [[[self alloc] initWithPath: path
mode: mode] autorelease];
|
<
<
<
<
<
<
<
<
<
<
<
|
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
#endif
#ifdef OF_NINTENDO_DS
if (!nitroFSInit(NULL))
@throw [OFInitializationFailedException
exceptionWithClass: self];
#endif
}
+ (instancetype)fileWithPath: (OFString *)path
mode: (OFString *)mode
{
return [[[self alloc] initWithPath: path
mode: mode] autorelease];
|