dbtypes.c

来自「开放源码的编译器open watcom 1.6.0版的源代码」· C语言 代码 · 共 1,151 行 · 第 1/3 页

C
1,151
字号
#ifndef NDEBUG
    EchoAPI( "DBFtnArray( %B,%t,%t,%i,%i)", dims, lo_bound_tipe,
             num_elts_tipe, off, base );
#endif
    if( _IsModel( DBG_DF ) ) {
        ret = DFFtnArray( dims, lo_bound_tipe, num_elts_tipe, off, base );
    }else if( _IsModel( DBG_CV ) ) {
        ret = CVFtnArray( dims, lo_bound_tipe, num_elts_tipe, off, base );
    }else{
#if _TARGET &( _TARG_IAPX86 | _TARG_80386 )
        ret = WVFtnArray( dims, lo_bound_tipe, num_elts_tipe, off, base );
#else
        ret = 0;
#endif
    }
#ifndef NDEBUG
    EchoAPI( " -> %i\n", ret );
#endif
    return( ret );
}


extern  dbg_type _CGAPI DBArray( dbg_type idx, dbg_type base ) {
/**************************************************************/

    dbg_type ret;

#ifndef NDEBUG
    EchoAPI( "DBArray( %i, %i)", idx, base );
#endif
    if( _IsModel( DBG_DF ) ) {
        ret = DFArray( idx, base );
    }else if( _IsModel( DBG_CV ) ) {
        ret = CVArray( idx, base );
    }else{
#if _TARGET &( _TARG_IAPX86 | _TARG_80386 )
        ret = WVArray( idx, base );
#else
        ret = 0;
#endif
    }
#ifndef NDEBUG
    EchoAPI( " -> %i\n", ret );
#endif
    return( ret );
}

extern  array_list * _CGAPI DBBegArray(  dbg_type base, cg_type tipe, bool is_col_major ){
/****************************************************************************************/
    array_list *ar;
//  type_def   *tipe_addr;

#ifndef NDEBUG
    EchoAPI( "DBBegArray( %i,%t,%i)", base, tipe, is_col_major );
#endif
     tipe = tipe;
    _Alloc( ar, sizeof( *ar ) );
    ar->num = 0;
//  tipe_addr = TypeAddress( tipe );
//  ar->size = tipe_addr->length;
    ar->list = NULL;
    ar->base = base;
    ar->is_col_major = is_col_major;
    ar->is_variable = FALSE;
#ifndef NDEBUG
    EchoAPI( " -> %i\n", ar );
#endif
    return( ar );
}

static  void    AddDim( array_list *ar, dim_any *dim ){
/******************************************************/

    dim_any *curr;
    dim_any **owner;

    owner = &ar->list;
    for(;;) {
        curr = *owner;
        if( curr == NULL ) break;
        owner = &curr->entry.next;
    }
    dim->entry.next = NULL;
    *owner = dim;
    ar->num++;
}

extern  void _CGAPI DBDimCon( array_list *ar, dbg_type idx, signed_32 lo, signed_32 hi ){
/***************************************************/
    dim_con *dim;

#ifndef NDEBUG
    EchoAPI( "DBDimCon( %i, %i, %i, %i )\n", ar, idx, lo, hi );
#endif
    _Alloc( dim, sizeof( *dim ) );
    dim->entry.kind = DIM_CON;
    dim->lo = lo;
    dim->hi = hi;
    dim->idx = idx;
    AddDim( ar, (dim_any *) dim );
}

extern  void _CGAPI DBDimVar( array_list *ar,
                        back_handle dims, int off,
                        cg_type lo_bound_tipe,
                        cg_type num_elts_tipe ){
/*************************************************/
    dim_var *dim;

#ifndef NDEBUG
    EchoAPI( "DBDimVar(%i, %B, %i, %t, %t)\n", ar, dims, off, lo_bound_tipe,
             num_elts_tipe);
#endif
    _Alloc( dim, sizeof( *dim ) );
    dim->entry.kind = DIM_VAR;
    dim->dims = dims;
    dim->off = off;
    dim->lo_bound_tipe = lo_bound_tipe;
    dim->num_elts_tipe = num_elts_tipe;
    AddDim( ar, (dim_any *) dim );
    ar->is_variable = TRUE;
}

