home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / DC-POS24.LZX / pOS / IncPOS.lzx / pLib / StartCode.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-03-18  |  2.1 KB  |  98 lines

  1. #ifndef __INC_POS_PLIB_STARTCODE_C
  2. #define __INC_POS_PLIB_STARTCODE_C
  3. /*******************************************************************
  4.  $CRT 16 Mar 1996 : hb
  5.  
  6.  $AUT Holger Burkarth
  7.  $DAT >>StartCode.c<<   08 Mar 1997    09:52:45 - (C) ProDAD
  8. *******************************************************************/
  9.  
  10. /**
  11.  mcpp:cppc -pc -c p:pLib/StartCode.c -o p:pLib/StartCode.o
  12.  mcpp:cppc -pp -c p:pLib/StartCode.c -o p:pLib/StartCodeCPP.o
  13. **/
  14.  
  15. #define __COMPUTER_AMIGA 1
  16. #define NOMYDEBUG
  17.  
  18. #include "p:pDOS/Process.h"
  19. #include "p:proto/pExec2.h"
  20. #include "p:pDOS/DosBase.h"
  21. #include "p:pExec/Diagnos.h"
  22. #include "p:pExec/TstTags.h"
  23.  
  24. struct pOS_FileHandle *pstd__in, *pstd__out, *pstd__err;
  25.  
  26.  
  27. #ifdef __cplusplus
  28.  extern "C" VOID InitModules();
  29.  extern "C" VOID CleanupModules();
  30.  extern "C" int main(VOID);
  31. #else
  32.  int main(VOID);
  33. #endif
  34.  
  35. void Entry(_R_LB struct pOS_DosBase*,_R_A0 const struct pOS_SegmentLst*);
  36.  
  37.  
  38. struct pOS_ExecBase        *gb_ExecBase;
  39. struct pOS_ExecLibFunction *gb_ExecLib;
  40. struct pOS_DosBase         *gb_DosBase;
  41.  
  42. static const struct pOS_TagItem gb_TstTags[]=
  43. {
  44.   EXTSTTAG_MainOSID, pOS_MAINOSID,
  45.   TAG_END
  46. };
  47.  
  48.  
  49. /*----------------------------------
  50. -----------------------------------*/
  51. void entry(_R_LB struct pOS_DosBase* dos,_R_A0 const struct pOS_SegmentLst* segm,
  52.            register __d0 ULONG id)
  53. {
  54.   if(id == 'pOS\0') Entry(dos,segm);
  55. }
  56.  
  57.  
  58. /*----------------------------------
  59. -----------------------------------*/
  60. void Entry(_R_LB struct pOS_DosBase* dos,_R_A0 const struct pOS_SegmentLst* segm)
  61. {
  62. #ifndef __pOS_EXECPRECODE
  63.  #error hier fehlt etwas
  64. #endif
  65.  
  66.   extern struct pOS_ExecBase        *gb_ExecBase;
  67.   extern struct pOS_ExecLibFunction *gb_ExecLib;
  68.   extern struct pOS_DosBase         *gb_DosBase;
  69.  
  70.   gb_DosBase =dos;
  71.   gb_ExecBase=(struct pOS_ExecBase*)dos->ExecBase;
  72.   gb_ExecLib =dos->dos_Exec2Private;
  73.   {
  74.     struct pOS_Process *const Proc=(struct pOS_Process*)pOS_FindTask(NULL);
  75.     pstd__in =Proc->pr_CIS;
  76.     pstd__out=Proc->pr_COS;
  77.     pstd__err=Proc->pr_CES;
  78.   }
  79.  
  80. /*\
  81. *** Wrong OS Version ?
  82. \*/
  83.   if(!pOS_ExecCheckA(gb_TstTags)) return;
  84.  
  85.  
  86. #ifdef __cplusplus
  87.   InitModules();
  88.   main();
  89.   CleanupModules();
  90. #else
  91.   main();
  92. #endif
  93. }
  94.  
  95.  
  96.  
  97. #endif
  98.