The PSL Users Manual

Version 4.2

by

Herbert Melenk  and  Winfried Neun

Konrad–Zuse–Zentrum für Informationstechnik Berlin
Division of Symbolic Computing
Takustrasse 7
D–14195 Berlin-Dahlem

URL: http://www.zib.de

based on earlier Versions

by

The Utah Symbolic Computation Group
Department of Computer Science
University of Utah
Salt Lake City, Utah 84112

and

Hewlett-Packard Company
Computer Research Center

Copyright©1997Konrad–Zuse–Zentrum Berlin
University of Utah
Hewlett–Packard Company
All rights reserved.

Registered system holders may reproduce all or any part of this publication for internal purposes, provided that the source of the material is clearly acknowledged, and the copyright notice is retained.

______________________________________________________________

(M 3004.02)

ABSTRACT

This manual describes the primitive data structures, facilities and functions present in the Portable Standard LISP (PSL) system. It describes the implementation details and functions of interest to a PSL programmer. Except for a small number of hand-coded routines for I/O and efficient function calling, PSL is written entirely in itself, using a machine-oriented mode of PSL, called SYSLisp, to perform word, byte, and efficient integer and string operations. PSL is compiled by an enhanced version of the Portable LISP Compiler, and currently runs on many platforms, from personal computers up to super computers.

Contents
Introduction
 1.1 Opening Remarks
 1.2 Scope of the Manual
 1.3 Hints on Using the PSL System
 1.4 Switches and Globals
 1.5 Compilation Versus Interpretation
 2.1 Data Types
 3.1 Numbers and Arithmetic Functions
Identifiers
 4.1 Introduction
 4.2 Identifiers and the Id Hash Table
 4.3 Property List Functions
 4.4 Value Cell Functions
 4.5 System Global Variables, Switches and Other ”Hooks”
List Structure
 5.1 Introduction to Lists and Pairs
 5.2 Basic Functions on Pairs
 5.3 Functions for Manipulating Lists
 5.4 Functions for Building and Searching A-Lists
 5.5 Substitutions
Characters and Strings
 6.1 Characters
 6.2 Strings
 6.3 Common LISP String Functions
Flow of Control
 7.1 Introduction
 7.2 Case and Selectq Statements
 7.3 Sequencing Evaluation
 7.4 Non-Local Exits
Function Definition and Binding
 8.1 Function Definition in PSL
 8.2 Wrappers
 8.3 Variables and Bindings
 8.4 User Binding Functions
The Interpreter
 9.1 Evaluator Functions Eval and Apply
 9.2 Support Functions for Eval and Apply
 9.3 Special Evaluator Functions, Quote and Function
 9.4 Support Functions for Macro Evaluation
Input and Output
 10.1 Introduction
 10.2 Printed Representation of LISP Objects
 10.3 Functions for Printing
 10.4 Functions for Reading
 10.5 File System Interface: Open and Close
 10.6 Loading Modules
 10.7 Reading Files into PSL
 10.8 About I/O Channels
 10.9 I/O to and from Lists and Strings
 10.10 Generalized Input/Output Streams
 10.11 Scan Table Internals
 10.12 Scan Table Utility Functions
 10.13 Binary I/O Functions
Top Level Loop
 11.1 Introduction
 11.2 The General Purpose Top Loop Function
 11.3 Changing the Default Top Level Function
Error Handling
 12.1 Introduction
 12.2 The Basic Error Functions
 12.3 Basic Error Handlers
 12.4 Break Loop
 12.5 Details on the Break Loop
 12.6 Some Convenient Error Calls
Debugging Tools
 13.1 The Debug Module
Miscellaneous Utilities
 14.1 Simulating a Stack
 14.2 Ring Buffers
 14.3 Word Vector Operations
Compiler
 15.1 Introduction
 15.2 Compiling Files
 15.3 Compiling Functions into Memory
 15.4 Compiler Errors and Warnings
 15.5 Differences between Compiled and Interpreted Code
 15.6 Constant Declaration
 15.7 Fluid and Global Declarations
 15.8 Control Over the Time When Something is Done
 15.9 Switches That Control the Compiler
 15.10 Conditional Compilation
 15.11 Implementation Details
Miscellaneous Useful Features
 16.1 Exiting PSL
 16.2 Saving an Executable PSL
 16.3 Init Files
 16.4 Miscellaneous Functions
 16.5 Garbage Collection
Cross Reference Tools
 17.1 Introduction
 17.2 Scanalyzer
Prettyprinting
 18.1 Introduction
 18.2 Prettyprinting Files and Data
 18.3 Formats
 18.4 Dispatch
 18.5 Specifying Formats
The Objects Module
 19.1 Introduction
 19.2 Creating Objects
 19.3 Reference Information
 19.4 Using Inheritance
 19.5 Debugging Information
Vectors and Such
 20.1 Vectors
 20.2 Word Vectors
 20.3 General X-Vector Operations
Operating System Contacts
 21.1 Calling the Command Shell
 21.2 The Working Directory
 21.3 Invoking Pipes
 21.4 Socket Interface (Unix only)
 21.5 Shared Memory Interface (Unix only)
 21.6 Miscellaneous Features
Calling Programs in Foreign Languages
Utilities for Profiling
PSL Command Line
Memory Management
Addendum
 26.1 Installation
 26.2 New unexec procedure, Image model
 26.3 Dynamic configuration of Heap Size and Binding Stack
 26.4 Size of Address Space
 26.5 Arbitrary Precision Integer Support
 26.6 Monitoring of Performance
 26.7 Compiler Modifications
 26.8 Disassembler
 26.9 More unsupported software
 26.10 Shared Memory Interface (Unix only)
 26.11 Socket interface (Unix only)
 26.12 Pipe Interface (Unix only)
 26.13 Mapping of LISP Addresses to C addresses
Index