Thread view

Greetings:
A colleague of mine wrote an African calendar script that runs in CLISP (using a .l file) and I would like to know how to transform this file into an executable file that can run independent of CLISP? I am no longer in contact with the colleague, and I am an historian, not a computer scientist. Thanks for any help or leads you can provide.
Kwasi Konadu

z_axis <z_axis@...> writes:
> 在 Wed, 21 Aug 2013 01:52:41 +0800，Pascal J. Bourguignon
> <pjb@...> 写道:
>
>> (defun save-program ()
>> (ext:saveinitmem "african-calendar"
>> :documentation "Displays an African calendar."
>> :init-function (lambda ()
>> (handler-case
>> (african-calendar)
>> (condition ()
>> (ext:quit 1))))
>> :locked-packages (list "CL" "KEYWORD")
>> :start-package *package*
>> :keep-global-handlers t
>> :executable t
>> :quiet t
>> :norc t
>> :script nil
>> :verbose nil))
>
> what does :script mean ?
>
> Regards!
That's where the link to the FAQ given by Sam (and further, to the
documentation of the saveinitmem function) comes handy.
But considering you may have difficulties accessing the Internet, here
is a copy:
31.2. Saving an Image
Prev Chapter 31. Platform Independent Next
Extensions
------------------------------------------------------------------
31.2. Saving an Image
31.2.1. Image Portability
The function (EXT:SAVEINITMEM &OPTIONAL (filename "lispinit.mem")
&KEY :KEEP-GLOBAL-HANDLERS :QUIET :INIT-FUNCTION :LOCKED-PACKAGES
:START-PACKAGE :EXECUTABLE :NORC :SCRIPT :DOCUMENTATION :VERBOSE)
saves the running CLISP's memory to the file filename; extension #
P".mem" is recommended (when filename does not have an extension,
#P".mem" extension is automatically added unless the file being
created is an executable).
:QUIET
If this argument is not NIL, the startup banner and the
good-bye message will be suppressed, as if by -q.
This is not recommended for interactive application delivery,
please append your banner to ours (using init function)
instead of replacing it.
:VERBOSE
Print a message after writing the file. This argument defaults
to CUSTOM:*SAVEINITMEM-VERBOSE*; initial value is T.
:NORC
If this argument is not NIL, the RC file loading will be
suppressed, as if by -norc.
:INIT-FUNCTION
This argument specifies a function that will be executed at
startup of the saved image, before entering the standard
read-eval-print loop (but after all other initialization, see
Section 31.1.1, “Cradle to Grave”); thus, if you want to avoid
the read-eval-print loop, you have to call EXT:EXIT at the end
of the init function yourself (this does not prevent
CUSTOM:*FINI-HOOKS* from being run).
See the manual for passing command line arguments to this
function.
See also CUSTOM:*INIT-HOOKS* and CUSTOM:*FINI-HOOKS*.
:SCRIPT
This options determines the handling of positional arguments
when the image is invoked.
* If it is T, then the first positional argument is the
script name and the rest is placed into EXT:*ARGS*, as
described in Section 32.6.2, “Scripting with CLISP”.
* It it is NIL, then all positional arguments are placed
into EXT:*ARGS* to be handled by the init function.
This option defaults to T when init function is NIL and to NIL
when init function is non-NIL.
:DOCUMENTATION
The description of what this image does, printed by the
-help-image olption.
Defaults to (DOCUMENTATION init function 'FUNCTION)
:LOCKED-PACKAGES
This argument specifies the packages to lock before saving the
image; this is convenient for application delivery, when you
do not want your users to mess up your product. This argument
defaults to CUSTOM:*SYSTEM-PACKAGE-LIST*.
:START-PACKAGE
This argument specifies the starting value of *PACKAGE* in the
image being saved, and defaults to the current value of
*PACKAGE*.
:KEEP-GLOBAL-HANDLERS
When non-NIL, the currently established global handlers
(either with EXT:SET-GLOBAL-HANDLER or with -on-error) are
inherited by the image. Defaults to NIL, so that
$ clisp -i myfile -x '(EXT:SAVEINITMEM)'
will produce an image without any global handlers inherited
from the batch mode of the above command.
:EXECUTABLE
When non-NIL, the saved file will be a standalone executable.
In this case, the #P".mem" extension is not added. On Win32
and Cygwin the extension #P".exe" is added instead.
Additionally, if this argument is 0, the standard CLISP
command line options will not be processed by the executable
but will be placed into EXT:*ARGS* instead. This is convenient
for application delivery, so that your CLISP-based application
can accept, e.g., -x. To override this feature of the image,
you have to prefix the options with "--clisp", e.g., use
--clisp-x instead of -x. This, given such a CLISP-based
application, you can get to an ordinary CLISP read-eval-print
loop by doing
$ application --clisp-x '(EXT:SAVEINITMEM "myclisp" :executable t :init-function nil)'
$ ./myclisp
[1]> (! 20)
2432902008176640000
These instructions are also printed by --clisp--help.
Of course, this feature opens a security hole if the
application is running setuid root, therefore CLISP resets the
effective group and user IDs to the real ones if it sees a
"--clisp-*" option.
You can use this memory image with the -M option. On UNIX systems,
you may compress it with GNU gzip to save disk space.
31.2.1. Image Portability
Memory images are not portable across different platforms (in
contrast with platform-independent #P".fas" files). They are not
even portable across linking sets: image saved using the full
linking set cannot be used with the base runtime:
$ clisp -K full -x '(EXT:SAVEINITMEM)'
$ clisp -K base -M lispinit.mem
base/lisp.run: initialization file `lispinit.mem' was not created by this version of CLISP runtime
See also SFmail/
BF6EFF38DF3FA647BBD932720D8BED650BAA11%40parmbx02.ilog.biz/Gmane/
devel/17757.
------------------------------------------------------------------
These notes document CLISP version 2.49 Last modified: 2010-07-07
------------------------------------------------------------------
[CLISP [Support CL [SourceForge]
------------------------------------------------------------------
Enter your search terms
[31.2. Saving an Image ]Submit search
form Google Search
(*)Web( )clisp.cons.org( )clisp.podval.org( )www.lisp.org
------------------------------------------------------------------
------------------------------------------------------------------
Prev Up Next
31.1. Customizing CLISP 31.3. Quitting CLISP
Process Initialization and Home
Termination
--
__Pascal Bourguignon__
http://www.informatimago.com/