extern  dbg_type _CGAPI DBEndArray( array_list  *ar ) {
/*****************************************************/

    dbg_type ret;

#ifndef NDEBUG
    EchoAPI( "DBEndArray( %i )", ar );
#endif
    if( _IsModel( DBG_DF ) ) {
        ret =  DFEndArray( ar );
    }else if( _IsModel( DBG_CV ) ) {
        ret =  CVEndArray( ar );
    }else{
#if _TARGET &( _TARG_IAPX86 | _TARG_80386 )
        ret = WVEndArray( ar );
#else
        ret = 0;
#endif
    }
    _Free( ar, sizeof( array_list ) );
#ifndef NDEBUG
    EchoAPI( " -> %i\n", ret );
#endif
    return( ret );
}

extern  dbg_type _CGAPI DBIntArray( unsigned_32 hi, dbg_type base ) {
/*******************************************************************/

    dbg_type ret;

#ifndef NDEBUG
    EchoAPI(  "DBIntArray( %i, %i )", hi, base );
#endif
    if( _IsModel( DBG_DF ) ) {
        ret = DFIntArray( hi, base );
    }else if( _IsModel( DBG_CV ) ) {
        ret = CVIntArray( hi, base );
    }else{
#if _TARGET &( _TARG_IAPX86 | _TARG_80386 )
        ret = WVIntArray( hi, base );
#else
        ret = 0;
#endif
    }
#ifndef NDEBUG
    EchoAPI( " -> %i\n", ret );
#endif
    return( ret );
}

extern  dbg_type _CGAPI DBIntArrayCG( cg_type tipe, unsigned_32 hi, dbg_type base ) {
/*******************************************************************/

    dbg_type          ret;
    type_def          *tipe_addr;

#ifndef NDEBUG
    EchoAPI( "DBIntArrayCG( %t, %i, %i )", tipe, hi, base );
#endif
    tipe_addr = TypeAddress( tipe );
    if( _IsModel( DBG_DF ) ) {
        ret = DFIntArray( hi, base );
    }else if( _IsModel( DBG_CV ) ) {
        ret = CVArraySize( tipe_addr->length, hi, base );
    }else{
#if _TARGET &( _TARG_IAPX86 | _TARG_80386 )
        ret = WVIntArray( hi, base );
#else
        ret = 0;
#endif
    }
#ifndef NDEBUG
    EchoAPI( " -> %i\n", ret );
#endif
    return( ret );
}

extern  dbg_type _CGAPI DBSubRange( signed_32 lo, signed_32 hi,
                                    dbg_type base ) {
/***************************************************/

    dbg_type ret;

#ifndef NDEBUG
    EchoAPI( "DBSubRange( %i, %i, %i )", lo, hi, base );
#endif
    if( _IsModel( DBG_DF ) ) {
        ret = DFSubRange( lo, hi, base );
    }else if( _IsModel( DBG_CV ) ) {
        ret = CVSubRange( lo, hi, base );
    }else{
#if _TARGET &( _TARG_IAPX86 | _TARG_80386 )
        ret = WVSubRange( lo, hi, base );
#else
        ret = 0;
#endif
    }
#ifndef NDEBUG
    EchoAPI( " -> %i\n", ret );
#endif
    return( ret );
}


extern  dbg_type _CGAPI DBDereference( cg_type ptr_type, dbg_type base ) {
/************************************************************************/

    dbg_type ret;


#ifndef NDEBUG
    EchoAPI( "DBDereference( %t, %i)", ptr_type, base );
#endif
    if( _IsModel( DBG_DF ) ) {
        ret = DFDereference( ptr_type, base );
    }else if( _IsModel( DBG_CV ) ) {
        ret = CVDereference( ptr_type, base );
    }else{
#if _TARGET &( _TARG_IAPX86 | _TARG_80386 )
        ret = WVDereference( ptr_type, base );
#else
        ret = 0;
#endif
    }

#ifndef NDEBUG
    EchoAPI( " -> %i\n", ret );
#endif
    return( ret );
}

