コード例 #1
0
ファイル: starteic.c プロジェクト: cubemoon/game-editor
void runEiC()
{
    void EiC_remTempories(void);
    void EiC_peephole(code_t *c);
    int EiC_getHistLineNo(), hfrom = 0;

	inRunEiC = 1;

	InitFileControl();

    switch(setjmp(env)) {
	case 0:
	    jmpOn = 1;

	    EiCp_initiateReset();

#ifndef NO_HISTORY
	    hfrom = EiC_getHistLineNo();
#endif
	    inbuf = EiC_nextproline();

	    EiC_initlex(inbuf);
	    EiC_initparser();
	    EiC_parse(EiC_ENV);
	    EiC_peephole(&getenvcode(EiC_ENV));
	
	    if(EiC_listcodeON)
		do_displays();
	    if (EiC_ENV->CODE.nextinst && EiC_interpON && !EiC_ParseError)
		EiC_interpret(EiC_ENV);
	    break;
	
	default:
	    EiC_messageDisplay("EiC reports an unRecognised jmp condition");
	case Err_:
	    EiC_ParseError = 1;
	    break;
	case Exit_:
	    EiC_messageDisplay("Exit called: force clean up!\n");
	    EiC_ParseError = 1;
	    break;

	    
    }

    if (EiC_errs) 
	EiC_clear_err_msgs();
    
    if(FREE_G_STRING)
	EiC_xfreemark(eicgstring);
    free_env_code();
    EiC_remTempories();
    
    if(EiC_ParseError) {

	if(EiC_ENV->lsp != 0) {
	    //EiC_messageDisplay("EiC Reset Local Stack Pointer\n");
	    EiC_ENV->lsp = 0;
	}
	
	/*
	if(EiC_ENV->ARgar.n)
		xmark(EiC_ENV->ARgar.val,eicstay);
	*/
	
	EiCp_Reset(1);
	firstInst.inst = NULL; //maks: the code is not valid anymore

	EiC_ParseError = 0;
    } else { 

#ifndef NO_HISTORY
	if(EiChist)
	    EiC_save_history(EiChist,hfrom);
#endif
    }

    if(EiC_memdumpON) {
	EiC_marksyms(NON_LEAK);
	if(EiC_verboseON)
	    printf("--- XMEM DUMP\n");
	xdumpnonmark("xdump", NON_LEAK); //maks
    }

	inRunEiC = 0;
}
コード例 #2
0
ファイル: starteic.c プロジェクト: otoauler/sdkpub
void runEiC()
{
    void EiC_remTempories(void);
    void EiC_peephole(code_t *c);
    int EiC_getHistLineNo(), hfrom = 0;

    /* Hawk start change */
    EiC_ParseError = 0;
    /* Hawk change */

    /* Hawk start change */
#ifdef WIN32
    __try {
#endif
        /* Hawk change */
        switch(setjmp(env)) {
        case 0:
            jmpOn = 1;

            EiCp_initiateReset();

#ifndef NO_HISTORY
            hfrom = EiC_getHistLineNo();
#endif
            inbuf = EiC_nextproline();

            EiC_initlex(inbuf);
            EiC_initparser();
            EiC_parse(EiC_ENV);
            EiC_peephole(&getenvcode(EiC_ENV));

            if(EiC_listcodeON)
                do_displays();
            if (EiC_ENV->CODE.nextinst && EiC_interpON && !EiC_ParseError)
                EiC_interpret(EiC_ENV);
            break;

        default:
            EiC_messageDisplay("EiC reports an unRecognised jmp condition in starteic.c");
        case Err_:
            EiC_ParseError = 1;
            break;
        case Exit_:
            EiC_messageDisplay("Exit called: force clean up!\n");
            EiC_ParseError = 1;
            break;


        }
        /* Hawk start change */
#ifdef WIN32
    } __finally {
#endif
        /* Hawk change */

        if (EiC_errs)
            EiC_clear_err_msgs();

        if(FREE_G_STRING)
            EiC_xfreemark(eicgstring);
        free_env_code();
        EiC_remTempories();

        if(EiC_ParseError) {

            if(EiC_ENV->lsp != 0) {
                EiC_messageDisplay("EiC::Reset Local Stack Pointer\n");
                EiC_ENV->lsp = 0;
            }
            /*
            if(EiC_ENV->ARgar.n)
            xmark(EiC_ENV->ARgar.val,eicstay);
            */

            EiCp_Reset(1);

            /* Hawk start change */
            EiC_ParseError = 0;
            /* Hawk change */
        } else {

#ifndef NO_HISTORY
            if(EiChist)
                EiC_save_history(EiChist,hfrom);
#endif
        }

        if(EiC_memdumpON) {
            EiC_marksyms(NON_LEAK);
            if(EiC_verboseON)
                printf("--- XMEM DUMP\n");
            xdumpnonmark("eicxdump", NON_LEAK);
        }
#ifdef WIN32
    }
#endif
}