[M3devel] religion, philosophy, Posix vs. Win32

Daniel Alejandro Benavides D. dabenavidesd at yahoo.es
Mon Jan 14 03:32:37 CET 2008


Hi all,
Yes, I also noticed the Time.T issue in pm3 1.1.15 because I was trying to get compiled m3browser and I finally arranged to do that, but the program just broke, and I didn't know about cygwin differences against a real UNIX platform.

Also in that pm3 NT386GNU, the winvbt implementation was the one of dec-src not like current cm3 winvbt (that use WIDECHAR as I remember)

I tried to have the same interfaces to be able to use from m3browser.
Now fortunately you can compile m3browser with NT386 cm3 platform.

I just liked very much the way one can make a bootstrap from pm3 from one platform to another and make a minimal compiler for NT386GNU:
http://tkb.mpl.com/~tkb/software/misc/pm3-NT386GNU.patch

I couldn't repeat the above link instructions in a Debian Sarge machine, with all the pm3 Debian packages installed (available in the Debian Woody http://archive.debian.org/pool/main/p/pm3/ ) I think the reason was I was unable to do all the bootstrap process http://archive.debian.org/pool/main/p/pm3-i386


I would like to have that kind of posix to cygwin capability of port at least a minimal compiler/runtime system.

Also, talking  about the topic of port NT386 to NT386GNU (more than a year ago) I got some answer from Bert Laverman, 

Daniel Benavides wrote: 
 > What if we use the cygwin platform to run cm3, an use its runtime 
 > of linker and c Compiler? 
 "Normally this involves a speed penalty, because cygwin will emulate 
 a UNIX environment, and has to translate this to Windows calls. The 
 advantage is of course that you can ignore most differences between 
 Windows and UNIX. 
 If you don't want the speed penalty, and can take care of the 
 platform differences, then you can use the -mno-cygwin flag. However, 
 make sure you use only "real" Windows API calls." 
 

 Bert Laverman



Thanks



Mika Nystrom <mika at async.caltech.edu> escribió: Jay,

I don't know if this is completely responsive to your question, and
take it with a grain of salt because I have never programmed on a
"pure" Windows system (and God willing, I never shall).

I expect the NT386GNU target, Cygwin, Windows-POSIX, whatever you
call it, to look as much as Unix "as possible."  (Obviously not,
but as "reasonable".)  The main things are (1) yes, /bin/sh, and
(2) Unix (POSIX?) libc---Modula-3 does a good job of covering up
the basic stuff so you don't need to worry about it for the most
part, but sometimes, just sometimes, you need to get, say, some
system information that doesn't have an existing M3 interface (say
the amount of free diskspace or something like that).  Then you
should be able to call C code that is portable between Unix and
Windows.

One thing that is bizarre about the old NT386GNU PM3 that doesn't
conform to the above description: it uses Windows Time.T.  It's all
the more bizarre because Cygwin uses Unix time_t.  (Time.Now and
time(3) are off by a couple of hundred years on NT386GNU, whereas
they are the same on all Unixes.)  I am sure there are other things.
Oh yes, the open-file (default) locking semantics are different
too.  Those two are actually the only differences that I noticed
in the programming environments.

     Mika

Jay writes:
>--_d0659847-2f20-454a-9665-5df3b5ce2832_
>Content-Type: text/plain; charset="iso-8859-1"
>Content-Transfer-Encoding: quoted-printable
>
>The conclusion here is:
> Just try to convince me otherwise. :)
>
>The gist of the question is:
>  Just what characteristics of "Posix" and "Win32" should "NT386GNU" have?
>
> Just what characteristics of "Posix" do people notice and like?
>You can't say "the whole thing". :)
>
>Restated:
>
>What is Posix? I don't mean, where is the standard document web site.
>I mean what is it TO YOU?
>
>Is it open/read/write/close?
>Is it fork?
>Is it sbrk?
>  On these previous ones, they are interesting to many programmers,
> but Modula-3 already layers over all this, so these are unlikely defining
>characteristics here.
>
>Is it sh? Probably somewhat. But if have you sat in Cygwin sh much vs. cmd?
> It is annoying. Command line history is flaky. Paths are munged to say /cy=
>gdrive.
> You lose the critical F8 command line completion against history feature.
>  You lose a lot of editing capability, but do gain some alternate possibly=
> "portable"
>  similar.
>
>Is it Perl? No.
>Is it X Windows. I doubt it.
>Is it pthreads? Probably not.
>  Or at least vtalarm? Maybe?
>  Or setjmp/longjmp? Ok.
>    Longjmp to the same buffer multiple times? Not likely.
>    Longjmp to a place that has already returned? Not likely.
>All full paths starting with a forward slash? Maybe.
>  Backward slash being a valid non-seperator path character? Maybe.
>
>Think about that last one.
>It is valid and occurs in Win32 code to treat forward slash and backward sl=
>ash the same.
>Some code does, some code does not.
>What if you just did that unconditionally, like even in Posix?
>What is the role of backward slash in Posix paths? It either just doesn't o=
>ccur,
>or is an escape character, or is a regular character. Something at a low le=
>vel
>could replace the backward slashes with forward slashes.
>
>I would like to change the code in m3-sys/cm3/m3path.m3 to treat backward s=
>lashes
>and forward slashes the same. Backward slashes just won't occur on Posix, r=
>ight?
>So far I have managed without this change, but not having it has bitten me =
>a few times.
>I do have the analogous change to the Win32 path code in m3core.
>
>It is the redundant filenames libfoo.a instead of foo.lib and libfoo.so ins=
>tead of foo.so?
>Perhaps. This seems dumb, redundant to me. Why have prefixes and suffixes?
>Don't suffixes suffice?
>
>That all said, I remain convinced that a useful intermediate or probably en=
>dpoint
>is a toolset that targets Windows using cm3cg, ld, as, but otherwise looks =
>like
>NT386 as much as possible. MAYBE alter the library names to libfoo.*.
>
>sh and make are needed for building cm3cg.
>I did use Cygwin for that. MinGWin sounds promising here too but I haven't =
>tried.
>
> - Jay
>
>
>_________________________________________________________________
>Get the power of Windows + Web with the new Windows Live.
>http://www.windowslive.com?ocid=3DTXT_TAGHM_Wave2_powerofwindows_012008=
>
>--_d0659847-2f20-454a-9665-5df3b5ce2832_
>Content-Type: text/html; charset="iso-8859-1"
>Content-Transfer-Encoding: quoted-printable
>
>
>
>
>.hmmessage P
>{
>margin:0px;
>padding:0px
>}
>body.hmmessage
>{
>FONT-SIZE: 10pt;
>FONT-FAMILY:Tahoma
>}
>
>
>The conclusion here is:
 Just try to conv=
