[M3devel] Some workarounds for m3gdb input and output of floating values.
Rodney M. Bates
rodney.m.bates at cox.net
Mon Jun 1 21:32:33 CEST 2009
I recently committed a couple of changes that give m3gdb some very
tenuous support of floating values. Printing them appears to work in
a few tests on LINUXLIBC6. This relies on the preexisting C floating
support, but this really needs some more thorough review. Moreover,
Modula-3 style floating literals are not being recognized.
Until it is fixed right, here are some ways to work around its
limitations. They are a bit tedious, but should allow you to do what
you need to do, using m3gdb calls on Modula-3 library code. The idea
is just to call procedures in Lex, Fmt, etc.
To print a value in Modula-3 form, do, e.g.:
(m3gdb) print Fmt.Real(LF,Fmt.Style.Fix,10,FALSE)
$1 = (*16_b737876c*) "1.1250000000"
Note that m3gdb has no knowledge of defaulted parameters, so you have
to supply them all explicitly.
To assign a literal value, do, e.g.:
(m3gdb) print LF := Lex.Real(TextRd.New("2.375"))
$2 = 2.375
(m3gdb) p Fmt.Real(LF,Fmt.Style.Fix,10,FALSE)
$3 = (*16_b73787dc*) "2.3750000000"
Few or none of these calls will work unless Lex, Fmt, and TextRd are
imported somewhere in the import closure of your program. Otherwise,
they have uninitialized data and many will segfault or otherwise fail
when called by m3gdb.
Rodney Bates
More information about the M3devel
mailing list