public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* i686-w64-mingw32-gcc: LC_MESSAGES
@ 2019-01-08 21:26 Lee
  2019-01-09 10:21 ` JonY
  0 siblings, 1 reply; 9+ messages in thread
From: Lee @ 2019-01-08 21:26 UTC (permalink / raw)
  To: cygwin

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html
has a note for LC_MESSAGES:
  The functionality described is an extension to the ISO C standard.
  Application developers may make use of an extension as it is
  supported on all POSIX.1-2017-conforming systems.

i686-w64-mingw32-gcc doesn't have LC_MESSAGES defined.
Is that an oversight, something missing in windows, or .. ??


$ cat lcmessages.c
#include <stdio.h>
#include <locale.h>
#include <string.h>
#include <stdlib.h>

int main(int argc, char **argv )
{
  char *s, *lang;
  lang = getenv("LANG");
  printf("  LANG=%s  initial locale: %s\n", lang, setlocale(LC_ALL, NULL));

  s = setlocale(LC_ALL, "");
  printf("after 'setlocale(LC_ALL, \"\");'                 locale=%s\n", s);
#ifdef LC_MESSAGES
  s = setlocale(LC_MESSAGES, "de_DE.utf8");
  printf("after 'setlocale(LC_MESSAGES, \"de_DE.utf8\");'
locale=%s\n", setlocale(LC_ALL, NULL));
#else
  printf("LC_MESSAGES is not defined\n");
#endif
}

$ gcc lcmessages.c

$ ./a
  LANG=en_US.UTF-8  initial locale: C
after 'setlocale(LC_ALL, "");'
locale=C/en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/en_US.UTF-8
after 'setlocale(LC_MESSAGES, "de_DE.utf8");'
locale=C/en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/de_DE.utf8

$ i686-w64-mingw32-gcc lcmessages.c

$ ./a
  LANG=en_US.UTF-8  initial locale: C
after 'setlocale(LC_ALL, "");'                 locale=English_United States.1252
LC_MESSAGES is not defined

Thanks,
Lee

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: i686-w64-mingw32-gcc: LC_MESSAGES
  2019-01-08 21:26 i686-w64-mingw32-gcc: LC_MESSAGES Lee
@ 2019-01-09 10:21 ` JonY
  2019-01-09 18:14   ` Lee
  0 siblings, 1 reply; 9+ messages in thread
From: JonY @ 2019-01-09 10:21 UTC (permalink / raw)
  To: cygwin


[-- Attachment #1.1: Type: text/plain, Size: 576 bytes --]

On 1/8/19 9:26 PM, Lee wrote:
> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html
> has a note for LC_MESSAGES:
>   The functionality described is an extension to the ISO C standard.
>   Application developers may make use of an extension as it is
>   supported on all POSIX.1-2017-conforming systems.
> 
> i686-w64-mingw32-gcc doesn't have LC_MESSAGES defined.
> Is that an oversight, something missing in windows, or .. ??
> 

Windows MSVCR isn't POSIX nor ISO C compliant, so you shouldn't be
referring to opengroups, only against MSDN.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: i686-w64-mingw32-gcc: LC_MESSAGES
  2019-01-09 10:21 ` JonY
@ 2019-01-09 18:14   ` Lee
  2019-01-09 18:19     ` Douglas Coup
  0 siblings, 1 reply; 9+ messages in thread
From: Lee @ 2019-01-09 18:14 UTC (permalink / raw)
  To: cygwin

On 1/9/19, JonY  wrote:
> On 1/8/19 9:26 PM, Lee wrote:
>> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html
>> has a note for LC_MESSAGES:
>>   The functionality described is an extension to the ISO C standard.
>>   Application developers may make use of an extension as it is
>>   supported on all POSIX.1-2017-conforming systems.
>>
>> i686-w64-mingw32-gcc doesn't have LC_MESSAGES defined.
>> Is that an oversight, something missing in windows, or .. ??
>>
>
> Windows MSVCR isn't POSIX nor ISO C compliant, so you shouldn't be
> referring to opengroups, only against MSDN.

What's a Windows MSVCR?

Since the same program compiled with cygwins' gcc has LC_MESSAGES
defined, I was guessing it was just a library thing and maybe it just
hadn't been implemented in the mingw libraries yet.. but it sounds
like it's not an oversight & Microsoft needs to support LC_MESSAGES
before i686-w64-mingw32-gcc will.  Is that about right?

