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
88
89
90
91
92
93
94
|
#import "OFInitializationFailedException.h"
#import "OFNotOpenException.h"
#import "OFOutOfRangeException.h"
#import "OFReadFailedException.h"
#import "OFWriteFailedException.h"
#ifdef OF_AMIGAOS
# ifdef OF_AMIGAOS4
# define __USE_INLINE__
# define __NOLIBBASE__
# define __NOGLOBALIFACE__
# endif
# include <proto/exec.h>
# include <proto/dos.h>
#endif
/* References for static linking */
#ifdef OF_WINDOWS
void
_reference_to_OFWin32ConsoleStdIOStream(void)
{
[OFWin32ConsoleStdIOStream class];
}
#endif
#ifdef OF_AMIGAOS4
extern struct ExecIFace *IExec;
static struct Library *DOSBase = NULL;
static struct DOSIFace *IDOS = NULL;
#endif
OFStdIOStream *of_stdin = nil;
OFStdIOStream *of_stdout = nil;
OFStdIOStream *of_stderr = nil;
#ifdef OF_AMIGAOS
OF_DESTRUCTOR()
{
[of_stdin dealloc];
[of_stdout dealloc];
[of_stderr dealloc];
# ifdef OF_AMIGAOS4
if (IDOS != NULL)
DropInterface((struct Interface *)IDOS);
if (DOSBase != NULL)
CloseLibrary(DOSBase);
# endif
}
#endif
void
of_log(OFConstantString *format, ...)
{
void *pool = objc_autoreleasePoolPush();
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
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
|
#import "OFInitializationFailedException.h"
#import "OFNotOpenException.h"
#import "OFOutOfRangeException.h"
#import "OFReadFailedException.h"
#import "OFWriteFailedException.h"
#ifdef OF_AMIGAOS
# include <proto/exec.h>
# include <proto/dos.h>
#endif
/* References for static linking */
#ifdef OF_WINDOWS
void
_reference_to_OFWin32ConsoleStdIOStream(void)
{
[OFWin32ConsoleStdIOStream class];
}
#endif
OFStdIOStream *of_stdin = nil;
OFStdIOStream *of_stdout = nil;
OFStdIOStream *of_stderr = nil;
#ifdef OF_AMIGAOS
OF_DESTRUCTOR()
{
[of_stdin dealloc];
[of_stdout dealloc];
[of_stderr dealloc];
}
#endif
void
of_log(OFConstantString *format, ...)
{
void *pool = objc_autoreleasePoolPush();
|
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
of_stderr = [[OFStdIOStream alloc]
of_initWithFileDescriptor: fd];
# else
BPTR input, output, error;
bool inputClosable = false, outputClosable = false,
errorClosable = false;
# 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
input = Input();
output = Output();
error = ((struct Process *)FindTask(NULL))->pr_CES;
if (input == 0) {
input = Open("*", MODE_OLDFILE);
inputClosable = true;
|
<
<
<
<
<
<
<
<
<
<
<
|
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
of_stderr = [[OFStdIOStream alloc]
of_initWithFileDescriptor: fd];
# else
BPTR input, output, error;
bool inputClosable = false, outputClosable = false,
errorClosable = false;
input = Input();
output = Output();
error = ((struct Process *)FindTask(NULL))->pr_CES;
if (input == 0) {
input = Open("*", MODE_OLDFILE);
inputClosable = true;
|