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
a6ad2f21
Commit
a6ad2f21
authored
May 28, 2008
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New crossreference lists
parent
4a1219fd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
607 additions
and
0 deletions
+607
-0
wb/lib/wb/src/wb_crrgen.cpp
wb/lib/wb/src/wb_crrgen.cpp
+563
-0
wb/lib/wb/src/wb_crrgen.h
wb/lib/wb/src/wb_crrgen.h
+44
-0
No files found.
wb/lib/wb/src/wb_crrgen.cpp
0 → 100644
View file @
a6ad2f21
/*
* Proview $Id: wb_crrgen.cpp,v 1.1 2008-05-28 11:53:47 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.
**/
#include "pwr_baseclasses.h"
#include "wb_crrgen.h"
#include "flow_ctx.h"
#include "co_dcli.h"
#include "wb_utl.h"
#include "wb_vldh.h"
#include "glow_ctx.h"
#include "glow_growctx.h"
#include "glow_growapi.h"
#include "ge_dyn.h"
typedef
enum
{
crrgen_eType_
,
crrgen_eType_Write
,
crrgen_eType_Read
,
crrgen_eType_Ref
}
crrgen_eType
;
typedef
enum
{
crrgen_eTable_
,
crrgen_eTable_Object
,
crrgen_eTable_Signal
}
crrgen_eTable
;
typedef
struct
sCrrKey
{
pwr_tAttrRef
target
;
pwr_tAttrRef
reference
;
crrgen_eType
type
;
}
sArefKey
;
typedef
struct
sCrr
{
tree_sNode
node
;
sCrrKey
key
;
}
sCrr
;
typedef
struct
{
pwr_tCid
cid
;
pwr_tObjName
body
;
pwr_tObjName
attr
;
crrgen_eType
type
;
crrgen_eTable
table
;
}
crrgen_tRefList
;
static
crrgen_tRefList
reflist
[]
=
{
{
pwr_cClass_plc
,
"DevBody"
,
"ResetObject"
,
crrgen_eType_Read
,
crrgen_eTable_Signal
},
{
pwr_cClass_resdv
,
"DevBody"
,
"DvObject"
,
crrgen_eType_Write
,
crrgen_eTable_Signal
},
{
pwr_cClass_setdv
,
"DevBody"
,
"DvObject"
,
crrgen_eType_Write
,
crrgen_eTable_Signal
},
{
pwr_cClass_stodv
,
"DevBody"
,
"DvObject"
,
crrgen_eType_Write
,
crrgen_eTable_Signal
},
{
pwr_cClass_GetDv
,
"DevBody"
,
"DvObject"
,
crrgen_eType_Read
,
crrgen_eTable_Signal
},
{
pwr_cClass_GetDo
,
"DevBody"
,
"DoObject"
,
crrgen_eType_Read
,
crrgen_eTable_Signal
},
{
pwr_cClass_resdo
,
"DevBody"
,
"DoObject"
,
crrgen_eType_Write
,
crrgen_eTable_Signal
},
{
pwr_cClass_setdo
,
"DevBody"
,
"DoObject"
,
crrgen_eType_Write
,
crrgen_eTable_Signal
},
{
pwr_cClass_stodo
,
"DevBody"
,
"DoObject"
,
crrgen_eType_Write
,
crrgen_eTable_Signal
},
{
pwr_cClass_GetDi
,
"DevBody"
,
"DiObject"
,
crrgen_eType_Read
,
crrgen_eTable_Signal
},
{
pwr_cClass_cstoav
,
"DevBody"
,
"AvObject"
,
crrgen_eType_Write
,
crrgen_eTable_Signal
},
{
pwr_cClass_GetAv
,
"DevBody"
,
"AvObject"
,
crrgen_eType_Read
,
crrgen_eTable_Signal
},
{
pwr_cClass_stoav
,
"DevBody"
,
"AvObject"
,
crrgen_eType_Write
,
crrgen_eTable_Signal
},
{
pwr_cClass_cstoao
,
"DevBody"
,
"AoObject"
,
crrgen_eType_Write
,
crrgen_eTable_Signal
},
{
pwr_cClass_GetAo
,
"DevBody"
,
"AoObject"
,
crrgen_eType_Read
,
crrgen_eTable_Signal
},
{
pwr_cClass_stoao
,
"DevBody"
,
"AoObject"
,
crrgen_eType_Write
,
crrgen_eTable_Signal
},
{
pwr_cClass_GetAi
,
"DevBody"
,
"AiObject"
,
crrgen_eType_Read
,
crrgen_eTable_Signal
},
{
pwr_cClass_pos3p
,
"DevBody"
,
"DoOpen"
,
crrgen_eType_Write
,
crrgen_eTable_Signal
},
{
pwr_cClass_pos3p
,
"DevBody"
,
"DoClose"
,
crrgen_eType_Write
,
crrgen_eTable_Signal
},
{
pwr_cClass_inc3p
,
"DevBody"
,
"DoOpen"
,
crrgen_eType_Write
,
crrgen_eTable_Signal
},
{
pwr_cClass_inc3p
,
"DevBody"
,
"DoClose"
,
crrgen_eType_Write
,
crrgen_eTable_Signal
},
{
pwr_cClass_stodp
,
"DevBody"
,
"Object"
,
crrgen_eType_Write
,
crrgen_eTable_Object
},
{
pwr_cClass_setdp
,
"DevBody"
,
"Object"
,
crrgen_eType_Write
,
crrgen_eTable_Object
},
{
pwr_cClass_resdp
,
"DevBody"
,
"Object"
,
crrgen_eType_Write
,
crrgen_eTable_Object
},
{
pwr_cClass_GetDp
,
"DevBody"
,
"DpObject"
,
crrgen_eType_Read
,
crrgen_eTable_Object
},
{
pwr_cClass_cstoap
,
"DevBody"
,
"Object"
,
crrgen_eType_Write
,
crrgen_eTable_Object
},
{
pwr_cClass_GetAp
,
"DevBody"
,
"ApObject"
,
crrgen_eType_Read
,
crrgen_eTable_Object
},
{
pwr_cClass_stoap
,
"DevBody"
,
"Object"
,
crrgen_eType_Write
,
crrgen_eTable_Object
},
{
pwr_cClass_CStoIp
,
"DevBody"
,
"Object"
,
crrgen_eType_Write
,
crrgen_eTable_Object
},
{
pwr_cClass_GetIp
,
"DevBody"
,
"IpObject"
,
crrgen_eType_Read
,
crrgen_eTable_Object
},
{
pwr_cClass_StoIp
,
"DevBody"
,
"Object"
,
crrgen_eType_Write
,
crrgen_eTable_Object
},
{
pwr_cClass_stoii
,
"DevBody"
,
"IiObject"
,
crrgen_eType_Write
,
crrgen_eTable_Signal
},
{
pwr_cClass_stoio
,
"DevBody"
,
"IoObject"
,
crrgen_eType_Write
,
crrgen_eTable_Signal
},
{
pwr_cClass_stoiv
,
"DevBody"
,
"IvObject"
,
crrgen_eType_Write
,
crrgen_eTable_Signal
},
{
pwr_cClass_cstoii
,
"DevBody"
,
"IiObject"
,
crrgen_eType_Write
,
crrgen_eTable_Signal
},
{
pwr_cClass_cstoio
,
"DevBody"
,
"IoObject"
,
crrgen_eType_Write
,
crrgen_eTable_Signal
},
{
pwr_cClass_cstoiv
,
"DevBody"
,
"IvObject"
,
crrgen_eType_Write
,
crrgen_eTable_Signal
},
{
pwr_cClass_GetIi
,
"DevBody"
,
"IiObject"
,
crrgen_eType_Read
,
crrgen_eTable_Signal
},
{
pwr_cClass_GetIo
,
"DevBody"
,
"IoObject"
,
crrgen_eType_Read
,
crrgen_eTable_Signal
},
{
pwr_cClass_GetIv
,
"DevBody"
,
"IvObject"
,
crrgen_eType_Read
,
crrgen_eTable_Signal
},
{
pwr_cClass_reset_so
,
"DevBody"
,
"OrderObject"
,
crrgen_eType_Read
,
crrgen_eTable_Object
},
{
pwr_cClass_GetData
,
"DevBody"
,
"DataObject"
,
crrgen_eType_Ref
,
crrgen_eTable_Object
}};
static
crrgen_tRefList
codelist
[]
=
{
{
pwr_cClass_dataarithm
,
"DevBody"
,
"Code"
,
crrgen_eType_
,
crrgen_eTable_
},
{
pwr_cClass_carithm
,
"DevBody"
,
"Code"
,
crrgen_eType_
,
crrgen_eTable_
},
{
pwr_cClass_aarithm
,
"DevBody"
,
"Expression"
,
crrgen_eType_
,
crrgen_eTable_
},
{
pwr_cClass_darithm
,
"DevBody"
,
"Expression"
,
crrgen_eType_
,
crrgen_eTable_
}};
static
int
comp_crr
(
tree_sTable
*
tp
,
tree_sNode
*
x
,
tree_sNode
*
y
);
static
int
comp_crr
(
tree_sTable
*
tp
,
tree_sNode
*
x
,
tree_sNode
*
y
)
{
sCrr
*
xp
=
(
sCrr
*
)
x
;
sCrr
*
yp
=
(
sCrr
*
)
y
;
if
(
xp
->
key
.
target
.
Objid
.
vid
>
yp
->
key
.
target
.
Objid
.
vid
)
return
1
;
if
(
xp
->
key
.
target
.
Objid
.
vid
<
yp
->
key
.
target
.
Objid
.
vid
)
return
-
1
;
if
(
xp
->
key
.
target
.
Objid
.
oix
>
yp
->
key
.
target
.
Objid
.
oix
)
return
1
;
if
(
xp
->
key
.
target
.
Objid
.
oix
<
yp
->
key
.
target
.
Objid
.
oix
)
return
-
1
;
if
(
xp
->
key
.
target
.
Body
>
yp
->
key
.
target
.
Body
)
return
1
;
if
(
xp
->
key
.
target
.
Body
<
yp
->
key
.
target
.
Body
)
return
-
1
;
if
(
xp
->
key
.
target
.
Offset
>
yp
->
key
.
target
.
Offset
)
return
1
;
if
(
xp
->
key
.
target
.
Offset
<
yp
->
key
.
target
.
Offset
)
return
-
1
;
if
(
xp
->
key
.
target
.
Size
>
yp
->
key
.
target
.
Size
)
return
1
;
if
(
xp
->
key
.
target
.
Size
<
yp
->
key
.
target
.
Size
)
return
-
1
;
if
(
xp
->
key
.
type
>
yp
->
key
.
type
)
return
1
;
if
(
xp
->
key
.
type
<
yp
->
key
.
type
)
return
1
;
if
(
xp
->
key
.
reference
.
Objid
.
vid
>
yp
->
key
.
reference
.
Objid
.
vid
)
return
1
;
if
(
xp
->
key
.
reference
.
Objid
.
oix
>
yp
->
key
.
reference
.
Objid
.
oix
)
return
1
;
if
(
xp
->
key
.
reference
.
Objid
.
vid
<
yp
->
key
.
reference
.
Objid
.
vid
)
return
-
1
;
if
(
xp
->
key
.
reference
.
Objid
.
oix
<
yp
->
key
.
reference
.
Objid
.
oix
)
return
-
1
;
if
(
xp
->
key
.
reference
.
Body
>
yp
->
key
.
reference
.
Body
)
return
1
;
if
(
xp
->
key
.
reference
.
Body
<
yp
->
key
.
reference
.
Body
)
return
-
1
;
if
(
xp
->
key
.
reference
.
Offset
>
yp
->
key
.
reference
.
Offset
)
return
1
;
if
(
xp
->
key
.
reference
.
Offset
<
yp
->
key
.
reference
.
Offset
)
return
-
1
;
if
(
xp
->
key
.
reference
.
Size
>
yp
->
key
.
reference
.
Size
)
return
1
;
if
(
xp
->
key
.
reference
.
Size
<
yp
->
key
.
reference
.
Size
)
return
-
1
;
return
0
;
}
wb_crrgen
::
wb_crrgen
(
wb_session
*
sp
)
:
m_sp
(
sp
)
{
pwr_tStatus
sts
;
m_object_th
=
tree_CreateTable
(
&
sts
,
sizeof
(
sCrrKey
),
offsetof
(
sCrr
,
key
),
sizeof
(
sCrr
),
1000
,
comp_crr
);
m_signal_th
=
tree_CreateTable
(
&
sts
,
sizeof
(
sCrrKey
),
offsetof
(
sCrr
,
key
),
sizeof
(
sCrr
),
1000
,
comp_crr
);
}
wb_crrgen
::~
wb_crrgen
()
{
pwr_tStatus
sts
;
tree_DeleteTable
(
&
sts
,
m_object_th
);
tree_DeleteTable
(
&
sts
,
m_signal_th
);
}
void
wb_crrgen
::
load
(
pwr_tStatus
*
rsts
)
{
pwr_tStatus
sts
;
for
(
int
i
=
0
;
i
<
int
(
sizeof
(
reflist
)
/
sizeof
(
reflist
[
0
]));
i
++
)
{
for
(
wb_object
o
=
m_sp
->
object
(
reflist
[
i
].
cid
);
o
;
o
=
o
.
next
())
{
pwr_tAttrRef
aref
;
wb_attribute
a
=
m_sp
->
attribute
(
o
.
oid
(),
reflist
[
i
].
body
,
reflist
[
i
].
attr
);
a
.
value
(
&
aref
);
if
(
cdh_ObjidIsNotNull
(
aref
.
Objid
))
{
sCrrKey
key
;
wb_utl
::
utl_replace_symbol
(
(
ldh_tSesContext
)
m_sp
,
o
.
oid
(),
&
aref
);
key
.
target
=
aref
;
key
.
reference
=
cdh_ObjidToAref
(
o
.
oid
());
key
.
type
=
reflist
[
i
].
type
;
switch
(
reflist
[
i
].
table
)
{
case
crrgen_eTable_Signal
:
tree_Insert
(
&
sts
,
m_signal_th
,
&
key
);
break
;
case
crrgen_eTable_Object
:
tree_Insert
(
&
sts
,
m_object_th
,
&
key
);
break
;
default:
;
}
}
}
}
// Ge references
for
(
wb_object
o
=
m_sp
->
object
(
pwr_cClass_XttGraph
);
o
;
o
=
o
.
next
())
{
pwr_tString80
action
;
pwr_tFileName
fname
;
char
line
[
512
];
char
linep
[
2
][
512
];
int
tag
;
int
nr
;
char
*
s
;
wb_attribute
a
=
m_sp
->
attribute
(
o
.
oid
(),
"RtBody"
,
"Action"
);
a
.
value
(
action
);
if
(
strstr
(
action
,
".pwg"
))
{
sprintf
(
fname
,
"$pwrp_exe/%s"
,
action
);
dcli_translate_filename
(
fname
,
fname
);
ifstream
fpg
(
fname
);
if
(
!
fpg
)
continue
;
while
(
fpg
.
getline
(
line
,
sizeof
(
line
)))
{
nr
=
dcli_parse
(
line
,
" "
,
""
,
(
char
*
)
linep
,
sizeof
(
linep
)
/
sizeof
(
linep
[
0
]),
sizeof
(
linep
[
0
]),
0
);
if
(
nr
!=
2
)
continue
;
nr
=
sscanf
(
linep
[
0
],
"%d"
,
&
tag
);
if
(
nr
!=
1
)
continue
;
switch
(
tag
)
{
case
ge_eSave_DigLowColor_attribute
:
case
ge_eSave_DigColor_attribute
:
case
ge_eSave_DigError_attribute
:
case
ge_eSave_DigWarning_attribute
:
case
ge_eSave_Invisible_attribute
:
case
ge_eSave_DigBorder_attribute
:
case
ge_eSave_DigText_attribute
:
case
ge_eSave_ValueInput_minvalue_attr
:
case
ge_eSave_ValueInput_maxvalue_attr
:
case
ge_eSave_Rotate_attribute
:
case
ge_eSave_Move_move_x_attribute
:
case
ge_eSave_Move_move_y_attribute
:
case
ge_eSave_Move_scale_x_attribute
:
case
ge_eSave_Move_scale_y_attribute
:
case
ge_eSave_AnalogShift_attribute
:
case
ge_eSave_DigShift_attribute
:
case
ge_eSave_Animation_attribute
:
case
ge_eSave_Bar_attribute
:
case
ge_eSave_Bar_minvalue_attr
:
case
ge_eSave_Bar_maxvalue_attr
:
case
ge_eSave_Trend_attribute1
:
case
ge_eSave_Trend_attribute2
:
case
ge_eSave_Trend_minvalue_attr1
:
case
ge_eSave_Trend_maxvalue_attr1
:
case
ge_eSave_Trend_minvalue_attr2
:
case
ge_eSave_Trend_maxvalue_attr2
:
case
ge_eSave_DigFlash_attribute
:
case
ge_eSave_FillLevel_attribute
:
case
ge_eSave_FillLevel_minvalue_attr
:
case
ge_eSave_FillLevel_maxvalue_attr
:
case
ge_eSave_Table_attribute1
:
case
ge_eSave_Table_sel_attribute1
:
case
ge_eSave_StatusColor_attribute
:
case
ge_eSave_DigSound_attribute
:
case
ge_eSave_XY_Curve_x_attr
:
case
ge_eSave_XY_Curve_y_attr
:
case
ge_eSave_XY_Curve_y_minvalue_attr
:
case
ge_eSave_XY_Curve_y_maxvalue_attr
:
case
ge_eSave_XY_Curve_x_minvalue_attr
:
case
ge_eSave_XY_Curve_x_maxvalue_attr
:
case
ge_eSave_DigCommand_attribute
:
case
ge_eSave_Slider_minvalue_attr
:
case
ge_eSave_Slider_maxvalue_attr
:
case
ge_eSave_Slider_insensitive_attr
:
case
ge_eSave_AnalogColor_attribute
:
case
ge_eSave_DigSound_soundobject
:
case
ge_eSave_PopupMenu_ref_object
:
{
if
(
(
s
=
strchr
(
linep
[
1
],
'#'
)))
*
s
=
0
;
if
(
linep
[
1
][
0
]
==
'!'
)
strcpy
(
&
linep
[
1
][
0
],
&
linep
[
1
][
1
]);
wb_attribute
al
=
m_sp
->
attribute
(
linep
[
1
]);
if
(
!
al
)
break
;
int
len
=
strlen
(
linep
[
1
]);
if
(
len
>
12
&&
cdh_NoCaseStrcmp
(
&
linep
[
1
][
len
-
12
],
".ActualValue"
)
==
0
)
{
linep
[
1
][
len
-
12
]
=
0
;
al
=
m_sp
->
attribute
(
linep
[
1
]);
if
(
!
al
)
break
;
}
switch
(
al
.
tid
())
{
case
pwr_cClass_Di
:
case
pwr_cClass_Do
:
case
pwr_cClass_Dv
:
case
pwr_cClass_Ai
:
case
pwr_cClass_Ao
:
case
pwr_cClass_Av
:
case
pwr_cClass_Ii
:
case
pwr_cClass_Io
:
case
pwr_cClass_Iv
:
case
pwr_cClass_Co
:
{
sCrrKey
key
;
key
.
target
=
al
.
aref
();
key
.
reference
=
cdh_ObjidToAref
(
o
.
oid
());
key
.
type
=
crrgen_eType_Read
;
tree_Insert
(
&
sts
,
m_signal_th
,
&
key
);
break
;
}
default:
{
sCrrKey
key
;
key
.
target
=
al
.
aref
();
key
.
reference
=
cdh_ObjidToAref
(
o
.
oid
());
key
.
type
=
crrgen_eType_Read
;
tree_Insert
(
&
sts
,
m_object_th
,
&
key
);
}
}
break
;
}
case
ge_eSave_Value_attribute
:
case
ge_eSave_SetDig_attribute
:
case
ge_eSave_ResetDig_attribute
:
case
ge_eSave_ToggleDig_attribute
:
case
ge_eSave_StoDig_attribute
:
case
ge_eSave_IncrAnalog_attribute
:
case
ge_eSave_RadioButton_attribute
:
case
ge_eSave_Slider_attribute
:
case
ge_eSave_OptionMenu_attribute
:
{
if
(
(
s
=
strchr
(
linep
[
1
],
'#'
)))
*
s
=
0
;
if
(
linep
[
1
][
0
]
==
'!'
)
strcpy
(
&
linep
[
1
][
0
],
&
linep
[
1
][
1
]);
wb_attribute
al
=
m_sp
->
attribute
(
linep
[
1
]);
if
(
!
al
)
break
;
int
len
=
strlen
(
linep
[
1
]);
if
(
len
>
12
&&
cdh_NoCaseStrcmp
(
&
linep
[
1
][
len
-
12
],
".ActualValue"
)
==
0
)
{
linep
[
1
][
len
-
12
]
=
0
;
al
=
m_sp
->
attribute
(
linep
[
1
]);
if
(
!
al
)
break
;
}
switch
(
al
.
tid
())
{
case
pwr_cClass_Di
:
case
pwr_cClass_Do
:
case
pwr_cClass_Dv
:
case
pwr_cClass_Ai
:
case
pwr_cClass_Ao
:
case
pwr_cClass_Av
:
case
pwr_cClass_Ii
:
case
pwr_cClass_Io
:
case
pwr_cClass_Iv
:
case
pwr_cClass_Co
:
{
sCrrKey
key
;
key
.
target
=
al
.
aref
();
key
.
reference
=
cdh_ObjidToAref
(
o
.
oid
());
key
.
type
=
crrgen_eType_Write
;
tree_Insert
(
&
sts
,
m_signal_th
,
&
key
);
break
;
}
default:
{
sCrrKey
key
;
key
.
target
=
al
.
aref
();
key
.
reference
=
cdh_ObjidToAref
(
o
.
oid
());
key
.
type
=
crrgen_eType_Write
;
tree_Insert
(
&
sts
,
m_object_th
,
&
key
);
}
}
break
;
}
default:
;
}
}
fpg
.
close
();
}
}
*
rsts
=
1
;
}
void
wb_crrgen
::
write
(
pwr_tStatus
*
rsts
)
{
pwr_tStatus
sts
;
char
type_char
;
pwr_tAttrRef
prev_target
;
pwr_tFileName
fname
;
memset
(
&
prev_target
,
0
,
sizeof
(
prev_target
));
sprintf
(
fname
,
"$pwrp_load/rtt_crr_%s.dat"
,
vldh_VolumeIdToStr
(
m_sp
->
vid
()));
dcli_translate_filename
(
fname
,
fname
);
ofstream
fps
(
fname
);
if
(
!
fps
)
{
*
rsts
=
LDH__FILEOPEN
;
return
;
}
sCrr
*
crr
=
(
sCrr
*
)
tree_Minimum
(
&
sts
,
m_signal_th
);
while
(
crr
)
{
wb_attribute
a_target
=
m_sp
->
attribute
(
&
crr
->
key
.
target
);
wb_object
o
=
m_sp
->
object
(
crr
->
key
.
reference
.
Objid
);
wb_cdef
cdef
=
m_sp
->
cdef
(
o
.
cid
());
if
(
!
(
crr
->
key
.
target
.
Objid
.
vid
==
prev_target
.
Objid
.
vid
&&
crr
->
key
.
target
.
Objid
.
oix
==
prev_target
.
Objid
.
oix
&&
crr
->
key
.
target
.
Offset
==
prev_target
.
Offset
&&
crr
->
key
.
target
.
Size
==
prev_target
.
Size
))
fps
<<
a_target
.
longName
().
c_str
()
<<
endl
;
switch
(
crr
->
key
.
type
)
{
case
crrgen_eType_Write
:
type_char
=
'W'
;
break
;
case
crrgen_eType_Read
:
type_char
=
'R'
;
break
;
case
crrgen_eType_Ref
:
type_char
=
'>'
;
break
;
default:
;
}
fps
<<
" "
<<
type_char
<<
" "
<<
o
.
longName
().
name
(
cdh_mName_path
|
cdh_mName_attribute
)
<<
" "
<<
cdef
.
name
()
<<
endl
;
memcpy
(
&
prev_target
,
&
crr
->
key
.
target
,
sizeof
(
prev_target
));
crr
=
(
sCrr
*
)
tree_Successor
(
&
sts
,
m_signal_th
,
crr
);
}
fps
.
close
();
sprintf
(
fname
,
"$pwrp_load/rtt_crro_%s.dat"
,
vldh_VolumeIdToStr
(
m_sp
->
vid
()));
dcli_translate_filename
(
fname
,
fname
);
ofstream
fpo
(
fname
);
if
(
!
fpo
)
{
*
rsts
=
LDH__FILEOPEN
;
return
;
}
memset
(
&
prev_target
,
0
,
sizeof
(
prev_target
));
crr
=
(
sCrr
*
)
tree_Minimum
(
&
sts
,
m_object_th
);
while
(
crr
)
{
wb_attribute
a_target
=
m_sp
->
attribute
(
&
crr
->
key
.
target
);
wb_object
o
=
m_sp
->
object
(
crr
->
key
.
reference
.
Objid
);
wb_cdef
cdef
=
m_sp
->
cdef
(
o
.
cid
());
if
(
!
(
crr
->
key
.
target
.
Objid
.
vid
==
prev_target
.
Objid
.
vid
&&
crr
->
key
.
target
.
Objid
.
oix
==
prev_target
.
Objid
.
oix
&&
crr
->
key
.
target
.
Offset
==
prev_target
.
Offset
&&
crr
->
key
.
target
.
Size
==
prev_target
.
Size
))
fpo
<<
a_target
.
longName
().
c_str
()
<<
endl
;
switch
(
crr
->
key
.
type
)
{
case
crrgen_eType_Write
:
type_char
=
'W'
;
break
;
case
crrgen_eType_Read
:
type_char
=
'R'
;
break
;
case
crrgen_eType_Ref
:
type_char
=
'>'
;
break
;
default:
;
}
fpo
<<
" "
<<
type_char
<<
" "
<<
o
.
longName
().
name
(
cdh_mName_path
|
cdh_mName_attribute
)
<<
" "
<<
cdef
.
name
()
<<
endl
;
memcpy
(
&
prev_target
,
&
crr
->
key
.
target
,
sizeof
(
prev_target
));
crr
=
(
sCrr
*
)
tree_Successor
(
&
sts
,
m_object_th
,
crr
);
}
fpo
.
close
();
*
rsts
=
1
;
}
void
wb_crrgen
::
write_code
(
pwr_tStatus
*
rsts
)
{
pwr_tFileName
fname
;
char
text
[
1024
];
sprintf
(
fname
,
"$pwrp_load/rtt_crrc_%s.dat"
,
vldh_VolumeIdToStr
(
m_sp
->
vid
()));
dcli_translate_filename
(
fname
,
fname
);
ofstream
fpc
(
fname
);
if
(
!
fpc
)
{
*
rsts
=
LDH__FILEOPEN
;
return
;
}
for
(
int
i
=
0
;
i
<
int
(
sizeof
(
codelist
)
/
sizeof
(
codelist
[
0
]));
i
++
)
{
for
(
wb_object
o
=
m_sp
->
object
(
codelist
[
i
].
cid
);
o
;
o
=
o
.
next
())
{
wb_attribute
a
=
m_sp
->
attribute
(
o
.
oid
(),
codelist
[
i
].
body
,
codelist
[
i
].
attr
);
a
.
value
(
text
);
if
(
strcmp
(
text
,
""
)
!=
0
)
{
fpc
<<
" _Obj_ "
<<
o
.
longName
().
c_str
()
<<
endl
;
fpc
<<
text
<<
endl
;
}
}
}
fpc
.
close
();
*
rsts
=
1
;
}
wb/lib/wb/src/wb_crrgen.h
0 → 100644
View file @
a6ad2f21
/*
* Proview $Id: wb_crrgen.h,v 1.1 2008-05-28 11:53:47 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.
**/
#ifndef wb_crrgen_h
#define wb_crrgen_h
#include <iostream.h>
#include "pwr.h"
#include "pwr_class.h"
#include "co_wow.h"
#include "co_tree.h"
#include "wb_session.h"
class
wb_crrgen
{
protected:
wb_session
*
m_sp
;
tree_sTable
*
m_signal_th
;
tree_sTable
*
m_object_th
;
public:
wb_crrgen
(
wb_session
*
sp
);
~
wb_crrgen
();
void
load
(
pwr_tStatus
*
sts
);
void
write
(
pwr_tStatus
*
sts
);
void
write_code
(
pwr_tStatus
*
rsts
);
};
#endif
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