Overview
Comment: | Derive of_std{in,out,err} from std{in,out,err}
Previously, this just assumed the existance of file descriptors 0, 1 and |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
0f8a72d43cf527e43d8cd4fb1e14086d |
User & Date: | js on 2019-03-24 13:19:50 |
Other Links: | manifest | tags |
Context
2019-03-24
| ||
22:29 | Add support for UNC paths on Windows check-in: a4b719e4e9 user: js tags: trunk | |
13:19 | Derive of_std{in,out,err} from std{in,out,err} check-in: 0f8a72d43c user: js tags: trunk | |
2019-03-23
| ||
22:03 | Add -[valueForKeyPath:] / -[setValue:forKeyPath:] check-in: d7824704f9 user: js tags: trunk | |
Changes
Modified src/OFStdIOStream.m from [416043c557] to [78d2467bd8].
︙ | ︙ | |||
115 116 117 118 119 120 121 122 | objc_autoreleasePoolPop(pool); } @implementation OFStdIOStream #ifndef OF_WINDOWS + (void)load { # ifndef OF_AMIGAOS | > > > > > > | > > | > > | > | 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 | objc_autoreleasePoolPop(pool); } @implementation OFStdIOStream #ifndef OF_WINDOWS + (void)load { if (self != [OFStdIOStream class]) return; # ifndef OF_AMIGAOS int fd; if ((fd = fileno(stdin)) >= 0) of_stdin = [[OFStdIOStream alloc] of_initWithFileDescriptor: fd]; if ((fd = fileno(stdout)) >= 0) of_stdout = [[OFStdIOStream alloc] of_initWithFileDescriptor: fd]; if ((fd = fileno(stderr)) >= 0) 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) |
︙ | ︙ |
Modified src/OFStdIOStream_Win32Console.m from [4abac542f9] to [7e7d715431].
︙ | ︙ | |||
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | #define OF_STDIO_STREAM_WIN32_CONSOLE_M #include "config.h" #include <assert.h> #include <errno.h> #import "OFStdIOStream_Win32Console.h" #import "OFStdIOStream+Private.h" #import "OFString.h" #import "OFData.h" #import "OFInvalidArgumentException.h" #import "OFInvalidEncodingException.h" #import "OFOutOfRangeException.h" #import "OFReadFailedException.h" #import "OFWriteFailedException.h" #include <windows.h> @implementation OFStdIOStream_Win32Console + (void)load { | > > > > > > > | | > | | > | | < < | < < < < < | < < < | 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 95 96 97 98 | #define OF_STDIO_STREAM_WIN32_CONSOLE_M #include "config.h" #include <assert.h> #include <errno.h> #include <io.h> #import "OFStdIOStream_Win32Console.h" #import "OFStdIOStream+Private.h" #import "OFString.h" #import "OFData.h" #import "OFInvalidArgumentException.h" #import "OFInvalidEncodingException.h" #import "OFOutOfRangeException.h" #import "OFReadFailedException.h" #import "OFWriteFailedException.h" #include <windows.h> @implementation OFStdIOStream_Win32Console + (void)load { int fd; if (self != [OFStdIOStream_Win32Console class]) return; if ((fd = _fileno(stdin)) >= 0) of_stdin = [[OFStdIOStream_Win32Console alloc] of_initWithFileDescriptor: fd]; if ((fd = _fileno(stdout)) >= 0) of_stdout = [[OFStdIOStream_Win32Console alloc] of_initWithFileDescriptor: fd]; if ((fd = _fileno(stderr)) >= 0) of_stderr = [[OFStdIOStream_Win32Console alloc] of_initWithFileDescriptor: fd]; } - (instancetype)of_initWithFileDescriptor: (int)fd { self = [super of_initWithFileDescriptor: fd]; @try { DWORD mode; _handle = (HANDLE)_get_osfhandle(fd); if (_handle == INVALID_HANDLE_VALUE) @throw [OFInvalidArgumentException exception]; /* Not a console: Treat it as a regular OFStdIOStream */ if (!GetConsoleMode(_handle, &mode)) object_setClass(self, [OFStdIOStream class]); } @catch (id e) { [self release]; @throw e; |
︙ | ︙ |