home *** CD-ROM | disk | FTP | other *** search
- #ifndef __INC_POS_PLIB_MAINCODE_C
- #define __INC_POS_PLIB_MAINCODE_C
- /*******************************************************************
- $CRT 17 Mar 1996 : hb
-
- $AUT Holger Burkarth
- $DAT >>MainCode.c<< 08 Mar 1997 09:55:06 - (C) ProDAD
- *******************************************************************/
-
- /***
- mcpp:cppc -pc -c p:pLib/MainCode.c -o p:pLib/MainCode.o
- mcpp:cppc -pp -c p:pLib/MainCode.c -o p:pLib/MainCodeCPP.o
- ***/
-
- #define __COMPUTER_AMIGA 1
- #define NOMYDEBUG
-
- #include "p:proto/pExec2.h"
- #include "p:proto/pDOS2.h"
-
- #include "p:pDOS/DosBase.h"
- #include "p:pDOS/ArgTags.h"
- #include "p:pDOS/DosArgs.h"
- #include "p:pDOS/Process.h"
- #include "p:pExec/Diagnos.h"
- #include "p:pExec/TstTags.h"
-
- struct pOS_FileHandle *pstd__in, *pstd__out, *pstd__err;
- SLONG gb_Error;
-
- #ifdef __cplusplus
- extern "C" VOID InitModules();
- extern "C" VOID CleanupModules();
- extern "C" int main(int argc,char* argv[]);
- #else
- int main(int argc,char* argv[]);
- #endif
-
- void Entry(_R_LB struct pOS_DosBase*,_R_A0 const struct pOS_SegmentLst*);
-
-
-
- struct pOS_ExecBase *gb_ExecBase;
- struct pOS_ExecLibFunction *gb_ExecLib;
- struct pOS_DosBase *gb_DosBase;
-
-
-
- static const struct pOS_TagItem gb_TstTags[]=
- {
- EXTSTTAG_MainOSID, pOS_MAINOSID,
- TAG_END
- };
-
-
- /*----------------------------------
- -----------------------------------*/
- void entry(_R_LB struct pOS_DosBase* dos,_R_A0 const struct pOS_SegmentLst* segm,
- register __d0 ULONG id)
- {
- if(id == 'pOS\0') Entry(dos,segm);
- }
-
-
- /*----------------------------------
- -----------------------------------*/
- void Entry(_R_LB struct pOS_DosBase* dos,_R_A0 const struct pOS_SegmentLst* segm)
- {
- struct pOS_DosArgs* Args;
- ULONG Area[1]={0};
-
- #ifndef __pOS_EXECPRECODE
- #error hier fehlt etwas
- #endif
-
- extern struct pOS_ExecBase *gb_ExecBase;
- extern struct pOS_ExecLibFunction *gb_ExecLib;
- extern struct pOS_DosBase *gb_DosBase;
-
- gb_DosBase =dos;
- gb_ExecBase=(struct pOS_ExecBase*)dos->ExecBase;
- gb_ExecLib =dos->dos_Exec2Private;
-
- /*\
- *** Wrong OS Version ?
- \*/
- if(!pOS_ExecCheckA(gb_TstTags)) return;
-
- {
- struct pOS_Process* Proc=(struct pOS_Process*)pOS_FindTask(NULL);
- pstd__in =Proc->pr_CIS;
- pstd__out=Proc->pr_COS;
- pstd__err=Proc->pr_CES;
- }
-
- Args=pOS_ReadDosArgsA("/M",Area,sizeof(Area)/sizeof(ULONG),NULL);
- if(Args) {
- CHAR **Argv=(CHAR**)Area[0];
- UWORD Argc;
-
- for(Argc=0; Argv[Argc]; ++Argc);
-
- #ifdef __cplusplus
- InitModules();
- #endif
-
- main(Argc+1,&Argv[-1]);
-
- #ifdef __cplusplus
- CleanupModules();
- #endif
-
- pOS_DeleteDosArgs(Args);
- }
- else gb_Error=DOSFAIL_FAIL;
- pOS_ExitProcess(gb_Error);
- }
-
-
- #endif
-