home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 2 / goldfish_vol2_cd1.bin / files / dev / gui / mui / developer / c / examples / demo.h < prev    next >
C/C++ Source or Header  |  1994-08-08  |  3KB  |  142 lines

  1. /*************************************************************/
  2. /* Includes and other common stuff for the MUI demo programs */
  3. /*************************************************************/
  4.  
  5. /* MUI */
  6. #include <libraries/mui.h>
  7.  
  8. /* System */
  9. #include <dos/dos.h>
  10. #include <graphics/gfxmacros.h>
  11. #include <workbench/workbench.h>
  12.  
  13. /* Prototypes */
  14. #include <clib/alib_protos.h>
  15. #include <clib/exec_protos.h>
  16. #include <clib/dos_protos.h>
  17. #include <clib/icon_protos.h>
  18. #include <clib/graphics_protos.h>
  19. #include <clib/intuition_protos.h>
  20. #include <clib/gadtools_protos.h>
  21. #include <clib/utility_protos.h>
  22. #include <clib/asl_protos.h>
  23. #include <clib/muimaster_protos.h>
  24.  
  25. /* ANSI C */
  26. #include <stdlib.h>
  27. #include <string.h>
  28. #include <stdio.h>
  29.  
  30.  
  31. /* Compiler specific stuff */
  32.  
  33. #ifdef _DCC
  34.  
  35. #define REG(x) __ ## x
  36. #define ASM
  37. #define SAVEDS __geta4
  38.  
  39. #else
  40.  
  41. #define REG(x) register __ ## x
  42.  
  43. #ifdef __MAXON__
  44. #define ASM
  45. #define SAVEDS
  46. #else
  47. #define ASM    __asm
  48. #define SAVEDS __saveds
  49. #endif
  50.  
  51. #ifdef __SASC
  52. #include <pragmas/exec_sysbase_pragmas.h>
  53. #else
  54. #include <pragmas/exec_pragmas.h>
  55. #endif
  56. #include <pragmas/dos_pragmas.h>
  57. #include <pragmas/icon_pragmas.h>
  58. #include <pragmas/graphics_pragmas.h>
  59. #include <pragmas/intuition_pragmas.h>
  60. #include <pragmas/gadtools_pragmas.h>
  61. #include <pragmas/utility_pragmas.h>
  62. #include <pragmas/asl_pragmas.h>
  63. #include <pragmas/muimaster_pragmas.h>
  64.  
  65. extern struct Library *SysBase,*IntuitionBase,*UtilityBase,*GfxBase,*DOSBase,*IconBase;
  66. struct Library *MUIMasterBase;
  67.  
  68. #endif
  69.  
  70.  
  71. /*************************/
  72. /* Init & Fail Functions */
  73. /*************************/
  74.  
  75. static VOID fail(APTR app,char *str)
  76. {
  77.     if (app)
  78.         MUI_DisposeObject(app);
  79.  
  80. #ifndef _DCC
  81.     if (MUIMasterBase)
  82.         CloseLibrary(MUIMasterBase);
  83. #endif
  84.  
  85.     if (str)
  86.     {
  87.         puts(str);
  88.         exit(20);
  89.     }
  90.     exit(0);
  91. }
  92.  
  93.  
  94. #ifdef _DCC
  95.  
  96. int brkfunc(void) { return(0); }
  97.  
  98. int wbmain(struct WBStartup *wb_startup)
  99. {
  100.     extern int main(int argc, char *argv[]);
  101.     return (main(0, (char **)wb_startup));
  102. }
  103.  
  104. #endif
  105.  
  106.  
  107. #ifdef __SASC
  108. int CXBRK(void) { return(0); }
  109. int _CXBRK(void) { return(0); }
  110. void chkabort(void) {}
  111. #endif
  112.  
  113.  
  114. static VOID init(VOID)
  115. {
  116. #ifdef _DCC
  117.     onbreak(brkfunc);
  118. #endif
  119.  
  120. #ifndef _DCC
  121.     if (!(MUIMasterBase = OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN)))
  122.         fail(NULL,"Failed to open "MUIMASTER_NAME".");
  123. #endif
  124. }
  125.  
  126.  
  127. #ifndef __SASC
  128. static VOID stccpy(char *dest,char *source,int len)
  129. {
  130.     strncpy(dest,source,len);
  131.     dest[len-1]='\0';
  132. }
  133. #endif
  134.  
  135.  
  136. #ifndef MAKE_ID
  137. #define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
  138. #endif
  139.  
  140.  
  141. LONG __stack = 8192;
  142.