Index: src/OFStdIOStream.h ================================================================== --- src/OFStdIOStream.h +++ src/OFStdIOStream.h @@ -134,10 +134,11 @@ #ifdef __cplusplus extern "C" { #endif /*! @file */ +#ifndef OF_AMIGAOS /*! * @brief The standard input as an OFStream. */ extern OFStdIOStream *_Nullable of_stdin; @@ -148,10 +149,18 @@ /*! * @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 Index: src/OFStdIOStream.m ================================================================== --- src/OFStdIOStream.m +++ src/OFStdIOStream.m @@ -55,14 +55,40 @@ _reference_to_OFWin32ConsoleStdIOStream(void) { [OFWin32ConsoleStdIOStream class]; } #endif + +#ifdef OF_AMIGAOS +# undef of_stdin +# undef of_stdout +# undef of_stderr +#endif OFStdIOStream *of_stdin = nil; OFStdIOStream *of_stdout = nil; OFStdIOStream *of_stderr = nil; + +#ifdef OF_AMIGAOS +OFStdIOStream ** +of_stdin_ref(void) +{ + return &of_stdin; +} + +OFStdIOStream ** +of_stdout_ref(void) +{ + return &of_stdout; +} + +OFStdIOStream ** +of_stderr_ref(void) +{ + return &of_stderr; +} +#endif #ifdef OF_AMIGAOS OF_DESTRUCTOR() { [of_stdin dealloc]; Index: src/amiga-glue.m ================================================================== --- src/amiga-glue.m +++ src/amiga-glue.m @@ -108,10 +108,28 @@ { M68K_ARG(const char *, type, a0) return of_alignof_type_encoding(type); } + +OFStdIOStream **__saveds +glue_of_stdin_ref(void) +{ + return of_stdin_ref(); +} + +OFStdIOStream **__saveds +glue_of_stdout_ref(void) +{ + return of_stdout_ref(); +} + +OFStdIOStream **__saveds +glue_of_stderr_ref(void) +{ + return of_stderr_ref(); +} void __saveds glue_of_logv PPC_PARAMS(OFConstantString *format, va_list arguments) { M68K_ARG(OFConstantString *, format, a0) Index: src/amiga-library.m ================================================================== --- src/amiga-library.m +++ src/amiga-library.m @@ -20,12 +20,13 @@ #include #include #include #include -#import "OFString.h" #import "OFHTTPRequest.h" +#import "OFStdIOStream.h" +#import "OFString.h" #import "amiga-library.h" #import "macros.h" #import "socket.h" @@ -73,10 +74,13 @@ extern const char *glue_of_http_request_method_to_string(void); extern of_http_request_method_t glue_of_http_request_method_from_string(void); extern OFString *glue_of_http_status_code_to_string(void); extern size_t glue_of_sizeof_type_encoding(void); extern size_t glue_of_alignof_type_encoding(void); +extern OFStdIOStream **glue_of_stdin_ref(void); +extern OFStdIOStream **glue_of_stdout_ref(void); +extern OFStdIOStream **glue_of_stderr_ref(void); extern void glue_of_logv(void); extern OFString *glue_of_zip_archive_entry_version_to_string(void); extern OFString *glue_of_zip_archive_entry_compression_method_to_string(void); extern size_t glue_of_zip_archive_entry_extra_field_find(void); extern void glue_of_pbkdf2(void); @@ -616,10 +620,13 @@ (CONST_APTR)glue_of_http_request_method_to_string, (CONST_APTR)glue_of_http_request_method_from_string, (CONST_APTR)glue_of_http_status_code_to_string, (CONST_APTR)glue_of_sizeof_type_encoding, (CONST_APTR)glue_of_alignof_type_encoding, + (CONST_APTR)glue_of_stdin_ref, + (CONST_APTR)glue_of_stdout_ref, + (CONST_APTR)glue_of_stderr_ref, (CONST_APTR)glue_of_logv, (CONST_APTR)glue_of_zip_archive_entry_version_to_string, (CONST_APTR)glue_of_zip_archive_entry_compression_method_to_string, (CONST_APTR)glue_of_zip_archive_entry_extra_field_find, (CONST_APTR)glue_of_pbkdf2, Index: src/amigaos3.sfd ================================================================== --- src/amigaos3.sfd +++ src/amigaos3.sfd @@ -9,10 +9,13 @@ const char *_Nullable glue_of_http_request_method_to_string(of_http_request_method_t method)(d0) of_http_request_method_t glue_of_http_request_method_from_string(OFString *string)(a0) OFString *_Nonnull glue_of_http_status_code_to_string(short code)(d0) size_t glue_of_sizeof_type_encoding(const char *type)(a0) size_t glue_of_alignof_type_encoding(const char *type)(a0) +OFStdIOStream *_Nonnull *_Nullable glue_of_stdin_ref(void)() +OFStdIOStream *_Nonnull *_Nullable glue_of_stdout_ref(void)() +OFStdIOStream *_Nonnull *_Nullable glue_of_stderr_ref(void)() void glue_of_logv(OFConstantString *format, va_list arguments)(a0,a1) OFString *_Nonnull glue_of_zip_archive_entry_version_to_string(uint16_t version)(d0) OFString *_Nonnull glue_of_zip_archive_entry_compression_method_to_string(uint16_t compressionMethod)(d0) size_t glue_of_zip_archive_entry_extra_field_find(OFData *extraField, uint16_t tag, uint16_t *size)(a0,d0,a1) void glue_of_pbkdf2(OFHMAC *HMAC, size_t iterations, const unsigned char *salt, size_t saltLength, const char *password, size_t passwordLength, unsigned char *key, size_t keyLength, bool allowsSwappableMemory)(a0,d0,a1,d1,a2,d2,a3,d3,d4) Index: src/linklib/linklib.m ================================================================== --- src/linklib/linklib.m +++ src/linklib/linklib.m @@ -395,10 +395,28 @@ size_t of_alignof_type_encoding(const char *type) { return glue_of_alignof_type_encoding(type); } + +OFStdIOStream ** +of_stdin_ref(void) +{ + return glue_of_stdin_ref(); +} + +OFStdIOStream ** +of_stdout_ref(void) +{ + return glue_of_stdout_ref(); +} + +OFStdIOStream ** +of_stderr_ref(void) +{ + return glue_of_stderr_ref(); +} void of_logv(OFConstantString *format, va_list arguments) { glue_of_logv(format, arguments);