示例#1
0
/*******************
 compareOrigTypes

 Specialized function to catch if two enumerations, two selects, or two aggrs
 of either, are of the same type.  The issue is that e.g. select B may be a
 rename of sel A (i.e., TYPE B = A;).  Such renamed types are implemented by
 fedex_plus with typedefs, so that they are in fact the same type.  TYPEget_-
 ctype() is used for most type comparisons and does not consider renamed types
 equivalent.  This function is called in instances when they should be consi-
 dered equivalent.  One such case is the generation of duplicate lists.
 *******************/
static int
compareOrigTypes( Type a, Type b ) {
    Type t, u;

    if( ( TYPEis_select( a ) && TYPEis_select( b ) )
            || ( TYPEis_enumeration( a ) && TYPEis_enumeration( b ) ) ) {
        t = a;
        u = b;
    } else if( TYPEis_aggregate( a ) && TYPEis_aggregate( b ) ) {
        t = TYPEget_base_type( a );
        u = TYPEget_base_type( b );
        if( !( ( TYPEis_select( t ) && TYPEis_select( u ) )
                || ( TYPEis_enumeration( t ) && TYPEis_enumeration( u ) ) ) ) {
            return FALSE;
            /* Only go further with 1D aggregates of sels or enums.  Note that
            // for 2D aggrs and higher we do not continue.  These are all recog-
            // nized to be the same type ("GenericAggregate") by TYPEget_ctype(),
            // and do not have to be handled specially here. */
        }
    } else {
        return FALSE;
    }

    if( TYPEget_head( t ) ) {
        t = TYPEget_ancestor( t );
    }
    if( TYPEget_head( u ) ) {
        u = TYPEget_ancestor( u );
    }
    return ( !strcmp( TYPEget_name( t ), TYPEget_name( u ) ) );
}
示例#2
0
const char * TypeDescriptorName( Type t ) {
    static char b [BUFSIZ];
    Schema parent = t->superscope;
    /* NOTE - I corrected a prev bug here in which the *current* schema was
    ** passed to this function.  Now we take "parent" - the schema in which
    ** Type t was defined - which was actually used to create t's name. DAR */

    if( !parent ) {
        parent = TYPEget_body( t )->entity->superscope;
        /* This works in certain cases that don't work otherwise (basically a
        ** kludge).  For some reason types which are really entity choices of
        ** a select have no superscope value, but their super may be tracked
        ** by following through the entity they reference, as above. */
    }

    sprintf( b, "%s::%s%s", SCHEMAget_name( parent ), TYPEprefix( t ),
             TYPEget_name( t ) );
    return b;
}
示例#3
0
const char *
SEL_ITEMget_enumtype( Type t ) {
    return StrToUpper( TYPEget_name( t ) );
}