Skip to content

Commit

Permalink
Modified the CodeGenType routine to return a single te_dt
Browse files Browse the repository at this point in the history
rather than returning s_dt plus s_cdt.  #4
  • Loading branch information
cortlandstarrett committed Feb 25, 2013
1 parent f32268b commit 0334442
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 61 deletions.
12 changes: 5 additions & 7 deletions arc/frag_util.arc
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
30 changes: 15 additions & 15 deletions arc/q.class.factory.arc
Original file line number Diff line number Diff line change
Expand Up @@ -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} ] );
Expand All @@ -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 )
Expand All @@ -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<Attribute>
.elif ( s_cdt.Core_Typ == 8 )
.elif ( 8 == te_dt.Core_Typ )
.// inst_ref<Object>
${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<Object>
${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<Event>
${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<Mapping>
${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<Mapping>
${te_instance.self}->${te_attr.GeneratedName} = ${te_instance.module}${te_string.atoi}( avlstring[ ${attribute_number} ] );
.assign attribute_number = attribute_number + 1
Expand Down
6 changes: 3 additions & 3 deletions arc/q.class.instance.dumper.arc
Original file line number Diff line number Diff line change
Expand Up @@ -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\\
Expand Down
6 changes: 2 additions & 4 deletions arc/q.class.link.arc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions arc/q.class.pei.arc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions arc/q.class.where.arc
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand All @@ -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
Expand Down
7 changes: 3 additions & 4 deletions arc/q.datatype.arc
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -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
.//
.//============================================================================
Expand Down
22 changes: 11 additions & 11 deletions arc/q.mc_metamodel.populate.arc
Original file line number Diff line number Diff line change
Expand Up @@ -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" )
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
.//
.//
Expand Down
24 changes: 12 additions & 12 deletions arc/q.oal.analyze.arc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 + ")"
Expand All @@ -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 + ")"
Expand All @@ -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
Expand Down

0 comments on commit 0334442

Please sign in to comment.