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
111ac995
Commit
111ac995
authored
Jun 10, 2014
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wb script functions GetTemplateObject() and GetNextTemplateAttrRef() added
parent
3ddb55a3
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
323 additions
and
2 deletions
+323
-2
wb/lib/wb/src/wb_ldh.cpp
wb/lib/wb/src/wb_ldh.cpp
+24
-0
wb/lib/wb/src/wb_ldh.h
wb/lib/wb/src/wb_ldh.h
+13
-0
wb/lib/wb/src/wb_merep.cpp
wb/lib/wb/src/wb_merep.cpp
+36
-0
wb/lib/wb/src/wb_volume.cpp
wb/lib/wb/src/wb_volume.cpp
+139
-2
wb/lib/wb/src/wb_volume.h
wb/lib/wb/src/wb_volume.h
+3
-0
wb/lib/wb/src/wb_vrepmem.cpp
wb/lib/wb/src/wb_vrepmem.cpp
+1
-0
wb/lib/wb/src/wb_wccm.cpp
wb/lib/wb/src/wb_wccm.cpp
+107
-0
No files found.
wb/lib/wb/src/wb_ldh.cpp
View file @
111ac995
...
...
@@ -587,6 +587,18 @@ ldh_GetClassList(ldh_tSession session, pwr_tCid cid, pwr_tOid *oid)
return
o
.
sts
();
}
pwr_tStatus
ldh_GetTemplateObject
(
ldh_tSession
session
,
pwr_tCid
cid
,
pwr_tOid
*
oid
)
{
wb_session
*
sp
=
(
wb_session
*
)
session
;
wb_object
o
=
sp
->
templateObject
(
cid
);
if
(
!
o
)
return
o
.
sts
();
*
oid
=
o
.
oid
();
return
o
.
sts
();
}
/* Returns the objid of the next object of the same class. */
pwr_tStatus
...
...
@@ -626,6 +638,18 @@ ldh_GetNextAttrRef(ldh_tSession session, pwr_tCid cid, pwr_sAttrRef *arp,
return
sp
->
sts
();
}
/* Returns the attrref of the next object of the same class. */
pwr_tStatus
ldh_GetNextTemplateAttrRef
(
ldh_tSession
session
,
pwr_tCid
cid
,
pwr_sAttrRef
*
arp
,
pwr_sAttrRef
*
new_arp
)
{
wb_session
*
sp
=
(
wb_session
*
)
session
;
sp
->
nextTemplateAref
(
cid
,
arp
,
new_arp
);
return
sp
->
sts
();
}
/* Returns the first attribute object of the specified class in
the specified object. */
...
...
wb/lib/wb/src/wb_ldh.h
View file @
111ac995
...
...
@@ -708,12 +708,25 @@ pwr_tStatus ldh_GetNextAttrRef(
pwr_sAttrRef
*
arp
,
pwr_sAttrRef
*
new_arp
);
pwr_tStatus
ldh_GetNextObjectAttrRef
(
ldh_tSession
session
,
pwr_tCid
cid
,
pwr_sAttrRef
*
arp
,
pwr_sAttrRef
*
new_arp
);
pwr_tStatus
ldh_GetTemplateObject
(
ldh_tSession
session
,
pwr_tCid
cid
,
pwr_tOid
*
oid
);
pwr_tStatus
ldh_GetNextTemplateAttrRef
(
ldh_tSession
session
,
pwr_tCid
cid
,
pwr_sAttrRef
*
arp
,
pwr_sAttrRef
*
new_arp
);
pwr_tStatus
ldh_GetNextSibling
(
ldh_tSession
Session
,
pwr_tObjid
object
,
...
...
wb/lib/wb/src/wb_merep.cpp
View file @
111ac995
...
...
@@ -733,6 +733,42 @@ tree_sTable *wb_merep::buildCatt( pwr_tStatus *sts)
}
}
// If the current volume is a class volume, add objects from this also
if
(
m_vrep
->
type
()
==
ldh_eVolRep_Mem
&&
m_vrep
->
cid
()
==
pwr_eClass_ClassVolume
)
{
wb_vrep
*
vrep
=
m_vrep
;
wb_orep
*
o
,
*
onext
;
wb_adrep
*
ad
,
*
adnext
;
pwr_tCid
cid
;
for
(
o
=
vrep
->
object
(
sts
,
pwr_eClass_ClassDef
);
ODD
(
*
sts
);
onext
=
o
->
next
(
sts
),
o
->
unref
(),
o
=
onext
)
{
o
->
ref
();
cid
=
cdh_ClassObjidToId
(
o
->
oid
());
wb_cdrep
*
cd
=
cdrep
(
sts
,
cid
);
if
(
EVEN
(
*
sts
))
throw
wb_error
(
*
sts
);
wb_bdrep
*
bd
=
cd
->
bdrep
(
sts
,
pwr_eBix_rt
);
if
(
EVEN
(
*
sts
))
{
delete
cd
;
continue
;
}
for
(
ad
=
bd
->
adrep
(
sts
);
ODD
(
*
sts
);
adnext
=
ad
->
next
(
sts
),
delete
ad
,
ad
=
adnext
)
{
if
(
ad
->
flags
()
&
PWR_MASK_CLASS
&&
cdh_tidIsCid
(
ad
->
tid
()))
{
insertCattObject
(
sts
,
cid
,
ad
,
0
);
if
(
EVEN
(
*
sts
))
throw
wb_error
(
*
sts
);
}
}
delete
bd
;
delete
cd
;
}
}
#if 0
merep_sClassAttrKey key;
key.subCid = 0;
...
...
wb/lib/wb/src/wb_volume.cpp
View file @
111ac995
...
...
@@ -192,6 +192,16 @@ wb_object wb_volume::object(const char *name) const
return
o
;
}
wb_object
wb_volume
::
templateObject
(
pwr_tCid
cid
)
const
{
pwr_tOid
oid
;
oid
.
oix
=
cdh_cixToOix
(
cdh_cidToCix
(
cid
),
pwr_eBix_template
,
0
);
oid
.
vid
=
cdh_CidToVid
(
cid
);
return
object
(
oid
);
}
wb_adef
wb_volume
::
adef
(
pwr_tCid
cid
,
const
char
*
bname
,
const
char
*
aname
)
{
pwr_tStatus
sts
;
...
...
@@ -206,7 +216,6 @@ wb_adef wb_volume::adef(pwr_tCid cid, const char *bname, const char *aname)
return
bdef
.
adef
(
aname
);
}
wb_cdef
wb_volume
::
cdef
(
wb_object
o
)
{
pwr_tStatus
sts
;
...
...
@@ -1270,6 +1279,134 @@ void wb_volume::nextAref(pwr_tCid cid, pwr_sAttrRef *arp,
op
->
unref
();
}
void
wb_volume
::
nextTemplateAref
(
pwr_tCid
cid
,
pwr_sAttrRef
*
arp
,
pwr_sAttrRef
*
oarp
)
{
tree_sTable
*
catt_tt
=
m_vrep
->
merep
()
->
buildCatt
(
&
m_sts
);
int
bd_size
;
wb_object
o
=
object
(
arp
->
Objid
);
if
(
!
o
)
{
m_sts
=
o
.
sts
();
return
;
}
wb_orep
*
op
=
o
;
// Get body size
wb_cdrep
*
cd
=
m_vrep
->
merep
()
->
cdrep
(
&
m_sts
,
cid
);
if
(
evenSts
())
return
;
wb_bdrep
*
bd
=
cd
->
bdrep
(
&
m_sts
,
pwr_eBix_rt
);
if
(
oddSts
())
{
bd_size
=
bd
->
size
();
delete
bd
;
}
else
bd_size
=
0
;
delete
cd
;
if
(
cid
==
op
->
cid
())
{
// Find attribute object
pwr_tCid
hostCid
=
0
;
merep_sClassAttrKey
key
;
merep_sClassAttr
*
item
;
key
.
subCid
=
cid
;
key
.
hostCid
=
0
;
key
.
idx
=
0
;
for
(
item
=
(
merep_sClassAttr
*
)
tree_FindSuccessor
(
&
m_sts
,
catt_tt
,
&
key
);
item
;
item
=
(
merep_sClassAttr
*
)
tree_FindSuccessor
(
&
m_sts
,
catt_tt
,
&
item
->
key
))
{
if
(
item
->
key
.
subCid
!=
cid
)
{
m_sts
=
LDH__CLASSLIST
;
break
;
}
if
(
hostCid
&&
item
->
key
.
hostCid
==
hostCid
)
// Same class with other index
continue
;
hostCid
=
item
->
key
.
hostCid
;
wb_object
to
=
templateObject
(
item
->
key
.
hostCid
);
if
(
to
)
{
wb_orep
*
o
=
to
;
wb_cdrep
*
cd
=
m_vrep
->
merep
()
->
cdrep
(
&
m_sts
,
cid
);
if
(
evenSts
())
return
;
int
bd_size
;
wb_bdrep
*
bd
=
cd
->
bdrep
(
&
m_sts
,
pwr_eBix_rt
);
if
(
oddSts
())
{
bd_size
=
bd
->
size
();
delete
bd
;
}
else
bd_size
=
0
;
delete
cd
;
*
oarp
=
pwr_cNAttrRef
;
oarp
->
Objid
=
o
->
oid
();
oarp
->
Flags
.
b
.
ObjectAttr
=
1
;
oarp
->
Offset
=
item
->
offset
[
0
];
oarp
->
Size
=
bd_size
;
oarp
->
Body
=
cdh_cidToBid
(
cid
,
pwr_eBix_rt
);
return
;
}
}
}
// Find next attribute object in current object
merep_sClassAttrKey
key
;
merep_sClassAttr
*
item
;
int
first_offset
=
0
;
key
.
subCid
=
cid
;
key
.
hostCid
=
op
->
cid
();
key
.
idx
=
0
;
for
(
item
=
(
merep_sClassAttr
*
)
tree_Find
(
&
m_sts
,
catt_tt
,
&
key
);
item
&&
item
->
key
.
subCid
==
cid
&&
item
->
key
.
hostCid
==
op
->
cid
();
item
=
(
merep_sClassAttr
*
)
tree_FindSuccessor
(
&
m_sts
,
catt_tt
,
&
item
->
key
))
{
// Find next offset
for
(
int
i
=
0
;
i
<
item
->
numOffset
;
i
++
)
{
if
(
i
==
0
&&
item
->
key
.
idx
==
0
)
first_offset
=
item
->
offset
[
0
];
if
(
item
->
offset
[
i
]
>
arp
->
Offset
)
{
*
oarp
=
pwr_cNAttrRef
;
oarp
->
Objid
=
op
->
oid
();
oarp
->
Flags
.
b
.
ObjectAttr
=
1
;
oarp
->
Offset
=
item
->
offset
[
i
];
oarp
->
Size
=
bd_size
;
oarp
->
Body
=
cdh_cidToBid
(
cid
,
pwr_eBix_rt
);
return
;
}
}
}
// Find first offset in first object of next class
key
.
subCid
=
cid
;
key
.
hostCid
=
op
->
cid
();
key
.
idx
=
0
;
for
(
item
=
(
merep_sClassAttr
*
)
tree_Find
(
&
m_sts
,
catt_tt
,
&
key
);
item
&&
item
->
key
.
subCid
==
cid
;
item
=
(
merep_sClassAttr
*
)
tree_FindSuccessor
(
&
m_sts
,
catt_tt
,
&
item
->
key
))
{
if
(
item
->
key
.
hostCid
==
key
.
hostCid
)
continue
;
wb_object
ol
=
templateObject
(
item
->
key
.
hostCid
);
if
(
oddSts
())
{
*
oarp
=
pwr_cNAttrRef
;
oarp
->
Objid
=
ol
.
oid
();
oarp
->
Flags
.
b
.
ObjectAttr
=
1
;
oarp
->
Offset
=
item
->
offset
[
0
];
oarp
->
Size
=
bd_size
;
oarp
->
Body
=
cdh_cidToBid
(
cid
,
pwr_eBix_rt
);
return
;
}
}
m_sts
=
LDH__NONEXT
;
}
void
wb_volume
::
aref
(
pwr_tCid
cid
,
wb_object
o
,
pwr_sAttrRef
*
arp
)
{
tree_sTable
*
catt_tt
=
m_vrep
->
merep
()
->
buildCatt
(
&
m_sts
);
...
...
wb/lib/wb/src/wb_volume.h
View file @
111ac995
...
...
@@ -88,6 +88,7 @@ public:
wb_object
object
(
pwr_tOid
oid
)
const
;
wb_object
object
(
pwr_tCid
cid
)
const
;
wb_object
object
(
const
char
*
name
)
const
;
wb_object
templateObject
(
pwr_tCid
cid
)
const
;
wb_attribute
attribute
(
pwr_tOid
oid
,
const
char
*
bname
,
const
char
*
aname
)
const
;
wb_attribute
attribute
(
pwr_tOid
oid
,
const
char
*
bname
)
const
;
...
...
@@ -139,6 +140,8 @@ public:
void
nextAref
(
pwr_tCid
cid
,
pwr_sAttrRef
*
arp
,
pwr_sAttrRef
*
new_arp
);
void
aref
(
pwr_tCid
cid
,
wb_object
o
,
pwr_sAttrRef
*
arp
);
void
nextObjectAref
(
pwr_tCid
cid
,
pwr_sAttrRef
*
arp
,
pwr_sAttrRef
*
oarp
);
void
nextTemplateAref
(
pwr_tCid
cid
,
pwr_sAttrRef
*
arp
,
pwr_sAttrRef
*
oarp
);
bool
isAncestor
(
wb_object
&
ancestor
,
wb_object
&
o
);
void
subClass
(
pwr_tCid
cid
,
pwr_tCid
subcid
,
pwr_tCid
*
nextsubcid
);
};
...
...
wb/lib/wb/src/wb_vrepmem.cpp
View file @
111ac995
...
...
@@ -604,6 +604,7 @@ wb_orep *wb_vrepmem::next(pwr_tStatus *sts, const wb_orep *o)
mem_object
*
next
=
root_object
->
next
(
mem
->
m_cid
,
&
oix
);
if
(
next
)
{
wb_orepmem
*
orep
=
new
wb_orepmem
(
this
,
next
);
*
sts
=
LDH__SUCCESS
;
return
orep
;
}
}
...
...
wb/lib/wb/src/wb_wccm.cpp
View file @
111ac995
...
...
@@ -375,6 +375,54 @@ static int wccm_getclasslist_func(
return
1
;
}
static
int
wccm_gettemplateobject_func
(
void
*
filectx
,
ccm_sArg
*
arg_list
,
int
arg_count
,
int
*
return_decl
,
ccm_tFloat
*
return_float
,
ccm_tInt
*
return_int
,
char
*
return_string
)
{
int
sts
;
pwr_tOName
name
;
pwr_tCid
cid
;
pwr_tObjid
oid
;
int
size
;
ldh_tSesContext
ldhses
;
sts
=
wccm_get_ldhses
(
&
ldhses
);
if
(
EVEN
(
sts
))
{
strcpy
(
return_string
,
""
);
*
return_decl
=
CCM_DECL_STRING
;
return
CMD__NOVOLATTACHED
;
}
if
(
arg_count
!=
1
)
return
CCM__ARGMISM
;
if
(
arg_list
->
value_decl
!=
CCM_DECL_STRING
)
return
CCM__ARGMISM
;
sts
=
ldh_ClassNameToId
(
ldhses
,
&
cid
,
arg_list
->
value_string
);
if
(
ODD
(
sts
))
{
sts
=
ldh_GetTemplateObject
(
ldhses
,
cid
,
&
oid
);
if
(
ODD
(
sts
))
sts
=
ldh_ObjidToName
(
ldhses
,
oid
,
cdh_mName_volumeStrict
,
name
,
sizeof
(
name
),
&
size
);
}
if
(
ODD
(
sts
))
strcpy
(
return_string
,
name
);
else
strcpy
(
return_string
,
""
);
*
return_decl
=
CCM_DECL_STRING
;
return
1
;
}
static
int
wccm_getnextobject_func
(
void
*
filectx
,
ccm_sArg
*
arg_list
,
...
...
@@ -524,6 +572,61 @@ static int wccm_getnextattrref_func(
return
1
;
}
static
int
wccm_getnexttemplateattrref_func
(
void
*
filectx
,
ccm_sArg
*
arg_list
,
int
arg_count
,
int
*
return_decl
,
ccm_tFloat
*
return_float
,
ccm_tInt
*
return_int
,
char
*
return_string
)
{
int
sts
;
char
*
name
;
pwr_tAttrRef
aref
;
pwr_tAttrRef
next_aref
;
int
size
;
ldh_tSesContext
ldhses
;
pwr_tCid
cid
;
ccm_sArg
*
arg_p2
;
sts
=
wccm_get_ldhses
(
&
ldhses
);
if
(
EVEN
(
sts
))
{
strcpy
(
return_string
,
""
);
*
return_decl
=
CCM_DECL_STRING
;
return
CMD__NOVOLATTACHED
;
}
if
(
arg_count
!=
2
)
return
CCM__ARGMISM
;
arg_p2
=
arg_list
->
next
;
if
(
arg_list
->
value_decl
!=
CCM_DECL_STRING
)
return
CCM__ARGMISM
;
if
(
arg_p2
->
value_decl
!=
CCM_DECL_STRING
)
return
CCM__ARGMISM
;
sts
=
ldh_ClassNameToId
(
ldhses
,
&
cid
,
arg_list
->
value_string
);
if
(
ODD
(
sts
))
{
sts
=
ldh_NameToAttrRef
(
ldhses
,
arg_p2
->
value_string
,
&
aref
);
if
(
ODD
(
sts
))
{
sts
=
ldh_GetNextTemplateAttrRef
(
ldhses
,
cid
,
&
aref
,
&
next_aref
);
if
(
ODD
(
sts
))
sts
=
ldh_AttrRefToName
(
ldhses
,
&
next_aref
,
cdh_mName_volumeStrict
,
&
name
,
&
size
);
}
}
if
(
ODD
(
sts
))
strcpy
(
return_string
,
name
);
else
strcpy
(
return_string
,
""
);
*
return_decl
=
CCM_DECL_STRING
;
return
1
;
}
static
int
wccm_getrootlist_func
(
void
*
filectx
,
ccm_sArg
*
arg_list
,
...
...
@@ -1205,6 +1308,10 @@ int wccm_register(
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ccm_register_function
(
"GetObjectClass"
,
wccm_getobjectclass_func
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ccm_register_function
(
"GetTemplateObject"
,
wccm_gettemplateobject_func
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ccm_register_function
(
"GetNextTemplateAttrRef"
,
wccm_getnexttemplateattrref_func
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ccm_register_function
(
"GetVolumeList"
,
wccm_getvolumelist_func
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ccm_register_function
(
"GetNextVolume"
,
wccm_getnextvolume_func
);
...
...
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