Overview
Comment: | Separate std{out,err} on MorphOS + libnix |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
0dabf9dc62984102b0a9a13c2d1d3ea3 |
User & Date: | js on 2017-05-28 18:57:48 |
Other Links: | manifest | tags |
Context
2017-05-28
| ||
21:29 | OFFile: Use AmigaDOS API on MorphOS + libnix check-in: 7a0f290eae user: js tags: trunk | |
18:57 | Separate std{out,err} on MorphOS + libnix check-in: 0dabf9dc62 user: js tags: trunk | |
17:56 | OFThread: Use Delay() on MorphOS + libnix check-in: aa6143bdf1 user: js tags: trunk | |
Changes
Modified src/OFStdIOStream+Private.h from [c0cf9d2b80] to [68f2152466].
︙ | ︙ | |||
15 16 17 18 19 20 21 22 23 24 25 | */ #import "OFStdIOStream.h" OF_ASSUME_NONNULL_BEGIN @interface OFStdIOStream () - (instancetype)of_initWithFileDescriptor: (int)fd OF_METHOD_FAMILY(init); @end OF_ASSUME_NONNULL_END | > > > > > > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | */ #import "OFStdIOStream.h" OF_ASSUME_NONNULL_BEGIN @interface OFStdIOStream () #if !defined(OF_MORPHOS) || defined(OF_IXEMUL) - (instancetype)of_initWithFileDescriptor: (int)fd OF_METHOD_FAMILY(init); #else - (instancetype)of_initWithFileDescriptor: (long)handle closable: (bool)closable OF_METHOD_FAMILY(init); #endif @end OF_ASSUME_NONNULL_END |
Modified src/OFStdIOStream.h from [76c0240823] to [6bad6405ef].
︙ | ︙ | |||
27 28 29 30 31 32 33 | * instances of this class and need no initialization. */ #ifdef OF_STDIO_STREAM_WIN32_CONSOLE_H OF_SUBCLASSING_RESTRICTED #endif @interface OFStdIOStream: OFStream { | > > > | > > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | * instances of this class and need no initialization. */ #ifdef OF_STDIO_STREAM_WIN32_CONSOLE_H OF_SUBCLASSING_RESTRICTED #endif @interface OFStdIOStream: OFStream { #if !defined(OF_MORPHOS) || defined(OF_IXEMUL) int _fd; #else long _fd; bool _closable; #endif bool _atEndOfStream; } - init OF_UNAVAILABLE; /*! * @brief Query the underlying terminal for the number of columns. |
︙ | ︙ |
Modified src/OFStdIOStream.m from [37f14b4e93] to [1049054022].
︙ | ︙ | |||
45 46 47 48 49 50 51 | # include <proto/dos.h> # undef BOOL # define INVALID_FD 0 # define getpid() ((int)SysBase->ThisTask) # define read(fd, buf, len) Read(fd, buf, len) # define write(fd, buf, len) Write(fd, buf, len) | < > > > > > > > > > | 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 | # include <proto/dos.h> # undef BOOL # define INVALID_FD 0 # define getpid() ((int)SysBase->ThisTask) # define read(fd, buf, len) Read(fd, buf, len) # define write(fd, buf, len) Write(fd, buf, len) extern struct ExecBase *SysBase; #endif #ifndef INVALID_FD # define INVALID_FD -1 #endif /* References for static linking */ #ifdef OF_WINDOWS void _reference_to_OFStdIOStream_Win32Console(void) { [OFStdIOStream_Win32Console class]; } #endif OFStdIOStream *of_stdin = nil; OFStdIOStream *of_stdout = nil; OFStdIOStream *of_stderr = nil; #if defined(OF_MORPHOS) && !defined(OF_IXEMUL) OF_DESTRUCTOR() { [of_stdin dealloc]; [of_stdout dealloc]; [of_stderr dealloc]; } #endif void of_log(OFConstantString *format, ...) { void *pool = objc_autoreleasePoolPush(); OFDate *date; OFString *dateString, *me, *msg; |
︙ | ︙ | |||
99 100 101 102 103 104 105 | + (void)load { # if !defined(OF_MORPHOS) || defined(OF_IXEMUL) of_stdin = [[OFStdIOStream alloc] of_initWithFileDescriptor: 0]; of_stdout = [[OFStdIOStream alloc] of_initWithFileDescriptor: 1]; of_stderr = [[OFStdIOStream alloc] of_initWithFileDescriptor: 2]; # else | > > > > > > > > > > > > > > > > > > > > | > > | > > | > > > > > > > > > > > > > > > > > > > > > > | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 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 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | + (void)load { # if !defined(OF_MORPHOS) || defined(OF_IXEMUL) of_stdin = [[OFStdIOStream alloc] of_initWithFileDescriptor: 0]; of_stdout = [[OFStdIOStream alloc] of_initWithFileDescriptor: 1]; of_stderr = [[OFStdIOStream alloc] of_initWithFileDescriptor: 2]; # else BPTR input = Input(), output = Output(); BPTR error = ((struct Process *)SysBase->ThisTask)->pr_CES; bool inputClosable = false, outputClosable = false, errorClosable = false; if (input == INVALID_FD) { input = Open("*", MODE_OLDFILE); inputClosable = true; } if (output == INVALID_FD) { output = Open("*", MODE_OLDFILE); outputClosable = true; } if (error == INVALID_FD) { error = Open("*", MODE_OLDFILE); errorClosable = true; } of_stdin = [[OFStdIOStream alloc] of_initWithFileDescriptor: input closable: inputClosable]; of_stdout = [[OFStdIOStream alloc] of_initWithFileDescriptor: output closable: outputClosable]; of_stderr = [[OFStdIOStream alloc] of_initWithFileDescriptor: error closable: errorClosable]; # endif } #endif - init { OF_INVALID_INIT_METHOD } #if !defined(OF_MORPHOS) || defined(OF_IXEMUL) - (instancetype)of_initWithFileDescriptor: (int)fd { self = [super init]; _fd = fd; return self; } #else - (instancetype)of_initWithFileDescriptor: (long)fd closable: (bool)closable { self = [super init]; _fd = fd; _closable = closable; return self; } #endif - (void)dealloc { [self close]; [super dealloc]; } - (bool)lowlevelIsAtEndOfStream { if (_fd == INVALID_FD) return true; return _atEndOfStream; |
︙ | ︙ | |||
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | { return _fd; } #endif - (void)close { if (_fd != INVALID_FD) close(_fd); _fd = INVALID_FD; [super close]; } - autorelease | > > > > > | 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | { return _fd; } #endif - (void)close { #if !defined(OF_MORPHOS) || defined(OF_IXEMUL) if (_fd != INVALID_FD) close(_fd); #else if (_closable && _fd != INVALID_FD) Close(_fd); #endif _fd = INVALID_FD; [super close]; } - autorelease |
︙ | ︙ | |||
225 226 227 228 229 230 231 | } - (unsigned int)retainCount { return OF_RETAIN_COUNT_MAX; } | < < < < < | 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | } - (unsigned int)retainCount { return OF_RETAIN_COUNT_MAX; } - (int)columns { #if defined(HAVE_SYS_IOCTL_H) && defined(TIOCGWINSZ) struct winsize ws; if (ioctl(_fd, TIOCGWINSZ, &ws) != 0) return -1; |
︙ | ︙ |