Deutsch English Français Italiano |
<20240822102243.459@kylheku.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Kaz Kylheku <643-408-1753@kylheku.com> Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc Subject: Re: Python (was Re: I did not inhale) Date: Thu, 22 Aug 2024 17:36:04 -0000 (UTC) Organization: A noiseless patient Spider Lines: 96 Message-ID: <20240822102243.459@kylheku.com> References: <uu54la$3su5b$6@dont-email.me> <uvbfii$3mom0$1@news.xmission.com> <20240412094809.811@kylheku.com> <87il0mm94y.fsf@tudado.org> <way-20240413091747@ram.dialup.fu-berlin.de> <87il0lldf8.fsf@tudado.org> <choices-20240413123957@ram.dialup.fu-berlin.de> <v9lm2k$12qhv$1@dont-email.me> <v9m4gd$14scu$1@dont-email.me> <20240815182717.189@kylheku.com> <v9npls$1fjus$1@dont-email.me> <v9t204$2dofg$1@dont-email.me> <va28pi$3dldm$1@dont-email.me> <va2ro9$3gd7v$1@dont-email.me> <va2vt0$3h3gj$1@dont-email.me> <va44rh$3p1l6$1@dont-email.me> <va45gv$3pilh$1@dont-email.me> <va4b0i$3q4g0$2@dont-email.me> <va5u2q$1uhn$3@dont-email.me> <va75ob$dfb0$2@dont-email.me> <va77gb$dr7n$1@dont-email.me> <20240822082202.318@kylheku.com> <va7n47$g5ck$1@dont-email.me> Injection-Date: Thu, 22 Aug 2024 19:36:04 +0200 (CEST) Injection-Info: dont-email.me; posting-host="90d9ee9f577d3e1dd330bc58c9f42403"; logging-data="556947"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18rlYm8FLMOXS6trXcG3V9ZLpXztojna2Q=" User-Agent: slrn/pre1.0.4-9 (Linux) Cancel-Lock: sha1:OY7zOZ3jM0bXHSjVodDfsqVxjTk= Bytes: 5058 On 2024-08-22, Bart <bc@freeuk.com> wrote: > On 22/08/2024 16:28, Kaz Kylheku wrote: >> On 2024-08-22, Dmitry A. Kazakov <mailbox@dmitry-kazakov.de> wrote: >>> On 2024-08-22 13:00, David Brown wrote: >>> >>>> Then there are those that - wisely or unwisely - program in C for >>>> Windows, without POSIX. >>> >>> Yes, that is true. There is no reason to use POSIX under Windows, >>> whatsoever. >> >> David also wrote this, in the same comment: >> >>>> It takes but one single counter-example to invalidate general claims >>>> like this. >> >> It applies to your reply as well. >> >> There are excellent, excellent reasons to use POSIX under Windows. >> >> Such as, oh, having an entire POSIX appliation ported to Windows >> almost without lifting a finger. >> >> For the TXR project I use a POSIX layer called Cygnal (see signature >> below). It gives a decent Windows port which preserves most of the >> functionality. All the POSIX stuff in the TXR Lisp standard library just >> works. The interactive listener ("REPL") with history and editing just >> works, right in your cmd.exe console. >> > > You can use the same argument to justify using X11 under Windows. I could use a similar argument, but it would lack nuance. Using X11 under Windows requires a server component, which is somewhat clunky for a stand-alone application to carry. X11 windows will not integrate nicely into the Windows desktop as native windows with native widgets and behaviors. Most POSIX stuff does translate nicely to the Windows environment, largely because Windows was aped after Unix. > (It's also not clear how well your product manages to use POSIX under > pure Windows, or whether you have to drag this other thing called 'CygWin'. It relies on a DLL, which is a modified/forked version of the Cygwin DLL, named cygwin1.dll. This just sits in the same directory as the main executable. If you wrote a program with Microsoft Visual C, and dynamically linked it to its run-time, you'd have the same thing: your executable and a redistributable run-time. The cygwin1.dll provides C stuff: malloc, printf, sin, cos, ... Plus POSIX stuff: glob, ftw, fork, dup2, stat, tcgetattr, ... > Can you write a normal Windows app and just call into a DLL called > posix.dll or is there an extra layer or two involved?) You can use Win32 calls (into kernel32.dll, user32.dll, ...) along side all that stuff from cygwin1.dll, just like you can use Win32 calls in a program linked to MSVC redistributable run-time. Here is an example TXR Lisp program that I use for turning a laptop monitor off. It's saved as "monitor-off.tl", where the .tl suffix has the correct association that I can launch it by double clicking on it. The (usleep ...) call is implemented using POSIX functions. (typedef HWND (cptr HWND)) (typedef UINT uint) (typedef LPARAM long) (typedef WPARAM ulong) (defsymacro SC_MONITORPOWER #xF170) (defsymacro WM_SYSCOMMAND #x0112) (defsymacro MONITOR_OFF 2) (defvarl HWND_BROADCAST (cptr-int -1 'HWND)) (with-dyn-lib "user32.dll" (deffi PostMessage "PostMessageW" int (HWND UINT WPARAM LPARAM))) (usleep 2000000) (PostMessage HWND_BROADCAST WM_SYSCOMMAND SC_MONITORPOWER MONITOR_OFF) -- TXR Programming Language: http://nongnu.org/txr Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal Mastodon: @Kazinator@mstdn.ca