Thanks,
Lee

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: i686-w64-mingw32-gcc: LC_MESSAGES
  2019-01-09 18:14   ` Lee
@ 2019-01-09 18:19     ` Douglas Coup
  2019-01-09 19:43       ` Lee
  0 siblings, 1 reply; 9+ messages in thread
From: Douglas Coup @ 2019-01-09 18:19 UTC (permalink / raw)
  To: cygwin


On 1/9/2019 1:14 PM, Lee wrote:
> On 1/9/19, JonY  wrote:
>> On 1/8/19 9:26 PM, Lee wrote:
>>> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html
>>> has a note for LC_MESSAGES:
>>>    The functionality described is an extension to the ISO C standard.
>>>    Application developers may make use of an extension as it is
>>>    supported on all POSIX.1-2017-conforming systems.
>>>
>>> i686-w64-mingw32-gcc doesn't have LC_MESSAGES defined.
>>> Is that an oversight, something missing in windows, or .. ??
>>>
>> Windows MSVCR isn't POSIX nor ISO C compliant, so you shouldn't be
>> referring to opengroups, only against MSDN.
> What's a Windows MSVCR?
>
> Since the same program compiled with cygwins' gcc has LC_MESSAGES
> defined, I was guessing it was just a library thing and maybe it just
> hadn't been implemented in the mingw libraries yet.. but it sounds
> like it's not an oversight & Microsoft needs to support LC_MESSAGES
> before i686-w64-mingw32-gcc will.  Is that about right?
>
> Thanks,
> Lee
>
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>
>
MSVCR = MicroSoft Visual C Run-time (I think)

Doug Coup

Objective Systems, Inc.
REAL WORLD ASN.1 AND XML SOLUTIONS
Tel: +1 (484) 875-9841
Fax: +1 (484) 875-9830
Toll-free: (877) 307-6855 (USA only)
http://www.obj-sys.com


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: i686-w64-mingw32-gcc: LC_MESSAGES
  2019-01-09 18:19     ` Douglas Coup
@ 2019-01-09 19:43       ` Lee
  2019-01-09 23:41         ` Brian Inglis
  2019-01-09 23:43         ` JonY
  0 siblings, 2 replies; 9+ messages in thread
From: Lee @ 2019-01-09 19:43 UTC (permalink / raw)
  To: cygwin

On 1/9/19, Douglas Coup  wrote:
>
> On 1/9/2019 1:14 PM, Lee wrote:
>> On 1/9/19, JonY  wrote:
>>> On 1/8/19 9:26 PM, Lee wrote:
>>>> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html
>>>> has a note for LC_MESSAGES:
>>>>    The functionality described is an extension to the ISO C standard.
>>>>    Application developers may make use of an extension as it is
>>>>    supported on all POSIX.1-2017-conforming systems.
>>>>
>>>> i686-w64-mingw32-gcc doesn't have LC_MESSAGES defined.
>>>> Is that an oversight, something missing in windows, or .. ??
>>>>
>>> Windows MSVCR isn't POSIX nor ISO C compliant, so you shouldn't be
>>> referring to opengroups, only against MSDN.
>>
>> What's a Windows MSVCR?
>>
>> Since the same program compiled with cygwins' gcc has LC_MESSAGES
>> defined, I was guessing it was just a library thing and maybe it just
>> hadn't been implemented in the mingw libraries yet.. but it sounds
>> like it's not an oversight & Microsoft needs to support LC_MESSAGES
>> before i686-w64-mingw32-gcc will.  Is that about right?
>>
>> Thanks,
>> Lee
>>
>>
> MSVCR = MicroSoft Visual C Run-time (I think)

Meaning i686-w64-mingw32-gcc uses the Microsoft libraries vs. cygwin
gcc using posix compliant libraries?  Implying LC_MESSAGES not being
defined is yet another instance of Microsoft not following accepted
standards?

The background for my question is https://github.com/htacg/tidy-html5/issues/770
Tidy removed the setlocale call from the library init function, so if
users want a specific locale/language they're going to have to set it
up themselves.
I'd like to update the tidylib example code showing how to set the language, but
  setlocale(LC_ALL, "");
  tidySetLanguage( setlocale(LC_MESSAGES, NULL) );
probably isn't a good example if LC_MESSAGES is missing on some systems.

Thanks
Lee

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: i686-w64-mingw32-gcc: LC_MESSAGES
  2019-01-09 19:43       ` Lee
