remove code that is commented out or disabled by '#if 0'
This commit is contained in:
1 parent
df87e02127
commit
d7410be164
6 files changed
+11
-1452
No files matched your search
+2
-595
@@ -287,66 +287,6 @@ ENTITYresolve_attr_ref( Entity e, Symbol * grp_ref, Symbol * attr_ref ) {
|
||||
return attr;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* find a simple object referred to be an entity */
|
||||
/* such as an entity, proc, etc. */
|
||||
Generic
|
||||
ENTITY_lookup( Entity entity, char * name ) {
|
||||
Generic result;
|
||||
|
||||
/* avoid searching scopes that we've already searched */
|
||||
/* this can happen due to several things */
|
||||
/* if A ref's B which ref's C, and A ref's C. Then C */
|
||||
/* can be searched twice by A. Similar problem with */
|
||||
/* sub/super inheritance. */
|
||||
#if 0
|
||||
if( entity->last_search == __ENTITY_search_count ) {
|
||||
return NULL;
|
||||
}
|
||||
entity->last_search = __ENTITY_search_count;
|
||||
#endif
|
||||
|
||||
/* first look locally */
|
||||
result = DICTlookup( entity->symbol_table, name );
|
||||
if( result != 0 ) {
|
||||
ENTITY_type = DICT_type;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* look in the rest of the schema */
|
||||
/* note that this convenient gets things LOCAL to schema, but not */
|
||||
/* LOCAL to any declarations inside the schema (like a proc) or */
|
||||
/* another entity's attributes */
|
||||
result = DICTlookup( entity->schema->symbol_table, name );
|
||||
if( result != 0 ) {
|
||||
ENTITY_type = DICT_type;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* check if it's explicitly REFERENCE'd */
|
||||
result = DICTlookup( entity->schema->referenced_objects, name );
|
||||
if( result != 0 ) {
|
||||
ENTITY_type = DICT_type;
|
||||
experrc = ERROR_none;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* check if it is one of the object ref'd implicitly by only a */
|
||||
/* schema name */
|
||||
LISTdo( entity->schema->referenced_schemas, schema, Schema * )
|
||||
/* would be nice if we could prevent these referenced scopes from */
|
||||
/* being looked up more than once in a single scopelookup */
|
||||
result = DICTlookup( schema->symbol_table, name );
|
||||
if( result ) {
|
||||
return( result );
|
||||
}
|
||||
LISTod;
|
||||
|
||||
experrc = ERROR_undefined_identifier;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Procedure: ENTITY_create/free/copy/equal
|
||||
** Description: These are the low-level defining functions for Class_Entity
|
||||
@@ -381,104 +321,6 @@ ENTITYcopy( Entity e ) {
|
||||
return e2;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void
|
||||
ENTITY_free( Generic dummy ) {
|
||||
struct Entity * entity = ( struct Entity * )dummy;
|
||||
Error experrc;
|
||||
|
||||
OBJfree( entity->attributes, &experrc );
|
||||
OBJfree( entity->supertypes, &experrc );
|
||||
OBJfree( entity->subtypes, &experrc );
|
||||
OBJfree( entity->subtype_expression, &experrc );
|
||||
OBJfree( entity->unique, &experrc );
|
||||
OBJfree( entity->constraints, &experrc );
|
||||
OBJfree( entity->instances, &experrc );
|
||||
}
|
||||
|
||||
void
|
||||
ENTITY_copy( Generic dummy1, Generic dummy2 ) {
|
||||
struct Entity * dest = ( struct Entity * )dummy1;
|
||||
struct Entity * source = ( struct Entity * )dummy2;
|
||||
Error experrc;
|
||||
|
||||
dest->supertypes = OBJcopy( source->supertypes, &experrc );
|
||||
dest->subtypes = OBJcopy( source->subtypes, &experrc );
|
||||
dest->subtype_expression = OBJcopy( source->subtype_expression, &experrc );
|
||||
dest->attributes = OBJcopy( source->attributes, &experrc );
|
||||
dest->inheritance = source->inheritance;
|
||||
dest->attribute_count = source->attribute_count;
|
||||
dest->unique = OBJcopy( source->unique, &experrc );
|
||||
dest->constraints = OBJcopy( source->constraints, &experrc );
|
||||
dest->instances = OBJcopy( source->instances, &experrc );
|
||||
dest->mark = source->mark;
|
||||
}
|
||||
|
||||
bool
|
||||
ENTITY_equal( Generic dummy1, Generic dummy2 ) {
|
||||
struct Entity * entity1 = ( struct Entity * )dummy1;
|
||||
struct Entity * entity2 = ( struct Entity * )dummy2;
|
||||
Error experrc;
|
||||
|
||||
return ( OBJequal( entity1->attributes, entity2->attributes, &experrc ) &&
|
||||
OBJequal( entity1->supertypes, entity2->supertypes, &experrc ) );
|
||||
}
|
||||
|
||||
void
|
||||
ENTITY_print( Generic dummy ) {
|
||||
struct Entity * entity = ( struct Entity * )dummy;
|
||||
|
||||
if( print_none( entity_print ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( print_some( entity_print, supertypes ) ) {
|
||||
iprint( "supertypes:\n" );
|
||||
OBJprint( entity->supertypes );
|
||||
}
|
||||
if( print_some( entity_print, subtypes ) ) {
|
||||
iprint( "subtype list:\n" );
|
||||
OBJprint( entity->subtypes );
|
||||
}
|
||||
if( print_some( entity_print, subtype_expression ) ) {
|
||||
iprint( "subtype expr:\n" );
|
||||
OBJprint( entity->subtype_expression );
|
||||
}
|
||||
if( print_some( entity_print, attributes ) ) {
|
||||
int i;
|
||||
|
||||
LISTdo( entity->attributes, name, String )
|
||||
iprint( "attribute %d: %s\n", i++, name );
|
||||
LISTod;
|
||||
}
|
||||
if( print_some( entity_print, inheritance ) ) {
|
||||
iprint( "inheritance: %d\n", entity->inheritance );
|
||||
}
|
||||
if( print_some( entity_print, attribute_count ) ) {
|
||||
iprint( "attribute_count: %d\n", entity->attribute_count );
|
||||
}
|
||||
if( print_some( entity_print, unique ) ) {
|
||||
iprint( "unique:\n" );
|
||||
OBJprint( entity->unique );
|
||||
}
|
||||
if( print_some( entity_print, constraints ) ) {
|
||||
iprint( "constraints:\n" );
|
||||
OBJprint( entity->constraints );
|
||||
}
|
||||
if( print_some( entity_print, instances ) ) {
|
||||
iprint( "instances:\n" );
|
||||
OBJprint( entity->instances );
|
||||
}
|
||||
if( print_some( entity_print, mark ) ) {
|
||||
iprint( "mark: %d\n", entity->mark );
|
||||
}
|
||||
if( print_some( entity_print, abstract ) ) {
|
||||
iprint( "abstract: %s\n", BOOLprint( entity->abstract ) );
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*0*/
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYinitialize
|
||||
** Parameters: -- none --
|
||||
@@ -493,58 +335,6 @@ ENTITYinitialize() {
|
||||
OBJ_ENTITY_BITS );
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYput_name
|
||||
** Parameters: Entity entity - entity to modify
|
||||
** String name - entity's name
|
||||
** Returns: void
|
||||
** Description: Set the name of an entity.
|
||||
*/
|
||||
|
||||
/* this function is defined as a macro in entity.h */
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYput_supertypes
|
||||
** Parameters: Entity entity - entity to modify
|
||||
** Linked_List list - superclass entity name Symbols
|
||||
** Returns: void
|
||||
** Description: Set the (immediate) supertype list of an entity.
|
||||
*/
|
||||
|
||||
void
|
||||
ENTITYput_supertypes( Entity entity, Linked_List list ) {
|
||||
struct Entity * data;
|
||||
Error experrc;
|
||||
|
||||
data = ( struct Entity * )OBJget_data( entity, Class_Entity, &experrc );
|
||||
OBJfree( data->supertypes, &experrc );
|
||||
data->supertypes = OBJreference( list );
|
||||
}
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYput_subtypes
|
||||
** Parameters: Entity entity - entity to modify
|
||||
** Expression expression - controlling subtype expression
|
||||
** Returns: void
|
||||
** Description: Set the (immediate) subtypes of an entity.
|
||||
*/
|
||||
|
||||
void
|
||||
ENTITYput_subtypes( Entity entity, Expression expression ) {
|
||||
struct Entity * data;
|
||||
Error experrc;
|
||||
|
||||
data = ( struct Entity * )OBJget_data( entity, Class_Entity, &experrc );
|
||||
OBJfree( data->subtypes, &experrc );
|
||||
OBJfree( data->subtype_expression, &experrc );
|
||||
data->subtypes = LIST_NULL;
|
||||
data->subtype_expression = OBJreference( expression );
|
||||
}
|
||||
|
||||
#endif /*0*/
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYadd_attribute
|
||||
** Parameters: Entity entity - entity to modify
|
||||
@@ -573,60 +363,6 @@ ENTITYadd_attribute( Entity entity, Variable attr ) {
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYput_uniqueness_list
|
||||
** Parameters: Entity entity - entity to modify
|
||||
** Linked_List list - uniqueness list of Linked_Lists
|
||||
** Returns: void
|
||||
** Description: Set the attribute uniqueness list of an entity.
|
||||
**
|
||||
** Notes: Each element of the uniqueness list should itself be
|
||||
** a list. The elements of these sublists are attribute names.
|
||||
** The attributes in a single sublist, when taken together, must
|
||||
** uniquely determine an entity instatiation. Thus, if person_name
|
||||
** has a sublist (first, last), then no two person_name entities
|
||||
** may share the same first and last names.
|
||||
*/
|
||||
|
||||
void
|
||||
ENTITYput_uniqueness_list( Entity entity, Linked_List list ) {
|
||||
Symbol sym;
|
||||
|
||||
entity->u.entity->unique = list;
|
||||
LISTdo( list, c, Linked_List )
|
||||
sym = ( Symbol )LISTpeek_first( list );
|
||||
DICTdefine( entity->symbol_table, sym.name, , &sym,
|
||||
);
|
||||
LISTod;
|
||||
}
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYput_constraints
|
||||
** Parameters: Entity entity - entity to modify
|
||||
** Linked_List constraints - list of constraints (Expressions)
|
||||
** which entity must satisfy
|
||||
** Returns: void
|
||||
** Description: Set the constraints on an entity.
|
||||
**
|
||||
** Notes: This is a list of constraints which must be satisfied by
|
||||
** each instatiation of the entity, or by the set of all
|
||||
** instantiations of the entity.
|
||||
*/
|
||||
|
||||
void
|
||||
ENTITYput_constraints( Entity entity, Linked_List list ) {
|
||||
struct Entity * data;
|
||||
Error experrc;
|
||||
|
||||
data = ( struct Entity * )OBJget_data( entity, Class_Entity, &experrc );
|
||||
OBJfree( data->constraints, &experrc );
|
||||
data->constraints = OBJreference( list );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYadd_instance
|
||||
** Parameters: Entity entity - entity to modify
|
||||
@@ -643,41 +379,6 @@ ENTITYadd_instance( Entity entity, Generic instance ) {
|
||||
LISTadd( entity->u.entity->instances, instance );
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYdelete_instance
|
||||
** Parameters: Entity entity - entity to modify
|
||||
** Generic instance - instance to delete
|
||||
** Returns: void
|
||||
** Description: Remove an item from the instance list of an entity.
|
||||
*/
|
||||
|
||||
void
|
||||
ENTITYdelete_instance( Entity entity, Generic instance ) {
|
||||
struct Entity * data;
|
||||
Error experrc;
|
||||
|
||||
data = ( struct Entity * )OBJget_data( entity, Class_Entity, &experrc );
|
||||
LISTdo_links( data->instances, link )
|
||||
if( link->data == instance ) {
|
||||
LISTremove( data->instances, link );
|
||||
}
|
||||
LISTod;
|
||||
}
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYput_mark
|
||||
** Parameters: Entity entity - entity to modify
|
||||
** int value - new mark for entity
|
||||
** Returns: void
|
||||
** Description: Set an entity's mark.
|
||||
*/
|
||||
|
||||
/* this function is inlined in entity.h */
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYhas_supertype
|
||||
** Parameters: Entity child - entity to check parentage of
|
||||
@@ -692,89 +393,7 @@ ENTITYhas_supertype( Entity child, Entity parent ) {
|
||||
if( entity == parent ) {
|
||||
return true;
|
||||
}
|
||||
#if 0
|
||||
if( OBJis_kind_of( entity, Class_Entity ) &&
|
||||
ENTITYhas_supertype( entity, parent ) )
|
||||
#endif
|
||||
if( ENTITYhas_supertype( entity, parent ) ) {
|
||||
return true;
|
||||
}
|
||||
LISTod;
|
||||
return false;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYget_supertype (by name)
|
||||
** Parameters: Entity child - entity to check parentage of
|
||||
** String supername- entity to check for
|
||||
** Returns: Boolean - does child's superclass chain include named entity?
|
||||
** Description: Returns supertype given name and entity (or ENTITY_NULL).
|
||||
*/
|
||||
|
||||
Entity
|
||||
ENTITYget_supertype( Entity child, String supername ) {
|
||||
struct Entity * data;
|
||||
Error experrc;
|
||||
|
||||
data = ( struct Entity * )OBJget_data( child, Class_Entity, &experrc );
|
||||
LISTdo( data->supertypes, super, Entity )
|
||||
if( STRINGequal( supername, ENTITYget_name( super ) ) ) {
|
||||
return( super );
|
||||
}
|
||||
if( OBJis_kind_of( super, Class_Entity ) )
|
||||
if( ENTITY_NULL != ( super = ENTITYget_supertype( super, supername ) ) ) {
|
||||
return( super );
|
||||
}
|
||||
LISTod;
|
||||
return ENTITY_NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYget_subtype (by name)
|
||||
** Parameters: Entity child - entity to check parentage of
|
||||
** String subname - entity to check for
|
||||
** Returns: Boolean - does child's subclass chain include named entity?
|
||||
** Description: Returns subtype given name and entity (or ENTITY_NULL).
|
||||
*/
|
||||
|
||||
Entity
|
||||
ENTITYget_subtype( Entity child, String subname ) {
|
||||
struct Entity * data;
|
||||
Error experrc;
|
||||
|
||||
data = ( struct Entity * )OBJget_data( child, Class_Entity, &experrc );
|
||||
LISTdo( data->subtypes, sub, Entity )
|
||||
if( STRINGequal( subname, ENTITYget_name( sub ) ) ) {
|
||||
return( sub );
|
||||
}
|
||||
if( ENTITY_NULL != ( sub = ENTITYget_subtype( sub, subname ) ) ) {
|
||||
return( sub );
|
||||
}
|
||||
LISTod;
|
||||
return ENTITY_NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYhas_subtype
|
||||
** Parameters: Entity parent - entity to check descendants of
|
||||
** Entity child - child to check for
|
||||
** Returns: Boolean - does parent's subclass tree include child?
|
||||
** Description: Look for a certain entity in the subtype graph of an entity.
|
||||
*/
|
||||
|
||||
bool
|
||||
ENTITYhas_subtype( Entity parent, Entity child ) {
|
||||
struct Entity * data;
|
||||
Error experrc;
|
||||
|
||||
data = ( struct Entity * )OBJget_data( parent, Class_Entity, &experrc );
|
||||
LISTdo( data->subtypes, entity, Entity )
|
||||
if( OBJequal( entity, child, &experrc ) ) {
|
||||
return true;
|
||||
}
|
||||
if( ENTITYhas_subtype( entity, child ) ) {
|
||||
if( ENTITYhas_supertype( entity, parent ) ) {
|
||||
return true;
|
||||
}
|
||||
LISTod;
|
||||
@@ -789,10 +408,7 @@ ENTITYhas_subtype( Entity parent, Entity child ) {
|
||||
** Description: Check whether an entity has a specific immediate superclass.
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
bool
|
||||
ENTITYhas_immediate_supertype( Entity child, Entity parent ) {
|
||||
bool ENTITYhas_immediate_supertype( Entity child, Entity parent ) {
|
||||
LISTdo( child->u.entity->supertypes, entity, Entity )
|
||||
if( entity == parent ) {
|
||||
return true;
|
||||
@@ -801,119 +417,6 @@ ENTITYhas_immediate_supertype( Entity child, Entity parent ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYhas_immediate_subtype
|
||||
** Parameters: Entity parent - entity to check children of
|
||||
** Entity child - child to check for
|
||||
** Returns: Boolean - is child a direct subtype of parent?
|
||||
** Description: Check whether an entity has a specific immediate subclass.
|
||||
*/
|
||||
|
||||
bool
|
||||
ENTITYhas_immediate_subtype( Entity parent, Entity child ) {
|
||||
LISTdo( parent->u.entity->subtypes, entity, Entity )
|
||||
if( entity == child ) {
|
||||
return true;
|
||||
}
|
||||
LISTod;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
ENTITYhas_immediate_subtype( Entity parent, Entity child ) {
|
||||
struct Entity * data;
|
||||
Error experrc;
|
||||
|
||||
data = ( struct Entity * )OBJget_data( parent, Class_Entity, &experrc );
|
||||
LISTdo( data->subtypes, entity, Entity )
|
||||
if( OBJequal( entity, child, &experrc ) ) {
|
||||
return true;
|
||||
}
|
||||
LISTod;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYget_name
|
||||
** Parameters: Entity entity - entity to examine
|
||||
** Returns: String - entity name
|
||||
** Description: Retrieve the name of an entity.
|
||||
*/
|
||||
|
||||
/* this function is defined as a macro in entity.h */
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYget_supertypes
|
||||
** Parameters: Entity entity - entity to examine
|
||||
** Returns: Linked_List of Entity - immediate supertypes of this entity
|
||||
** Description: Retrieve a list of an entity's immediate supertypes.
|
||||
*/
|
||||
|
||||
/* this function is defined as a macro in entity.h */
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYget_subtypes
|
||||
** Parameters: Entity entity - entity to examine
|
||||
** Returns: Linked_List of Entity - immediate subtypes of this entity
|
||||
** Description: Retrieve a list of an entity's immediate subtypes.
|
||||
*/
|
||||
|
||||
Linked_List
|
||||
ENTITYget_subtypes( Entity entity ) {
|
||||
struct Entity * data;
|
||||
Error experrc;
|
||||
|
||||
data = ( struct Entity * )OBJget_data( entity, Class_Entity, &experrc );
|
||||
return OBJreference( data->subtypes );
|
||||
}
|
||||
|
||||
/*
|
||||
** Procedure: ENTITY{get,put}_abstract
|
||||
** Parameters: Entity entity - entity to examine
|
||||
** Boolean abstract - is entity abstract?
|
||||
** Returns: Boolean - is entity abstract?
|
||||
** Description: Retrieve/Set whether an entity is abstract.
|
||||
*/
|
||||
|
||||
bool
|
||||
ENTITYget_abstract( Entity entity ) {
|
||||
struct Entity * data;
|
||||
Error experrc;
|
||||
|
||||
data = ( struct Entity * )OBJget_data( entity, Class_Entity, &experrc );
|
||||
return data->abstract;
|
||||
}
|
||||
|
||||
void
|
||||
ENTITYput_abstract( Entity entity, bool abstract ) {
|
||||
struct Entity * data;
|
||||
Error experrc;
|
||||
|
||||
data = ( struct Entity * )OBJget_data( entity, Class_Entity, &experrc );
|
||||
data->abstract = abstract;
|
||||
}
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYget_subtype_expression
|
||||
** Parameters: Entity entity - entity to examine
|
||||
** Returns: Expression - immediate subtype expression
|
||||
** Description: Retrieve the controlling expression for an entity's
|
||||
** immediate subtype list.
|
||||
*/
|
||||
|
||||
Expression
|
||||
ENTITYget_subtype_expression( Entity entity ) {
|
||||
struct Entity * data;
|
||||
Error experrc;
|
||||
|
||||
data = ( struct Entity * )OBJget_data( entity, Class_Entity, &experrc );
|
||||
return OBJreference( data->subtype_expression );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYget_all_attributes
|
||||
** Parameters: Entity entity - entity to examine
|
||||
@@ -933,11 +436,6 @@ ENTITY_get_all_attributes( Entity entity, Linked_List result ) {
|
||||
ENTITY_get_all_attributes( super, result );
|
||||
LISTod;
|
||||
/* Gee, aren't they resolved by this time? */
|
||||
#if 0
|
||||
LISTdo( entity->attributes, name, char * )
|
||||
LISTadd_last( result,
|
||||
( Generic )SCOPElookup( entity, name, False, &experrc ) );
|
||||
#endif
|
||||
LISTdo( entity->u.entity->attributes, attr, Generic )
|
||||
LISTadd_last( result, attr );
|
||||
LISTod;
|
||||
@@ -1069,94 +567,3 @@ ENTITYget_initial_offset( Entity entity ) {
|
||||
|
||||
/* macroized in entity.h */
|
||||
|
||||
#if 0
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYget_uniqueness_list
|
||||
** Parameters: Entity entity - entity to examine
|
||||
** Returns: Linked_List of Linked_List - this entity's uniqueness sets
|
||||
** Description: Retrieve an entity's uniqueness list.
|
||||
**
|
||||
** Notes: For a description of the uniqueness list, see the notes to
|
||||
** ENTITYput_uniqueness_list.
|
||||
*/
|
||||
|
||||
Linked_List
|
||||
ENTITYget_uniqueness_list( Entity entity ) {
|
||||
struct Entity * data;
|
||||
Error experrc;
|
||||
|
||||
data = ( struct Entity * )OBJget_data( entity, Class_Entity, &experrc );
|
||||
return OBJreference( data->unique );
|
||||
}
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYget_constraints
|
||||
** Parameters: Entity entity - entity to examine
|
||||
** Returns: Linked_List of Expression - this entity's constraints
|
||||
** Description: Retrieve the list of constraints on an entity.
|
||||
*/
|
||||
|
||||
Linked_List
|
||||
ENTITYget_constraints( Entity entity ) {
|
||||
struct Entity * data;
|
||||
Error experrc;
|
||||
|
||||
data = ( struct Entity * )OBJget_data( entity, Class_Entity, &experrc );
|
||||
return OBJreference( data->constraints );
|
||||
}
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYget_instances
|
||||
** Parameters: Entity entity - entity to examine
|
||||
** Returns: Linked_List - list of instances
|
||||
** Description: Retrieve a list of instances of an entity.
|
||||
*/
|
||||
|
||||
Linked_List
|
||||
ENTITYget_instances( Entity entity ) {
|
||||
struct Entity * data;
|
||||
Error experrc;
|
||||
|
||||
data = ( struct Entity * )OBJget_data( entity, Class_Entity, &experrc );
|
||||
return OBJreference( data->instances );
|
||||
}
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYput_resolved
|
||||
** Parameters: Entity entity - entity to modify
|
||||
** Returns: void
|
||||
** Description: Set the 'resolved' flag for an entity.
|
||||
**
|
||||
** Notes: This should be called only when the entity has indeed
|
||||
** been resolved.
|
||||
*/
|
||||
|
||||
/* this function is defined as a macro in entity.h */
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYget_resolved
|
||||
** Parameters: Entity entity - entity to examine
|
||||
** Returns: Boolean - has entity been resolved?
|
||||
** Description: Checks whether references within an entity have been resolved.
|
||||
*/
|
||||
|
||||
/* this function is defined as a macro in entity.h */
|
||||
|
||||
/*
|
||||
** Procedure: ENTITYput_inheritance_count
|
||||
** Parameters: Entity entity - entity to modify
|
||||
** int count - number of inherited attributes
|
||||
** Returns: void
|
||||
** Description: Set the count of attributes inherited by an entity.
|
||||
**
|
||||
** Notes: This should be computed automatically (perhaps only when
|
||||
** needed), and this call removed. The count is currently
|
||||
** computed by ENTITYresolve().
|
||||
*/
|
||||
|
||||
void
|
||||
ENTITYput_inheritance_count( Entity e, int count ) {
|
||||
e->u.entity->inheritance = count;
|
||||
}
|
||||
#endif
|
||||
+6
-732
File diff suppressed because it is too large.
Load diff
@@ -50,7 +50,6 @@ N350 ( August 31, 1993 ) of ISO 10303 TC184/SC4/WG7.
|
||||
#define SCHEMA_FILE_PREFIX "Sdai"
|
||||
#define TYPE_PREFIX "Sdai"
|
||||
#define ENTITYCLASS_PREFIX TYPE_PREFIX
|
||||
/*#define ENUM_PREFIX "SDAI_"*/
|
||||
#define ENUM_PREFIX ""
|
||||
|
||||
#define move(b) (b = (b + strlen(b)))
|
||||
@@ -134,11 +133,9 @@ void SCHEMAprint( Schema, FILES *, Express, void *, int );
|
||||
Type TYPEget_ancestor( Type );
|
||||
|
||||
/*Variable*/
|
||||
/*VARis_simple_explicit (Variable a)*/
|
||||
#define VARis_simple_explicit(a) (!VARis_type_shifter(a))
|
||||
|
||||
/*Variable*/
|
||||
/*VARis_simple_derived (Variable a)*/
|
||||
#define VARis_simple_derived(a) (!VARis_overrider(a))
|
||||
|
||||
/* Added for multiple schema support: */
|
||||
|
||||
@@ -38,8 +38,6 @@ void
|
||||
create_builtin_type_decl( FILES * files, char * name ) {
|
||||
fprintf( files->incall, "extern TypeDescriptor *%s%s_TYPE;\n",
|
||||
TD_PREFIX, name );
|
||||
/* fprintf(files->initall,"TypeDescriptor *%s%s_TYPE;\n",*/
|
||||
/* TD_PREFIX,name);*/
|
||||
}
|
||||
|
||||
void
|
||||
@@ -130,30 +128,6 @@ print_file_header( Express express, FILES * files ) {
|
||||
files -> classes = FILEcreate( "Sdaiclasses.h" );
|
||||
fprintf( files->classes, "/* %cId$ */ \n", '$' );
|
||||
fprintf( files->classes, "#include <schema.h>\n" );
|
||||
|
||||
/* create built-in types */
|
||||
/* no need to generate
|
||||
create_builtin_type_decl(files,"INTEGER");
|
||||
create_builtin_type_decl(files,"REAL");
|
||||
create_builtin_type_decl(files,"STRING");
|
||||
create_builtin_type_decl(files,"BINARY");
|
||||
create_builtin_type_decl(files,"BOOLEAN");
|
||||
create_builtin_type_decl(files,"LOGICAL");
|
||||
create_builtin_type_decl(files,"NUMBER");
|
||||
create_builtin_type_decl(files,"GENERIC");
|
||||
*/
|
||||
/* create built-in types */
|
||||
/* no need to generate
|
||||
create_builtin_type_defn(files,"INTEGER");
|
||||
create_builtin_type_defn(files,"REAL");
|
||||
create_builtin_type_defn(files,"STRING");
|
||||
create_builtin_type_defn(files,"BINARY");
|
||||
create_builtin_type_defn(files,"BOOLEAN");
|
||||
create_builtin_type_defn(files,"LOGICAL");
|
||||
create_builtin_type_defn(files,"NUMBER");
|
||||
create_builtin_type_defn(files,"GENERIC");
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
@@ -211,10 +185,6 @@ SCOPEPrint( Scope scope, FILES * files, Schema schema, Express model,
|
||||
fprintf( files -> lib, "\nSchema *%s%s =0;\n",
|
||||
SCHEMA_PREFIX, SCHEMAget_name( schema ) );
|
||||
|
||||
/* Not sure why needed - DAR
|
||||
fprintf (files -> inc, "\nclass SdaiModel_contents_%s;\n",
|
||||
SCHEMAget_name(schema)); */
|
||||
|
||||
/* Do \'new\'s for types descriptors (in SdaiAll.cc (files->create)),
|
||||
and the externs typedefs, and incomplete descriptors (in Sdai-
|
||||
classes.h (files->classes)). */
|
||||
@@ -365,22 +335,8 @@ SCOPEPrint( Scope scope, FILES * files, Schema schema, Express model,
|
||||
sprintf( nm, "%s%s", SCHEMA_PREFIX, SCHEMAget_name( s ) );
|
||||
fprintf( files->inc, "// \t include definitions for %s \n", nm );
|
||||
fprintf( files->inc, "#include <%s.h> \n", nm );
|
||||
#if 0
|
||||
l = SCOPEget_imports( s );
|
||||
fprintf( files -> inc, "/* the following are *assumed* in the express schema */\n" );
|
||||
LISTdo( l, s, Schema )
|
||||
fprintf( files -> inc, "/* include definitions for %s */\n",
|
||||
nm = ClassName( SCHEMAget_name( s ) ) );
|
||||
/* fprintf (files -> inc, "#include <%s.h> \n", nm);*/
|
||||
LISTod;
|
||||
#endif
|
||||
|
||||
LISTod;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
use_ref( schema, model, files );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -463,47 +419,11 @@ PrintModelContentsSchema( Scope scope, FILES * files, Schema schema,
|
||||
sprintf( nm, "%s%s", SCHEMA_PREFIX, SCHEMAget_name( s ) );
|
||||
fprintf( files->inc, "// \t include definitions for %s \n", nm );
|
||||
fprintf( files->inc, "#include <%s.h> \n", nm );
|
||||
#if 0
|
||||
l = SCOPEget_imports( s );
|
||||
fprintf( files -> inc, "/* the following are *assumed* in the express schema */\n" );
|
||||
LISTdo( l, s, Schema )
|
||||
fprintf( files -> inc, "/* include definitions for %s */\n",
|
||||
nm = ClassName( SCHEMAget_name( s ) ) );
|
||||
/* fprintf (files -> inc, "#include <%s.h> \n", nm);*/
|
||||
LISTod;
|
||||
#endif
|
||||
|
||||
LISTod;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* simulate USE/REFERENCE by creating links */
|
||||
/* assignments have to be done after all initializations above */
|
||||
void
|
||||
use_ref( Schema schema, Express model, FILES * files ) {
|
||||
DictionaryEntry de;
|
||||
Rename * r;
|
||||
|
||||
DICTdo_init( schema->u.schema->usedict, &de );
|
||||
while( 0 != ( r = ( Rename * )DICTdo( &de ) ) ) {
|
||||
|
||||
}
|
||||
|
||||
DICTdo_init( schema->u.schema->refdict, &de );
|
||||
while( 0 != ( r = ( Rename * )DICTdo( &de ) ) ) {
|
||||
|
||||
}
|
||||
|
||||
LISTdo( schema->u.schema->uselist, r, Rename * )
|
||||
LISTod
|
||||
|
||||
LISTdo( schema->u.schema->reflist, r, Rename * )
|
||||
LISTod
|
||||
}
|
||||
#endif
|
||||
|
||||
/******************************************************************
|
||||
** Procedure: SCHEMAprint
|
||||
** Parameters: const Schema schema - schema to print
|
||||
@@ -567,13 +487,6 @@ SCHEMAprint( Schema schema, FILES * files, Express model, void * complexCol,
|
||||
"#include <corbaSchema.h> \n"
|
||||
"#endif \n" );
|
||||
|
||||
/* Generate local to SCHEMA.init.cc file */
|
||||
/* fprintf(incfile,"Schema *%s%s;\n",*/
|
||||
/* SCHEMA_PREFIX,SCHEMAget_name(schema));*/
|
||||
|
||||
/* fprintf (incfile, "extern void %sInit (Registry & r);\n", schnm);*/
|
||||
/* fprintf (incfile, "extern void SchemaInit (Registry & r);\n");*/
|
||||
|
||||
np = fnm + strlen( fnm ) - 1; /* point to end of constant part of string */
|
||||
|
||||
/* 2. class source file */
|
||||
@@ -582,6 +495,8 @@ SCHEMAprint( Schema schema, FILES * files, Express model, void * complexCol,
|
||||
return;
|
||||
}
|
||||
fprintf( libfile, "/* %cId$ */ \n", '$' );
|
||||
//TODO: Looks like this switches between 'schema.h' and a non-generic name. What is that name,
|
||||
//and how do we fully enable this feature (i.e. how to write the file with different name)?
|
||||
#ifdef SCHEMA_HANDLING
|
||||
sprintf( np, "h" );
|
||||
fprintf( libfile, "#ifndef %s\n", StrToConstant( sufnm ) );
|
||||
@@ -659,10 +574,8 @@ SCHEMAprint( Schema schema, FILES * files, Express model, void * complexCol,
|
||||
tmpstr_size = strlen( RULEto_string( r ) ) * 2;
|
||||
tmpstr = ( char * )malloc( sizeof( char ) * tmpstr_size );
|
||||
tmpstr[0] = '\0';
|
||||
/* printf("malloc'd: %d\n",tmpstr_size);*/
|
||||
}
|
||||
/*
|
||||
*/
|
||||
|
||||
fprintf( createall,
|
||||
"\tgr = new Global_rule(\"%s\",%s%s,\"%s\");\n",
|
||||
r->symbol.name,
|
||||
@@ -672,9 +585,6 @@ SCHEMAprint( Schema schema, FILES * files, Express model, void * complexCol,
|
||||
"\t%s%s->AddGlobal_rule(gr);\n",
|
||||
SCHEMA_PREFIX, SCHEMAget_name( schema ) );
|
||||
fprintf( createall, "/*\n%s\n*/\n", RULEto_string( r ) );
|
||||
#if 0
|
||||
fprintf( createall, "/*\n\"%s\"\n*/\n", format_for_stringout( RULEto_string( r ), tmpstr ) );
|
||||
#endif
|
||||
}
|
||||
/**************/
|
||||
/* add FUNCTIONs to Schema dictionary entry */
|
||||
@@ -686,19 +596,13 @@ SCHEMAprint( Schema schema, FILES * files, Express model, void * complexCol,
|
||||
}
|
||||
tmpstr_size = strlen( FUNCto_string( f ) ) * 2;
|
||||
tmpstr = ( char * )malloc( sizeof( char ) * tmpstr_size );
|
||||
/* printf("malloc'd: %d\n",tmpstr_size);*/
|
||||
}
|
||||
/* printf("tmpstr: %d\nfunc: %d\n",tmpstr_size,strlen(FUNCto_string(f)) );*/
|
||||
fprintf( createall,
|
||||
"#ifndef MSWIN\n\t%s%s->AddFunction(\"%s\");\n#endif\n",
|
||||
SCHEMA_PREFIX, SCHEMAget_name( schema ),
|
||||
format_for_stringout( FUNCto_string( f ), tmpstr ) );
|
||||
fprintf( createall, "/*\n%s\n*/\n", FUNCto_string( f ) );
|
||||
#if 0
|
||||
fprintf( createall, "/*\n\"%s\"\n*/\n", format_for_stringout( FUNCto_string( f ), tmpstr ) );
|
||||
#endif
|
||||
}
|
||||
/* if(tmpstr_size > 0) free(tmpstr); */
|
||||
|
||||
/* add PROCEDUREs to Schema dictionary entry */
|
||||
DICTdo_type_init( schema->symbol_table, &de, OBJ_PROCEDURE );
|
||||
@@ -746,10 +650,6 @@ SCHEMAprint( Schema schema, FILES * files, Express model, void * complexCol,
|
||||
SCOPEPrint( schema, files, schema, model, ( ComplexCollect * )complexCol,
|
||||
suffix );
|
||||
|
||||
#if 0
|
||||
/* create calls for connecting sub/supertypes */
|
||||
STypePrint( schema, files, schema );
|
||||
#endif
|
||||
|
||||
/********** close the files ***********/
|
||||
FILEclose( libfile );
|
||||
@@ -847,8 +747,6 @@ EXPRESSPrint( Express express, ComplexCollect & col, FILES * files ) {
|
||||
fprintf( incfile, "#include <OpenOODB.h>\n" );
|
||||
fprintf( incfile, "#endif\n\n" );
|
||||
fprintf( incfile, "#include <sdai.h> \n" );
|
||||
/* fprintf (incfile, "#include <schema.h> \n");*/
|
||||
/* fprintf (incfile, "extern void %sInit (Registry & r);\n", schnm);*/
|
||||
|
||||
np = fnm + strlen( fnm ) - 1; /* point to end of constant part of string */
|
||||
|
||||
|
||||
@@ -124,22 +124,10 @@ void print_schemas_separate( Express express, void * complexCol, FILES * files )
|
||||
while( ( schema = ( Scope )DICTdo( &de ) ) != 0 ) {
|
||||
fprintf( files->create,
|
||||
"\t//////////////// USE statements\n" );
|
||||
#if 0
|
||||
str = REFto_string( schema->u.schema->usedict, schema->u.schema->uselist, "USE", 0 );
|
||||
fprintf( files->create,
|
||||
"\t/*\n%s\n\t*/\n", str );
|
||||
free( str );
|
||||
#endif
|
||||
USEREFout( schema, schema->u.schema->usedict, schema->u.schema->use_schemas, "USE", files->create );
|
||||
|
||||
fprintf( files->create,
|
||||
"\t//////////////// REFERENCE statements\n" );
|
||||
#if 0
|
||||
str = REFto_string( schema->u.schema->refdict, schema->u.schema->reflist, "REFERENCE", 0 );
|
||||
fprintf( files->create,
|
||||
"\t/*\n%s\n\t*/\n", str );
|
||||
free( str );
|
||||
#endif
|
||||
USEREFout( schema, schema->u.schema->refdict, schema->u.schema->ref_schemas, "REFERENCE", files->create );
|
||||
}
|
||||
/*****************
|
||||
|
||||
@@ -79,11 +79,6 @@ SEL_ITEMget_enumtype( Type t ) {
|
||||
|
||||
const char *
|
||||
TYPEget_utype( Type t ) {
|
||||
/*
|
||||
static char b [BUFSIZ];
|
||||
strncpy (b, TYPEget_ctype (t), BUFSIZ-2);
|
||||
if (TYPEis_select (t)) strcat (b, "H");
|
||||
*/
|
||||
return ( TYPEis_entity( t ) ? "SCLP23(Application_instance_ptr)" : TYPEget_ctype( t ) );
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user