@@ -15,10 +15,11 @@ * file. */ #include "config.h" +#include #include #include #include "ObjFWRT.h" #include "private.h" @@ -26,11 +27,13 @@ #ifdef OF_AMIGAOS # define USE_INLINE_STDARG # include # include # define __NOLIBBASE__ +# define Class IntuitionClass # include +# undef Class # undef __NOLIBBASE__ #endif static objc_enumeration_mutation_handler_t enumerationMutationHandler = NULL; @@ -57,10 +60,14 @@ char title[BUF_LEN]; char message[BUF_LEN]; int status; va_list args; struct Library *IntuitionBase; +# ifdef OF_AMIGAOS4 + struct IntuitionIFace *IIntuition; +# endif + struct EasyStruct easy; status = snprintf(title, BUF_LEN, "ObjFWRT @ %s:%u", file, line); if (status <= 0 || status >= BUF_LEN) title[0] = '\0'; @@ -68,26 +75,36 @@ status = vsnprintf(message, BUF_LEN, format, args); if (status <= 0 || status >= BUF_LEN) message[0] = '\0'; va_end(args); +# ifndef OF_AMIGAOS4 kprintf("[%s] %s\n", title, message); - - IntuitionBase = OpenLibrary("intuition.library", 0); - if (IntuitionBase != NULL) { - struct EasyStruct easy = { - .es_StructSize = sizeof(easy), - .es_Flags = 0, - .es_Title = (UBYTE *)title, - .es_TextFormat = (UBYTE *)"%s", - (UBYTE *)"OK" - }; - - EasyRequest(NULL, &easy, NULL, (ULONG)message); - - CloseLibrary(IntuitionBase); - } +# endif + + if ((IntuitionBase = OpenLibrary("intuition.library", 0)) == NULL) + exit(EXIT_FAILURE); + +# ifdef OF_AMIGAOS4 + if ((IIntuition = (struct IntuitionIFace *)GetInterface(IntuitionBase, + "main", 1, NULL)) == NULL) + exit(EXIT_FAILURE); +# endif + + easy.es_StructSize = sizeof(easy); + easy.es_Flags = 0; + easy.es_Title = (void *)title; + easy.es_TextFormat = (void *)"%s"; + easy.es_GadgetFormat = (void *)"OK"; + + EasyRequest(NULL, &easy, NULL, (ULONG)message); + +# ifdef OF_AMIGAOS4 + DropInterface((struct Interface *)IIntuition); +# endif + + CloseLibrary(IntuitionBase); exit(EXIT_FAILURE); # undef BUF_LEN #else va_list args;