@ 2019-01-09 23:41         ` Brian Inglis
  2019-01-10  0:07           ` Lee
  2019-01-09 23:43         ` JonY
  1 sibling, 1 reply; 9+ messages in thread
From: Brian Inglis @ 2019-01-09 23:41 UTC (permalink / raw)
  To: cygwin


On 2019-01-09 12:43, Lee wrote:
> On 1/9/19, Douglas Coup  wrote:
>>
>> On 1/9/2019 1:14 PM, Lee wrote:
>>> On 1/9/19, JonY  wrote:
>>>> On 1/8/19 9:26 PM, Lee wrote:
>>>>> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html
>>>>> has a note for LC_MESSAGES:
>>>>> The functionality described is an extension to the ISO C standard. 
>>>>> Application developers may make use of an extension as it is 
>>>>> supported on all POSIX.1-2017-conforming systems.
>>>>> i686-w64-mingw32-gcc doesn't have LC_MESSAGES defined.
>>>>> Is that an oversight, something missing in windows, or .. ??
>>>> Windows MSVCR isn't POSIX nor ISO C compliant, so you shouldn't be
>>>> referring to opengroups, only against MSDN.
>>> What's a Windows MSVCR?
>>> Since the same program compiled with cygwins' gcc has LC_MESSAGES
>>> defined, I was guessing it was just a library thing and maybe it just
>>> hadn't been implemented in the mingw libraries yet.. but it sounds
>>> like it's not an oversight & Microsoft needs to support LC_MESSAGES
>>> before i686-w64-mingw32-gcc will.  Is that about right?
>> MSVCR = MicroSoft Visual C Run-time (I think)
> Meaning i686-w64-mingw32-gcc uses the Microsoft libraries vs. cygwin
> gcc using posix compliant libraries?  Implying LC_MESSAGES not being
> defined is yet another instance of Microsoft not following accepted
> standards?
> The background for my question is https://github.com/htacg/tidy-html5/issues/770
> Tidy removed the setlocale call from the library init function, so if
> users want a specific locale/language they're going to have to set it
> up themselves.
> I'd like to update the tidylib example code showing how to set the language, but
>   setlocale(LC_ALL, "");
>   tidySetLanguage( setlocale(LC_MESSAGES, NULL) );
> probably isn't a good example if LC_MESSAGES is missing on some systems.

You have to convert your messages to Windows message resources in your build,
then link and package Windows message resources with non-POSIX compliant exes,
or add a POSIX message implementation to your exes.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: i686-w64-mingw32-gcc: LC_MESSAGES
  2019-01-09 19:43       ` Lee
  2019-01-09 23:41         ` Brian Inglis
@ 2019-01-09 23:43         ` JonY
  2019-01-10  0:51           ` Lee
  1 sibling, 1 reply; 9+ messages in thread
From: JonY @ 2019-01-09 23:43 UTC (permalink / raw)
  To: cygwin


[-- Attachment #1.1: Type: text/plain, Size: 1213 bytes --]

On 1/9/19 7:43 PM, Lee wrote:
>> MSVCR = MicroSoft Visual C Run-time (I think)
> 

Yes, as implemented by msvcrt.dll.

> Meaning i686-w64-mingw32-gcc uses the Microsoft libraries vs. cygwin
> gcc using posix compliant libraries?  Implying LC_MESSAGES not being
> defined is yet another instance of Microsoft not following accepted
> standards?
> 

Cygwin has its own runtime, Windows has its own. Microsoft does whatever
it well pleases, it never did claim POSIX or ISO C compliance.

See the printf/scanf hacks in mingw.

> The background for my question is https://github.com/htacg/tidy-html5/issues/770
> Tidy removed the setlocale call from the library init function, so if
> users want a specific locale/language they're going to have to set it
> up themselves.
> I'd like to update the tidylib example code showing how to set the language, but
>   setlocale(LC_ALL, "");
>   tidySetLanguage( setlocale(LC_MESSAGES, NULL) );
> probably isn't a good example if LC_MESSAGES is missing on some systems.
> 
> Thanks
> Lee
> 

Unfortunately, I don't know how that should be implemented on top of a
proprietary runtime layer, or any alternative function calls for that
matter.



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: i686-w64-mingw32-gcc: LC_MESSAGES
  2019-01-09 23:41         ` Brian Inglis
