*restart-init-function*

Variable

Package: excl

The value of this variable should be a function name or function object (suitable as the first argument to funcall) or nil. The function should take no arguments. It is called as the last startup action before either a standard Lisp listener is started or *restart-app-function* is called. This variable is never modified or set by any Allegro CL facility. Since the value of this variable is passed to funcall, if the value is nil, no action is taken.

As an example of its use, consider the following code, suitable for placement in a user's .clinit.cl file. It defines the function start-composer-from-clinit-file, which, if called in the .clinit.cl file, causes Allegro Composer to be started. It is reprinted here to illustrate how *restart-init-function* might be modified in a .clinit.cl file in a way that preserves any functionality expressed by the current value of the variable and is further careful to reset the variable appropriately after Allegro Composer is started -- thus preventing a dumped image from trying to start Allegro Composer twice. (Evaluating (composer:start-composer) in .clinit.cl works but causes annoying bogus warnings to be printed.)

;; Description: Facilitate Composer startup from .clinit.cl file
;;
 
(defun start-composer-from-clinit-file ()
  (let ((initial-restart-init-function *restart-init-function*))
    (cond (initial-restart-init-function
      (setf *restart-init-function*
            #'(lambda ()
               (composer:start-composer)
               (setf *restart-init-function* initial-restart-init-function)
               (funcall initial-restart-init-function))))
     (t (setf *restart-init-function*
              #'(lambda ()
                (composer:start-composer)
                (setf *restart-init-function* nil)))))))

Special note concerning the IDE and Projects on Windows

This note applies to users of the Integrated Development Environment (IDE) with Allegro CL 5.0/5.0.1 on Windows.

In 5.0.1, *restart-init-function* is not used by the Integrated Development Environment for developing applications but is used by an application developed using the project system. In such an application, the value of *restart-init-function* is set to cg::do-default-restart. That function initializes Common Graphics, and calls the project on-initialization function (displayed in the Project manager Options tab as the Init Function). The on-initialization function should do whatever application initializations are necessary and should return the main window of the application. The main window is the one that the user closes in order to exit the application.

When the window returned by the on-initialization function is closed, the application will exit. If something other than a window is returned by the on-initialization function, the application exits immediately.

So, programmers using the project system should not set a value for *restart-init-function* and they should do all initializations associated with the application in the on-initialization function. Note that Common Graphics-related code cannot be evaluated earlier in the startup procedure because Common Graphics will not yet be initialized.

In 5.0, the IDE was initialized with *restart-init-function* In 5.0.1, it is initialized with *restart-app-function*.

Special note about the value when calling build-lisp-image or generate-applictaion

Warning: the functions build-lisp-image and generate-application both accept a :restart-init-function keyword argument whose value defaults to the value of this variable. However, the only valid values for that argument are a symbol or a list (typically a lambda list defining an anonymous function). If the value of this variable is a function object, and the :restart-init-function argument is not specified, the call to build-lisp-image or generate-application will fail. Thus, this will fail:

(setq *restart-init-function* #'(lambda () (do-my-startup))
(build-lisp-image "myimage.dxl")

and this will succeed:

(setq *restart-init-function* '(lambda () (do-my-startup))
(build-lisp-image "myimage.dxl")

References

See startup.htm, particularly section What Lisp does when it starts up, for information on initialization functions.

The documentation is described in introduction.htm and the index is in index.htm.

Copyright (c) 1998-2000, Franz Inc. Berkeley, CA., USA. All rights reserved.

Created 2000.10.5.