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

    CGControl( O_GOTO, NULL, GetLabel( GetU16() ) );
}
Example #2
0
void            FCAllocate( void ) {
//============================

    call_handle         handle;
    sym_id              arr;
    act_dim_list        *dim;
    uint                num;
    uint_16             alloc_flags;
    cg_name             expr_stat;
    cg_name             expr_loc;
    cg_name             fl;
    label_handle        label;

    SymPush( NULL );
    for( num = 0; (arr = GetPtr()) != NULL; ++num ) {
        // check if array is already allocated before filling in ADV
        label = BENewLabel();
        fl = getFlags( arr );
        fl = CGBinary( O_AND, fl, CGInteger( ALLOC_MEM, TY_UINT_2 ), TY_UINT_2 );
        CGControl( O_IF_TRUE, CGCompare( O_NE, fl, CGInteger( 0, TY_UINT_2 ), TY_UINT_2 ), label );
        FCodeSequence(); // fill in the ADV, SCB or RCB
        CGControl( O_LABEL, NULL, label );
        BEFiniLabel( label );
        SymPush( arr );
    }
    alloc_flags = GetU16();
    if( alloc_flags & ALLOC_NONE ) {
        expr_loc = CGInteger( 0, TY_POINTER );
        expr_stat = NULL;
    } else {
        FCodeSequence();
        if( alloc_flags & ALLOC_LOC ) {
            expr_loc = XPopValue( TY_INT_4 );
            expr_stat = NULL;
            if( alloc_flags & ALLOC_STAT ) {
                FCodeSequence();
                expr_stat = XPop();
            }
        } else {
            expr_loc = NULL;
            expr_stat = XPop();
        }
    }
    handle = InitCall( RT_ALLOCATE );
    for( ; (arr = SymPop()) != NULL; ) {
        if( arr->u.ns.flags & SY_SUBSCRIPTED ) {
            dim = arr->u.ns.si.va.u.dim_ext;
            CGAddParm( handle, CGInteger( _SymSize( arr ), TY_INT_4 ), TY_INT_4 );
            CGAddParm( handle, CGInteger( _DimCount( dim->dim_flags ), TY_INTEGER ), TY_INTEGER );
            CGAddParm( handle, GetAdv( arr ), TY_LOCAL_POINTER );
        }
        CGAddParm( handle, CGFEName( arr, TY_POINTER ), TY_POINTER );
        CGAddParm( handle, getFlags( arr ), FLAG_PARM_TYPE );
    }
    if( alloc_flags & ALLOC_NONE ) {
        CGAddParm( handle, expr_loc, TY_POINTER );
    } else {
        if( alloc_flags & ALLOC_LOC ) {
            CGAddParm( handle, expr_loc, TY_INT_4 );
        }
        if( alloc_flags & ALLOC_STAT ) {
            CGAddParm( handle, expr_stat, TY_POINTER );
        }
    }
    CGAddParm( handle, CGInteger( num, TY_UNSIGNED ), TY_UNSIGNED );
    CGAddParm( handle, CGInteger( alloc_flags, TY_UINT_2 ), FLAG_PARM_TYPE );
    CGDone( CGCall( handle ) );
}