X-Received: by 2002:a05:620a:24c8:b0:767:36d8:b67d with SMTP id m8-20020a05620a24c800b0076736d8b67dmr59172qkn.4.1689460455859; Sat, 15 Jul 2023 15:34:15 -0700 (PDT) X-Received: by 2002:a05:6808:1788:b0:3a3:9990:f396 with SMTP id bg8-20020a056808178800b003a39990f396mr10753982oib.11.1689460455639; Sat, 15 Jul 2023 15:34:15 -0700 (PDT) Path: csiph.com!1.us.feeder.erje.net!3.eu.feeder.erje.net!feeder.erje.net!fdn.fr!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.os.os2.programmer.misc Date: Sat, 15 Jul 2023 15:34:15 -0700 (PDT) In-Reply-To: <83234834-db2d-42ac-8bc6-0fcf631f53b9n@googlegroups.com> Injection-Info: google-groups.googlegroups.com; posting-host=37.48.24.87; posting-account=M0HM6QoAAADN6I0fdAn6f6_AFrdXmFjO NNTP-Posting-Host: 37.48.24.87 References: <83234834-db2d-42ac-8bc6-0fcf631f53b9n@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <7ee4e13c-63ae-4c02-a17d-b183c5045e92n@googlegroups.com> Subject: Re: win32 via odin From: xhajt03 Injection-Date: Sat, 15 Jul 2023 22:34:15 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: csiph.com comp.os.os2.programmer.misc:1713 On Saturday, July 15, 2023=C2=A0at=C2=A07:02:14 UTC+2, Paul Edwards wrote: . . > > > However, programs of mine that use ANSI escape codes=20 > > > do not work properly - the ESC appears to be ignored/=20 > > > swallowed.=20 >=20 > > Not sure about that one, perhaps someone else has some insight. > I have confirmed that when I build my own OS/2 native=20 > executables, the escape sequences take effect. I believe that Win32 console applications executed via Odin are actually ru= n in a PM window rather than a real OS/2 console window and ANSI codes are = probably not interpreted there. > So if I go the route of writing a public domain, somewhat=20 > minimal, win32 environment for OS/2, I know that the=20 > escapes will get through.=20 >=20 > However, I still have a problem with keyboard input. I=20 > need to get ANSI escapes - or at least - something -=20 > when I press the different cursor keys. Otherwise my=20 > version of microemacs 3.6 (also public domain - that=20 > older version) won't work.=20 >=20 > So I wrote a test program, and if I build it as a win32=20 > executable (using pdpclib) and run it under "pec", all=20 > the cursor keys generate a x'e0'.=20 >=20 > If I instead build an OS/2 native executable (also with=20 > pdpclib), I don't get any input at all.=20 >=20 > The "keys off" command doesn't change either of=20 > the above.=20 >=20 > PDPCLIB is using this code:=20 >=20 > C:\devel\pdos\pdpclib>git diff stdio.c=20 > diff --git a/pdpclib/stdio.c b/pdpclib/stdio.c=20 > index 685e3e4c..f6b837e6 100644=20 > --- a/pdpclib/stdio.c=20 > +++ b/pdpclib/stdio.c=20 > @@ -1921,6 +1921,7 @@ static void iread(FILE *stream, void *ptr, size_t t= oread, size_t *actualRead)=20 >=20 >=20 > #ifdef __OS2__=20 > +printf("about to do dosread of %d\n", (int)stream->hfile);=20 > rc =3D DosRead(stream->hfile, ptr, toread, &tempRead);=20 > if (rc !=3D 0)=20 > {=20 >=20 > C:\devel\pdos\pdpclib>=20 >=20 >=20 > ie doing a DosRead from handle 0.=20 >=20 > I thought there might be a DosDevIOCtl that governs this=20 > behavior, so I went looking for the documentation.=20 >=20 > I was surprised that this was all I could find online:=20 >=20 > http://www.edm2.com/index.php/DosDevIOCtl=20 >=20 > which is insufficient. I actually need three things for=20 > a fullscreen editor like microemacs:=20 >=20 > 1. Cursor keys to come through with unique codes.=20 > 2. Echo switched off.=20 > 3. Line buffering switched off.=20 >=20 > On MSDOS I can use INT 21H AH=3D44H to change those=20 > last two things. But without documentation I don't know=20 > if the equivalent exists in OS/2. I know what is required=20 > in Windows too. > > > In addition, the doco says that the driver is no longer=20 > > > working, so I need to run everything via pec. Which=20 > > > probably means I need to provide my own shell.=20 > > > Which I can probably do, as I have 3 flavors of my=20 > > > shell already (for 3 different flavors of PDOS).=20 >=20 > > Wonder if it is possible to run PDOS in a DOS session? > PDOS/86 is an 8086 OS, so it would be a replacement=20 > for OS/2's DOS, and not be useful regardless.=20 >=20 > But PDOS/386 has the infrastructure to do 32-bit for=20 > Windows, so as above - I can potentially do what I want=20 > in an OS/2 window.=20 >=20 > Although - I just realized while typing this that I could=20 > possibly install HX into a DOS window to run everything.=20 >=20 > I come close to being able to do that in Freedos+HX=20 > already. > > > But that won't really work without ANSI escapes. ;-----;;;;;;; > I think the VIO thing is what is swallowing the ESC character.=20 > And what I need to do is switch to standard streams.=20 I don't think that you can ever get cursor keys from stdin under OS/2 - onl= y regular characters are delivered that way. You'd need to use the (16-bit)= kbdcalls with thunking, or some wrapper around it (EMXWRAP.DLL from EMX ru= ntime, or something else). Tomas