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
fc434677
Commit
fc434677
authored
Jan 15, 2004
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Connect method for signals
parent
714903a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
146 additions
and
0 deletions
+146
-0
wb/lib/wb/src/wb_c_objid.c
wb/lib/wb/src/wb_c_objid.c
+146
-0
No files found.
wb/lib/wb/src/wb_c_objid.c
0 → 100644
View file @
fc434677
/* wb_c_objid.c -- work bench methods of the Objid class.
PROVIEW/R
Copyright (C) 1994, 1996 by Comator Process AB. */
#include <stdio.h>
#include <string.h>
#include "wb_pwrs.h"
#include "wb_ldh_msg.h"
#include "wb_ldh.h"
#include "wb_dutl.h"
#include "wb_pwrs_msg.h"
#include "co_cdh.h"
/*----------------------------------------------------------------------------*\
Is it OK to connect an object ?
\*----------------------------------------------------------------------------*/
static
int
IsOkConnect
(
ldh_sMenuCall
*
ip
,
pwr_sMenuButton
*
mbp
)
{
pwr_tStatus
sts
;
pwr_tCid
cid
;
pwr_tCid
arg_cid
;
if
(
strcmp
(
mbp
->
FilterArguments
[
1
],
""
)
!=
0
)
{
// arg 1 holds the allowed class to connect to
sts
=
ldh_ClassNameToId
(
ip
->
PointedSession
,
&
arg_cid
,
mbp
->
FilterArguments
[
1
]);
if
(
EVEN
(
sts
))
return
0
;
sts
=
ldh_GetObjectClass
(
ip
->
PointedSession
,
ip
->
Selected
[
0
].
Objid
,
&
cid
);
if
(
EVEN
(
sts
))
return
0
;
if
(
cid
!=
arg_cid
)
return
0
;
}
return
1
;
}
/*----------------------------------------------------------------------------*\
To connect an object to Objid
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
Connect
(
ldh_sMenuCall
*
ip
)
{
pwr_tStatus
sts
;
pwr_sMenuButton
mb
;
pwr_sAttrRef
PattrRef
;
pwr_tCid
cid
;
pwr_tCid
arg_cid
;
sts
=
ldh_ReadObjectBody
(
ip
->
PointedSession
,
ip
->
ItemList
[
ip
->
ChosenItem
].
MenuObject
,
"SysBody"
,
&
mb
,
sizeof
(
pwr_sMenuButton
));
if
(
EVEN
(
sts
))
return
sts
;
if
(
strcmp
(
mb
.
MethodArguments
[
1
],
""
)
!=
0
)
{
// arg 1 holds the allowed class to connect to
sts
=
ldh_ClassNameToId
(
ip
->
PointedSession
,
&
arg_cid
,
mb
.
MethodArguments
[
1
]);
if
(
EVEN
(
sts
))
return
0
;
sts
=
ldh_GetObjectClass
(
ip
->
PointedSession
,
ip
->
Selected
[
0
].
Objid
,
&
cid
);
if
(
EVEN
(
sts
))
return
0
;
if
(
cid
!=
arg_cid
)
return
0
;
}
sts
=
ldh_GetAttrRef
(
ip
->
PointedSession
,
ip
->
Pointed
.
Objid
,
mb
.
MethodArguments
[
0
],
&
PattrRef
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ldh_WriteAttribute
(
ip
->
PointedSession
,
&
PattrRef
,
&
ip
->
Selected
[
0
].
Objid
,
sizeof
(
pwr_tObjid
));
return
PWRS__SUCCESS
;
}
static
int
IsOkDisconnect
(
ldh_sMenuCall
*
ip
,
pwr_sMenuButton
*
mbp
)
{
pwr_tStatus
sts
;
pwr_sAttrRef
PattrRef
;
pwr_tOid
oid
;
sts
=
ldh_GetAttrRef
(
ip
->
PointedSession
,
ip
->
Pointed
.
Objid
,
mbp
->
FilterArguments
[
0
],
&
PattrRef
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ldh_ReadAttribute
(
ip
->
PointedSession
,
&
PattrRef
,
&
oid
,
sizeof
(
pwr_tOid
));
if
(
cdh_ObjidIsNull
(
oid
))
return
0
;
return
1
;
}
/*----------------------------------------------------------------------------*\
To disconnect an objid attribute
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
Disconnect
(
ldh_sMenuCall
*
ip
)
{
pwr_tStatus
sts
;
pwr_sMenuButton
mb
;
pwr_sAttrRef
PattrRef
;
pwr_tOid
oid
;
sts
=
ldh_ReadObjectBody
(
ip
->
PointedSession
,
ip
->
ItemList
[
ip
->
ChosenItem
].
MenuObject
,
"SysBody"
,
&
mb
,
sizeof
(
pwr_sMenuButton
));
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ldh_GetAttrRef
(
ip
->
PointedSession
,
ip
->
Pointed
.
Objid
,
mb
.
MethodArguments
[
0
],
&
PattrRef
);
if
(
EVEN
(
sts
))
return
sts
;
oid
=
pwr_cNObjid
;
sts
=
ldh_WriteAttribute
(
ip
->
PointedSession
,
&
PattrRef
,
&
oid
,
sizeof
(
pwr_tOid
));
return
PWRS__SUCCESS
;
}
pwr_dExport
pwr_BindMethods
(
$
Objid
)
=
{
pwr_BindMethod
(
Connect
),
pwr_BindMethod
(
IsOkConnect
),
pwr_BindMethod
(
Disconnect
),
pwr_BindMethod
(
IsOkDisconnect
),
pwr_NullMethod
};
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