SYSTEM FUNCTIONS
LOAD A SOURCE FILE
(load <fname> &key :verbose :print)
An implicit ERRSET exists in this function so that if error occurs during loading, and *breakenable* is NIL, then the error message will be printed and NIL will be returned. The OS environmental variable XLPATH is used as a search path for files in this function. If the filename does not contain path separators ('/' for UNIX, and either '/' or '\' for MS-DOS) and XLPATH is defined, then each pathname in XLPATH is tried in turn until a matching file is found. If no file is found, then one last attempt is made in the current directory. The pathnames are separated by either a space or semicolon, and a trailing path separator character is optional.
- <fname> the filename string, symbol, or a file stream created with OPEN. The extension "lsp" is assumed.
- :verbose the verbose flag (default is t)
- :print the print flag (default is NIL)
- returns t if successful, else NIL
RESTORE WORKSPACE FROM A FILE
(restore <fname>)
The OS environmental variable XLPATH is used as a search path for files in this function. See the note under function "load", above. The standard system streams are restored to the defaults as of when XLISP-PLUS was started. Files streams are restored in the same mode they were created, if possible, and are positioned where they were at the time of the save. If the files have been altered or moved since the time of the save, the restore will not be completely successful. Memory allocation will not be the same as the current settings of ALLOC are used. Execution proceeds at the top-level read-eval-print loop. The state of the transcript logging is not affected by this function.
- <fname> the filename string, symbol, or a file stream created with OPEN. The extension "wks" is assumed.
- returns NIL on failure, otherwise never returns
SAVE WORKSPACE TO A FILE
(save <fname>)
You cannot save from within a load. Not all of the state may be saved -- see "restore", above. By saving a workspace with the name "xlisp", that workspace will be loaded automatically when you invoke XLISP-PLUS.
- <fname> the filename string, symbol, or a file stream created with OPEN. The extension "wks" is assumed.
- returns t if workspace was written, NIL otherwise
SAVE FUNCTION TO A FILE
(savefun <fcn>)
defined in init.lsp
- <fcn> function name (saves it to file of same name, with extension ".lsp")
- returns t if successful
CREATE A FILE WITH A TRANSCRIPT OF A SESSION
(dribble [<fname>])
- <fname> file name string, symbol, or file stream created with OPEN
- (if missing, close current transcript)
- returns t if the transcript is opened, NIL if it is closed
FORCE GARBAGE COLLECTION
(gc)
EXPAND MEMORY BY ADDING SEGMENTS
(expand [<num>])
- <num> the number of segments to add, default 1
- returns the number of segments added
CHANGE SEGMENT SIZE
(alloc <num> [<num2>])
- <num> the number of nodes to allocate
- <num2> the number of pointer elements to allocate in an array segment (when dynamic array allocation compiled). Default is no change.
- returns the old number of nodes to allocate
SHOW MEMORY ALLOCATION STATISTICS
(room)
Statistics (which are sent to *STANDARD-OUTPUT*) include:
- Nodes - number of nodes, free and used
- Free nodes - number of free nodes
- Segments - number of node segments, including those reserved for characters and small integers.
- Allocate - number of nodes to allocate in any new node segments
- Total - total memory bytes allocated for node segments, arrays, and strings
- Collections - number of garbage collections
- Time - time spent performing garbage collections (in seconds)
When dynamic array allocation is compiled, the following additional statistics are printed:
- Vector nodes - number of pointers in arrays and (size equivalent) strings
- Vector free - free space in vector area (may be fragmented across segments)
- Vector segs - number of vector segments. Increases and decreases as needed.
- Vec allocate - number of pointer elements to allocate in any new vector segment
- returns NIL
MEASURE EXECUTION TIME
(time <expr>)
fsubr.
- <expr> the expression to evaluate
- returns the result of the expression. The execution time is printed to *TRACE-OUTPUT*
GET ELAPSED CLOCK TIME
(get-internal-real-time)
GET ELAPSED EXECUTION TIME
(get-internal-run-time)
- returns integer time in system units (see internal-time-units-per-second on page 27). meaning of absolute values is system dependent.
FORCE EXPRESSION TO DESIGNATED TYPE
(coerce <expr> <type>)
Sequences can be coerced into other sequences, single character strings or symbols with single character printnames can be coerced into characters, fixnums can be coerced into characters or flonums. Ratios can be coerced into flonums. Flonums and ratios can be coerced into complex (so can fixnums, but they turn back into fixnums).
- <expr> the expression to coerce
- <type> desired type, as returned by type-of (see page 88)
- returns <expr> if type is correct, or converted object.
RETURNS THE TYPE OF THE EXPRESSION
(type-of <expr>)
It is recommended that typep be used instead, as it is more general. In the original XLISP, the value NIL was returned for NIL.
- <expr> the expression to return the type of
- returns One of the symbols:
PEEK AT A LOCATION IN MEMORY
(peek <addrs>)
- <addrs> the address to peek at (integer)
- returns the value at the specified address (integer)
POKE A VALUE INTO MEMORY
(poke <addrs> <value>)
- <addrs> the address to poke (integer)
- <value> the value to poke into the address (integer)
- returns the value
GET THE ADDRESS OF AN XLISP NODE
(address-of <expr>)
- <expr> the node
- returns the address of the node (integer)
READ A KEYSTROKE FROM CONSOLE
(get-key)
OS dependent.
- returns integer value of key (no echo)
EXECUTE A SYSTEM COMMAND
(system <command>)
OS dependent -- not always available.
- <command> Command string, if 0 length then spawn OS shell
- returns T if successful (note that MS/DOS command.com always returns success)
SET SYSTEM STACK WARNING POINT
(set-stack-mark <size>)
OS dependent -- not always available. The system will perform a continuable error when the amount of remaining system stack passes below this setting. The trap is reset at the top-level. This function is useful for debugging runaway recursive functions.
- <size> Remaining stack, in bytes. Minimum value is fixed at the value that causes the system stack overflow error, while the maximum value is limitied to somewhat less than the current remaining stack space. Use "0" to turn the warnings off.
- returns the previous value.
DEFAULT TOP LEVEL LOOP
(top-level-loop)
Runs the XLISP top level read-eval-print loop, described earlier. Never returns.
FLUSH INPUT BUFFERS
(reset-system)
Used by user-implemented top level loops to flush the input buffer
EXIT XLISP
(exit)
CREATE A GENERIC TYPED COPY OF THE EXPRESSION
(generic <expr>)
Note: added function, Tom Almy's creation for debugging xlisp.
- <expr> the expression to copy
- returns NIL if value is NIL and NILSYMBOL compilation option not declared, otherwise if type is:
- SYMBOL copy as an ARRAY
- OBJECT copy as an ARRAY
- CONS (CONS (CAR <expr>)(CDR <expr>))
- CLOSURE copy as an ARRAY
- STRING copy of the string
- FIXNUM value
- FLONUM value
- RATIO value
- CHARACTER value
- UNNAMED-STREAM copy as a CONS
- ARRAY copy of the array
- COMPLEX copy as an ARRAY
- HASH-TABLE copy as an ARRAY
- structure copy as an ARRAY
(eval-when <condition> <body> ...)
Macro defined in common.lsp, and provided to assist in porting Common Lisp applications to XLISP-PLUS.
- <condition> List of conditions
- <body> expressions which are evaluated if one of the conditions is EXECUTE or LOAD.
- returns result of last body expression
The following graphic and display functions represent an extension by Tom Almy:
CLEAR DISPLAY
(cls)
Clear the display and position cursor at upper left corner.
CLEAR TO END OF LINE
(cleol)
Clears current line to end.
GET OR SET CURSOR POSITION
(goto-xy [<column> <row>])
Cursor is repositioned if optional arguments are specified. Coordinates are clipped to actual size of display.
- <column> 0-based column (x coordinate)
- <row> 0-based row (y coordinate)
- returns list of original column and row positions
SET DRAWING COLOR
(color <value>)
- <value> Drawing color (not checked for validity)
- returns <value>
ABSOLUTE MOVE
(move <x1> <y1> [<x2> <y2> ...])
RELATIVE MOVE
(moverel <x1> <y2> [<x2> <y2> ...])
For moverel, all coordinates are relative to the preceeding point.
- <x1> <y1> Moves to point x1,y1 in anticipation of draw.
- <x2> <y2> Draws to points specified in additional arguments.
- returns T if succeeds, else NIL
ABSOLUTE DRAW
(draw [<x1> <y1> ...])
RELATIVE DRAW
(drawrel [<x1> <y1> ...])
For drawrel, all coordinates are relative to the preceeding point.
- <x1> <y1> Point(s) drawn to, in order.
- returns T if succeeds, else NIL
SET DISPLAY MODE
(mode <ax> [<bx> <width> <height>)
Standard modes require only <ax> argument. Extended modes are "Super-VGA" or "Super-EGA" and are display card specific. Not all XLISP versions support all modes.
- <ax> Graphic mode (value passed in register AX)
- Common standard Modes:
- 0,1 - 40x25 text
- 2,3 - 80x25 text
- 4,5 - 320x200 4 color graphics (CGA)
- 6 - 640x200 monchrome graphics (CGA)
- 13 - 320x200 16 color graphics (EGA)
- 14 - 640x200 16 color graphics (EGA)
- 16 - 640x350 16 color graphics (EGA)
- 18 - 640x480 16 color graphics (VGA)
- 19 - 320x200 256 color graphics (VGA)
- <bx> BX value for some extended graphic modes
- <width> width for extended graphic modes
- <height> height for extended graphic modes
- returns a list of the number of columns, number of lines (1 for CGA), maximum X graphic coordinate (-1 for text modes), and the maximum Y graphic coordinate (-1 for text modes), or NIL if fails
XLISP-PLUS - Version 2.1g - Tom Almy
tom.almy@tek.com - 18 JUL 94
Generated with WebMaker