Re: Compiler ?? (dynamic inclusion)
- Posted by Chris Bensler <bensler at MAILOPS.COM> Jun 06, 2000
- 431 views
------=_NextPart_000_0027_01BFCFD8.A2B32C00 charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable what's wrong with a preprocessor? That's all it would be if Rob added = it. Accept you would have the minor convenience of a single compilation, = instead of precompiling, then compiling. But you can get around this = with a simple batch file. ----- Original Message -----=20 From: Irv Mullins=20 To: EUPHORIA at LISTSERV.MUOHIO.EDU=20 Sent: Tuesday, June 06, 2000 3:28 PM Subject: Re: Compiler ?? (dynamic inclusion) On Tue, 06 Jun 2000, you wrote: > Hrm.. well, let me explain just why I'd like conditional compilation = (and > conditional interpretation). > > Suppose you've written a library (or a program) that you want to be > compilable on any platform. The problem is that this library uses > OS-specific stuff. What to do? Write one version for each OS? Nah, = do it > like this instead: > > -- Suppose this is the Windows version > define WIN32 > > ifdef DOS32 > -- DOS specific stuff goes here > endif > ifdef WIN32 > -- Windows > endif > ifdef LINUX > -- ..and finally Linux > endif Now I agree with you - we already have platform() which defines Linux/Win/Dos, so we can write platform dependent code. if platform() =3D LINUX then x =3D 4 ... etc. elsif platform() =3D DOS then ... However, what we really need is conditional _includes_, for example, if platform() =3D LINUX then include xgraphics.e elsif platform() =3D DOS then include graphics.e .... I don't know why this would be hard to add to Euphoria. Irv ------=_NextPart_000_0027_01BFCFD8.A2B32C00 charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content=3D"text/html; charset=3Diso-8859-1" = http-equiv=3DContent-Type> <META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT color=3D#0000ff face=3D"Comic Sans MS">what's wrong with a = preprocessor?=20 That's all it would be if Rob added it. Accept you would have the minor=20 convenience of a single compilation, instead of precompiling, then = compiling.=20 But you can get around this with a simple batch file.</FONT></DIV> <BLOCKQUOTE=20 style=3D"BORDER-LEFT: #0000ff 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: = 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px"> <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV> <DIV=20 style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: = black"><B>From:</B>=20 <A href=3D"mailto:irv at ELLIJAY.COM" title=3Dirv at ELLIJAY.COM>Irv = Mullins</A> </DIV> <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A=20 href=3D"mailto:EUPHORIA at LISTSERV.MUOHIO.EDU"=20 title=3DEUPHORIA at LISTSERV.MUOHIO.EDU>EUPHORIA at LISTSERV.MUOHIO.EDU</A> = </DIV> <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Tuesday, June 06, 2000 = 3:28=20 PM</DIV> <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Re: Compiler ?? = (dynamic=20 inclusion)</DIV> <DIV><BR></DIV> <DIV>On Tue, 06 Jun 2000, you wrote:<BR>> Hrm.. well, let me = explain just=20 why I'd like conditional compilation (and<BR>> conditional=20 interpretation).<BR>><BR>> Suppose you've written a library (or = a=20 program) that you want to be<BR>> compilable on any platform. The = problem=20 is that this library uses<BR>> OS-specific stuff. What to do? Write = one=20 version for each OS? Nah, do it<BR>> like this = instead:<BR>><BR>> --=20 Suppose this is the Windows version<BR>> define = WIN32<BR>><BR>> ifdef=20 DOS32<BR>> -- DOS specific stuff goes here<BR>> endif<BR>> = ifdef=20 WIN32<BR>> -- Windows<BR>> endif<BR>> ifdef LINUX<BR>> -- = ..and=20 finally Linux<BR>> endif<BR><BR>Now I agree with you - we already = have=20 platform() which defines<BR>Linux/Win/Dos, so we can write platform = dependent=20 code.<BR>if platform() =3D LINUX then<BR> x =3D 4 ... = etc.<BR>elsif=20 platform() =3D DOS then ...<BR><BR>However, what we really need is = conditional=20 _includes_, for example,<BR>if platform() =3D LINUX then include=20 xgraphics.e<BR>elsif platform() =3D DOS then include graphics.e = ....<BR><BR>I=20 don't know why this would be hard to add to=20 ------=_NextPart_000_0027_01BFCFD8.A2B32C00--