[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gccxml
Subject:    RE: [GCC-XML]Default values
From:       Brad King <brad.king () kitware ! com>
Date:       2003-10-21 13:00:58
Message-ID: Pine.LNX.4.44.0310210856130.18337-100000 () hythloth ! kitwarein ! com
[Download RAW message or body]

On Tue, 21 Oct 2003, Tony Cook wrote:

> Sorry to bring this one up again! I do have a suggestion that might
> help. Instead of emitting something like:
>
> default="0x00000000000000000080ff3f0000000000000000" or
> init="0x00000000000000000080ff3f0000000000000000"
>
> would it be possible to emit these float/double values as
> exponent/mantissa value pairs? In the current form I am at a loss to
> know what the hex value is trying to represent (presumably a hex dump of
> some combined mantissa/exponent word known only to gcc) and thus
> translating it into the syntax of another language is - well - awkward!
>
> If instead I could see:
>
> mantissa="12345" exponent="-4"
>
> I can easily translate this into whatever alternate form "1.2345" or
> "12345E-4" etc needed in my target language. This is the only glitch in
> GCC_XML that is causing me grief translating C/C++ interfaces into stuff
> like VB6 and COM interfaces.
>
> Would this be possible to do?

The problem is that initializers can be arbitrary expressions.  The dump
is doing nothing but calling an internal gcc function called something
like "expr_as_string".  Support for the full expression dump may
eventually be added, but I don't have time to look at this now.

If you look at xml_print_default_argument_attribute and
xml_print_init_attribute in xml.c, you'll see the code that prints the
initializers.  You can probably add cases to the switch statement to
handle floating-point and integer-valued expressions.  If you can get
something working, I'll see about applying your patch until full
expression/function body support is added in the future.

-Brad


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic