help-make
[Top][All Lists]
Advanced

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

Re: Gmake UTF-8 Support?


From: Kaz Kylheku (gmake)
Subject: Re: Gmake UTF-8 Support?
Date: Fri, 01 Oct 2021 12:23:59 -0700
User-agent: Roundcube Webmail/0.9.2

On 2021-10-01 08:58, Eli Zaretskii wrote:
From: Dan Kegel <dank@kegel.com>
Date: Fri, 1 Oct 2021 08:11:53 -0700
Cc: help-make@gnu.org

https://developercommunity.visualstudio.com/t/create-a-utf8-c-runtime/351432
has some info from 2020 about utf-8 locale support in recent builds of
windows.

Yes, I know.  But note a caveat: you need to use the Universal C
Runtime to get that in CRT.  AFAIK, that could mean legal problems,
and in any case it's available only on the latest versions of Windows.
I don't think MinGW supports that, but maybe I'm mistaken.  Also, it
isn't clear which Win32 APIs support that it is not documented, AFAIK.
It is important to know about Win32 APIs because CRT is limited in
what it can do.  And after all that, there are bugs and misfeatures as
documented in that issue and elsewhere on the net.

Even Windows 10 has yet some way to go before ports of Free Software
could use the UTF-8 support built into it.  And that's even before we
consider what can one do if one wants their program to run on versions
of Windows older than the latest and the greatest.

I made a solution for my own projects that I'm happy with;

I took the Cygwin DLL and created a fork which reverses some of the
behaviors that are "too POSIXy", like path handling, without throwing
out the entire baby with the bathwater, so to speak.

I called the library Cygnal (Cygwin Native Application Library).

http://www.kylheku.com/cygnal/

You simply build your program in Cygwin as a Cygwin program, and
can slide this alternative cygwin1.dll under it.

Or that's the "sales pitch" at least.

Of course, due to the behavioral changes, any program needs
careful validation and possibly some nonzero amount of additional
porting effort.

If your program is a POSIX program from the freeware Unix-like
world, that effort will almost certainly be orders of magnitude
less than going to Microsoft libraries.

Here is a demo of some of it, through the lens of a Lisp.

This Lisp was built on Cygwin as a normal Cygwin program.

1> (chdir "C:\\Windows")
t
2> (pwd)
"C:/Windows"
3> (chdir "D:")
t
4> (pwd)
"D:/"
5> (chdir "C:")
t
6> (pwd) ;; directory associated with C drive remembered
"C:/Windows"
7> (chdir "D:")
t
8> (open-directory "C:System32") ;; drive-relative path passed to opendir function.
#<dir-stream 6ffffef0760>
9> (get-line *9)
"0409"
10> (get-line *9)
"69fe178f-26e7-43a9-aa7d-2b616b672dde_eventlogservice.dll"
11> (get-line *9)
"6bea57fb-8dfb-4177-9ae8-42e8b3529933_RuntimeDeviceInstall.dll"
12> (getenv "PATH") ;; unmodified Windows PATH with semicolons and backslashes
"C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program
 Files\\PuTTY\\;C:\\Program Files\\txr\\bin;"
13> (sh "echo %HOME%") ;; interpreter is cmd.exe; HOME points to USERPROFILE
C:\Users\kazk
0
14> (uname) ;; Am I on Cygwin or Cygnal? Check sysname in struct utsname #S(utsname sysname "CYGNAL_NT-10.0" nodename "W10P26222-Kazk" release "2.9.0(0.318/5/3)"
           version "2017-11-17 13:10" machine "x86_64" domainname nil)


Kind of way off topic sorry!

Cheers ....








reply via email to

[Prev in Thread] Current Thread [Next in Thread]