Re: Multi-purpose include/standalone files - neat trick
- Posted by petelomax at blueyonder.co.uk Oct 23, 2002
- 378 views
On Wed, 23 Oct 2002 09:17:49 -0400, Sabal.Mike at notations.com wrote: >Both options are good and concise, hmmm. I've just queried jbrown privately re what he meant. Main.exw and Include.exw; no other source files, right? > but rely on variables set outside the file. Eh? Not me. *My* point was simply that routine_id("xxx") figures this out for you by returning -1 or a valid routine number (see below). If you wanted to communicate with the including app, I guess you could call the isIncludeFile() procedure/function (via call_proc/func()) with various parameters for each include file, possibly even passing/returning routine-id()'s of procs/ funcs defined in include/main source the other wishes to call... > Personally, I like my include files to be self-contained whenever >possible. The use of command_line() accomplishes that goal. <SNIP some complex stuff> OK, I'm listening. Explain to me how using command_line() is better. It works, I agree, but better?!? I don't want to be aggressive about this, but I really liked the idea I had & am worried you haven't got it yet. (or you see a flaw I don't). Pete PS original message snippet follows: > * * HOWEVER * *: > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > global procedure isIncludeFile() -- dummy > end procedure >=20 > include fred.ew >=20 > works a treat as fred.ew can simply ask: >=20 > if routine_id("isIncludeFile")=3D-1 then > -- code to be run if standalone > else > -- probably little or no code to be run if an include > end if > ...