Exemplo n.º 1
0
static void __CDECL
startup(register BASEPAGE *b)
{
	register int (*func)(long);
	register long arg;
	_setstack(((char *)b) + SIZE);
	func = (int (*)(long))b->p_dbase;
	arg = b->p_dlen;

	/* If this is a thread, it doesn't need
	 * own copy of the environment, right?
	 */
	Mfree(b->p_env);
	b->p_env = _base->p_env;

	/* copy from parents basepage for debuggers... */
	b->p_tbase = _base->p_tbase;
	b->p_tlen = _base->p_tlen;
	b->p_dbase = _base->p_dbase;
	b->p_dlen = _base->p_dlen;
	b->p_bbase = _base->p_bbase;
	b->p_blen = _base->p_blen;

	Pterm((*func)(arg));
}
Exemplo n.º 2
0
main()
{
	char	buf[512], bbuf[512];
	int	i;

/*	
	for (i = 0; i < 512;) {
		buf[i++] = 'M';
		buf[i++] = 'I';
		buf[i++] = 'N';
		buf[i++] = 'O';
	}

/**/	
	/* physical operation on unit 0 */
/*
	Lrwabs(9, buf, 1, 0x10000, 2);
	Lrwabs(8, bbuf, 1, 0x10000, 3);
/**/	
	/* logical operation on D: */
/*
	i = 1;
	while (i == 1) {
		Mediach(3);
		Getbpb(3);
		Rwabs(1, buf, 1, 0x700, 3);
	}
/**/	
/*
	Lrwabs(0, bbuf, 1, 0x10000, 3);
/**/
	Rwabs(8, bbuf, 1, 0, 2);
	Rwabs(9, bbuf, 1, 0, 2);
	Pterm(0);
}
Exemplo n.º 3
0
main()
{
	/*
	char	buf[512], bbuf[512];
	int	i;
	long	srchndl, dsthndl, ret;
	/**/

/*
	for (i = 0; i < 512*3;) {
		buf[i++] = 'M';
		buf[i++] = 'I';
		buf[i++] = 'N';
		buf[i++] = 'O';
	}
/**/	

	/* physical operation on unit 0 */
/*
	Lrwabs(9, buf, 1, 0x10000, 2);
	Lrwabs(8, bbuf, 1, 0x10000, 3);
/**/	
	/* logical operation on D: */
/*
	i = 1;
	while (i == 1) {
		Mediach(3);
		Getbpb(3);
		Rwabs(1, buf, 1, 0x700, 3);
	}
/**/	
/*
	Lrwabs(0, bbuf, 1, 0x10000, 3);
	Rwabs(1, buf+1, 3, 102, 3);
	Rwabs(0, buf, 3, 102, 3);
	Rwabs(9, bbuf, 1, 0, 11);
	Rwabs(8, bbuf, 1, 0, 11);
	Rwabs(9, bbuf, 1, 0, 11);
	char	*buf256;
	
	buf256 = (char *)Malloc(131072L);
	Rwabs(8, buf256+1, 2, 0, 18);
	Rwabs(9, buf256+1, 2, 0xa35a, 18);
/**/
/*
	Rwabs(8, buf256+1, 255, 0, 10);
	Rwabs(9, buf256+1, 255, 0, 10);
/**/
	Fsfirst("h:\\*.*", 0);
	
	while (!(Cconis()))
		;

	Fsfirst("g:\\*.*", 0);
	Fsfirst("h:\\*.*", 0);
	Pterm(0);
}
Exemplo n.º 4
0
/*
 * Top level;
 * we get control from the desktop.
 *
 */
