[M3devel] finding a file

hendrik at topoi.pooq.com hendrik at topoi.pooq.com
Sat Nov 7 15:38:35 CET 2009


I'm guessing there's probably a well-known, more-or-less standard way to 
handle the following problem.  So before I roll my own (not a difficult 
task), I thought I'd ask what the normal techniques are, and 
whether there are already ready-made tools for this somewhere in the 
Modula 3 codebase.  

I have a file that has to be read by a program under development.  
Conceptually, the file is part of the program (it contains 
boilerplate that has to be copied (at present, anyway; later I may 
need to make substitutions) into the program's output).

The question is how to find it.  So far I have two ideas.

(1) use a preprocessor to turn the file contents into the Modula 3 
source code for a module with a humongous initialized character string.  
How do I specify this in an m3makefile?  It would have to be able to 
compile the preprocessor as well as run it to create further Modula 3 
code that it would then compile.

or

(2) Find a standard place for the file, possible relative to the 
location of the executable.  (At any time I may have several versions of 
this code -- such as a production and a development version)  Is there 
well-known code for finding the executable?

or

(3) At compile time, have a parameter that gets copied into the 
generated executable that says where these files will be at 
execution time.  But how to I embed compile-time parameters into 
Modula 3 code?

-- hendrik



More information about the M3devel mailing list