This patch has been posted to the DDD mailing list by Peter Ernst on Wed, 5 Jun 2002 17:36:12 +0200 (MET DST)
-----------------------------------------------------------
DDD 3.3.1 with Perl: when using the graphical display on reference
variables, de-referencing works nicely through
e.g. a double-mouse click (by means of code in
ddd/deref.C). However, if the references is
blessed (i.e. it is a object reference),
de-referencing does NOT work.
Example: graph display $SeqInfoObj
p $SeqInfoObj
W3H::Parser::Seqinfo=HASH(0x4d3738)
i.e. $SeqInfoObj is a blessed reference
double-click on the graph does NOT dereference, because
the code in ddd/deref.C tries to get the "type" of the
reference (in this case HASH) by parsing the output of
" p $SeqInfoObj ", and considers the first identifier as
"type". In this case the type is "W3H" which is wrong.
Interestingly, the regular expression to parse the output
of " p $SeqInfoObj " (rxperlref line 359 in ddd/rxscan.L)
already knows about the "more complicated" syntax. I.e. it
is not necessary to fix something here.
Fix description:
Correct is is to take the first identifier after a
"=". This works for blessed and un-blessed references
(un-blessed references don't have a "=" character in the
output of " p $simple_ref "). I.e. the bug is fixed by
changing line 72 in ddd/deref.C
from:
ref = val.through(rxidentifier);
to:
ref = val.at(rxidentifier, val.index("=") + 1);
on a blessed reference, val.index("=") + 1 points to the first
character after the "=" sign,
on a un-blessed reference, val.index("=") + 1 points to character 0.
The fix is working as you can see from the history file below:
$SeqInfoObj is a blessed hash-reference
$SeqInfoObj->{'entries'} is an un-blessed array-reference
$SeqInfoObj->{'entries'}->[0] aka
${$SeqInfoObj->{'entries'}}[0]
is an un-blessed hash-reference
from ~/.ddd/history :
------------- begin snip -------------------
exec "perl -d w3h.debugtask dnasweep -infile=ensembl_cdna:enst00000000442"
cont
c 218
graph display $SeqInfoObj
graph display %$SeqInfoObj dependent on 1
graph display @{$SeqInfoObj->{'entries'}} dependent on 2
graph display %{${$SeqInfoObj->{'entries'}}[0]} dependent on 3
------------- end snip -------------------
in case you're interested ~/.ddd/log :
------------- begin snip -------------------
GNU DDD 3.3.1 (sparc-sun-solaris2.7)
Copyright (C) 1995-1999 Technische Universität Braunschweig, Germany.
Copyright (C) 1999-2001 Universität Passau, Germany.
Compiled with GCC 2.95.2 19991024 (release), libstdc++ 2.8.0
Requires X11R6, Xt11R6, Motif 2.1 (Motif Version 2.1.0)
Includes Athena Panner, DDD core
Built 2002-06-05 by Peter Ernst <unknown>.
$ /home/dok427/fox/ddd-3.3.1/ddd/ddd --perl w3h.debugtask
------------- end snip -------------------
Kind regards,
Peter Ernst
P.S: DDD is really a very nice program. Congratulations for it!
Peter Ernst
Department of Molecular Biophysics - H0200
Deutsches Krebsforschungszentrum (German Cancer Research Center) DKFZ
Im Neuenheimer Feld 280
69120 Heidelberg, Germany phone: +49-6221-42-2330
http://genome.dkfz-heidelberg.de/ fax: +49-6221-42-2333
=======================================================================
diff with fix
Logged In: YES
user_id=566665
Applied in the CVS repository