Personal tools
You are here: Home Projects LISP XLISP XLISP 0.0 Sources unpacked David M. Betz. XLISP code and documentation. 1983.
Document Actions

David M. Betz. XLISP code and documentation. 1983.

by Paul McJones last modified 2011-01-24 13:31

XLISP code and documentation

Copyright 1983, by David M. Betz
114 Davenport Ave.
Manchester, NH 03103
603-625-4691
UUCP: decvax!betz
All rights reserved
Permission granted for unrestricted non-commercial use


XLISP is an experimental programming language combining some of the features
of LISP with an object oriented extension capability. All of the builtin
functions of XLISP are LISP like functions. The only builtin object class
is "class". This is sufficient to allow the language to be extended in an
object oriented manner. XLISP is very slow because of the way that it handles
dynamic memory allocation, hence it isn't a practical language for serious
applications. It was implemented to allow experimentation with object
oriented programming before Smalltalk-80 becomes available from Xerox.


Utility functions:

(load <fname>) LOAD AN XLISP SOURCE FILE
<fname> the filename string (default extension is ".lsp") (evaluated)
returns the filename

(mem) SHOW MEMORY ALLOCATION STATISTICS
returns nil

(gc) FORCE GARBAGE COLLECTION
returns nil

(alloc <num>) CHANGE THE NUMBER OF NODES TO ALLOCATE IN EACH SEGMENT
<num> the number of nodes to allocate (evaluated)
returns the old number of nodes to allocate

(expand <num>) EXPAND MEMORY BY ADDING SEGMENTS
<num> the number of segments to add (evaluated)
returns the number of segments added


Functions:

(eval <list>) EVALUATE A LIST AS XLISP CODE
<list> the list to be evaluated as an xlisp expression (evaluated)
returns the result of evaluating the expression

(set <sym> <expr>) SET THE VALUE OF A SYMBOL
<sym> the symbol being set (evaluated)
<expr> the new value (evaluated)
returns the new value

(setq <qsym> <expr>) SET THE VALUE OF A SYMBOL
<qsym> the symbol being set (quoted)
<expr> the new value (evaluated)
returns the new value

(print <expr>...) PRINT A LIST OF VALUES
<expr> the expressions to be printed (evaluated)
returns null

(quote <expr>) RETURN AN EXPRESSION UNEVALUATED
<expr> the expression to be quoted (quoted)
returns <expr> unevaluated

(if <expr> <expr1> [ <expr2> ]) EXECUTE EXPRESSIONS CONDITIONALLY
<texpr> test expression (evaluated)
<expr1> expression evaluated if texpr is non-null or non-zero
<expr2> expression evaluated if texpr is null or zero
returns the valued of the expression evaluated

(while <texpr> <expr>...) ITERATE WHILE AN EXPRESSION IS TRUE
<texpr> test expression evaluated at start of each iteration
<expr> expressions evaluated as long as <texpr> evaluates to
non-null or non-zero
returns the result of the last expression evaluated

(defun <qsym> <qfargs> <expr>...) DEFINE A NEW FUNCTION
<qsym> symbol to be defined (quoted)
<qfargs> list of formal arguments (quoted)
this list is of the form:
( <farg>... [ / <local>... ] )
where
<farg> is a formal argument
<local> is a local variable
<expr> expressions constituting the body of the function (quoted)
returns the function symbol


I/O Functions:

(readchr) READ A CHARACTER WITHOUT ECHO
returns one character string with next input character

(getnum) READ A SIGNED NUMBER WITHOUT ECHO
returns number as read from input (gobbles terminator)


String Functions:

(concat <expr>...) CONCATENATE STRINGS
<expr> string expressions (must be strings)
returns string with concatenation

(substr <expr> <sexpr> [<lexpr>]) RETURN SUBSTRING
<expr> string expressin
<sexpr> starting position (first char is 1)
<lexpr> optional length (default is rest of string)
returns substring starting at <sexpr> for <lexpr>

