Differences From Artifact [6a9a522909]:
- File src/runtime/amiga-library.m — part of check-in [310e9eb600] at 2018-04-28 23:41:53 on branch trunk — Update buildsys (user: js, size: 5431) [annotate] [blame] [check-ins using]
- File
src/runtime/morphos-library.m
— part of check-in
[fe2cbe0021]
at
2018-04-22 16:13:04
on branch trunk
— runtime: Define BOOL to be the same as bool
As we define the ABI, we can just replace BOOL with bool everywhere,
including in ObjFW itself. For the Apple platforms where BOOL and bool
are different, this is not a problem as BOOL and bool are passed and
returned the same way in the ABI.This still defines BOOL to bool for compatibility, except on AmigaOS and
Wii, which both have its own BOOL type. (user: js, size: 5431) [annotate] [blame] [check-ins using]
To Artifact [d7ad72af48]:
- File src/runtime/amiga-library.m — part of check-in [d7870d7c1b] at 2018-04-29 18:23:55 on branch trunk — runtime: Rewrite amiga-library.m for AmigaOS 3 (user: js, size: 5827) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
14 15 16 17 18 19 20 | * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "ObjFW_RT.h" | | > | > > | | < > > > > > > > > > > > > > > > > > > > | | | > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > | | > > > | > > | | > > > > > | > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < | | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 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 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 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "ObjFW_RT.h" #import "private.h" #import "platform.h" #ifdef OF_AMIGAOS3 # define INTUITION_CLASSES_H #endif #include <exec/libraries.h> #include <exec/nodes.h> #include <exec/resident.h> #include <proto/exec.h> #define CONCAT_VERSION2(major, minor) #major "." #minor #define CONCAT_VERSION(major, minor) CONCAT_VERSION2(major, minor) #define VERSION_STRING CONCAT_VERSION(OBJFW_RT_LIB_MAJOR, OBJFW_RT_LIB_MINOR) /* This always needs to be the first thing in the file. */ int _start() { return -1; } struct ObjFWRTBase { struct Library library; BPTR seg_list; }; struct ExecBase *SysBase; #ifdef OF_MORPHOS const ULONG __abox__ = 1; #endif struct WBStartup *_WBenchMsg; struct objc_libc *libc; FILE *stdout; FILE *stderr; static struct Library * lib_init(struct ExecBase *exec_base OBJC_M68K_REG("a6"), BPTR seg_list OBJC_M68K_REG("a0"), struct ObjFWRTBase *base OBJC_M68K_REG("d0")) { SysBase = exec_base; base->seg_list = seg_list; return &base->library; } static struct Library * OBJC_M68K_FUNC(lib_open, struct ObjFWRTBase *base OBJC_M68K_REG("a6")) { OBJC_M68K_ARG(struct ObjFWRTBase *, base, REG_A6) base->library.lib_OpenCnt++; base->library.lib_Flags &= ~LIBF_DELEXP; return &base->library; } static BPTR expunge(struct ObjFWRTBase *base) { BPTR seg_list; if (base->library.lib_OpenCnt > 0) { base->library.lib_Flags |= LIBF_DELEXP; return 0; } seg_list = base->seg_list; Remove(&base->library.lib_Node); FreeMem((char *)base - base->library.lib_NegSize, base->library.lib_NegSize + base->library.lib_PosSize); return seg_list; } static BPTR OBJC_M68K_FUNC(lib_expunge, struct ObjFWRTBase *base OBJC_M68K_REG("a6")) { OBJC_M68K_ARG(struct ObjFWRTBase *, base, REG_A6) return expunge(base); } static BPTR OBJC_M68K_FUNC(lib_close, struct ObjFWRTBase *base OBJC_M68K_REG("a6")) { OBJC_M68K_ARG(struct ObjFWRTBase *, base, REG_A6) if (--base->library.lib_OpenCnt == 0 && (base->library.lib_Flags & LIBF_DELEXP)) return expunge(base); return 0; } static BPTR lib_null(void) { return 0; } static void objc_set_libc(struct objc_libc *libc_) { libc = libc_; stdout = libc->stdout; stderr = libc->stderr; } void * malloc(size_t size) { return libc->malloc(size); } void * calloc(size_t count, size_t size) { return libc->calloc(count, size); } void * realloc(void *ptr, size_t size) { return libc->realloc(ptr, size); } void free(void *ptr) { libc->free(ptr); } int fprintf(FILE *restrict stream, const char *restrict fmt, ...) { int ret; va_list args; va_start(args, fmt); ret = libc->vfprintf(stream, fmt, args); va_end(args); return ret; } int fputs(const char *restrict s, FILE *restrict stream) { return libc->fputs(s, stream); } void exit(int status) { libc->exit(status); } void abort(void) { libc->abort(); } static ULONG function_table[] = { (ULONG)lib_open, (ULONG)lib_close, (ULONG)lib_expunge, (ULONG)lib_null, /* Functions for the glue code */ (ULONG)objc_set_libc, /* Used by the compiler - these need glue code */ (ULONG)__objc_exec_class, (ULONG)objc_msg_lookup, (ULONG)objc_msg_lookup_stret, (ULONG)objc_msg_lookup_super, (ULONG)objc_msg_lookup_super_stret, (ULONG)objc_lookUpClass, |
︙ | ︙ | |||
97 98 99 100 101 102 103 | (ULONG)protocol_conformsToProtocol, (ULONG)objc_exit, (ULONG)objc_setUncaughtExceptionHandler, (ULONG)objc_setForwardHandler, (ULONG)objc_setEnumerationMutationHandler, (ULONG)objc_zero_weak_references, -1, | < < < < | | | | | > > | | | | > > > > | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | (ULONG)protocol_conformsToProtocol, (ULONG)objc_exit, (ULONG)objc_setUncaughtExceptionHandler, (ULONG)objc_setForwardHandler, (ULONG)objc_setEnumerationMutationHandler, (ULONG)objc_zero_weak_references, -1, }; static struct { ULONG data_size; ULONG *function_table; ULONG *data_table; struct Library *(*init_func)( struct ExecBase *exec_base OBJC_M68K_REG("a6"), BPTR seg_list OBJC_M68K_REG("a0"), struct ObjFWRTBase *base OBJC_M68K_REG("d0")); } initTable = { sizeof(struct ObjFWRTBase), function_table, NULL, lib_init }; static struct Resident resident = { .rt_MatchWord = RTC_MATCHWORD, .rt_MatchTag = &resident, .rt_EndSkip = &resident + 1, .rt_Flags = RTF_AUTOINIT #ifndef OF_AMIGAOS3 | RTF_PPC #endif , .rt_Version = OBJFW_RT_LIB_MAJOR, .rt_Type = NT_LIBRARY, .rt_Pri = 0, .rt_Name = (char *)"objfw_rt.library", .rt_IdString = (char *)"ObjFW_RT " VERSION_STRING " \xA9 2008-2018 Jonathan Schleifer", .rt_Init = &initTable }; |