From 033444218d0a8ba5a53995d4b91a85c5ee5cad70 Mon Sep 17 00:00:00 2001 From: Cortland Starrett Date: Mon, 25 Feb 2013 16:54:42 -0500 Subject: [PATCH] Modified the CodeGenType routine to return a single te_dt rather than returning s_dt plus s_cdt. #4 --- arc/frag_util.arc | 12 +++++------- arc/q.class.factory.arc | 30 +++++++++++++++--------------- arc/q.class.instance.dumper.arc | 6 +++--- arc/q.class.link.arc | 6 ++---- arc/q.class.pei.arc | 4 ++-- arc/q.class.where.arc | 6 +++--- arc/q.datatype.arc | 7 +++---- arc/q.mc_metamodel.populate.arc | 22 +++++++++++----------- arc/q.oal.analyze.arc | 24 ++++++++++++------------ 9 files changed, 56 insertions(+), 61 deletions(-) diff --git a/arc/frag_util.arc b/arc/frag_util.arc index 35fea0761..0833a1c5a 100644 --- a/arc/frag_util.arc +++ b/arc/frag_util.arc @@ -88,23 +88,21 @@ ${indent.result}} .select one o_attr related by te_attr->O_ATTR[R2033] .if ( te_attr.translate ) .invoke r = GetAttributeCodeGenType( o_attr ) - .assign s_cdt = r.cdt - .assign s_dt = r.dt - .if ( not_empty s_cdt ) - .if ( 5 == s_cdt.Core_Typ ) + .assign te_dt = r.result + .if ( not_empty te_dt ) + .if ( 5 == te_dt.Core_Typ ) .// unique_id .select any o_oida related by o_attr->O_OIDA[R105] .if ( not_empty o_oida ) - .select one te_dt related by s_dt->TE_DT[R2021] .assign result = true ${instance}->${te_attr.GeneratedName} = (${te_dt.ExtName}) ${instance}; .end if - .elif ( ( 2 == s_cdt.Core_Typ ) or ( 3 == s_cdt.Core_Typ ) ) + .elif ( ( 2 == te_dt.Core_Typ ) or ( 3 == te_dt.Core_Typ ) ) .// integer or real .if ( "" != te_attr.DefaultValue ) ${instance}->${te_attr.GeneratedName} = ${te_attr.DefaultValue}; /* DefaultValue */ .end if - .elif ( 4 == s_cdt.Core_Typ ) + .elif ( 4 == te_dt.Core_Typ ) .// string .if ( "" != te_attr.DefaultValue ) ${te_instance.module}${te_string.strcpy}( ${instance}->${te_attr.GeneratedName}, ${te_attr.DefaultValue} ); /* DefaultValue */ diff --git a/arc/q.class.factory.arc b/arc/q.class.factory.arc index f82041c42..01dc9bf9e 100644 --- a/arc/q.class.factory.arc +++ b/arc/q.class.factory.arc @@ -92,22 +92,22 @@ ${te_class.GeneratedName}_instanceloader( ${te_instance.handle} instance, const .assign persistent = ( "$l{o_attr.Descrip:Persistent}" != "false" ) .if ( te_attr.translate and persistent ) .invoke r = GetAttributeCodeGenType( o_attr ) - .assign s_cdt = r.cdt - .if ( empty s_cdt ) + .assign te_dt = r.result + .if ( te_dt.Core_Typ < 0 ) .// sdt - .elif ( s_cdt.Core_Typ == 0 ) + .elif ( 0 == te_dt.Core_Typ ) .// void - .elif ( s_cdt.Core_Typ == 1 ) + .elif ( 1 == te_dt.Core_Typ ) .// boolean ${te_instance.self}->${te_attr.GeneratedName} = ( '0' != *avlstring[ ${attribute_number} ] ); .assign attribute_number = attribute_number + 1 - .elif ( s_cdt.Core_Typ == 2 ) + .elif ( 2 == te_dt.Core_Typ ) .// integer ${te_instance.self}->${te_attr.GeneratedName} = ${te_instance.module}${te_string.atoi}( avlstring[ ${attribute_number} ] ); .assign attribute_number = attribute_number + 1 - .elif ( s_cdt.Core_Typ == 3 ) + .elif ( 3 == te_dt.Core_Typ ) .// real - .elif ( s_cdt.Core_Typ == 4 ) + .elif ( 4 == te_dt.Core_Typ ) .// string .if ( "Action_Semantics_internal" == te_attr.Name ) ${te_instance.self}->${te_attr.GeneratedName} = (c_t *) ${te_dma.allocate}( avlstring[ ${attribute_number} + 1 ] - avlstring[ ${attribute_number} ] ); @@ -118,7 +118,7 @@ ${te_class.GeneratedName}_instanceloader( ${te_instance.handle} instance, const ${te_instance.module}${te_string.strcpy}( ${te_instance.self}->${te_attr.GeneratedName}, avlstring[ ${attribute_number} ] ); .end if .assign attribute_number = attribute_number + 1 - .elif ( s_cdt.Core_Typ == 5 ) + .elif ( 5 == te_dt.Core_Typ ) .// unique_id ${te_instance.self}->${te_attr.GeneratedName} = (${te_instance.handle}) ${te_instance.module}${te_string.atoi}( avlstring[ ${attribute_number} ] ); .select any o_oida related by o_attr->O_OIDA[R105] where ( selected.Oid_ID == 0 ) @@ -127,27 +127,27 @@ ${te_class.GeneratedName}_instanceloader( ${te_instance.handle} instance, const return_identifier = ${te_instance.self}->${te_attr.GeneratedName}; .end if .assign attribute_number = attribute_number + 1 - .elif ( s_cdt.Core_Typ == 6 ) + .elif ( 6 == te_dt.Core_Typ ) .// current_state - .elif ( s_cdt.Core_Typ == 7 ) + .elif ( 7 == te_dt.Core_Typ ) .// same as base - .elif ( s_cdt.Core_Typ == 8 ) + .elif ( 8 == te_dt.Core_Typ ) .// inst_ref ${te_instance.self}->${te_attr.GeneratedName} = ${te_instance.module}${te_string.atoi}( avlstring[ ${attribute_number} ] ); .assign attribute_number = attribute_number + 1 - .elif ( s_cdt.Core_Typ == 9 ) + .elif ( 9 == te_dt.Core_Typ ) .// inst_ref_set ${te_instance.self}->${te_attr.GeneratedName} = ${te_instance.module}${te_string.atoi}( avlstring[ ${attribute_number} ] ); .assign attribute_number = attribute_number + 1 - .elif ( s_cdt.Core_Typ == 10 ) + .elif ( 10 == te_dt.Core_Typ ) .// inst ${te_instance.self}->${te_attr.GeneratedName} = ${te_instance.module}${te_string.atoi}( avlstring[ ${attribute_number} ] ); .assign attribute_number = attribute_number + 1 - .elif ( s_cdt.Core_Typ == 11 ) + .elif ( 11 == te_dt.Core_Typ ) .// inst ${te_instance.self}->${te_attr.GeneratedName} = ${te_instance.module}${te_string.atoi}( avlstring[ ${attribute_number} ] ); .assign attribute_number = attribute_number + 1 - .elif ( s_cdt.Core_Typ == 12 ) + .elif ( 12 == te_dt.Core_Typ ) .// inst_ref ${te_instance.self}->${te_attr.GeneratedName} = ${te_instance.module}${te_string.atoi}( avlstring[ ${attribute_number} ] ); .assign attribute_number = attribute_number + 1 diff --git a/arc/q.class.instance.dumper.arc b/arc/q.class.instance.dumper.arc index 1f170c04e..1652637ef 100644 --- a/arc/q.class.instance.dumper.arc +++ b/arc/q.class.instance.dumper.arc @@ -40,14 +40,14 @@ INSERT INTO ${o_obj.Key_Lett} VALUES (\ .if ( "${o_attr.Descrip:Persistent}" != "false" ) .assign attributename = o_attr.Name .invoke r = GetAttributeCodeGenType( o_attr ) - .assign s_dt = r.dt - .if ( "string" == s_dt.Name ) + .assign te_dt = r.result + .if ( "string" == te_dt.Name ) .if ( ( "Action_Semantics_internal" == attributename ) or ( "Descrip" == attributename ) ) ${delimiter} ''\\ .else ${delimiter} '$${$l{o_obj.Key_Lett}.${attributename}}'\ .end if - .elif ( "unique_id" == s_dt.Name ) + .elif ( "unique_id" == te_dt.Name ) \\ ..if ( "un-initialized" == "$${$l{o_obj.Key_Lett}.${attributename}}" ) ${delimiter} 0\\ diff --git a/arc/q.class.link.arc b/arc/q.class.link.arc index afba2efbf..1163c5dc7 100644 --- a/arc/q.class.link.arc +++ b/arc/q.class.link.arc @@ -875,8 +875,7 @@ ${aoth_fundamentals.body}\ .if ( ref_te_attr.translate ) .select one ident_te_attr related by ident_attr->TE_ATTR[R2033] .invoke r = GetAttributeCodeGenType( ref_attr ) - .assign s_dt = r.dt - .select one te_dt related by s_dt->TE_DT[R2021] + .assign te_dt = r.result .assign initial_value = te_dt.Initial_Value .include "${te_file.arc_path}/t.class.set_refs.c" .end if @@ -898,8 +897,7 @@ ${aoth_fundamentals.body}\ .select one ref_te_attr related by ref_attr->TE_ATTR[R2033] .if ( ref_te_attr.translate ) .invoke r = GetAttributeCodeGenType( ref_attr ) - .assign s_dt = r.dt - .select one te_dt related by s_dt->TE_DT[R2021] + .assign te_dt = r.result .include "${te_file.arc_path}/t.class.reset_refs.c" .end if .end for .// ref_attr in ref_attr_set diff --git a/arc/q.class.pei.arc b/arc/q.class.pei.arc index 6bc972bd5..21798e15f 100644 --- a/arc/q.class.pei.arc +++ b/arc/q.class.pei.arc @@ -165,8 +165,8 @@ .assign attr_result = "0" .// Get the attribute data type. Strings need to be quoted. .invoke r = GetAttributeCodeGenType( o_attr ) - .assign s_cdt = r.cdt - .if ( 4 == s_cdt.Core_Typ ) + .assign te_dt = r.result + .if ( 4 == te_dt.Core_Typ ) .// string .if ( empty i_avl ) .// In absence of a populated attribute, use the attribute default value. diff --git a/arc/q.class.where.arc b/arc/q.class.where.arc index 8742e6a1a..67ecd0075 100644 --- a/arc/q.class.where.arc +++ b/arc/q.class.where.arc @@ -50,10 +50,10 @@ .end for .// .select any te_attr related by te_class->TE_ATTR[R2061] where ( selected.prevID == 0 ) - .assign ident_attr_count = 0 + .assign oida_count = 0 .while ( not_empty te_attr ) .if ( te_attr.Included ) - .assign ident_attr_count = ident_attr_count + 1 + .assign oida_count = oida_count + 1 .assign param_list = param_list + te_attr.GeneratedType .if ( not gen_declaration ) .if ( te_attr.dimensions == 0 ) @@ -68,7 +68,7 @@ .end if .assign param_list = param_list + te_attr.array_spec .// - .if ( ident_attr_count < num_ident_attr ) + .if ( oida_count < num_ident_attr ) .assign param_list = param_list + ", " .assign compare_stmt = compare_stmt + " && " .end if diff --git a/arc/q.datatype.arc b/arc/q.datatype.arc index c1fb98c77..de582d942 100644 --- a/arc/q.datatype.arc +++ b/arc/q.datatype.arc @@ -40,6 +40,7 @@ .invoke r = GetBaseTypeForUDT( s_udt ) .assign s_dt = r.result .end if + .select one te_dt related by s_dt->TE_DT[R2021] .select one s_cdt related by s_dt->S_CDT[R17] .// .if ( empty s_cdt ) @@ -73,12 +74,10 @@ .end if .// Note: the following is a recursive call to this function .invoke r = GetAttributeCodeGenType( base_o_attr ) - .assign s_dt = r.dt - .assign s_cdt = r.cdt + .assign te_dt = r.result .end if .end if - .assign attr_dt = s_dt - .assign attr_cdt = s_cdt + .assign attr_result = te_dt .end function .// .//============================================================================ diff --git a/arc/q.mc_metamodel.populate.arc b/arc/q.mc_metamodel.populate.arc index 723b1d671..981cb4398 100644 --- a/arc/q.mc_metamodel.populate.arc +++ b/arc/q.mc_metamodel.populate.arc @@ -722,6 +722,7 @@ .else .assign te_dt.ExtName = te_dt.Name + "_t" .end if + .// CDS We should some day pass along the EDT. .assign te_dt.Core_Typ = 2 .assign te_dt.Is_Enum = true .assign te_dt.Initial_Value = ( te_dt.Owning_Dom_Name + "_" ) + ( te_dt.Name + "__UNINITIALIZED__e" ) @@ -1468,7 +1469,7 @@ .select one te_dt related by s_sync->S_DT[R25]->TE_DT[R2021] .select many te_parms related by s_sync->S_SPARM[R24]->TE_PARM[R2030] .invoke r = FactoryTE_ABA( te_c, te_parms, te_c.Name, te_sync.GeneratedName, "S_SYNC", te_dt ) - .assign te_aba = r.te_aba + .assign te_aba = r.result .// relate te_sync to te_aba across R2010; .assign te_sync.AbaID = te_aba.AbaID .// end relate @@ -1566,8 +1567,7 @@ .if ( 7 == te_dt.Core_Typ ) .// referential attribute .invoke r = GetAttributeCodeGenType( o_attr ) - .assign s_dt = r.dt - .select one te_dt related by s_dt->TE_DT[R2021] + .assign te_dt = r.result .end if .assign te_attr.GeneratedType = te_dt.ExtName .assign te_class.attribute_format = ( te_class.attribute_format + delimiter ) + te_dt.string_format @@ -1594,7 +1594,7 @@ .select one te_dt related by o_attr->S_DT[R114]->TE_DT[R2021] .assign te_parms = empty_te_parms .invoke r = FactoryTE_ABA( te_c, te_parms, "", te_dbattr.GeneratedName, "O_DBATTR", te_dt ) - .assign te_aba = r.te_aba + .assign te_aba = r.result .// relate te_dbattr to te_aba across R2010; .assign te_dbattr.AbaID = te_aba.AbaID .// end relate @@ -1630,7 +1630,7 @@ .select one te_dt related by o_tfr->S_DT[R116]->TE_DT[R2021] .select many te_parms related by o_tfr->O_TPARM[R117]->TE_PARM[R2029] .invoke r = FactoryTE_ABA( te_c, te_parms, te_class.GeneratedName, te_tfr.GeneratedName, "O_TFR", te_dt ) - .assign te_aba = r.te_aba + .assign te_aba = r.result .// relate te_tfr to te_aba across R2010; .assign te_tfr.AbaID = te_aba.AbaID .// end relate @@ -1760,7 +1760,7 @@ .assign te_act.GeneratedName = ( te_class.GeneratedName + class_based ) + ( "_act" + "${te_state.Numb}" ) .//.select many te_parms related by sm_state->SM_SEME[R503]->SM_SEVT[R503]->SM_EVT[R525]->SM_EVTDI[R532]->TE_PARM[R2031] .invoke r = FactoryTE_ABA( te_c, empty_te_parms, "", te_act.GeneratedName, "SM_ACT", void_te_dt ) - .assign te_aba = r.te_aba + .assign te_aba = r.result .// relate te_act to te_aba across R2010; .assign te_act.AbaID = te_aba.AbaID .// end relate @@ -1792,7 +1792,7 @@ .assign te_act.number = counter .//.select many te_parms related by sm_act->SM_AH[R514]->SM_TAH[R513]->SM_TXN[R530]->SM_NSTXN[R507]->SM_SEME[R504]->SM_SEVT[R503]->SM_EVT[R525]->SM_EVTDI[R532]->TE_PARM[R2031] .invoke r = FactoryTE_ABA( te_c, empty_te_parms, "", te_act.GeneratedName, "SM_ACT", void_te_dt ) - .assign te_aba = r.te_aba + .assign te_aba = r.result .// relate te_act to te_aba across R2010; .assign te_act.AbaID = te_aba.AbaID .// end relate @@ -1942,7 +1942,7 @@ .for each te_parm in te_parms .// If we are using TLM ports, convert booleans to integers .select one param_te_dt related by te_parm->TE_DT[R2049] - .if ( param_te_dt.Core_Typ == 1 ) + .if ( 1 == param_te_dt.Core_Typ ) .// relate te_part to converted_bool_te_dt across R2049; .assign te_parm.te_dtID = converted_bool_te_dt.ID .// end relate @@ -1959,7 +1959,7 @@ .assign te_parms = te_parms | polymorphic_te_parm .end if .invoke r = FactoryTE_ABA( te_c, te_parms, te_mact.ComponentName, te_mact.GeneratedName, "TE_MACT", te_dt ) - .assign te_aba = r.te_aba + .assign te_aba = r.result .// relate te_mact to te_aba across R2010; .assign te_mact.AbaID = te_aba.AbaID .// end relate @@ -2018,7 +2018,7 @@ .select one te_dt related by s_brg->S_DT[R20]->TE_DT[R2021] .select many te_parms related by s_brg->S_BPARM[R21]->TE_PARM[R2028] .invoke r = FactoryTE_ABA( te_c, te_parms, te_ee.RegisteredName, te_brg.GeneratedName, "S_BRG", te_dt ) - .assign te_aba = r.te_aba + .assign te_aba = r.result .// relate te_brg to te_aba across R2010; .assign te_brg.AbaID = te_aba.AbaID .// end relate @@ -2092,7 +2092,7 @@ .if ( te_aba.dimensions > 0 ) .assign te_aba.ReturnDataType = te_aba.ReturnDataType + " *" .end if - .assign attr_te_aba = te_aba + .assign attr_result = te_aba .end function .// .// diff --git a/arc/q.oal.analyze.arc b/arc/q.oal.analyze.arc index 9e4bde7d1..c168851c0 100644 --- a/arc/q.oal.analyze.arc +++ b/arc/q.oal.analyze.arc @@ -553,13 +553,13 @@ .// *** Provide a key without parenthesis. .select any first_te_attr related by te_class->TE_ATTR[R2061] where ( selected.prevID == 0 ) .assign te_attr = first_te_attr - .assign ident_attr_count = 0 + .assign oida_count = 0 .while ( not_empty te_attr ) .select one o_attr related by te_attr->O_ATTR[R2033] .if ( te_attr.Included ) - .assign ident_attr_count = ident_attr_count + 1 + .assign oida_count = oida_count + 1 .assign where_spec = where_spec + "selected.${o_attr.Name} == ?" - .if ( ident_attr_count < num_ident_attr ) + .if ( oida_count < num_ident_attr ) .assign where_spec = where_spec + " AND " .end if .end if @@ -583,13 +583,13 @@ .assign where_spec = "(" .assign where_key = "${te_class.Key_Lett}_Key${key_number}_mcw${info.unique_num}" .assign te_attr = first_te_attr - .assign ident_attr_count = 0 + .assign oida_count = 0 .while ( not_empty te_attr ) .select one o_attr related by te_attr->O_ATTR[R2033] .if ( te_attr.Included ) - .assign ident_attr_count = ident_attr_count + 1 + .assign oida_count = oida_count + 1 .assign where_spec = where_spec + "selected.${o_attr.Name} == ?" - .if ( ident_attr_count < num_ident_attr ) + .if ( oida_count < num_ident_attr ) .assign where_spec = where_spec + " AND " .else .assign where_spec = where_spec + ")" @@ -616,13 +616,13 @@ .assign where_spec = "(" .assign where_key = "${te_class.Key_Lett}_Key${key_number}_mcw${info.unique_num}" .assign te_attr = first_te_attr - .assign ident_attr_count = 0 + .assign oida_count = 0 .while ( not_empty te_attr ) .select one o_attr related by te_attr->O_ATTR[R2033] .if ( te_attr.Included ) - .assign ident_attr_count = ident_attr_count + 1 + .assign oida_count = oida_count + 1 .assign where_spec = where_spec + "(selected.${o_attr.Name} == ?)" - .if ( ident_attr_count < num_ident_attr ) + .if ( oida_count < num_ident_attr ) .assign where_spec = where_spec + " AND " .else .assign where_spec = where_spec + ")" @@ -647,13 +647,13 @@ .assign where_spec = "" .assign where_key = "${te_class.Key_Lett}_Key${key_number}_mcw${info.unique_num}" .assign te_attr = first_te_attr - .assign ident_attr_count = 0 + .assign oida_count = 0 .while ( not_empty te_attr ) .select one o_attr related by te_attr->O_ATTR[R2033] .if ( te_attr.Included ) - .assign ident_attr_count = ident_attr_count + 1 + .assign oida_count = oida_count + 1 .assign where_spec = where_spec + "(selected.${o_attr.Name} == ?)" - .if ( ident_attr_count < num_ident_attr ) + .if ( oida_count < num_ident_attr ) .assign where_spec = where_spec + " AND " .end if .end if