/*************************************************************/ /* Includes and other common stuff for the MUI demo programs */ /*************************************************************/ /* MUI */ #include /* System */ #include #include #include /* Prototypes */ #include #include #include #include #include #include #include #include #include #ifndef __GNUC__ #include #else #include #endif /* ANSI C */ #include #include #include /* Compiler specific stuff */ #ifdef _DCC #define REG(x) __ ## x #define ASM #define SAVEDS __geta4 #else #define REG(x) register __ ## x #if defined __MAXON__ || defined __GNUC__ #define ASM #define SAVEDS #else #define ASM __asm #define SAVEDS __saveds #endif /* if defined ... */ #ifdef __SASC #include #else #ifndef __GNUC__ #include #endif /* ifndef __GNUC__ */ #endif /* ifdef SASC */ #ifndef __GNUC__ #include #include #include #include #include #include #include #include #endif /* ifndef __GNUC__ */ extern struct Library *SysBase,*IntuitionBase,*UtilityBase,*GfxBase,*DOSBase,*IconBase; struct Library *MUIMasterBase; #endif /* ifdef _DCC */ /*************************/ /* Init & Fail Functions */ /*************************/ static VOID fail(APTR app,char *str) { if (app) MUI_DisposeObject(app); #ifndef _DCC if (MUIMasterBase) CloseLibrary(MUIMasterBase); #endif if (str) { puts(str); exit(20); } exit(0); } #ifdef _DCC int brkfunc(void) { return(0); } int wbmain(struct WBStartup *wb_startup) { extern int main(int argc, char *argv[]); return (main(0, (char **)wb_startup)); } #endif #ifdef __SASC int CXBRK(void) { return(0); } int _CXBRK(void) { return(0); } void chkabort(void) {} #endif static VOID init(VOID) { #ifdef _DCC onbreak(brkfunc); #endif #ifndef _DCC if (!(MUIMasterBase = OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN))) fail(NULL,"Failed to open "MUIMASTER_NAME"."); #endif } #ifndef __SASC static VOID stccpy(char *dest,char *source,int len) { strncpy(dest,source,len); dest[len-1]='\0'; } #endif #ifndef MAKE_ID #define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d)) #endif LONG __stack = 8192;