Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
269cd605
Commit
269cd605
authored
May 27, 2011
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Plc object EnumToStr added
parent
44ef941a
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
176 additions
and
1 deletion
+176
-1
src/doc/orm/src/orm_enumtostr_fo.png
src/doc/orm/src/orm_enumtostr_fo.png
+0
-0
src/lib/rt/src/rt_plc_io.c
src/lib/rt/src/rt_plc_io.c
+31
-0
src/wbl/pwrb/src/pwrb_c_dtostr.wb_load
src/wbl/pwrb/src/pwrb_c_dtostr.wb_load
+1
-1
src/wbl/pwrb/src/pwrb_c_enumtostr.wb_load
src/wbl/pwrb/src/pwrb_c_enumtostr.wb_load
+143
-0
wb/exp/wb/src/pwr_wb_palette.cnf
wb/exp/wb/src/pwr_wb_palette.cnf
+1
-0
No files found.
src/doc/orm/src/orm_enumtostr_fo.png
0 → 100644
View file @
269cd605
1.53 KB
src/lib/rt/src/rt_plc_io.c
View file @
269cd605
...
...
@@ -444,3 +444,34 @@ void StoIpPtr_exec( plc_sThread *tp,
*
o
->
Ptr
=
*
o
->
InP
;
}
/*_*
ENUMTOSTR
@aref enumtostr ENUMTOSTR
*/
void
EnumToStr_init
(
pwr_sClass_EnumToStr
*
o
)
{
if
(
EVEN
(
gdh_GetEnumValueDef
(
o
->
TypeId
,
(
gdh_sValueDef
**
)
&
o
->
EnumDefP
,
(
int
*
)
&
o
->
EnumDefRows
)))
o
->
EnumDefP
=
0
;
}
void
EnumToStr_exec
(
plc_sThread
*
tp
,
pwr_sClass_EnumToStr
*
o
)
{
int
i
;
int
found
=
0
;
if
(
!
o
->
EnumDefP
)
return
;
for
(
i
=
0
;
i
<
o
->
EnumDefRows
;
i
++
)
{
if
(
((
gdh_sValueDef
*
)
o
->
EnumDefP
)[
i
].
Value
->
Value
==
*
o
->
InP
)
{
strncpy
(
o
->
ActVal
,
((
gdh_sValueDef
*
)
o
->
EnumDefP
)[
i
].
Value
->
Text
,
sizeof
(
o
->
ActVal
));
found
=
1
;
break
;
}
}
if
(
!
found
)
strcpy
(
o
->
ActVal
,
""
);
}
src/wbl/pwrb/src/pwrb_c_dtostr.wb_load
View file @
269cd605
...
...
@@ -28,7 +28,7 @@ SObject pwrb:Class
! @image orm_dtostr_fo.gif
!
! The DtoStr object converts the value of the digital input to
! a
t
string stored in ActVal.
! a string stored in ActVal.
!
! Note that an erroneous format specification may cause the
! plcprogram to terminate. The size of the output of the conversion should
...
...
src/wbl/pwrb/src/pwrb_c_enumtostr.wb_load
0 → 100644
View file @
269cd605
!
! Proview $Id: pwrb_c_dtostr.wb_load,v 1.9 2005-09-01 14:58:01 claes Exp $
! Copyright (C) 2005 SSAB Oxelsund AB.
!
! 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 the program, if not, write to the Free Software
! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
!
! pwrb_c_enumtostr.wb_load -- Defines the class EnumToStr.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Code rt_plc_io.c
! @Group Plc,PlcString,PlcConversion
! @Summary Convert enumeration value to string
! Convert enumeration value to string.
! @image orm_enumtostr_fo.png
!
! The EnumToStr object converts the value of the enumeration input to
! the associated string.
!
! The enumeration value can be fetched as an integer, eg with a GetIp
! connected to the input pin.
!
! The enumeration type is specified in the TypeId attribute.
!*/
Object EnumToStr $ClassDef 543
Body SysBody
Attr Editor = pwr_eEditor_PlcEd
Attr Method = pwr_eMethod_Connections
Attr PopEditor = 2
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "EnumToStr"
EndBody
!/**
! Emumeration input that will be converted to string.
!*/
Object In $Input 1
Body SysBody
Attr TypeRef = "pwrs:Type-$Int32"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_RTVIRTUAL
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_NOREMOVE
Attr GraphName = "In"
EndBody
EndObject
!/**
! Enumeration type id, eg pwrb:Type-PIDModeEnum.
!*/
Object TypeId $Intern 2
Body SysBody
Attr TypeRef = "pwrs:Type-$TypeId"
EndBody
EndObject
!/**
! Pointer to the enum definition.
!*/
Object EnumDefP $Intern 3
Body SysBody
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_PRIVATE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Size of enum definition.
!*/
Object EnumDefRows $Intern 4
Body SysBody
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
!/**
! Output that contains the string.
!*/
Object ActVal $Output 5
Body SysBody
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$String80"
Attr GraphName = "Val"
EndBody
EndObject
EndObject
Object DevBody $ObjBodyDef 2
Object PlcNode $Buffer 1
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] = 3
Attr parameters[2] = 1
Attr parameters[3] = 0
Attr subwindows = 0
Attr graphmethod = 1
Attr graphindex = 0
Attr default_mask[0] = 1
Attr default_mask[1] = 1
Attr segname_annotation = 1
Attr compmethod = 35
Attr compindex = 0
Attr tracemethod = 0
Attr traceindex = 0
Attr executeordermethod = 2
Attr objname = "EnumToStr"
Attr graphname = "EnumToStr"
EndBody
EndObject
Object Template EnumToStr
Body RtBody
EndBody
EndObject
EndObject
EndSObject
wb/exp/wb/src/pwr_wb_palette.cnf
View file @
269cd605
...
...
@@ -874,6 +874,7 @@ palette PlcEditorPalette
class DtoEnum
class DtoStr
class EnumToD
class EnumToStr
class Float64ToA
class Gray
class Int64toI
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment