[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Stop Evaluator on File Load
- To: "Bruce Lester [Pillsbury]" <email@example.com>
- Subject: Re: Stop Evaluator on File Load
- From: bill (Bill St. Clair)
- Date: Wed, 9 Nov 94 11:53:13 -0500
- Cc: MCL bulletin board <firstname.lastname@example.org>
- Sender: email@example.com
At 3:44 PM 11/9/94, Bruce Lester [Pillsbury] wrote:
>Is there a way to put a 'stop-eval' mark in an MCL .lisp and/or .fasl file that
>will evaluate expressions before the mark and stop evaluating expressions when
>the mark is read?
>I am thinking about single-file application that would contain user interface
>expressions at the beginning of the file followed by data.
>I don't want the data part of the file read by the MCL loader. I want to read
>or not read the rest of this file under the control of the code loaded at the
>beginning of the file.
>I also want to edit this single-file under control of the same code that is
>loaded from the beginning of the file.
>I this feasible in MCL?
The method that I can think of that will work requires that the
file be a ".fasl" file, not a ".lisp" file. It also requires
some preparation on your part, but I doubt that that's a problem.
As I understand it, your requirement is just that everything that's
necessary be stored in one file.
I envision the following.
Write a ".lisp" file with the code that you want to execute.
Compile it into a fasl file.
Write a resource into the fasl file recording its length.
Append your data to the fasl file.
To load the file:
Call ccl:load to load the code part of the fasl file. This will
ignore the data since a fasl file contains an EOF marker in its
Read the resource to find the location of the data in the file.
Open the file and read the data.
You could do the same with an uncompiled (".lisp") file, but you'd
need to wrap a catch around your call to load, and have a throw
at the end of the code in the file to prevent evaluating the
data. Either that or put a #| ... |# comment around the data.