home *** CD-ROM | disk | FTP | other *** search
- /*
- ** Amster - Main
- ** Copyright © 1999-2000 by Gürer Özen
- ** Copyright © 2000-2001 by Jacob Laursen
- **
- ** This program is free software; you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation; either version 2 of the License, or
- ** (at your option) any later version.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with this program; if not, write to the Free Software
- ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
- #include <proto/exec.h>
- #include <dos/dos.h>
-
- #include "amster.h"
-
- long __stack = AMSTER_STACK ;
-
- #ifdef __MORPHOS__
- struct IntuitionBase *IntuitionBase = NULL;
- struct UtilityBase *UtilityBase = NULL;
- struct GfxBase *GfxBase = NULL;
- struct Library *IconBase = NULL;
- struct Library *AslBase = NULL;
- struct Library *RexxSysBase = NULL;
- #endif
-
- int main(int argc, char *argv[])
- {
- long sig;
-
- #ifdef __MORPHOS__
- IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 39L);
- UtilityBase = (struct UtilityBase *)OpenLibrary("utility.library", 37L);
- GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 39L);
- IconBase = OpenLibrary("icon.library", 37L);
- AslBase = OpenLibrary("asl.library", 37L);
- RexxSysBase = OpenLibrary("rexxsyslib.library", 37L);
- if(!GfxBase || !IntuitionBase || !UtilityBase || !AslBase || !IconBase || !RexxSysBase) goto quit;
- #endif
-
- sig = AllocSignal(-1);
- if (sig == -1) return 20;
- nap_sigmask = 1L << sig;
-
- if (!th_init()) return 20;
-
- #ifdef __SASC
- if (argc == 0) {
- argc = _WBArgc;
- argv = _WBArgv;
- }
- #endif
-
- prf_setup(argc, argv);
- gui_run(nap_sigmask);
-
- FreeSignal(sig);
-
- #ifdef __MORPHOS__
- quit:
- if (RexxSysBase) CloseLibrary(RexxSysBase);
- if (AslBase) CloseLibrary(AslBase);
- if (IconBase) CloseLibrary(IconBase);
- if (GfxBase) CloseLibrary((struct Library *)GfxBase);
- if (UtilityBase) CloseLibrary((struct Library *)UtilityBase);
- if (IntuitionBase) CloseLibrary((struct Library *)IntuitionBase);
- #endif
-
- return 0;
- }
-
-
- #ifndef __SASC
- /* Replacement for SAS/C function */
- extern int stcd_i(const char *in, int *ivalue)
- {
- int i=0;
-
- ivalue = atoi(in);
-
- if(in[0] == '-' || in[0] == '+') i++;
- while(in[i] >= '0' && in[i] <= '9')) i++;
- if(in[0] == '-' || in[0] == '+') i--;
-
- return i;
- }
- #endif
-