Differences From Artifact [30b6ddea45]:
- File
src/OFStdIOStream.h
— part of check-in
[9697334084]
at
2020-06-21 02:15:26
on branch amiga-library
— Make of_std{in,out,err} available in Amiga library
This is done by using functions that return a reference to the variable
and defining of_std{in,out,err} to a call into these functions. (user: js, size: 4797) [annotate] [blame] [check-ins using]
To Artifact [35e066feed]:
- File src/OFStdIOStream.h — part of check-in [92335940e9] at 2020-10-04 15:00:40 on branch amiga-library — Merge trunk into branch "amiga-library" (user: js, size: 4797) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
20 21 22 23 24 25 26 | #ifdef OF_AMIGAOS # include <dos/dos.h> #endif OF_ASSUME_NONNULL_BEGIN | | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #ifdef OF_AMIGAOS # include <dos/dos.h> #endif OF_ASSUME_NONNULL_BEGIN /** @file */ @class OFColor; /** * @class OFStdIOStream OFStdIOStream.h ObjFW/OFStdIOStream.h * * @brief A class for providing standard input, output and error as OFStream. * * The global variables @ref of_stdin, @ref of_stdout and @ref of_stderr are * instances of this class and need no initialization. */ |
︙ | ︙ | |||
49 50 51 52 53 54 55 | #else BPTR _handle; bool _closable; #endif bool _atEndOfStream; } | | | | | | | | | | | | | | | | | | 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 99 100 101 102 103 104 105 106 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 | #else BPTR _handle; bool _closable; #endif bool _atEndOfStream; } /** * @brief Whether there is an underlying terminal. */ @property (readonly, nonatomic) bool hasTerminal; /** * @brief The number of columns, or -1 if there is no underlying terminal or * the number of columns could not be queried. */ @property (readonly, nonatomic) int columns; /** * @brief The number of rows, or -1 if there is no underlying terminal or the * number of rows could not be queried. */ @property (readonly, nonatomic) int rows; - (instancetype)init OF_UNAVAILABLE; /** * @brief Sets the foreground color on the underlying terminal. Does nothing if * there is no underlying terminal or colors are unsupported. * * @param color The foreground color to set */ - (void)setForegroundColor: (OFColor *)color; /** * @brief Sets the background color on the underlying terminal. Does nothing if * there is no underlying terminal or colors are unsupported. * * @param color The background color to set */ - (void)setBackgroundColor: (OFColor *)color; /** * @brief Resets all attributes (color, bold, etc.). Does nothing if there is * no underlying terminal. */ - (void)reset; /** * @brief Clears the entire underlying terminal. Does nothing if there is no * underlying terminal. */ - (void)clear; /** * @brief Erases the entire current line on the underlying terminal. Does * nothing if there is no underlying terminal. */ - (void)eraseLine; /** * @brief Moves the cursor to the specified column in the current row. Does * nothing if there is no underlying terminal. * * @param column The column in the current row to move the cursor to */ - (void)setCursorColumn: (unsigned int)column; /** * @brief Moves the cursor to the specified absolute position. Does nothing if * there is no underlying terminal. * * @param position The position to move the cursor to */ - (void)setCursorPosition: (of_point_t)position; /** * @brief Moves the cursor to the specified relative position. Does nothing if * there is no underlying terminal. * * @param position The position to move the cursor to */ - (void)setRelativeCursorPosition: (of_point_t)position; @end #ifdef __cplusplus extern "C" { #endif /** @file */ #ifndef OF_AMIGAOS /** * @brief The standard input as an OFStream. */ extern OFStdIOStream *_Nullable of_stdin; /** * @brief The standard output as an OFStream. */ extern OFStdIOStream *_Nullable of_stdout; /** * @brief The standard error as an OFStream. */ extern OFStdIOStream *_Nullable of_stderr; #else extern OFStdIOStream *_Nonnull *_Nullable of_stdin_ref(void); extern OFStdIOStream *_Nonnull *_Nullable of_stdout_ref(void); extern OFStdIOStream *_Nonnull *_Nullable of_stderr_ref(void); # define of_stdin (*of_stdin_ref()) # define of_stdout (*of_stdout_ref()) # define of_stderr (*of_stderr_ref()) #endif /** * @brief Logs the specified printf-style format to @ref of_stderr. * * This prefixes the output with the date, timestamp, process name and PID and * allows `%@` as a printf-style formatted to print objects. */ extern void of_log(OFConstantString *format, ...); |
︙ | ︙ |