Esempio n. 1
0
void TermDo( void )
{
// Terminate a DO or an implied DO.

    do_entry    *do_pointer;
    sym_id      do_var;

    if( CSHead->typ == CS_DO ) {
        do_pointer = CSHead->cs_info.do_parms;
        if( do_pointer->do_parm != NULL ) {
            if( ( StmtSw & SS_DATA_INIT ) == 0 ) {
                GLabel( CSHead->cycle );
            }
            GDoEnd();
            do_var = do_pointer->do_parm;
            if( (do_var->u.ns.flags & SY_SPECIAL_PARM) &&
                !(do_var->u.ns.flags & SY_PS_ENTRY) ) {
                STUnShadow( do_var );
            }
            do_var->u.ns.flags &= ~SY_DO_PARM;
            if( ( StmtSw & SS_DATA_INIT ) == 0 ) {
                GLabel( CSHead->bottom );
            }
        }
    } else {
        Match();
    }
    if( ( StmtSw & SS_DATA_INIT ) == 0 ) {
        FreeLabel( CSHead->branch );
        FreeLabel( CSHead->bottom );
        FreeLabel( CSHead->cycle );
    }
    DelCSNode();
}
Esempio n. 2
0
static void BadDoEnd( void )
{
    Error( DO_BAD_ENDDO );
    FreeLabel( CSHead->branch );
    FreeLabel( CSHead->bottom );
    DelCSNode();
}
Esempio n. 3
0
static void FiniLoop( void )
{
    GBranch( CSHead->branch );
    GLabel( CSHead->bottom );
    FreeLabel( CSHead->branch );
    FreeLabel( CSHead->bottom );
    FreeLabel( CSHead->cycle );
}
Esempio n. 4
0
void    CpElseIf(void) {
//==================

// Process an ELSEIF statement.

    if( ( CSHead->typ == CS_IF ) || ( CSHead->typ == CS_ELSEIF ) ) {
        GBranch( CSHead->bottom );
        GLabel( CSHead->branch );
        FreeLabel( CSHead->branch );
        CSHead->typ = CS_ELSEIF;
        CSHead->branch = NextLabel();
        CSHead->block = ++BlockNum;
    } else if( CSHead->typ == CS_ELSE ) {
        Error( IF_ELSE_LAST );
    } else {
        Match();
    }
    CSCond( CSHead->branch );
    if( RecKeyWord( "THEN" ) ) {
        AdvanceITPtr();
        ReqEOS();
    } else {
        Error( IF_NO_THEN );
    }
}
Esempio n. 5
0
void CpUntil( void )
{
// Compile an UNTIL statement.

    if( ( CSHead->typ == CS_LOOP ) || ( CSHead->typ == CS_WHILE ) ) {
        GLabel( CSHead->cycle );
        CSCond( CSHead->branch );
        GLabel( CSHead->bottom );
        FreeLabel( CSHead->branch );
        FreeLabel( CSHead->bottom );
        FreeLabel( CSHead->cycle );
    } else {
        Match();
    }
    DelCSNode();
    CSNoMore();
}
Esempio n. 6
0
void    CpEndif(void) {
//=================

// Process an ENDIF statement.

    if( ( CSHead->typ == CS_IF ) || ( CSHead->typ == CS_ELSEIF ) ) {
        GLabel( CSHead->branch );
        FreeLabel( CSHead->branch );
        GLabel( CSHead->bottom );
        FreeLabel( CSHead->bottom );
    } else if( CSHead->typ == CS_ELSE ) {
        GLabel( CSHead->bottom );
        FreeLabel( CSHead->bottom );
    } else {
        Match();
    }
    DelCSNode();
    CSNoMore();
}
Esempio n. 7
0
void CpEndBlock( void )
{
    CheckCSList( CS_REMOTEBLOCK );
    if( CSHead->typ == CS_REMOTEBLOCK ) {
        GLabel( CSHead->bottom );
        FreeLabel( CSHead->bottom );
        // Make sure REMOTEBLOCK statement was valid.
        if( CSHead->cs_info.rb != NULL ) {
            GEndBlock();
        }
        GLabel( CSHead->branch );
        FreeLabel( CSHead->branch );
        DelCSNode();
    } else {
        Match();
    }
    CSNoMore();
    StNumbers.in_remote = FALSE;
    ClearRem();
    CSNoMore();
    BIEndRBorEP();
}
Esempio n. 8
0
void    GEpilog( void ) {
//=================

// Generate a subprogram epilogue.

    if( (SubProgId->u.ns.flags & SY_SUBPROG_TYPE) == SY_SUBROUTINE ) {
        GNullRetIdx();
    }
    if( EpilogLabel != 0 ) {
        GLabel( EpilogLabel );
        FreeLabel( EpilogLabel );
    }
    EmitOp( FC_EPILOGUE );
    OutPtr( SubProgId );
}
Esempio n. 9
0
void    CpElse(void) {
//================

// Process an ELSE statement.

    if( ( CSHead->typ == CS_IF ) || ( CSHead->typ == CS_ELSEIF ) ) {
        GBranch( CSHead->bottom );
        GLabel( CSHead->branch );
        FreeLabel( CSHead->branch );
        CSHead->typ = CS_ELSE;
        CSHead->block = ++BlockNum;
    } else if( CSHead->typ == CS_ELSE ) {
        Error( IF_ELSE_LAST );
    } else {
        Match();
    }
    CSNoMore();
}
Esempio n. 10
0
void    CpLogIf(void) {
//=================

// Process a logical IF statement.

    label_id    if_skip;

    if_skip = NextLabel();
    CSCond( if_skip );
    if( RecKeyWord( "THEN" ) &&
        ( RecNextOpr( OPR_TRM ) || RecNextOpr( OPR_COL ) ) ) {
        AddCSNode( CS_IF );
        CSHead->branch = if_skip;
        CSHead->bottom = NextLabel();
        CITNode->opn.ds = DSOPN_PHI;       // not part of the block label
        BlockLabel();
        CtrlFlgs |= CF_BAD_DO_ENDING;
    } else {
        Recurse();
        GLabel( if_skip );
        FreeLabel( if_skip );
    }
}
Esempio n. 11
0
void    GEPProlog( void ) {
//===================

// Generate an entry point prologue.

    sym_id      ep;
    char        *ptr;
    char        name[MAX_SYMLEN+3];

    ep = ArgList->id;
    ep->u.ns.si.sp.u.entry = NextLabel();
    GLabel( ep->u.ns.si.sp.u.entry );
    // by the time we define the label for the entry point, the code that
    // references it will have been executed
    FreeLabel( ep->u.ns.si.sp.u.entry );
    SetArgAddrs();
    if( CommonEntry == NULL ) {
        ptr = name;
        *ptr = '$';
        ptr++;
        ptr = STGetName( SubProgId, ptr );
        *ptr = '.';
        ptr++;
        *ptr = NULLCHAR;
        CommonEntry = SymLookup( name, SubProgId->u.ns.u2.name_len + 2 );
        if( (SubProgId->u.ns.flags & SY_SUBPROG_TYPE) == SY_SUBROUTINE ) {
            CommonEntry->u.ns.flags = SY_USAGE | SY_SUBPROGRAM | SY_SUBROUTINE |
                                    SY_SENTRY | SY_REFERENCED;
        } else {
            CommonEntry->u.ns.flags = SY_USAGE | SY_SUBPROGRAM | SY_FUNCTION |
                                    SY_SENTRY | SY_REFERENCED;
        }
        EPValue = SymLookup( "$@EVAL", 6 );
        EPValue->u.ns.flags |= SY_REFERENCED;
        EPValue->u.ns.u1.s.xflags |= SY_DEFINED;
    }
}
Esempio n. 12
0
Object *
oflabel(ULONG id)
{
    return FreeLabel((ULONG)getString(id));
}
Esempio n. 13
0
Object *oflabel(ULONG text)
{
    return FreeLabel((ULONG)getString(text));
}