@@ -29,30 +29,31 @@ void SCOPEPrint( Scope scope, FILES * files, Schema schema ) {
2929 DictionaryEntry de;
3030 Type i;
3131 int redefs = 0 ;// index = 0;
32+ int skipped;
3233
33- /* Defined Types based on SIMPLE types */
34- SCOPEdo_types ( scope, t, de )
35- if ( ( t->search_id == CANPROCESS )
36- && !( TYPEis_enumeration ( t ) || TYPEis_select ( t ) || TYPEis_aggregate ( t ) )
37- && ( TYPEget_ancestor ( t ) == NULL ) ) {
38- TYPEprint_descriptions ( t, files, schema );
39- t->search_id = PROCESSED ;
40- }
41- SCOPEod
34+ while ( 1 ) {
35+ skipped = 0 ;
4236
43- /* Defined Types with defined ancestor head
44- * TODO: recursive approach
45- */
46- SCOPEdo_types ( scope, t, de )
47- if ( ( t-> search_id == CANPROCESS )
48- && !( TYPEis_enumeration ( t ) || TYPEis_select ( t ) || TYPEis_aggregate ( t ) )
49- && ( ( i = TYPEget_head ( t ) ) != NULL ) ) {
50- if (i ->search_id == PROCESSED ) {
37+ SCOPEdo_types ( scope, t, de )
38+ if ( TYPEis_enumeration ( t ) || TYPEis_select ( t ) || TYPEis_aggregate ( t ) ) {
39+ continue ;
40+ }
41+
42+ i = TYPEget_head ( t );
43+ if ( ( !i || i-> search_id == PROCESSED )
44+ && t ->search_id == CANPROCESS ) {
5145 TYPEprint_descriptions ( t, files, schema );
5246 t->search_id = PROCESSED ;
47+ } else if ( t->search_id == CANPROCESS ) {
48+ skipped++;
49+ }
50+
51+ SCOPEod
52+
53+ if ( !skipped ) {
54+ break ;
5355 }
5456 }
55- SCOPEod
5657
5758 /* fill in the values for the type descriptors */
5859 /* and print the enumerations */
@@ -74,14 +75,15 @@ void SCOPEPrint( Scope scope, FILES * files, Schema schema ) {
7475 SCOPEod
7576
7677 SCOPEdo_types ( scope, t, de )
78+ if ( TYPEis_select ( t ) || TYPEis_aggregate ( t ) ) {
79+ continue ;
80+ }
81+
7782 // Do the non-redefined enumerations:
7883 if ( ( t->search_id == CANPROCESS )
7984 && !( TYPEis_enumeration ( t ) && TYPEget_head ( t ) ) ) {
8085 TYPEprint_descriptions ( t, files, schema );
81- if ( !TYPEis_select ( t ) ) {
82- // Selects have a lot more processing and are done below.
83- t->search_id = PROCESSED ;
84- }
86+ t->search_id = PROCESSED ;
8587 }
8688 SCOPEod;
8789
@@ -101,11 +103,13 @@ void SCOPEPrint( Scope scope, FILES * files, Schema schema ) {
101103 // we don't have to worry about printing B before A. This is checked in
102104 // TYPEselect_print().
103105 SCOPEdo_types ( scope, t, de )
104- if ( t->search_id == CANPROCESS ) {
106+ if ( t->search_id == CANPROCESS && TYPEis_select ( t ) ) {
105107 // Only selects haven't been processed yet and may still be set to
106108 // CANPROCESS.
107109 // FIXME this function is not implemented!
108110// TYPEselect_print( t, files, schema );
111+ // TODO: due to conditional error we were previously executing this above without realising
112+ TYPEprint_descriptions ( t, files, schema );
109113 t->search_id = PROCESSED ;
110114 }
111115 SCOPEod;
@@ -131,6 +135,14 @@ void SCOPEPrint( Scope scope, FILES * files, Schema schema ) {
131135 LISTod;
132136 LISTfree ( rule_list );
133137
138+ // TODO: check dependencies
139+ SCOPEdo_types ( scope, t, de )
140+ if ( t->search_id == CANPROCESS && TYPEis_aggregate ( t ) ) {
141+ TYPEprint_descriptions ( t, files, schema );
142+ t->search_id = PROCESSED ;
143+ }
144+ SCOPEod
145+
134146}
135147
136148
0 commit comments