@@ -1270,9 +1270,6 @@ void MemberFunctionSign( Entity entity, Linked_List neededAttr, FILE * file ) {
12701270
12711271 /* print creation function for class */
12721272 fprintf ( file , "inline %s * create_%s() {\n return new %s;\n}\n\n" , entnm , entnm , entnm );
1273-
1274- /* print init function for class */
1275- fprintf ( file , "void init_%s(Registry& reg);\n\n" , entnm );
12761273}
12771274
12781275/**************************************************************/ /**
@@ -2285,7 +2282,7 @@ static bool listContainsVar( Linked_List l, Variable v ) {
22852282}
22862283
22872284void ENTITYPrint_h ( const Entity entity , Linked_List neededAttr , Schema schema ) {
2288- const char * name = ENTITYget_classname ( entity );
2285+ char * name = ENTITYget_classname ( entity );
22892286 char filename [MAX_LEN ];
22902287 FILE * file = NULL ;
22912288
@@ -2305,6 +2302,8 @@ void ENTITYPrint_h( const Entity entity, Linked_List neededAttr, Schema schema )
23052302 DataMemberPrint ( entity , neededAttr , file );
23062303 MemberFunctionSign ( entity , neededAttr , file );
23072304
2305+ fprintf ( file , "void init_%s(Registry& reg);\n\n" , name );
2306+
23082307 fprintf ( file , "namespace %s {\n" , SCHEMAget_name ( schema ) );
23092308 ENTITYnames_print ( entity , file );
23102309 fprintf ( file , "}\n\n" );
@@ -2315,7 +2314,7 @@ void ENTITYPrint_h( const Entity entity, Linked_List neededAttr, Schema schema )
23152314}
23162315
23172316void ENTITYPrint_cc ( const Entity entity , Linked_List neededAttr , Schema schema ) {
2318- const char * name = ENTITYget_classname ( entity );
2317+ char * name = ENTITYget_classname ( entity );
23192318 char filename [MAX_LEN ];
23202319 FILE * file = NULL ;
23212320
@@ -2363,7 +2362,6 @@ void ENTITYPrint_cc( const Entity entity, Linked_List neededAttr, Schema schema
23632362 ** Status: complete 1/15/91
23642363 ******************************************************************/
23652364void ENTITYPrint ( Entity entity , FILES * files , Schema schema ) {
2366-
23672365 char * n = ENTITYget_name ( entity );
23682366 Linked_List remaining = LISTcreate ();
23692367
@@ -3218,7 +3216,7 @@ int TYPEget_RefTypeVarNm( const Type t, char * buf, Schema schema ) {
32183216}
32193217
32203218void TYPEPrint_h ( const Type type , Schema schema ) {
3221- const char * name = TYPEget_ctype ( type );
3219+ char * name = TYPEget_ctype ( type );
32223220 char filename [MAX_LEN ];
32233221 FILE * file = NULL ;
32243222
@@ -3238,13 +3236,15 @@ void TYPEPrint_h( const Type type, Schema schema ) {
32383236 else if ( TYPEis_select ( type ) )
32393237 TYPEselect_inc_print ( type , file );
32403238
3239+ fprintf ( file , "void init_%s(Registry& reg);\n\n" , TYPEget_ctype ( type )/*name*/ );
3240+
32413241 FILEclose (file );
32423242
32433243 DEBUG ( "DONE TYPEPrint_h\n" );
32443244}
32453245
32463246void TYPEPrint_cc ( const Type type , Schema schema ) {
3247- const char * name = TYPEget_ctype ( type );
3247+ char * name = TYPEget_ctype ( type );
32483248 char filename [MAX_LEN ];
32493249 FILE * file = NULL ;
32503250
@@ -3268,16 +3268,22 @@ void TYPEPrint_cc( const Type type, Schema schema ) {
32683268 else if ( TYPEis_select ( type ) )
32693269 TYPEselect_lib_print ( type , file );
32703270
3271+ fprintf ( file , "\nvoid init_%s( Registry& reg ) {\n" , TYPEget_ctype ( type ) );
3272+ TYPEprint_init ( type , file , schema );
3273+ fprintf ( file , "}\n\n" );
3274+
32713275 FILEclose (file );
32723276
32733277 DEBUG ( "DONE TYPEPrint_cc\n" );
32743278}
32753279
32763280void TYPEPrint ( const Type type , FILES * files , Schema schema ) {
3277- const char * name = TYPEget_ctype ( type );
3281+ char * name = TYPEget_ctype ( type );
32783282
32793283 fprintf ( files -> inc , "#include \"type/%s.h\"\n" , name );
32803284
3285+ fprintf ( files -> init , " init_%s( reg );\n" , name );
3286+
32813287 TYPEPrint_h ( type , schema );
32823288 TYPEPrint_cc ( type , schema );
32833289}
@@ -3401,21 +3407,21 @@ static void printEnumAggrCrBody( FILE * lib, const Type type ) {
34013407 fprintf ( lib , " return new %s_agg( %s );\n}\n" , n , tdnm );
34023408}
34033409
3404- void TYPEprint_init ( const Type type , FILES * files , Schema schema ) {
3410+ void TYPEprint_init ( const Type type , FILE * file , Schema schema ) {
34053411 char tdnm [BUFSIZ ];
34063412 char typename_buf [MAX_LEN ];
34073413
34083414 strncpy ( tdnm , TYPEtd_name ( type ), BUFSIZ );
34093415
34103416 if ( isAggregateType ( type ) ) {
3411- AGGRprint_init ( files -> init , type , tdnm , type -> symbol .name );
3417+ AGGRprint_init ( file , type , tdnm , type -> symbol .name );
34123418 }
34133419
34143420 /* fill in the TD's values in the SchemaInit function (it is already
34153421 declared with basic values) */
34163422
34173423 if ( TYPEget_RefTypeVarNm ( type , typename_buf , schema ) ) {
3418- fprintf ( files -> init , " %s->ReferentType(%s);\n" , tdnm , typename_buf );
3424+ fprintf ( file , " %s->ReferentType(%s);\n" , tdnm , typename_buf );
34193425 } else {
34203426 switch ( TYPEget_body ( type )-> type ) {
34213427 case aggregate_ : /* aggregate_ should not happen? DAS */
@@ -3424,9 +3430,9 @@ void TYPEprint_init( const Type type, FILES * files, Schema schema ) {
34243430 case set_ :
34253431 case list_ : {
34263432 if ( isMultiDimAggregateType ( type ) ) {
3427- print_typechain ( files -> init , TYPEget_body ( type )-> base ,
3433+ print_typechain ( file , TYPEget_body ( type )-> base ,
34283434 typename_buf , schema , type -> symbol .name );
3429- fprintf ( files -> init , " %s->ReferentType(%s);\n" , tdnm ,
3435+ fprintf ( file , " %s->ReferentType(%s);\n" , tdnm ,
34303436 typename_buf );
34313437 }
34323438 break ;
@@ -3439,17 +3445,17 @@ void TYPEprint_init( const Type type, FILES * files, Schema schema ) {
34393445 /* DAR - moved fn call below from TYPEselect_print to here to put all init
34403446 ** info together. */
34413447 if ( TYPEis_select ( type ) ) {
3442- TYPEselect_init_print ( type , files -> init );
3448+ TYPEselect_init_print ( type , file );
34433449 }
34443450#ifdef NEWDICT
34453451 /* DAS New SDAI Dictionary 5/95 */
34463452 /* insert the type into the schema descriptor */
3447- fprintf ( files -> init ,
3453+ fprintf ( file ,
34483454 " ((SDAIAGGRH(Set,DefinedTypeH))%s::schema->Types())->Add((DefinedTypeH)%s);\n" ,
34493455 SCHEMAget_name ( schema ), tdnm );
34503456#endif
34513457 /* insert into type dictionary */
3452- fprintf ( files -> init , " reg.AddType (*%s);\n" , tdnm );
3458+ fprintf ( file , " reg.AddType (*%s);\n" , tdnm );
34533459}
34543460
34553461/** print name, fundamental type, and description initialization function
0 commit comments