1 #ifndef __GURU_MEDITATION_h_20130422__
2 #define __GURU_MEDITATION_h_20130422__
3 #include <SDL/SDL_video.h>
4 
5 /* Colours... just for the fun of it! */
6 #define GM_FLAGS_YELLOW		0x0000 //!< Colour choice... yellow.
7 #define GM_FLAGS_RECOVERY	0x0000 //!< Recovery alert, colour choice... yellow.
8 #define GM_FLAGS_DEADEND	0x0001 //!< Colour choice... red. Never return from this alert!
9 #define GM_FLAGS_GREEN		0x0002 //!< Colour choice... green.
10 #define GM_FLAGS_BLUE		0x0003 //!< Colour choice... blue.
11 #define GM_FLAGS_CHOICE		0x0800 //!< Press left to retry, right to abort... is being displayed.
12 #define GM_FLAGS_AUTOTIMEOUT	0x2000 //!< Flash a few times and then continue
13 #define GM_FLAGS_EXIT_VIA_TERM	0x4000 //!< Do not use the exit() function but raise(SIGTERM).
14 #define GM_FLAGS_ABORTIFY	0x8000 //!< Pressing the right mouse button will call abort().
15 
16 /* ---------- 8< ---------- */
17 /* These are actually the classic errors found on the Amiga. Use them
18    on your own risk... */
19 
20 /* Classic subsystems */
21 #define GM_SS_Exec	 0x01000000
22 #define GM_SS_Graphics	 0x02000000
23 #define GM_SS_Layers	 0x03000000
24 #define GM_SS_Intuition	 0x04000000
25 #define GM_SS_Math	 0x05000000
26 #define GM_SS_Clist	 0x06000000
27 #define GM_SS_DOS	 0x07000000
28 #define GM_SS_RAM	 0x08000000
29 #define GM_SS_ICON	 0x09000000
30 #define GM_SS_Expansion	 0x0A000000
31 #define GM_SS_Audio	 0x10000000
32 #define GM_SS_Console	 0x11000000
33 #define GM_SS_GamePort	 0x12000000
34 #define GM_SS_KeyBoard	 0x13000000
35 #define GM_SS_TrackDisk	 0x14000000
36 #define GM_SS_Timer	 0x15000000
37 #define GM_SS_CIA	 0x20000000
38 #define GM_SS_Disk	 0x21000000
39 #define GM_SS_Misc	 0x22000000
40 #define GM_SS_BootStrap	 0x30000000
41 #define GM_SS_WorkBench	 0x31000000
42 #define GM_SS_DiskCopy	 0x32000000
43 
44 /* Classic general errors */
45 #define GM_GE_NoMemory	 0x00010000
46 #define GM_GE_MakeLib	 0x00020000
47 #define GM_GE_OpenLib	 0x00030000
48 #define GM_GE_OpenDev	 0x00040000
49 #define GM_GE_OpenRes	 0x00050000
50 #define GM_GE_IOError	 0x00060000
51 #define GM_GE_NoSignal	 0x00070000
52 #define GM_GE_BadParm	 0x00080000
53 #define GM_GE_CloseLib	 0x00090000
54 #define GM_GE_CloseDev	 0x000A0000
55 #define GM_GE_ProcCreate 0x000B0000
56 
57 /*! \brief General purpose guru meditation display
58  *
59  * This function displays a Guru Meditation with subsystem, address
60  * and text.
61  *
62  * This is only a display function! It will always return and will not
63  * honor abort or deadend alerts (only make the appropriate changes to
64  * the display). If you use GM_FLAGS_DEADEND the colour of the border
65  * will be *always* red!
66  *
67  * \param ts target surface to display guru meditation on
68  * \param flags or'ed together GM_FLAGS_*
69  * \param subsystem subsystem id, define your own or use the Amiga ones
70  * \param address adress where something happened
71  * \param atext a text to display
72  * \return which mouse button was pressed
73  */
74 int guru_display_gp(SDL_Surface *ts, unsigned short flags, Uint32 subsystem, void *address, const char *atext);
75 
76 /*! \brief Display Guru Meditation Alert
77  *
78  * This function just displays a guru meditation alert. In contrast to
79  * guru_meditation() this function will ignore the GM_FLAGS_DEADEND
80  * flag. GM_FLAGS_ABORTIFY is honored, though.
81  *
82  * It uses the default display surface.
83  * \param flags or'ed together GM_FLAGS_*
84  * \param subsystem subsystem id, define your own or use the Amiga ones
85  * \param address adress where something happened
86  * \return which mouse button was pressed
87  */
88 int guru_alert(unsigned short flags, Uint32 subsystem, void *address);
89 
90 /*! \brief Guru Meditation
91  *
92  * This is a true guru meditation alert. Warning! Setting
93  * GM_FLAGS_DEADEND will never return but call exit(EXIT_FAILURE),
94  * while using GM_FLAGS_ABORTIFY 0x8000 will call abort() on pressing
95  * the right mouse button.
96  *
97  * It uses the default display surface.
98  * \param flags or'ed together GM_FLAGS_*
99  * \param subsystem subsystem id, define your own or use the Amiga ones
100  * \param address adress where something happened
101  * \return which mouse button was pressed or terminate application if GM_FLAGS_DEADEND was given.
102  */
103 int guru_meditation(unsigned short flags, Uint32 subsystem, void *address);
104 #endif
105