revert between 56095 -> 55830 in arch
[AROS.git] / arch / all-ios / kernel / _displayalert.c
blobf48db949b092e1e5333ea4fa0fe7c54fd4641da4
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Display an alert, iOS-hosted version
6 Lang: english
7 */
9 #include <aros/atomic.h>
10 #include <aros/libcall.h>
11 #include <proto/exec.h>
13 #include <inttypes.h>
14 #include <signal.h>
16 #include "hostinterface.h"
17 #include "kernel_base.h"
18 #include "kernel_debug.h"
19 #include "kernel_intern.h"
20 #include "kernel_unix.h"
22 static void (*displayAlert)(const char *text) = NULL;
24 void krnDisplayAlert(const char *text, struct KernelBase *KernelBase)
26 if (!displayAlert)
29 * Early alert. call hook is not initialized yet.
30 * Fail back to debug output.
32 bug(text);
33 return;
36 /* Display the alert via our UIKit helper */
37 displayAlert(text);
38 AROS_HOST_BARRIER
41 static int Alert_Init(void *libc)
43 APTR libHandle;
44 char *err;
47 * We use local variable for the handle because we never expunge
48 * so we will never close it
50 libHandle = HostIFace->hostlib_Open("Libs/Host/uikit_hidd.dylib", &err);
51 if (!libHandle)
53 bug("Failed to load uikit_hidd.dylib: %s\n", err);
54 return FALSE;
57 displayAlert = HostIFace->hostlib_GetPointer(libHandle, "DisplayAlert", &err);
58 if (displayAlert)
59 return TRUE;
61 HostIFace->hostlib_Close(libHandle, NULL);
63 bug("Failed to load DisplayAlert helper: %s\n", err);
64 return FALSE;
67 ADD2SET(Alert_Init, STARTUP, 0);