1. help with include files
- Posted by Ferlin Scarborough <ferlin at SANDW.NET> May 19, 1998
- 677 views
Please HELP!!!!! Although I have been lurking around the Euphoria List Server for awhile. I have just begin to program with EUPHORIA, and loving it. What I am trying to do now is to modify a program to use a certain include file based on the value of a global sequence which may be changed by the user while running the program. What I tried is this: if compare(THISSEQ, "INCA") = 0 then include a.e elsif compare(THISSEQ,"INCB") = 0 then include b.e end if The results is that Euphoria expects "end" not "include". I would like to include A.E if THISSEQ = "INCA" or include B.E if THISSEQ = "INCB". Any suggestions on HOW to accomplish this? TIA (Thanks In Advance) Later: + + + Rev. Ferlin Scarborough - Centreville, Alabama. U.S.A.
2. Re: help with include files
- Posted by Irv <irv at ELLIJAY.COM> May 19, 1998
- 656 views
- Last edited May 20, 1998
At 05:46 PM 5/19/98 -0500, Ferlin Scarborough wrote: >What I tried is this: > > if compare(THISSEQ, "INCA") = 0 then > include a.e > elsif compare(THISSEQ,"INCB") = 0 then > include b.e > end if > >The results is that Euphoria expects "end" not "include". > >I would like to include A.E if THISSEQ = "INCA" or >include B.E if THISSEQ = "INCB". > >Any suggestions on HOW to accomplish this? > You can't do that. If you are trying to execute different programs based on user input, you could write the user prefs to a file, then load your program based on the file contents. (a "setup" program, for example, to select different graphic modes) Your setup program would write a file named, for instance: *include.all*, consisting of the includes you need: include a include c ...etc and a line in your main program says: include all. If you are trying to include different routines based on some condition that happens or changes during the program run (say, some value is computed or entered) it's too late. Irv
3. Re: help with include files
- Posted by Robert Craig <rds at EMAIL.MSN.COM> May 20, 1998
- 663 views
Irv's reply to Ferlin regarding dynamic selection of an include file was essentially correct. However consider the following "trick": -- ...set THISSEQ, perhaps from user input... if compare(THISSEQ, "INCA") = 0 then system("copy a.e temp.e", 2) elsif compare(THISSEQ,"INCB") = 0 then system("copy b.e temp.e", 2) end if include temp.e This won't work if you bind or shroud your program, but will work if you run it the normal way with ex/exw. Regards, Rob Craig Rapid Deployment Software
4. Re: help with include files
- Posted by David Cuny <dcuny at LANSET.COM> May 19, 1998
- 652 views
- Last edited May 20, 1998
The Rev. Ferlin Scarborough wrote: >What I am trying to do now is to modify a program to use a certain >include file based on the value of a global sequence which may be >changed by the user while running the program. In addition to Robert's suggestion, you could also try my pre-processor (PP). Among the many features in it is a "conditional compilation" directive #if ... #else ... #end if. PP takes files ending with .p and .pp as extensions, and creates .e and .ex files. You can include code or include comments within these directives. You can find PP in the Euphoria Archive, at http://members.aol.com/FilesEu/exestuff.htm. -- David Cuny
5. Re: help with include files
- Posted by Daniel Berstein <daber at PAIR.COM> May 19, 1998
- 654 views
- Last edited May 20, 1998
>What I am trying to do now is to modify a program to use a certain >include file based on the value of a global sequence which may be >changed by the user while running the program. > >What I tried is this: > > if compare(THISSEQ, "INCA") = 0 then > include a.e > elsif compare(THISSEQ,"INCB") = 0 then > include b.e > end if > >The results is that Euphoria expects "end" not "include". Unfortunatly Euphoria doesn't provides conditional include :( That's a feature that would be quite useful for example to have a program to run either under DOS32 or WIN32, autodetecting it's enviorment and dinamically loading the appropiate routines. There's still a problem with the interpreter (ex.exe or exw.exe), but before that we need conditional inclusion. Anyway I think you may be able to simulate the effect using the function routine_id(). It's complex and difficult to maintain. Personally I have never used routine_id (except for some experimetal WIN32 tasks). Regards, Daniel Berstein daber at pair.com