Mail Archives: geda-user/2015/12/25/12:20:48
This is a multi-part message in MIME format.
--------------080206020900020706060207
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Hi Peter,
to follow up on my previous email, I have taken a closer look
at how those files interact with locale.h -there seem to be two scenarios.
[1] main.c, print.c
Those two files call setlocale() API if ENABLE_NFS is defined.
So it seems to me that those two files should include locale.h
in that case, since this is how setlocale() API is made available
to the consumers.
[2] gui-config.c, gui-misc.c, gui-netlist-window.c, report.c
Those files do not seem to consume any locale.h API directly,
but they all call C_() macro which is defined in global.h:
# define C_(C, S) pgettext(C, S)
pgettext() macro is in turn defined in gettext.h as
#ifdef DEFAULT_TEXT_DOMAIN
# define pgettext(Msgctxt, Msgid) \
pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
#else
# define pgettext(Msgctxt, Msgid) \
pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
#endif
pgettext_aux () takes LC_MESSAGES as an argument.
Since LC_MESSAGES is provided by locale.h, gettext.h should include it.
Based on that, it seems that following three files should include locale.h:
src/main.c
src/print.c
src/gettext.h
There is already a check for locale.h in configure.ac,
so I took advantage of that.
I have updated bug report with this evaluation and attached
patch with proposed fix. I have tested these changes on Oracle Solaris 11.3
and Ubunutu 14.04. In both cases, tried to build with both NLS support
enabled and disabled.
Best regards,
Jan
On 12/25/15 11:23 AM, Peter Stuge (peter AT stuge DOT se) [via geda-user AT delorie DOT com] wrote:
> Hi Jan,
>
> Jan Damborsky wrote:
>> Deploying those tools on Solaris is straightforward, I justneed to deal
>> with a small issue when building pcb - compilation fails due to following
>> files missing <locale.h> header:
>>
>> $ git status -s
>> M src/hid/gtk/gui-config.c
>> M src/hid/gtk/gui-misc.c
>> M src/hid/gtk/gui-netlist-window.c
>> M src/main.c
>> M src/print.c
>> M src/report.c
>>
>> Adding <locale.h> to those filessolves the problem.
>> Tried that on Linux as well (Ubuntu 14.04), but Linux doesn't complain
>> which is perhaps the reason why that issue has not been reported so far.
>> I am wondering if it would make sense to file bug for this and fix that.
> I think so, we still need to find the right way to fix it.
>
>> If desired, I am willing to do whatever is needed to integrate
>> those changes into the upstream, just would need some guidance
>> to go through the processes.
> Filing a bug is a good first step. Next steps would be:
>
> * find out why locale.h is required
> * find out whether that is correct
> + if no, find what to do instead and implement that
> + if yes, check for locale.h in configure.ac and add #include within
> #if HAVE_LOCALE_H in the source files where locale.h is required
> * commit locally
> * either: git format-patch -1, then attach patch to the bug
> or: git push to somewhere and ask here for review+possible merge
>
>
> //Peter
--------------080206020900020706060207
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta content=3D"text/html; charset=3Dwindows-1252"
http-equiv=3D"Content-Type">
</head>
<body bgcolor=3D"#FFFFFF" text=3D"#000000">
<div class=3D"moz-cite-prefix"><tt>Hi Peter,</tt><tt><br>
</tt><tt><br>
</tt><tt>to follow up on my previous email, I have taken a closer
look<br>
at how those files interact with locale.h -</tt><tt> </tt><tt>the=
re
seem to be two scenarios.</tt>
<div class=3D"comment-text" itemprop=3D"commentText">
<p><tt>[1] main.c, print.c</tt></p>
<p><tt>Those two files call setlocale() API if ENABLE_NFS is
defined.<br>
So it seems to me that those two files should include
locale.h<br>
in that case, since this is how setlocale() API is made
available<br>
to the consumers.</tt></p>
<p><tt>[2] gui-config.c, gui-misc.c, gui-netlist-</tt><wbr><tt>wi=
ndow.</tt><wbr><tt>c,
report.c</tt></p>
<p><tt>Those files do not seem to consume any locale.h API
directly,<br>
but they all call C_() macro which is defined in global.h:</t=
t></p>
<p><tt># define C_(C, S) pgettext(C, S)</tt></p>
<p><tt>pgettext() macro is in turn defined in gettext.h as</tt></=
p>
<p><tt>#ifdef DEFAULT_TEXT_DOMAIN</tt><tt><br>
</tt><tt>
# define pgettext(Msgctxt, Msgid) \</tt><tt><br>
</tt><tt>
=A0=A0=A0pgettext_aux (DEFAULT_</tt><wbr><tt>TEXT_DOMAIN, Msg=
ctxt
GETTEXT_</tt><wbr><tt>CONTEXT_</tt><wbr><tt>GLUE Msgid,
Msgid, LC_MESSAGES)</tt><tt><br>
</tt><tt>
#else</tt><tt><br>
</tt><tt>
# define pgettext(Msgctxt, Msgid) \</tt><tt><br>
</tt><tt>
=A0=A0=A0pgettext_aux (NULL, Msgctxt GETTEXT_</tt><wbr><tt>CO=
NTEXT_</tt><wbr><tt>GLUE
Msgid, Msgid, LC_MESSAGES)</tt><tt><br>
</tt><tt>
#endif</tt></p>
<p><tt>pgettext_aux () takes LC_MESSAGES as an argument.<br>
Since LC_MESSAGES is provided by locale.h, gettext.h should
include it.</tt></p>
<p><tt>Based on that, it seems that following three files should
include locale.h:</tt></p>
<p><tt>src/main.c</tt><tt><br>
</tt><tt>
src/print.c</tt><tt><br>
</tt><tt>
src/gettext.h<br>
</tt></p>
<p><tt>There is already a check for locale.h in configure.ac,<br>
so I took advantage of that.<br>
</tt></p>
<p><tt>I have updated bug report with this evaluation and
attached<br>
patch with proposed fix. I have tested these changes on
Oracle Solaris 11.3<br>
and Ubunutu 14.04. In both cases, tried to build with both
NLS support<br>
enabled and disabled.<br>
</tt></p>
<p><tt>Best regards,<br>
Jan<br>
</tt></p>
</div>
<tt></tt><tt>On 12/25/15 11:23 AM, Peter Stuge (<a class=3D"moz-txt=
-link-abbreviated" href=3D"mailto:peter AT stuge DOT se">peter AT stuge DOT se</a>)
[via <a class=3D"moz-txt-link-abbreviated" href=3D"mailto:geda-us=
er AT delorie DOT com">geda-user AT delorie DOT com</a>] wrote:</tt><tt><br>
</tt></div>
<blockquote cite=3D"mid:20151225102357 DOT 16247 DOT qmail AT stuge DOT se"
type=3D"cite">
<pre wrap=3D"">Hi Jan,
Jan Damborsky wrote:
</pre>
<blockquote type=3D"cite">
<pre wrap=3D"">Deploying those tools on Solaris is straightforwar=
d, I justneed to deal
with a small issue when building pcb - compilation fails due to following
files missing <locale.h> header:
$ git status -s
M src/hid/gtk/gui-config.c
M src/hid/gtk/gui-misc.c
M src/hid/gtk/gui-netlist-window.c
M src/main.c
M src/print.c
M src/report.c
Adding <locale.h> to those filessolves the problem.
Tried that on Linux as well (Ubuntu 14.04), but Linux doesn't complain
which is perhaps the reason why that issue has not been reported so far.
I am wondering if it would make sense to file bug for this and fix that.
</pre>
</blockquote>
<pre wrap=3D"">
I think so, we still need to find the right way to fix it.
</pre>
<blockquote type=3D"cite">
<pre wrap=3D"">If desired, I am willing to do whatever is needed =
to integrate
those changes into the upstream, just would need some guidance
to go through the processes.
</pre>
</blockquote>
<pre wrap=3D"">
Filing a bug is a good first step. Next steps would be:
* find out why locale.h is required
* find out whether that is correct
+ if no, find what to do instead and implement that
+ if yes, check for locale.h in configure.ac and add #include within
#if HAVE_LOCALE_H in the source files where locale.h is required
* commit locally
* either: git format-patch -1, then attach patch to the bug
or: git push to somewhere and ask here for review+possible merge
//Peter
</pre>
</blockquote>
<tt><br>
</tt>
</body>
</html>
--------------080206020900020706060207--
- Raw text -