Re: Gscanner: can I get the text of scanned floating point numbers



Tim,

Thanks for your prompt reply.
Would-it make sense to add this feature to Gscanner?
(have access to the scanned text).

I would like to save text inside comments in the generated
xml document of my appl.

Laurent


Tim Janik wrote:
> 
> On Wed, 2 May 2001, Laurent Lemaitre wrote:
> 
> > Tim,
> >
> > I am currently using the Lexical Scanner from glib
> > for my application (the appl converts files written
> > in verilog to xml).
> >
> > My problem: my scanner scans floating point numbers (for
> > instance 1.22222e-24). It returns G_TOKEN_FLOAT when a
> > floating point number is found. I would like to save the
> > text that has been scanned (and that served to create the
> > value of  scanner->value.v_float). Is-there a way to have
> > access to the scanned text?
> 
> nope you can't i'm sorry.
> that level of detail is abstracted by gscanner.
> 
> >
> > Thanks,
> >
> > Laurent
> >
> > PS: with the automatic conversion str->float I can loose
> > precision (that is bad for my application :-( )
> > More specifically here is what I am doing to get the text back:
> > txt = g_strdup_printf ("%e",scanner->value.v_float);
> 
> you can however use precision specifiers here (man printf) to
> preserve all of the float precision (though, under some circumstances,
> those float strings can get quite long),
> 
> >
> >
> 
> ---
> ciaoTJ
> 
> _______________________________________________
> gnome-list mailing list
> gnome-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]