This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH,fortran] *The* ISO C Binding patch


On Tue, Jun 26, 2007 at 10:01:34AM -0700, Steve Kargl wrote:
> On Sun, Jun 24, 2007 at 08:37:45PM +0200, FX Coudert wrote:
> > >>+NAMED_CHARCST (ISOCBINDING_NULL_CHAR, "c_null_char", '\0')
> > >>+NAMED_CHARCST (ISOCBINDING_ALERT, "c_alert", '\a')
> > >>+NAMED_CHARCST (ISOCBINDING_BACKSPACE, "c_backspace", '\b')
> > >>+NAMED_CHARCST (ISOCBINDING_FORM_FEED, "c_form_feed", '\f')
> > >>+NAMED_CHARCST (ISOCBINDING_NEW_LINE, "c_new_line", '\n')
> > >>+NAMED_CHARCST (ISOCBINDING_CARRIAGE_RETURN, "c_carriage_return",  
> > >>'\r')
> > >>+NAMED_CHARCST (ISOCBINDING_HORIZONTAL_TAB, "c_horizontal_tab", '\t')
> > >>+NAMED_CHARCST (ISOCBINDING_VERTICAL_TAB, "c_vertical_tab", '\v')
> > >
> > >Shouldn't those use the target character set?
> > 
> > Indeed they should. I thought I had taken care of it when I worked on  
> > the F-E branch, but apparently I never committed it (or never got it  
> > fully working).
> > 
> > For Steve : first, I'm sorry that I don't have time to deal with it  
> > myself; second, the function you need for the translation is  
> > lang_hooks.to_target_charset, you can see it used in trans-expr.c  
> > (gfc_trans_string_copy), it's simply a matter of replacing '\b' with  
> > lang_hooks.to_target_charset('\b'), and possibly #include  
> > "langhooks.h" at the beginning of the file concerned.
> 
> There are only 5 uses on lang_hooks.to_target_charset in the 
> entire GCC repository.  One appears in trans-expr.c.  None
> involve any of the above special chars.  Andreas pointed me
> to libcpp/charset.c.  This contains convert_escape, but that's
> a static function and it deals with more than the above set.
> There is cpp_host_to_exec_charset(), which might do the trick,
> except that it is implemented in terms of opaque types declared
> as part of cpp.
> 

Ugh.  It's worse than I thought!  To use lang_hooks.to_target_charset,
I would need to change iso-c-binding.def (ie the above lines) and
add langhooks.h to the beginning of appropriate files.  Well, this
file is sucked into gfortran.h, which now means I have to either 
add langhooks.h to gfortran.h or to all the individual files.  No
problem until one reads the top of langhooks.h, which states that
tree.h must appear before langhooks.h.  So, now we're adding two
headers that the majority of files in gcc/fortran don't need.
-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]