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
a63ab463
Commit
a63ab463
authored
Dec 21, 2007
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Conversion to uppercase removed. Object names with more than one attribute segment works
parent
ccf93237
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
129 deletions
+56
-129
src/lib/rt/src/rt_ini_alias.c
src/lib/rt/src/rt_ini_alias.c
+56
-129
No files found.
src/lib/rt/src/rt_ini_alias.c
View file @
a63ab463
/*
* Proview $Id: rt_ini_alias.c,v 1.
5 2007-11-22 15:10:23
claes Exp $
* Proview $Id: rt_ini_alias.c,v 1.
6 2007-12-21 13:31:08
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -216,7 +216,7 @@ ini_SetAttribute (
value_ptr
=
data_ptr
;
value_ptr
++
;
if
(
s
trcmp
(
(
char
*
)
attribute_ptr
,
"PLCSCAN"
)
==
0
)
if
(
cdh_NoCaseS
trcmp
(
(
char
*
)
attribute_ptr
,
"PLCSCAN"
)
==
0
)
{
sts
=
ini_set_plcscan
((
char
*
)
value_ptr
);
if
(
EVEN
(
sts
))
...
...
@@ -230,9 +230,9 @@ ini_SetAttribute (
else
errh_Info
(
"attribute '%s' set to '%s'"
,
(
char
*
)
attribute_ptr
,
(
char
*
)
value_ptr
);
}
else
if
(
s
trcmp
(
(
char
*
)
attribute_ptr
,
"PLCSIM"
)
==
0
||
s
trcmp
(
(
char
*
)
attribute_ptr
,
"ERRLOGFILE"
)
==
0
||
s
trcmp
(
(
char
*
)
attribute_ptr
,
"ERRLOGTERM"
)
==
0
)
else
if
(
cdh_NoCaseS
trcmp
(
(
char
*
)
attribute_ptr
,
"PLCSIM"
)
==
0
||
cdh_NoCaseS
trcmp
(
(
char
*
)
attribute_ptr
,
"ERRLOGFILE"
)
==
0
||
cdh_NoCaseS
trcmp
(
(
char
*
)
attribute_ptr
,
"ERRLOGTERM"
)
==
0
)
{
sts
=
ini_set_nodeattribute
(
(
char
*
)
attribute_ptr
,
(
char
*
)
value_ptr
);
...
...
@@ -334,8 +334,8 @@ static int ini_datafile_get_next( char *parameter, char **data,
cdh_ToUpper
(
param
,
parameter
);
found
=
0
;
while
(
1
)
{
while
(
1
)
{
/* Read one line */
sts
=
ini_read_line
(
line
,
sizeof
(
line
),
ini_datafile
);
if
(
EVEN
(
sts
))
...
...
@@ -345,15 +345,13 @@ static int ini_datafile_get_next( char *parameter, char **data,
/* Parse the line */
cdh_ToUpper
(
line
,
line
)
;
nr
=
ini_parse
(
line
,
"=, "
,
""
,
(
char
*
)
data_array
,
sizeof
(
data_array
)
/
sizeof
(
data_array
[
0
]),
sizeof
(
data_array
[
0
]));
if
(
nr
==
0
)
continue
;
if
(
strcmp
(
data_array
[
0
],
param
)
==
0
)
{
if
(
cdh_NoCaseStrcmp
(
data_array
[
0
],
param
)
==
0
)
{
found
=
1
;
break
;
}
...
...
@@ -553,124 +551,53 @@ static int ini_set_attribute (
char
*
value_str
)
{
/* Get type of the parameter from info in the class object */
int
sts
;
pwr_tOName
hiername
;
pwr_tOName
parname
;
pwr_tClassId
class
;
pwr_tObjid
classObject
;
pwr_sParInfo
parinfo
;
pwr_tOName
objname
;
pwr_tOName
name_array
[
2
];
int
nr
;
pwr_tObjid
objid
;
pwr_tObjid
value_objid
;
pwr_tUInt32
parameter_type
;
unsigned
long
parameter_size
;
char
buffer
[
80
];
char
*
s
;
pwr_sAttrRef
attrref
;
/* Parse the parameter name into a object and a parameter name */
nr
=
ini_parse
(
name_str
,
"."
,
""
,
name_array
[
0
],
sizeof
(
name_array
)
/
sizeof
(
name_array
[
0
]),
sizeof
(
name_array
[
0
]));
if
(
nr
!=
2
)
{
/* rtt_message( "Syntax error in name");
return RTT__HOLDCOMMAND;
*/
return
0
;
}
strcpy
(
objname
,
name_array
[
0
]);
strcpy
(
parname
,
name_array
[
1
]);
/* Get type of the parameter from info in the class object */
/* Get objid */
sts
=
gdh_NameToObjid
(
objname
,
&
objid
);
if
(
EVEN
(
sts
))
return
sts
;
/* Remove index if element in an array */
if
(
(
s
=
strrchr
(
parname
,
'['
)))
*
s
=
0
;
int
sts
;
char
buffer
[
256
];
pwr_sAttrRef
attrref
;
/* Get objid of rtbody */
sts
=
gdh_GetObjectClass
(
objid
,
&
class
);
if
(
EVEN
(
sts
))
return
sts
;
unsigned
int
asize
,
aoffs
,
aelem
;
pwr_tTid
atid
;
classObject
=
cdh_ClassIdToObjid
(
class
);
sts
=
gdh_NameToAttrref
(
pwr_cNOid
,
name_str
,
&
attrref
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
gdh_ObjidToName
(
classObject
,
hiername
,
sizeof
(
hiername
),
cdh_mName_volumeStrict
);
if
(
EVEN
(
sts
))
return
sts
;
strcat
(
hiername
,
"-RtBody-"
);
strcat
(
hiername
,
parname
);
sts
=
gdh_GetObjectInfo
(
hiername
,
&
parinfo
,
sizeof
(
parinfo
));
if
(
EVEN
(
sts
))
{
/* Try with sysbody */
sts
=
gdh_ObjidToName
(
classObject
,
hiername
,
sizeof
(
hiername
),
cdh_mName_volumeStrict
);
if
(
EVEN
(
sts
))
return
sts
;
strcat
(
hiername
,
"-SysBody-"
);
strcat
(
hiername
,
parname
);
sts
=
gdh_GetObjectInfo
(
hiername
,
&
parinfo
,
sizeof
(
parinfo
));
if
(
EVEN
(
sts
))
{
/*
rtt_message("Parameter does not exist");
return RTT__HOLDCOMMAND;
*/
return
0
;
}
}
parameter_type
=
parinfo
.
Type
;
parameter_size
=
parinfo
.
Size
;
if
(
parinfo
.
Elements
>
1
)
{
/* Check that attribute name includes index */
if
(
!
strrchr
(
name_str
,
'['
))
{
/*
rtt_message( "Attribute is an array, index is missing");
*/
return
0
;
}
parameter_size
=
parinfo
.
Size
/
parinfo
.
Elements
;
}
switch
(
parameter_type
)
{
case
pwr_eType_Objid
:
{
sts
=
gdh_NameToObjid
(
(
char
*
)
value_str
,
&
value_objid
);
if
(
EVEN
(
sts
))
return
sts
;
memcpy
(
buffer
,
&
value_objid
,
sizeof
(
value_objid
));
break
;
}
case
pwr_eType_AttrRef
:
{
sts
=
gdh_NameToAttrref
(
pwr_cNObjid
,
value_str
,
&
attrref
);
if
(
EVEN
(
sts
))
return
sts
;
memcpy
(
buffer
,
&
attrref
,
sizeof
(
attrref
));
break
;
}
default:
sts
=
cdh_StringToAttrValue
(
parameter_type
,
value_str
,
(
void
*
)
buffer
);
break
;
}
if
(
EVEN
(
sts
))
return
sts
;
sts
=
gdh_SetObjectInfo
(
name_str
,
(
void
*
)
buffer
,
parameter_size
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
gdh_GetAttributeCharAttrref
(
&
attrref
,
&
atid
,
&
asize
,
&
aoffs
,
&
aelem
);
if
(
EVEN
(
sts
))
return
sts
;
return
INI__SUCCESS
;
switch
(
atid
)
{
case
pwr_eType_Objid
:
{
pwr_tOid
oid
;
sts
=
gdh_NameToObjid
(
(
char
*
)
value_str
,
&
oid
);
if
(
EVEN
(
sts
))
return
sts
;
memcpy
(
buffer
,
&
oid
,
sizeof
(
oid
));
break
;
}
case
pwr_eType_AttrRef
:
{
pwr_tAttrRef
aref
;
sts
=
gdh_NameToAttrref
(
pwr_cNOid
,
value_str
,
&
aref
);
if
(
EVEN
(
sts
))
return
sts
;
memcpy
(
buffer
,
&
aref
,
sizeof
(
aref
));
break
;
}
default:
sts
=
cdh_StringToAttrValue
(
atid
,
value_str
,
(
void
*
)
buffer
);
break
;
}
if
(
EVEN
(
sts
))
return
sts
;
sts
=
gdh_SetObjectInfo
(
name_str
,
(
void
*
)
buffer
,
asize
/
aelem
);
if
(
EVEN
(
sts
))
return
sts
;
return
INI__SUCCESS
;
}
...
...
@@ -715,7 +642,7 @@ static int ini_set_nodeattribute (
sts
=
gdh_ObjidToPointer
(
nodeobjid
,
(
pwr_tAddress
*
)
&
nodeobjp
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
s
trcmp
(
attribute_str
,
"PLCSIM"
)
==
0
)
if
(
cdh_NoCaseS
trcmp
(
attribute_str
,
"PLCSIM"
)
==
0
)
{
/* Moved to IOHandler object */
sts
=
gdh_GetClassList
(
pwr_cClass_IOHandler
,
&
objid
);
...
...
@@ -723,7 +650,7 @@ static int ini_set_nodeattribute (
sts
=
gdh_ObjidToName
(
objid
,
nodename
,
sizeof
(
nodename
),
cdh_mNName
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
s
trcmp
(
value_str
,
"YES"
)
==
0
)
if
(
cdh_NoCaseS
trcmp
(
value_str
,
"YES"
)
==
0
)
{
strcpy
(
attributename
,
nodename
);
strcat
(
attributename
,
".IOReadWriteFlag"
);
...
...
@@ -736,7 +663,7 @@ static int ini_set_nodeattribute (
sts
=
gdh_SetObjectInfo
(
attributename
,
&
value
,
sizeof
(
value
));
if
(
EVEN
(
sts
))
return
sts
;
}
else
if
(
s
trcmp
(
value_str
,
"NO"
)
==
0
)
else
if
(
cdh_NoCaseS
trcmp
(
value_str
,
"NO"
)
==
0
)
{
strcpy
(
attributename
,
nodename
);
strcat
(
attributename
,
".IOReadWriteFlag"
);
...
...
@@ -752,7 +679,7 @@ static int ini_set_nodeattribute (
else
return
0
;
}
else
if
(
s
trcmp
(
attribute_str
,
"ERRLOGFILE"
)
==
0
)
else
if
(
cdh_NoCaseS
trcmp
(
attribute_str
,
"ERRLOGFILE"
)
==
0
)
{
strcpy
(
attributename
,
nodename
);
strcat
(
attributename
,
".ErrLogFile"
);
...
...
@@ -760,7 +687,7 @@ static int ini_set_nodeattribute (
sizeof
(
nodeobjp
->
ErrLogFile
));
if
(
EVEN
(
sts
))
return
sts
;
}
else
if
(
s
trcmp
(
attribute_str
,
"ERRLOGTERM"
)
==
0
)
else
if
(
cdh_NoCaseS
trcmp
(
attribute_str
,
"ERRLOGTERM"
)
==
0
)
{
strcpy
(
attributename
,
nodename
);
strcat
(
attributename
,
".ErrLogTerm"
);
...
...
@@ -803,7 +730,7 @@ static int ini_set_plcscan (char *value_str)
int
sts
;
pwr_tBoolean
value
;
if
(
s
trcmp
(
value_str
,
"OFF"
)
!=
0
)
if
(
cdh_NoCaseS
trcmp
(
value_str
,
"OFF"
)
!=
0
)
return
0
;
/* Get all window classes */
...
...
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