Exemplo n.º 1
0
static  intstar4        CheckSubStr( act_eq_entry *eqv_entry ) {
//==============================================================

// Check for a valid substring operation.

    sym_id      sym;
    intstar4    *substr;
    intstar4    offset;
    intstar4    last;

    sym = eqv_entry->name_equived;
    substr = &eqv_entry->subscrs[ eqv_entry->subs_no ];
    if( sym->ns.typ != TY_CHAR ) {
        NameTypeErr( EV_ONLY_IF_CHAR, sym );
        offset = 0;
    } else {
        offset = substr[0];
        if( eqv_entry->substr == 1 ) {
            last = sym->ns.xt.size;
        } else {
            last = substr[1];
        }
        if( DoSubstring( offset, last, sym->ns.xt.size ) ) {
            offset--;
        } else {
            NameStmtErr( EV_SSTR_INVALID, sym, PR_EQUIV );
            offset = 0;
        }
    }
    return( offset );
}
Exemplo n.º 2
0
void    DtFieldSubstring( void ) {
//==========================

// Data initialize a substring character item within a structure.

    sym_id      fd;
    intstar4    base;
    intstar4    first;
    intstar4    last;
    char        name[MAX_SYMLEN+1];

    base = DXPop();
    first = DXPop();
    fd = GetPtr();
    last = GetInt();
    if( last != 0 ) {
        last += first - 1;
    } else {
        last = DXPop();
    }
    GetU16(); // skip typing information
    if( DoSubstring( first, last, fd->u.fd.xt.size ) ) {
        DXPush( base + first - 1 );
        DtItemSize = last - first + 1;
    } else {
        STFieldName( fd, name );
        Error( EV_SSTR_INVALID, name, StmtKeywords[ PR_DATA ] );
    }
}
Exemplo n.º 3
0
void    DtSubstring( void ) {
//=====================

// Data initialize a character substring.

    intstar4    first;
    intstar4    last;
    sym_id      cv;

    cv = GetPtr();
    GetU16();   // skip typing information
    first = DXPop();
    if( cv != NULL ) {
        if( DtFlags & DT_SS_NO_HIGH ) {
            last = cv->u.ns.xt.size;
            DtFlags &= ~DT_SS_NO_HIGH;
        } else {
            last = DXPop();
        }
    } else {
        last = first + GetInt() - 1;
    }
    if( !DoSubstring( first, last, InitVar->u.ns.xt.size ) ) {
        NameStmtErr( EV_SSTR_INVALID, InitVar, PR_DATA );
    }
    DtOffset += first - 1;
    DtItemSize = last - first + 1;
}
Exemplo n.º 4
0
static  bool    SubStr( string *scb ) {
//=====================================

// Get a substring list.

    intstar4    ss1;
    intstar4    ss2;

    ss1 = 1;
    ss2 = scb->len;
    if( !ScanChar( ':' ) ) {
        if( !ScanSNum( &ss1 ) ) return( FALSE );
        if( !ScanChar( ':' ) ) return( FALSE );
    }
    if( !ScanChar( ')' ) ) {
        if( !ScanSNum( &ss2 ) ) return( FALSE );
        if( !ScanChar( ')' ) ) return( FALSE );
    }
    if( !DoSubstring( ss1, ss2, scb->len ) ) return( FALSE );
    scb->len = ss2 - ss1 + 1;
    scb->strptr = scb->strptr + ss1 - 1;
    return( TRUE );
}