Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zmap
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
zmap
Commits
7b47dc50
Commit
7b47dc50
authored
15 years ago
by
edgrif
Browse files
Options
Downloads
Patches
Plain Diff
improve debug message output so we can see who sends what.
parent
0368a15a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/zmapControl/remote/zmapXRemote.c
+60
-34
60 additions, 34 deletions
src/zmapControl/remote/zmapXRemote.c
src/zmapControl/remote/zmapXRemote_P.h
+14
-6
14 additions, 6 deletions
src/zmapControl/remote/zmapXRemote_P.h
with
74 additions
and
40 deletions
src/zmapControl/remote/zmapXRemote.c
+
60
−
34
View file @
7b47dc50
...
...
@@ -20,16 +20,15 @@
* This file is part of the ZMap genome database package
* originated by
* Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk,
* Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk,
* Rob Clack (Sanger Institute, UK) rnc@sanger.ac.uk
* Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk
*
* Description:
*
* Exported functions: See ZMap/zmapXRemote.h
* HISTORY:
* Last edited: A
pr
1
6
1
1:06
2009 (
rds
)
* Last edited: A
ug
1
1
1
6:30
2009 (
edgrif
)
* Created: Wed Apr 13 19:04:48 2005 (rds)
* CVS info: $Id: zmapXRemote.c,v 1.3
5
2009-0
4
-1
6 10:07:48 rds
Exp $
* CVS info: $Id: zmapXRemote.c,v 1.3
6
2009-0
8
-1
4 09:59:37 edgrif
Exp $
*-------------------------------------------------------------------
*/
...
...
@@ -89,12 +88,11 @@ ZMapXRemoteObj zMapXRemoteNew(void)
/* Get current display, open it to check it's valid
and store in struct to save having to do it again */
if
((
env_string
=
getenv
(
"DISPLAY"
))
&&
(
object
=
g_new0
(
ZMapXRemoteObjStruct
,
1
)))
if
((
env_string
=
getenv
(
"DISPLAY"
))
&&
(
object
=
g_new0
(
ZMapXRemoteObjStruct
,
1
)))
{
zmapXDebug
(
"Using DISPLAY: %s
\n
"
,
env_string
);
if
((
object
->
display
=
XOpenDisplay
(
env_string
))
==
NULL
)
if
((
object
->
display
=
XOpenDisplay
(
env_string
))
==
NULL
)
{
zmapXDebug
(
"Failed to open display '%s'
\n
"
,
env_string
);
...
...
@@ -107,10 +105,18 @@ ZMapXRemoteObj zMapXRemoteNew(void)
}
else
{
zmapXDebug
(
"[zMapXRemoteNew] XSynchronize() '%s'
\n
"
,
env_string
);
#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
#ifdef DO_DEBUGGING
g_printerr
(
"[zMapXRemoteNew] XSynchronize() @ line %d
\n
"
,
__LINE__
);
g_printerr
(
"
%s
[zMapXRemoteNew] XSynchronize() @ line %d
\n
"
,
__LINE__
);
XSynchronize
(
object
->
display
,
True
);
#endif
#endif
/* ED_G_NEVER_INCLUDE_THIS_CODE */
/* almost certainly not required when using g_new0(). */
object
->
init_called
=
FALSE
;
object
->
is_server
=
FALSE
;
...
...
@@ -312,11 +318,13 @@ int zMapXRemoteInitServer(ZMapXRemoteObj object, Window id, char *appName, char
return
1
;
}
int
zMapXRemoteSendRemoteCommands
(
ZMapXRemoteObj
object
){
int
zMapXRemoteSendRemoteCommands
(
ZMapXRemoteObj
object
)
{
int
response_status
=
0
;
zmapXDebug
(
"
\n
trying %s
\n
"
,
"a broken function..."
);
return
response_status
;
}
...
...
@@ -368,7 +376,7 @@ int zMapXRemoteSendRemoteCommand(ZMapXRemoteObj object, char *command, char **re
timeout_timer
=
g_timer_new
();
g_timer_start
(
timeout_timer
);
if
(
response
)
if
(
response
)
*
response
=
NULL
;
if
(
object
->
is_server
==
TRUE
)
...
...
@@ -398,14 +406,14 @@ int zMapXRemoteSendRemoteCommand(ZMapXRemoteObj object, char *command, char **re
goto
DONE
;
}
if
(
check_names
)
if
(
check_names
)
{
char
*
atom_name
=
NULL
;
if
((
atom_name
=
zmapXRemoteGetAtomName
(
object
->
display
,
object
->
request_atom
)))
if
((
atom_name
=
zmapXRemoteGetAtomName
(
object
->
display
,
object
->
request_atom
)))
{
zmapXDebug
(
"
remote: (writing '%s'
to %s on 0x%x
)
\n
"
,
command
,
atom_name
,
(
unsigned
int
)
object
->
window_id
)
;
zmapXDebug
(
"
About to send
to %s on 0x%x
:
\n
'%s'
\n
"
,
atom_name
,
(
unsigned
int
)
object
->
window_id
,
command
)
;
g_free
(
atom_name
);
}
}
...
...
@@ -414,17 +422,23 @@ int zMapXRemoteSendRemoteCommand(ZMapXRemoteObj object, char *command, char **re
result
=
zmapXRemoteChangeProperty
(
object
,
object
->
request_atom
,
command
);
zmapXDebug
(
"
s
ent
'%s'
...
\n
"
,
command
);
zmapXDebug
(
"
S
ent
:
\n
'%s'
\n
"
,
command
);
if
(
windowError
){
result
=
ZMAPXREMOTE_SENDCOMMAND_INVALID_WINDOW
;
goto
DONE
;
}
if
(
windowError
)
{
result
=
ZMAPXREMOTE_SENDCOMMAND_INVALID_WINDOW
;
goto
DONE
;
}
do
{
XEvent
event
=
{
0
};
#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
/* I need it not to time out during testing..... */
if
((
elapsed
=
g_timer_elapsed
(
timeout_timer
,
&
ignore
))
>
timeout
)
{
isDone
=
TRUE
;
...
...
@@ -436,22 +450,26 @@ int zMapXRemoteSendRemoteCommand(ZMapXRemoteObj object, char *command, char **re
result
=
ZMAPXREMOTE_SENDCOMMAND_TIMEOUT
;
/* invalid window */
goto
DONE
;
}
#endif
/* ED_G_NEVER_INCLUDE_THIS_CODE */
if
(
XPending
(
object
->
display
))
if
(
XPending
(
object
->
display
))
XNextEvent
(
object
->
display
,
&
event
);
if
(
event
.
xany
.
window
==
object
->
window_id
)
if
(
event
.
xany
.
window
==
object
->
window_id
)
{
switch
(
event
.
type
)
{
case
PropertyNotify
:
{
isDone
=
process_property_notify
(
object
,
&
send_time
,
&
event
,
response
);
isDone
=
process_property_notify
(
object
,
&
send_time
,
&
event
,
response
)
;
break
;
}
break
;
case
DestroyNotify
:
{
if
(
XCheckTypedWindowEvent
(
object
->
display
,
object
->
window_id
,
PropertyNotify
,
&
event
))
if
(
XCheckTypedWindowEvent
(
object
->
display
,
object
->
window_id
,
PropertyNotify
,
&
event
))
{
g_printerr
(
"
\n
(%s, line %d) - Found destroy before property notify, processing...
\n\n
"
,
__FILE__
,
__LINE__
);
...
...
@@ -466,11 +484,15 @@ int zMapXRemoteSendRemoteCommand(ZMapXRemoteObj object, char *command, char **re
object
->
window_id
,
""
,
"window was destroyed"
);
zmapXDebug
(
"remote : window 0x%x was destroyed.
\n
"
,
(
unsigned
int
)
object
->
window_id
);
result
=
ZMAPXREMOTE_SENDCOMMAND_INVALID_WINDOW
;
/* invalid window */
goto
DONE
;
}
break
;
}
break
;
case
CirculateNotify
:
case
ConfigureNotify
:
case
CreateNotify
:
...
...
@@ -486,6 +508,7 @@ int zMapXRemoteSendRemoteCommand(ZMapXRemoteObj object, char *command, char **re
* SubstructureNotifyMask */
break
;
default:
printf
(
"Got event of type %d
\n
"
,
event
.
type
);
break
;
...
...
@@ -759,13 +782,13 @@ static Bool process_property_notify(ZMapXRemoteObj object,
XEvent
*
event_in
,
char
**
response
)
{
XEvent
event
=
*
event_in
;
Bool
isDone
=
False
;
XEvent
event
=
*
event_in
;
gboolean
atomic_delete
=
FALSE
;
if
(
event
.
type
==
PropertyNotify
&&
(
predicate
->
set
==
True
&&
event
.
xproperty
.
time
>=
predicate
->
time
)
&&
event
.
xproperty
.
atom
==
object
->
response_atom
)
if
(
event
.
type
==
PropertyNotify
&&
(
predicate
->
set
==
True
&&
event
.
xproperty
.
time
>=
predicate
->
time
)
&&
event
.
xproperty
.
atom
==
object
->
response_atom
)
{
switch
(
event
.
xproperty
.
state
)
{
...
...
@@ -774,6 +797,7 @@ static Bool process_property_notify(ZMapXRemoteObj object,
GError
*
error
=
NULL
;
char
*
commandResult
;
int
nitems
;
if
(
!
zmapXRemoteGetPropertyFullString
(
object
->
display
,
object
->
window_id
,
object
->
response_atom
,
...
...
@@ -784,14 +808,17 @@ static Bool process_property_notify(ZMapXRemoteObj object,
*
response
=
g_strdup
(
error
->
message
);
g_error_free
(
error
);
}
else
if
(
nitems
>
0
&&
commandResult
&&
*
commandResult
)
else
if
(
nitems
>
0
&&
commandResult
&&
*
commandResult
)
{
*
response
=
commandResult
;
*
response
=
commandResult
;
zmapXDebug
(
"Received:
\n
'%s'
\n
"
,
*
response
)
;
}
else
{
*
response
=
g_strdup
(
"assert_not_reached()"
);
}
isDone
=
TRUE
;
}
break
;
...
...
@@ -944,8 +971,7 @@ static int zmapXRemoteCmpAtomString (ZMapXRemoteObj object, Atom atom, char *exp
if
(
error
)
{
zmapXDebug
(
"Warning : window 0x%x is not a valid remote-controllable window.
\n
"
,
(
unsigned
int
)
win
);
(
unsigned
int
)
object
->
window_id
);
switch
(
error
->
code
)
{
...
...
This diff is collapsed.
Click to expand it.
src/zmapControl/remote/zmapXRemote_P.h
+
14
−
6
View file @
7b47dc50
...
...
@@ -20,16 +20,15 @@
* This file is part of the ZMap genome database package
* originated by
* Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk,
* Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk,
* Rob Clack (Sanger Institute, UK) rnc@sanger.ac.uk
* Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk
*
* Description:
*
* Exported functions: None
* HISTORY:
* Last edited:
Dec
1
9
1
0:35
200
8
(
rds
)
* Last edited:
Aug
1
1
1
6:16
200
9
(
edgrif
)
* Created: Thu Apr 14 13:07:51 2005 (rds)
* CVS info: $Id: zmapXRemote_P.h,v 1.1
4
200
8-12
-1
9
1
3:55:56 rds
Exp $
* CVS info: $Id: zmapXRemote_P.h,v 1.1
5
200
9-08
-1
4
1
0:00:07 edgrif
Exp $
*-------------------------------------------------------------------
*/
...
...
@@ -71,18 +70,27 @@ typedef struct
/*====================== DEBUGGING =========================*/
/* #define DO_DEBUGGING */
#define DO_DEBUGGING
#ifdef DO_DEBUGGING
#define ZMAP_X_MSG_FORMAT_STRING "(%s, line %d) - "
extern
char
*
ZMAP_X_PROGRAM_G
;
#define ZMAP_X_MSG_FORMAT_STRING "(%s %s line %d) - "
#define zmapXDebug(FORMAT, ...) \
G_STMT_START{ \
g_printerr(ZMAP_X_MSG_FORMAT_STRING FORMAT, \
ZMAP_X_PROGRAM_G, \
__FILE__, \
__LINE__, \
__VA_ARGS__) ; \
}G_STMT_END
#else
#define zmapXDebug(FORMAT, ...) do {} while(0)
#endif
/*==========================================================*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment