i686-w64-mingw32-gcc: LC_MESSAGES

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

i686-w64-mingw32-gcc: LC_MESSAGES

Lee-83
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

Reply | Threaded
Open this post in threaded view
|

Re: i686-w64-mingw32-gcc: LC_MESSAGES

JonY
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.


signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: i686-w64-mingw32-gcc: LC_MESSAGES

Lee-83
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

Reply | Threaded
Open this post in threaded view
|

Re: i686-w64-mingw32-gcc: LC_MESSAGES

Douglas Coup

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

Reply | Threaded
Open this post in threaded view
|

Re: i686-w64-mingw32-gcc: LC_MESSAGES

Lee-83
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

Reply | Threaded
Open this post in threaded view
|

Re: i686-w64-mingw32-gcc: LC_MESSAGES

Brian Inglis

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

Reply | Threaded
Open this post in threaded view
|

Re: i686-w64-mingw32-gcc: LC_MESSAGES

JonY
In reply to this post by Lee-83
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.



signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: i686-w64-mingw32-gcc: LC_MESSAGES

Lee-83
In reply to this post by Brian Inglis
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

Reply | Threaded
Open this post in threaded view
|

Re: i686-w64-mingw32-gcc: LC_MESSAGES

Lee-83
In reply to this post by JonY
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