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
34db3b87
Commit
34db3b87
authored
Aug 29, 2012
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Classeditor check that StructName and PgmName is unique (refs #76)
parent
9b4de8cc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
102 additions
and
0 deletions
+102
-0
wb/lib/wb/src/wb_vrepmem.cpp
wb/lib/wb/src/wb_vrepmem.cpp
+101
-0
wb/lib/wb/src/wb_vrepmem.h
wb/lib/wb/src/wb_vrepmem.h
+1
-0
No files found.
wb/lib/wb/src/wb_vrepmem.cpp
View file @
34db3b87
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
#include <iostream>
#include <iostream>
#include <fstream>
#include <fstream>
#include <string>
#include <sys/stat.h>
#include <sys/stat.h>
#include "wb_vrepmem.h"
#include "wb_vrepmem.h"
...
@@ -1948,6 +1949,7 @@ bool wb_vrepmem::commit(pwr_tStatus *sts)
...
@@ -1948,6 +1949,7 @@ bool wb_vrepmem::commit(pwr_tStatus *sts)
pwr_tCmd
cmd
;
pwr_tCmd
cmd
;
if
(
m_classeditor
)
{
if
(
m_classeditor
)
{
classeditorCheckCommit
();
classeditorCommit
();
classeditorCommit
();
}
}
...
@@ -2094,6 +2096,105 @@ void wb_vrepmem::classeditorDeleteObject( mem_object *memo)
...
@@ -2094,6 +2096,105 @@ void wb_vrepmem::classeditorDeleteObject( mem_object *memo)
}
}
}
}
void
wb_vrepmem
::
classeditorCheckCommit
()
{
vector
<
string
>
rtbody_vect
;
vector
<
string
>
devbody_vect
;
mem_object
*
class_hier
;
for
(
class_hier
=
root_object
;
class_hier
&&
class_hier
->
m_cid
!=
pwr_eClass_ClassHier
;
class_hier
=
class_hier
->
fws
)
;
if
(
!
class_hier
||
class_hier
->
m_cid
!=
pwr_eClass_ClassHier
)
return
;
// Check that RtBody.StructName is unique
for
(
mem_object
*
o1
=
class_hier
->
fch
;
o1
;
o1
=
o1
->
fws
)
{
for
(
mem_object
*
o2
=
o1
->
fch
;
o2
;
o2
=
o2
->
fws
)
{
switch
(
o2
->
m_cid
)
{
case
pwr_eClass_ObjBodyDef
:
if
(
strcmp
(
o2
->
name
(),
"RtBody"
)
==
0
)
{
int
found
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
rtbody_vect
.
size
();
i
++
)
{
if
(
strcmp
(
rtbody_vect
[
i
].
c_str
(),
((
pwr_sObjBodyDef
*
)
o2
->
rbody
)
->
StructName
)
==
0
)
{
found
=
1
;
char
str
[
400
];
sprintf
(
str
,
"%s.RtBody.StructName
\"
%s
\"
already used in this volume"
,
o1
->
name
(),
rtbody_vect
[
i
].
c_str
());
MsgWindow
::
message
(
'E'
,
str
,
msgw_ePop_Yes
);
break
;
}
}
if
(
!
found
)
{
string
str
(((
pwr_sObjBodyDef
*
)
o2
->
rbody
)
->
StructName
);
rtbody_vect
.
push_back
(
str
);
}
}
else
if
(
strcmp
(
o2
->
name
(),
"DevBody"
)
==
0
)
{
int
found
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
devbody_vect
.
size
();
i
++
)
{
if
(
strcmp
(
devbody_vect
[
i
].
c_str
(),
((
pwr_sObjBodyDef
*
)
o2
->
rbody
)
->
StructName
)
==
0
)
{
found
=
1
;
char
str
[
400
];
sprintf
(
str
,
"%s.DevBody.StructName
\"
%s
\"
already used in this volume"
,
o1
->
name
(),
devbody_vect
[
i
].
c_str
());
MsgWindow
::
message
(
'E'
,
str
,
msgw_ePop_Yes
);
break
;
}
}
if
(
!
found
)
{
string
str
(((
pwr_sObjBodyDef
*
)
o2
->
rbody
)
->
StructName
);
devbody_vect
.
push_back
(
str
);
}
}
default:
;
}
}
}
// Check that Attribute.PgmName is unique within one class
for
(
mem_object
*
o1
=
class_hier
->
fch
;
o1
;
o1
=
o1
->
fws
)
{
vector
<
string
>
pgmname_vect
;
for
(
mem_object
*
o2
=
o1
->
fch
;
o2
;
o2
=
o2
->
fws
)
{
switch
(
o2
->
m_cid
)
{
case
pwr_eClass_ObjBodyDef
:
for
(
mem_object
*
o3
=
o2
->
fch
;
o3
;
o3
=
o3
->
fws
)
{
switch
(
o3
->
m_cid
)
{
case
pwr_eClass_Param
:
case
pwr_eClass_Input
:
case
pwr_eClass_Output
:
case
pwr_eClass_Intern
:
case
pwr_eClass_Buffer
:
case
pwr_eClass_ObjXRef
:
case
pwr_eClass_AttrXRef
:
{
int
found
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
pgmname_vect
.
size
();
i
++
)
{
if
(
strcmp
(
pgmname_vect
[
i
].
c_str
(),
((
pwr_sParam
*
)
o3
->
rbody
)
->
Info
.
PgmName
)
==
0
)
{
found
=
1
;
char
str
[
400
];
sprintf
(
str
,
"%s-%s-%s.PgmName
\"
%s
\"
already used in this class"
,
o1
->
name
(),
o2
->
name
(),
o3
->
name
(),
pgmname_vect
[
i
].
c_str
());
MsgWindow
::
message
(
'E'
,
str
,
msgw_ePop_Yes
);
break
;
}
}
if
(
!
found
)
{
string
str
(((
pwr_sParam
*
)
o3
->
rbody
)
->
Info
.
PgmName
);
pgmname_vect
.
push_back
(
str
);
}
break
;
}
default:
;
}
}
default:
;
}
}
}
}
bool
wb_vrepmem
::
classeditorCheck
(
ldh_eDest
dest_code
,
mem_object
*
dest
,
pwr_tCid
cid
,
bool
wb_vrepmem
::
classeditorCheck
(
ldh_eDest
dest_code
,
mem_object
*
dest
,
pwr_tCid
cid
,
pwr_tOix
*
oix
,
char
*
name
,
pwr_tStatus
*
sts
,
pwr_tOix
*
oix
,
char
*
name
,
pwr_tStatus
*
sts
,
bool
import_paste
)
bool
import_paste
)
...
...
wb/lib/wb/src/wb_vrepmem.h
View file @
34db3b87
...
@@ -422,6 +422,7 @@ public:
...
@@ -422,6 +422,7 @@ public:
void
classeditorRenameObject
(
mem_object
*
memo
,
char
*
oldname
,
void
classeditorRenameObject
(
mem_object
*
memo
,
char
*
oldname
,
wb_name
&
name
);
wb_name
&
name
);
void
classeditorDeleteObject
(
mem_object
*
memo
);
void
classeditorDeleteObject
(
mem_object
*
memo
);
void
classeditorCheckCommit
();
private:
private:
bool
nameCheck
(
mem_object
*
memo
);
bool
nameCheck
(
mem_object
*
memo
);
...
...
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