Commit 29b22e1a authored by Claes Sjofors's avatar Claes Sjofors

wb embedded plc code, more work

parent 50039a92
......@@ -140,6 +140,30 @@
else \
strcpy( obj->ActVal, "");
/*_*
GetRefS
Get string value by reference
@aref getrefs GetRefS
*/
#define GetRefS_exec(obj,value) \
strncpy( obj->ActVal, value, sizeof(obj->ActVal));
/*_*
StoRefS
Store string value by reference
@aref storefs StoRefS
*/
#define StoRefS_exec(out,in,size) \
strncpy( out, in, size);
/*_*
CStoRefS
Conditionally store analog value by reference
@aref cstorefs CStoRefS
*/
#define CStoRefS_exec(out,in,cond,size) \
if ( cond) strncpy( out, in, size);
......
......@@ -44,6 +44,10 @@ SObject pwrb:Class
! Conditional store analog attribute by reference.
! @image orm_cstorefa_fo.png
!
! The object should be conneced to an attribute of type AttrRef that
! points to the target signal or attribute.
!
! The target can be an Av, Ai, Ao or an arbitrary analog attribute.
!*/
Object CStoRefA $ClassDef 667
Body SysBody
......
......@@ -44,6 +44,10 @@ SObject pwrb:Class
! Conditional store analog attribute by reference.
! @image orm_cstorefi_fo.png
!
! The object should be conneced to an attribute of type AttrRef that
! points to the target signal or attribute.
!
! The target can be an Iv, Ii, Io or an arbitrary integer attribute.
!*/
Object CStoRefI $ClassDef 668
Body SysBody
......
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2014 SSAB EMEA AB.
!
! This file is part of Proview.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with Proview. If not, see <http://www.gnu.org/licenses/>
!
! Linking Proview statically or dynamically with other modules is
! making a combined work based on Proview. Thus, the terms and
! conditions of the GNU General Public License cover the whole
! combination.
!
! In addition, as a special exception, the copyright holders of
! Proview give you permission to, from the build function in the
! Proview Configurator, combine Proview with modules generated by the
! Proview PLC Editor to a PLC program, regardless of the license
! terms of these modules. You may copy and distribute the resulting
! combined work under the terms of your choice, provided that every
! copy of the combined work is accompanied by a complete copy of
! the source code of Proview (the version used to produce the
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! pwrb_c_cstorefs.wb_load -- Defines the class CStoRefS.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Group Plc,PlcIO
! @Summary Conditinal store string attribute by reference
! Conditional store string attribute by reference.
! @image orm_cstorefs_fo.png
!
! The object should be conneced to an attribute of type AttrRef that
! points to the target signal or attribute.
!
! The target can be an Sv or an arbitrary string attribute.
!*/
Object CStoRefS $ClassDef 672
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_RtConnectionsAndDevBodies
Attr Flags = pwr_mClassDef_DevOnly
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "CStoRefS"
EndBody
!/**
! Input value to store in the referenced attribute.
!*/
Object In $Input 1
Body SysBody
Attr PgmName = "In"
Attr Flags |= PWR_MASK_RTVIRTUAL
Attr Flags |= PWR_MASK_DEVBODYREF
Attr TypeRef = "pwrs:Type-$String80"
Attr GraphName = "in"
EndBody
EndObject
!/**
! Specifies whether a storage will be done or not. FALSE
! means no storage and TRUE means storage of a string
! value.
!*/
Object Cond $Input 2
Body SysBody
Attr PgmName = "Cond"
Attr TypeRef = "pwrs:Type-$Boolean"
Attr GraphName = "con"
Attr ConPointNr = 1
EndBody
EndObject
EndObject
Object DevBody $ObjBodyDef 2
!/**
! Used by the PLC Editor. Specifies the complete name of
! the actual attribute.
!*/
Object RefAttribute $Intern 1
Body SysBody
Attr PgmName = "RefAttribute"
Attr TypeRef = "pwrs:Type-$AttrRef"
Attr NiNaAnnot = 1
Attr NiNaSegments = 1
EndBody
EndObject
!/**
! Specifies how many segments of the actual object name
! that is to be displayed in the symbol of the CStoRefS
! object. The segments are counted from behind.
!*/
Object RefAttributeSegments $Intern 3
Body SysBody
Attr TypeRef = "pwrs:Type-$Int32"
EndBody
EndObject
Object PlcNode $Buffer 4
Body SysBody
Attr Class = pwr_eClass_PlcNode
Attr Flags |= PWR_MASK_INVISIBLE
EndBody
EndObject
EndObject
Object GraphPlcNode $GraphPlcNode
Body SysBody
Attr object_type = 11
Attr parameters[0] = 2
Attr parameters[1] = 0
Attr parameters[2] = 0
Attr parameters[3] = 0
Attr subwindows = 0
Attr graphmethod = 15
Attr graphindex = 0
Attr default_mask[0] = 3
Attr default_mask[1] = 0
Attr segname_annotation = 0
Attr devbody_annotation = 1
Attr compmethod = 69
Attr compindex = 0
Attr tracemethod = 1
Attr traceindex = 1
Attr connectmethod = 35
Attr executeordermethod = 2
Attr objname = "CStoRefS"
Attr graphname = "CStoRefS"
EndBody
EndObject
Object Template StoRefS
Body RtBody
Attr Cond = 1
EndBody
Body DevBody
Attr RefAttributeSegments = 2
EndBody
EndObject
EndObject
EndSObject
......@@ -43,6 +43,10 @@ SObject pwrb:Class
! Get analog attribute by reference.
! @image orm_getrefa_fo.png
!
! The object should be conneced to an attribute of type AttrRef that
! points to the source signal or attribute.
!
! The source can be an Av, Ai, Ao or an arbitrary analog attribute.
!*/
Object GetRefA $ClassDef 661
Body SysBody
......
......@@ -43,6 +43,10 @@ SObject pwrb:Class
! Get Digital attribute by reference.
! @image orm_getrefd_fo.png
!
! The object should be conneced to an attribute of type AttrRef that
! points to the source signal or attribute.
!
! The source can be a Dv, Di, Do or an arbitrary digital attribute.
!*/
Object GetRefD $ClassDef 659
Body SysBody
......
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2014 SSAB EMEA AB.
!
! This file is part of Proview.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with Proview. If not, see <http://www.gnu.org/licenses/>
!
! Linking Proview statically or dynamically with other modules is
! making a combined work based on Proview. Thus, the terms and
! conditions of the GNU General Public License cover the whole
! combination.
!
! In addition, as a special exception, the copyright holders of
! Proview give you permission to, from the build function in the
! Proview Configurator, combine Proview with modules generated by the
! Proview PLC Editor to a PLC program, regardless of the license
! terms of these modules. You may copy and distribute the resulting
! combined work under the terms of your choice, provided that every
! copy of the combined work is accompanied by a complete copy of
! the source code of Proview (the version used to produce the
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! pwrb_c_getrefdata.wb_load -- Defines the class GetRefData.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Group Plc,PlcIO
! @Summary Get data attribute by reference
! Get data attribute by reference.
! @image orm_getrefdata_fo.png
!
! The object should be conneced to an attribute of type AttrRef that
! points to the source object or attribute object.
!
! The source can be an individual object or an attribute object.
!*/
Object GetRefData $ClassDef 673
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_RtAndDevBodies
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "GetRefData"
EndBody
!/**
! The value of the referenced attribute.
!*/
Object Out $Output 1
Body SysBody
Attr PgmName = "Out"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_PRIVATE
Attr TypeRef = "pwrs:Type-$Void"
Attr GraphName = "Out"
EndBody
EndObject
EndObject
Object DevBody $ObjBodyDef 2
!/**
! Used by the PLC Editor. Specifies the complete name of
! the actual attribute.
!*/
Object RefAttribute $Intern 1
Body SysBody
Attr PgmName = "RefAttribute"
Attr TypeRef = "pwrs:Type-$AttrRef"
Attr NiNaAnnot = 1
Attr NiNaSegments = 1
EndBody
EndObject
!/**
! Specifies how many segments of the actual object name
! that is to be displayed in the symbol of the GetRefData
! object. The segments are counted from behind.
!*/
Object RefAttributeSegments $Intern 3
Body SysBody
Attr TypeRef = "pwrs:Type-$Int32"
EndBody
EndObject
Object PlcNode $Buffer 4
Body SysBody
Attr Class = pwr_eClass_PlcNode
Attr Flags |= PWR_MASK_INVISIBLE
EndBody
EndObject
EndObject
Object GraphPlcNode $GraphPlcNode
Body SysBody
Attr object_type = 11
Attr parameters[0] = 0
Attr parameters[1] = 0
Attr parameters[2] = 1
Attr parameters[3] = 0
Attr subwindows = 0
Attr graphmethod = 7
Attr graphindex = 0
Attr default_mask[0] = 0
Attr default_mask[1] = 1
Attr segname_annotation = 0
Attr devbody_annotation = 1
Attr compmethod = 68
Attr compindex = 0
Attr tracemethod = 1
Attr traceindex = 1
Attr connectmethod = 35
Attr executeordermethod = 2
Attr objname = "GetRefData"
Attr graphname = "GetRefData"
Attr debugpar = "ActVal"
EndBody
EndObject
Object Template GetRefData
Body DevBody
Attr RefAttributeSegments = 2
EndBody
EndObject
EndObject
EndSObject
......@@ -43,6 +43,10 @@ SObject pwrb:Class
! Get Integer attribute by reference.
! @image orm_getrefi_fo.png
!
! The object should be conneced to an attribute of type AttrRef that
! points to the source signal or attribute.
!
! The source can be an Iv, Ii, Io or an arbitrary integer attribute.
!*/
Object GetRefI $ClassDef 660
Body SysBody
......
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2014 SSAB EMEA AB.
!
! This file is part of Proview.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with Proview. If not, see <http://www.gnu.org/licenses/>
!
! Linking Proview statically or dynamically with other modules is
! making a combined work based on Proview. Thus, the terms and
! conditions of the GNU General Public License cover the whole
! combination.
!
! In addition, as a special exception, the copyright holders of
! Proview give you permission to, from the build function in the
! Proview Configurator, combine Proview with modules generated by the
! Proview PLC Editor to a PLC program, regardless of the license
! terms of these modules. You may copy and distribute the resulting
! combined work under the terms of your choice, provided that every
! copy of the combined work is accompanied by a complete copy of
! the source code of Proview (the version used to produce the
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! pwrb_c_getrefs.wb_load -- Defines the class GetRefS.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Group Plc,PlcIO
! @Summary Get string attribute by reference
! Get string attribute by reference.
! @image orm_getrefs_fo.png
!
! The object should be conneced to an attribute of type AttrRef that
! points to the source signal or attribute.
!
! The source can be an Sv or an arbitrary string attribute.
!*/
Object GetRefS $ClassDef 670
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_RtAndDevBodies
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "GetRefS"
EndBody
!/**
! The value of the referenced attribute.
!*/
Object ActVal $Output 1
Body SysBody
Attr PgmName = "ActVal"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$String80"
Attr GraphName = "ActVal"
EndBody
EndObject
EndObject
Object DevBody $ObjBodyDef 2
!/**
! Used by the PLC Editor. Specifies the complete name of
! the actual attribute.
!*/
Object RefAttribute $Intern 1
Body SysBody
Attr PgmName = "RefAttribute"
Attr TypeRef = "pwrs:Type-$AttrRef"
Attr NiNaAnnot = 1
Attr NiNaSegments = 1
EndBody
EndObject
!/**
! Specifies how many segments of the actual object name
! that is to be displayed in the symbol of the GetRefS
! object. The segments are counted from behind.
!*/
Object RefAttributeSegments $Intern 3
Body SysBody
Attr TypeRef = "pwrs:Type-$Int32"
EndBody
EndObject
Object PlcNode $Buffer 4
Body SysBody
Attr Class = pwr_eClass_PlcNode
Attr Flags |= PWR_MASK_INVISIBLE
EndBody
EndObject
EndObject
Object GraphPlcNode $GraphPlcNode
Body SysBody
Attr object_type = 11
Attr parameters[0] = 0
Attr parameters[1] = 0
Attr parameters[2] = 1
Attr parameters[3] = 0
Attr subwindows = 0
Attr graphmethod = 7
Attr graphindex = 0
Attr default_mask[0] = 0
Attr default_mask[1] = 1
Attr segname_annotation = 0
Attr devbody_annotation = 1
Attr compmethod = 68
Attr compindex = 0
Attr tracemethod = 1
Attr traceindex = 1
Attr connectmethod = 35
Attr executeordermethod = 2
Attr objname = "GetRefS"
Attr graphname = "GetRefS"
Attr debugpar = "ActVal"
EndBody
EndObject
Object Template GetRefS
Body DevBody
Attr RefAttributeSegments = 2
EndBody
EndObject
EndObject
EndSObject
......@@ -43,6 +43,10 @@ SObject pwrb:Class
! Reset digital attribute by reference.
! @image orm_resrefd_fo.png
!
! The object should be conneced to an attribute of type AttrRef that
! points to the target signal or attribute.
!
! The target can be a Dv, Di, Do or an arbitrary digital attribute.
!*/
Object ResRefD $ClassDef 666
Body SysBody
......@@ -113,7 +117,7 @@ SObject pwrb:Class
Attr devbody_annotation = 1
Attr compmethod = 69
Attr compindex = 0
Attr tracemethod = 1
Attr tracemethod = 6
Attr traceindex = 1
Attr connectmethod = 35
Attr executeordermethod = 2
......
......@@ -43,6 +43,10 @@ SObject pwrb:Class
! Set digital attribute by reference.
! @image orm_setrefd_fo.png
!
! The object should be conneced to an attribute of type AttrRef that
! points to the target signal or attribute.
!
! The target can be a Dv, Di, Do or an arbitrary digital attribute.
!*/
Object SetRefD $ClassDef 665
Body SysBody
......@@ -113,7 +117,7 @@ SObject pwrb:Class
Attr devbody_annotation = 1
Attr compmethod = 69
Attr compindex = 0
Attr tracemethod = 1
Attr tracemethod = 6
Attr traceindex = 1
Attr connectmethod = 35
Attr executeordermethod = 2
......
......@@ -44,6 +44,10 @@ SObject pwrb:Class
! Store analog attribute by reference.
! @image orm_storefa_fo.png
!
! The object should be conneced to an attribute of type AttrRef that
! points to the target signal or attribute.
!
! The target can be an Av, Ai, Ao or an arbitrary analog attribute.
!*/
Object StoRefA $ClassDef 664
Body SysBody
......
......@@ -43,6 +43,10 @@ SObject pwrb:Class
! Store digital attribute by reference.
! @image orm_storefd_fo.png
!
! The object should be conneced to an attribute of type AttrRef that
! points to the target signal or attribute.
!
! The target can be a Dv, Di, Do or an arbitrary digital attribute.
!*/
Object StoRefD $ClassDef 662
Body SysBody
......@@ -113,7 +117,7 @@ SObject pwrb:Class
Attr devbody_annotation = 1
Attr compmethod = 69
Attr compindex = 0
Attr tracemethod = 1
Attr tracemethod = 6
Attr traceindex = 1
Attr connectmethod = 35
Attr executeordermethod = 2
......
......@@ -43,6 +43,10 @@ SObject pwrb:Class
! Store integer attribute by reference.
! @image orm_storefi_fo.png
!
! The object should be conneced to an attribute of type AttrRef that
! points to the target signal or attribute.
!
! The target can be an Iv, Ii, Io or an arbitrary integer attribute.
!*/
Object StoRefI $ClassDef 663
Body SysBody
......
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2014 SSAB EMEA AB.
!
! This file is part of Proview.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with Proview. If not, see <http://www.gnu.org/licenses/>
!
! Linking Proview statically or dynamically with other modules is
! making a combined work based on Proview. Thus, the terms and
! conditions of the GNU General Public License cover the whole
! combination.
!
! In addition, as a special exception, the copyright holders of
! Proview give you permission to, from the build function in the
! Proview Configurator, combine Proview with modules generated by the
! Proview PLC Editor to a PLC program, regardless of the license
! terms of these modules. You may copy and distribute the resulting
! combined work under the terms of your choice, provided that every
! copy of the combined work is accompanied by a complete copy of
! the source code of Proview (the version used to produce the
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! pwrb_c_storefs.wb_load -- Defines the class StoRefS.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Group Plc,PlcIO
! @Summary Store string attribute by reference
! Store string attribute by reference.
! @image orm_storefs_fo.png
!
! The object should be conneced to an attribute of type AttrRef that
! points to the target signal or attribute.
!
! The target can be an Sv or an arbitrary string attribute.
!*/
Object StoRefS $ClassDef 671
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_RtConnectionsAndDevBodies
Attr Flags = pwr_mClassDef_DevOnly
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "StoRefS"
EndBody
!/**
! Input value to store in the referenced attribute.
!*/
Object In $Input 1
Body SysBody
Attr PgmName = "In"
Attr Flags |= PWR_MASK_RTVIRTUAL
Attr Flags |= PWR_MASK_DEVBODYREF
Attr TypeRef = "pwrs:Type-$String80"
Attr GraphName = "in"
EndBody
EndObject
EndObject
Object DevBody $ObjBodyDef 2
!/**
! Used by the PLC Editor. Specifies the complete name of
! the actual attribute.
!*/
Object RefAttribute $Intern 1
Body SysBody
Attr PgmName = "RefAttribute"
Attr TypeRef = "pwrs:Type-$AttrRef"
Attr NiNaAnnot = 1
Attr NiNaSegments = 1
EndBody
EndObject
!/**
! Specifies how many segments of the actual object name
! that is to be displayed in the symbol of the StoRefS
! object. The segments are counted from behind.
!*/
Object RefAttributeSegments $Intern 3
Body SysBody
Attr TypeRef = "pwrs:Type-$Int32"
EndBody
EndObject
Object PlcNode $Buffer 4
Body SysBody
Attr Class = pwr_eClass_PlcNode
Attr Flags |= PWR_MASK_INVISIBLE
EndBody
EndObject
EndObject
Object GraphPlcNode $GraphPlcNode
Body SysBody
Attr object_type = 11
Attr parameters[0] = 1
Attr parameters[1] = 0
Attr parameters[2] = 0
Attr parameters[3] = 0
Attr subwindows = 0
Attr graphmethod = 7
Attr graphindex = 0
Attr default_mask[0] = 1
Attr default_mask[1] = 0
Attr segname_annotation = 0
Attr devbody_annotation = 1
Attr compmethod = 69
Attr compindex = 0
Attr tracemethod = 1
Attr traceindex = 1
Attr connectmethod = 35
Attr executeordermethod = 2
Attr objname = "StoRefS"
Attr graphname = "StoRefS"
EndBody
EndObject
Object Template StoRefS
Body DevBody
Attr RefAttributeSegments = 2
EndBody
EndObject
EndObject
EndSObject
......@@ -39,8 +39,10 @@ SObject pwrb:Class
!/**
! @Version 1.0
! @Code rt_plc_macro_io.h
! @Group Plc,PlcIO
! @Summary Store string attribute from class template plc.
! @Summary Deprecated.
! Deprecated.
! This object is deprecated and should not be used in newly written code.
!
! Store string attribute from class template plc.
! @image orm_stosattr_fo.gif
!
......
......@@ -1078,16 +1078,20 @@ palette PlcEditorPalette
class GetDataRefp
class GetDataRefv
class GetDataInput
class GetRefData
class StoDataRefv
}
menu String
{
class CStoNumSp
class CStoRefS
class CStoSp
class CStoSv
class GetRefS
class GetSp
class GetSv
class StoNumSp
class StoRefS
class StoSp
class StoSv
class StrAdd
......@@ -1160,22 +1164,6 @@ palette PlcEditorPalette
class StoPi
class ToggleDi
}
menu Function
{
class CStoAattr
class CStoIattr
class CStoSattr
class GetAattr
class GetDattr
class GetIattr
class GetSattr
class ResDattr
class SetDattr
class StoAattr
class StoDattr
class StoIattr
class StoSattr
}
}
menu TLog TLog
{
......
......@@ -16610,6 +16610,16 @@ int gcg_comp_m68( gcg_ctx gcgctx, vldh_t_node node)
/* Insert io object in ioread list */
gcg_ioread_insert( gcgctx, aref, GCG_PREFIX_REF);
break;
case pwr_cClass_Sv:
if ( node->ln.cid != pwr_cClass_GetRefS) {
gcg_error_msg( gcgctx, GSX__REFPARTYPE, node);
return GSX__NEXTPAR;
}
strcpy( parameter, "ActualValue");
/* Insert io object in ioread list */
gcg_aref_insert( gcgctx, aref, GCG_PREFIX_REF, node);
break;
default: {
switch ( info.type) {
case pwr_eType_Boolean:
......@@ -16638,64 +16648,92 @@ int gcg_comp_m68( gcg_ctx gcgctx, vldh_t_node node)
return GSX__NEXTPAR;
}
break;
case pwr_eType_String:
if ( node->ln.cid != pwr_cClass_GetRefS) {
gcg_error_msg( gcgctx, GSX__REFPARTYPE, node);
return GSX__NEXTPAR;
}
break;
default:
gcg_error_msg( gcgctx, GSX__REFPARTYPE, node);
return GSX__NEXTPAR;
if ( cdh_tidIsCid( info.tid)) {
if ( node->ln.cid != pwr_cClass_GetRefData) {
gcg_error_msg( gcgctx, GSX__REFPARTYPE, node);
return GSX__NEXTPAR;
}
}
else {
gcg_error_msg( gcgctx, GSX__REFPARTYPE, node);
return GSX__NEXTPAR;
}
}
/* Get rid of last attribute segment of the referenced object */
sts = ldh_AttrRefToName( ldhses, &aref, ldh_eName_ArefVol,
&name_p, &size);
if ( EVEN(sts)) return sts;
if ( node->ln.cid == pwr_cClass_GetRefData)
gcg_aref_insert( gcgctx, aref, GCG_PREFIX_REF, node);
else {
/* Get rid of last attribute segment of the referenced object */
sts = ldh_AttrRefToName( ldhses, &aref, ldh_eName_ArefVol,
&name_p, &size);
if ( EVEN(sts)) return sts;
strcpy( aname, name_p);
if ( (s = strrchr( aname, '.')) == 0) {
gcg_error_msg( gcgctx, GSX__REFOBJ, node);
return GSX__NEXTPAR;
}
strcpy( aname, name_p);
if ( (s = strrchr( aname, '.')) == 0) {
gcg_error_msg( gcgctx, GSX__REFOBJ, node);
return GSX__NEXTPAR;
}
*s = 0;
sts = ldh_NameToAttrRef( ldhses, aname, &aref);
if ( EVEN(sts)) {
gcg_error_msg( gcgctx, GSX__REFOBJ, node);
return GSX__NEXTPAR;
}
*s = 0;
sts = ldh_NameToAttrRef( ldhses, aname, &aref);
if ( EVEN(sts)) {
gcg_error_msg( gcgctx, GSX__REFOBJ, node);
return GSX__NEXTPAR;
}
sts = ldh_GetAttrRefOrigTid( ldhses, &aref, &cid);
if ( EVEN(sts)) return sts;
sts = ldh_GetAttrRefOrigTid( ldhses, &aref, &cid);
if ( EVEN(sts)) return sts;
sts = gcg_parname_to_pgmname(ldhses, cid, s+1, parameter);
if ( EVEN(sts)) return sts;
if ( info.flags & PWR_MASK_RTVIRTUAL) {
/* Attribute is not defined in runtime */
gcg_error_msg( gcgctx, GSX__REFPARTYPE, node);
return GSX__NEXTNODE;
}
sts = gcg_parname_to_pgmname(ldhses, cid, s+1, parameter);
if ( EVEN(sts)) return sts;
if ( info.flags & PWR_MASK_ARRAY) {
if ( info.nElement == -1) {
/* No index in attribute */
if ( info.flags & PWR_MASK_RTVIRTUAL) {
/* Attribute is not defined in runtime */
gcg_error_msg( gcgctx, GSX__REFPARTYPE, node);
return GSX__NEXTNODE;
}
if ( info.flags & PWR_MASK_ARRAY) {
if ( info.nElement == -1) {
/* No index in attribute */
gcg_error_msg( gcgctx, GSX__REFPARTYPE, node);
return GSX__NEXTNODE;
}
}
}
/* Insert object in ref list */
gcg_aref_insert( gcgctx, aref, GCG_PREFIX_REF, node);
/* Insert object in ref list */
gcg_aref_insert( gcgctx, aref, GCG_PREFIX_REF, node);
}
}
}
sts = gcg_print_exec_macro( gcgctx, node, node->ln.oid, GCG_PREFIX_REF);
if (EVEN(sts)) return sts;
/* Print the parent object */
IF_PR fprintf( gcgctx->files[GCGM1_CODE_FILE],
"%c%s->%s);\n",
GCG_PREFIX_REF,
vldh_AttrRefToStr(0, aref),
parameter);
if ( node->ln.cid == pwr_cClass_GetRefData) {
IF_PR fprintf( gcgctx->files[GCGM1_REF_FILE],
"%c%s->Out = (pwr_tVoid *)%c%s;\n",
GCG_PREFIX_REF,
vldh_IdToStr(0, node->ln.oid),
GCG_PREFIX_REF,
vldh_AttrRefToStr(0, aref));
}
else {
sts = gcg_print_exec_macro( gcgctx, node, node->ln.oid, GCG_PREFIX_REF);
if (EVEN(sts)) return sts;
/* Print the parent object */
IF_PR fprintf( gcgctx->files[GCGM1_CODE_FILE],
"%c%s->%s);\n",
GCG_PREFIX_REF,
vldh_AttrRefToStr(0, aref),
parameter);
}
return GSX__SUCCESS;
}
......@@ -16743,6 +16781,7 @@ int gcg_comp_m69( gcg_ctx gcgctx, vldh_t_node node)
gcg_t_nocondef nocondef[2];
unsigned long nocontype[2];
char *name;
int info_size;
nocondef[1].bo = 1;
nocontype[1] = GCG_BOOLEAN;
......@@ -16844,7 +16883,19 @@ int gcg_comp_m69( gcg_ctx gcgctx, vldh_t_node node)
/* Insert io object in iowrite list */
gcg_iowrite_insert( gcgctx, aref, GCG_PREFIX_REF);
break;
case pwr_cClass_Sv:
if ( !(node->ln.cid == pwr_cClass_StoRefS ||
node->ln.cid == pwr_cClass_CStoRefS)) {
gcg_error_msg( gcgctx, GSX__REFPARTYPE, node);
return GSX__NEXTPAR;
}
strcpy( parameter, "ActualValue");
info_size = sizeof(pwr_tString80);
/* Insert io object in ref list */
gcg_aref_insert( gcgctx, aref, GCG_PREFIX_REF, node);
break;
default: {
info_size = info.size;
switch ( info.type) {
case pwr_eType_Boolean:
if ( !(node->ln.cid == pwr_cClass_StoRefD ||
......@@ -16876,6 +16927,13 @@ int gcg_comp_m69( gcg_ctx gcgctx, vldh_t_node node)
return GSX__NEXTPAR;
}
break;
case pwr_eType_String:
if ( !(node->ln.cid == pwr_cClass_StoRefS ||
node->ln.cid == pwr_cClass_CStoRefS)) {
gcg_error_msg( gcgctx, GSX__REFPARTYPE, node);
return GSX__NEXTPAR;
}
break;
default:
gcg_error_msg( gcgctx, GSX__REFPARTYPE, node);
return GSX__NEXTPAR;
......@@ -16951,6 +17009,11 @@ int gcg_comp_m69( gcg_ctx gcgctx, vldh_t_node node)
nocondef[0].bo = *(int *) nocondef_ptr;
nocontype[0] = GCG_INT32;
break;
case pwr_cClass_StoRefS:
case pwr_cClass_CStoRefS:
strcpy( nocondef[0].str, (char *) nocondef_ptr);
nocontype[0] = GCG_STRING;
break;
default: ;
}
free(nocondef_ptr);
......@@ -16971,27 +17034,13 @@ int gcg_comp_m69( gcg_ctx gcgctx, vldh_t_node node)
nocondef, nocontype);
if ( EVEN(sts) ) return sts;
#if 0
if ( node->ln.cid == pwr_cClass_stosp ||
node->ln.cid == pwr_cClass_cstosp ) {
if ( node->ln.cid == pwr_cClass_StoRefS ||
node->ln.cid == pwr_cClass_CStoRefS ) {
// Add size of connected attribute
IF_PR fprintf( gcgctx->files[GCGM1_CODE_FILE],
",%d", info.size);
",%d", info_size);
}
else if ( node->ln.cid == pwr_cClass_stonumsp ||
node->ln.cid == pwr_cClass_cstonumsp ) {
// Add size of connected attribute and number of characters
pwr_tInt32 *numberofchar_ptr;
sts = ldh_GetObjectPar( ldhses, node->ln.oid, "DevBody",
"NumberOfChar", (char **)&numberofchar_ptr, &size);
if ( EVEN(sts)) return sts;
IF_PR fprintf( gcgctx->files[GCGM1_CODE_FILE],
",%d,%d", info.size, *numberofchar_ptr);
free( (char *)numberofchar_ptr);
}
#endif
IF_PR fprintf( gcgctx->files[GCGM1_CODE_FILE],
");\n");
......
......@@ -136,6 +136,13 @@ static pwr_tStatus trace_get_attr_m5( WGre *gre,
char *attr_str,
flow_eTraceType *trace_type,
int *inverted);
static pwr_tStatus trace_get_attr_m6( WGre *gre,
vldh_t_node node,
char *debug_par,
char *object_str,
char *attr_str,
flow_eTraceType *trace_type,
int *inverted);
static pwr_tStatus trace_get_attr_m7( WGre *gre,
vldh_t_node node,
char *debug_par,
......@@ -166,7 +173,7 @@ tra_tMethod trace_get_attr_m[TRA_MAX_TRACEMETHOD] = {
trace_get_attr_m3,
trace_get_attr_m4,
trace_get_attr_m5,
trace_get_attr_mno,
trace_get_attr_m6,
trace_get_attr_m7,
trace_get_attr_mno,
trace_get_attr_m9
......@@ -573,6 +580,99 @@ static pwr_tStatus trace_get_attr_m5( WGre *gre,
return TRA__SUCCESS;
}
/*************************************************************************
*
* Name: trace_getm6()
*
* Type int
*
* Type Parameter IOGF Description
*
* Description:
* Trace method for SetRefD, StoRefD and similar objects.
*
* The attribute RefAttribute contains a reference to an attribute of type
* pwr_tAttrRef that points to the actual attribute.
*
**************************************************************************/
static pwr_tStatus trace_get_attr_m6( WGre *gre,
vldh_t_node node,
char *debug_par,
char *object_str,
char *attr_str,
flow_eTraceType *trace_type,
int *inverted)
{
pwr_tAName aname;
pwr_tStatus sts;
int size;
pwr_tAttrRef *refarp, *arp;
pwr_tAttrRef aref;
pwr_tTid tid;
char *np, *s;
ldh_sAttrRefInfo info;
sts = ldh_GetObjectPar( node->hn.wind->hw.ldhses, node->ln.oid,
"DevBody", "RefAttribute", (char **)&refarp, &size);
if ( EVEN(sts)) return sts;
sts = ldh_GetAttrObjectPar( node->hn.wind->hw.ldhses,
refarp, "RtBody", "", (char **)&arp, &size);
free((char *) refarp);
if ( EVEN(sts)) return sts;
aref = *arp;
free( arp);
sts = ldh_GetAttrRefTid( node->hn.wind->hw.ldhses, &aref, &tid);
if( EVEN(sts) ) return sts;
/* Get the name of the node */
sts = ldh_AttrRefToName( node->hn.wind->hw.ldhses,
&aref, cdh_mNName, &np, &size);
if( EVEN(sts)) return sts;
strcpy( aname, np);
switch ( tid) {
case pwr_cClass_Dv:
case pwr_cClass_Di:
case pwr_cClass_Do:
strcpy( attr_str, "ActualValue");
strcpy( object_str, aname);
*trace_type = flow_eTraceType_Boolean;
break;
default:;
if ( cdh_tidIsCid( tid))
return TRA__NOPAR;
s = strrchr( aname, '.');
if ( !s) return TRA__NOPAR;
strcpy( attr_str, s + 1);
*s = 0;
strcpy( object_str, aname);
sts = ldh_GetAttrRefInfo( node->hn.wind->hw.ldhses, &aref, &info);
if ( EVEN(sts)) return sts;
switch( info.type) {
case pwr_eType_Boolean:
*trace_type = flow_eTraceType_Boolean;
break;
case pwr_eType_Int32:
*trace_type = flow_eTraceType_Int32;
break;
case pwr_eType_Float32:
*trace_type = flow_eTraceType_Float32;
break;
default:
*trace_type = flow_eTraceType_Int32;
break;
}
}
return TRA__SUCCESS;
}
/*************************************************************************
*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment