[M3devel] serial/Cygwin
Randy Coleburn
rcoleburn at scires.com
Thu Dec 18 21:46:26 CET 2008
I do use Cygwin on occasion, but I'm not sure how most Cygwin users feel about it and Modula-3.
Mika has a point that if you want to create an environment on Windows that is devoid of Microsoft tools, the Cygwin Modula-3 may be what you are looking for.
On the other hand, I am in a camp of folks who don't mind using the Microsoft tools and want Modula-3 to work out of the box on Windows without having to add any other non-Microsoft stuff (like Cygwin).
I think it is great for CM3 to be able to support both these camps!
Thus, you will find me always advocating for keeping the "CM3 on Windows variant" where it will work on Windows using just the Microsoft tools. I am happy with the use of Windows threads and the native backend and use of the MS Visual Studio linker.
Regards,
Randy Coleburn
>>> Mika Nystrom <mika at async.caltech.edu> 12/17/2008 10:10 PM >>>
Do Cygwin users really care about all that stuff?
The point of using Modula-3 on Cygwin is to turn a yucky Windows
machine as close as possible into a friendly Unix environment...
not to use a bunch of Microsoft tools and libraries---I would have
thought that if you wanted to use Visual X-Y-Z then you wouldn't
be using Cygwin but would be using the native Windows environment?
So yes I find it a bit odd that the ancient PM3-Klagenfurt I still
occasionally use on Windows uses Windows threads and has its own
compiler back-end. But it's kind of cool too and since it's not
really distinguishable from user-level threads and gcc I just think
"great" and get on with it. In fact I'm not even sure it uses
the integrated back end now that I think about it.
I think what I'm saying is that almost no Cygwin users are terribly
interested in Microsoft interfaces, and I would bet most Cygwin
users aren't even aware of the existence of most Microsoft tools.
They (we) want as little to do with Windows as possible....
Mika
Jay writes:
>--_c7ada8a5-5684-4472-b0c7-b49c8c279dc2_
>Content-Type: text/plain; charset="iso-8859-1"
>Content-Transfer-Encoding: quoted-printable
>
>
>
>From: TonyTo: jay
>I would have thought of CygWin as a POSIX platform that just happens to hav=
>e Windows underneath. Did we go round this roundabout before?
>
>
>
>
>
>It's more complicated than that.
>It isn't just one bit.
>There's a few factors=2C that people care more and less about.
> GUI library -- Win32 or X
> thread library -- pthreads or Win32 (or user threads)=20
> file system path representation -- forward slashes or backward slashes =
> This seems to be what people care most about -- to see forward slashes.
> C compiler -- Visual C++ cl or Cygwin/GNU gcc
> linker -- Visual C++ link or Cygwin/GNU ld=20
> C runtime -- msvcr*.dll or cygwin1.dll=20
> integrated backend or not The integrated backend is way faster=2C but=
> doesn't yet support 64bit LONGINT.
> which debugger/symbol format -- gdb/stabs or windbg/VisuaStudio/CodeView/=
>pdb
>Many of these factors are independent of each other=2C but not entirely.
>Compiler/linker directly lead to which debugger you can use=2C since they =
>each use different formats.
>Well=2C you can use either debugger=2C but..without symbols..at least for s=
>ome modules.
>The Cygwin C runtime and Visual C++ linker disagreeon the name of __ImageBa=
>se=2C so you can't link to the Cygwin C runtime with theVisual C++ linker. =
>This is probably fixable at least in one combination withan alias (ability =
>to link Cygwin C runtime with Visual C++ linker=3B I don'tknow if Cygwin/GN=
>U ld understands aliases).
>I have also found that Cygwin produces incorrectimport .libs=2C perhaps the=
>ir linker somehow accepts them.
>=20
>Cygwin can program the Win32 GUI=2C but there is an issue with passing 8 by=
>te structs by value to __stdcall functions=2C the function name isn't mangl=
>ed correctly and linking fails.
>It is a bit of a combinatorial explosion.As the system stands=2C you can co=
>ntrol each bit in the config file=2C andmultiple combinations might work=2C=
> though I don't run any combinatorial tests.
>Three combinations are "identified" (named=2C spoken of) and have had some =
>development testing.NT386=2C NT386MINGNU (which I think should be called I3=
>86_MINGWIN)=2C and NT386GNU (which I think should be called I386_CYGWIN).
>Furthermore=2C you can imagine I386_INTERIX and I386_UWIN (I forget if that=
>'s the name).Interix and UWIN being two other very viable Posix layers on W=
>indows.Interix has been renamed a few times. It is called "SFU" -- services=
> for Unix=2C and I don't know=2Clike SUA -- services for unix applications=
>=2C and I think there's another name.It is a free download from Microsoft f=
>or x86 Windows < Vista=2C and is an optional component in Vista.It has its =
>pluses and minuses..not now.
>Anyway=2C in conversation here=2C one of the main things that people DO NOT=
> care aboutis which thread library is used.
>I believe it was asserted that PM3/NT386GNU did work=2C but that it might h=
>ave used Win32 threads.
>And maybe never had any GUI?
>I tried getting pthreads to work=2C but gave up debugging it.Perhaps a fres=
>h go at debugging it would pan out..but I'm really not too interested..
>I also have no interest in user threads. I believe they are never warranted=
>=2C excepton old systems that don't have kernel threads=2C like the hypothe=
>tical DJGPP port.
>I never brought up the issue of serial ports.I ASSUMED that almost nobody u=
>ses them=2C and anyone that does use them=2C doesn'tcare if they are implem=
>ented using Cygwin or Win32=2C as long as they work.
>I ASSUME there is no interop issue=2C like getting an int fd from the seria=
>l portand passing it to select() or close=2C or getting a Win32 HANDLE and =
>passing itto WaitForSingleObject=2C but I could be wrong here=2C certainly.
>I didn't look into if Cygwin is complete enough to implement them.I conside=
>r serial ports to be kind of out on the fringe..that it wouldn't be surpris=
>ing if Cygwin didn't implement them..but I didn't look. Heck=2C I tried bui=
>lding minicom on some non-Linux system(s) recently and it failed miserably.=
> I don't know if there is even much Posix portability option for serial por=
>t programming.
>Sure..I debug over a serial port=2C and lately have machines I can't get vi=
>deoout of (Itanium) or even seem to have no video hardware (Sun)=2C so I us=
>e a serial consolefor initial install (recent achievement :) still haven't =
>installed over network..)=2C but that's still imho a big step away from wri=
>ting code that uses the serial port.(And NetBSD doesn't support the local v=
>ideo on SGI O2=2C but I'm running OpenBSD there for now.)
>=20
>Anyway=2C there are a few ways to look at this issue.More and less trivial.
>A trivial view is: Get the filtering to work. Build serial on all platform=
>s but Cygwin. Or see if the Posix code will work.
> I'd be surprised if the intersection of Cygwin x Modula-3 x serial port p=
>rogrammers is not 0=2C but could be. I actually don't think anyone is using=
> Cygwin x Modula-3.
>Another view is: Get the Win32 serial code to work on Cygwin. The code is=
> already there=2C and buildable=2C but building in a system that also build=
>s FilePosix.m3 breaks Modula-3 rules=2C you end up with two implementatio=
>ns of the File interface. What you want=2C I think=2C is FilePosix.m3 to pr=
>ovide the File interface=2C and FileWin32.m3 to provide just its own spec=
>ific FileWin32 interface. I think this is a simple transform of the code.
>Anyway=2C not a big deal...my tone here...is rushed=2C not rude=2C sorry.Ma=
>ybe I'll get the truncation I deserve. :)
> - Jay=
>
>--_c7ada8a5-5684-4472-b0c7-b49c8c279dc2_
>Content-Type: text/html; charset="iso-8859-1"
>Content-Transfer-Encoding: quoted-printable
>
><html>
><head>
><style>
>.hmmessage P
>{
>margin:0px=3B
>padding:0px
>}
>body.hmmessage
>{
>font-size: 10pt=3B
>font-family:Verdana
>}
></style>
></head>
><body class=3D'hmmessage'>
><HR id=3DstopSpelling>
>From: Tony<BR>To: jay<BR><BR>
><DIV>I would have thought of CygWin as a POSIX platform that just happens t=
>o have Windows underneath.  =3BDid we go round this roundabout before?<=
>/DIV>
><DIV><SPAN class=3DEC_Apple-style-span style=3D"WORD-SPACING: 0px=3B FONT: =
>12px Helvetica=3B TEXT-TRANSFORM: none=3B COLOR: rgb(0=2C0=2C0)=3B TEXT-IND=
>ENT: 0px=3B WHITE-SPACE: normal=3B LETTER-SPACING: normal=3B BORDER-COLLAPS=
>E: separate">
><DIV style=3D"WORD-WRAP: break-word"><SPAN class=3DEC_Apple-style-span styl=
>e=3D"WORD-SPACING: 0px=3B FONT: 12px Helvetica=3B TEXT-TRANSFORM: none=3B C=
>OLOR: rgb(0=2C0=2C0)=3B TEXT-INDENT: 0px=3B WHITE-SPACE: normal=3B LETTER-S=
>PACING: normal=3B BORDER-COLLAPSE: separate"><SPAN class=3DEC_Apple-style-s=
>pan style=3D"WORD-SPACING: 0px=3B FONT: 12px Helvetica=3B TEXT-TRANSFORM: n=
>one=3B COLOR: rgb(0=2C0=2C0)=3B TEXT-INDENT: 0px=3B WHITE-SPACE: normal=3B =
>LETTER-SPACING: normal=3B BORDER-COLLAPSE: separate"><SPAN class=3DEC_Apple=
>-style-span style=3D"WORD-SPACING: 0px=3B FONT: 12px Helvetica=3B TEXT-TRAN=
>SFORM: none=3B COLOR: rgb(0=2C0=2C0)=3B TEXT-INDENT: 0px=3B WHITE-SPACE: no=
>rmal=3B LETTER-SPACING: normal=3B BORDER-COLLAPSE: separate"><SPAN class=3D=
>EC_Apple-style-span style=3D"WORD-SPACING: 0px=3B FONT: 12px Helvetica=3B T=
>EXT-TRANSFORM: none=3B COLOR: rgb(0=2C0=2C0)=3B TEXT-INDENT: 0px=3B WHITE-S=
>PACE: normal=3B LETTER-SPACING: normal=3B BORDER-COLLAPSE: separate"><SPAN =
>class=3DEC_Apple-style-span style=3D"WORD-SPACING: 0px=3B FONT: 12px Helvet=
>ica=3B TEXT-TRANSFORM: none=3B COLOR: rgb(0=2C0=2C0)=3B TEXT-INDENT: 0px=3B=
> WHITE-SPACE: normal=3B LETTER-SPACING: normal=3B BORDER-COLLAPSE: separate=
>"><SPAN class=3DEC_Apple-style-span style=3D"WORD-SPACING: 0px=3B FONT: 12p=
>x Helvetica=3B TEXT-TRANSFORM: none=3B COLOR: rgb(0=2C0=2C0)=3B TEXT-INDENT=
>: 0px=3B WHITE-SPACE: normal=3B LETTER-SPACING: normal=3B BORDER-COLLAPSE: =
>separate"><SPAN class=3DEC_Apple-style-span style=3D"WORD-SPACING: 0px=3B F=
>ONT: 12px Helvetica=3B TEXT-TRANSFORM: none=3B COLOR: rgb(0=2C0=2C0)=3B TEX=
>T-INDENT: 0px=3B WHITE-SPACE: normal=3B LETTER-SPACING: normal=3B BORDER-CO=
>LLAPSE: separate"><SPAN class=3DEC_Apple-style-span style=3D"WORD-SPACING: =
>0px=3B FONT: 12px Helvetica=3B TEXT-TRANSFORM: none=3B COLOR: rgb(0=2C0=2C0=
>)=3B TEXT-INDENT: 0px=3B WHITE-SPACE: normal=3B LETTER-SPACING: normal=3B B=
>ORDER-COLLAPSE: separate">
><DIV><BR></DIV></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></DI=
>V></SPAN></DIV>
><DIV>
><BLOCKQUOTE><SPAN class=3DEC_Apple-style-span style=3D"WORD-SPACING: 0px=3B=
> FONT: 12px Helvetica=3B TEXT-TRANSFORM: none=3B COLOR: rgb(0=2C0=2C0)=3B T=
>EXT-INDENT: 0px=3B WHITE-SPACE: normal=3B LETTER-SPACING: normal=3B BORDER-=
>COLLAPSE: separate">
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR>It's more complicated than that.</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR>It isn't just one bit.</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR>There's a few factors=2C that people care more and less about.</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR> =3B GUI library =3B -- Win32 or X</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR> =3B thread library =3B -- pthreads or Win32 (or user threads)=
> </DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR> =3B file system path representation -- forward slashes or backwar=
>d slashes<BR> =3B =3B =3B This seems to be what people care mos=
>t about -- to see forward slashes.</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR> =3B C compiler -- Visual C++ cl or Cygwin/GNU gcc</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR> =3B linker -- Visual C++ link or Cygwin/GNU ld </DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR> =3B C runtime -- msvcr*.dll or cygwin1.dll </DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR> =3B integrated backend or not <BR> =3B =3B =3B The in=
>tegrated backend is way faster=2C but doesn't yet support 64bit LONGINT.</D=
>IV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR> =3B which debugger/symbol format =3B-- gdb/stabs or windbg/Vi=
>suaStudio/CodeView/pdb</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR>Many of these factors are independent of each other=2C but not entirel=
>y.</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR>Compiler/linker directly lead to which debugger you can use=2C since<B=
>R> =3B they each use different formats.</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR>Well=2C you can use either debugger=2C but..without symbols..at least =
>for some modules.</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR>The Cygwin C runtime and Visual C++ linker disagree<BR>on the name of =
>__ImageBase=2C so you can't link to the Cygwin C runtime with the<BR>Visual=
> C++ linker. This is probably fixable at least in one combination with<BR>a=
>n alias (ability to link Cygwin C runtime with Visual C++ linker=3B I don't=
><BR>know if Cygwin/GNU ld understands aliases).</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR>I have also found that Cygwin produces incorrect<BR>import .libs=2C pe=
>rhaps their linker somehow accepts them.</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>> =3B</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>>Cygwin can program the Win32 GUI=2C but there is an issue with passing 8 b=
>yte structs by value to __stdcall functions=2C the function name isn't mang=
>led correctly and linking fails.</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR>It is a bit of a combinatorial explosion.<BR>As the system stands=2C y=
>ou can control each bit in the config file=2C and<BR>multiple combinations =
>might work=2C though I don't run any combinatorial tests.</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR>Three combinations are "identified" (named=2C spoken of) =3Band ha=
>ve had some development testing.<BR>NT386=2C NT386MINGNU (which I think sho=
>uld be called I386_MINGWIN)=2C and NT386GNU (which I think should be called=
> I386_CYGWIN).</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR>Furthermore=2C you can imagine I386_INTERIX and I386_UWIN (I forget if=
> that's the name).<BR>Interix and UWIN being two other very viable Posix la=
>yers on Windows.<BR>Interix has been renamed a few times. It is called "SFU=
>" -- services for Unix=2C and I don't know=2C<BR>like SUA -- services for u=
>nix applications=2C and I think there's another name.<BR>It is a free downl=
>oad from Microsoft for x86 Windows <=3B Vista=2C and is an optional compo=
>nent in Vista.<BR>It has its pluses and minuses..not now.</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR>Anyway=2C in conversation here=2C one of the main things that people D=
>O NOT care about<BR>is which thread library is used.</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR>I believe it was asserted that PM3/NT386GNU did work=2C but that it mi=
>ght have used Win32 threads.</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>>And maybe never had any GUI?</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR>I tried getting pthreads to work=2C but gave up debugging it.<BR>Perha=
>ps a fresh go at debugging it would pan out..but I'm really not too interes=
>ted..</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR>I also have no interest in user threads. I believe they are never warr=
>anted=2C except<BR>on old systems that don't have kernel threads=2C like th=
>e hypothetical DJGPP port.</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR>I never brought up the issue of serial ports.<BR>I ASSUMED that almost=
> nobody uses them=2C and anyone that does use them=2C doesn't<BR>care if th=
>ey are implemented using Cygwin or Win32=2C as long as they work.<BR></DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>>I ASSUME there is no interop issue=2C like getting an int fd from the seri=
>al port<BR>and passing it to select() or close=2C or getting a Win32 HANDLE=
> and passing it<BR>to WaitForSingleObject=2C but I could be wrong here=2C c=
>ertainly.</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR>I didn't look into if Cygwin is complete enough to implement them.<BR>=
>I consider serial ports to be kind of out on the fringe..that it wouldn't b=
>e surprising if Cygwin didn't implement them..but I didn't look. Heck=2C I =
>tried building minicom on some non-Linux system(s) recently and it failed m=
>iserably. I don't know if there is even much Posix portability option for s=
>erial port programming.</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR>Sure..I debug over a serial port=2C and lately have machines I can't g=
>et video<BR>out of (Itanium) or even seem to have no video hardware (Sun)=
>=2C so I use a serial console<BR>for initial install (recent achievement :)=
> still haven't installed over network..)=2C but that's still imho a big ste=
>p away from writing code that uses the serial port.<BR>(And NetBSD doesn't =
>support the local video on SGI O2=2C but I'm running OpenBSD there for now.=
>)</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>> =3B</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR>Anyway=2C there are a few ways to look at this issue.<BR>More and less=
> trivial.</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR>A trivial view is:<BR> =3B Get the filtering to work. Build serial=
> on all platforms but Cygwin.<BR> =3B =3B Or see if the Posix code =
>will work.</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>> =3B I'd be surprised if the intersection of Cygwin x Modula-3 x seria=
>l port programmers is not 0=2C but could be. I actually don't think anyone =
>is using Cygwin x Modula-3.</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR>Another view is:<BR> =3B Get the Win32 serial code to work on Cygw=
>in.<BR> =3B The code is already there=2C and buildable=2C but building =
>in a system that also builds FilePosix.m3<BR> =3B =3B breaks Modula=
>-3 rules=2C you end up with two implementations of the File interface.<BR>&=
>nbsp=3BWhat you want=2C I think=2C is FilePosix.m3 to provide the File inte=
>rface=2C and FileWin32.m3 to provide<BR> =3B =3B just its own speci=
>fic FileWin32 interface.<BR> =3B I think this is a simple transform of =
>the code.</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR>Anyway=2C not a big deal...my tone here...is rushed=2C not rude=2C sor=
>ry.<BR>Maybe I'll get the truncation I deserve. :)</DIV>
><DIV class=3DEC_hmmessage style=3D"FONT-SIZE: 10pt=3B FONT-FAMILY: Verdana"=
>><BR> =3B- Jay</DIV></SPAN></BLOCKQUOTE></DIV></body>
></html>=
>
>--_c7ada8a5-5684-4472-b0c7-b49c8c279dc2_--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20081218/f9b90823/attachment-0002.html>
More information about the M3devel
mailing list