示例#1
0
void CpWhile( void )
{
//=================

// Compile a WHILE statement.
//    WHILE( expr )DO <:label> -- block while
//    WHILE( expr )   <:label> -- block while
//    WHILE( expr ) STATEMENT  -- one line while

    CSExtn();
    InitLoop( CS_WHILE );
    CSCond( CSHead->bottom );
    if( RecNOpn() && RecNextOpr( OPR_COL ) ) {
        BlockLabel();
    } else if( RecKeyWord( "DO" ) &&
               ( RecNextOpr( OPR_TRM ) || RecNextOpr( OPR_COL ) ) ) {
        CITNode->opn.ds = DSOPN_PHI;
        BlockLabel();
    } else {
        Recurse();
        GLabel( CSHead->cycle );
        FiniLoop();
        DelCSNode();
    }
}
示例#2
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();
}
示例#3
0
static bool BlockName( unsigned_16 rb_defined )
{
    sym_id      sym_ptr;
    unsigned_16 flag_mask;
    bool        rb_name;

    CSExtn();
    rb_name = FALSE;
    if( ReqName( NAME_REM_BLOCK ) ) {
        sym_ptr = LkSym();
        if( ( sym_ptr->ns.flags & ~SY_REFERENCED ) == 0 ) {
            sym_ptr->ns.si.rb.entry = NextLabel();
            sym_ptr->ns.flags = RB_FLAGS;
        }
        flag_mask = (unsigned_16)~( SY_RB_DEFINED | SY_REFERENCED );
        if( ( ( sym_ptr->ns.flags & flag_mask ) == RB_FLAGS ) &&
            ( ( sym_ptr->ns.flags & rb_defined ) == 0 ) ) {
            sym_ptr->ns.flags |= rb_defined;
            rb_name = TRUE;
        } else {
            IllName( sym_ptr );
        }
    }
    return( rb_name );
}
示例#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();
}
示例#5
0
void CpLoop( void )
{
// Compile a LOOP statement.

    CSExtn();
    InitLoop( CS_LOOP );
    BlockLabel();
}
示例#6
0
void    CpMap( void ) {
//===============

// Process MAP statement.
//      MAP

    CSExtn();
    SgmtSw |= SG_DEFINING_MAP;
    EndOfStatement();
    STMap();
}
示例#7
0
void    CpUnion( void ) {
//=================

// Process UNION statement.
//      UNION

    CSExtn();
    SgmtSw |= SG_DEFINING_UNION;
    EndOfStatement();
    STUnion();
}
示例#8
0
void    CpEndUnion( void ) {
//====================

// Process ENDUNION statement.
//      ENDUNION

    CSExtn();
    if( (SgmtSw & SG_DEFINING_STRUCTURE) == 0 ) {
        StmtPtrErr( SP_UNMATCHED, StmtKeywords[ PR_UNION ] );
    }
    SgmtSw &= ~SG_DEFINING_UNION;
    EndOfStatement();
}
示例#9
0
void    CpEndMap( void ) {
//====================

// Process ENDMAP statement.
//      ENDMAP

    CSExtn();
    if( (SgmtSw & SG_DEFINING_MAP) == 0 ) {
        StmtPtrErr( SP_UNMATCHED, StmtKeywords[ PR_MAP ] );
    }
    SgmtSw &= ~SG_DEFINING_MAP;
    EndOfStatement();
}