extern  dbg_type _CGAPI DBPtr( cg_type ptr_type, dbg_type base ) {
/****************************************************************/

    dbg_type ret;

#ifndef NDEBUG
    EchoAPI( "DBPtr( %t, %i )", ptr_type, base );
#endif
    if( _IsModel( DBG_DF ) ) {
        ret = DFPtr( ptr_type, base );
    }else if( _IsModel( DBG_CV ) ) {
        ret = CVPtr( ptr_type, base );
    }else{
#if _TARGET &( _TARG_IAPX86 | _TARG_80386 )
        ret = WVPtr( ptr_type, base );
#else
        ret = 0;
#endif
    }
#ifndef NDEBUG
    EchoAPI( " -> %i\n", ret );
#endif
    return( ret );
}

extern  dbg_type _CGAPI DBBasedPtr( cg_type ptr_type, dbg_type base,
                                        dbg_loc loc_segment ) {
/****************************************************************/

    dbg_type ret;

#ifndef NDEBUG
    EchoAPI("DBBasedPtr( %t, %i, %i )", ptr_type, base, loc_segment );
#endif
    if( _IsModel( DBG_DF ) ) {
        ret = DFBasedPtr( ptr_type, base, loc_segment );
    }else if( _IsModel( DBG_CV ) ) {
        ret = CVBasedPtr( ptr_type, base, loc_segment );
    }else{
#if _TARGET &( _TARG_IAPX86 | _TARG_80386 )
        ret = WVBasedPtr( ptr_type, base, loc_segment );
#else
        ret = 0;
#endif
    }
#ifndef NDEBUG
    EchoAPI( " -> %i\n", ret );
#endif
    return( ret );
}


extern char _CGAPI DBNested( char nested ){
/*****************************************/
    char ret;

#ifndef NDEBUG
    EchoAPI( "DBNested(%i)", nested );
#endif
    ret = Nested;
    Nested = nested;
#ifndef NDEBUG
    EchoAPI( " -> %i\n", nested );
#endif
    return( nested );
}

extern  struct_list * _CGAPI DBBegNameStruct( char *nm, cg_type tipe, char is_struct ) {
/********************************************************************/

    uint      n_len;
    struct_list *st;

#ifndef NDEBUG
    EchoAPI( "DBBegNameStruct( %c, %t, %i )", nm, tipe, is_struct );
#endif
    n_len = Length( nm );
    _Alloc( st, sizeof( struct_list ) + n_len );
    strcpy( st->name, nm );
    st->num = 0;
    st->list = NULL;
    st->list_tail = &st->list;
    st->size = TypeAddress( tipe )->length;
    st->is_struct = is_struct;   /* v.s. union */
    st->is_class = FALSE;
    st->is_nested = Nested;
    st->is_cnested = FALSE;
    if( _IsModel(DBG_DF) ){
        DFBegStruct( st );
    }else if( _IsModel( DBG_CV ) ) {
//       CVBegStruct( st );
       st->me = DBG_NIL_TYPE;
    }else{
        st->me = DBG_NIL_TYPE;
    }
    st->vtbl_off    = 0;
    st->vtbl_type  = DBG_NIL_TYPE;
    st->ptr_type  = 0;
    st->vtbl_esize = 0;
    st->vf = NULL;
#ifndef NDEBUG
    EchoAPI( " -> %i\n", st );
#endif
    return( st );
}

extern  struct_list * _CGAPI DBBegStruct( cg_type tipe, char is_struct ) {
/********************************************************************/

    struct_list *st;

#ifndef NDEBUG
    EchoAPI( "DBBegStruct( %t, %i )", tipe, is_struct );
#endif

    st = DBBegNameStruct( "", tipe, is_struct );

#ifndef NDEBUG
    EchoAPI( " -> %i\n", st );
#endif
    return( st );
}

static  field_member     *CreateMember( char *nm, byte strt, byte len,
                                        dbg_type base, uint attr ) {
/******************************************************************/
    uint          n_len;
    field_member *field;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?