@ 2019-01-10  0:07           ` Lee
  0 siblings, 0 replies; 9+ messages in thread
From: Lee @ 2019-01-10  0:07 UTC (permalink / raw)
  To: cygwin

On 1/9/19, Brian Inglis  wrote:
>
> On 2019-01-09 12:43, Lee wrote:
>> On 1/9/19, Douglas Coup  wrote:
>>>
>>> On 1/9/2019 1:14 PM, Lee wrote:
>>>> On 1/9/19, JonY  wrote:
>>>>> On 1/8/19 9:26 PM, Lee wrote:
>>>>>> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html
>>>>>> has a note for LC_MESSAGES:
>>>>>> The functionality described is an extension to the ISO C standard.
>>>>>> Application developers may make use of an extension as it is
>>>>>> supported on all POSIX.1-2017-conforming systems.
>>>>>> i686-w64-mingw32-gcc doesn't have LC_MESSAGES defined.
>>>>>> Is that an oversight, something missing in windows, or .. ??
>>>>> Windows MSVCR isn't POSIX nor ISO C compliant, so you shouldn't be
>>>>> referring to opengroups, only against MSDN.
>>>> What's a Windows MSVCR?
>>>> Since the same program compiled with cygwins' gcc has LC_MESSAGES
>>>> defined, I was guessing it was just a library thing and maybe it just
>>>> hadn't been implemented in the mingw libraries yet.. but it sounds
>>>> like it's not an oversight & Microsoft needs to support LC_MESSAGES
>>>> before i686-w64-mingw32-gcc will.  Is that about right?
>>> MSVCR = MicroSoft Visual C Run-time (I think)
>> Meaning i686-w64-mingw32-gcc uses the Microsoft libraries vs. cygwin
>> gcc using posix compliant libraries?  Implying LC_MESSAGES not being
>> defined is yet another instance of Microsoft not following accepted
>> standards?
>> The background for my question is
>> https://github.com/htacg/tidy-html5/issues/770
>> Tidy removed the setlocale call from the library init function, so if
>> users want a specific locale/language they're going to have to set it
>> up themselves.
>> I'd like to update the tidylib example code showing how to set the
>> language, but
>>   setlocale(LC_ALL, "");
>>   tidySetLanguage( setlocale(LC_MESSAGES, NULL) );
>> probably isn't a good example if LC_MESSAGES is missing on some systems.
>
> You have to convert your messages to Windows message resources in your
> build, then link and package Windows message resources with non-POSIX
> compliant exes, or add a POSIX message implementation to your exes.

I'm just trying to come up with example code for how to set the locale
& language in the tidylib documentation; thankfully, me building a
native windows version of tidy isn't the goal..  I was just trying out
code that worked under cygwin & was a bit surprised it wouldn't even
compile for windows.  But it seems to be a windows limitation, so
[snip snarky comment]

Regards,
Lee

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: i686-w64-mingw32-gcc: LC_MESSAGES
  2019-01-09 23:43         ` JonY
@ 2019-01-10  0:51           ` Lee
  0 siblings, 0 replies; 9+ messages in thread
From: Lee @ 2019-01-10  0:51 UTC (permalink / raw)
  To: cygwin

On 1/9/19, JonY  wrote:
> On 1/9/19 7:43 PM, Lee wrote:
>>> MSVCR = MicroSoft Visual C Run-time (I think)
>>
>
> Yes, as implemented by msvcrt.dll.

cool - makes much more sense now.  Thank you!

>> Meaning i686-w64-mingw32-gcc uses the Microsoft libraries vs. cygwin
>> gcc using posix compliant libraries?  Implying LC_MESSAGES not being
>> defined is yet another instance of Microsoft not following accepted
>> standards?
>>
>
> Cygwin has its own runtime, Windows has its own. Microsoft does whatever
> it well pleases, it never did claim POSIX or ISO C compliance.
>
> See the printf/scanf hacks in mingw.
>
>> The background for my question is
>> https://github.com/htacg/tidy-html5/issues/770
>> Tidy removed the setlocale call from the library init function, so if
>> users want a specific locale/language they're going to have to set it
>> up themselves.
>> I'd like to update the tidylib example code showing how to set the
>> language, but
>>   setlocale(LC_ALL, "");
>>   tidySetLanguage( setlocale(LC_MESSAGES, NULL) );
>> probably isn't a good example if LC_MESSAGES is missing on some systems.
>>
>
> Unfortunately, I don't know how that should be implemented on top of a
> proprietary runtime layer, or any alternative function calls for that
> matter.

Me either, which is why I was trying to keep it limited to system
calls.  But tidySetLanguage( setlocale(LC_ALL, NULL) ); isn't a good
idea because setlocale returns a string starting with the value of
LC_COLLATE & I suspect there's plenty enough others that prefer ascii
sort order to dictionary sort order or whatever it's called.

^shrug^ since it is just example code, if LC_MESSAGES isn't defined
maybe just tell them to pick a default & use that...

Thanks
Lee

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-01-10  0:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-08 21:26 i686-w64-mingw32-gcc: LC_MESSAGES Lee
2019-01-09 10:21 ` JonY
2019-01-09 18:14   ` Lee
2019-01-09 18:19     ` Douglas Coup
2019-01-09 19:43       ` Lee
2019-01-09 23:41         ` Brian Inglis
2019-01-10  0:07           ` Lee
2019-01-09 23:43         ` JonY
2019-01-10  0:51           ` Lee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).