>ince me otherwise. :)

The gist of the question is:
  Just wh=
>at characteristics of "Posix" and "Win32" should "NT386GNU" have?

&n=
>bsp;Just what characteristics of "Posix" do people notice and like?
You =
>can't say "the whole thing". :)

Restated:

What is Posix? I do=
>n't mean, where is the standard document web site.
I mean what is it TO =
>YOU?

Is it open/read/write/close?
Is it fork?
Is it sbrk?
&=
>nbsp; On these previous ones, they are interesting to many programmers,
=
> but Modula-3 already layers over all this, so these are unlikely defi=
>ning
characteristics here.

Is it sh? Probably somewhat. But if ha=
>ve you sat in Cygwin sh much vs. cmd?
 It is annoying. Command line=
> history is flaky. Paths are munged to say /cygdrive.
 You lose the=
> critical F8 command line completion against history feature.
  You=
> lose a lot of editing capability, but do gain some alternate possibly "por=
>table"
  similar.

Is it Perl? No.
Is it X Windows. I doub=
>t it.
Is it pthreads? Probably not.
  Or at least vtalarm? Maybe=
>?
  Or setjmp/longjmp? Ok.
    Longjmp to the sam=
>e buffer multiple times? Not likely.
    Longjmp to a pla=
>ce that has already returned? Not likely.
All full paths starting with a=
> forward slash? Maybe.
  Backward slash being a valid non-seperator=
> path character? Maybe.

Think about that last one.
It is valid an=
>d occurs in Win32 code to treat forward slash and backward slash the same.<=
>br>Some code does, some code does not.
What if you just did that uncondi=
>tionally, like even in Posix?
What is the role of backward slash in Posi=
>x paths? It either just doesn't occur,
or is an escape character, or is =
>a regular character. Something at a low level
could replace the backward=
> slashes with forward slashes.

I would like to change the code in m3=
>-sys/cm3/m3path.m3 to treat backward slashes
and forward slashes the sam=
>e. Backward slashes just won't occur on Posix, right?
So far I have mana=
>ged without this change, but not having it has bitten me a few times.
I =
>do have the analogous change to the Win32 path code in m3core.

It is=
> the redundant filenames libfoo.a instead of foo.lib and libfoo.so instead =
>of foo.so?
Perhaps. This seems dumb, redundant to me. Why have prefixes =
>and suffixes?
Don't suffixes suffice?

That all said, I remain con=
>vinced that a useful intermediate or probably endpoint
is a toolset that=
> targets Windows using cm3cg, ld, as, but otherwise looks like
NT386 as =
>much as possible. MAYBE alter the library names to libfoo.*.

sh and =
>make are needed for building cm3cg.
I did use Cygwin for that. MinGWin s=
>ounds promising here too but I haven't tried.

 - Jay



> />
---------------------------------
Get the power of Windows + Web with the new Windows Live. >=3D'http://www.windowslive.com?ocid=3DTXT_TAGHM_Wave2_powerofwindows_012008=
>' target=3D'_new'>Get it now!
>=
>
>--_d0659847-2f20-454a-9665-5df3b5ce2832_--


       
---------------------------------

Web Revelación Yahoo! 2007:
 Premio Favorita del Público - ¡Vota tu preferida!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20080114/949c98c6/attachment-0002.html>


More information about the M3devel mailing list