main()
{
    long *cookptr;	/* pointer to AHDI cookie */

    running = TRUE;
    appl_init();
    phys_handle = graf_handle(&gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox);
    wind_get(0, WF_WORKXYWH, &xdesk, &ydesk, &wdesk, &hdesk);
    open_vwork();
    wi_handle = wind_create(WI_KIND, xdesk, ydesk, wdesk, hdesk);
  
    hidden = FALSE;
    butdown = TRUE;
  
    if (!rsrc_load(RESOURCEFILE)) {
	errs("[2][", RESOURCEFILE, "][ OK ]");
	goto punt;
    }
  
    graf_mouse(ARROW, 0L);
  
    /* display menu bar */
    if (getalladdr() == ERROR) {
	errs("[2][", RESOURCEFILE, "][ OK ]");
	goto punt;
    }
  
    ostack = Super(NULL);	/* Superuser mode for low memory access */
    pun = (int *)(*(long *)PUNPTR);
    Super(ostack);		/* back to User mode */

    if (!pun || !(*pun)) {	/* if no unit exists */
	err(noavdrv);		/* return error */
	goto punt;
    }

    cookptr = (long *)((char *)pun + 2 + 16 + 16*4);
    if (*cookptr != AHDI || cookptr != *(long *)(cookptr + 1))
	vernum = 0L;
    else
	vernum = (int *)(cookptr + 2);

    menu_bar(menubar, 1);	/* put up menu bar */
  
    while (running)
	domulti();
    
    menu_bar(menubar, 0);	/* erase menu bar */
  
punt:
    wind_delete(wi_handle);	/* close window on screen */
    v_clsvwk(handle);		/* close virtual workstation */
    appl_exit();		/* exit application HDX */
    Pterm(0);			/* terminate process */
}
Exemplo n.º 5
0
void _crtinit(void)
{
	register BASEPAGE *bp;
	register long m;
	register long freemem;
	
	bp = _base;

	/* m = # bytes used by environment + args */
	m = parseargs(bp);

	/* make m the total number of bytes required by program sans stack/heap */
	m += (bp->p_tlen + bp->p_dlen + bp->p_blen + sizeof(BASEPAGE));
	m = (m + 3L) & (~3L);

	/* freemem the amount of free mem accounting for MINFREE at top */
	if ((freemem = (long)bp->p_hitpa - (long)bp - MINFREE - m) <= 0L)
		goto notenough;
	
	/* make m the total number of bytes including stack */
	m += _stksize;

	/* make sure there's enough room for the stack */
	if (((long)bp + m) > ((long)bp->p_hitpa - MINFREE))
		goto notenough;

	/* set up the new stack to bp + m */
	_setstack((char *)bp + m);

	/* shrink the TPA */
	(void)Mshrink(0, bp, m);

	Pterm(main());
	__builtin_unreachable();
	
notenough:
	(void) Cconws("Fatal error: insufficient memory\r\n"
	              "Hint: either decrease stack size using 'stack' command (not recomended)\r\n"
		          "      or increase TPA_INITIALMEM value in mint.cnf.\r\n");
	Pterm(-1);
	__builtin_unreachable();
}
Exemplo n.º 6
0
static void
start(BASEPAGE *bp)
{
	long shrinklen;
	
	_base = bp;
	shrinklen = bp->p_tlen + bp->p_dlen + bp->p_blen + STACK + 0x100;
	if (bp->p_lowtpa + shrinklen <= bp->p_hitpa) {
		static char null[1] = {""};
		static char *argv[2] = {null, NULL};
		extern __builtin_putreg P_((int, long));	/* totally bogus */

		__builtin_putreg(15, bp->p_lowtpa + shrinklen);
		Mshrink((void *)bp->p_lowtpa, shrinklen);
		main(1, argv);
	}
	Pterm(ENSMEM);
}
Exemplo n.º 7
0
int main (int argc, char **argv) {
    Tobj co;
    Psrc_t src;

#ifdef MTRACE
    extern int Mt_certify;
    Mt_certify = 1;
#endif
#ifdef STATS
    stime = time (NULL);
#endif

    idlerunmode = 0;
    exprstr = NULL;
    fp = NULL;
    init (argv[0]);
    Minit (GFXprune);
    Ginit ();
    FD_SET (Gxfd, &inputfds);

    Eerrlevel = 1;
    Estackdepth = 2;
    Eshowbody = 1;
    Eshowcalls = 1;

    processstr (leftyoptions);
    argv++, argc--;
    processargs (argc, argv);

    if (setjmp (exitljbuf))
        goto eop;

    Cinit ();
    IOinit ();
    Tinit ();
    Pinit ();
    Einit ();
    Sinit ();
    Dinit ();
    Iinit ();
    TXTinit (txtcoords);
    GFXinit ();
#ifdef FEATURE_GMAP
    gmapon = TRUE, G2Linit ();
#endif

    if (exprstr) {
        src.flag = CHARSRC, src.s = exprstr, src.fp = NULL;
        src.tok = -1, src.lnum = 1;
        while ((co = Punit (&src)))
            Eunit (co);
    }
    if (fp) {
        src.flag = FILESRC, src.s = NULL, src.fp = fp;
        src.tok = -1, src.lnum = 1;
        while ((co = Punit (&src)))
            Eunit (co);
    }
    if (endflag)
        goto eop;

    TXTupdate ();

    Gneedredraw = FALSE;
    for (;;) {
        if (Gneedredraw)
            GFXredraw (), Gneedredraw = FALSE;
        if (Gbuttonsdown > 0) {
            GFXmove (), Gprocessevents (FALSE, G_ONEEVENT);
            processinput (FALSE);
        } else {
            if (Mcouldgc) {
                if (!processinput (FALSE))
                    Mdogc (M_GCINCR);
            }
            if (idlerunmode) {
                if (!processinput (FALSE))
                    GFXidle ();
#ifdef FEATURE_GMAP
            } else if (GMAPneedupdate) {
                processinput (FALSE);
#endif
            } else
                processinput (TRUE);
        }
#ifdef FEATURE_GMAP
        if (gmapon)
            GMAPupdate ();
#endif
        if (Erun)
            TXTupdate (), Erun = FALSE;
    }
eop:
#ifdef PARANOID
#ifdef FEATURE_GMAP
    if (gmapon)
        G2Lterm ();
#endif
    GFXterm ();
    TXTterm ();
    Iterm ();
    Dterm ();
    Sterm ();
    Eterm ();
    Pterm ();
    Tterm ();
    IOterm ();
    Cterm ();
    Gterm ();
    Mterm ();
    FD_CLR (Gxfd, &inputfds);
    term ();
#endif
    printusage ();
    return 0;
}
Exemplo n.º 8
0
int APIENTRY WinMain (
    HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow
) {
    Tobj co;
    Psrc_t src;

    hinstance = hInstance;
    hprevinstance = hPrevInstance;
    idlerunmode = 0;
    exprstr = NULL;
    fp = NULL;
    init (NULL);
    Ginit ();
#ifndef FEATURE_MS
    FD_SET (Gxfd, &inputfds);
#endif

    Eerrlevel = 1;
    Estackdepth = 2;
    Eshowbody = 1;
    Eshowcalls = 1;

    processstr (leftyoptions);
    __argv++, __argc--;
    processargs (__argc, __argv);

    if (setjmp (exitljbuf))
        goto eop;

    Cinit ();
    IOinit ();
    Minit (GFXprune);
    Tinit ();
    Pinit ();
    Einit ();
    Sinit ();
    Dinit ();
    Iinit ();
    TXTinit (txtcoords);
    GFXinit ();

    if (exprstr) {
        src.flag = CHARSRC, src.s = exprstr, src.fp = NULL;
        src.tok = -1, src.lnum = 1;
        while ((co = Punit (&src)))
            Eunit (co);
    }
    if (fp) {
        src.flag = FILESRC, src.s = NULL, src.fp = fp;
        src.tok = -1, src.lnum = 1;
        while ((co = Punit (&src)))
            Eunit (co);
    }
    if (endflag)
        goto eop;

    TXTupdate ();

    Gneedredraw = FALSE;
    for (;;) {
        if (Gneedredraw)
            GFXredraw (), Gneedredraw = FALSE;
        if (Gbuttonsdown > 0)
            GFXmove (), Gprocessevents (FALSE, G_ONEEVENT);
        else {
            if (Mcouldgc) {
                if (!processinput (FALSE))
                    Mdogc (M_GCINCR);
            } else if (idlerunmode) {
                if (!processinput (FALSE))
                    GFXidle ();
            } else
                processinput (TRUE);
        }
        if (Erun)
            TXTupdate (), Erun = FALSE;
    }

eop:
#ifdef PARANOID
    GFXterm ();
    TXTterm ();
    Iterm ();
    Dterm ();
    Sterm ();
    Eterm ();
    Pterm ();
    Tterm ();
    Mterm ();
    IOterm ();
    Cterm ();
    Gterm ();
    term ();
#endif
    printusage ();
    exit (0);
}
Exemplo n.º 9
0
int main( void )
{
    char pathbuf[128];
    char fname[33];
    int	result;
    int button,sortmode;
    int nfiles;
    char *pattern;
    void *fsel_dialog;
    int whdl;
    EVNT evnt;


    if   ((appl_init()) < 0)
        Pterm(-1);

    /* Aufruf */
    /* ------ */

    strcpy(fname, "initname");
    strcpy(pathbuf, "E:\\BIN\\");


    if	(1 == form_alert(1, "[2][Modus ?][Fenster|Dialog]"))
    {
        fsel_dialog = fslx_open(
                          " Titel ",
                          -1,-1,
                          &whdl,
                          pathbuf, 128,
                          fname, 33,
                          "*.PRG,*.APP\0"
                          "*.TOS,*.TTP\0"
                          "*\0",
                          0L,			/* kein Filter */
                          "C:\\\0"
                          "U:\\BIN\\\0"
                          "U:\\DEV\\\0",
                          SORTBYNAME,
                          GETMULTI
                      );
        if	(fsel_dialog)
        {
            do	{
                evnt.mwhich = evnt_multi(
                                  MU_KEYBD+MU_BUTTON+MU_MESAG,
                                  2,1,1,
                                  0,0,0,0,0,
                                  0,0,0,0,0,
                                  evnt.msg,
                                  0,0,
                                  &evnt.mx,
                                  &evnt.my,
                                  &evnt.mbutton,
                                  &evnt.kstate,
                                  &evnt.key,
                                  &evnt.mclicks);
                result = fslx_evnt(
                             fsel_dialog,
                             &evnt,
                             pathbuf,
                             fname,
                             &button,
                             &nfiles,
                             &sortmode,
                             &pattern);
            }
            while(result);
        }
    }
    else	{

        sortmode = SORTBYNAME;
        fsel_dialog = fslx_do(
                          "mein Titel",
                          pathbuf, 128,
                          fname, 33,
                          "*.PRG,*.APP\0"
                          "*.TOS,*.TTP\0"
                          "*\0",
                          0L,				/* kein Filter */
                          "C:\\\0"
                          "U:\\BIN\\\0"
                          "U:\\DEV\\\0",
                          &sortmode,
                          0,
                          &button,
                          &nfiles,
                          &pattern
                      );
    }

    if	(fsel_dialog)
        fslx_close(fsel_dialog);

    appl_exit();
    return(0);
}