Skip to content

Commit 04f4c1d

Browse files
committed
Added unnamed types to Schema.
* Unnamed types where created, but never destroyed, added unnamed types list to Schema and delete the unnamed types in Schema destructor.
1 parent 0a12237 commit 04f4c1d

4 files changed

Lines changed: 21 additions & 0 deletions

File tree

src/cleditor/SdaiHeaderSchemaInit.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ void SdaiHEADER_SECTION_SCHEMAInit( Registry & reg ) {
5959
t_0->Description( "SET [1:?] OF section_name" );
6060
t_0->OriginatingSchema( s_header_section_schema );
6161
t_0->ReferentType( header_section_schemat_section_name );
62+
s_header_section_schema->AddUnnamedType(t_0);
6263
a_4governed_sections =
6364
new AttrDescriptor( "governed_sections", t_0, LTrue, LFalse, AttrType_Explicit,
6465
*header_section_schemae_file_population );
@@ -86,6 +87,7 @@ void SdaiHEADER_SECTION_SCHEMAInit( Registry & reg ) {
8687
t_1->Description( "LIST [1:?] OF STRING (256)" );
8788
t_1->OriginatingSchema( s_header_section_schema );
8889
t_1->ReferentType( t_sdaiSTRING );
90+
s_header_section_schema->AddUnnamedType(t_1);
8991
a_7author =
9092
new AttrDescriptor( "author", t_1, LFalse, LFalse, AttrType_Explicit,
9193
*header_section_schemae_file_name );
@@ -98,6 +100,7 @@ void SdaiHEADER_SECTION_SCHEMAInit( Registry & reg ) {
98100
t_2->Description( "LIST [1:?] OF STRING (256)" );
99101
t_2->OriginatingSchema( s_header_section_schema );
100102
t_2->ReferentType( t_sdaiSTRING );
103+
s_header_section_schema->AddUnnamedType(t_2);
101104
a_8organization =
102105
new AttrDescriptor( "organization", t_2, LFalse, LFalse, AttrType_Explicit,
103106
*header_section_schemae_file_name );
@@ -135,6 +138,7 @@ void SdaiHEADER_SECTION_SCHEMAInit( Registry & reg ) {
135138
t_3->Description( "LIST [1:?] OF context_name" );
136139
t_3->OriginatingSchema( s_header_section_schema );
137140
t_3->ReferentType( header_section_schemat_context_name );
141+
s_header_section_schema->AddUnnamedType(t_3);
138142
a_13context_identifiers =
139143
new AttrDescriptor( "context_identifiers", t_3, LFalse, LFalse, AttrType_Explicit,
140144
*header_section_schemae_section_context );
@@ -152,6 +156,7 @@ void SdaiHEADER_SECTION_SCHEMAInit( Registry & reg ) {
152156
t_4->Description( "LIST [1:?] OF STRING (256)" );
153157
t_4->OriginatingSchema( s_header_section_schema );
154158
t_4->ReferentType( t_sdaiSTRING );
159+
s_header_section_schema->AddUnnamedType(t_4);
155160
a_14description =
156161
new AttrDescriptor( "description", t_4, LFalse, LFalse, AttrType_Explicit,
157162
*header_section_schemae_file_description );
@@ -175,6 +180,7 @@ void SdaiHEADER_SECTION_SCHEMAInit( Registry & reg ) {
175180
t_5->Description( "LIST [1:?] OF UNIQUE schema_name" );
176181
t_5->OriginatingSchema( s_header_section_schema );
177182
t_5->ReferentType( header_section_schemat_schema_name );
183+
s_header_section_schema->AddUnnamedType(t_5);
178184
a_16schema_identifiers =
179185
new AttrDescriptor( "schema_identifiers", t_5, LFalse, LFalse, AttrType_Explicit,
180186
*header_section_schemae_file_schema );

src/clstepcore/ExpDict.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,7 @@ class SCL_CORE_EXPORT Schema : public Dictionary_instance {
657657
const char * _name ;
658658
EntityDescriptorList _entList; // list of entities in the schema
659659
TypeDescriptorList _typeList; // list of types in the schema
660+
TypeDescriptorList _unnamed_typeList; // list of unnamed types in the schema (for cleanup)
660661
Interface_spec _interface; // list of USE and REF interfaces (SDAI)
661662

662663
// non-SDAI lists
@@ -725,6 +726,10 @@ class SCL_CORE_EXPORT Schema : public Dictionary_instance {
725726
return _typeList.AddNode( td );
726727
}
727728

729+
TypeDescLinkNode * AddUnnamedType( TypeDescriptor * td ) {
730+
return _unnamed_typeList.AddNode( td );
731+
}
732+
728733
// the whole schema
729734
void GenerateExpress( ostream & out ) const;
730735

src/clstepcore/ExpDict.inline.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ Schema::Schema( const char * schemaName )
2525
}
2626

2727
Schema::~Schema() {
28+
TypeDescLinkNode *node;
29+
2830
if( _use_interface_list != 0 ) {
2931
delete _use_interface_list;
3032
}
@@ -34,6 +36,11 @@ Schema::~Schema() {
3436
if( _global_rules != 0 ) {
3537
delete _global_rules;
3638
}
39+
node = (TypeDescLinkNode*) _unnamed_typeList.GetHead();
40+
while ( node ) {
41+
delete node->TypeDesc();
42+
node = (TypeDescLinkNode*) node->NextNode();
43+
}
3744
}
3845

3946
Interfaced_item::Interfaced_item() {

src/fedex_plus/classes.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1983,6 +1983,9 @@ void print_typechain( FILE * f, const Type t, char * buf, Schema schema ) {
19831983
fprintf( f, " %s%d->ReferentType(%s);\n", TD_PREFIX, count, callee_buffer );
19841984
}
19851985
sprintf( buf, "%s%d", TD_PREFIX, count );
1986+
1987+
/* Types */
1988+
fprintf( f, " %s::schema->AddUnnamedType(%s%d);\n", SCHEMAget_name( schema ), TD_PREFIX, count );
19861989
}
19871990

19881991
/**************************************************************//**

0 commit comments

Comments
 (0)