Index: .fossil-settings/clean-glob ================================================================== --- .fossil-settings/clean-glob +++ .fossil-settings/clean-glob @@ -21,10 +21,11 @@ config.log config.status configure docs extra.mk +generators/library/gen_libraries generators/unicode/gen_tables src/Info.plist src/bridge/Info.plist src/objfw-defs.h src/runtime/Info.plist Index: .fossil-settings/ignore-glob ================================================================== --- .fossil-settings/ignore-glob +++ .fossil-settings/ignore-glob @@ -23,10 +23,11 @@ config.log config.status configure docs extra.mk +generators/library/gen_libraries generators/unicode/gen_tables src/Info.plist src/bridge/Info.plist src/objfw-defs.h src/runtime/Info.plist Index: .gitignore ================================================================== --- .gitignore +++ .gitignore @@ -23,10 +23,11 @@ config.log config.status configure docs extra.mk +generators/library/gen_libraries generators/unicode/gen_tables src/Info.plist src/bridge/Info.plist src/objfw-defs.h src/runtime/Info.plist ADDED generators/library/LibraryGenerator.m Index: generators/library/LibraryGenerator.m ================================================================== --- generators/library/LibraryGenerator.m +++ generators/library/LibraryGenerator.m @@ -0,0 +1,224 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, + * 2018, 2019, 2020 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#include "config.h" + +#import "OFApplication.h" +#import "OFArray.h" +#import "OFFile.h" +#import "OFXMLAttribute.h" +#import "OFXMLElement.h" + +#import "OFInvalidFormatException.h" +#import "OFUnsupportedVersionException.h" + +#import "copyright.h" + +@interface LibraryGenerator: OFObject +@end + +OF_APPLICATION_DELEGATE(LibraryGenerator) + +@implementation LibraryGenerator +- (void)applicationDidFinishLaunching +{ + [self generateLinkLibInDirectory: @"../../src/runtime"]; + + [OFApplication terminate]; +} + +- (void)generateLinkLibInDirectory: (OFString *)directory +{ + OFXMLElement *library = [OFXMLElement elementWithFile: + [directory stringByAppendingPathComponent: @"library.xml"]]; + OFString *linklibPath = [[directory + stringByAppendingPathComponent: @"linklib"] + stringByAppendingPathComponent: @"linklib.m"]; + OFFile *linklib = [OFFile fileWithPath: linklibPath + mode: @"w"]; + OFArray OF_GENERIC(OFXMLElement *) *functions; + size_t funcIndex = 0; + OFString *libBase; + + if (![library.name isEqual: @"amiga-library"] || + library.namespace != nil) + @throw [OFInvalidFormatException exception]; + + OFXMLAttribute *version = [library attributeForName: @"version"]; + if (version == nil) + @throw [OFInvalidFormatException exception]; + + if (![version.stringValue isEqual: @"1.0"]) + @throw [OFUnsupportedVersionException + exceptionWithVersion: version.stringValue]; + + libBase = [library attributeForName: @"base"].stringValue; + + [linklib writeString: COPYRIGHT]; + [linklib writeString: + @"/* This file is automatically generated from library.xml */\n" + @"\n" + @"#include \"config.h\"\n" + @"\n"]; + + for (OFXMLElement *include in [library elementsForName: @"include"]) + [linklib writeFormat: @"#import \"%@\"\n", include.stringValue]; + + [linklib writeFormat: @"\n" + @"extern struct Library *%@;\n" + @"\n", + libBase]; + + functions = [library elementsForName: @"function"]; + for (OFXMLElement *function in functions) { + OFString *name = + [function attributeForName: @"name"].stringValue; + OFString *returnType = + [function attributeForName: @"return-type"].stringValue; + OFArray OF_GENERIC(OFXMLElement *) *arguments = + [function elementsForName: @"argument"]; + size_t argumentIndex; + + if (returnType == nil) + returnType = @"void"; + + [linklib writeFormat: @"%@\n%@(", returnType, name]; + + argumentIndex = 0; + for (OFXMLElement *argument in + [function elementsForName: @"argument"]) { + OFString *argName = + [argument attributeForName: @"name"].stringValue; + OFString *argType = + [argument attributeForName: @"type"].stringValue; + + if (argumentIndex++ > 0) + [linklib writeString: @", "]; + + [linklib writeString: argType]; + if (![argType hasSuffix: @"*"]) + [linklib writeString: @" "]; + [linklib writeString: argName]; + } + + [linklib writeFormat: + @")\n" + @"{\n" + @"#if defined(OF_AMIGAOS_M68K)\n" + @"\tregister struct Library *a6 __asm__(\"a6\") = %@;\n" + @"\t(void)a6;\n" + @"\t", libBase]; + + if (![returnType isEqual: @"void"]) + [linklib writeString: @"return "]; + + [linklib writeString: @"(("]; + [linklib writeString: returnType]; + if (![returnType hasSuffix: @"*"]) + [linklib writeString: @" "]; + [linklib writeString: @"(*)("]; + + argumentIndex = 0; + for (OFXMLElement *argument in arguments) { + OFString *argType = + [argument attributeForName: @"type"].stringValue; + OFString *m68kReg = [argument + attributeForName: @"m68k-reg"].stringValue; + + if (argumentIndex++ > 0) + [linklib writeString: @", "]; + + [linklib writeString: argType]; + if (![argType hasSuffix: @"*"]) + [linklib writeString: @" "]; + [linklib writeFormat: @"__asm__(\"%@\")", m68kReg]; + } + + [linklib writeFormat: @"))(((uintptr_t)%@) - %zu))(", + libBase, 30 + funcIndex * 6]; + + argumentIndex = 0; + for (OFXMLElement *argument in + [function elementsForName: @"argument"]) { + OFString *argName = + [argument attributeForName: @"name"].stringValue; + + if (argumentIndex++ > 0) + [linklib writeString: @", "]; + + [linklib writeString: argName]; + } + + [linklib writeFormat: + @");\n" + @"#elif defined(OF_MORPHOS)\n" + @"\t__asm__ __volatile__ (\n" + @"\t \"mr\t\t%%%%r12, %%0\"\n" + @"\t :: \"r\"(%@) : \"r12\"\n" + @"\t);\n" + @"\n" + @"\t", + libBase, libBase]; + + if (![returnType isEqual: @"void"]) + [linklib writeString: @"return "]; + + [linklib writeString: @"(("]; + [linklib writeString: returnType]; + if (![returnType hasSuffix: @"*"]) + [linklib writeString: @" "]; + [linklib writeString: @"(*)("]; + + argumentIndex = 0; + for (OFXMLElement *argument in arguments) { + OFString *argType = + [argument attributeForName: @"type"].stringValue; + + if (argumentIndex++ > 0) + [linklib writeString: @", "]; + + [linklib writeString: argType]; + } + + [linklib writeFormat: @"))*(void **)(((uintptr_t)%@) - %zu))(", + libBase, 28 + funcIndex * 6]; + + argumentIndex = 0; + for (OFXMLElement *argument in + [function elementsForName: @"argument"]) { + OFString *argName = + [argument attributeForName: @"name"].stringValue; + + if (argumentIndex++ > 0) + [linklib writeString: @", "]; + + [linklib writeString: argName]; + } + + [linklib writeString: @");\n" + @"#endif\n"]; + + if ([function attributeForName: @"noreturn"] != nil) + [linklib writeString: @"\n\tOF_UNREACHABLE\n"]; + + [linklib writeString: @"}\n"]; + + if (++funcIndex < functions.count) + [linklib writeString: @"\n"]; + } +} +@end ADDED generators/library/Makefile Index: generators/library/Makefile ================================================================== --- generators/library/Makefile +++ generators/library/Makefile @@ -0,0 +1,67 @@ +include ../../extra.mk + +PROG_NOINST = gen_libraries${PROG_SUFFIX} +SRCS = LibraryGenerator.m + +.PHONY: run +run: all + rm -f libobjfw.so.${OBJFW_LIB_MAJOR} + rm -f libobjfw.so.${OBJFW_LIB_MAJOR_MINOR} + rm -f objfw.dll libobjfw.${OBJFW_LIB_MAJOR}.dylib + rm -f libobjfwrt.so.${OBJFWRT_LIB_MAJOR} + rm -f libobjfwrt.so.${OBJFWRT_LIB_MAJOR_MINOR} + rm -f objfwrt.dll libobjfwrt.${OBJFWRT_LIB_MAJOR}.dylib + rm -f ${OBJFWRT_AMIGA_LIB} + if test -f ../../src/libobjfw.so; then \ + ${LN_S} ../../src/libobjfw.so libobjfw.so.${OBJFW_LIB_MAJOR}; \ + ${LN_S} ../../src/libobjfw.so \ + libobjfw.so.${OBJFW_LIB_MAJOR_MINOR}; \ + elif test -f ../../src/libobjfw.so.${OBJFW_LIB_MAJOR_MINOR}; then \ + ${LN_S} ../../src/libobjfw.so.${OBJFW_LIB_MAJOR_MINOR} \ + libobjfw.so.${OBJFW_LIB_MAJOR_MINOR}; \ + fi + if test -f ../../src/objfw.dll; then \ + ${LN_S} ../src/objfw.dll objfw.dll; \ + fi + if test -f ../../src/libobjfw.dylib; then \ + ${LN_S} ../src/libobjfw.dylib \ + libobjfw.${OBJFW_LIB_MAJOR}.dylib; \ + fi + if test -f ../../src/runtime/libobjfwrt.so; then \ + ${LN_S} ../../src/runtime/libobjfwrt.so \ + libobjfwrt.so.${OBJFWRT_LIB_MAJOR}; \ + ${LN_S} ../../src/runtime/libobjfwrt.so \ + libobjfwrt.so.${OBJFWRT_LIB_MAJOR_MINOR}; \ + elif test -f ../../src/runtime/libobjfwrt.so.${OBJFWRT_LIB_MAJOR_MINOR}; then \ + ${LN_S} ../../src/runtime/libobjfwrt.so.${OBJFWRT_LIB_MAJOR_MINOR} libobjfwrt.so.${OBJFWRT_LIB_MAJOR_MINOR}; \ + fi + if test -f ../../src/runtime/objfwrt.dll; then \ + ${LN_S} ../../src/runtime/objfwrt.dll objfwrt.dll; \ + fi + if test -f ../../src/runtime/libobjfwrt.dylib; then \ + ${LN_S} ../../src/runtime/libobjfwrt.dylib \ + libobjfwrt.${OBJFWRT_LIB_MAJOR}.dylib; \ + fi + if test -f ../../src/runtime/${OBJFWRT_AMIGA_LIB}; then \ + ${LN_S} ../../src/runtime/${OBJFWRT_AMIGA_LIB} \ + ${OBJFWRT_AMIGA_LIB}; \ + fi + LD_LIBRARY_PATH=.$${LD_LIBRARY_PATH+:}$$LD_LIBRARY_PATH \ + DYLD_FRAMEWORK_PATH=../../src:../../src/runtime$${DYLD_FRAMEWORK_PATH+:}$$DYLD_FRAMEWORK_PATH \ + DYLD_LIBRARY_PATH=.$${DYLD_LIBRARY_PATH+:}$$DYLD_LIBRARY_PATH \ + LIBRARY_PATH=.$${LIBRARY_PATH+:}$$LIBRARY_PATH \ + ASAN_OPTIONS=allocator_may_return_null=1 \ + ${WRAPPER} ./${PROG_NOINST}; EXIT=$$?; \ + rm -f libobjfw.so.${OBJFW_LIB_MAJOR}; \ + rm -f objfw.so.${OBJFW_LIB_MAJOR_MINOR} objfw.dll; \ + rm -f libobjfw.${OBJFW_LIB_MAJOR}.dylib; \ + rm -f libobjfwrt.so.${OBJFWRT_LIB_MAJOR}; \ + rm -f objfwrt.so.${OBJFWRT_LIB_MAJOR_MINOR} objfwrt.dll; \ + rm -f libobjfwrt.${OBJFWRT_LIB_MAJOR}.dylib; \ + exit $$EXIT + +include ../../buildsys.mk + +CPPFLAGS += -I../../src -I../../src/exceptions -I../../src/runtime -I../.. +LIBS := -L../../src -lobjfw -L../../src/runtime ${RUNTIME_LIBS} ${LIBS} +LD = ${OBJC} ADDED generators/library/copyright.h Index: generators/library/copyright.h ================================================================== --- generators/library/copyright.h +++ generators/library/copyright.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, + * 2018, 2019, 2020 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#import "OFString.h" + +#define COPYRIGHT \ + @"/*\n" \ + @" * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, " \ + @"2017,\n" \ + @" * 2018, 2019, 2020\n" \ + @" * Jonathan Schleifer \n" \ + @" *\n" \ + @" * All rights reserved.\n" \ + @" *\n" \ + @" * This file is part of ObjFW. It may be distributed under the terms " \ + @"of the\n" \ + @" * Q Public License 1.0, which can be found in the file LICENSE.QPL " \ + @"included in\n" \ + @" * the packaging of this file.\n" \ + @" *\n" \ + @" * Alternatively, it may be distributed under the terms of the GNU " \ + @"General\n" \ + @" * Public License, either version 2 or 3, which can be found in the " \ + @"file\n" \ + @" * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the " \ + @"packaging of this\n" \ + @" * file.\n" \ + @" */\n" \ + @"\n" ADDED src/runtime/library.xml Index: src/runtime/library.xml ================================================================== --- src/runtime/library.xml +++ src/runtime/library.xml @@ -0,0 +1,345 @@ + + ObjFWRT.h + private.h + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: src/runtime/linklib/Makefile ================================================================== --- src/runtime/linklib/Makefile +++ src/runtime/linklib/Makefile @@ -1,12 +1,13 @@ include ../../../extra.mk STATIC_LIB = libobjfwrt.library.a -SRCS = linklib.m +SRCS = init.m \ + linklib.m include ../../../buildsys.mk CPPFLAGS += -I.. -I../.. -I../../.. \ -DOBJC_COMPILING_AMIGA_LINKLIB \ -DOBJFWRT_AMIGA_LIB=\"${OBJFWRT_AMIGA_LIB}\" \ -DOBJFWRT_LIB_MINOR=${OBJFWRT_LIB_MINOR} LD = ${OBJC} ADDED src/runtime/linklib/init.m Index: src/runtime/linklib/init.m ================================================================== --- src/runtime/linklib/init.m +++ src/runtime/linklib/init.m @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, + * 2018, 2019, 2020 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#include "config.h" + +#import "ObjFWRT.h" +#import "private.h" +#import "macros.h" + +#include +#include + +struct ObjFWRTBase; + +#import "inline.h" + +#include +#include + +#if defined(OF_AMIGAOS_M68K) +# include +#elif defined(OF_MORPHOS) +# include +#endif + +#ifdef HAVE_SJLJ_EXCEPTIONS +extern int _Unwind_SjLj_RaiseException(void *); +#else +extern int _Unwind_RaiseException(void *); +#endif +extern void _Unwind_DeleteException(void *); +extern void *_Unwind_GetLanguageSpecificData(void *); +extern uintptr_t _Unwind_GetRegionStart(void *); +extern uintptr_t _Unwind_GetDataRelBase(void *); +extern uintptr_t _Unwind_GetTextRelBase(void *); +extern uintptr_t _Unwind_GetIP(void *); +extern uintptr_t _Unwind_GetGR(void *, int); +extern void _Unwind_SetIP(void *, uintptr_t); +extern void _Unwind_SetGR(void *, int, uintptr_t); +#ifdef HAVE_SJLJ_EXCEPTIONS +extern void _Unwind_SjLj_Resume(void *); +#else +extern void _Unwind_Resume(void *); +#endif +#ifdef OF_AMIGAOS_M68K +extern void __register_frame_info(const void *, void *); +extern void *__deregister_frame_info(const void *); +#endif +#ifdef OF_MORPHOS +extern void __register_frame(void *); +extern void __deregister_frame(void *); +#endif + +struct Library *ObjFWRTBase; +void *__objc_class_name_Protocol; + +static void +error(const char *string, ULONG arg) +{ + struct Library *IntuitionBase = OpenLibrary("intuition.library", 0); + + if (IntuitionBase != NULL) { + struct EasyStruct easy = { + .es_StructSize = sizeof(easy), + .es_Flags = 0, + .es_Title = (void *)NULL, + .es_TextFormat = (void *)string, + (void *)"OK" + }; + + EasyRequest(NULL, &easy, NULL, arg); + + CloseLibrary(IntuitionBase); + } + + exit(EXIT_FAILURE); +} + +static void __attribute__((__used__)) +ctor(void) +{ + static bool initialized = false; + struct objc_libc libc = { + .malloc = malloc, + .calloc = calloc, + .realloc = realloc, + .free = free, +#ifdef HAVE_SJLJ_EXCEPTIONS + ._Unwind_SjLj_RaiseException = _Unwind_SjLj_RaiseException, +#else + ._Unwind_RaiseException = _Unwind_RaiseException, +#endif + ._Unwind_DeleteException = _Unwind_DeleteException, + ._Unwind_GetLanguageSpecificData = + _Unwind_GetLanguageSpecificData, + ._Unwind_GetRegionStart = _Unwind_GetRegionStart, + ._Unwind_GetDataRelBase = _Unwind_GetDataRelBase, + ._Unwind_GetTextRelBase = _Unwind_GetTextRelBase, + ._Unwind_GetIP = _Unwind_GetIP, + ._Unwind_GetGR = _Unwind_GetGR, + ._Unwind_SetIP = _Unwind_SetIP, + ._Unwind_SetGR = _Unwind_SetGR, +#ifdef HAVE_SJLJ_EXCEPTIONS + ._Unwind_SjLj_Resume = _Unwind_SjLj_Resume, +#else + ._Unwind_Resume = _Unwind_Resume, +#endif +#ifdef OF_AMIGAOS_M68K + .__register_frame_info = __register_frame_info, + .__deregister_frame_info = __deregister_frame_info, +#endif +#ifdef OF_MORPHOS + .__register_frame = __register_frame, + .__deregister_frame = __deregister_frame, +#endif +#ifdef OF_AMIGAOS_M68K + .vsnprintf = vsnprintf, +#endif + .atexit = atexit, + .exit = exit, + }; + + if (initialized) + return; + + if ((ObjFWRTBase = OpenLibrary(OBJFWRT_AMIGA_LIB, + OBJFWRT_LIB_MINOR)) == NULL) + error("Failed to open " OBJFWRT_AMIGA_LIB " version %lu!", + OBJFWRT_LIB_MINOR); + + if (!glue_objc_init(1, &libc)) + error("Failed to initialize " OBJFWRT_AMIGA_LIB "!", 0); + + initialized = true; +} + +static void __attribute__((__used__)) +dtor(void) +{ + CloseLibrary(ObjFWRTBase); +} + +#if defined(OF_AMIGAOS_M68K) +ADD2INIT(ctor, -5); +ADD2EXIT(dtor, -5); +#elif defined(OF_MORPHOS) +CONSTRUCTOR_P(ObjFWRT, 4000) +{ + ctor(); + + return 0; +} + +DESTRUCTOR_P(ObjFWRT, 4000) +{ + dtor(); +} +#endif + +extern int __gnu_objc_personality(int version, int actions, uint64_t *exClass, + void *ex, void *ctx); + +int +#ifdef HAVE_SJLJ_EXCEPTIONS +__gnu_objc_personality_sj0( +#else +__gnu_objc_personality_v0( +#endif + int version, int actions, uint64_t exClass, void *ex, void *ctx) +{ +#ifdef OF_AMIGAOS_M68K + return glue___gnu_objc_personality(version, actions, &exClass, ex, ctx); +#else + return glue___gnu_objc_personality(version, actions, exClass, ex, ctx); +#endif +} Index: src/runtime/linklib/linklib.m ================================================================== --- src/runtime/linklib/linklib.m +++ src/runtime/linklib/linklib.m @@ -13,761 +13,1528 @@ * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ +/* This file is automatically generated from library.xml */ + #include "config.h" #import "ObjFWRT.h" #import "private.h" -#import "macros.h" - -#include -#include - -struct ObjFWRTBase; - -#import "inline.h" - -#include -#include - -#if defined(OF_AMIGAOS_M68K) -# include -# define SYM(name) __asm__("_" name) -#elif defined(OF_MORPHOS) -# include -# define SYM(name) __asm__(name) -#endif - -#ifdef HAVE_SJLJ_EXCEPTIONS -extern int _Unwind_SjLj_RaiseException(void *); -#else -extern int _Unwind_RaiseException(void *); -#endif -extern void _Unwind_DeleteException(void *); -extern void *_Unwind_GetLanguageSpecificData(void *); -extern uintptr_t _Unwind_GetRegionStart(void *); -extern uintptr_t _Unwind_GetDataRelBase(void *); -extern uintptr_t _Unwind_GetTextRelBase(void *); -extern uintptr_t _Unwind_GetIP(void *); -extern uintptr_t _Unwind_GetGR(void *, int); -extern void _Unwind_SetIP(void *, uintptr_t); -extern void _Unwind_SetGR(void *, int, uintptr_t); -#ifdef HAVE_SJLJ_EXCEPTIONS -extern void _Unwind_SjLj_Resume(void *); -#else -extern void _Unwind_Resume(void *); -#endif -#ifdef OF_AMIGAOS_M68K -extern void __register_frame_info(const void *, void *); -extern void *__deregister_frame_info(const void *); -#endif -#ifdef OF_MORPHOS -extern void __register_frame(void *); -extern void __deregister_frame(void *); -#endif - -struct Library *ObjFWRTBase; -void *__objc_class_name_Protocol; - -static void -error(const char *string, ULONG arg) -{ - struct Library *IntuitionBase = OpenLibrary("intuition.library", 0); - - if (IntuitionBase != NULL) { - struct EasyStruct easy = { - .es_StructSize = sizeof(easy), - .es_Flags = 0, - .es_Title = (void *)NULL, - .es_TextFormat = (void *)string, - (void *)"OK" - }; - - EasyRequest(NULL, &easy, NULL, arg); - - CloseLibrary(IntuitionBase); - } - - exit(EXIT_FAILURE); -} - -static void __attribute__((__used__)) -ctor(void) -{ - static bool initialized = false; - struct objc_libc libc = { - .malloc = malloc, - .calloc = calloc, - .realloc = realloc, - .free = free, -#ifdef HAVE_SJLJ_EXCEPTIONS - ._Unwind_SjLj_RaiseException = _Unwind_SjLj_RaiseException, -#else - ._Unwind_RaiseException = _Unwind_RaiseException, -#endif - ._Unwind_DeleteException = _Unwind_DeleteException, - ._Unwind_GetLanguageSpecificData = - _Unwind_GetLanguageSpecificData, - ._Unwind_GetRegionStart = _Unwind_GetRegionStart, - ._Unwind_GetDataRelBase = _Unwind_GetDataRelBase, - ._Unwind_GetTextRelBase = _Unwind_GetTextRelBase, - ._Unwind_GetIP = _Unwind_GetIP, - ._Unwind_GetGR = _Unwind_GetGR, - ._Unwind_SetIP = _Unwind_SetIP, - ._Unwind_SetGR = _Unwind_SetGR, -#ifdef HAVE_SJLJ_EXCEPTIONS - ._Unwind_SjLj_Resume = _Unwind_SjLj_Resume, -#else - ._Unwind_Resume = _Unwind_Resume, -#endif -#ifdef OF_AMIGAOS_M68K - .__register_frame_info = __register_frame_info, - .__deregister_frame_info = __deregister_frame_info, -#endif -#ifdef OF_MORPHOS - .__register_frame = __register_frame, - .__deregister_frame = __deregister_frame, -#endif -#ifdef OF_AMIGAOS_M68K - .vsnprintf = vsnprintf, -#endif - .atexit = atexit, - .exit = exit, - }; - - if (initialized) - return; - - if ((ObjFWRTBase = OpenLibrary(OBJFWRT_AMIGA_LIB, - OBJFWRT_LIB_MINOR)) == NULL) - error("Failed to open " OBJFWRT_AMIGA_LIB " version %lu!", - OBJFWRT_LIB_MINOR); - - if (!glue_objc_init(1, &libc)) - error("Failed to initialize " OBJFWRT_AMIGA_LIB "!", 0); - - initialized = true; -} - -static void __attribute__((__used__)) -dtor(void) -{ - CloseLibrary(ObjFWRTBase); -} - -#if defined(OF_AMIGAOS_M68K) -ADD2INIT(ctor, -2); -ADD2EXIT(dtor, -2); -#elif defined(OF_MORPHOS) -CONSTRUCTOR_P(ObjFWRT, 4000) -{ - ctor(); - - return 0; -} - -DESTRUCTOR_P(ObjFWRT, 4000) -{ - dtor(); -} -#endif - -void -__objc_exec_class(struct objc_module *module) -{ - /* - * The compiler generates constructors that call into this, so it is - * possible that we are not set up yet when we get called. - */ - ctor(); - - glue___objc_exec_class(module); -} - -IMP -objc_msg_lookup(id object, SEL selector) -{ - return glue_objc_msg_lookup(object, selector); -} - -IMP -objc_msg_lookup_stret(id object, SEL selector) -{ - return glue_objc_msg_lookup_stret(object, selector); -} - -IMP -objc_msg_lookup_super(struct objc_super *super, SEL selector) -{ - return glue_objc_msg_lookup_super(super, selector); -} - -IMP -objc_msg_lookup_super_stret(struct objc_super *super, SEL selector) -{ - return glue_objc_msg_lookup_super_stret(super, selector); -} - -Class -objc_lookUpClass(const char *name) -{ - return glue_objc_lookUpClass(name); -} - -Class -objc_getClass(const char *name) -{ - return glue_objc_getClass(name); -} - -Class -objc_getRequiredClass(const char *name) -{ - return glue_objc_getRequiredClass(name); -} - -Class -objc_lookup_class(const char *name) -{ - return glue_objc_lookup_class(name); -} - -Class -objc_get_class(const char *name) -{ - return glue_objc_get_class(name); -} - -void -objc_exception_throw(id object) -{ -#ifdef OF_AMIGAOS_M68K - /* - * This does not use the glue code to hack around a compiler bug. - * - * When using the generated inline stubs, the compiler does not emit - * any frame information, making the unwind fail. As unwind always - * starts from objc_exception_throw(), this means exceptions would - * never work. If, however, we're using a function pointer instead of - * the inline stub, the compiler does generate a frame and everything - * works fine. - */ - register void *a6 __asm__("a6") = ObjFWRTBase; - uintptr_t throw = (((uintptr_t)ObjFWRTBase) - 0x60); - ((void (*)(id __asm__("a0")))throw)(object); - (void)a6; -#else - glue_objc_exception_throw(object); + +extern struct Library *ObjFWRTBase; + +bool +objc_init(unsigned int version, struct objc_libc *libc) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((bool (*)(unsigned int __asm__("d0"), struct objc_libc *__asm__("a0")))(((uintptr_t)ObjFWRTBase) - 30))(version, libc); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((bool (*)(unsigned int, struct objc_libc *))*(void **)(((uintptr_t)ObjFWRTBase) - 28))(version, libc); +#endif +} + +void +__objc_exec_class(struct objc_module *_Nonnull module) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + ((void (*)(struct objc_module *_Nonnull __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 36))(module); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + ((void (*)(struct objc_module *_Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 34))(module); +#endif +} + +IMP _Nonnull +objc_msg_lookup(id _Nullable object, SEL _Nonnull selector) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((IMP _Nonnull (*)(id _Nullable __asm__("a0"), SEL _Nonnull __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 42))(object, selector); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((IMP _Nonnull (*)(id _Nullable, SEL _Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 40))(object, selector); +#endif +} + +IMP _Nonnull +objc_msg_lookup_stret(id _Nullable object, SEL _Nonnull selector) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((IMP _Nonnull (*)(id _Nullable __asm__("a0"), SEL _Nonnull __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 48))(object, selector); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((IMP _Nonnull (*)(id _Nullable, SEL _Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 46))(object, selector); +#endif +} + +IMP _Nonnull +objc_msg_lookup_super(struct objc_super *_Nonnull super, SEL _Nonnull selector) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((IMP _Nonnull (*)(struct objc_super *_Nonnull __asm__("a0"), SEL _Nonnull __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 54))(super, selector); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((IMP _Nonnull (*)(struct objc_super *_Nonnull, SEL _Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 52))(super, selector); +#endif +} + +IMP _Nonnull +objc_msg_lookup_super_stret(struct objc_super *_Nonnull super, SEL _Nonnull selector) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((IMP _Nonnull (*)(struct objc_super *_Nonnull __asm__("a0"), SEL _Nonnull __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 60))(super, selector); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((IMP _Nonnull (*)(struct objc_super *_Nonnull, SEL _Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 58))(super, selector); +#endif +} + +Class _Nullable +objc_lookUpClass(const char *_Nonnull name) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((Class _Nullable (*)(const char *_Nonnull __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 66))(name); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((Class _Nullable (*)(const char *_Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 64))(name); +#endif +} + +Class _Nullable +objc_getClass(const char *_Nonnull name) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((Class _Nullable (*)(const char *_Nonnull __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 72))(name); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((Class _Nullable (*)(const char *_Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 70))(name); +#endif +} + +Class _Nonnull +objc_getRequiredClass(const char *_Nonnull name) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((Class _Nonnull (*)(const char *_Nonnull __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 78))(name); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((Class _Nonnull (*)(const char *_Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 76))(name); +#endif +} + +Class _Nullable +objc_lookup_class(const char *_Nonnull name) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((Class _Nullable (*)(const char *_Nonnull __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 84))(name); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((Class _Nullable (*)(const char *_Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 82))(name); +#endif +} + +Class _Nonnull +objc_get_class(const char *_Nonnull name) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((Class _Nonnull (*)(const char *_Nonnull __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 90))(name); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((Class _Nonnull (*)(const char *_Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 88))(name); +#endif +} + +void +objc_exception_throw(id _Nonnull object) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + ((void (*)(id _Nonnull __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 96))(object); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + ((void (*)(id _Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 94))(object); #endif OF_UNREACHABLE } int -objc_sync_enter(id object) -{ - return glue_objc_sync_enter(object); -} - -int -objc_sync_exit(id object) -{ - return glue_objc_sync_exit(object); -} - -id -objc_getProperty(id self, SEL _cmd, ptrdiff_t offset, bool atomic) -{ - return glue_objc_getProperty(self, _cmd, offset, atomic); -} - -void -objc_setProperty(id self, SEL _cmd, ptrdiff_t offset, id value, bool atomic, - signed char copy) -{ - glue_objc_setProperty(self, _cmd, offset, value, atomic, copy); -} - -void -objc_getPropertyStruct(void *dest, const void *src, ptrdiff_t size, bool atomic, - bool strong) -{ - glue_objc_getPropertyStruct(dest, src, size, atomic, strong); -} - -void -objc_setPropertyStruct(void *dest, const void *src, ptrdiff_t size, bool atomic, - bool strong) -{ - glue_objc_setPropertyStruct(dest, src, size, atomic, strong); -} - -void -objc_enumerationMutation(id object) -{ -#ifdef OF_AMIGAOS_M68K - /* - * This does not use the glue code to hack around a compiler bug. - * - * When using the generated inline stubs, the compiler does not emit - * any frame information, making the unwind fail. As a result - * objc_enumerationMutation() might throw an exception that could never - * be caught. If, however, we're using a function pointer instead of - * the inline stub, the compiler does generate a frame and everything - * works fine. - */ - register void *a6 __asm__("a6") = ObjFWRTBase; - uintptr_t enumerationMutation = (((uintptr_t)ObjFWRTBase) - 0x8A); - ((void (*)(id __asm__("a0")))enumerationMutation)(object); - (void)a6; -#else - glue_objc_enumerationMutation(object); -#endif - - OF_UNREACHABLE -} - -#ifdef HAVE_SJLJ_EXCEPTIONS -int -__gnu_objc_personality_sj0(int version, int actions, uint64_t exClass, - void *ex, void *ctx) -{ -# ifdef OF_AMIGAOS_M68K - return glue___gnu_objc_personality(version, actions, &exClass, ex, ctx); -# else - return glue___gnu_objc_personality(version, actions, exClass, ex, ctx); -# endif -} -#else -int -__gnu_objc_personality_v0(int version, int actions, uint64_t exClass, - void *ex, void *ctx) -{ -# ifdef OF_AMIGAOS_M68K - return glue___gnu_objc_personality(version, actions, &exClass, ex, ctx); -# else - return glue___gnu_objc_personality(version, actions, exClass, ex, ctx); -# endif -} -#endif - -id -objc_retain(id object) -{ - return glue_objc_retain(object); -} - -id -objc_retainBlock(id block) -{ - return glue_objc_retainBlock(block); -} - -id -objc_retainAutorelease(id object) -{ - return glue_objc_retainAutorelease(object); -} - -void -objc_release(id object) -{ - glue_objc_release(object); -} - -id -objc_autorelease(id object) -{ - return glue_objc_autorelease(object); -} - -id -objc_autoreleaseReturnValue(id object) -{ - return glue_objc_autoreleaseReturnValue(object); -} - -id -objc_retainAutoreleaseReturnValue(id object) -{ - return glue_objc_retainAutoreleaseReturnValue(object); -} - -id -objc_retainAutoreleasedReturnValue(id object) -{ - return glue_objc_retainAutoreleasedReturnValue(object); -} - -id -objc_storeStrong(id *object, id value) -{ - return glue_objc_storeStrong(object, value); -} - -id -objc_storeWeak(id *object, id value) -{ - return glue_objc_storeWeak(object, value); -} - -id -objc_loadWeakRetained(id *object) -{ - return glue_objc_loadWeakRetained(object); -} - -id -objc_initWeak(id *object, id value) -{ - return glue_objc_initWeak(object, value); -} - -void -objc_destroyWeak(id *object) -{ - glue_objc_destroyWeak(object); -} - -id -objc_loadWeak(id *object) -{ - return glue_objc_loadWeak(object); -} - -void -objc_copyWeak(id *dest, id *src) -{ - glue_objc_copyWeak(dest, src); -} - -void -objc_moveWeak(id *dest, id *src) -{ - glue_objc_moveWeak(dest, src); -} - -SEL -sel_registerName(const char *name) -{ - return glue_sel_registerName(name); -} - -const char * -sel_getName(SEL selector) -{ - return glue_sel_getName(selector); -} - -bool -sel_isEqual(SEL selector1, SEL selector2) -{ - return glue_sel_isEqual(selector1, selector2); -} - -Class -objc_allocateClassPair(Class superclass, const char *name, size_t extraBytes) -{ - return glue_objc_allocateClassPair(superclass, name, extraBytes); -} - -void -objc_registerClassPair(Class class) -{ - glue_objc_registerClassPair(class); +objc_sync_enter(id _Nullable object) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((int (*)(id _Nullable __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 102))(object); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((int (*)(id _Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 100))(object); +#endif +} + +int +objc_sync_exit(id _Nullable object) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((int (*)(id _Nullable __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 108))(object); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((int (*)(id _Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 106))(object); +#endif +} + +id _Nullable +objc_getProperty(id _Nonnull self, SEL _Nonnull _cmd, ptrdiff_t offset, bool atomic) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((id _Nullable (*)(id _Nonnull __asm__("a0"), SEL _Nonnull __asm__("a1"), ptrdiff_t __asm__("d0"), bool __asm__("d1")))(((uintptr_t)ObjFWRTBase) - 114))(self, _cmd, offset, atomic); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((id _Nullable (*)(id _Nonnull, SEL _Nonnull, ptrdiff_t, bool))*(void **)(((uintptr_t)ObjFWRTBase) - 112))(self, _cmd, offset, atomic); +#endif +} + +void +objc_setProperty(id _Nonnull self, SEL _Nonnull _cmd, ptrdiff_t offset, id _Nullable value, bool atomic, signed char copy) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + ((void (*)(id _Nonnull __asm__("a0"), SEL _Nonnull __asm__("a1"), ptrdiff_t __asm__("d0"), id _Nullable __asm__("a2"), bool __asm__("d1"), signed char __asm__("d2")))(((uintptr_t)ObjFWRTBase) - 120))(self, _cmd, offset, value, atomic, copy); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + ((void (*)(id _Nonnull, SEL _Nonnull, ptrdiff_t, id _Nullable, bool, signed char))*(void **)(((uintptr_t)ObjFWRTBase) - 118))(self, _cmd, offset, value, atomic, copy); +#endif +} + +void +objc_getPropertyStruct(void *_Nonnull dest, const void *_Nonnull src, ptrdiff_t size, bool atomic, bool strong) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + ((void (*)(void *_Nonnull __asm__("a0"), const void *_Nonnull __asm__("a1"), ptrdiff_t __asm__("d0"), bool __asm__("d1"), bool __asm__("d2")))(((uintptr_t)ObjFWRTBase) - 126))(dest, src, size, atomic, strong); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + ((void (*)(void *_Nonnull, const void *_Nonnull, ptrdiff_t, bool, bool))*(void **)(((uintptr_t)ObjFWRTBase) - 124))(dest, src, size, atomic, strong); +#endif +} + +void +objc_setPropertyStruct(void *_Nonnull dest, const void *_Nonnull src, ptrdiff_t size, bool atomic, bool strong) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + ((void (*)(void *_Nonnull __asm__("a0"), const void *_Nonnull __asm__("a1"), ptrdiff_t __asm__("d0"), bool __asm__("d1"), bool __asm__("d2")))(((uintptr_t)ObjFWRTBase) - 132))(dest, src, size, atomic, strong); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + ((void (*)(void *_Nonnull, const void *_Nonnull, ptrdiff_t, bool, bool))*(void **)(((uintptr_t)ObjFWRTBase) - 130))(dest, src, size, atomic, strong); +#endif +} + +void +objc_enumerationMutation(id _Nonnull object) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + ((void (*)(id _Nonnull __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 138))(object); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + ((void (*)(id _Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 136))(object); +#endif +} + +int +__gnu_objc_personality(int version, int actions, uint64_t *_Nonnull exClass, void *_Nonnull ex, void *_Nonnull ctx) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((int (*)(int __asm__("d0"), int __asm__("d1"), uint64_t *_Nonnull __asm__("d2"), void *_Nonnull __asm__("a0"), void *_Nonnull __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 144))(version, actions, exClass, ex, ctx); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((int (*)(int, int, uint64_t *_Nonnull, void *_Nonnull, void *_Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 142))(version, actions, exClass, ex, ctx); +#endif +} + +id _Nullable +objc_retain(id _Nullable object) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((id _Nullable (*)(id _Nullable __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 150))(object); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((id _Nullable (*)(id _Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 148))(object); +#endif +} + +id _Nullable +objc_retainBlock(id _Nullable block) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((id _Nullable (*)(id _Nullable __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 156))(block); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((id _Nullable (*)(id _Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 154))(block); +#endif +} + +id _Nullable +objc_retainAutorelease(id _Nullable object) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((id _Nullable (*)(id _Nullable __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 162))(object); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((id _Nullable (*)(id _Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 160))(object); +#endif +} + +void +objc_release(id _Nullable object) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + ((void (*)(id _Nullable __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 168))(object); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + ((void (*)(id _Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 166))(object); +#endif +} + +id _Nullable +objc_autorelease(id _Nullable object) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((id _Nullable (*)(id _Nullable __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 174))(object); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((id _Nullable (*)(id _Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 172))(object); +#endif +} + +id _Nullable +objc_autoreleaseReturnValue(id _Nullable object) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((id _Nullable (*)(id _Nullable __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 180))(object); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((id _Nullable (*)(id _Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 178))(object); +#endif +} + +id _Nullable +objc_retainAutoreleaseReturnValue(id _Nullable object) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((id _Nullable (*)(id _Nullable __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 186))(object); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((id _Nullable (*)(id _Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 184))(object); +#endif +} + +id _Nullable +objc_retainAutoreleasedReturnValue(id _Nullable object) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((id _Nullable (*)(id _Nullable __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 192))(object); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((id _Nullable (*)(id _Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 190))(object); +#endif +} + +id _Nullable +objc_storeStrong(id _Nullable *_Nonnull object, id _Nullable value) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((id _Nullable (*)(id _Nullable *_Nonnull __asm__("a0"), id _Nullable __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 198))(object, value); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((id _Nullable (*)(id _Nullable *_Nonnull, id _Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 196))(object, value); +#endif +} + +id _Nullable +objc_storeWeak(id _Nullable *_Nonnull object, id _Nullable value) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((id _Nullable (*)(id _Nullable *_Nonnull __asm__("a0"), id _Nullable __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 204))(object, value); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((id _Nullable (*)(id _Nullable *_Nonnull, id _Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 202))(object, value); +#endif +} + +id _Nullable +objc_loadWeakRetained(id _Nullable *_Nonnull object) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((id _Nullable (*)(id _Nullable *_Nonnull __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 210))(object); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((id _Nullable (*)(id _Nullable *_Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 208))(object); +#endif +} + +id _Nullable +objc_initWeak(id _Nullable *_Nonnull object, id _Nullable value) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((id _Nullable (*)(id _Nullable *_Nonnull __asm__("a0"), id _Nullable __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 216))(object, value); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((id _Nullable (*)(id _Nullable *_Nonnull, id _Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 214))(object, value); +#endif +} + +void +objc_destroyWeak(id _Nullable *_Nonnull object) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + ((void (*)(id _Nullable *_Nonnull __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 222))(object); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + ((void (*)(id _Nullable *_Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 220))(object); +#endif +} + +id _Nullable +objc_loadWeak(id _Nullable *_Nonnull object) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((id _Nullable (*)(id _Nullable *_Nonnull __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 228))(object); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((id _Nullable (*)(id _Nullable *_Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 226))(object); +#endif +} + +void +objc_copyWeak(id _Nullable *_Nonnull dest, id _Nullable *_Nonnull src) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + ((void (*)(id _Nullable *_Nonnull __asm__("a0"), id _Nullable *_Nonnull __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 234))(dest, src); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + ((void (*)(id _Nullable *_Nonnull, id _Nullable *_Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 232))(dest, src); +#endif +} + +void +objc_moveWeak(id _Nullable *_Nonnull dest, id _Nullable *_Nonnull src) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + ((void (*)(id _Nullable *_Nonnull __asm__("a0"), id _Nullable *_Nonnull __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 240))(dest, src); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + ((void (*)(id _Nullable *_Nonnull, id _Nullable *_Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 238))(dest, src); +#endif +} + +SEL _Nonnull +sel_registerName(const char *_Nonnull name) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((SEL _Nonnull (*)(const char *_Nonnull __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 246))(name); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((SEL _Nonnull (*)(const char *_Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 244))(name); +#endif +} + +const char *_Nonnull +sel_getName(SEL _Nonnull selector) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((const char *_Nonnull (*)(SEL _Nonnull __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 252))(selector); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((const char *_Nonnull (*)(SEL _Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 250))(selector); +#endif +} + +bool +sel_isEqual(SEL _Nonnull selector1, SEL _Nonnull selector2) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((bool (*)(SEL _Nonnull __asm__("a0"), SEL _Nonnull __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 258))(selector1, selector2); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((bool (*)(SEL _Nonnull, SEL _Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 256))(selector1, selector2); +#endif +} + +Class _Nonnull +objc_allocateClassPair(Class _Nullable superclass, const char *_Nonnull name, size_t extraBytes) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((Class _Nonnull (*)(Class _Nullable __asm__("a0"), const char *_Nonnull __asm__("a1"), size_t __asm__("d0")))(((uintptr_t)ObjFWRTBase) - 264))(superclass, name, extraBytes); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((Class _Nonnull (*)(Class _Nullable, const char *_Nonnull, size_t))*(void **)(((uintptr_t)ObjFWRTBase) - 262))(superclass, name, extraBytes); +#endif +} + +void +objc_registerClassPair(Class _Nonnull class) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + ((void (*)(Class _Nonnull __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 270))(class); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + ((void (*)(Class _Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 268))(class); +#endif } unsigned int -objc_getClassList(Class *buffer, unsigned int count) +objc_getClassList(Class _Nonnull *_Nullable buffer, unsigned int count) { - return glue_objc_getClassList(buffer, count); +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((unsigned int (*)(Class _Nonnull *_Nullable __asm__("a0"), unsigned int __asm__("d0")))(((uintptr_t)ObjFWRTBase) - 276))(buffer, count); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((unsigned int (*)(Class _Nonnull *_Nullable, unsigned int))*(void **)(((uintptr_t)ObjFWRTBase) - 274))(buffer, count); +#endif } -Class * -objc_copyClassList(unsigned int *length) +Class _Nonnull *_Nonnull +objc_copyClassList(unsigned int *_Nullable length) { - return glue_objc_copyClassList(length); +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((Class _Nonnull *_Nonnull (*)(unsigned int *_Nullable __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 282))(length); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((Class _Nonnull *_Nonnull (*)(unsigned int *_Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 280))(length); +#endif } bool -class_isMetaClass(Class class) -{ - return glue_class_isMetaClass(class); -} - -const char * -class_getName(Class class) -{ - return glue_class_getName(class); -} - -Class -class_getSuperclass(Class class) -{ - return glue_class_getSuperclass(class); +class_isMetaClass(Class _Nullable class) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((bool (*)(Class _Nullable __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 288))(class); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((bool (*)(Class _Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 286))(class); +#endif +} + +const char *_Nullable +class_getName(Class _Nullable class) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((const char *_Nullable (*)(Class _Nullable __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 294))(class); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((const char *_Nullable (*)(Class _Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 292))(class); +#endif +} + +Class _Nullable +class_getSuperclass(Class _Nullable class) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((Class _Nullable (*)(Class _Nullable __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 300))(class); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((Class _Nullable (*)(Class _Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 298))(class); +#endif } unsigned long -class_getInstanceSize(Class class) -{ - return glue_class_getInstanceSize(class); -} - -bool -class_respondsToSelector(Class class, SEL selector) -{ - return glue_class_respondsToSelector(class, selector); -} - -bool -class_conformsToProtocol(Class class, Protocol *protocol) -{ - return glue_class_conformsToProtocol(class, protocol); -} - -IMP -class_getMethodImplementation(Class class, SEL selector) -{ - return glue_class_getMethodImplementation(class, selector); -} - -IMP -class_getMethodImplementation_stret(Class class, SEL selector) -{ - return glue_class_getMethodImplementation_stret(class, selector); -} - -Method -class_getInstanceMethod(Class class, SEL selector) -{ - return glue_class_getInstanceMethod(class, selector); -} - -bool -class_addMethod(Class class, SEL selector, IMP implementation, - const char *typeEncoding) -{ - return glue_class_addMethod(class, selector, implementation, - typeEncoding); -} - -IMP -class_replaceMethod(Class class, SEL selector, IMP implementation, - const char *typeEncoding) -{ - return glue_class_replaceMethod(class, selector, implementation, - typeEncoding); -} - -Class -object_getClass(id object) -{ - return glue_object_getClass(object); -} - -Class -object_setClass(id object, Class class) -{ - return glue_object_setClass(object, class); -} - -const char * -object_getClassName(id object) -{ - return glue_object_getClassName(object); -} - -const char * -protocol_getName(Protocol *protocol) -{ - return glue_protocol_getName(protocol); -} - -bool -protocol_isEqual(Protocol *protocol1, Protocol *protocol2) -{ - return glue_protocol_isEqual(protocol1, protocol2); -} - -bool -protocol_conformsToProtocol(Protocol *protocol1, Protocol *protocol2) -{ - return glue_protocol_conformsToProtocol(protocol1, protocol2); -} - -objc_uncaught_exception_handler_t -objc_setUncaughtExceptionHandler(objc_uncaught_exception_handler_t handler) -{ - return glue_objc_setUncaughtExceptionHandler(handler); -} - -void -objc_setForwardHandler(IMP forward, IMP stretForward) -{ - glue_objc_setForwardHandler(forward, stretForward); -} - -void -objc_setEnumerationMutationHandler(objc_enumeration_mutation_handler_t handler) -{ - glue_objc_setEnumerationMutationHandler(handler); -} - -id -objc_constructInstance(Class class, void *_Nullable bytes) -{ - return glue_objc_constructInstance(class, bytes); -} - -void -objc_exit(void) -{ - glue_objc_exit(); -} - -Ivar * -class_copyIvarList(Class class, unsigned int *outCount) -{ - return glue_class_copyIvarList(class, outCount); -} - -const char * -ivar_getName(Ivar ivar) -{ - return glue_ivar_getName(ivar); -} - -const char * -ivar_getTypeEncoding(Ivar ivar) -{ - return glue_ivar_getTypeEncoding(ivar); -} - -ptrdiff_t -ivar_getOffset(Ivar ivar) -{ - return glue_ivar_getOffset(ivar); -} - -Method * -class_copyMethodList(Class class, unsigned int *outCount) -{ - return glue_class_copyMethodList(class, outCount); -} - -SEL -method_getName(Method method) -{ - return glue_method_getName(method); -} - -const char * -method_getTypeEncoding(Method method) -{ - return glue_method_getTypeEncoding(method); -} - -objc_property_t * -class_copyPropertyList(Class class, unsigned int *outCount) -{ - return glue_class_copyPropertyList(class, outCount); -} - -const char * -property_getName(objc_property_t property) -{ - return glue_property_getName(property); -} - -char * -property_copyAttributeValue(objc_property_t property, const char *name) -{ - return glue_property_copyAttributeValue(property, name); -} - -void * -objc_destructInstance(id object) -{ - return glue_objc_destructInstance(object); -} - -void * -objc_autoreleasePoolPush(void) -{ - return glue_objc_autoreleasePoolPush(); -} - -void -objc_autoreleasePoolPop(void *pool) -{ - glue_objc_autoreleasePoolPop(pool); -} - -id -_objc_rootAutorelease(id object) -{ - return glue__objc_rootAutorelease(object); -} - -struct objc_hashtable * -objc_hashtable_new(objc_hashtable_hash_func hash, - objc_hashtable_equal_func equal, uint32_t size) -{ - return glue_objc_hashtable_new(hash, equal, size); -} - -void -objc_hashtable_set(struct objc_hashtable *table, const void *key, - const void *object) -{ - glue_objc_hashtable_set(table, key, object); -} - -void * -objc_hashtable_get(struct objc_hashtable *table, const void *key) -{ - return glue_objc_hashtable_get(table, key); -} - -void -objc_hashtable_delete(struct objc_hashtable *table, const void *key) -{ - glue_objc_hashtable_delete(table, key); -} - -void -objc_hashtable_free(struct objc_hashtable *table) -{ - glue_objc_hashtable_free(table); +class_getInstanceSize(Class _Nullable class) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((unsigned long (*)(Class _Nullable __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 306))(class); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((unsigned long (*)(Class _Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 304))(class); +#endif +} + +bool +class_respondsToSelector(Class _Nullable class, SEL _Nonnull selector) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((bool (*)(Class _Nullable __asm__("a0"), SEL _Nonnull __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 312))(class, selector); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((bool (*)(Class _Nullable, SEL _Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 310))(class, selector); +#endif +} + +bool +class_conformsToProtocol(Class _Nullable class, Protocol *_Nonnull p) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((bool (*)(Class _Nullable __asm__("a0"), Protocol *_Nonnull __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 318))(class, p); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((bool (*)(Class _Nullable, Protocol *_Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 316))(class, p); +#endif +} + +IMP _Nullable +class_getMethodImplementation(Class _Nullable class, SEL _Nonnull selector) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((IMP _Nullable (*)(Class _Nullable __asm__("a0"), SEL _Nonnull __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 324))(class, selector); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((IMP _Nullable (*)(Class _Nullable, SEL _Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 322))(class, selector); +#endif +} + +IMP _Nullable +class_getMethodImplementation_stret(Class _Nullable class, SEL _Nonnull selector) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((IMP _Nullable (*)(Class _Nullable __asm__("a0"), SEL _Nonnull __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 330))(class, selector); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((IMP _Nullable (*)(Class _Nullable, SEL _Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 328))(class, selector); +#endif +} + +Method _Nullable +class_getInstanceMethod(Class _Nullable class, SEL _Nonnull selector) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((Method _Nullable (*)(Class _Nullable __asm__("a0"), SEL _Nonnull __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 336))(class, selector); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((Method _Nullable (*)(Class _Nullable, SEL _Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 334))(class, selector); +#endif +} + +bool +class_addMethod(Class _Nonnull class, SEL _Nonnull selector, IMP _Nonnull implementation, const char *_Nullable typeEncoding) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((bool (*)(Class _Nonnull __asm__("a0"), SEL _Nonnull __asm__("a1"), IMP _Nonnull __asm__("a2"), const char *_Nullable __asm__("a3")))(((uintptr_t)ObjFWRTBase) - 342))(class, selector, implementation, typeEncoding); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((bool (*)(Class _Nonnull, SEL _Nonnull, IMP _Nonnull, const char *_Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 340))(class, selector, implementation, typeEncoding); +#endif +} + +IMP _Nullable +class_replaceMethod(Class _Nonnull class, SEL _Nonnull selector, IMP _Nonnull implementation, const char *_Nullable typeEncoding) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((IMP _Nullable (*)(Class _Nonnull __asm__("a0"), SEL _Nonnull __asm__("a1"), IMP _Nonnull __asm__("a2"), const char *_Nullable __asm__("a3")))(((uintptr_t)ObjFWRTBase) - 348))(class, selector, implementation, typeEncoding); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((IMP _Nullable (*)(Class _Nonnull, SEL _Nonnull, IMP _Nonnull, const char *_Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 346))(class, selector, implementation, typeEncoding); +#endif +} + +Class _Nullable +object_getClass(id _Nullable object) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((Class _Nullable (*)(id _Nullable __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 354))(object); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((Class _Nullable (*)(id _Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 352))(object); +#endif +} + +Class _Nullable +object_setClass(id _Nullable object, Class _Nonnull class) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((Class _Nullable (*)(id _Nullable __asm__("a0"), Class _Nonnull __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 360))(object, class); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((Class _Nullable (*)(id _Nullable, Class _Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 358))(object, class); +#endif +} + +const char *_Nullable +object_getClassName(id _Nullable object) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((const char *_Nullable (*)(id _Nullable __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 366))(object); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((const char *_Nullable (*)(id _Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 364))(object); +#endif +} + +const char *_Nonnull +protocol_getName(Protocol *_Nonnull protocol) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((const char *_Nonnull (*)(Protocol *_Nonnull __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 372))(protocol); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((const char *_Nonnull (*)(Protocol *_Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 370))(protocol); +#endif +} + +bool +protocol_isEqual(Protocol *_Nonnull protocol1, Protocol *_Nonnull protocol2) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((bool (*)(Protocol *_Nonnull __asm__("a0"), Protocol *_Nonnull __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 378))(protocol1, protocol2); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((bool (*)(Protocol *_Nonnull, Protocol *_Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 376))(protocol1, protocol2); +#endif +} + +bool +protocol_conformsToProtocol(Protocol *_Nonnull protocol1, Protocol *_Nonnull protocol2) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((bool (*)(Protocol *_Nonnull __asm__("a0"), Protocol *_Nonnull __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 384))(protocol1, protocol2); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((bool (*)(Protocol *_Nonnull, Protocol *_Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 382))(protocol1, protocol2); +#endif +} + +_Nullable objc_uncaught_exception_handler_t +objc_setUncaughtExceptionHandler(objc_uncaught_exception_handler_t _Nullable handler) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((_Nullable objc_uncaught_exception_handler_t (*)(objc_uncaught_exception_handler_t _Nullable __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 390))(handler); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((_Nullable objc_uncaught_exception_handler_t (*)(objc_uncaught_exception_handler_t _Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 388))(handler); +#endif +} + +void +objc_setForwardHandler(IMP _Nullable forward, IMP _Nullable stretForward) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + ((void (*)(IMP _Nullable __asm__("a0"), IMP _Nullable __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 396))(forward, stretForward); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + ((void (*)(IMP _Nullable, IMP _Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 394))(forward, stretForward); +#endif +} + +void +objc_setEnumerationMutationHandler(objc_enumeration_mutation_handler_t _Nullable hadler) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + ((void (*)(objc_enumeration_mutation_handler_t _Nullable __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 402))(hadler); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + ((void (*)(objc_enumeration_mutation_handler_t _Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 400))(hadler); +#endif +} + +id _Nullable +objc_constructInstance(Class _Nullable class, void *_Nullable bytes) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((id _Nullable (*)(Class _Nullable __asm__("a0"), void *_Nullable __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 408))(class, bytes); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((id _Nullable (*)(Class _Nullable, void *_Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 406))(class, bytes); +#endif +} + +void +objc_exit() +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + ((void (*)())(((uintptr_t)ObjFWRTBase) - 414))(); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + ((void (*)())*(void **)(((uintptr_t)ObjFWRTBase) - 412))(); +#endif +} + +Ivar _Nullable *_Nullable +class_copyIvarList(Class _Nullable class, unsigned int *_Nullable outCount) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((Ivar _Nullable *_Nullable (*)(Class _Nullable __asm__("a0"), unsigned int *_Nullable __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 420))(class, outCount); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((Ivar _Nullable *_Nullable (*)(Class _Nullable, unsigned int *_Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 418))(class, outCount); +#endif +} + +const char *_Nonnull +ivar_getName(Ivar _Nonnull ivar) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((const char *_Nonnull (*)(Ivar _Nonnull __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 426))(ivar); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((const char *_Nonnull (*)(Ivar _Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 424))(ivar); +#endif +} + +const char *_Nonnull +ivar_getTypeEncoding(Ivar _Nonnull ivar) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((const char *_Nonnull (*)(Ivar _Nonnull __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 432))(ivar); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((const char *_Nonnull (*)(Ivar _Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 430))(ivar); +#endif +} + +ptrdiff_t +ivar_getOffset(Ivar _Nonnull ivar) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((ptrdiff_t (*)(Ivar _Nonnull __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 438))(ivar); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((ptrdiff_t (*)(Ivar _Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 436))(ivar); +#endif +} + +Method _Nullable *_Nullable +class_copyMethodList(Class _Nullable class, unsigned int *_Nullable outCount) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((Method _Nullable *_Nullable (*)(Class _Nullable __asm__("a0"), unsigned int *_Nullable __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 444))(class, outCount); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((Method _Nullable *_Nullable (*)(Class _Nullable, unsigned int *_Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 442))(class, outCount); +#endif +} + +SEL _Nonnull +method_getName(Method _Nonnull method) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((SEL _Nonnull (*)(Method _Nonnull __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 450))(method); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((SEL _Nonnull (*)(Method _Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 448))(method); +#endif +} + +const char *_Nullable +method_getTypeEncoding(Method _Nonnull method) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((const char *_Nullable (*)(Method _Nonnull __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 456))(method); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((const char *_Nullable (*)(Method _Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 454))(method); +#endif +} + +objc_property_t _Nullable *_Nullable +class_copyPropertyList(Class _Nullable class, unsigned int *_Nullable outCount) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((objc_property_t _Nullable *_Nullable (*)(Class _Nullable __asm__("a0"), unsigned int *_Nullable __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 462))(class, outCount); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((objc_property_t _Nullable *_Nullable (*)(Class _Nullable, unsigned int *_Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 460))(class, outCount); +#endif +} + +const char *_Nonnull +property_getName(objc_property_t _Nonnull property) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((const char *_Nonnull (*)(objc_property_t _Nonnull __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 468))(property); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((const char *_Nonnull (*)(objc_property_t _Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 466))(property); +#endif +} + +char *_Nullable +property_copyAttributeValue(objc_property_t _Nonnull property, const char *_Nonnull name) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((char *_Nullable (*)(objc_property_t _Nonnull __asm__("a0"), const char *_Nonnull __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 474))(property, name); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((char *_Nullable (*)(objc_property_t _Nonnull, const char *_Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 472))(property, name); +#endif +} + +void *_Nullable +objc_destructInstance(id _Nullable object) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((void *_Nullable (*)(id _Nullable __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 480))(object); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((void *_Nullable (*)(id _Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 478))(object); +#endif +} + +void *_Null_unspecified +objc_autoreleasePoolPush() +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((void *_Null_unspecified (*)())(((uintptr_t)ObjFWRTBase) - 486))(); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((void *_Null_unspecified (*)())*(void **)(((uintptr_t)ObjFWRTBase) - 484))(); +#endif +} + +void +objc_autoreleasePoolPop(void *_Null_unspecified pool) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + ((void (*)(void *_Null_unspecified __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 492))(pool); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + ((void (*)(void *_Null_unspecified))*(void **)(((uintptr_t)ObjFWRTBase) - 490))(pool); +#endif +} + +id _Nullable +_objc_rootAutorelease(id _Nullable object) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((id _Nullable (*)(id _Nullable __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 498))(object); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((id _Nullable (*)(id _Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 496))(object); +#endif +} + +struct objc_hashtable *_Nonnull +objc_hashtable_new(objc_hashtable_hash_func hash, objc_hashtable_equal_func equal, uint32_t size) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((struct objc_hashtable *_Nonnull (*)(objc_hashtable_hash_func __asm__("a0"), objc_hashtable_equal_func __asm__("a1"), uint32_t __asm__("d0")))(((uintptr_t)ObjFWRTBase) - 504))(hash, equal, size); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((struct objc_hashtable *_Nonnull (*)(objc_hashtable_hash_func, objc_hashtable_equal_func, uint32_t))*(void **)(((uintptr_t)ObjFWRTBase) - 502))(hash, equal, size); +#endif +} + +void +objc_hashtable_set(struct objc_hashtable *_Nonnull table, const void *_Nonnull key, const void *_Nonnull object) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + ((void (*)(struct objc_hashtable *_Nonnull __asm__("a0"), const void *_Nonnull __asm__("a1"), const void *_Nonnull __asm__("a2")))(((uintptr_t)ObjFWRTBase) - 510))(table, key, object); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + ((void (*)(struct objc_hashtable *_Nonnull, const void *_Nonnull, const void *_Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 508))(table, key, object); +#endif +} + +void *_Nullable +objc_hashtable_get(struct objc_hashtable *_Nonnull table, const void *_Nonnull key) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((void *_Nullable (*)(struct objc_hashtable *_Nonnull __asm__("a0"), const void *_Nonnull __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 516))(table, key); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((void *_Nullable (*)(struct objc_hashtable *_Nonnull, const void *_Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 514))(table, key); +#endif +} + +void +objc_hashtable_delete(struct objc_hashtable *_Nonnull table, const void *_Nonnull key) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + ((void (*)(struct objc_hashtable *_Nonnull __asm__("a0"), const void *_Nonnull __asm__("a1")))(((uintptr_t)ObjFWRTBase) - 522))(table, key); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + ((void (*)(struct objc_hashtable *_Nonnull, const void *_Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 520))(table, key); +#endif +} + +void +objc_hashtable_free(struct objc_hashtable *_Nonnull table) +{ +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + ((void (*)(struct objc_hashtable *_Nonnull __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 528))(table); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + ((void (*)(struct objc_hashtable *_Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 526))(table); +#endif } void objc_setTaggedPointerSecret(uintptr_t secret) { - glue_objc_setTaggedPointerSecret(secret); +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + ((void (*)(uintptr_t __asm__("d0")))(((uintptr_t)ObjFWRTBase) - 534))(secret); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + ((void (*)(uintptr_t))*(void **)(((uintptr_t)ObjFWRTBase) - 532))(secret); +#endif } int -objc_registerTaggedPointerClass(Class class) +objc_registerTaggedPointerClass(Class _Nonnull class) { - return glue_objc_registerTaggedPointerClass(class); +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((int (*)(Class _Nonnull __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 540))(class); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((int (*)(Class _Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 538))(class); +#endif } bool -object_isTaggedPointer(id object) +object_isTaggedPointer(id _Nullable object) { - return glue_object_isTaggedPointer(object); +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((bool (*)(id _Nullable __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 546))(object); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((bool (*)(id _Nullable))*(void **)(((uintptr_t)ObjFWRTBase) - 544))(object); +#endif } uintptr_t -object_getTaggedPointerValue(id object) +object_getTaggedPointerValue(id _Nonnull object) { - return glue_object_getTaggedPointerValue(object); +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((uintptr_t (*)(id _Nonnull __asm__("a0")))(((uintptr_t)ObjFWRTBase) - 552))(object); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((uintptr_t (*)(id _Nonnull))*(void **)(((uintptr_t)ObjFWRTBase) - 550))(object); +#endif } -id +id _Nullable objc_createTaggedPointer(int class, uintptr_t value) { - return glue_objc_createTaggedPointer(class, value); +#if defined(OF_AMIGAOS_M68K) + register struct Library *a6 __asm__("a6") = ObjFWRTBase; + (void)a6; + return ((id _Nullable (*)(int __asm__("d0"), uintptr_t __asm__("d1")))(((uintptr_t)ObjFWRTBase) - 558))(class, value); +#elif defined(OF_MORPHOS) + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWRTBase) : "r12" + ); + + return ((id _Nullable (*)(int, uintptr_t))*(void **)(((uintptr_t)ObjFWRTBase) - 556))(class, value); +#endif }