31.1. Customizing CLISP Process Initialization and Termination
Prev | Chapter 31. Platform Independent Extensions | Next

## 31.1. Customizing CLISP Process Initialization and Termination

### 31.1.1. Cradle to Grave

#### What is done when

1. Initialization

   1. Parse command line arguments until the first positional argument (see `:SCRIPT` in Section 31.2, “Saving an Image”).

   2. Load the memory image.

   3. Install internal signal handlers.

   4. Initialize time variables.

   5. Initialize locale-dependent encodings.

   6. Initialize stream variables.

   7. Initialize pathname variables.

   8. Initialize “FFI”.

   9. Initialize modules.

   10. Run all functions in `CUSTOM:*INIT-HOOKS*`.

   11. Say “hi”, unless suppressed by `-q`.

   12. Load RC file, unless suppressed by `-norc`.

2. The actual work

   Handle command line options: file loading and/or compilation, form evaluation, script execution, read-eval-print loop.

3. Finalization (executed even on abnormal exit due to `kill`)

   1. Unwind the `STACK`, executing cleanup forms in `UNWIND-PROTECT`.

   2. Run all functions in `CUSTOM:*FINI-HOOKS*`.

   3. Call `FRESH-LINE` on the standard streams.

   4. Say “bye” unless suppressed by `-q`.

   5. Wait for a keypress if requested by `-w`.

   6. Close all open `FILE-STREAM`s.

   7. Finalize modules.

   8. Close all open DLLs.

### 31.1.2. Customizing Initialization

`CUSTOM:*INIT-HOOKS*` is run like this:

    (MAPC #'FUNCALL CUSTOM:*INIT-HOOKS*)

#### 31.1.2.1. The difference between `CUSTOM:*INIT-HOOKS*` and init function

- `CUSTOM:*INIT-HOOKS*` are always run regardless of the command line options before even the banner is printed.
- The init function is run only if the read-eval-print loop is ever entered and just before the first prompt is printed.

### 31.1.3. Customizing Termination

`CUSTOM:*FINI-HOOKS*` is run like this:

    (MAPC #'FUNCALL CUSTOM:*FINI-HOOKS*)

| These notes document CLISP version 2.45 | Last modified: 2008-05-14

Enter your search termsSubmit search form
Webclisp.cons.orgclisp.podval.orgwww.lisp.org

Prev | Up | Next
Chapter 31. Platform Independent Extensions | Home | 31.2. Saving an Image