Commit 3f561ce6 authored by Claes Sjofors's avatar Claes Sjofors

Functionobject EnumToStr added

parent a792d6c2
...@@ -492,3 +492,34 @@ void EnumToStr_exec( plc_sThread *tp, ...@@ -492,3 +492,34 @@ void EnumToStr_exec( plc_sThread *tp,
strcpy( o->ActVal, ""); strcpy( o->ActVal, "");
} }
/*_*
STRTOENUM
@aref strtoenum STRTOENUM
*/
void StrToEnum_init( pwr_sClass_StrToEnum *o)
{
if ( EVEN( gdh_GetEnumValueDef( o->TypeId, (gdh_sValueDef **)&o->EnumDefP, (int *)&o->EnumDefRows)))
o->EnumDefP = 0;
}
void StrToEnum_exec( plc_sThread *tp,
pwr_sClass_StrToEnum *o)
{
int i;
int found = 0;
if ( !o->EnumDefP)
return;
for ( i = 0; i < o->EnumDefRows; i++) {
if ( strcmp( (char *)o->StrP, ((gdh_sValueDef *)o->EnumDefP)[i].Value->Text) == 0) {
o->ActVal = ((gdh_sValueDef *)o->EnumDefP)[i].Value->Value;
found = 1;
break;
}
}
if ( !found)
o->ActVal = 0;
}
...@@ -91,7 +91,7 @@ SObject pwrb:Class ...@@ -91,7 +91,7 @@ SObject pwrb:Class
Attr Flags |= PWR_MASK_POINTER Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_PRIVATE Attr Flags |= PWR_MASK_PRIVATE
Attr Flags |= PWR_MASK_STATE Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT Attr Flags |= PWR_MASK_INVISIBLE
Attr TypeRef = "pwrs:Type-$Float32" Attr TypeRef = "pwrs:Type-$Float32"
EndBody EndBody
EndObject EndObject
...@@ -101,7 +101,7 @@ SObject pwrb:Class ...@@ -101,7 +101,7 @@ SObject pwrb:Class
Object EnumDefRows $Intern 4 Object EnumDefRows $Intern 4
Body SysBody Body SysBody
Attr Flags |= PWR_MASK_STATE Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT Attr Flags |= PWR_MASK_INVISIBLE
Attr TypeRef = "pwrs:Type-$UInt32" Attr TypeRef = "pwrs:Type-$UInt32"
EndBody EndBody
EndObject EndObject
......
...@@ -338,6 +338,7 @@ palette NavigatorPalette ...@@ -338,6 +338,7 @@ palette NavigatorPalette
{ {
class OneWire class OneWire
class OneWire_AiDevice class OneWire_AiDevice
class OneWire_AoDevice
class Maxim_DS18B20 class Maxim_DS18B20
} }
menu SPI menu SPI
...@@ -381,6 +382,7 @@ palette NavigatorPalette ...@@ -381,6 +382,7 @@ palette NavigatorPalette
class RemnodeTCP class RemnodeTCP
class RemnodeUDP class RemnodeUDP
class Remnode3964R class Remnode3964R
class RemnodeRK512
class RemTrans class RemTrans
menu Buffers menu Buffers
{ {
...@@ -922,6 +924,7 @@ palette PlcEditorPalette ...@@ -922,6 +924,7 @@ palette PlcEditorPalette
class ItoUInt64 class ItoUInt64
class MaskToD class MaskToD
class NameToStr class NameToStr
class StrToEnum
class UInt64toI class UInt64toI
class UInt32toI class UInt32toI
} }
......
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