System Internals

$Revision: 5.0.2.4 $

*system*
Configuration
APP
System Start Up and Shut Down
dumplisp
Cached Pixmaps
Cached Cursors

*system*

The goal for Common Graphics and the Development Environment is to have a single global variable called *system*. The global variable, *system*, is an instance of the system or development-system class.

All slots and other global information, are added as properties of *system*. That way, you can assess and change anything about the global state using the inspector.


Configuration

The system object is a hierarchical object. Stored in a slot of the system object is a configuration object. The configuration object is used to store all options that will be saved and restored in the preferences file. Not all configuration options are displayed in the Tools | Options dialog but the commonly used ones are offered.

Like the system and development-system classes, there are configuration and development-configuration classes. The configuration class is used for Common Graphics and some Common Lisp configuration options. The development-configuration is used for the Development Environment configuration options.

All slots and configuration information should also be properties of the configuration class so that you can assess and change them using the inspector. Only properties are saved to the preferences file.


APP

The app slot of the system object holds an instance of the app class. The app object holds Windows application information such as current program, command line options, hinst, wndow-proc-address, etc. This object is analogous to the app object offered by Visual Basic.


System Start Up and Shut Down

To start Common Graphics or the Development Environment, run the function cg:start-ide. System start up runs through the following steps:

  1. mp::start-scheduler
  2. Starts a process named "IDE/Common Graphics" with the preset function start-main-event-handler.
    1. The function, start-main-event-handler, has two main tasks. It does the initialization for the top-level command and calls initialize-cg-system.
      1. The function, initialize-cg-system, is responsible for most of the initialization during start up. First, it sets *system* to the results of calling make-system.
      2. Check if .session-startup-hook. is bound to a function. If so, then the hook function is invoked with zero arguments. The .session-startup-hook. is for internal use only so that Common Graphics can customize *system*, the app object, etc before the user does their initialization.
      3. Check if *session-startup-hook* is bound to a function. If so, then the hook function is invoked with zero arguments. The *session-startup-hook* is provided so that users can customize during runtime the session-init-functions before they are executed. You can use the #+runtime-system conditional so that the addition is only executed at runtime.
      4. Sets the excl::*internal-invoke-debugger-hook* to the value of internal-invoke-debugger-hook of system.
      5. Sets (session-variables *system*) to nil
      6. Each item in (session-init-functions *system*) is funcalled.

Exiting the system causes similar process to occur.

  1. (In development environment only) Each item in (exit-tests *system*) is funcalled. The exit is aborted if an exit-test function returns false.
  2. runs (system-exit) which...
    1. funcalls each item in (session-exit-functions *system*)
    2. ,
    3. sets each of the variables listed (session-variables *system*) to nil.


dumplisp

After a dumplisp, the *system* variable remains bound. That way, all global state and configuration is saved in the new dxl. When the system is started after a dumplisp, reinitialize-system is called to clean up the values stored in *system*.

Cached Pixmaps

The slot  cached-pixmaps on the *system* object holds a set of pixmaps. cached-pixmaps replaces *loaded-pixmaps*. The value of cached-pixmaps is a list of pixmap instances, but the interface does not require you to know that.

Functions That Work with cached-pixmaps
cached-pixmaps (pixmap) Adds a pixmap to the cached pixmaps.
find-cached-pixmap (name) Returns the cached pixmap based on its name or handle. If not already created, then creates the handle.
remove-cached-pixmap (name) Removes the specified pixmap from the cache and destroys the handle.
invalidate-cached-pixmap (name) Destroys the handle and pixmap so that it is reread from the .bmp file.
copy-to-stream (pixmap stream from-box to-box &optional mode) Draws cached-pixmap to stream.
Similar to copy-pixels-to-stream when working with pixmaps

In v. 3.0.2 there were several global variables related to pre-defined pixmaps. These have been replaced by zero argument functions that use find-cached-pixmap, such as default-leaf-pixmap.
  • The pixmaps used by Common Graphics are created during start up by common-graphics-cached-pixmaps.
  • The pixmaps used by the Development Environment are created by development-cached-pixmaps during start up.

 

Cached Cursors

The slot, cached-cursors, on the *system* object holds a set of cursors. A cached-cursors object has a name, cursor structure object, and a cursor-handle. The name of a cached-cursor is a symbol (not a string like cached-pixmaps) that should be unique among the set of cached-cursors.

Functions that Work with cached-cursors.
add-cached-cursor (name hot-spot pixmap mask &optional handle) Adds a cursor description to the cached cursors.
  • name is a symbol.
  • hot-spot is a position for the cursor location within the pixmap.
  • pixmap is a bitmap array describing the cursor.
  • mask allows specifying which pixels are drawn
  • handle is the Windows handle to the cursor if  already created.
find-cached-cursor (name) Returns the cached cursor based on its name or handle. If not already created, then creates the handle.
remove-cached-cursor (name) Removes the specified cursor from the cache and destroys the handle
There were global variables related to pre-defined cursors. These have been replaced by zero argument functions that use find-cached-cursor, such as vertical-splitbar-cursor.
  • The cursors used by Common Graphics are created during start up by common-graphics-cached-cursors.
  • Currently, there are no development environment-specific cursors.

Copyright (C) 1998-1999, Franz Inc., Berkeley, CA. All Rights Reserved.