[M3devel] finding a file
Mika Nystrom
mika at async.async.caltech.edu
Sat Nov 7 18:26:08 CET 2009
Yes, the first variant is "standard m3."
My Scheme interpreter has some functions implemented in Scheme, stored
in an scm file. In fact it's a whole package, whose m3makefile is
as follows:
import ("libm3")
resource ("m3.scm")
resource ("basic-defs.scm")
resource ("hashtable.scm")
resource ("set.scm")
resource ("struct.scm")
bundle ("SchemeDefsBundle")
library ("scheme-lib")
In the main part of the program I then do:
VAR schemeDefs := SchemeDefsBundle.Get();
Bundle.Get(schemeDefs, "struct.scm")
which returns NIL if that bundle doesn't exist, and
the TEXT otherwise.
Mika
hendrik at topoi.pooq.com writes:
>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