Example #1
0
void    CpQuit(void) {
//================

// Compile a QUIT statement.

    itnode      *block_label;
    csnode      *csblock;

    CSExtn();
    block_label = GetBlockLabel();
    csblock = CSHead;
    if( block_label->opnd_size != 0 ) {
        for(;;) {
            if( CmpNode2Str( block_label, &csblock->label ) ) break;
            if( csblock->link == NULL ) break;
            csblock = csblock->link;
        }
    }
    if( csblock->typ == CS_EMPTY_LIST ) {
        StmtErr( SP_BAD_QUIT );
    } else if( (csblock->typ == CS_GUESS) || (csblock->typ == CS_ADMIT) ) {
        GBranch( csblock->branch );
    } else {
        GBranch( csblock->bottom );
    }
    BlockLabel();
}
Example #2
0
void CpRemBlock( void )
{
    sym_id      rb;

    if( EmptyCSList() == FALSE ) {
        StmtErr( SP_BLK_IN_STRUCTURE );
    }
    AddCSNode( CS_REMOTEBLOCK );
    CSHead->bottom = NextLabel();
    CSHead->branch = NextLabel();
    GBranch( CSHead->branch );
    if( BlockName( SY_RB_DEFINED ) ) {
        rb = CITNode->sym_ptr;
        if( ( rb->ns.flags & SY_REFERENCED ) == 0 ) {
            rb->ns.si.rb.ref_count = 0;
        }
        rb->ns.si.rb.ref_count++;
        CSHead->cs_info.rb = rb;
        GStartBlock();
        BIStartRBorEP( rb );
    }
    AdvanceITPtr();
    ReqEOS();
    StNumbers.in_remote = TRUE;
    ClearRem();
}
Example #3
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 );
    }
}
Example #4
0
void    CpCycle(void) {
//=================

// Compile the CYCLE statement.

    itnode      *block_label;
    csnode      *csblock;

    CSExtn();
    block_label = GetBlockLabel();
    csblock = CSHead;
    for(;;) {
        if( ( csblock->typ == CS_DO ) ||
            ( csblock->typ == CS_DO_WHILE ) ||
            ( csblock->typ == CS_WHILE ) ||
            ( csblock->typ == CS_LOOP ) ) {
            if( block_label->opnd_size == 0 ) break;
            if( CmpNode2Str( block_label, &csblock->label ) ) break;
        }
        if( csblock->link == NULL ) break;
        csblock = csblock->link;
    }
    if( csblock->typ == CS_EMPTY_LIST ) {
        StmtErr( SP_BAD_QUIT );
    } else {
        GBranch( csblock->cycle );
    }
    BlockLabel();
}
Example #5
0
static void FiniLoop( void )
{
    GBranch( CSHead->branch );
    GLabel( CSHead->bottom );
    FreeLabel( CSHead->branch );
    FreeLabel( CSHead->bottom );
    FreeLabel( CSHead->cycle );
}
Example #6
0
void    GGotoEpilog( void ) {
//=====================

// Generate a branch to the epilogue.

    if( EpilogLabel == 0 ) {
        EpilogLabel = NextLabel();
    }
    GBranch( EpilogLabel );
}
Example #7
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();
}