@@ -201,23 +201,29 @@ void SCOPEPrint( Scope scope, FILES * files, Schema schema, Express model,
201201 /* and print the enumerations */
202202 fprintf ( files -> inc, " \n /* ************** TYPES */\n " );
203203 fprintf ( files -> lib, " \n /* ************** TYPES */\n " );
204- SCOPEdo_types ( scope, t, de )
205- // First check for one exception: Say enumeration type B is defined
206- // to be a rename of enum A. If A is in this schema but has not been
207- // processed yet, we must wait till it's processed first. The reason
208- // is because B will basically be defined with a couple of typedefs to
209- // the classes which represent A. (To simplify, we wait even if A is
210- // in another schema, so long as it's been processed.)
211- if ( ( t->search_id == CANPROCESS )
212- && ( TYPEis_enumeration ( t ) )
213- && ( ( i = TYPEget_ancestor ( t ) ) != NULL )
214- && ( i->search_id >= CANPROCESS ) ) {
215- redefs = 1 ;
204+ /* The following was `SCOPEdo_types( scope, t, de ) ... SCOPEod;`
205+ * Modified Jan 2012 by MAP - moving enums to own dictionary */
206+ HASHlistinit_by_type (scope->enum_table ,&de,OBJ_TYPE);{
207+ Type t;
208+ while ( 0 != ( t = (Type) DICTdo ( &de ) ) ) {
209+ // First check for one exception: Say enumeration type B is defined
210+ // to be a rename of enum A. If A is in this schema but has not been
211+ // processed yet, we must wait till it's processed first. The reason
212+ // is because B will basically be defined with a couple of typedefs to
213+ // the classes which represent A. (To simplify, we wait even if A is
214+ // in another schema, so long as it's been processed.)
215+ if ( ( t->search_id == CANPROCESS )
216+ && ( TYPEis_enumeration ( t ) )
217+ && ( ( i = TYPEget_ancestor ( t ) ) != NULL )
218+ && ( i->search_id >= CANPROCESS ) ) {
219+ redefs = 1 ;
220+ }
221+ }
216222 }
217- SCOPEod
218223
219224 SCOPEdo_types ( scope, t, de )
220- // Do the non-redefined enumerations:
225+ /* NOTE the following comment seems to contradict the logic below it (... && !( TYPEis_enumeration( t ) && ...)
226+ // Do the non-redefined enumerations:*/
221227 if ( ( t->search_id == CANPROCESS )
222228 && !( TYPEis_enumeration ( t ) && TYPEget_head ( t ) ) ) {
223229 TYPEprint_descriptions ( t, files, schema );
@@ -231,12 +237,17 @@ void SCOPEPrint( Scope scope, FILES * files, Schema schema, Express model,
231237 if ( redefs ) {
232238 // Here we process redefined enumerations. See note, 2 loops ago.
233239 fprintf ( files->inc , " // ***** Redefined Enumerations:\n " );
234- SCOPEdo_types ( scope, t, de )
235- if ( t->search_id == CANPROCESS && TYPEis_enumeration ( t ) ) {
236- TYPEprint_descriptions ( t, files, schema );
237- t->search_id = PROCESSED;
240+ /* The following was `SCOPEdo_types( scope, t, de ) ... SCOPEod;`
241+ * Modified Jan 2012 by MAP - moving enums to own dictionary */
242+ HASHlistinit_by_type (scope->enum_table ,&de,OBJ_TYPE);{
243+ Type t;
244+ while ( 0 != ( t = (Type) DICTdo ( &de ) ) ) {
245+ if ( t->search_id == CANPROCESS && TYPEis_enumeration ( t ) ) {
246+ TYPEprint_descriptions ( t, files, schema );
247+ t->search_id = PROCESSED;
248+ }
249+ }
238250 }
239- SCOPEod;
240251 }
241252
242253 /* do the select definitions next, since they depend on the others */
0 commit comments