Skip to content

Commit

Permalink
Began the changes for attr_. Also, moved R2001 from O_OBJ to TE_CLASS.
Browse files Browse the repository at this point in the history
This required an update to the instance dumper.  While comparing it
with previous instance dumpers, I noted that without sorting, the
generated instance dumper will not be easily comparable from build
to build.  So, I enhanced it to sort the subsystems and sort the
classes before emitting.  This will keep it consistent from build
to build.  #4
  • Loading branch information
cortlandstarrett committed Feb 22, 2013
1 parent e88971f commit 4885eb6
Show file tree
Hide file tree
Showing 11 changed files with 3,292 additions and 3,303 deletions.
6,450 changes: 3,212 additions & 3,238 deletions arc/q.class.instance.dump.arc

Large diffs are not rendered by default.

62 changes: 40 additions & 22 deletions arc/q.class.instance.dumper.arc
Original file line number Diff line number Diff line change
Expand Up @@ -17,44 +17,62 @@
.assign dollarcurly = "$${"
..print "dumping class instances into SQL format..."
.select many s_sss from instances of S_SS where ( ( ( ( selected.Name != "Value" ) and ( selected.Name != "Body" ) ) and ( ( selected.Name != "Event" ) and ( selected.Name != "Selection" ) ) ) and ( ( ( selected.Name != "Instance Access" ) and ( selected.Name != "Relate and Unrelate" ) ) and ( selected.Name != "Translation OAL" ) ) )
.for each s_ss in s_sss
.invoke SortSetAlphabeticallyByNameAttr( s_sss )
.assign s_ss_count = cardinality s_sss
.assign s_ss_number = 0
.while ( s_ss_number < s_ss_count )
.for each s_ss in s_sss
.if ( s_ss.Order == s_ss_number )
..print "${s_ss.Name}"
.select many o_objs related by s_ss->O_OBJ[R2] where ( ( selected.Key_Lett != "TE_VAL" ) and ( selected.Key_Lett != "TE_VAR" ) )
.for each o_obj in o_objs
.select many o_objs related by s_ss->O_OBJ[R2] where ( ( selected.Key_Lett != "TE_VAL" ) and ( selected.Key_Lett != "TE_VAR" ) )
.invoke SortSetAscendingByAttr_Numb( o_objs )
.assign o_obj_count = cardinality o_objs
.assign o_obj_number = 0
.while ( o_obj_number < o_obj_count )
.for each o_obj in o_objs
.if ( o_obj.Order == o_obj_number )
..select many $l{o_obj.Key_Lett}s from instances of ${o_obj.Key_Lett}
..for each $l{o_obj.Key_Lett} in $l{o_obj.Key_Lett}s
INSERT INTO ${o_obj.Key_Lett} VALUES (\
.select one o_attr related by o_obj->O_ATTR[R102] where ( selected.PAttr_ID == 0 )
.assign delimiter = ""
.while ( not_empty o_attr )
.if ( "${o_attr.Descrip:Persistent}" != "false" )
.assign attributename = o_attr.Name
.invoke d = GetAttributeCodeGenType( o_attr )
.assign s_dt = d.dt
.if ( "string" == s_dt.Name )
.if ( ( "Action_Semantics_internal" == attributename ) or ( "Descrip" == attributename ) )
.select one o_attr related by o_obj->O_ATTR[R102] where ( selected.PAttr_ID == 0 )
.assign delimiter = ""
.while ( not_empty o_attr )
.if ( "${o_attr.Descrip:Persistent}" != "false" )
.assign attributename = o_attr.Name
.invoke d = GetAttributeCodeGenType( o_attr )
.assign s_dt = d.dt
.if ( "string" == s_dt.Name )
.if ( ( "Action_Semantics_internal" == attributename ) or ( "Descrip" == attributename ) )
${delimiter} ''\\
.else
.else
${delimiter} '$${$l{o_obj.Key_Lett}.${attributename}}'\
.end if
.elif ( "unique_id" == s_dt.Name )
.end if
.elif ( "unique_id" == s_dt.Name )
\\
..if ( "un-initialized" == "$${$l{o_obj.Key_Lett}.${attributename}}" )
${delimiter} 0\\
..else
${delimiter} ${dollarcurly}$l{o_obj.Key_Lett}.${attributename}}\\
..end if
.else
.else
${delimiter} ${dollarcurly}$l{o_obj.Key_Lett}.${attributename}}\
.end if
.assign delimiter = ","
.end if
.select one o_attr related by o_attr->O_ATTR[R103.'succeeds']
.end while
.end if
.assign delimiter = ","
.end if
.select one o_attr related by o_attr->O_ATTR[R103.'succeeds']
.end while
);
..end for
.break for
.end if
.end for
.assign o_obj_number = o_obj_number + 1
.end while
.break for
.end if
.end for
.end for
.assign s_ss_number = s_ss_number + 1
.end while
..emit to file "_system.sql"
..exit 508
.end function
19 changes: 11 additions & 8 deletions arc/q.datatype.arc
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@
.//============================================================================
.function GetBaseTypeForUDT
.param inst_ref s_udt
.select one attr_result related by s_udt->S_DT[R18];
.select one s_udt related by attr_result->S_UDT[R17];
.select one s_dt related by s_udt->S_DT[R18]
.select one s_udt related by s_dt->S_UDT[R17]
.if ( not_empty s_udt )
.invoke btype = GetBaseTypeForUDT( s_udt )
.assign attr_result = btype.result
.invoke r = GetBaseTypeForUDT( s_udt )
.assign s_dt = r.result
.end if
.assign attr_result = s_dt
.end function
.//
.//============================================================================
Expand Down Expand Up @@ -101,7 +102,7 @@
.function MapUserSpecifiedDataTypePrecision
.param inst_ref te_dt
.param string mapping
.assign attr_error = false
.assign error = false
.assign type = mapping
.if ( (type == "uchar_t") or ((type == "u_char") or (type == "unsignedchar")) )
.assign te_dt.ExtName = "unsigned char"
Expand Down Expand Up @@ -167,18 +168,20 @@
.assign te_dt.ExtName = "volatile unsigned long"
.//
.else
.assign attr_error = true
.assign error = true
.end if
.assign attr_result = error
.end function
.//
.// Return the structure type for persistent links.
.function UserSuppliedDataTypeIncludes
.select any te_file from instances of TE_FILE
.assign sys_types_file_name = ( te_file.types + "." ) + te_file.hdr_file_ext
.select many special_te_dts from instances of TE_DT where ( ( selected.Include_File != "" ) and ( selected.Include_File != sys_types_file_name ) )
.assign attr_s = ""
.assign s = ""
.for each special_te_dt in special_te_dts
.assign attr_s = ( attr_s + "#include " ) + ( special_te_dt.Include_File + "\n" )
.assign s = ( s + "#include " ) + ( special_te_dt.Include_File + "\n" )
.end for
.assign attr_result = s
.end function
.//
12 changes: 2 additions & 10 deletions arc/q.mc_metamodel.populate.arc
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@
.end if
.if ( ( s_cdt.Core_Typ == 2 ) or ( s_cdt.Core_Typ == 3 ) )
.invoke r = MapUserSpecifiedDataTypePrecision( te_dt, tm_precision.xName )
.assign status_error = r.error
.assign status_error = r.result
.if ( status_error )
.assign te_dt.ExtName = tm_precision.xName
.end if
Expand Down Expand Up @@ -2062,15 +2062,7 @@
.assign actual_te_parms = actual_te_parms | te_parm
.end if
.end for
.invoke params = te_parm_RenderParameters( actual_te_parms )
.assign te_aba.ParameterDefinition = params.definition
.assign te_aba.ParameterDeclaration = params.declaration
.assign te_aba.ParameterInvocation = params.invocation
.assign te_aba.ParameterStructure = params.structure
.assign te_aba.ParameterTrace = params.parameter_trace
.assign te_aba.ParameterFormat = params.string_format
.assign te_aba.ParameterAssignment = params.assignment
.assign te_aba.ParameterAssignmentBase = params.assignment_base
.invoke te_parm_RenderParameters( actual_te_parms, te_aba )
.assign te_aba.scope = ""
.if ( ( "C++" == te_target.language ) or ( "SystemC" == te_target.language ) )
.assign te_aba.scope = scope + "::"
Expand Down
16 changes: 8 additions & 8 deletions arc/q.oal.analyze.arc
Original file line number Diff line number Diff line change
Expand Up @@ -570,9 +570,9 @@
.// Object ${te_class.Name} (${te_class.Key_Lett}) Identifier *${key_number}
.create object instance te_swc of TE_SWC
.// relate te_swc to te_class across R2001;
.// CDS We need to move R2001 from O_OBJ to TE_CLASS.
.assign te_swc.Obj_Kl = te_class.Key_Lett
.assign te_swc.GeneratedName = te_class.GeneratedName
.// end relate
.assign te_swc.Obj_Kl = te_class.Key_Lett
.assign te_swc.Where_Spec = where_spec
.assign te_swc.Key = where_key
.assign te_swc.Ret_Val = FALSE
Expand Down Expand Up @@ -602,9 +602,9 @@
.// Object ${te_class.Name} (${te_class.Key_Lett}) Identifier *${key_number}
.create object instance te_swc of TE_SWC
.// relate te_swc to te_class across R2001;
.// CDS We need to move R2001 from O_OBJ to TE_CLASS.
.assign te_swc.Obj_Kl = te_class.Key_Lett
.assign te_swc.GeneratedName = te_class.GeneratedName
.// end relate
.assign te_swc.Obj_Kl = te_class.Key_Lett
.assign te_swc.Where_Spec = where_spec
.assign te_swc.Key = where_key
.assign te_swc.Ret_Val = FALSE
Expand Down Expand Up @@ -635,9 +635,9 @@
.// Object ${te_class.Name} (${te_class.Key_Lett}) Identifier *${key_number}
.create object instance te_swc of TE_SWC
.// relate te_swc to te_class across R2001;
.// CDS We need to move R2001 from O_OBJ to TE_CLASS.
.assign te_swc.Obj_Kl = te_class.Key_Lett
.assign te_swc.GeneratedName = te_class.GeneratedName
.// end relate
.assign te_swc.Obj_Kl = te_class.Key_Lett
.assign te_swc.Where_Spec = where_spec
.assign te_swc.Key = where_key
.assign te_swc.Ret_Val = FALSE
Expand All @@ -664,9 +664,9 @@
.// Object ${te_class.Name} (${te_class.Key_Lett}) Identifier *${key_number}
.create object instance te_swc of TE_SWC
.// relate te_swc to te_class across R2001;
.// CDS We need to move R2001 from O_OBJ to TE_CLASS.
.assign te_swc.Obj_Kl = te_class.Key_Lett
.assign te_swc.GeneratedName = te_class.GeneratedName
.// end relate
.assign te_swc.Obj_Kl = te_class.Key_Lett
.assign te_swc.Where_Spec = where_spec
.assign te_swc.Key = where_key
.assign te_swc.Ret_Val = FALSE
Expand Down
17 changes: 9 additions & 8 deletions arc/q.parameters.arc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
.//
.function te_parm_RenderParameters
.param inst_ref_set te_parms
.param inst_ref te_aba
.// Consider that we may have additional parameters (like for passing "self").
.assign defn = ""
.assign decl = " void"
Expand Down Expand Up @@ -83,13 +84,13 @@
.assign item_number = item_number + 1
.end while
.end if
.assign attr_definition = defn + ""
.assign attr_declaration = decl + " "
.assign attr_invocation = invo
.assign attr_structure = stru
.assign attr_parameter_trace = parameter_trace
.assign attr_string_format = string_format
.assign attr_assignment = assn
.assign attr_assignment_base = assnbase
.assign te_aba.ParameterDefinition = defn + ""
.assign te_aba.ParameterDeclaration = decl + " "
.assign te_aba.ParameterInvocation = invo
.assign te_aba.ParameterStructure = stru
.assign te_aba.ParameterTrace = parameter_trace
.assign te_aba.ParameterFormat = string_format
.assign te_aba.ParameterAssignment = assn
.assign te_aba.ParameterAssignmentBase = assnbase
.end function
.//
2 changes: 1 addition & 1 deletion arc/q.smt.generate.arc
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@
.assign built_in = false
.assign oid_id = -1
.if ( built_in )
.select any te_swc related by o_obj->TE_SWC[R2001] where ( selected.Key == "p_where.key" )
.select any te_swc related by te_class->TE_SWC[R2001] where ( selected.Key == "p_where.key" )
.assign built_in = te_swc.Built_In
.assign oid_id = te_swc.Oid_ID
.end if
Expand Down
2 changes: 1 addition & 1 deletion arc/q.val.translate.arc
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
.select one te_dim related by te_var->TE_DIM[R2057]
.if ( not_empty te_dim )
.// relate te_val to te_dim across R2057;
.assign te_val.te_dimID = te_dim.ID
.assign te_val.te_dimID = te_dim.te_dimID
.// end relate
.else
.assign te_val.te_dimID = 00
Expand Down
7 changes: 4 additions & 3 deletions arc/specialized/sys.arc
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@
.// Generate the system code.
.//============================================================================
.invoke main_decl = GetMainTaskEntryDeclaration()
.invoke return_body = GetMainTaskEntryReturn()
.invoke r = GetMainTaskEntryReturn()
.assign return_body = r.body
.select any te_cia from instances of TE_CIA
.//
.// function-based archetype generation
Expand Down Expand Up @@ -368,8 +369,8 @@
.assign structured_data_types = structured_data_types + s.body
.// Get all components, not just those with internal behavior.
.select many te_cs from instances of TE_C where ( selected.included_in_build )
.invoke s = UserSuppliedDataTypeIncludes()
.assign user_supplied_data_types = s.s
.invoke r = UserSuppliedDataTypeIncludes()
.assign user_supplied_data_types = r.result
.include "${te_file.arc_path}/t.sys_types.h"
.emit to file "${te_file.system_include_path}/${te_file.types}.${te_file.hdr_file_ext}"
.//
Expand Down
2 changes: 1 addition & 1 deletion arc/specialized/t.sys_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ if ( false == lazy_initialized ) {
.end if
.end if
.if ( ( te_thread.flavor != "Nucleus" ) and ( te_thread.flavor != "AUTOSAR" ) )
${return_body.body}\
${return_body}\
.end if
.if ( te_sys.AUTOSAR )
}
Expand Down
6 changes: 3 additions & 3 deletions schema/sql/xtumlmc_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2371,7 +2371,7 @@ CREATE TABLE TE_SWC (
Ret_Val BOOLEAN,
Built_In BOOLEAN,
Oid_ID INTEGER,
Obj_ID UNIQUE_ID );
GeneratedName STRING );

-- Class: 2001. Component Instance
CREATE TABLE TE_CI (
Expand Down Expand Up @@ -6010,8 +6010,8 @@ CREATE ROP REF_ID R4404 FROM MC SLD_SCINP (Sys_ID)
-- Relationships In Subsystem: Translation Extensions
-- ============================================================================

CREATE ROP REF_ID R2001 FROM MC TE_SWC (Obj_Kl)
TO 1C O_OBJ (Key_Lett);
CREATE ROP REF_ID R2001 FROM MC TE_SWC (GeneratedName)
TO 1C TE_CLASS (GeneratedName);

CREATE ROP REF_ID R2002 FROM MC TE_MACT (te_cID)
TO 1 TE_C (ID);
Expand Down

0 comments on commit 4885eb6

Please sign in to comment.