(makestr <expr> <sexpr>) MAKE STRING OF CHARS
<expr> length of result string
<sexpr> string, fill new string with first char
returns string <expr> long all of <sexpr>

(ascii <expr>) NUMERIC VALUE OF CHARACTER
<expr> string exprssion
returns numeric value of first character (according to ASCII)

(chr <expr>) CHARACTER EQUIVALENT OF ASCII VALUE
<expr> numeric expression
returns one character string with ASCII equivalent of <expr>


List Functions:

(head <expr>) RETURN THE HEAD ELEMENT OF A LIST (CAR sortof)
<expr> the list (evaluated)
returns the first element of the list

(tail <expr>) RETURN THE TAIL ELEMENTS OF A LIST (CDR sortof)
<expr> the list (evaluated)
returns the list minus the first element

(list <expr>...) CREATE A LIST OF VALUES
<expr> evaluated expressions to be combined into a list
returns the new list

(nth <n> <list>) RETURN THE NTH ELEMENT OF A LIST
<n> the number (zero origin) of the element to return (evaluated)
<list> the list to return the nth element of
returns the nth element or nil if the list isn't that long

(append <list> <expr>...) APPEND TO A LIST
<list> the initial list (evaluated)
<expr> expressions to be appended to the list (evaluated)
returns the new list

(prepend <list> <expr>...) APPEND TO THE FRONT OF A LIST
<list> the initial list (evaluated)
<expr> expressions to be prepended to the list (evaluated)
returns the new list


Arithmetic Functions:

(+ <expr>...) ADD A LIST OF VALUES
<expr> expressions to be added (evaluated)
returns the result of the addition

(- <expr>...) SUBTRACT A LIST OF VALUES
<expr> expressions to be subtracted (evaluated)
returns the result of the subtraction

(* <expr>...) MULTIPLY A LIST OF VALUES
<expr> expressions to be multiplied (evaluated)
returns the result of the multiplication

(/ <expr>...) DIVIDE A LIST OF VALUES
<expr> expressions to be divided (evaluated)
returns the result of the division

(% <expr>...) MODify A LIST OF VALUES? (the mod function)
<expr> expressions to be MODified? (evaluated)
returns the result of mod

(&& <expr>...) THE LOGICAL AND OF A LIST OF VALUES
<expr> expressions to be ANDed (evaluated)
returns the result of anding the expressions
(evaluation of expressions stops after the first expression
that evaluates to false)

(|| <expr>...) THE LOGICAL OR OF A LIST OF VALUES
<expr> expressions to be ORed (evaluated)
returns the result of oring the expressions
(evaluation of expressions stops after the first expression
that evaluates to true)

(! <expr>) THE LOGICAL NOT OF A VALUE
<expr> expression to be NOTed (evaluated)
return logical not of <expr>

(< <e1> <e2>) TEST WHETHER AN EXPRESSION IS LESS THAN ANOTHER
<e1> the left operand of the comparison (evaluated)
<e2> the right operand of the comparison (evaluated)
returns the result of comparing <e1> with <e2>

(<= <e1> <e2>) TEST WHETHER AN EXPRESSION IS LESS THAN OR EQUAL TO ANOTHER
<e1> the left operand of the comparison (evaluated)
<e2> the right operand of the comparison (evaluated)
returns the result of comparing <e1> with <e2>

(== <e1> <e2>) TEST WHETHER AN EXPRESSION IS EQUAL TO ANOTHER
<e1> the left operand of the comparison (evaluated)
<e2> the right operand of the comparison (evaluated)
returns the result of comparing <e1> with <e2>

(!= <e1> <e2>) TEST WHETHER AN EXPRESSION IS NOT EQUAL TO ANOTHER
<e1> the left operand of the comparison (evaluated)
<e2> the right operand of the comparison (evaluated)
returns the result of comparing <e1> with <e2>

(>= <e1> <e2>) TEST WHETHER AN EXPRESSION IS GREATER THAN OR EQUAL TO ANOTHER
<e1> the left operand of the comparison (evaluated)
<e2> the right operand of the comparison (evaluated)
returns the result of comparing <e1> with <e2>

(> <e1> <e2>) TEST WHETHER AN EXPRESSION IS GREATER THAN ANOTHER
<e1> the left operand of the comparison (evaluated)
<e2> the right operand of the comparison (evaluated)
returns the result of comparing <e1> with <e2>

(& <expr>...) THE BITWISE AND OF A LIST OF VALUES
<expr> expressions to be ANDed (evaluated)
returns the bit by bit ANDing of expressions

(| <expr...) THE BITWISE OR OF A LIST OF VALUES
<expr> expressions to be ORed (evaluated)
returns the bit by bit ORing of expressions

(~ <expr>) THE BITWISE NOT OF A VALUE
<expr> expression to be NOTed (evaluated)
returns the bit by bit inversion of expression

(min <expr>...) THE SMALLEST OF A LIST OF VALUES
<expr> expressions to be checked (evaluated)
returns the smallest value of the list

(max <expr>...) THE LARGEST OF A LIST OF VALUES
<expr> expressions to be checked (evaluated)
returns the largest value of the list


Keymap Functions:

(keymap) CREATE A NEW KEYMAP
returns a new keymap

(key <km> <kstr> <ksym>) ADD A KEY DEFINITION TO A KEYMAP
<km> the keymap (evaluated)
<kstr> the string defining the key (evaluated)
<ksym> the symbol for the message (evaluated)
returns the keymap

(kmprocess <km> <envlist>) PROCESS INPUT USING A KEYMAP
<km> the keymap (evaluated)
<envlist> list of active objects (evaluated)
returns (never returns)


SDB Database Functions:

(select <sstr>) SELECT RECORDS FROM AN SDB DATABASE
<sstr> SDB selection expression string (evaluated)
returns a database pointer

(fetch <dbptr) FETCH THE NEXT RECORD IN A SELECTION
<dbptr> the database pointer (evaluated)
returns the database pointer if a record was fetched
null otherwise

(update <dbptr>) UPDATE THE CURRENT RECORD
<dbptr> the database pointer (evaluated)
returns the database pointer

(store <dbptr>) STORE A NEW RECORD
<dbptr> the database pointer (evaluated)
returns the database pointer

(done <dbptr>) CLOSE A DATABASE SELECTION
<dbptr> the database pointer (evaluated)
returns null

(get <dbptr> <fname>) GET THE VALUE OF A FIELD IN THE CURRENT RECORD
<dbptr> the database pointer (evaluated)
<fname> the field name string (evaluated)
returns the database pointer

(put <dbptr> <fname> <vstr>) STORE A FIELD VALUE INTO THE CURRENT RECORD
<dbptr> the database pointer (evaluated)
<fname> the field name string (evaluated)
<vstr> the new value string (evaluated)
returns the database pointer


Symbols:

newline the newline character
tab the tab character
bell the bell character
self the current object (within a message context)


Classes:

class THE CLASS OF ALL OBJECT CLASSES (including itself)

Messages:

new CREATE A NEW INSTANCE OF A CLASS
returns the new class object

isnew INITIALIZE A NEW CLASS
returns the new class object

answer <msg> <fargs> <code> ADD A MESSAGE TO A CLASS
<msg> the message symbol (evaluated)
<fargs> the formal argument list (evaluated)
this list is of the form:
( <farg>... [ / <local>... ] )
where
<fargs> is a list of formal arguments
<locals> is a list of local variables
<code> a list of executable expressions (evaluated)
returns the object

ivars <vars> DEFINE THE LIST OF INSTANCE VARIABLES
<vars> the list of instance variable symbols (evaluated)
returns the object

(Note: When a new instance of a class is created by sending the message "new"
to an existing class, the message "isnew" followed by whatever parameters
were passed to the "new" message is send to the newly created object)

February 2013 »
Su Mo Tu We Th Fr Sa
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28
 

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: