Update clones
This commit is contained in:
parent
7e48bb96c8
commit
0370a2eecf
506 changed files with 76893 additions and 0 deletions
|
@ -0,0 +1,94 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; f computes square of x
|
||||||
|
(defun f (x) (* x x))
|
||||||
|
|
||||||
|
; show the function in use
|
||||||
|
(format t "f(3) gives square of 3: ~A~%" (f 3))
|
||||||
|
|
||||||
|
; try to display the component's of f
|
||||||
|
(format t "~%The original structure of f is:~%")
|
||||||
|
(dolist (component (function f))
|
||||||
|
(format t "the next component of f is ~A~%" component))
|
||||||
|
|
||||||
|
; all functions are stored as either in one of three forms:
|
||||||
|
;
|
||||||
|
; for functions created using defun
|
||||||
|
; (lambda-block functionName parameterList body)
|
||||||
|
;
|
||||||
|
; for functions created using labels
|
||||||
|
; (lambda-block-closure envList1 envList2 envList3 functionName parameterList body)
|
||||||
|
; note that envLists 2/3 can be circular lists, so if we print them we
|
||||||
|
; must first set *print-circle* to true to enable circle detection
|
||||||
|
;
|
||||||
|
; for functions created using closures
|
||||||
|
; (lambda-closure envList1 envList2 envList3 parameterList body)
|
||||||
|
;
|
||||||
|
; for lambda expressions that have not yet been evaluated into functions
|
||||||
|
; (lambda parameterList body)
|
||||||
|
;
|
||||||
|
; the first environment list consists of a list of pairs, identifying
|
||||||
|
; all the in-scope parameters and local variables and their current values
|
||||||
|
;
|
||||||
|
; the other two lists identify the block scopes in which the function was created
|
||||||
|
|
||||||
|
; thus if we want to examine the content of any (not-compiled) function, we can use:
|
||||||
|
|
||||||
|
; for functions defined using defun
|
||||||
|
; the car of f is 'lambda-block
|
||||||
|
; the cadr of f is the function name
|
||||||
|
; the caddr of f is the parameter list
|
||||||
|
; the cdddr of f is the body of f
|
||||||
|
|
||||||
|
; for functions defined using labels
|
||||||
|
; the car of f is 'lambda-block-closure
|
||||||
|
; the next three elements are environment lists, specifying
|
||||||
|
; - local variable/parameters and their values
|
||||||
|
; - creation environment 1
|
||||||
|
; - creation environment 2
|
||||||
|
; the caddr of (cddr f) is the function name
|
||||||
|
; the cadddr of (cddr f) is the parameter list
|
||||||
|
; the cddddr of (cddr f) is the body of f
|
||||||
|
|
||||||
|
; for functions defined otherwise (flet, closures, lambda)
|
||||||
|
; the car of f is 'lambda-closure
|
||||||
|
; the next three elements are environment lists, specifying
|
||||||
|
; - local variable/parameters and their values
|
||||||
|
; - creation environment 1
|
||||||
|
; - creation environment 2
|
||||||
|
; the caddr of (cddr f) is the parameter list
|
||||||
|
; the cdddr of (cddr f) is the body of f
|
||||||
|
|
||||||
|
; for lambda expressions that have not yet been evaluated to form functions
|
||||||
|
; the car of f is 'lambda
|
||||||
|
; the cadr of f is the parameter list
|
||||||
|
; the cddr of f is the body
|
||||||
|
|
||||||
|
|
||||||
|
; try to change the body of f to just x
|
||||||
|
(setf (cdddr (function f)) (list 'x))
|
||||||
|
|
||||||
|
; try to display the component's of f
|
||||||
|
(format t "~%The new structure of f is:~%")
|
||||||
|
(dolist (component (function f))
|
||||||
|
(format t "the next component of f is ~A~%" component))
|
||||||
|
|
||||||
|
; try to call f
|
||||||
|
(format t "~%calling the altered function, f(3) is ~A~%" (f 3))
|
||||||
|
|
||||||
|
; note that we can alter the name inside the function,
|
||||||
|
; but lisp's symbol table wouldn't know about that so
|
||||||
|
; wouldn't let us call it through the new name
|
||||||
|
|
||||||
|
; we can, however, create a function and associate it with
|
||||||
|
; any existing symbol (whether that used to be a variable
|
||||||
|
; or a function)
|
||||||
|
(defvar foo nil)
|
||||||
|
(setf (symbol-function 'foo) (lambda (x) (format t "inside foo, x is ~A~%" x)))
|
||||||
|
(format t "calling the new function through symbol foo~%")
|
||||||
|
(foo 3)
|
||||||
|
|
||||||
|
(format t "Is f bound to a function? ~A~%" (fboundp 'f))
|
||||||
|
(format t "Is foo bound to a function? ~A~%" (fboundp 'foo))
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
(defun myappend (L1 L2)
|
||||||
|
(cond
|
||||||
|
; error checking
|
||||||
|
((not (listp L1)) (format t "cannot append, first argument is not a list~%" L1))
|
||||||
|
((not (listp L2)) (format t "cannot append, second argument is not a list~%" L2))
|
||||||
|
; base cases
|
||||||
|
((null L1) L2)
|
||||||
|
((null L2) L1)
|
||||||
|
; general case, neither list is empty
|
||||||
|
(t (cons (car L1) (myappend (cdr L1) L2)))))
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; (apply 'function '(list of operands))
|
||||||
|
; -------------------------------------
|
||||||
|
; apply is used to run a function against a specific set of parameters,
|
||||||
|
; e.g. to get the effect (function op1 op2 op3)
|
||||||
|
; we would use (apply 'function (op1 op2 op3))
|
||||||
|
|
||||||
|
; use apply to run (- 1 2 3 4)
|
||||||
|
(setf x (apply '- '(1 2 3 4)))
|
||||||
|
|
||||||
|
; print the result
|
||||||
|
(format t "~A~%" x)
|
||||||
|
|
||||||
|
; explanation of the successive - operations:
|
||||||
|
; (((1-2) - 3) - 4) gives -8
|
||||||
|
|
||||||
|
; function to apply a function to a list of arguments
|
||||||
|
(defun applyTo (f L)
|
||||||
|
(cond
|
||||||
|
((not (functionp f)) (format t "~A is not a function~%" f))
|
||||||
|
((not (listp L)) (format t "~A is not a list of operands~%" L))
|
||||||
|
(t (apply f L))))
|
||||||
|
|
||||||
|
(applyTo 'format '(t "hello!~%"))
|
||||||
|
(format t "3+3 is ~A~%" (applyTo '+ '(3 3)))
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
; (approxeq x y)
|
||||||
|
; --------------
|
||||||
|
; return true if x and y are equal
|
||||||
|
; or if x and y are numeric and within 0.001% of each other
|
||||||
|
; return nil otherwise
|
||||||
|
(defun approxeq (x y)
|
||||||
|
"(approxeq x y) true if value of x is within 0.001% of value of y"
|
||||||
|
(let ((precision 0.00001) ; allowable difference, 0.01 is 1%
|
||||||
|
(denom x)) ; either x or y, whichever is nonzero
|
||||||
|
(diffratio 0) ; will be set to abs(x-y)/denom
|
||||||
|
(cond
|
||||||
|
((not (numberp x)) (eq x y)) ; if not numbers just use eq
|
||||||
|
((not (numberp y)) nil) ; x is number, y isn't
|
||||||
|
((= x y) t) ; quick check if they are truly equal
|
||||||
|
(t (block
|
||||||
|
(setf denom (if (= 0 x) y) x) ; pick nonzero element of x,y
|
||||||
|
(setf diffratio (abs (/ (- x y) denom))) ; calc abs(x-y)/denom
|
||||||
|
(if (< diffratio precision) t nil) ; see if meets precision reqs.
|
||||||
|
)))))
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; (getArrSlize arr rowNum)
|
||||||
|
; ------------------------
|
||||||
|
; given an array and a row number,
|
||||||
|
; get one row of an array as a vector
|
||||||
|
(defun getArrSlice (arr rowNum)
|
||||||
|
(make-array (array-dimension arr 1)
|
||||||
|
:displaced-to arr
|
||||||
|
:displaced-index-offset (* rowNum (array-dimension arr 1))))
|
||||||
|
|
||||||
|
; try it out
|
||||||
|
(defvar arr (make-array '(3 4) :initial-element 1))
|
||||||
|
(format t "~%as array:~%~A~%~%" arr)
|
||||||
|
(format t "~%as list:~%~A~%~%" (getArrSlice arr 1))
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; function to print an arrays dimensions and contents
|
||||||
|
(defun prtArr (arr)
|
||||||
|
(cond
|
||||||
|
((not (arrayp arr)) (format t "Not an array ~A~%" arr))
|
||||||
|
(t (block
|
||||||
|
(format t "the array dimensions are ~A~%" (array-dimensions arr))
|
||||||
|
(format t "the length of dimension 0 is ~A~%" (array-dimension arr 0))
|
||||||
|
(format t "and its contents are ~A~%" arr)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
; create a 3x4 array, initialize the contents to 0
|
||||||
|
(setf myArr (make-array '(3 4) :initial-element 0))
|
||||||
|
|
||||||
|
; set element [2][3] to -1
|
||||||
|
(setf (aref myArr 2 3) -1)
|
||||||
|
|
||||||
|
; set element [1][0] to 1
|
||||||
|
(setf (aref myArr 1 0) 1)
|
||||||
|
|
||||||
|
; pass the array to prtArr for display
|
||||||
|
(prtArr myArr)
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; (ascSeqs L)
|
||||||
|
; -----------
|
||||||
|
; given L is a list of numbers,
|
||||||
|
; return a list with the numbers in the same order
|
||||||
|
; but broken into lists of strictly ascending sequences
|
||||||
|
; e.g.
|
||||||
|
; (ascSeqs '(3 4 1 2)) ; returns ((3 4) (1 2))
|
||||||
|
; (ascSeqs '(1 2 0 3 3 11 4)) returns ((1 2) (0 3) (3 11) (4))
|
||||||
|
; returns nil if L is not a list of numbers
|
||||||
|
;
|
||||||
|
; uses a "private" accumulator to track what we've processed so far
|
||||||
|
(defun ascSeqs (L &optional (soFar 'ascSeqs_unstarted))
|
||||||
|
(cond
|
||||||
|
; basic error checking, L must be a list
|
||||||
|
((not (listp L)) nil)
|
||||||
|
|
||||||
|
; if this is the first call to ascSeqs, begin by reversing L
|
||||||
|
((equal soFar 'ascSeqs_unstarted) (ascSeqs (reverse L) nil))
|
||||||
|
|
||||||
|
; base case, return accumulated result
|
||||||
|
((null L) soFar)
|
||||||
|
|
||||||
|
; basic error checking, L's elements must be numbers
|
||||||
|
((not (numberp (car L))) nil)
|
||||||
|
|
||||||
|
; if this is the first value pulled from L, make it the
|
||||||
|
; the only element in the only list in soFar, then recurse
|
||||||
|
((null soFar) (ascSeqs (cdr L) (list (list (car L)))))
|
||||||
|
|
||||||
|
; if the next thing in L belongs at the start of the first
|
||||||
|
; sequence in soFar, add it to that sequence and rebuild soFar
|
||||||
|
((< (car L) (caar soFar)) (ascSeqs (cdr L)
|
||||||
|
(cons (cons (car L) (car soFar)) (cdr soFar))))
|
||||||
|
|
||||||
|
; otherwise the next thing in L belongs in a sequence of its own
|
||||||
|
; at the start of soFar
|
||||||
|
(t (ascSeqs (cdr L) (cons (list (car L)) soFar)))))
|
||||||
|
|
||||||
|
|
||||||
|
; ---- try out our function ----
|
||||||
|
(format t "Please enter a list of numbers:~%")
|
||||||
|
(defvar L (read))
|
||||||
|
(format t "The asc sequences of ~A are:~%~A~%" L (ascSeqs L))
|
||||||
|
|
|
@ -0,0 +1,237 @@
|
||||||
|
|
||||||
|
; (bfs Graph StartList)
|
||||||
|
; -------------------------
|
||||||
|
; assuming Graph represents a directed graph expressed as a
|
||||||
|
; list of pairs of the form (vertexid adjacencylist),
|
||||||
|
; where all vertices are specified by an integer id,
|
||||||
|
; and assuming StartList is a list of vertices in the graph
|
||||||
|
; to use as starting points,
|
||||||
|
; return a list of ids of all the vertices in the graph
|
||||||
|
; reachable from at least one of the starting vertices
|
||||||
|
; return nil if the graph is invalid
|
||||||
|
; (invalid structure, or contains multi-edges, or contains self-edges)
|
||||||
|
(defun bfs (Graph StartList)
|
||||||
|
(let
|
||||||
|
; list of local vars
|
||||||
|
( ; Ghash is the hash table of vertex ids - adjacency lists
|
||||||
|
(Ghash (make-hash-table))
|
||||||
|
)
|
||||||
|
|
||||||
|
; check if Graph is a valid pairs list
|
||||||
|
(if (pairsList Graph)
|
||||||
|
|
||||||
|
; if ok so far, try adding the pairs to the table
|
||||||
|
; and set ok to the result
|
||||||
|
(if (addpairs Graph Ghash)
|
||||||
|
|
||||||
|
; if ok so far, check for undeclared destination vertices
|
||||||
|
; (i.e. a vertex id in an adj list isn't a key in Ghash)
|
||||||
|
; for self edges (a vertex id is in its own adj list)
|
||||||
|
; and for duplicate edges (an adj list contains duplicate ids)
|
||||||
|
(if (checkdest Graph Ghash)
|
||||||
|
|
||||||
|
; if ok so far, check that all the vertices in StartList are valid
|
||||||
|
(if (keyList StartList Ghash)
|
||||||
|
|
||||||
|
; if ok so far, then call (bfsInternal Ghash ProcessList ReachableList)
|
||||||
|
; using the StartList with duplicates removed as the vertices
|
||||||
|
; need to be processed and the list of reachable vertices
|
||||||
|
(bfsInternal Ghash (removeDups StartList) (removeDups StartList))
|
||||||
|
|
||||||
|
; if any of the above if statements failed generate an error message and return nil
|
||||||
|
(errmsg "keyList failed"))
|
||||||
|
(errmsg "checkdest failed"))
|
||||||
|
(errmsg "addpairs failed"))
|
||||||
|
(errmsg "pairsList failed"))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
; (bfsInternal GraphHash ProcessList ReachableList)
|
||||||
|
; -----------------------------------------
|
||||||
|
; given that GraphHash is the hash table representation of
|
||||||
|
; vertices and their adjacency lists,
|
||||||
|
; and that ProcessList is the list of current exploration points,
|
||||||
|
; and ReachableList is the list of known reachable vertices,
|
||||||
|
; complete the exploration and return the list of
|
||||||
|
; all reachable vertices
|
||||||
|
(defun bfsInternal (GraphHash ProcessList ReachableList)
|
||||||
|
(cond
|
||||||
|
; if ProcessList is empty, we are done
|
||||||
|
((eq ProcessList '()) ReachableList)
|
||||||
|
; otherwise update the reachable list based
|
||||||
|
; on what is connected to the next element
|
||||||
|
; and continue exploring with the rest of the process list
|
||||||
|
(t (let ( ; use locals to look up the current key/value
|
||||||
|
(vertex (car ProcessList))
|
||||||
|
(adjlist (removeDups (gethash (car ProcessList) GraphHash)))
|
||||||
|
)
|
||||||
|
(bfsInternal GraphHash
|
||||||
|
; the new process list is the tail of the old one plus any
|
||||||
|
; newly reachable vertices from the current source vertex
|
||||||
|
(append (cdr ProcessList)
|
||||||
|
(diff adjlist ReachableList))
|
||||||
|
; the new reachable list is the old one plus any additional
|
||||||
|
; vertices reachable from the current source vertex
|
||||||
|
(append ReachableList
|
||||||
|
(diff adjlist ReachableList)))))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
; (keyList L HT)
|
||||||
|
; -----------------------
|
||||||
|
; assuming hash table HT has already been filled,
|
||||||
|
; check that L is indeed a list,
|
||||||
|
; and that every element of L appears as a key in HT
|
||||||
|
(defun keyList (L HT)
|
||||||
|
(cond
|
||||||
|
; reject non-lists
|
||||||
|
((not (listp L)) (errmsg "Not a list"))
|
||||||
|
; accept empty lists
|
||||||
|
((eq L '()) T)
|
||||||
|
; reject if the head is an invalid key
|
||||||
|
((eq (gethash (car L) HT) nil) (errmsg "Invalid vertex id in list"))
|
||||||
|
; check the remainder of the list
|
||||||
|
(t (keyList (cdr L) HT))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
; (errMsg M)
|
||||||
|
; ----------
|
||||||
|
; prints an error message and returns false
|
||||||
|
(defun errMsg (M)
|
||||||
|
(let () (format t "~A~%" M) nil)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
; (msg M Val)
|
||||||
|
; ---------
|
||||||
|
; prints a message on one line and an indented value on the next
|
||||||
|
(defun msg (M Val)
|
||||||
|
(format t "~A~% ~A~%" M Val)
|
||||||
|
)
|
||||||
|
|
||||||
|
; (pairsList L)
|
||||||
|
; -------------
|
||||||
|
; checks that L is a list of pairs
|
||||||
|
(defun pairsList (L)
|
||||||
|
(cond
|
||||||
|
; reject non-lists
|
||||||
|
((not (listp L)) (errMsg "given non-list"))
|
||||||
|
; accept empty lists
|
||||||
|
((eq L '()) t)
|
||||||
|
; head of L must be a 2-element list
|
||||||
|
((not (listp (car L))) (errmsg "graph contains non-list in place of a vertex/adjlist pair"))
|
||||||
|
((not (eq (length (car L)) 2)) (errmsg "graph contains non-pair for key-value"))
|
||||||
|
; head of head of L must be an integer
|
||||||
|
((not (integerp (car (car L)))) (errmsg "non-integer vertex id"))
|
||||||
|
; second element of head of L must be a list
|
||||||
|
((not (list (car (cdr (car L))))) (errmsg "non-list in place of adj list"))
|
||||||
|
; if head is ok then check the rest of the list
|
||||||
|
(t (pairsList (cdr L)))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
; (addpairs L HT)
|
||||||
|
; ---------------
|
||||||
|
; adds each (key value) pair in list L to hash table HT
|
||||||
|
; assumes L and HT have already been validated
|
||||||
|
(defun addpairs (L HT)
|
||||||
|
(if (eq L '()) t ; if L is empty we're done
|
||||||
|
; otherwise add the next key value pair to the hash table
|
||||||
|
; and call recursively on the remainder of the list
|
||||||
|
; note that if the value is an empty list we'll add the word 'empty
|
||||||
|
; instead, so on retrieval we can tell the difference between
|
||||||
|
; an empty adjacency list and a missing key
|
||||||
|
(let* ( ; use local vars for the key and value
|
||||||
|
(key (car (car L)))
|
||||||
|
(value (car (cdr (car L)))) ; 2nd element of the head
|
||||||
|
)
|
||||||
|
(if (eq value '()) (setf (gethash key HT) 'empty)
|
||||||
|
(setf (gethash key HT) value))
|
||||||
|
(addpairs (cdr L) HT)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
; (removeDups List)
|
||||||
|
; -----------------
|
||||||
|
; return a copy of the list with duplicate elements removed
|
||||||
|
(defun removeDups (List)
|
||||||
|
(cond
|
||||||
|
((not (listp List)) '())
|
||||||
|
((< (length List) 2) List)
|
||||||
|
((not (member (car List) (cdr List))) (cons (car List) (removeDups (cdr List))))
|
||||||
|
(t (removeDups (cdr List)))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
; (diff List1 List2)
|
||||||
|
; ------------------
|
||||||
|
; return the list of elements that are in List1 but not List2
|
||||||
|
(defun diff (List1 List2)
|
||||||
|
(cond
|
||||||
|
((not (listp List2)) List1)
|
||||||
|
((eq 0 (length List2)) List1)
|
||||||
|
((not (listp List1)) '())
|
||||||
|
((eq '() List1) '())
|
||||||
|
((member (car List1) List2) (diff (cdr List1) List2))
|
||||||
|
(t (cons (car List1) (diff (cdr List1) List2)))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
; (containsDups L)
|
||||||
|
; -------------------
|
||||||
|
; returns true if L contains duplicate elements
|
||||||
|
(defun containsDups (L)
|
||||||
|
(cond
|
||||||
|
((not (listp L)) nil)
|
||||||
|
((< (length L) 2) nil)
|
||||||
|
((member (car L) (cdr L)) t)
|
||||||
|
(t (containsDups (cdr L)))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
; (checkdest Graph Ghash)
|
||||||
|
; -----------------------
|
||||||
|
; assuming pairsList has already validated graph
|
||||||
|
; and addPairs has already built up Ghash,
|
||||||
|
; check for undeclared destination vertices
|
||||||
|
; (i.e. a vertex id in an adj list isn't a key in Ghash),
|
||||||
|
; for self edges (a vertex id is in its own adj list), and
|
||||||
|
; for duplicate edges (an adj list contains duplicate ids)
|
||||||
|
(defun checkdest (Graph Ghash)
|
||||||
|
(cond
|
||||||
|
((eq Graph '()) t) ; accept empty graph
|
||||||
|
(t (let* ( ; extract front vertex id and adj list,
|
||||||
|
; lookup corresponding hash table entry
|
||||||
|
(vertex (car (car Graph)))
|
||||||
|
(adjlist (car (cdr (car Graph))))
|
||||||
|
(entry (gethash vertex Ghash))
|
||||||
|
)
|
||||||
|
(cond
|
||||||
|
; accept vertices with no outgoing edges
|
||||||
|
((eq entry 'empty) t)
|
||||||
|
; reject vertices with no hash table entry
|
||||||
|
((eq entry nil) (errmsg "destination vertex is not defined in graph"))
|
||||||
|
; reject if adjlist is not a list
|
||||||
|
((not (listp adjlist)) (errmsg "non-list supplied instead of adjaency list"))
|
||||||
|
; reject self edges
|
||||||
|
((member vertex adjlist) (errmsg "graph invalid: contains self edge"))
|
||||||
|
; reject multi-edges
|
||||||
|
((containsDups adjlist) (errmsg "graph invalid: contains duplicate edges"))
|
||||||
|
; reject if any vertices in the adjacency list are not in the hash table
|
||||||
|
((not (keyList adjlist Ghash)) (errmsg "destination vertex not defined"))
|
||||||
|
; call recursively on rest of list
|
||||||
|
(t (checkdest (cdr Graph) Ghash))
|
||||||
|
)
|
||||||
|
))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; (checksum N)
|
||||||
|
; ------------
|
||||||
|
; checksum expects a parameter, N, as a non-negative integer
|
||||||
|
; whose least significant D bits are treated as data bits,
|
||||||
|
; and all higher bits are treated as check bits
|
||||||
|
; the function returns true iff the check bits represent a
|
||||||
|
; correct count of the number of zeros in the data bits
|
||||||
|
;
|
||||||
|
; e.g. (checksum 658 7)
|
||||||
|
; N last 12 bits 7 data bits preceeding check bits
|
||||||
|
; 658 001010010010 0010010 00101
|
||||||
|
; there are 5 zeroes in the data bits, which is the same as
|
||||||
|
; the binary value shown in the checkbits, so N is valid
|
||||||
|
;
|
||||||
|
; more examples, showing just 10 bits of N since all higher bits are 0's
|
||||||
|
;
|
||||||
|
; N check/databits Result (explanation)
|
||||||
|
; 658 101 0010010 valid (count is 5, 5 zeros in last 7 bits)
|
||||||
|
; 399 011 0001111 valid (count is 3, 3 zeros in last 7 bits)
|
||||||
|
; 100 000 1100100 invalid (count is 0, 4 zeros in last 7 bits)
|
||||||
|
; 723 101 1010011 invalid (count is 5, 3 zeros in last 7 bits)
|
||||||
|
; -7 N/A invalid (N is out of range)
|
||||||
|
; "foo" N/A invalid (N is incorrect data type)
|
||||||
|
;
|
||||||
|
;
|
||||||
|
(defun checksum (N &optional (D 7))
|
||||||
|
"returns t iff N is a non-negative integer representing a bit sequence whose last D bits are data and all preceding bits represent a count of the zeroes in the data bits"
|
||||||
|
(let ((count 0))
|
||||||
|
(cond
|
||||||
|
((not (integerp N)) nil)
|
||||||
|
((< N 0) nil)
|
||||||
|
(t (block 'checkTheSum
|
||||||
|
(dotimes (pos D)
|
||||||
|
(when (= 0 (logand N (ash 1 pos))) (incf count)))
|
||||||
|
(= count (logand D (ash N (- D)))))))))
|
||||||
|
|
||||||
|
; try our examples above
|
||||||
|
(let ((N 0))
|
||||||
|
(setf N 658) (format t "N: ~A, result: ~A~%" N (checksum N))
|
||||||
|
(setf N 399) (format t "N: ~A, result: ~A~%" N (checksum N))
|
||||||
|
(setf N 100) (format t "N: ~A, result: ~A~%" N (checksum N))
|
||||||
|
(setf N 723) (format t "N: ~A, result: ~A~%" N (checksum N))
|
||||||
|
(setf N -7) (format t "N: ~A, result: ~A~%" N (checksum N))
|
||||||
|
(setf N "foo") (format t "N: ~A, result: ~A~%" N (checksum N))
|
||||||
|
)
|
||||||
|
|
||||||
|
; sample run results:
|
||||||
|
; N: 658, result: T
|
||||||
|
; N: 399, result: T
|
||||||
|
; N: 100, result: NIL
|
||||||
|
; N: 723, result: NIL
|
||||||
|
; N: -7, result: NIL
|
||||||
|
; N: foo, result: NIL
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
|
||||||
|
; there are a number of bitwise logic operators,
|
||||||
|
; which assume a 2's complement form for their arguments:
|
||||||
|
; (lognot x)
|
||||||
|
; (logand x y) (lognand x y)
|
||||||
|
; (logior x y) (lognor x y) for inclusive-or
|
||||||
|
; (logxor x y) for exclusive-or
|
||||||
|
|
||||||
|
; there is also an arithmetic shift operation for 2's comp:
|
||||||
|
; (ash x 1) shifts x left 1, effectively multiplying by 2
|
||||||
|
; (ash x -1) shifts x right 1, effectively doing integer division by 2
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; create a block of statements,
|
||||||
|
; can be placed anywhere a single statement would be,
|
||||||
|
; first element of the block is treated as its name (not evaluated)
|
||||||
|
; the return value of the block is the return value
|
||||||
|
; of the last statement
|
||||||
|
|
||||||
|
(block
|
||||||
|
myBlockName
|
||||||
|
(format t "this is my block~%")
|
||||||
|
(format t "return the list 1 2 3~%")
|
||||||
|
'(1 2 3)
|
||||||
|
)
|
||||||
|
|
||||||
|
; the name allows us to have nested blocks, and thus
|
||||||
|
; to use the name of a specific block when we want to
|
||||||
|
; do something like return-from, e.g.
|
||||||
|
(defvar result
|
||||||
|
(block
|
||||||
|
outer
|
||||||
|
(format t "in the outer block~%")
|
||||||
|
(block
|
||||||
|
inner
|
||||||
|
(format t "in the inner block~%")
|
||||||
|
(return-from outer 3))
|
||||||
|
(format t "back in the outer block~%"))) ; <-- never reached
|
||||||
|
|
||||||
|
(format t "after all loops, result is ~A~%" result)
|
||||||
|
|
||||||
|
; note that many of the different block forms (let, prog, etc)
|
||||||
|
; either use an implicit block name of nil
|
||||||
|
; or allow the programmer to assigne a name to the block
|
||||||
|
|
|
@ -0,0 +1,103 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
|
||||||
|
;(setf mytree (bstree))
|
||||||
|
; ---------------------
|
||||||
|
; builds a binary search tree (initially empty)
|
||||||
|
; whose nodes each contain a string key and an associated value,
|
||||||
|
; it returns a dispatcher that allows the user to do the following
|
||||||
|
; (funcall mytree 'insert key val) ; insert a new node in the tree
|
||||||
|
; (funcall mytree 'lookup key) ; returns the associated value or nil
|
||||||
|
; (funcall mytree 'prttree) ; prints the tree contents in sorted order
|
||||||
|
; internally tree nodes look like (key value leftsubtree rightsubtree)
|
||||||
|
; with '() indicating empty subtrees
|
||||||
|
(defun bstree (&optional (treeinit '()))
|
||||||
|
(let* ( ; fields of the tree class
|
||||||
|
(root treeinit) ; root of the tree
|
||||||
|
)
|
||||||
|
(labels (
|
||||||
|
; methods of the tree class
|
||||||
|
(lookup (key &optional (subtree root))
|
||||||
|
(cond
|
||||||
|
((not (stringp key)) nil)
|
||||||
|
((null subtree) nil)
|
||||||
|
((string= key (car subtree)) (cadr subtree))
|
||||||
|
((string< key (car subtree)) (lookup key (caddr subtree)))
|
||||||
|
(t (lookup key (cadddr subtree)))
|
||||||
|
))
|
||||||
|
(prttree (&optional (subtree root))
|
||||||
|
(when (not (null subtree))
|
||||||
|
(prttree (caddr subtree))
|
||||||
|
(format t "~A:~A~%" (car subtree) (cadr subtree))
|
||||||
|
(prttree (cadddr subtree))))
|
||||||
|
(insert (key value &optional (subtree root))
|
||||||
|
(cond
|
||||||
|
((not (stringp key)) nil) ; bad key
|
||||||
|
((null subtree) ; empty tree so far, insert in root
|
||||||
|
(setf root (list key value '() '())))
|
||||||
|
((string< key (car subtree)) ; goes in left subtree, i.e. the caddr
|
||||||
|
(if (null (caddr subtree))
|
||||||
|
; left is empty, insert here
|
||||||
|
(setf (caddr subtree) (list key value '() ()))
|
||||||
|
; left is not empty, go recursively
|
||||||
|
(insert key value (caddr subtree))))
|
||||||
|
(t (if (null (cadddr subtree)) ; goes in right subtree, i.e. the cadddr
|
||||||
|
; right is empty, insert here
|
||||||
|
(setf (cadddr subtree) (list key value '() ()))
|
||||||
|
; right is not empty, go recursively
|
||||||
|
(insert key value (cadddr subtree)))))))
|
||||||
|
; dispatch function for the tree
|
||||||
|
(lambda (command &optional key value)
|
||||||
|
(cond
|
||||||
|
((equalp command 'prttree) (prttree))
|
||||||
|
((equalp command 'lookup) (lookup key))
|
||||||
|
((equalp command 'insert) (insert key value))
|
||||||
|
)))))
|
||||||
|
|
||||||
|
|
||||||
|
(defvar mytree (bstree '()))
|
||||||
|
(setf other (bstree '()))
|
||||||
|
(format t "~%Printing empty tree~%")
|
||||||
|
(funcall mytree 'prttree)
|
||||||
|
(format t "~%Inserting nodes~%")
|
||||||
|
(funcall mytree 'insert "june" 30)
|
||||||
|
(funcall mytree 'prttree)
|
||||||
|
(funcall mytree 'insert "july" 31)
|
||||||
|
(funcall mytree 'prttree)
|
||||||
|
(funcall mytree 'insert "april" 30)
|
||||||
|
(funcall mytree 'prttree)
|
||||||
|
(funcall mytree 'insert "may" 31)
|
||||||
|
(funcall mytree 'prttree)
|
||||||
|
(funcall mytree 'insert "december" 31)
|
||||||
|
(funcall mytree 'prttree)
|
||||||
|
(funcall mytree 'insert "august" 31)
|
||||||
|
(funcall mytree 'prttree)
|
||||||
|
(funcall mytree 'insert "october" 31)
|
||||||
|
(funcall mytree 'prttree)
|
||||||
|
(funcall mytree 'insert "september" 30)
|
||||||
|
(funcall mytree 'prttree)
|
||||||
|
(funcall mytree 'insert "march" 31)
|
||||||
|
(funcall mytree 'prttree)
|
||||||
|
(funcall mytree 'insert "january" 31)
|
||||||
|
(funcall mytree 'prttree)
|
||||||
|
(funcall mytree 'insert "november" 30)
|
||||||
|
(funcall mytree 'prttree)
|
||||||
|
(funcall mytree 'insert "february" 28)
|
||||||
|
(format t "~%Printing tree of 12 keys~%")
|
||||||
|
(funcall mytree 'prttree)
|
||||||
|
(format t "~%Testing valid lookups~%")
|
||||||
|
(format t "Looking up january ~A~%" (funcall mytree 'lookup "january"))
|
||||||
|
(format t "Looking up february ~A~%" (funcall mytree 'lookup "february"))
|
||||||
|
(format t "Looking up march: ~A~%" (funcall mytree 'lookup "march"))
|
||||||
|
(format t "Looking up april ~A~%" (funcall mytree 'lookup "april"))
|
||||||
|
(format t "Looking up may ~A~%" (funcall mytree 'lookup "may"))
|
||||||
|
(format t "Looking up june ~A~%" (funcall mytree 'lookup "june"))
|
||||||
|
(format t "Looking up july ~A~%" (funcall mytree 'lookup "july"))
|
||||||
|
(format t "Looking up august ~A~%" (funcall mytree 'lookup "august"))
|
||||||
|
(format t "Looking up september ~A~%" (funcall mytree 'lookup "september"))
|
||||||
|
(format t "Looking up october ~A~%" (funcall mytree 'lookup "october"))
|
||||||
|
(format t "Looking up november ~A~%" (funcall mytree 'lookup "november"))
|
||||||
|
(format t "Looking up december ~A~%" (funcall mytree 'lookup "december"))
|
||||||
|
(format t "~%Testing invalid lookup~%")
|
||||||
|
(format t "Looking up foo ~A~%~%" (funcall mytree 'lookup "foo"))
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; (buildRotate N)
|
||||||
|
; ---------------
|
||||||
|
; returns a function that takes a list, L, as a parameter and
|
||||||
|
; rotates the list by N positions
|
||||||
|
; (if L is not a list the function simply returns it,
|
||||||
|
; also just returns L in cases where N is invalid or < 1)
|
||||||
|
;
|
||||||
|
; construction algorithm:
|
||||||
|
; what should be built can be simplified based on N
|
||||||
|
; if N < 1 or invalid no rotation needed, so just return the original list
|
||||||
|
; (lambda (L) L)
|
||||||
|
; otherwise build the customized rotation out of value N
|
||||||
|
; (lambda (L)
|
||||||
|
; (cond
|
||||||
|
; ((not (listp L)) L) ; base case
|
||||||
|
; (t (let* ((len (length L)) ; get length of L for computing fN, lN
|
||||||
|
; (fN (mod N len)) ; if N > len we can drop the first k*len cycles,
|
||||||
|
; ; fN is amount of L that 'drops off' the left side
|
||||||
|
; (lN (- len fN)) ; lN is amount of L that winds up at front of list
|
||||||
|
; (if (< fN 1) L ; don't bother shifting if fN is 0
|
||||||
|
; ; general case, the lN tail elements followed by fN front elements
|
||||||
|
; (append (last L lN) (butlast L (- (length L) N)))))))))
|
||||||
|
(defun buildRotate (N)
|
||||||
|
(cond
|
||||||
|
((not (integerp N)) (lambda (L) L))
|
||||||
|
((< N 1) (lambda (L) L))
|
||||||
|
(t (lambda (L)
|
||||||
|
(cond
|
||||||
|
((not (listp L)) L)
|
||||||
|
((null L) L)
|
||||||
|
(t (let* ((len (length L))
|
||||||
|
(fN (mod N len))
|
||||||
|
(lN (- len fN)))
|
||||||
|
(if (< fN 1) L
|
||||||
|
(append (last L lN) (butlast L lN))))))))))
|
||||||
|
|
||||||
|
(defun main ()
|
||||||
|
(let ; local variables
|
||||||
|
((L nil) ; the list to be rotated
|
||||||
|
(N 0) ; the number of positions to rotate
|
||||||
|
(F nil) ; the constructed list rotation function
|
||||||
|
(R nil)) ; the resulting list
|
||||||
|
|
||||||
|
; get L and N
|
||||||
|
(format t "Enter the list to be rotated~%")
|
||||||
|
(setf L (read))
|
||||||
|
(format t "Enter the number of positions to rotate~%")
|
||||||
|
(setf N (read))
|
||||||
|
|
||||||
|
; build the rotation function
|
||||||
|
(setf F (buildRotate N))
|
||||||
|
|
||||||
|
; if F is a function, apply it to L
|
||||||
|
; otherwise display an error message
|
||||||
|
(if (functionp F) (setf R (funcall F L))
|
||||||
|
(format t "Returned function is not valid: ~A~%" F))
|
||||||
|
|
||||||
|
; display the final result
|
||||||
|
(format t "The final result is ~A~%" R)))
|
||||||
|
|
||||||
|
; run the main routine
|
||||||
|
(main)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; compute and display your grade so far from a list of mark data,
|
||||||
|
; where the format for each assessment item is
|
||||||
|
; (actualMark maxPossibleMark weight)
|
||||||
|
; the weight is 0..100 (representing the weight of that assessment
|
||||||
|
; item as a percent of the total grade
|
||||||
|
;
|
||||||
|
; for example, suppose so far you have:
|
||||||
|
; 12/16 on an assignment worth 10%,
|
||||||
|
; 20/24 on a midterm worth 21%
|
||||||
|
;
|
||||||
|
; (calcGrade '((12 16 10) (20 24 21)))
|
||||||
|
;
|
||||||
|
; With 31.0% of the assessment completed, your average so far is 80.64%
|
||||||
|
;
|
||||||
|
|
||||||
|
(defun calcGrade (marksList)
|
||||||
|
(cond
|
||||||
|
((not (listp marksList)) (format t "Invalid marks list: ~A~%" marksList))
|
||||||
|
((null marksList) (format t "No marks entered yet~%"))
|
||||||
|
(t (let ( (percent 0.0) (total 0.0) (mark 0) (max 0) (weight 0))
|
||||||
|
(dolist (m marksList)
|
||||||
|
(when (and (listp m) (= 3 (length m)))
|
||||||
|
(setf mark (car m))
|
||||||
|
(setf max (cadr m))
|
||||||
|
(setf weight (caddr m))
|
||||||
|
(when (and (> max 0) (>= mark 0) (>= max mark) (> weight 0) (<= weight 100))
|
||||||
|
(setf percent (+ percent weight))
|
||||||
|
(setf total (+ total (/ (* weight mark) max))))))
|
||||||
|
(format t "With ~A% of the assessment completed, " percent)
|
||||||
|
(format t "your average so far is ~5,2F%~%" (/ (* 100 total) percent))))))
|
||||||
|
|
||||||
|
; let's try it out with out example data:
|
||||||
|
(calcGrade '((12 16 10) (20 24 21)))
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; examples using case for testing value of an item
|
||||||
|
|
||||||
|
; initialize a variable x (just for the sake of the example)
|
||||||
|
(defvar x 3)
|
||||||
|
|
||||||
|
; case acts much like a C switch statement
|
||||||
|
(case x
|
||||||
|
(0 (format t "x is 0~%"))
|
||||||
|
(1 (format t "x is 1~%"))
|
||||||
|
(2 (format t "x is 2~%"))
|
||||||
|
("hi" (format t "x is string hi~%"))
|
||||||
|
('(2 4 6) (format t "x is list (2 4 6)~%"))
|
||||||
|
(3 (format t "x is 3~%"))
|
||||||
|
(otherwise (format t "x is something else~%"))
|
||||||
|
)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
|
||||||
|
; catch and throw work a little differently than in
|
||||||
|
; most languages:
|
||||||
|
;
|
||||||
|
; catch defines a block during which a throw may occur,
|
||||||
|
; rather like a try block in other languages
|
||||||
|
;
|
||||||
|
; while throw identifies which block it is exiting,
|
||||||
|
; and what value to return
|
||||||
|
;
|
||||||
|
; (this is essentially a re-branding of blocks and return-from)
|
||||||
|
|
||||||
|
(catch 'example ; example being the name of our block
|
||||||
|
(... do whatever ...)
|
||||||
|
(if (somecondition)
|
||||||
|
(throw 'example "nooooo.....")) ; exit the example block, returning "nooooo...."
|
||||||
|
(... do more stuff ...))
|
||||||
|
|
|
@ -0,0 +1,107 @@
|
||||||
|
|
||||||
|
; -----------------------------------------------------------------
|
||||||
|
; Context free grammar checker for lists of simple lisp expressions
|
||||||
|
;
|
||||||
|
; Note format statements are currently included to show the
|
||||||
|
; parsing sequence followed
|
||||||
|
; -----------------------------------------------------------------
|
||||||
|
|
||||||
|
; suppose our CFG grammar goes like this:
|
||||||
|
;
|
||||||
|
; StatementList --> A list of one or more statements
|
||||||
|
; Statement --> Value
|
||||||
|
; --> Expression
|
||||||
|
; Expression --> (UnaryOperator Statement)
|
||||||
|
; --> (BinaryOperator Statement Statement)
|
||||||
|
; BinaryOperator --> +, -, *, /
|
||||||
|
; UnaryOperator --> +, -
|
||||||
|
; Value --> symbol, integer
|
||||||
|
|
||||||
|
|
||||||
|
; (statementList s)
|
||||||
|
; -----------------
|
||||||
|
; statementList returns true if s is a list of one or more
|
||||||
|
; valid statements, nil otherwise
|
||||||
|
(defun statementList (s)
|
||||||
|
(format t "statementList check on ~A~%" s)
|
||||||
|
(cond
|
||||||
|
; s must be a non-empty list
|
||||||
|
((not (listp s)) nil)
|
||||||
|
((null S) nil)
|
||||||
|
; the first element of s must be a statement
|
||||||
|
((not (statement (car S))) nil)
|
||||||
|
; if there are no remaining elements then s passes
|
||||||
|
((null (cdr S)) t)
|
||||||
|
; otherwise check the remaining elements recursively
|
||||||
|
(t (statementList (cdr S)))))
|
||||||
|
|
||||||
|
|
||||||
|
; (statement s)
|
||||||
|
; -------------
|
||||||
|
; statement returns true if s is a valid Statement, nil otherwise
|
||||||
|
; valid statements are values or expressions
|
||||||
|
(defun statement (s)
|
||||||
|
(format t "statement check on ~A~%" s)
|
||||||
|
(cond
|
||||||
|
((value s) t)
|
||||||
|
((expression s) t)
|
||||||
|
(t nil)))
|
||||||
|
|
||||||
|
|
||||||
|
; (expression e)
|
||||||
|
; --------------
|
||||||
|
; returns true if e is a valid expression, nil otherwise
|
||||||
|
; valid expressions have either of the forms:
|
||||||
|
; (unaryOp statement) or (binaryOp statement statement)
|
||||||
|
(defun expression (e)
|
||||||
|
(format t "expression check on ~A~%" e)
|
||||||
|
(cond
|
||||||
|
; e must be a list with at least two elements
|
||||||
|
((not (listp e)) nil)
|
||||||
|
((< (length e) 2) nil)
|
||||||
|
; if e has length two then it must be a unary operator
|
||||||
|
; followed by an operand (statement)
|
||||||
|
((null (cddr e))
|
||||||
|
(and (unaryOp (car e)) (statement (cadr e))))
|
||||||
|
; if e has length three then it must be a binary operator
|
||||||
|
; followed by two operands (statements)
|
||||||
|
((null (cdddr e))
|
||||||
|
(and (binaryOp (car e)) (statement (cadr e)) (statement (caddr e))))
|
||||||
|
; e cannot have more than three elements
|
||||||
|
(t nil)))
|
||||||
|
|
||||||
|
|
||||||
|
; (binaryOp op)
|
||||||
|
; -------------
|
||||||
|
; returns true if op is a valid binary operator, nil otherwise
|
||||||
|
; binary operators are +, -, *, and /
|
||||||
|
(defun binaryOp (op)
|
||||||
|
(format t "binary op check on ~A~%" op)
|
||||||
|
(cond
|
||||||
|
((equalp op '+) t)
|
||||||
|
((equalp op '-) t)
|
||||||
|
((equalp op '/) t)
|
||||||
|
((equalp op '*) t)
|
||||||
|
(t nil)))
|
||||||
|
|
||||||
|
; (unaryOp op)
|
||||||
|
; -------------
|
||||||
|
; returns true if op is a valid operator, nil otherwise
|
||||||
|
; unary operators are + and -
|
||||||
|
(defun unaryOp (op)
|
||||||
|
(format t "unary op check on ~A~%" op)
|
||||||
|
(cond
|
||||||
|
((equalp op '+) t)
|
||||||
|
((equalp op '-) t)
|
||||||
|
(t nil)))
|
||||||
|
|
||||||
|
; (value v)
|
||||||
|
; ---------
|
||||||
|
; returns true if v is a symbol or an integer, nil otherwise
|
||||||
|
(defun value (v)
|
||||||
|
(format t "value check on ~A~%" v)
|
||||||
|
(cond
|
||||||
|
((integerp v) t)
|
||||||
|
((symbolp v) t)
|
||||||
|
(t nil)))
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
|
||||||
|
; char functions
|
||||||
|
|
||||||
|
; #\x is the literal character x
|
||||||
|
|
||||||
|
; special chars:
|
||||||
|
; #\Backspace #\Space #\Newline #\Tab
|
||||||
|
; #\Return #\Linefeed #\Rubout #\Page
|
||||||
|
|
||||||
|
; special chars within text literals
|
||||||
|
; "... \" ... "
|
||||||
|
|
||||||
|
(setf c1 #\q)
|
||||||
|
(setf c2 #\Q)
|
||||||
|
|
||||||
|
; convert cases
|
||||||
|
(char-upcase c1)
|
||||||
|
(char-downcase c2)
|
||||||
|
|
||||||
|
; convert between ascii and chars
|
||||||
|
(code-char 63) ; converts from ascii to char
|
||||||
|
(char-code #\a) ; converts from char to ascii
|
||||||
|
|
||||||
|
; compare characters
|
||||||
|
(char= c1 c2)
|
||||||
|
(char/= c1 c2)
|
||||||
|
(char<= c1 c2)
|
||||||
|
(char>= c1 c2)
|
||||||
|
(char< c1 c2)
|
||||||
|
(char> c1 c2)
|
||||||
|
(char= c1 c2)
|
||||||
|
|
||||||
|
; reading chars from streams
|
||||||
|
(read-char stream nil) ; read from stream, nil if end of stream
|
||||||
|
(peek-char stream nil) ; peek at next char in stream, nil if end of stream
|
||||||
|
(unread-char c stream) ; put c back into front of input stream
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; program to read all the command line arguments and classify them by their data type
|
||||||
|
|
||||||
|
; classify each element of the supplied argument list
|
||||||
|
(defun classifyAll (argList)
|
||||||
|
(dolist (arg argList)
|
||||||
|
(classifyElement arg)))
|
||||||
|
|
||||||
|
; classify an item by its data type
|
||||||
|
(defun classifyElement (elem)
|
||||||
|
(typecase elem
|
||||||
|
(string (format t "~A is a string~%" elem))
|
||||||
|
(vector (format t "~A is a vector~%" elem))
|
||||||
|
(array (format t "~A is an array~%" elem))
|
||||||
|
(list (format t "~A is a list~%" elem))
|
||||||
|
(hash-table (format t "~A is a hash table~%" elem))
|
||||||
|
(integer (format t "~A is an integer~%" elem))
|
||||||
|
(float (format t "~A is a floating point number~%" elem))
|
||||||
|
(real (format t "~A is a real number~%" elem))
|
||||||
|
(number (format t "~A is a number~%" elem))
|
||||||
|
(function (format t "~A is a function~%" elem))
|
||||||
|
(symbol (if (boundp elem) (format t "~A is a bound symbol~%" elem)
|
||||||
|
(format t "~A is a symbol~%" elem)))
|
||||||
|
(keyword (format t "~A is a keyword~%" elem))
|
||||||
|
(character (format t "~A is a character~%" elem))
|
||||||
|
(t (format t "~A is an unknown type~%" elem))
|
||||||
|
))
|
||||||
|
|
||||||
|
; main routine for the program
|
||||||
|
(defun main (argList)
|
||||||
|
(cond
|
||||||
|
; if no command line arguments are given, tell the user how to run the program
|
||||||
|
((null argList) (format t "Provide a list of arguments on the command line to have them classified~%"))
|
||||||
|
|
||||||
|
; under any other circumstances run the classification on the argument list
|
||||||
|
(t (classifyAll argList))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
; run the program
|
||||||
|
(main (cdr si::*command-args*))
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; (geturl hostname port filepath)
|
||||||
|
; -------------------------------
|
||||||
|
; create a connection to the specified host/port,
|
||||||
|
; get the file at the specified path,
|
||||||
|
; and return a list of the lines of output retrieved
|
||||||
|
; e.g. (geturl "csci.viu.ca" 80 "/~wesselsd/index.html")
|
||||||
|
(defun geturl (hostname port filepath)
|
||||||
|
(let
|
||||||
|
; set up the socket and connection
|
||||||
|
((sock (si::socket port :host hostname))
|
||||||
|
; initialize the results list as empty
|
||||||
|
(result nil))
|
||||||
|
|
||||||
|
; use unwind-protect to make sure we close the socket
|
||||||
|
; even if the loop terminates abnormally
|
||||||
|
(unwind-protect
|
||||||
|
(progn
|
||||||
|
; send the get request with format (4 lines including the blank line)
|
||||||
|
; GET filepath HTTP/1.1
|
||||||
|
; Host: hostname
|
||||||
|
; Connection: close
|
||||||
|
;
|
||||||
|
(format sock "GET ~A HTTP/1.1" filepath)
|
||||||
|
(format sock "~A~A" #\RETURN #\NEWLINE)
|
||||||
|
(format sock "Host: ~A" hostname)
|
||||||
|
(format sock "~A~A" #\RETURN #\NEWLINE)
|
||||||
|
(format sock "Connection: close")
|
||||||
|
(format sock "~A~A" #\RETURN #\NEWLINE)
|
||||||
|
(format sock "~A~A" #\RETURN #\NEWLINE)
|
||||||
|
(force-output sock)
|
||||||
|
|
||||||
|
; read the response and display it, one line at a time
|
||||||
|
(loop
|
||||||
|
(let
|
||||||
|
; current line
|
||||||
|
((line (read-line sock nil nil)))
|
||||||
|
(unless line (return)) ; quit when read-line returns nil
|
||||||
|
(setq result (cons line result)))))
|
||||||
|
|
||||||
|
; last step of unwind: we close the socket
|
||||||
|
; ... currently this is producing a spurious error message ...
|
||||||
|
(close sock))
|
||||||
|
|
||||||
|
; note the lines of output are currently stored in reverse order,
|
||||||
|
; so re-arrange them before we return them
|
||||||
|
(reverse result)))
|
||||||
|
|
||||||
|
; test out our geturl
|
||||||
|
(defvar contents (geturl "csci.viu.ca" 80 "/~wesselsd/courses/csci330/index.html"))
|
||||||
|
(format t "~%Result:~%~%~A~%~%" contents)
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; CLOSURES: functions that build and return customized versions of functions
|
||||||
|
;
|
||||||
|
; (buildAdder N)
|
||||||
|
; -------------------
|
||||||
|
; builds and returns a function to manipulate numbers
|
||||||
|
; the built function has the form (f x) and the purpose
|
||||||
|
; of the function is return (x+N)
|
||||||
|
(defun buildAdder (N)
|
||||||
|
(lambda (x) (+ x N)))
|
||||||
|
|
||||||
|
; build one function (f x) that returns 3+x
|
||||||
|
(setf f (buildAdder 3))
|
||||||
|
|
||||||
|
; build another, (g x), that returns 0.1+x
|
||||||
|
(setf g (buildAdder 0.1))
|
||||||
|
|
||||||
|
; apply both functions to a variable
|
||||||
|
(defvar i 0)
|
||||||
|
(format t "initial value ~A~%" i)
|
||||||
|
(format t "after applying f (adds 3) ~A~%" (funcall f i))
|
||||||
|
(format t "after applying g (adds 0.1) ~A~%" (funcall g i))
|
||||||
|
|
||||||
|
(format t "(funcall (buildAdder 2) 4) gives ~A~%" (funcall (buildAdder 2) 4))
|
||||||
|
|
||||||
|
|
||||||
|
; Name clashes with dynamic variables (e.g. defvars)
|
||||||
|
; --------------------------------------------------
|
||||||
|
; Consider our buildAdder solution above in the circumstances where
|
||||||
|
; the user does something like this:
|
||||||
|
|
||||||
|
(defvar N 3)
|
||||||
|
(defvar h (buildAdder N))
|
||||||
|
(setf N 12)
|
||||||
|
(format t "Adding 3 to 5 gives: ~A~%" (funcall f 5))
|
||||||
|
|
||||||
|
; The result displayed is 17!
|
||||||
|
; The lambda function looks like (lambda (x) (+ x N))
|
||||||
|
; so when it runs in the call above it grabs the current
|
||||||
|
; value for N, i.e. 12, not the N value we passed to buildAdder
|
||||||
|
;
|
||||||
|
; One solution is to have our buildAdder use a let block with a
|
||||||
|
; local variable name that (hopefully) will not clash with
|
||||||
|
; any dynamically-scoped variables when called, e.g.
|
||||||
|
|
||||||
|
(defun betterBuilder (N)
|
||||||
|
(let ((betterBuilderLocal N))
|
||||||
|
(lambda (x) (+ x betterBuilderLocal)))
|
||||||
|
|
||||||
|
|
||||||
|
; Where would you really use closures?
|
||||||
|
; ------------------------------------
|
||||||
|
;
|
||||||
|
; Any situation where you would like to use a custom built function many
|
||||||
|
; times during a run of your program, but don't know the precise nature
|
||||||
|
; of the customization until runtime.
|
||||||
|
;
|
||||||
|
; Suppose you want to customize elements of a web page, and need to
|
||||||
|
; generate those customized elements many times with different data content,
|
||||||
|
; and as rapidly as possible, but you won't know until runtime what the
|
||||||
|
; specific customization is.
|
||||||
|
;
|
||||||
|
; To solve this, you add a function whose parameters define the possible
|
||||||
|
; customizations, and at runtime that function builds and returns the
|
||||||
|
; function that actually builds the specialized element.
|
||||||
|
;
|
||||||
|
; During the run of the program you can call the customized function as
|
||||||
|
; often as needed, passing it the data content.
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,37 @@
|
||||||
|
|
||||||
|
; (buildColumnizer N W)
|
||||||
|
; ---------------------
|
||||||
|
; creates and returns a lambda function for printing lists
|
||||||
|
; that are formatted to a specified column width (W)
|
||||||
|
; and number of columns per row (N)
|
||||||
|
; e.g.
|
||||||
|
; (defvar prt (buildColumnizer 5 20))
|
||||||
|
; (funcall prt '(1 2 3 4 5 6 7 8 9 10 11 12))
|
||||||
|
; would print the list in rows of 5 columns,
|
||||||
|
; each column padded to a minimum width of 20
|
||||||
|
(defun buildColumnizer (N W)
|
||||||
|
(cond
|
||||||
|
; make sure N and W are valid values to build the function with
|
||||||
|
((or (not (integerp N)) (< N 1))
|
||||||
|
(format t "Error: number of columns (~A) must be a positive integer~%" N))
|
||||||
|
((or (not (integerp W)) (< W 1))
|
||||||
|
(format t "Error: column width (~A) must be a positive integer~%" W))
|
||||||
|
|
||||||
|
; use locals for number of columns, column width, and the format string
|
||||||
|
; the constructed function will use (e.g. "~20A")
|
||||||
|
(t (let* ((Cols N) (Width W) (fstr (format nil "~~~AA" Width)))
|
||||||
|
|
||||||
|
; generate the actual prt function to be returned
|
||||||
|
(lambda (L)
|
||||||
|
(let ((index 1)) ; tracks position on current row
|
||||||
|
(if (not (listp L)) (format t "Error: must be a list (~A)~%" L)
|
||||||
|
(dolist (e L)
|
||||||
|
(block 'prtNincrement
|
||||||
|
; print the element using the format string
|
||||||
|
(format t fstr e)
|
||||||
|
; see if we need to print a newline
|
||||||
|
(if (= index Cols) (format t "~%"))
|
||||||
|
; update index (either index++ or set to 1 to start new row)
|
||||||
|
(if (= index Cols) (setf index 1) (setf index (+ index 1))))))))))))
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; display the command line arguments passed to the script
|
||||||
|
(format t "this script is named: ~A~%" (car si::*command-args*))
|
||||||
|
(format t "the command line arguments the user entered were: ~A~%" (cdr si::*command-args*))
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; to compile an entire file into an executable, follow these steps:
|
||||||
|
; (1) create the source code, e.g. file myprog.cl
|
||||||
|
; and do NOT include the #! line in the file
|
||||||
|
; (2) in myprog.cl, define a function called si::top-level,
|
||||||
|
; this is the one where execution will automatically start,
|
||||||
|
; e.g. here we have it simply call our "main" function
|
||||||
|
; (defun si::top-level () (main))
|
||||||
|
; (3) open the interpretter and issue these commands:
|
||||||
|
; (compile-file "myprog.cl") ; creates myprog.o
|
||||||
|
; (load "myprog.o")
|
||||||
|
; (si::save-system "myprog") ; creates executable
|
||||||
|
; (4) you can now run your program in linux using ./myprog
|
||||||
|
; Note: the executable includes a lot of lisp environment information,
|
||||||
|
; so tends to be significantly larger than typical linux executables
|
||||||
|
|
||||||
|
; define two interpretted functions
|
||||||
|
(defun f (x y) (* x y))
|
||||||
|
(defun g (x y) (/ x y))
|
||||||
|
|
||||||
|
; compile a function g
|
||||||
|
(format t "~%Compiling function G~%")
|
||||||
|
(compile 'g)
|
||||||
|
|
||||||
|
; create a lambda function, store in variable h1
|
||||||
|
(format t "~%Creating lambda function, storing in h1~%")
|
||||||
|
(defvar h1 (lambda (x y) (+ x y)))
|
||||||
|
|
||||||
|
; create and compile a lambda function, store in variable h2
|
||||||
|
(format t "~%Compiling lambda function, storing in h2~%")
|
||||||
|
(defvar h2 (compile nil '(lambda (x y) (max x y))))
|
||||||
|
|
||||||
|
; compile and load another file, test.cl, which defines t1(x,y)
|
||||||
|
(format t "~%Compiling file test.o (containing definition of function t1)~%")
|
||||||
|
(compile-file "compileTest.cl" :output-file "compileTest.o")
|
||||||
|
(load "compileTest.o")
|
||||||
|
|
||||||
|
; call the five functions
|
||||||
|
(format t "~%f(2,3): ~A~%" (f 2 3))
|
||||||
|
(format t "g(2,3): ~A~%" (g 2 3))
|
||||||
|
(format t "h1(2,3): ~A~%" (apply h1 '(2 3)))
|
||||||
|
(format t "h2(2,3): ~A~%" (apply h2 '(2 3)))
|
||||||
|
(format t "t1(2,3): ~A~%" (t1 2 3)))
|
||||||
|
|
||||||
|
; use function to see the form of the functions
|
||||||
|
(format t "~%function(f): ~A~%" (function f))
|
||||||
|
(format t "function(g): ~A~%" (function g))
|
||||||
|
(format t "h1: ~A~%" h1)
|
||||||
|
(format t "h2: ~A~%" h2)
|
||||||
|
(format t "function(t1): ~A~%~%" (function t1))
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; examples using cond for condition testing
|
||||||
|
(defvar x 3)
|
||||||
|
(cond
|
||||||
|
; series of pairs, each pair consists of a boolean expression and
|
||||||
|
; the result to return if that expression is true
|
||||||
|
; the pairs are examined in order,
|
||||||
|
; the return value of the cond is the return value of the
|
||||||
|
; first pair whose boolean expression is true
|
||||||
|
((< x 0) -1) ; if x < 0 return -1
|
||||||
|
((> x 0) (- 0 x)) ; if x > 0 return negative x
|
||||||
|
(t 0) ; by default (since t is always true) return 0
|
||||||
|
)
|
||||||
|
|
||||||
|
; example chaining multiple statements together in one case of cond
|
||||||
|
(setf x '(1 2 3))
|
||||||
|
(cond
|
||||||
|
; if x is nil print an error message and return 0
|
||||||
|
((null x) (format t "x is empty~%") 0)
|
||||||
|
; else print a message and return the first element
|
||||||
|
(t (format t "x has length ~A~%" (length x)) (car x)))
|
||||||
|
|
||||||
|
; defining a constant named else to use as the default for cond
|
||||||
|
(defconstant else t)
|
||||||
|
(setf x 3)
|
||||||
|
(cond
|
||||||
|
((< x 0) -1)
|
||||||
|
((= x 0) 0)
|
||||||
|
(else 1))
|
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
; (countAll L)
|
||||||
|
; ------------
|
||||||
|
; if L is not a list this returns 1
|
||||||
|
; otherwise it returns the number of elements
|
||||||
|
; contained in L and any sublists of L
|
||||||
|
; e.g. (countAll 1) returns 1
|
||||||
|
; (countAll '()) returns 0
|
||||||
|
; (countAll '(1 2 '())) returns 2
|
||||||
|
; (countAll '(1 2 3 4)) returns 4
|
||||||
|
; (countAll '((1 2) 3 (4 5 (6 7 8) (9 10)))) returns 10
|
||||||
|
(defun countAll (L)
|
||||||
|
(cond
|
||||||
|
((not (listp L)) 1)
|
||||||
|
((eq L '()) 0)
|
||||||
|
((eq (length L) 1) (countAll (car L)))
|
||||||
|
(t (+ (countAll (car L)) (countAll (cdr L))))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
|
||||||
|
; basic data types
|
||||||
|
|
||||||
|
; t is true, nil is false, nil and '() are equivalent
|
||||||
|
; text is put in double quotes "blah blah blah"
|
||||||
|
; characters are represented with #\, e.g. #\Q
|
||||||
|
; numbers supported include
|
||||||
|
; integers, eg 123
|
||||||
|
; fixed point, e.g. 123.456
|
||||||
|
; exp. notation, e.g. 1.23456e8
|
||||||
|
; rationals, e.g. 1/3
|
||||||
|
; complex, e.g. #c(5 6) represents (5 + 6i)
|
||||||
|
; lists are represented within parenthesis, and preceeded by a ', e.g.
|
||||||
|
; '(1 2 3 4 5)
|
||||||
|
; '("foo" #\y 5.43 (1 2 3))
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
|
||||||
|
Common errors/resulting messages in common lisp (gcl specifically):
|
||||||
|
|
||||||
|
1. You put the #! line in a file then try to load it, i.e. (load "filename.cl")
|
||||||
|
Error message: "BROKEN AT LOAD"
|
||||||
|
|
||||||
|
2. You're missing a ) somewhere
|
||||||
|
Error message: "END-OF-FILE :STREAM <path-to-your-lisp-file>"
|
||||||
|
|
||||||
|
3. You're missing a "
|
||||||
|
No error message, it just hangs waiting to find another "
|
||||||
|
|
||||||
|
4. You forget the ' in front of a data list
|
||||||
|
or you put ( ) around a data value, e.g. (3)
|
||||||
|
Error message: TYPE-ERROR :DATUM the front element of the list :EXPECTED-TYPE FUNCTION
|
||||||
|
|
||||||
|
5. You pass an incorrect data type to an operator or function
|
||||||
|
Error message: TYPE-ERROR :DATUM the value you passed :EXPECTED-TYPE the kind of data it expected
|
||||||
|
|
||||||
|
6. You use an undeclared variable (or undeclared in the current scope)
|
||||||
|
Error message: UNBOUND-VARIABLE :NAME your variable name
|
||||||
|
|
||||||
|
7. You use an undeclared function (or undeclared in the current scope)
|
||||||
|
Error message: UNBOUND-FUNCTION :NAME your function name
|
||||||
|
or: UNDEFINED-FUNCTION :NAME your function name
|
||||||
|
|
||||||
|
8. You call a function with the incorrect number of arguments
|
||||||
|
Error message: PROGRAM ERROR function name REQUIRES more/less THAN n ARGUMENTS
|
||||||
|
where n is the number of arguments you actually passed
|
||||||
|
|
||||||
|
9. You have infinite recursion
|
||||||
|
Error message: Frame Stack overflow
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,18 @@
|
||||||
|
|
||||||
|
; return a list whose elements are the elements of list1
|
||||||
|
; that do not also appear in list2
|
||||||
|
(defun diff (list1 list2)
|
||||||
|
(cond
|
||||||
|
; return nil if either of them are non-lists
|
||||||
|
((not (listp list1)) nil)
|
||||||
|
((not (listp list2)) nil)
|
||||||
|
; if list1 is empty then the result is an empty list
|
||||||
|
((null list1) nil)
|
||||||
|
; if list2 is empty then the result is all of list1
|
||||||
|
((null list2) list1)
|
||||||
|
; if the head of list1 isn't in list 2 then it belongs in the answer,
|
||||||
|
; call recursively on the tail of list1 to see what else belongs
|
||||||
|
((not (member (car list1) list2)) (cons (car list1) (diff (cdr list1) list2)))
|
||||||
|
; otherwise the head of list1 doesn't belong in the answer,
|
||||||
|
; call recursively on the tail of list1 to see what else may belong
|
||||||
|
(t (diff (cdr list1) list2))))
|
|
@ -0,0 +1,9 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; you can see the code the compiler produces for a function using
|
||||||
|
; disassemble, e.g.
|
||||||
|
|
||||||
|
(defun foo (x) (* x x))
|
||||||
|
|
||||||
|
(disassemble 'foo)
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
|
||||||
|
; do loops consist of three parts
|
||||||
|
; - a list of local variables, their initial values, and
|
||||||
|
; how they get updated at the end of each pass through the loop
|
||||||
|
; - the stopping condition for the loop and
|
||||||
|
; a list of statements to execute after the loop stops
|
||||||
|
; (the return value of do is the return value of the last statement)
|
||||||
|
; - the body of the loop: the statements to execute each pass
|
||||||
|
(do
|
||||||
|
; initialization/update descriptions
|
||||||
|
( (x 0 (+ x 1)) ; x = 0 initially, add 1 after every pass
|
||||||
|
(y 10 (+ y 2))) ; y = 10 initially, add 2 after every pass
|
||||||
|
|
||||||
|
; stopping section
|
||||||
|
( ; stopping condition
|
||||||
|
(OR (= x 10) (> y 15)) ; stop if (x == 10) or (y > 15)
|
||||||
|
; actions to perform after stopping
|
||||||
|
(format t "~%exited loop~%" x)
|
||||||
|
(format t "x stopped at ~A~%" x)
|
||||||
|
(format t "y stopped at ~A~%" y)
|
||||||
|
(format t "returning ~A~%" (+ x y))
|
||||||
|
; return value
|
||||||
|
(+ x y))
|
||||||
|
|
||||||
|
; loop body
|
||||||
|
(format t "inside loop ~%")
|
||||||
|
(format t "x is currently ~A~%" x)
|
||||||
|
(format t "y is currently ~A~%" y))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
(defun foo (x)
|
||||||
|
; the documentation string for a function goes immediately after the parameter list
|
||||||
|
"foo does nothing"
|
||||||
|
(if (< x 0) T nil))
|
||||||
|
|
||||||
|
; lookup the documentation string using (documentation 'func 'foo)
|
||||||
|
(format t "Docs information:~%~A~%" (documentation 'foo 'function))
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; example of dolist to iterate through a list
|
||||||
|
|
||||||
|
; print each element of a list
|
||||||
|
(defvar L '(1 2 3 4))
|
||||||
|
|
||||||
|
(dolist
|
||||||
|
; variable to use for iterating through L
|
||||||
|
(x L)
|
||||||
|
; expression to apply to each element (x) of L
|
||||||
|
(format t "x is ~A~%" x)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
|
||||||
|
; dotimes allows us to iterate a fixed number of times,
|
||||||
|
; allowing us to specify an index variable,
|
||||||
|
; the number of times to repeat,
|
||||||
|
; and the expression to use as a return value
|
||||||
|
;
|
||||||
|
; e.g.
|
||||||
|
; (dotimes (x 5 (* x 2)) (format t "Hi ~A~%" x))
|
||||||
|
; displays
|
||||||
|
; Hi 0
|
||||||
|
; Hi 1
|
||||||
|
; Hi 2
|
||||||
|
; Hi 3
|
||||||
|
; Hi 4
|
||||||
|
; and returns 10
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; you can record everything that happens in a lisp session using
|
||||||
|
; (dribble "filename") to start and (dribble) to finish, e.g.
|
||||||
|
|
||||||
|
(dribble "mylog.txt")
|
||||||
|
|
||||||
|
(format t "begin experimenting~%")
|
||||||
|
(defun foo (x) (* x x))
|
||||||
|
(defvar a 3)
|
||||||
|
(defvar b (foo a))
|
||||||
|
(format t "foo(~A) is ~A~%" a b)
|
||||||
|
|
||||||
|
(dribble)
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
; a collection of ascii-based screen manipulation functions
|
||||||
|
|
||||||
|
; set up a global constant to represent the escape character
|
||||||
|
(defconstant Escape (code-char 27))
|
||||||
|
|
||||||
|
; clear the screen by printing an ascii control sequence
|
||||||
|
(defun clearscrn ()
|
||||||
|
(format t "~A[2J~A[H" Escape Escape))
|
||||||
|
|
||||||
|
; move the cursor to a set row column position
|
||||||
|
; where (1 1) is the upper left corner
|
||||||
|
(defun moveCursor (row col)
|
||||||
|
(format t "~A[~A;~AH" Escape row col))
|
||||||
|
|
||||||
|
; colour manipulation functions use the following colours:
|
||||||
|
; Black, Red, Green, Yellow, Blue, Purple, Pale, Grey, or Default
|
||||||
|
; or Help to get this list
|
||||||
|
|
||||||
|
; set the colour of text
|
||||||
|
(defun textColour (colour)
|
||||||
|
(cond
|
||||||
|
((equalp colour 'Help) (format t "Available colours: Black, Red, Green, Yellow, Blue, Purple, Pale, Grey, (anything else for default)"))
|
||||||
|
((equalp colour 'Black) (format t "~A[30m" Escape))
|
||||||
|
((equalp colour 'Red) (format t "~A[31m" Escape))
|
||||||
|
((equalp colour 'Green) (format t "~A[32m" Escape))
|
||||||
|
((equalp colour 'Yellow) (format t "~A[33m" Escape))
|
||||||
|
((equalp colour 'Blue) (format t "~A[34m" Escape))
|
||||||
|
((equalp colour 'Purple) (format t "~A[35m" Escape))
|
||||||
|
((equalp colour 'Pale) (format t "~A[36m" Escape))
|
||||||
|
((equalp colour 'Grey) (format t "~A[37m" Escape))
|
||||||
|
(t (format t "~A[0m" Escape))))
|
||||||
|
|
||||||
|
; set the background colour
|
||||||
|
(defun bkgdColour (colour)
|
||||||
|
(cond
|
||||||
|
((equalp colour 'Help) (format t "Available colours: Black, Red, Green, Yellow, Blue, Purple, Pale, Grey, (anything else for default)"))
|
||||||
|
((equalp colour 'Black) (format t "~A[40m" Escape))
|
||||||
|
((equalp colour 'Red) (format t "~A[41m" Escape))
|
||||||
|
((equalp colour 'Green) (format t "~A[42m" Escape))
|
||||||
|
((equalp colour 'Yellow) (format t "~A[43m" Escape))
|
||||||
|
((equalp colour 'Blue) (format t "~A[44m" Escape))
|
||||||
|
((equalp colour 'Purple) (format t "~A[45m" Escape))
|
||||||
|
((equalp colour 'Pale) (format t "~A[46m" Escape))
|
||||||
|
((equalp colour 'Grey) (format t "~A[47m" Escape))
|
||||||
|
(t (format t "~A[0m" Escape))))
|
||||||
|
|
||||||
|
; set text effects, options are
|
||||||
|
; Faint, Negative, Normal, AltFont, Underline, Bold, Clear
|
||||||
|
; or Help to get this list
|
||||||
|
(defun textEffect (effect)
|
||||||
|
(cond
|
||||||
|
((equalp effect 'Help) (format t "Available effects: Faint, Negative, Normal, AltFont, Underline, Bold, Clear"))
|
||||||
|
((equalp effect 'Clear) (format t "~A[0m" Escape))
|
||||||
|
((equalp effect 'Bold) (format t "~A[1m" Escape))
|
||||||
|
((equalp effect 'Underline) (format t "~A[4m" Escape))
|
||||||
|
((equalp effect 'Faint) (format t "~A[5m" Escape))
|
||||||
|
((equalp effect 'Negative) (format t "~A[7m" Escape))
|
||||||
|
((equalp effect 'Normal) (format t "~A[10m" Escape))
|
||||||
|
((equalp effect 'AltFont) (format t "~A[12m" Escape))
|
||||||
|
(t (format t "~A[0m" Escape))))
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
|
||||||
|
; Notes on efficiency and maintainability
|
||||||
|
; ---------------------------------------
|
||||||
|
|
||||||
|
; Efficiency
|
||||||
|
; ----------
|
||||||
|
;
|
||||||
|
; while the logical behaviour is similar,
|
||||||
|
; internally the implementation of strings, vectors, arrays, and lists
|
||||||
|
; do in fact differ, and best efficiency can be obtained by using the
|
||||||
|
; most suitable type and operations
|
||||||
|
;
|
||||||
|
; the best choices, in order of decreasing effiency, are:
|
||||||
|
; string, access elements with (char str i)
|
||||||
|
; vectors, access elements with svref
|
||||||
|
; arrays, access elements with aref
|
||||||
|
; lists, access elements with nth
|
||||||
|
; sequences, access elements with elt
|
||||||
|
;
|
||||||
|
; if dealing with lists of values with particular meanings,
|
||||||
|
; use a struct rather than a positionally-accessed list
|
||||||
|
;
|
||||||
|
; favour iteration constructs over tail recursion, as these
|
||||||
|
; are more reliably optimized at compile time, and
|
||||||
|
; if you do use tail recursion, then don't use dynamically-scoped
|
||||||
|
; variables within the tail recursive functions, and ensure
|
||||||
|
; you identify and apply any necessary settings to ensure that
|
||||||
|
; tail recursion optimizations are actually applied
|
||||||
|
; favour dotimes and dolist over the more generalized loop
|
||||||
|
; features (again, more reliably optimized)
|
||||||
|
|
||||||
|
; Maintainability
|
||||||
|
; ---------------
|
||||||
|
; most common sense rules for program maintainability apply,
|
||||||
|
; a few things may be worth specifically noting:
|
||||||
|
;
|
||||||
|
; - avoid side effects where not needed
|
||||||
|
; - use (function f) or #'f, rather than just 'f when
|
||||||
|
; what you want to access is known to be a function
|
||||||
|
; - avoid runtime use of eval, #, and intern
|
||||||
|
; - avoid the use of dynamic scope where possible,
|
||||||
|
; a decent rule of thumb is to use it for situations
|
||||||
|
; where you need to do something with "the current" X,
|
||||||
|
; where what constitutes "the current" can be set in
|
||||||
|
; a variety of ways/places, but not so commonly as to
|
||||||
|
; make passing an additional parameter worthwhile
|
||||||
|
|
||||||
|
; if dealing with sequences of characters, use the string type
|
||||||
|
; if dealing with
|
||||||
|
;
|
|
@ -0,0 +1,54 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; set up some values for comparison
|
||||||
|
(setf x 3)
|
||||||
|
(setf y 3.0)
|
||||||
|
(setf z 3)
|
||||||
|
(setf L1 '(1 2))
|
||||||
|
(setf L2 '((1 2) 3))
|
||||||
|
(setf L3 (list L1 z))
|
||||||
|
(format t "x is 3, y is 3.0, z is 3~%")
|
||||||
|
(format t "L1 is (1 2), L2 is ((1 2) 3), L3 is (list L1 z)~%")
|
||||||
|
(format t "~%")
|
||||||
|
|
||||||
|
; equal does a structural comparison of the two values for equality
|
||||||
|
(format t "(equal x y): ~A~%" (equal x y))
|
||||||
|
(format t "(equal x z): ~A~%" (equal x z))
|
||||||
|
(format t "(equal x 3): ~A~%" (equal x 3))
|
||||||
|
(format t "(equal x 3.0): ~A~%" (equal x 3.0))
|
||||||
|
(format t "(equal L2 L3): ~A~%" (equal L2 L3))
|
||||||
|
(format t "~%")
|
||||||
|
|
||||||
|
; equalp and = true if two values are equivalent, e.g. 3 and 3.0
|
||||||
|
; but = is just for numbers
|
||||||
|
(format t "(equalp x y): ~A~%" (equalp x y))
|
||||||
|
(format t "(equalp x z): ~A~%" (equalp x z))
|
||||||
|
(format t "(equalp x 3): ~A~%" (equalp x 3))
|
||||||
|
(format t "(equalp x 3.0): ~A~%" (equalp x 3.0))
|
||||||
|
(format t "(equalp L2 L3): ~A~%" (equalp L2 L3))
|
||||||
|
(format t "~%")
|
||||||
|
(format t "(= x y): ~A~%" (= x y))
|
||||||
|
(format t "(= x z): ~A~%" (= x z))
|
||||||
|
(format t "(= x 3): ~A~%" (= x 3))
|
||||||
|
(format t "(= x 3.0): ~A~%" (= x 3.0))
|
||||||
|
(format t "~%")
|
||||||
|
|
||||||
|
; eql is true if the two things compared are actually the same object,
|
||||||
|
; of if a variable is compared to a character or number with the same value and type
|
||||||
|
(format t "(eql x y): ~A~%" (eql x y))
|
||||||
|
(format t "(eql x z): ~A~%" (eql x z))
|
||||||
|
(format t "(eql x 3): ~A~%" (eql x 3))
|
||||||
|
(format t "(eql x 3.0): ~A~%" (eql x 3.0))
|
||||||
|
(format t "(eql L2 L3): ~A~%" (eql L2 L3))
|
||||||
|
(format t "~%")
|
||||||
|
|
||||||
|
; eq is true iff the two things are actually the same object
|
||||||
|
(format t "(eq x y): ~A~%" (eq x y))
|
||||||
|
(format t "(eq x z): ~A~%" (eq x z))
|
||||||
|
(format t "(eq x 3): ~A~%" (eq x 3))
|
||||||
|
(format t "(eq x 3.0): ~A~%" (eq x 3.0))
|
||||||
|
(format t "(eq L2 L3): ~A~%" (eq L2 L3))
|
||||||
|
(format t "~%")
|
||||||
|
(setf a x)
|
||||||
|
(format t "a is set to x, (eq a x): ~A~%" (eq a x))
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; define a constant as a unique default error value
|
||||||
|
(defconstant Err 'Err)
|
||||||
|
|
||||||
|
; use the constant in a function that tests lists
|
||||||
|
(defun nonemptyList (L)
|
||||||
|
(cond
|
||||||
|
((not (listp L)) Err)
|
||||||
|
((null L) Err)
|
||||||
|
(t t)))
|
||||||
|
|
||||||
|
; function to check if something is an error value
|
||||||
|
(defun errorp (e) (equalp e Err))
|
||||||
|
|
||||||
|
; ---- use example ---
|
||||||
|
(defvar list1 3)
|
||||||
|
(defvar list2 '(3))
|
||||||
|
(defvar result (nonEmptyList list1))
|
||||||
|
(format t "is ~A an ok list?: ~A~%" list1 (not (errorp result)))
|
||||||
|
(setf result (nonEmptyList list2))
|
||||||
|
(format t "is ~A an ok list?: ~A~%" list2 (not (errorp result)))
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; (eval '(expression))
|
||||||
|
; --------------------
|
||||||
|
; given a lisp expression as a list, eval can be
|
||||||
|
; used to evaluate it
|
||||||
|
|
||||||
|
; run eval on the list (+ 1 2 3 4)
|
||||||
|
(setf x (eval '(+ 1 2 3 4)))
|
||||||
|
|
||||||
|
; consider what happens if we run the following:
|
||||||
|
(setf x (eval (+ 1 2 3 4))) ; lisp evaluates the (+ 1 2 3 4) first,
|
||||||
|
; *then* runs (eval 10)
|
||||||
|
|
||||||
|
; examples of eval and quoting
|
||||||
|
(defvar x 1)
|
||||||
|
(eval x) ; 1 - lisp evaluates x as 1, then runs (eval 1)
|
||||||
|
(eval 'x) ; 1 - eval is looking up the value associated with symbol x
|
||||||
|
(eval (quote x)) ; 1 - as above
|
||||||
|
(eval '(quote x)) ; x
|
||||||
|
|
||||||
|
; print the result
|
||||||
|
(format t "~A~%" x)
|
||||||
|
|
||||||
|
; build an expression using cons then pass it to eval and print the result:
|
||||||
|
(format t "~A~%" (eval (cons '* '(10 20))))
|
||||||
|
|
||||||
|
; function that accepts an expression as a parameter and runs eval on it
|
||||||
|
(defun evalon (expr)
|
||||||
|
(eval expr))
|
||||||
|
|
||||||
|
(format t "result of (evalon '(sqrt 4)) is ~A~%" (evalon '(sqrt 4)))
|
||||||
|
|
||||||
|
; function that takes a list of expressions, L, as a parameter
|
||||||
|
; and runs eval on each of them, in order
|
||||||
|
(defun evalEach (L)
|
||||||
|
(cond
|
||||||
|
((not (listp L)) L)
|
||||||
|
((null L) nil)
|
||||||
|
(t (block
|
||||||
|
evalBlock
|
||||||
|
(eval (car L))
|
||||||
|
(evalEach (cdr L))))))
|
||||||
|
|
||||||
|
(evalEach '((format t "this is expression 1~%")
|
||||||
|
(format t "this is expression 2~%")))
|
||||||
|
|
||||||
|
; you can also specify the conditions under which eval will be run:
|
||||||
|
; - at compile time
|
||||||
|
; - at load time
|
||||||
|
; - at time of interpretation
|
||||||
|
(eval when (compile load eval) (format t "hi!"))
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; test if a file exists using probe-file
|
||||||
|
(format t "checking for file fileio.cl: ~A~%" (probe-file "fileio.cl"))
|
||||||
|
|
||||||
|
; read the contents of a file
|
||||||
|
(with-open-file (stream "./fileio.cl")
|
||||||
|
(do
|
||||||
|
( ; local variable nextline is initialized with the first
|
||||||
|
; line of the file, and after each pass through the
|
||||||
|
; loop is gets the next line of the file
|
||||||
|
(nextline (read-line stream nil) (read-line stream nil)))
|
||||||
|
|
||||||
|
( ; stopping condition and actions
|
||||||
|
(null nextline) ; quits when nextline is null, ie eof
|
||||||
|
(format t "done!~%") ; message to print after quitting
|
||||||
|
)
|
||||||
|
|
||||||
|
; body of loop
|
||||||
|
(format t "current line: ~A~%" nextline)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
; write some stuff to a file
|
||||||
|
(with-open-file
|
||||||
|
; set up the file specs
|
||||||
|
(stream "testfile.txt"
|
||||||
|
:direction :output ; opens for output
|
||||||
|
:if-exists :overwrite ; replace existing file
|
||||||
|
:if-does-not-exist :create) ; otherwise create new one
|
||||||
|
; action(s) to perform,
|
||||||
|
; here writing list to file
|
||||||
|
(format stream "~A~%" '(1 2 3 4)))
|
||||||
|
|
||||||
|
; we can delete an existing file using
|
||||||
|
; (delete-file "filename")
|
||||||
|
|
||||||
|
; a number of functions are provided to get file information based
|
||||||
|
; on the file name, e.g.
|
||||||
|
; (file-author "filename")
|
||||||
|
; (file-write-date "filename")
|
||||||
|
; (file-namestring "path/filename") ; extracts just the filename
|
||||||
|
; (directory-namestring "path/filename") ; extracts just the path
|
||||||
|
|
||||||
|
; a number of others are provided to work from the open stream
|
||||||
|
; (as shown above), e.g.
|
||||||
|
; (file-position stream)
|
||||||
|
; (file-length stream)
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; (flatten L)
|
||||||
|
; -----------
|
||||||
|
; takes a potentially-nested list, L,
|
||||||
|
; and collapses all its elements into a single level,
|
||||||
|
; maintaining their order
|
||||||
|
; e.g. ((1 2 (3 4) 5) 6 ((7 8) 9))
|
||||||
|
; becomes (1 2 3 4 5 6 7 8 9)
|
||||||
|
(defun flatten (L)
|
||||||
|
(cond
|
||||||
|
((not (listp L)) L)
|
||||||
|
((null L) L)
|
||||||
|
((not (listp (car L))) (cons (car L) (flatten (cdr L))))
|
||||||
|
(t (append (flatten (car L)) (flatten (cdr L))))))
|
||||||
|
|
||||||
|
; trial runs
|
||||||
|
|
||||||
|
(defvar L1 '((1 2 (3 4) 5) 6 ((7 8) 9)))
|
||||||
|
(defvar L2 '(1 2 3))
|
||||||
|
(defvar L3 '())
|
||||||
|
(defvar L4 1)
|
||||||
|
(format t "Flattening ~A gives ~A~%" L1 (flatten L1))
|
||||||
|
(format t "Flattening ~A gives ~A~%" L2 (flatten L2))
|
||||||
|
(format t "Flattening ~A gives ~A~%" L3 (flatten L3))
|
||||||
|
(format t "Flattening ~A gives ~A~%" L4 (flatten L4))
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
|
||||||
|
; tail recursive flatten
|
||||||
|
; ----------------------
|
||||||
|
; our tail recursive solution will have one parameter for the
|
||||||
|
; list we're working on right now,
|
||||||
|
; plus an accumulator to keep track of the content still to be processed in
|
||||||
|
; the "parent" list
|
||||||
|
; plus another accumulator to track the result built so far
|
||||||
|
;
|
||||||
|
(defun fflat (L &optional (todo nil) (sofar nil))
|
||||||
|
(cond
|
||||||
|
; error check
|
||||||
|
((not (listp L)) 'error)
|
||||||
|
|
||||||
|
; nothing at all left to process
|
||||||
|
((and (null L) (null todo)) sofar)
|
||||||
|
|
||||||
|
; nothing left in L, but still stuff in todo list
|
||||||
|
((null L) (fflat (car todo) (cdr todo) sofar))
|
||||||
|
|
||||||
|
; front thing in L isn't a list, move it to end of result so far
|
||||||
|
((not (listp (car L))) (fflat (cdr L) todo (append sofar (list (car L)))))
|
||||||
|
|
||||||
|
; front thing in L is a nil, move it to end of result so far
|
||||||
|
((null (car L)) (fflat (cdr L) todo (append sofar (list (car L)))))
|
||||||
|
|
||||||
|
; front thing in L is a nonempty list, move the rest of L to the front of todo list
|
||||||
|
(t (fflat (car L) (cons (cdr L) todo) sofar))))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; emulating a for loop like
|
||||||
|
; for (current = small; current < large; current *= 2) {
|
||||||
|
; print("%d squared is %d\n", current, current*current)
|
||||||
|
; }
|
||||||
|
(defun printsquares (small large)
|
||||||
|
(loop
|
||||||
|
; count which iteration we're on
|
||||||
|
for pass from 1
|
||||||
|
; update for the current base value:
|
||||||
|
; set it to small if we're on the first pass,
|
||||||
|
; otherwise double it on each pass
|
||||||
|
for current = (if (eql pass 1) small (* 2 current))
|
||||||
|
; keep going as long as we haven't hit the end value
|
||||||
|
while (< current large)
|
||||||
|
; body of the loop: prints the square of the current value
|
||||||
|
do (format t "~A squared is ~A~%" current (* current current))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
; emulating a for loop like
|
||||||
|
; for (current = L; member(E,current); current = tail(current)) {
|
||||||
|
; print current;
|
||||||
|
; }
|
||||||
|
(defun printlist (E L)
|
||||||
|
(loop
|
||||||
|
; count which iteration we're on
|
||||||
|
for pass from 1
|
||||||
|
; update for the current list to examing:
|
||||||
|
; the entire list if we're on the first pass,
|
||||||
|
; otherwise chop off the front element
|
||||||
|
for current = (if (eql pass 1) L (cdr current))
|
||||||
|
; keep going as long as we the current list still contains the test element
|
||||||
|
while (member E current)
|
||||||
|
; body of the loop: print the current list
|
||||||
|
do (format t "~A~%" current)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
; sample calls
|
||||||
|
(format t "Calling printsquares~%")
|
||||||
|
(printsquares 1 10)
|
||||||
|
(format t "~%Calling printlist~%")
|
||||||
|
(printlist 3 '(6 5 4 3 2 1))
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; examples using format
|
||||||
|
|
||||||
|
; (format t "text") writes the text to standard output,
|
||||||
|
; ~% is the newline character
|
||||||
|
(format t "blah blah~% more stuff ~%~%")
|
||||||
|
|
||||||
|
; ~A is a placeholder to embed variable/expression values into the string
|
||||||
|
(setf x 1)
|
||||||
|
(setf L '(2 4 6))
|
||||||
|
(format t "x is ~A, (* 3 5) is ~A, L is ~A ~%" x (* 3 5) L)
|
||||||
|
|
||||||
|
; ~S is another placeholder, but prints in a way that lisp can read back in
|
||||||
|
(format t "x is ~S, (* 3 5) is ~S, L is ~S ~%" x (* 3 5) L)
|
||||||
|
|
||||||
|
; using nil instead of t causes format to return the string it would have printed
|
||||||
|
(setf str (format nil "x is ~A~%" x))
|
||||||
|
; we can now use str as a regular chunk of text
|
||||||
|
(format t "~A" str)
|
||||||
|
|
||||||
|
; formats embedded in ~{ ... ~} also allow us to specify how to do something
|
||||||
|
; with every element of a list,
|
||||||
|
; e.g. to print every element of a list formatted to width 6:
|
||||||
|
(format t "list elements are: ~{~6A~}~%" '(1 2 3))
|
||||||
|
|
||||||
|
; ~F allows us to format numeric values, embedding a list of 5 comma-separated
|
||||||
|
; options for how to display them:
|
||||||
|
; the first option is the total number of characters to display
|
||||||
|
; the second is the number of digits after the decimal
|
||||||
|
; the third is the number of digits to shift the decimal point left
|
||||||
|
; (each shift effectively multiplying the output by 10)
|
||||||
|
; the fourth is the character to print if the number is too long
|
||||||
|
; to fit in the space allocated by option 1
|
||||||
|
; the fifth is the character to pad with on the left
|
||||||
|
; here width 8, 3 decimal points, don't shift, print ! if it's too big, pad with 0's
|
||||||
|
(format t "~8,3,0,'!,'0F ~%" (* 1.23 62.5))
|
||||||
|
(format t "~8,3,0,'!,'0F ~%" (/ 100000 3))
|
||||||
|
|
||||||
|
; some other options include ~B, ~O, and ~X for binary, octal, and hexadecimal
|
||||||
|
|
||||||
|
; note that you can force display of any buffered output using
|
||||||
|
(force-output)
|
||||||
|
; or you can discard any buffered output using
|
||||||
|
(clear-output)
|
||||||
|
|
||||||
|
; you can also display warning messages (goes to stderr), e.g.
|
||||||
|
(defvar someValue 27)
|
||||||
|
(warn "something went wrong with ~A~%" someValue)
|
||||||
|
|
||||||
|
; or you can generate an error message and halt the program
|
||||||
|
(error "something REALLY wrong with ~A, dropping to debug mode!~%" someValue)
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; (funcall 'function ...function arguments...)
|
||||||
|
; ---------------------------------------------
|
||||||
|
; given a function and a sequence of parameters,
|
||||||
|
; funcall can be used to apply the function to the arguments
|
||||||
|
|
||||||
|
; use funcall to evaluate (* 1 2 3 4)
|
||||||
|
(setf x (funcall '* 1 2 3 4))
|
||||||
|
|
||||||
|
; print the result
|
||||||
|
(format t "~A~%" x)
|
||||||
|
|
||||||
|
; function that takes a binary operator and two values as parameters
|
||||||
|
; and runs the function on the two values
|
||||||
|
(defun binRun (f a b)
|
||||||
|
(cond
|
||||||
|
((not (functionp f)) (format t "~A is not a function~%" f))
|
||||||
|
(t (funcall f a b))))
|
||||||
|
|
||||||
|
(binRun 'format t "hello!~%")
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; functions can be globally declared using defun,
|
||||||
|
; which actually treats them much like a special global variable,
|
||||||
|
; (global function variables are treated differently than global data variables)
|
||||||
|
|
||||||
|
; example of function declaration and call
|
||||||
|
|
||||||
|
; declare function foo that takes parameters x and y
|
||||||
|
(defun foo (x y)
|
||||||
|
; run the statements contained in foo
|
||||||
|
(format t "we are inside function foo~%")
|
||||||
|
(format t "x is ~A, y is ~A~%" x y)
|
||||||
|
; foo's return value is the value of the last statement run
|
||||||
|
(+ x y) ; returns x+y
|
||||||
|
)
|
||||||
|
|
||||||
|
; call foo passing 2 for x, 3 for y,
|
||||||
|
; store the result in variable x
|
||||||
|
(setf x (foo 2 3))
|
||||||
|
|
||||||
|
; print x
|
||||||
|
(format t "x is ~A~%" x)
|
||||||
|
|
||||||
|
; --- functions operating on functions ---
|
||||||
|
|
||||||
|
; test if a symbol has a function bound to it
|
||||||
|
(fboundp 'foo)
|
||||||
|
|
||||||
|
; look up the structure of a function
|
||||||
|
(function foo)
|
||||||
|
|
||||||
|
; look up the global function associated with a symbol
|
||||||
|
(symbol-function foo)
|
||||||
|
|
||||||
|
; unbind (delete) an existing function definition
|
||||||
|
(makunbound 'foo)
|
||||||
|
|
||||||
|
; bind a function body to an existing symbol,
|
||||||
|
; can be used to turn a variable into a function,
|
||||||
|
; or to overwrite an existing function definition
|
||||||
|
(setf (symbol-function 'foo) (lambda (x) (+ x x)))
|
||||||
|
(foo 3) ; foo now returns x+x, here 6
|
||||||
|
|
|
@ -0,0 +1,98 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; in this script we create and test a variety of macros to determine what form
|
||||||
|
; was used in a function definition, and to extract the function
|
||||||
|
; name, parameter list, body, and local environment (accessible variables/parameters)
|
||||||
|
;
|
||||||
|
; the core macros are
|
||||||
|
; (getName func)
|
||||||
|
; (getParams func)
|
||||||
|
; (getBody func)
|
||||||
|
; (getEnv func)
|
||||||
|
;
|
||||||
|
; usage note:
|
||||||
|
; for functions defined using defun or labels you cannot pass the symbol,
|
||||||
|
; you must pass the function, e.g. (getname (function f))
|
||||||
|
; whereas for functions assigned to a variable you can simply pass the variable
|
||||||
|
; (e.g. variables in a let block that have been assigned a lambda
|
||||||
|
; or variables storing the result of a closure)
|
||||||
|
|
||||||
|
; macro to capture the definition form of a function
|
||||||
|
(defmacro getForm (func)
|
||||||
|
`(cond
|
||||||
|
((not (listp ,func)) 'err)
|
||||||
|
((null ,func) 'err)
|
||||||
|
((string= (symbol-name (car ,func)) (symbol-name 'LAMBDA-BLOCK)) 'defun)
|
||||||
|
((string= (symbol-name (car ,func)) (symbol-name 'LAMBDA)) 'lambda)
|
||||||
|
((string= (symbol-name (car ,func)) (symbol-name 'LAMBDA-CLOSURE)) 'closure)
|
||||||
|
((string= (symbol-name (car ,func)) (symbol-name 'LAMBDA-BLOCK-CLOSURE)) 'labels)
|
||||||
|
(t 'err)))
|
||||||
|
|
||||||
|
; macros to capture the name, parameter list, body, and environment (accessible variables/parameters) of a function
|
||||||
|
; (after identifying the form of the function)
|
||||||
|
(defmacro getName (func)
|
||||||
|
`(case (getForm ,func)
|
||||||
|
(defun (if (< (length ,func) 2) 'err (cadr ,func)))
|
||||||
|
(lambda 'lambda)
|
||||||
|
(closure 'closure)
|
||||||
|
(labels (if (< (length ,func) 5) 'err (car (cddddr ,func))))
|
||||||
|
(t 'err)))
|
||||||
|
|
||||||
|
(defmacro getParams (func)
|
||||||
|
`(case (getForm ,func)
|
||||||
|
(defun (if (< (length ,func) 3) 'err (caddr ,func)))
|
||||||
|
(lambda (if (< (length ,func) 2) 'err (cadr ,func)))
|
||||||
|
(closure (if (< (length ,func) 5) 'err (car (cddddr ,func))))
|
||||||
|
(labels (if (< (length ,func) 6) 'err (cadr (cddddr ,func))))
|
||||||
|
(t 'err)))
|
||||||
|
|
||||||
|
(defmacro getBody (func)
|
||||||
|
`(case (getForm ,func)
|
||||||
|
(defun (if (< (length ,func) 3) 'err (cdddr ,func)))
|
||||||
|
(lambda (if (< (length ,func) 2) 'err (cddr ,func)))
|
||||||
|
(closure (if (< (length ,func) 5) 'err (cdr (cddddr ,func))))
|
||||||
|
(labels (if (< (length ,func) 6) 'err (cddr (cddddr ,func))))
|
||||||
|
(t 'err)))
|
||||||
|
|
||||||
|
(defmacro getEnv (func)
|
||||||
|
`(case (getForm ,func)
|
||||||
|
(defun nil)
|
||||||
|
(lambda nil)
|
||||||
|
(closure (if (< (length ,func) 2) 'err (cadr ,func)))
|
||||||
|
(labels (if (< (length ,func) 2) 'err (cadr ,func)))
|
||||||
|
(t 'err)))
|
||||||
|
|
||||||
|
|
||||||
|
; function to analyze all the parts of our function
|
||||||
|
(defun analyze (func)
|
||||||
|
(format t "~%Name of function is ~A~%" (getName func))
|
||||||
|
(format t " paramList of function is ~A~%" (getParams func))
|
||||||
|
(format t " env of function is ~A~%" (getEnv func))
|
||||||
|
(format t " body of function is ~A~%" (getBody func)))
|
||||||
|
|
||||||
|
|
||||||
|
; test out our macros
|
||||||
|
(defun f (x)
|
||||||
|
(let ((sq (lambda () (* x x))))
|
||||||
|
(labels
|
||||||
|
((prt (j) (format t "hi ~A, ~A squared is ~A~%" j x (sq))))
|
||||||
|
(format t "~%---analyze f let variable with a lambda---~%")
|
||||||
|
(analyze sq)
|
||||||
|
(format t "~%---analyze f labels function---~%")
|
||||||
|
(analyze (function prt)))))
|
||||||
|
|
||||||
|
|
||||||
|
(format t "~%---analyze prt2 in global labels block---~%")
|
||||||
|
(labels ((prt2 (i) (format t "hi ~A!~%" i)))
|
||||||
|
(analyze (function prt2)))
|
||||||
|
|
||||||
|
|
||||||
|
(format t "~%---analyze defun f---~%")
|
||||||
|
(analyze (function f))
|
||||||
|
(format t "~%---run f to analyze local let/labels---~%")
|
||||||
|
(f 3)
|
||||||
|
|
||||||
|
|
||||||
|
(format t "~%---analyze lambda expression---~%")
|
||||||
|
(analyze (lambda (a) (* a a)))
|
||||||
|
|
|
@ -0,0 +1,158 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; sample program to let you interactively edit and run a lisp function
|
||||||
|
; as long as the function is of the form supported by selfModMacros
|
||||||
|
|
||||||
|
(load "selfModMacros.cl")
|
||||||
|
|
||||||
|
|
||||||
|
; modifyParams allows the user to rewrite the function's parameter list
|
||||||
|
(defun modifyParams (func)
|
||||||
|
(format t "The parameter list is currently: ~A~%" (fGetParams func))
|
||||||
|
(format t "Please enter the new parameter list:~%")
|
||||||
|
(setf (fGetParams func) (read))
|
||||||
|
(format t "The new parameter list is: ~A~%" (fGetParams func)))
|
||||||
|
|
||||||
|
|
||||||
|
; modifyLocals allows the user to rewrite the function's local variable list
|
||||||
|
(defun modifyLocals (func)
|
||||||
|
(format t "The local variable list is currently ~A~%" (fGetLocals func))
|
||||||
|
(format t "Please enter the new local variable list:~%")
|
||||||
|
(setf (fGetLocals func) (read))
|
||||||
|
(format t "The new local variable list is: ~A~%" (fGetLocals func)))
|
||||||
|
|
||||||
|
|
||||||
|
; getCommand prompts the user to choose remove, add, or modify
|
||||||
|
; and return their choice
|
||||||
|
(defun getCommand ()
|
||||||
|
(format t "Enter rem to remove an element, add to add one, or mod to modify one~%")
|
||||||
|
(case (read)
|
||||||
|
(rem 'rem)
|
||||||
|
(add 'add)
|
||||||
|
(mod 'mod)
|
||||||
|
(t (format t "Invalid selection, please try again~%")
|
||||||
|
(getCommand))))))
|
||||||
|
|
||||||
|
|
||||||
|
; modifyMethods allows the user to modify the function's local method list
|
||||||
|
(defun modifyMethods (func)
|
||||||
|
(let ((pos nil) (newF nil))
|
||||||
|
(format t "The local method list is currently ~A~%" (fGetMethods func))
|
||||||
|
(case (getCommand)
|
||||||
|
(rem (format t "Please enter the position of the method to remove (0-based)~%")
|
||||||
|
(setf pos (read))
|
||||||
|
(removeNth pos (fGetMethods func)))
|
||||||
|
(add (format t "Please enter the definition of the method you wish added~%")
|
||||||
|
(insertNth 0 (read) (fGetMethods func)))
|
||||||
|
(mod (format t "Please enter the position of the method you wish to replace (0-based)~%")
|
||||||
|
(setf pos (read))
|
||||||
|
(format t "Please enter the new method definition~%")
|
||||||
|
(setf newF (read))
|
||||||
|
(replaceNth pos newF (fGetMethods func)))
|
||||||
|
(t (format t "Err: invalid command, no action taken~%")))))
|
||||||
|
|
||||||
|
|
||||||
|
; modifyBlock allows the user to modify the function's preprocessing block
|
||||||
|
; (adding, removing, or altering statements within the block)
|
||||||
|
(defun modifyBlock (func)
|
||||||
|
(let ((pos nil) (newS nil))
|
||||||
|
(format t "The setup block is currently ~A~%" (fGetBlock func))
|
||||||
|
(format t " -- note the first statement is always in position 2 --~%")
|
||||||
|
(case (getCommand)
|
||||||
|
(rem (format t "Please enter the position of the statement to remove (2+)~%")
|
||||||
|
(setf pos (read))
|
||||||
|
(removeNth pos (fGetBlock func)))
|
||||||
|
(add (format t "Please enter the position in which you wish to add the new statement (2+)~%")
|
||||||
|
(setf pos (read))
|
||||||
|
(format t "Please enter the statement you wish added~%")
|
||||||
|
(setf newS (read))
|
||||||
|
(insertNth pos newS (fGetBlock func)))
|
||||||
|
(mod (format t "Please enter the position of the statement you wish to replace (2+)~%")
|
||||||
|
(setf pos (read))
|
||||||
|
(format t "Please enter the new statment~%")
|
||||||
|
(setf newS (read))
|
||||||
|
(replaceNth pos newS (fGetBlock func)))
|
||||||
|
(t (format t "Err: invalid command, no action taken~%")))))
|
||||||
|
|
||||||
|
|
||||||
|
; modifyCond allows the user to modify the function's final conditions block
|
||||||
|
(defun modifyCond (func)
|
||||||
|
(let ((pos nil) (newC nil))
|
||||||
|
(format t "The final cond is currently ~A~%" (fGetCond func))
|
||||||
|
(format t " -- note the first case is always in position 1 --~%")
|
||||||
|
(case (getCommand)
|
||||||
|
(rem (format t "Please enter the position of the case to remove (1+)~%")
|
||||||
|
(setf pos (read))
|
||||||
|
(removeNth pos (fGetCond func)))
|
||||||
|
(add (format t "Please enter the position in which you wish to add the new case (1+)~%")
|
||||||
|
(setf pos (read))
|
||||||
|
(format t "Please enter the case you wish added~%")
|
||||||
|
(setf newC (read))
|
||||||
|
(insertNth pos newC (fGetCond func)))
|
||||||
|
(mod (format t "Please enter the position of the case you wish to replace (1+)~%")
|
||||||
|
(setf pos (read))
|
||||||
|
(format t "Please enter the new case~%")
|
||||||
|
(setf newC (read))
|
||||||
|
(replaceNth pos newC (fGetCond func)))
|
||||||
|
(t (format t "Err: invalid command, no action taken~%")))))
|
||||||
|
|
||||||
|
|
||||||
|
; displayHelp shows the available commands
|
||||||
|
(defun displayHelp ()
|
||||||
|
(format t "Enter help to display this menu~%")
|
||||||
|
(format t " or show to display the function~%")
|
||||||
|
(format t " or params to modify the function parameters~%")
|
||||||
|
(format t " or locals to modify the function local variables~%")
|
||||||
|
(format t " or methods to modify the function local methods~%")
|
||||||
|
(format t " or block to modify the function preprocessing block~%")
|
||||||
|
(format t " or cond to modify the function final condition statement~%")
|
||||||
|
(format t " or run to run the function~%")
|
||||||
|
(format t " or quit to quit the program~%"))
|
||||||
|
|
||||||
|
|
||||||
|
; run allows the user to supply parameters and then run the function
|
||||||
|
(defun run (func)
|
||||||
|
(let ; local vars, just the parameter list
|
||||||
|
((params nil))
|
||||||
|
(format t "Please enter the list of parameters to be supplied to the function~%")
|
||||||
|
(setf params (read))
|
||||||
|
(format t "Beginning execution:~%")
|
||||||
|
(apply func params)))
|
||||||
|
|
||||||
|
|
||||||
|
; editFunc allows editing and execution of the given function
|
||||||
|
(defun editFunc (func)
|
||||||
|
|
||||||
|
; let the user repeatedly customize the function
|
||||||
|
(do
|
||||||
|
; local variables: the user command choice
|
||||||
|
((cmd nil))
|
||||||
|
|
||||||
|
; stopping condition (when the user enters the quit command),
|
||||||
|
; return value is the modified function
|
||||||
|
((symbol-equal cmd 'quit)
|
||||||
|
func)
|
||||||
|
|
||||||
|
; loop body - prompt/read/process command
|
||||||
|
(format t "~%Enter a command (help for a list of commands)~%")
|
||||||
|
(setf cmd (read))
|
||||||
|
(case cmd
|
||||||
|
(help (displayHelp))
|
||||||
|
(params (modifyParams func))
|
||||||
|
(locals (modifyLocals func))
|
||||||
|
(methods (modifyMethods func))
|
||||||
|
(cond (modifyCond func))
|
||||||
|
(block (modifyBlock func))
|
||||||
|
(run (run func))
|
||||||
|
(show (printFunc func))
|
||||||
|
(help (displayHelp))
|
||||||
|
(quit (format t "Bye!~%"))
|
||||||
|
(t (format t "Invalid command: ~A~%" cmd)))))
|
||||||
|
|
||||||
|
|
||||||
|
(format t "~%---Welcome---~%~%")
|
||||||
|
; generate an initial function and start editing it
|
||||||
|
(defvar newF (editFunc (fGenFunc)))
|
||||||
|
(format t "~%The final modified function is:~%~A~%" newF)
|
||||||
|
(format t "~%---Done---~%")
|
||||||
|
|
|
@ -0,0 +1,97 @@
|
||||||
|
#! /usr/bin/gcl -f
|
||||||
|
|
||||||
|
; pure functional programming generally has the philosophy that
|
||||||
|
; we avoid explicit use of state and sequence - no variables,
|
||||||
|
; no side effects, no explicitly ordering of steps
|
||||||
|
;
|
||||||
|
; this allows cleaner theoretical analysis of a program based on
|
||||||
|
; logical compositions of it's individual components, which
|
||||||
|
; (i) permits much simpler proofs of correctness
|
||||||
|
; (proving the parts are correct proves the whole is correct,
|
||||||
|
; since there is no state, no side effects)
|
||||||
|
; (ii) permits much simpler testing (for the same reasons,
|
||||||
|
; if the parts are correct and pass testing then the whole
|
||||||
|
; is correct and passes testing)
|
||||||
|
; (iii) since there are no interactions and no side effects,
|
||||||
|
; it is much simpler to autumatically parallelize code, since
|
||||||
|
; if we have a call like (f (g ...params...) (h ...params...))
|
||||||
|
; we know we can give h and g to different processors to run
|
||||||
|
; in parallel [and, in a purely functional implementation,
|
||||||
|
; calls of that form will be extremely common)
|
||||||
|
;
|
||||||
|
; in fact, many features of lisp and other functional languages
|
||||||
|
; appear to violate those principles - defvar allows creation
|
||||||
|
; of global variables which can be modified with setf,
|
||||||
|
; block and let specify ordered sequences of operations,
|
||||||
|
; let blocks also allow definitions of local variables, etc.
|
||||||
|
;
|
||||||
|
; those features can, generally, actually be implemented to operate
|
||||||
|
; in a functionally pure manner, while allowing the programmer to
|
||||||
|
; use the features in an apparently impure manner
|
||||||
|
;
|
||||||
|
; here we'll look at taking some impure features of lisp,
|
||||||
|
; and show how we could achieve the desired results
|
||||||
|
; in a pure fashion - the actual implementation of the
|
||||||
|
; features often follow similar approaches (though more
|
||||||
|
; efficiently)
|
||||||
|
|
||||||
|
; Technique 1: eliminating the need for local variables
|
||||||
|
; ------------
|
||||||
|
; consider the function below with parameters x and y,
|
||||||
|
; and local variables a and b:
|
||||||
|
(defun f (x y)
|
||||||
|
(let ( ; read two values entered by the user and store in a,b
|
||||||
|
(a (read))(b (read)))
|
||||||
|
; compute and return ay + x(b-(a/y))
|
||||||
|
(+ (* y a) (* x (- b (/ a y))))))
|
||||||
|
|
||||||
|
; if we wanted the same effect, but done in a "purely" functional manner
|
||||||
|
; (i.e. with parameters only, no local variables)
|
||||||
|
; we could rewrite it as two functions - the public call to f,
|
||||||
|
; and an internal call to fHidden:
|
||||||
|
(defun f (x y)
|
||||||
|
; read the two values entered by the user, pass everything to fHidden
|
||||||
|
(fHidden x y (read) (read)))
|
||||||
|
|
||||||
|
(defun fHidden (x y a b)
|
||||||
|
; perform the calculation and return the result
|
||||||
|
(+ (* y a) (* x (- b (/ a y))))))
|
||||||
|
|
||||||
|
; Technique 2: functionally enforcing sequential statements
|
||||||
|
; ------------
|
||||||
|
; consider the block below, which runs several statements in the
|
||||||
|
; order presented, and returns the value of the last statement
|
||||||
|
(block
|
||||||
|
Example
|
||||||
|
(format t "statement 1~%")
|
||||||
|
(format t "statement 2~%"))
|
||||||
|
|
||||||
|
; we could force the same effect in a "pure" manner using
|
||||||
|
(if (format t "statement 1~%") (format t "statement 2~%")
|
||||||
|
(format t "statement 2~%"))
|
||||||
|
; (essentially guaranteeing statement 1 is run first to evaluate the if,
|
||||||
|
; and regardless of the result of statement 1 it will go on to run statement 2)
|
||||||
|
|
||||||
|
; Technique 3: functionally supporting setting of variable values
|
||||||
|
; ------------
|
||||||
|
; consider this example with global variables:
|
||||||
|
(defvar x C)
|
||||||
|
(f1 x)
|
||||||
|
(setf x (f2 x))
|
||||||
|
(f3 x)
|
||||||
|
|
||||||
|
; we combine techniques 1 and 2 above:
|
||||||
|
(defun hidden (x)
|
||||||
|
(if (f1 x) (f3 (f2 x)) (f3 (f2 x))))
|
||||||
|
(hidden C)
|
||||||
|
|
||||||
|
; Technique 4: eliminating side effects
|
||||||
|
; ------------
|
||||||
|
; The primary source of side effects comes from the implementation of lists
|
||||||
|
; through pointers/references, and permitting functions to simply access/return
|
||||||
|
; the pointer/reference. To eliminate this would require using our own set of
|
||||||
|
; functions that always returned COPIES of the list component being accessed,
|
||||||
|
; rather than pointers/references into the original. While this is not difficult,
|
||||||
|
; it would certainly cause a significant increase in memory use and (sometimes)
|
||||||
|
; execution time for functions that manipulate large lists.
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL SI Manual: Available Symbols</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL SI Manual: Available Symbols">
|
||||||
|
<meta name="keywords" content="GCL SI Manual: Available Symbols">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
|
||||||
|
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="C-Interface.html#C-Interface" rel="up" title="C Interface">
|
||||||
|
<link href="System-Definitions.html#System-Definitions" rel="next" title="System Definitions">
|
||||||
|
<link href="C-Interface.html#C-Interface" rel="prev" title="C Interface">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Available-Symbols"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Previous: <a href="C-Interface.html#C-Interface" accesskey="p" rel="prev">C Interface</a>, Up: <a href="C-Interface.html#C-Interface" accesskey="u" rel="up">C Interface</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Available-Symbols-1"></a>
|
||||||
|
<h3 class="section">16.1 Available Symbols</h3>
|
||||||
|
|
||||||
|
<p>When GCL is built, those symbols in the system libraries which
|
||||||
|
are referenced by functions linked in in the list of objects
|
||||||
|
given in <samp>unixport/makefile</samp>, become available for reference
|
||||||
|
by GCL code.
|
||||||
|
</p>
|
||||||
|
<p>On some systems it is possible with <code>faslink</code> to load <samp>.o</samp> files
|
||||||
|
which reference other libraries, but in general this practice is not
|
||||||
|
portable.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,131 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL SI Manual: Bignums</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL SI Manual: Bignums">
|
||||||
|
<meta name="keywords" content="GCL SI Manual: Bignums">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
|
||||||
|
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="GCL-Specific.html#GCL-Specific" rel="up" title="GCL Specific">
|
||||||
|
<link href="C-Interface.html#C-Interface" rel="next" title="C Interface">
|
||||||
|
<link href="GCL-Specific.html#GCL-Specific" rel="prev" title="GCL Specific">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Bignums"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Previous: <a href="GCL-Specific.html#GCL-Specific" accesskey="p" rel="prev">GCL Specific</a>, Up: <a href="GCL-Specific.html#GCL-Specific" accesskey="u" rel="up">GCL Specific</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Bignums-1"></a>
|
||||||
|
<h3 class="section">15.1 Bignums</h3>
|
||||||
|
|
||||||
|
<p>A directory mp was added to hold the new multi precision arithmetic
|
||||||
|
code. The layout and a fair amount of code in the mp directory is an
|
||||||
|
enhanced version of gpari version 34. The gpari c code was rewritten
|
||||||
|
to be more efficient, and gcc assembler macros were added to allow
|
||||||
|
inlining of operations not possible to do in C. On a 68K machine,
|
||||||
|
this allows the C version to be as efficient as the very carefully
|
||||||
|
written assembler in the gpari distribution. For the main machines,
|
||||||
|
an assembler file (produced by gcc) based on this new method, is
|
||||||
|
included. This is for sites which do not have gcc, or do not
|
||||||
|
wish to compile the whole system with gcc.
|
||||||
|
</p>
|
||||||
|
<p>Bignum arithmetic is much faster now. Many changes were made to
|
||||||
|
cmpnew also, to add ’integer’ as a new type. It differs from
|
||||||
|
variables of other types, in that storage is associated to each such
|
||||||
|
variable, and assignments mean copying the storage. This allows a
|
||||||
|
function which does a good deal of bignum arithmetic, to do very
|
||||||
|
little consing in the heap. An example is the computation of PI-INV
|
||||||
|
in scratchpad, which calculates the inverse of pi to a prescribed
|
||||||
|
number of bits accuracy. That function is now about 20 times faster,
|
||||||
|
and no longer causes garbage collection. In versions of GCL where
|
||||||
|
HAVE_ALLOCA is defined, the temporary storage growth is on the C
|
||||||
|
stack, although this often not so critical (for example it makes
|
||||||
|
virtually no difference in the PI-INV example, since in spite of the
|
||||||
|
many operations, only one storage allocation takes place.
|
||||||
|
</p>
|
||||||
|
<p>Below is the actual code for PI-INV
|
||||||
|
</p>
|
||||||
|
<p>On a sun3/280 (cli.com)
|
||||||
|
</p>
|
||||||
|
<p>Here is the comparison of lucid and gcl before and after
|
||||||
|
on that pi-inv. Times are in seconds with multiples of the
|
||||||
|
gcl/akcl time in parentheses.
|
||||||
|
</p>
|
||||||
|
<p>On a sun3/280 (cli.com)
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">
|
||||||
|
pi-inv akcl-566 franz lucid old kcl/akcl
|
||||||
|
----------------------------------------
|
||||||
|
10000 3.3 9.2(2.8 X) 15.3 (4.6X) 92.7 (29.5 X)
|
||||||
|
20000 12.7 31.0(2.4 X) 62.2 (4.9X) 580.0 (45.5 X)
|
||||||
|
|
||||||
|
|
||||||
|
(defun pi-inv (bits &aux (m 0))
|
||||||
|
(declare (integer bits m))
|
||||||
|
(let* ((n (+ bits (integer-length bits) 11))
|
||||||
|
(tt (truncate (ash 1 n) 882))
|
||||||
|
(d (* 4 882 882))
|
||||||
|
(s 0))
|
||||||
|
(declare (integer s d tt n))
|
||||||
|
(do ((i 2 (+ i 2))
|
||||||
|
(j 1123 (+ j 21460)))
|
||||||
|
((zerop tt) (cons s (- (+ n 2))))
|
||||||
|
(declare (integer i j))
|
||||||
|
(setq s (+ s (* j tt))
|
||||||
|
m (- (* (- i 1) (- (* 2 i) 1) (- (* 2 i) 3)))
|
||||||
|
tt (truncate (* m tt) (* d (the integer (expt i 3))))))))
|
||||||
|
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Previous: <a href="GCL-Specific.html#GCL-Specific" accesskey="p" rel="prev">GCL Specific</a>, Up: <a href="GCL-Specific.html#GCL-Specific" accesskey="u" rel="up">GCL Specific</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,70 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL SI Manual: C Interface</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL SI Manual: C Interface">
|
||||||
|
<meta name="keywords" content="GCL SI Manual: C Interface">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
|
||||||
|
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="index.html#Top" rel="up" title="Top">
|
||||||
|
<link href="Available-Symbols.html#Available-Symbols" rel="next" title="Available Symbols">
|
||||||
|
<link href="Bignums.html#Bignums" rel="prev" title="Bignums">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="C-Interface"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="System-Definitions.html#System-Definitions" accesskey="n" rel="next">System Definitions</a>, Previous: <a href="GCL-Specific.html#GCL-Specific" accesskey="p" rel="prev">GCL Specific</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="C-Interface-1"></a>
|
||||||
|
<h2 class="chapter">16 C Interface</h2>
|
||||||
|
|
||||||
|
<table class="menu" border="0" cellspacing="0">
|
||||||
|
<tr><td align="left" valign="top">• <a href="Available-Symbols.html#Available-Symbols" accesskey="1">Available Symbols</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,488 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL SI Manual: Characters</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL SI Manual: Characters">
|
||||||
|
<meta name="keywords" content="GCL SI Manual: Characters">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
|
||||||
|
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="index.html#Top" rel="up" title="Top">
|
||||||
|
<link href="Lists.html#Lists" rel="next" title="Lists">
|
||||||
|
<link href="Sequences-and-Arrays-and-Hash-Tables.html#Sequences-and-Arrays-and-Hash-Tables" rel="prev" title="Sequences and Arrays and Hash Tables">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Characters"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Lists.html#Lists" accesskey="n" rel="next">Lists</a>, Previous: <a href="Sequences-and-Arrays-and-Hash-Tables.html#Sequences-and-Arrays-and-Hash-Tables" accesskey="p" rel="prev">Sequences and Arrays and Hash Tables</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Characters-1"></a>
|
||||||
|
<h2 class="chapter">3 Characters</h2>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-NAME_002dCHAR"></a>Function: <strong>NAME-CHAR</strong> <em>(name)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Given an argument acceptable to string,
|
||||||
|
Returns a character object whose name is NAME if one exists. Returns NIL
|
||||||
|
otherwise. NAME must be an object that can be coerced to a string.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHAR_002dNAME"></a>Function: <strong>CHAR-NAME</strong> <em>(char)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the name for CHAR as a string; NIL if CHAR has no name.
|
||||||
|
Only #\Backspace, #\Tab, #\Newline (or #\Linefeed), #\Page, #\Return,
|
||||||
|
and #\Rubout have names.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-BOTH_002dCASE_002dP"></a>Function: <strong>BOTH-CASE-P</strong> <em>(char)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if CHAR is an alphabetic character; NIL otherwise. Equivalent to
|
||||||
|
ALPHA-CHAR-P.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-SCHAR"></a>Function: <strong>SCHAR</strong> <em>(simple-string index)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the character object representing the INDEX-th character in STRING.
|
||||||
|
This is faster than CHAR.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHAR_002dSUPER_002dBIT"></a>Constant: <strong>CHAR-SUPER-BIT</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
The bit that indicates a super character.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHAR_002dFONT_002dLIMIT"></a>Constant: <strong>CHAR-FONT-LIMIT</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
The upper exclusive bound on values produced by CHAR-FONT.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHAR_002dDOWNCASE"></a>Function: <strong>CHAR-DOWNCASE</strong> <em>(char)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the lower-case equivalent of CHAR, if any.
|
||||||
|
If not, simply returns CHAR.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-STRING_002dCHAR_002dP"></a>Function: <strong>STRING-CHAR-P</strong> <em>(char)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if CHAR can be stored in a string. In GCL, this function always
|
||||||
|
returns T since any character in GCL can be stored in a string.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHAR_002dNOT_002dLESSP"></a>Function: <strong>CHAR-NOT-LESSP</strong> <em>(char &rest more-chars)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if the codes of CHARs are in strictly non-increasing order; NIL
|
||||||
|
otherwise. For a lower-case character, the code of its upper-case equivalent
|
||||||
|
is used.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-DISASSEMBLE"></a>Function: <strong>DISASSEMBLE</strong> <em>(thing)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Compiles the form specified by THING and prints the intermediate C language
|
||||||
|
code for that form. But does NOT install the result of compilation.
|
||||||
|
If THING is a symbol that names a not-yet-compiled function, the function
|
||||||
|
definition is disassembled.
|
||||||
|
If THING is a lambda expression, it is disassembled as a function definition.
|
||||||
|
Otherwise, THING itself is disassembled as a top-level form.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-LOWER_002dCASE_002dP"></a>Function: <strong>LOWER-CASE-P</strong> <em>(char)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if CHAR is a lower-case character; NIL otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHAR_003c_003d"></a>Function: <strong>CHAR<=</strong> <em>(char &rest more-chars)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if the codes of CHARs are in strictly non-decreasing order; NIL
|
||||||
|
otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHAR_002dHYPER_002dBIT"></a>Constant: <strong>CHAR-HYPER-BIT</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
The bit that indicates a hyper character.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CODE_002dCHAR"></a>Function: <strong>CODE-CHAR</strong> <em>(code &optional (bits 0) (font 0))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns a character object with the specified code, if any.
|
||||||
|
If not, returns NIL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHAR_002dCODE"></a>Function: <strong>CHAR-CODE</strong> <em>(char)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the code attribute of CHAR.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHAR_002dCONTROL_002dBIT"></a>Constant: <strong>CHAR-CONTROL-BIT</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
The bit that indicates a control character.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHAR_002dLESSP"></a>Function: <strong>CHAR-LESSP</strong> <em>(char &rest more-chars)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if the codes of CHARs are in strictly increasing order; NIL
|
||||||
|
otherwise. For a lower-case character, the code of its upper-case equivalent
|
||||||
|
is used.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHAR_002dFONT"></a>Function: <strong>CHAR-FONT</strong> <em>(char)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the font attribute of CHAR.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHAR_003c"></a>Function: <strong>CHAR<</strong> <em>(char &rest more-chars)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if the codes of CHARs are in strictly increasing order; NIL otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHAR_003e_003d"></a>Function: <strong>CHAR>=</strong> <em>(char &rest more-chars)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if the codes of CHARs are in strictly non-increasing order; NIL
|
||||||
|
otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHAR_002dMETA_002dBIT"></a>Constant: <strong>CHAR-META-BIT</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
The bit that indicates a meta character.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-GRAPHIC_002dCHAR_002dP"></a>Function: <strong>GRAPHIC-CHAR-P</strong> <em>(char)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if CHAR is a printing character, i.e., #\Space through #\~;
|
||||||
|
NIL otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHAR_002dNOT_002dEQUAL"></a>Function: <strong>CHAR-NOT-EQUAL</strong> <em>(char &rest more-chars)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if no two of CHARs are the same character; NIL otherwise.
|
||||||
|
Upper case character and its lower case equivalent are regarded the same.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHAR_002dBITS_002dLIMIT"></a>Constant: <strong>CHAR-BITS-LIMIT</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
The upper exclusive bound on values produced by CHAR-BITS.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHARACTERP"></a>Function: <strong>CHARACTERP</strong> <em>(x)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if X is a character; NIL otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHAR_003d"></a>Function: <strong>CHAR=</strong> <em>(char &rest more-chars)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if all CHARs are the same character; NIL otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-ALPHA_002dCHAR_002dP"></a>Function: <strong>ALPHA-CHAR-P</strong> <em>(char)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if CHAR is an alphabetic character, A-Z or a-z; NIL otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-UPPER_002dCASE_002dP"></a>Function: <strong>UPPER-CASE-P</strong> <em>(char)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if CHAR is an upper-case character; NIL otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHAR_002dBIT"></a>Function: <strong>CHAR-BIT</strong> <em>(char name)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if the named bit is on in the character CHAR; NIL otherwise.
|
||||||
|
In GCL, this function always returns NIL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-MAKE_002dCHAR"></a>Function: <strong>MAKE-CHAR</strong> <em>(char &optional (bits 0) (font 0))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns a character object with the same code attribute as CHAR and with
|
||||||
|
the specified BITS and FONT attributes.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHARACTER"></a>Function: <strong>CHARACTER</strong> <em>(x)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Coerces X into a character object if possible.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHAR_002dEQUAL"></a>Function: <strong>CHAR-EQUAL</strong> <em>(char &rest more-chars)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if all of its arguments are the same character; NIL otherwise.
|
||||||
|
Upper case character and its lower case equivalent are regarded the same.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHAR_002dNOT_002dGREATERP"></a>Function: <strong>CHAR-NOT-GREATERP</strong> <em>(char &rest more-chars)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if the codes of CHARs are in strictly non-decreasing order; NIL
|
||||||
|
otherwise. For a lower-case character, the code of its upper-case equivalent
|
||||||
|
is used.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHAR_003e"></a>Function: <strong>CHAR></strong> <em>(char &rest more-chars)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if the codes of CHARs are in strictly decreasing order; NIL
|
||||||
|
otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-STANDARD_002dCHAR_002dP"></a>Function: <strong>STANDARD-CHAR-P</strong> <em>(char)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if CHAR is a standard character, i.e., one of the 95 ASCII printing
|
||||||
|
characters #\Space to #\~ and #Newline; NIL otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHAR_002dUPCASE"></a>Function: <strong>CHAR-UPCASE</strong> <em>(char)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the upper-case equivalent of CHAR, if any.
|
||||||
|
If not, simply returns CHAR.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-DIGIT_002dCHAR_002dP"></a>Function: <strong>DIGIT-CHAR-P</strong> <em>(char &optional (radix 10))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>If CHAR represents a digit in RADIX, then returns the weight as an integer.
|
||||||
|
Otherwise, returns nil.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHAR_002f_003d"></a>Function: <strong>CHAR/=</strong> <em>(char &rest more-chars)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if no two of CHARs are the same character; NIL otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHAR_002dGREATERP"></a>Function: <strong>CHAR-GREATERP</strong> <em>(char &rest more-chars)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if the codes of CHARs are in strictly decreasing order; NIL
|
||||||
|
otherwise. For a lower-case character, the code of its upper-case equivalent
|
||||||
|
is used.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-ALPHANUMERICP"></a>Function: <strong>ALPHANUMERICP</strong> <em>(char)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if CHAR is either numeric or alphabetic; NIL otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHAR_002dBITS"></a>Function: <strong>CHAR-BITS</strong> <em>(char)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the bits attribute (which is always 0 in GCL) of CHAR.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-DIGIT_002dCHAR"></a>Function: <strong>DIGIT-CHAR</strong> <em>(digit &optional (radix 10) (font 0))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns a character object that represents the DIGIT in the specified RADIX.
|
||||||
|
Returns NIL if no such character exists.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-SET_002dCHAR_002dBIT"></a>Function: <strong>SET-CHAR-BIT</strong> <em>(char name newvalue)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns a character just like CHAR except that the named bit is set or
|
||||||
|
cleared, according to whether NEWVALUE is non-NIL or NIL. This function
|
||||||
|
is useless in GCL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Lists.html#Lists" accesskey="n" rel="next">Lists</a>, Previous: <a href="Sequences-and-Arrays-and-Hash-Tables.html#Sequences-and-Arrays-and-Hash-Tables" accesskey="p" rel="prev">Sequences and Arrays and Hash Tables</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,212 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL SI Manual: Command Line</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL SI Manual: Command Line">
|
||||||
|
<meta name="keywords" content="GCL SI Manual: Command Line">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
|
||||||
|
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="Operating-System.html#Operating-System" rel="up" title="Operating System">
|
||||||
|
<link href="Operating-System-Definitions.html#Operating-System-Definitions" rel="next" title="Operating System Definitions">
|
||||||
|
<link href="Operating-System.html#Operating-System" rel="prev" title="Operating System">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Command-Line"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Operating-System-Definitions.html#Operating-System-Definitions" accesskey="n" rel="next">Operating System Definitions</a>, Previous: <a href="Operating-System.html#Operating-System" accesskey="p" rel="prev">Operating System</a>, Up: <a href="Operating-System.html#Operating-System" accesskey="u" rel="up">Operating System</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Command-Line-1"></a>
|
||||||
|
<h3 class="section">9.1 Command Line</h3>
|
||||||
|
|
||||||
|
<p>The variable si::*command-args* is set to the list of strings passed
|
||||||
|
in when gcl is invoked.
|
||||||
|
</p>
|
||||||
|
<p>Various flags are understood.
|
||||||
|
</p><dl compact="compact">
|
||||||
|
<dt><code>-eval</code>
|
||||||
|
<a name="index-_002deval"></a>
|
||||||
|
</dt>
|
||||||
|
<dd><p>Call read and then eval on the command argument following <code>-eval</code>
|
||||||
|
</p></dd>
|
||||||
|
<dt><code>-load</code>
|
||||||
|
<a name="index-_002dload"></a>
|
||||||
|
</dt>
|
||||||
|
<dd><p>Load the file whose pathname is specified after <code>-load</code>.
|
||||||
|
</p></dd>
|
||||||
|
<dt><code>-f</code>
|
||||||
|
<a name="index-_002df"></a>
|
||||||
|
</dt>
|
||||||
|
<dd><p>Replace si::*command-args* by the the list starting after <code>-f</code>.
|
||||||
|
Open the file following <code>-f</code> for input, skip the first line, and then
|
||||||
|
read and eval the rest of the forms in the file. This can be used
|
||||||
|
as with the shells to write small shell programs:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">#!/usr/local/bin/gcl.exe -f
|
||||||
|
(format t "hello world ~a~%" (nth 1 si::*command-args*))
|
||||||
|
</pre></div>
|
||||||
|
<p>The value si::*command-args* will have the appropriate value.
|
||||||
|
Thus if the above 2 line file is made executable and called <samp>foo</samp>
|
||||||
|
then
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">tutorial% foo billy
|
||||||
|
hello world billy
|
||||||
|
</pre></div>
|
||||||
|
<p>NOTE: On many systems (eg SunOs) the first line of an executable script file
|
||||||
|
such as:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">#!/usr/local/bin/gcl.exe -f
|
||||||
|
</pre></div>
|
||||||
|
<p>only reads the first 32 characters! So if your pathname where the executable
|
||||||
|
together with the ’-f’ amount to more than 32 characters the file will not
|
||||||
|
be recognized. Also the executable must be the actual large binary file,
|
||||||
|
[or a link to it],
|
||||||
|
and not just a <code>/bin/sh</code> script. In latter case the
|
||||||
|
<code>/bin/sh</code> interpreter would get invoked on the file.
|
||||||
|
</p>
|
||||||
|
<p>Alternately one could invoke the file <samp>foo</samp> without making it
|
||||||
|
executable:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">tutorial% gcl -f foo "from bill"
|
||||||
|
hello world from bill
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Finally perhaps the best way (why do we save the best for last..
|
||||||
|
I guess because we only figure it out after all the others..)
|
||||||
|
The following file <samp>myhello</samp> has 4 lines:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">#!/bin/sh
|
||||||
|
#| Lisp will skip the next 2 lines on reading
|
||||||
|
exec gcl -f "$0" $ |#
|
||||||
|
(format t "hello world ~a~%" (nth 1 si::*command-args*))
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">marie% chmod a+x myhello
|
||||||
|
marie% myhello bill
|
||||||
|
hello world bill
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>The advantage of this method is that <samp>gcl</samp> can itself
|
||||||
|
be a shell script, which sets up environment and
|
||||||
|
so on. Also the normal path will be searched to find <samp>gcl</samp>
|
||||||
|
The disadvantage is that this would cause 2 invocations of <samp>sh</samp>
|
||||||
|
and one invocation of <samp>gcl</samp>. The plan using <samp>gcl.exe</samp>
|
||||||
|
bypasses the <samp>sh</samp> entirely. Inded invoking <samp>gcl.exe</samp> to
|
||||||
|
print <samp>hello world</samp> is faster on most systems than a similar
|
||||||
|
<samp>csh</samp> or <samp>bash</samp> script, but slightly slower than the old
|
||||||
|
<samp>sh</samp>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd>
|
||||||
|
<dt><code>-batch</code>
|
||||||
|
<a name="index-_002dbatch"></a>
|
||||||
|
</dt>
|
||||||
|
<dd><p>Do not enter the command print loop. Useful if the other command line
|
||||||
|
arguments do something. Do not print the License and acknowledgement
|
||||||
|
information. Note if your program does print any License information,
|
||||||
|
it must print the GCL header information also.
|
||||||
|
</p></dd>
|
||||||
|
<dt><code>-dir</code>
|
||||||
|
<a name="index-_002ddir"></a>
|
||||||
|
</dt>
|
||||||
|
<dd><p>Directory where the executable binary that is running is located.
|
||||||
|
Needed by save and friends. This gets set as si::*system-directory*
|
||||||
|
</p></dd>
|
||||||
|
<dt><code>-libdir</code>
|
||||||
|
<a name="index-_002dlibdir"></a>
|
||||||
|
</dt>
|
||||||
|
<dd><div class="example">
|
||||||
|
<pre class="example"> -libdir <samp>/d/wfs/gcl-2.0/</samp>
|
||||||
|
</pre></div>
|
||||||
|
<p>would mean that the files like gcl-tk/tk.o would be found by
|
||||||
|
concatting the path to the libdir path, ie in
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example"><samp>/d/wfs/gcl-2.0/gcl-tk/tk.o</samp>
|
||||||
|
</pre></div>
|
||||||
|
</dd>
|
||||||
|
<dt><code>-compile</code>
|
||||||
|
<a name="index-_002dcompile"></a>
|
||||||
|
</dt>
|
||||||
|
<dd><p>Invoke the compiler on the filename following <code>-compile</code>.
|
||||||
|
Other flags affect compilation.
|
||||||
|
</p></dd>
|
||||||
|
<dt><code>-o-file</code>
|
||||||
|
<a name="index-_002do_002dfile"></a>
|
||||||
|
</dt>
|
||||||
|
<dd><p>If nil follows <code>-o-file</code> then do not produce an <code>.o</code> file.
|
||||||
|
</p></dd>
|
||||||
|
<dt><code>-c-file</code>
|
||||||
|
<a name="index-_002dc_002dfile"></a>
|
||||||
|
</dt>
|
||||||
|
<dd><p>If <code>-c-file</code> is specified, leave the intermediate <code>.c</code> file there.
|
||||||
|
</p></dd>
|
||||||
|
<dt><code>-h-file</code>
|
||||||
|
<a name="index-_002dh_002dfile"></a>
|
||||||
|
</dt>
|
||||||
|
<dd><p>If <code>-h-file</code> is specified, leave the intermediate <code>.h</code> file there.
|
||||||
|
</p></dd>
|
||||||
|
<dt><code>-data-file</code>
|
||||||
|
<a name="index-_002ddata_002dfile"></a>
|
||||||
|
</dt>
|
||||||
|
<dd><p>If <code>-data-file</code> is specified, leave the intermediate <code>.data</code> file there.
|
||||||
|
</p></dd>
|
||||||
|
<dt><code>-system-p</code>
|
||||||
|
<a name="index-_002dsystem_002dp"></a>
|
||||||
|
</dt>
|
||||||
|
<dd><p>If <code>-system-p</code> is specified then invoke <code>compile-file</code> with the
|
||||||
|
<code>:system-p t</code> keyword argument, meaning that the C init function
|
||||||
|
will bear a name based on the name of the file, so that it may be invoked
|
||||||
|
by name by C code.
|
||||||
|
</p></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Operating-System-Definitions.html#Operating-System-Definitions" accesskey="n" rel="next">Operating System Definitions</a>, Previous: <a href="Operating-System.html#Operating-System" accesskey="p" rel="prev">Operating System</a>, Up: <a href="Operating-System.html#Operating-System" accesskey="u" rel="up">Operating System</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,400 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL SI Manual: Compilation</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL SI Manual: Compilation">
|
||||||
|
<meta name="keywords" content="GCL SI Manual: Compilation">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
|
||||||
|
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="index.html#Top" rel="up" title="Top">
|
||||||
|
<link href="Symbols.html#Symbols" rel="next" title="Symbols">
|
||||||
|
<link href="Special-Forms-and-Functions.html#Special-Forms-and-Functions" rel="prev" title="Special Forms and Functions">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Compilation"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Symbols.html#Symbols" accesskey="n" rel="next">Symbols</a>, Previous: <a href="Special-Forms-and-Functions.html#Special-Forms-and-Functions" accesskey="p" rel="prev">Special Forms and Functions</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Compilation-1"></a>
|
||||||
|
<h2 class="chapter">7 Compilation</h2>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-COMPILE"></a>Function: <strong>COMPILE</strong> <em>(name &optional (definition nil))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>If DEFINITION is NIL, NAME must be the name of a not-yet-compiled
|
||||||
|
function. In this case, COMPILE compiles the function, installs the compiled
|
||||||
|
function as the global function definition of NAME, and returns NAME.
|
||||||
|
If DEFINITION is non-NIL, it must be a lambda expression and NAME must be
|
||||||
|
a symbol. COMPILE compiles the lambda expression, installs the compiled
|
||||||
|
function as the function definition of NAME, and returns NAME.
|
||||||
|
There is only one exception for this: If NAME is NIL, then the compiled
|
||||||
|
function is not installed but is simply returned as the value of COMPILE.
|
||||||
|
In any case, COMPILE creates temporary files whose filenames are
|
||||||
|
"gazonk***". By default, i.e. if :LEAVE-GAZONK is not supplied or is
|
||||||
|
NIL, these files are automatically deleted after compilation.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-LINK"></a>Function: <strong>LINK</strong> <em>(files image &optional post extra-libs (run-user-init t) &aux raw init) </em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>On systems where dlopen is used for relocations, one cannot make custom
|
||||||
|
images containing loaded binary object files simply by loading the files
|
||||||
|
and executing save-system. This function is provided for such cases.
|
||||||
|
</p>
|
||||||
|
<p>After compiling source files into objects, LINK can be called with a
|
||||||
|
list of binary and source FILES which would otherwise normally be
|
||||||
|
loaded in sequence before saving the image to IMAGE. LINK will use
|
||||||
|
the system C linker to link the binary files thus supplied with GCL’s
|
||||||
|
objects, using EXTRA-LIBS as well if provided, and producing a
|
||||||
|
raw_IMAGE executable. This executable is then run to initialize first
|
||||||
|
GCL’s objects, followed by the supplied files, in order, if
|
||||||
|
RUN-USER-INIT is set. In such a case, source files are loaded at
|
||||||
|
their position in the sequence. Any optional code which should be run
|
||||||
|
after file initialization can be supplied in the POST variable. The
|
||||||
|
image is then saved using save-system to IMAGE.
|
||||||
|
</p>
|
||||||
|
<p>This method of creating lisp images may also have the advantage that
|
||||||
|
all new object files are kept out of the lisp core and placed instead
|
||||||
|
in the final image’s .text section. This should in principle reduce
|
||||||
|
the core size, speed up garbage collection, and forego any performance
|
||||||
|
penalty induced by data cache flushing on some machines.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>In both the RAW and SAVED image, any calls to LOAD binary object files
|
||||||
|
which have been specified in this list will bypass the normal load
|
||||||
|
procedure, and simply initialize the already linked in module. One
|
||||||
|
can rely on this feature by disabling RUN-USER-INIT, and instead
|
||||||
|
passing the normal build commands in POST. In the course of executing
|
||||||
|
this code, binary modules previously linked into the .text section of
|
||||||
|
the executable will be initialized at the same point at which they
|
||||||
|
would have normally been loaded into the lisp core, in the
|
||||||
|
executable’s .data section. In this way, the user can choose to take
|
||||||
|
advantage of the aforementioned possible benefits of this linking
|
||||||
|
method in a relatively transparent way.
|
||||||
|
</p>
|
||||||
|
<p>All binary objects specified in FILES must have been compiled with
|
||||||
|
:SYSTEM-P set to T.
|
||||||
|
</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-EVAL_002dWHEN"></a>Special Form: <strong>EVAL-WHEN</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Syntax:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(eval-when ({situation}*) {form}*)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>A situation must be either COMPILE, LOAD, or EVAL. The interpreter evaluates
|
||||||
|
only when EVAL is specified. If COMPILE is specified, FORMs are evaluated
|
||||||
|
at compile time. If LOAD is specified, the compiler arranges so that FORMs
|
||||||
|
be evaluated when the compiled code is loaded.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-COMPILE_002dFILE"></a>Function: <strong>COMPILE-FILE</strong> <em>(input-pathname &key output-file (load nil) (message-file nil) ;GCL specific keywords: system-p c-debug c-file h-file data-file)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>Compiles the file specified by INPUT-PATHNAME and generates a fasl file
|
||||||
|
specified by OUTPUT-FILE. If the filetype is not specified in INPUT-PATHNAME,
|
||||||
|
then ".lsp" is used as the default file type for the source file. :LOAD
|
||||||
|
specifies whether to load the generated fasl file after compilation.
|
||||||
|
:MESSAGE-FILE specifies the log file for the compiler messages. It defaults to
|
||||||
|
the value of the variable COMPILER:*DEFAULT-MESSAGE-FILE*. A non-NIL value of
|
||||||
|
COMPILER::*COMPILE-PRINT* forces the compiler to indicate the form currently
|
||||||
|
being compiled. More keyword parameters are accepted, depending on the
|
||||||
|
version. Most versions of GCL can receive :O-FILE, :C-FILE, :H-FILE, and
|
||||||
|
:DATA-FILE keyword parameters, with which you can control the intermediate
|
||||||
|
files generated by the GCL compiler. Also :C-DEBUG will pass the -g flag to
|
||||||
|
the C compiler.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>By top level forms in a file, we mean the value of *top-level-forms* after
|
||||||
|
doing (TF form) for each form read from a file. We define TF as follows:
|
||||||
|
</p>
|
||||||
|
<p>(defun TF (x)
|
||||||
|
(when (consp x)
|
||||||
|
(setq x (macroexpand x))
|
||||||
|
(when (consp x)
|
||||||
|
(cond ((member (car x) ’(progn eval-when))
|
||||||
|
(mapcar ’tf (cdr x)))
|
||||||
|
(t (push x *top-level-forms*))))))
|
||||||
|
</p>
|
||||||
|
<p>Among the common lisp special forms only DEFUN and DEFMACRO will cause actual
|
||||||
|
native machine code to be generated. The rest will be specially treated in an
|
||||||
|
init section of the .data file. This is done so that things like putprop,setq,
|
||||||
|
and many other forms would use up space which could not be usefully freed, if
|
||||||
|
we were to compile to native machine code. If you have other ‘ordinary’ top
|
||||||
|
level forms which you need to have compiled fully to machine code you may
|
||||||
|
either set compiler::*COMPILE-ORDINARIES* to t, or put them inside a
|
||||||
|
</p>
|
||||||
|
<p>(PROGN ’COMPILE ...forms-which-need-to-be-compiled)
|
||||||
|
</p>
|
||||||
|
<p>The compiler will take each of them and make a temporary function which will be
|
||||||
|
compiled and invoked once. It is permissible to wrap a (PROGN ’COMPILE ..)
|
||||||
|
around the whole file. Currently this construction binds the
|
||||||
|
compiler::*COMPILE-ORDINARIES* flag to t. Setting this flag globally to a non
|
||||||
|
nil value to cause all top level forms to generate machine code. This might be
|
||||||
|
useful in a system such as PCL, where a number of top level lambda expressions
|
||||||
|
are given. Note that most common lisps will simply ignore the top level atom
|
||||||
|
’compile, since it has no side effects.
|
||||||
|
</p>
|
||||||
|
<p>Defentry, clines, and defcfun also result in machine code being generated.
|
||||||
|
</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<a name="subsection-Evaluation-at-Compile-time"></a>
|
||||||
|
<h2 class="unnumbered">subsection Evaluation at Compile time</h2>
|
||||||
|
|
||||||
|
<p>In GCL the eval-when behaviour was changed in order to allow
|
||||||
|
more efficient init code, and also to bring it into line with the resolution
|
||||||
|
passed by the X3j13 committee. Evaluation at compile time is controlled by
|
||||||
|
placing eval-when special forms in the code, or by the value of the variable
|
||||||
|
compiler::*eval-when-defaults* [default value :defaults]. If that variable
|
||||||
|
has value :defaults, then the following hold:
|
||||||
|
</p>
|
||||||
|
<p>Eval at Compile Type of Top Level Form<!-- /@w --><br>
|
||||||
|
</p>
|
||||||
|
<dl compact="compact">
|
||||||
|
<dt>Partial:</dt>
|
||||||
|
<dd><p>defstructs, defvar, defparameter
|
||||||
|
</p></dd>
|
||||||
|
<dt>Full:</dt>
|
||||||
|
<dd><p>defmacro, defconstant, defsetf, define-setf-method,
|
||||||
|
deftype, package ops, proclaim
|
||||||
|
</p></dd>
|
||||||
|
<dt>None:</dt>
|
||||||
|
<dd><p>defun, others
|
||||||
|
</p></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
<p>By ‘partial’ we mean (see the X3J13 Common Lisp document
|
||||||
|
(doc/compile-file-handling-of-top-level-forms) for more detail), that functions
|
||||||
|
will not be defined, values will not be set, but other miscellaneous compiler
|
||||||
|
properties will be set: eg properties to inline expand defstruct accessors and
|
||||||
|
testers, defstruct properties allowing subsequent defstructs to include this
|
||||||
|
one, any type hierarch information, special variable information will be set up.
|
||||||
|
</p>
|
||||||
|
<p>Example:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(defun foo () 3)
|
||||||
|
(defstruct jo a b)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>As a side effect of compiling these two forms, foo would not have its function
|
||||||
|
cell changed. Neither would jo-a, although it would gain a property which
|
||||||
|
allows it to expand inline to a structure access. Thus if it had a previous
|
||||||
|
definition (as commonly happens from previously loading the file), this previous
|
||||||
|
definition would not be touched, and could well be inconsistent with the
|
||||||
|
compiler properties. Unfortunately this is what the CL standard says to do,
|
||||||
|
and I am just trying to follow it.
|
||||||
|
</p>
|
||||||
|
<p>If you prefer a more intuitive scheme, of evaling all forms in the file, so
|
||||||
|
that there are no inconsistencies, (previous behaviour of AKCL) you may set
|
||||||
|
compiler::*eval-when-defaults* to ’(compile eval load).
|
||||||
|
</p>
|
||||||
|
<p>The variable compiler::*FASD-DATA* [default t] controls whether an ascii output
|
||||||
|
is used for the data section of the object file. The data section will be in
|
||||||
|
ascii if *fasd-data* is nil or if the system-p keyword is supplied to
|
||||||
|
compile-file and *fasd-data* is not eq to :system-p.
|
||||||
|
</p>
|
||||||
|
<p>The old GCL variable *compile-time-too* has disappeared.
|
||||||
|
</p>
|
||||||
|
<p>See OPTIMIZE on how to enable warnings of slow constructs.
|
||||||
|
</p>
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-PROCLAIM"></a>Function: <strong>PROCLAIM</strong> <em>(decl-spec)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Puts the declaration given by DECL-SPEC into effect globally. See the doc of
|
||||||
|
DECLARE for possible DECL-SPECs.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-PROVIDE"></a>Function: <strong>PROVIDE</strong> <em>(module-name)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Adds the specified module to the list of modules maintained in *MODULES*.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-COMPILED_002dFUNCTION_002dP"></a>Function: <strong>COMPILED-FUNCTION-P</strong> <em>(x)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if X is a compiled function; NIL otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-GPROF_002dSTART"></a>Function: <strong>GPROF-START</strong> <em>()</em></dt>
|
||||||
|
<dd><p>Package:SYSTEM
|
||||||
|
</p>
|
||||||
|
<p>GCL now has preliminary support for profiling with gprof, an
|
||||||
|
externally supplied profiling tool at the C level which typically
|
||||||
|
accompanies gcc. Support must be enabled at compile time with
|
||||||
|
–enable-gprof. This function starts the profiling timers and
|
||||||
|
counters.
|
||||||
|
</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-GPROF_002dQUIT"></a>Function: <strong>GPROF-QUIT</strong> <em>()</em></dt>
|
||||||
|
<dd><p>Package:SYSTEM
|
||||||
|
</p>
|
||||||
|
<p>GCL now has preliminary support for profiling with gprof, an
|
||||||
|
externally supplied profiling tool at the C level which typically
|
||||||
|
accompanies gcc. Support must be enabled at compile time with
|
||||||
|
–enable-gprof. This function reports the profiling results in the
|
||||||
|
form of a call graph to standard output, and clears the profiling
|
||||||
|
arrays. Please note that lisp functions are not (yet) displayed with
|
||||||
|
their lisp names. Please see also the PROFILE function.
|
||||||
|
</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-GPROF_002dSET"></a>Function: <strong>GPROF-SET</strong> <em>(begin end)</em></dt>
|
||||||
|
<dd><p>Package:SYSTEM
|
||||||
|
</p>
|
||||||
|
<p>GCL now has preliminary support for profiling with gprof, an
|
||||||
|
externally supplied profiling tool at the C level which typically
|
||||||
|
accompanies gcc. Support must be enabled at compile time with
|
||||||
|
–enable-gprof. This function sets the address range used by
|
||||||
|
GPROF-START in specifying the section of the running program which is
|
||||||
|
to be profiled. All subsequent calls to GPROF-START will use this new
|
||||||
|
address range. By default, the range is set to begin at the starting
|
||||||
|
address of the .text section, and to end at the current end of the
|
||||||
|
running core. These default values can be restored by calling
|
||||||
|
GPROF-SET with both argments set to 0.
|
||||||
|
</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002aDEFAULT_002dSYSTEM_002dP_002a"></a>Variable: <strong>*DEFAULT-SYSTEM-P*</strong></dt>
|
||||||
|
<dd><p>Pakcage:COMPILER
|
||||||
|
Specifies the default setting of :SYSTEM-P used by COMPILE. Defaults to NIL.
|
||||||
|
</p></dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002aDEFAULT_002dC_002dFILE_002a"></a>Variable: <strong>*DEFAULT-C-FILE*</strong></dt>
|
||||||
|
<dd><p>Pakcage:COMPILER
|
||||||
|
Specifies the default setting of :C-FILE used by COMPILE. Defaults to NIL.
|
||||||
|
</p></dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002aDEFAULT_002dH_002dFILE_002a"></a>Variable: <strong>*DEFAULT-H-FILE*</strong></dt>
|
||||||
|
<dd><p>Pakcage:COMPILER
|
||||||
|
Specifies the default setting of :H-FILE used by COMPILE. Defaults to NIL.
|
||||||
|
</p></dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002aDEFAULT_002dDATA_002dFILE_002a"></a>Variable: <strong>*DEFAULT-DATA-FILE*</strong></dt>
|
||||||
|
<dd><p>Pakcage:COMPILER
|
||||||
|
Specifies the default setting of :DATA-FILE used by COMPILE. Defaults to NIL.
|
||||||
|
</p></dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002aFEATURES_002a"></a>Variable: <strong>*FEATURES*</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
List of symbols that name features of the current version of GCL.
|
||||||
|
These features are used to decide the read-time conditionalization facility
|
||||||
|
provided by ’#+’ and ’#-’ read macros. When the GCL reader encounters
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example"> #+ feature-description form
|
||||||
|
</pre></div>
|
||||||
|
<p>it reads FORM in the usual manner if FEATURE-DESCRIPTION is true. Otherwise,
|
||||||
|
the reader just skips FORM.
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example"> #- feature-description form
|
||||||
|
</pre></div>
|
||||||
|
<p>is equivalent to
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example"> #- (not feature-description) form
|
||||||
|
</pre></div>
|
||||||
|
<p>A feature-description may be a symbol, which is true only when it is an
|
||||||
|
element of *FEATURES*. Or else, it must be one of the following:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(and feature-desciption-1 ... feature-desciption-n)
|
||||||
|
(or feature-desciption-1 ... feature-desciption-n)
|
||||||
|
(not feature-desciption)
|
||||||
|
</pre></div>
|
||||||
|
<p>The AND description is true only when all of its sub-descriptions are true.
|
||||||
|
The OR description is true only when at least one of its sub-descriptions is
|
||||||
|
true. The NOT description is true only when its sub-description is false.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Symbols.html#Symbols" accesskey="n" rel="next">Symbols</a>, Previous: <a href="Special-Forms-and-Functions.html#Special-Forms-and-Functions" accesskey="p" rel="prev">Special Forms and Functions</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,236 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL SI Manual: Compiler Definitions</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL SI Manual: Compiler Definitions">
|
||||||
|
<meta name="keywords" content="GCL SI Manual: Compiler Definitions">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
|
||||||
|
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="index.html#Top" rel="up" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="next" title="Function and Variable Index">
|
||||||
|
<link href="Low-Level-X-Interface.html#Low-Level-X-Interface" rel="prev" title="Low Level X Interface">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Compiler-Definitions"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Function-and-Variable-Index.html#Function-and-Variable-Index" accesskey="n" rel="next">Function and Variable Index</a>, Previous: <a href="Miscellaneous.html#Miscellaneous" accesskey="p" rel="prev">Miscellaneous</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Compiler-Definitions-1"></a>
|
||||||
|
<h2 class="chapter">20 Compiler Definitions</h2>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-EMIT_002dFN"></a>Function: <strong>EMIT-FN</strong> <em>(turn-on)</em></dt>
|
||||||
|
<dd><p>Package:COMPILER
|
||||||
|
</p>
|
||||||
|
<p>If TURN-ON is t, the subsequent calls to COMPILE-FILE will
|
||||||
|
cause compilation of foo.lisp to emit a foo.fn as well as foo.o.
|
||||||
|
The .fn file contains cross referencing information as well as
|
||||||
|
information useful to the collection utilities in cmpnew/collectfn
|
||||||
|
This latter file must be manually loaded to call emit-fn.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002aCMPINCLUDE_002dSTRING_002a"></a>Variable: <strong>*CMPINCLUDE-STRING*</strong></dt>
|
||||||
|
<dd><p>Package:COMPILER
|
||||||
|
If it is a string it holds the text of the cmpinclude.h file appropriate for
|
||||||
|
this version. Otherwise the usual #include of *cmpinclude* will be used. To
|
||||||
|
disable this feature set *cmpinclude-string* to NIL in the init-form.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-EMIT_002dFN-1"></a>Function: <strong>EMIT-FN</strong> <em>(turn-on)</em></dt>
|
||||||
|
<dd><p>Package:COMPILER
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>If TURN-ON is t, then subsequent calls to compile-file on a file foo.lisp
|
||||||
|
cause output of a file foo.fn. This .fn file contains lisp structures
|
||||||
|
describing the functions in foo.lisp. Some tools for analyzing this data base
|
||||||
|
are WHO-CALLS, LIST-UNDEFINED-FUNCTIONS, LIST-UNCALLED-FUNCTIONS, and
|
||||||
|
MAKE-PROCLAIMS.
|
||||||
|
</p>
|
||||||
|
<p>Usage:
|
||||||
|
(compiler::emit-fn t)
|
||||||
|
(compile-file "foo1.lisp")
|
||||||
|
(compile-file "foo2.lisp")
|
||||||
|
</p>
|
||||||
|
<p>This would create foo1.fn and foo2.fn. These may be loaded using LOAD. Each
|
||||||
|
time compile-file is called the data base is cleared. Immediately after the
|
||||||
|
compilation, the data base consists of data from the compilation. Thus if you
|
||||||
|
wished to find functions called but not defined in the current file, you could
|
||||||
|
do (list-undefined-functions), immediately following the compilation. If you
|
||||||
|
have a large system, you would load all the .fn files before using the above
|
||||||
|
tools.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-MAKE_002dALL_002dPROCLAIMS"></a>Function: <strong>MAKE-ALL-PROCLAIMS</strong> <em>(&rest directories)</em></dt>
|
||||||
|
<dd><p>Package:COMPILER
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>For each D in DIRECTORIES all files in (directory D) are loaded.
|
||||||
|
</p>
|
||||||
|
<p>For example
|
||||||
|
(make-all-proclaims "lsp/*.fn" "cmpnew/*.fn")
|
||||||
|
would load any files in lsp/*.fn and cmpnew/*.fn.
|
||||||
|
</p>
|
||||||
|
<p>[See EMIT-FN for details on creation of .fn files]
|
||||||
|
</p>
|
||||||
|
<p>Then calculations on the newly loaded .fn files are made, to determine
|
||||||
|
function proclamations. If number of values of a function cannot be
|
||||||
|
determined [for example because of a final funcall, or call of a function
|
||||||
|
totally unknown at this time] then return type * is assigned.
|
||||||
|
</p>
|
||||||
|
<p>Finally a file sys-proclaim.lisp is written out. This file contains function
|
||||||
|
proclamations.
|
||||||
|
</p>
|
||||||
|
<p>(load "sys-proclaim.lisp")
|
||||||
|
(compile-file "foo1.lisp")
|
||||||
|
(compile-file "foo2.lisp")
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-MAKE_002dPROCLAIMS"></a>Function: <strong>MAKE-PROCLAIMS</strong> <em>(&optional (stream *standard-output*))</em></dt>
|
||||||
|
<dd><p>Package:COMPILER
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>Write to STREAM the function proclaims from the current data base. Usually a
|
||||||
|
number of .fn files are loaded prior to running this. See EMIT-FN for details
|
||||||
|
on how to collect this. Simply use LOAD to load in .fn files.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-LIST_002dUNDEFINED_002dFUNCTIONS"></a>Function: <strong>LIST-UNDEFINED-FUNCTIONS</strong> <em>()</em></dt>
|
||||||
|
<dd><p>Package:COMPILER
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>Return a list of all functions called but not defined, in the current data
|
||||||
|
base (see EMIT-FN).
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">Sample:
|
||||||
|
(compiler::emit-fn t)
|
||||||
|
(compile-file "foo1.lisp")
|
||||||
|
(compiler::list-undefined-functions)
|
||||||
|
or
|
||||||
|
(mapcar 'load (directory "*.fn")) (compiler::list-undefined-functions)
|
||||||
|
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-WHO_002dCALLS"></a>Function: <strong>WHO-CALLS</strong> <em>(function-name)</em></dt>
|
||||||
|
<dd><p>Package:COMPILER
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>List all functions in the data base [see emit-fn] which call FUNCTION-NAME.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-LIST_002dUNCALLED_002dFUNCTIONS"></a>Function: <strong>LIST-UNCALLED-FUNCTIONS</strong> <em>()</em></dt>
|
||||||
|
<dd><p>Package:COMPILER
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>Examine the current data base [see emit-fn] for any functions or macros which
|
||||||
|
are called but are not: fboundp, OR defined in the data base, OR having
|
||||||
|
special compiler optimizer properties which would eliminate an actual call.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002aCC_002a"></a>Variable: <strong>*CC*</strong></dt>
|
||||||
|
<dd><p>Package:COMPILER
|
||||||
|
Has value a string which controls which C compiler is used by GCL.
|
||||||
|
Usually this string is obtained from the machine.defs file, but
|
||||||
|
may be reset by the user, to change compilers or add an include path.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002aSPLIT_002dFILES_002a"></a>Variable: <strong>*SPLIT-FILES*</strong></dt>
|
||||||
|
<dd><p>Package:COMPILER
|
||||||
|
This affects the behaviour of compile-file, and is useful for cases where
|
||||||
|
the C compiler cannot handle large C files resulting from lisp compilation.
|
||||||
|
This scheme should allow arbitrarily long lisp files to be compiled.
|
||||||
|
</p>
|
||||||
|
<p>If the value [default NIL] is a positive integer, then the source file will
|
||||||
|
be compiled into several object files whose names have 0,1,2,.. prepended,
|
||||||
|
and which will be loaded by the main object file. File 0 will
|
||||||
|
contain compilation of top level forms thru position *split-files* in the
|
||||||
|
lisp source file, and file 1 the next forms, etc. Thus a 180k file
|
||||||
|
would probably result in three object files (plus the master object file
|
||||||
|
of the same name) if *split-files* was set to 60000.
|
||||||
|
The package information will be inserted in each file.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002aCOMPILE_002dORDINARIES_002a"></a>Variable: <strong>*COMPILE-ORDINARIES*</strong></dt>
|
||||||
|
<dd><p>Package:COMPILER
|
||||||
|
If this has a non nil value [default = nil], then all top level
|
||||||
|
forms will be compiled into machine instructions. Otherwise
|
||||||
|
only defun’s, defmacro’s, and top level forms beginning
|
||||||
|
with (progn ’compile ...) will do so.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Function-and-Variable-Index.html#Function-and-Variable-Index" accesskey="n" rel="next">Function and Variable Index</a>, Previous: <a href="Miscellaneous.html#Miscellaneous" accesskey="p" rel="prev">Miscellaneous</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,74 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL SI Manual: Debugging</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL SI Manual: Debugging">
|
||||||
|
<meta name="keywords" content="GCL SI Manual: Debugging">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
|
||||||
|
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="index.html#Top" rel="up" title="Top">
|
||||||
|
<link href="Source-Level-Debugging-in-Emacs.html#Source-Level-Debugging-in-Emacs" rel="next" title="Source Level Debugging in Emacs">
|
||||||
|
<link href="Regular-Expressions.html#Regular-Expressions" rel="prev" title="Regular Expressions">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Debugging"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Miscellaneous.html#Miscellaneous" accesskey="n" rel="next">Miscellaneous</a>, Previous: <a href="System-Definitions.html#System-Definitions" accesskey="p" rel="prev">System Definitions</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Debugging-1"></a>
|
||||||
|
<h2 class="chapter">18 Debugging</h2>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<table class="menu" border="0" cellspacing="0">
|
||||||
|
<tr><td align="left" valign="top">• <a href="Source-Level-Debugging-in-Emacs.html#Source-Level-Debugging-in-Emacs" accesskey="1">Source Level Debugging in Emacs</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Low-Level-Debug-Functions.html#Low-Level-Debug-Functions" accesskey="2">Low Level Debug Functions</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,170 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL SI Manual: Doc</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL SI Manual: Doc">
|
||||||
|
<meta name="keywords" content="GCL SI Manual: Doc">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
|
||||||
|
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="index.html#Top" rel="up" title="Top">
|
||||||
|
<link href="Type.html#Type" rel="next" title="Type">
|
||||||
|
<link href="User-Interface.html#User-Interface" rel="prev" title="User Interface">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Doc"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Type.html#Type" accesskey="n" rel="next">Type</a>, Previous: <a href="User-Interface.html#User-Interface" accesskey="p" rel="prev">User Interface</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Doc-1"></a>
|
||||||
|
<h2 class="chapter">13 Doc</h2>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-APROPOS"></a>Function: <strong>APROPOS</strong> <em>(string &optional (package nil))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Prints those symbols whose print-names contain STRING as substring.
|
||||||
|
If PACKAGE is non-NIL, then only the specified package is searched.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-INFO"></a>Function: <strong>INFO</strong> <em>(string &optional (list-of-info-files *default-info-files*))</em></dt>
|
||||||
|
<dd><p>PACKAGE:SI
|
||||||
|
</p>
|
||||||
|
<p>Find all documentation about STRING in LIST-OF-INFO-FILES. The search
|
||||||
|
is done for STRING as a substring of a node name, or for STRING in the
|
||||||
|
indexed entries in the first index for each info file. Typically that
|
||||||
|
should be a variable and function definition index, if the info file is
|
||||||
|
about a programming language. If the windowing system is connected,
|
||||||
|
then a choice box is offered and double clicking on an item brings up
|
||||||
|
its documentation.
|
||||||
|
</p>
|
||||||
|
<p>Otherwise a list of choices is offered and the user may select some of
|
||||||
|
these choices.
|
||||||
|
</p>
|
||||||
|
<p>list-of-info-files is of the form
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example"> ("gcl-si.info" "gcl-tk.info" "gcl.info")
|
||||||
|
</pre></div>
|
||||||
|
<p>The above list is the default value of *default-info-files*,
|
||||||
|
a variable in the SI package. To find these files in the file
|
||||||
|
system, the search path *info-paths* is consulted as is the master
|
||||||
|
info directory <samp>dir</samp>.
|
||||||
|
</p>
|
||||||
|
<p>see *Index *default-info-files*:: and *Index *info-paths*::.
|
||||||
|
For example
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(info "defun")
|
||||||
|
|
||||||
|
0: DEFUN :(gcl-si.info)Special Forms and Functions.
|
||||||
|
1: (gcl.info)defun.
|
||||||
|
Enter n, all, none, or multiple choices eg 1 3 : 1
|
||||||
|
|
||||||
|
Info from file /home/wfs/gcl-doc/gcl.info:
|
||||||
|
defun [Macro]
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
`Defun' function-name lambda-list [[{declaration}* | documentation]]
|
||||||
|
...
|
||||||
|
|
||||||
|
</pre></div>
|
||||||
|
<p>would list the node <code>(gcl.info)defun</code>.
|
||||||
|
That is the node entitled <code>defun</code> from the info file gcl.info. That
|
||||||
|
documentation is based on the ANSI common lisp standard. The choice
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">DEFUN :(gcl-si.info)Special Forms and Functions.
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>refers to the documentation on DEFUN from the info file gcl-si.info in
|
||||||
|
the node <i>Special Forms And Functions</i>. This is an index reference
|
||||||
|
and only the part of the node which refers to <code>defun</code> will be
|
||||||
|
printed.
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(info "factor" '("maxima.info"))
|
||||||
|
</pre></div>
|
||||||
|
<p>would search the maxima info files index and nodes for <code>factor</code>.
|
||||||
|
</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002ainfo_002dpaths_002a"></a>Variable: <strong>*info-paths*</strong></dt>
|
||||||
|
<dd><p>Package SI:
|
||||||
|
</p>
|
||||||
|
<p>A list of strings such as
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example"> '("" "/usr/info/" "/usr/local/lib/info/" "/usr/local/info/"
|
||||||
|
"/usr/local/gnu/info/" )
|
||||||
|
</pre></div>
|
||||||
|
<p>saying where to look for the info files. It is used implicitly
|
||||||
|
by <code>info</code>, see *Index info::.
|
||||||
|
</p>
|
||||||
|
<p>Looking for maxima.info would look for the file
|
||||||
|
maxima.info in all the directories listed in *info-paths*. If nto found
|
||||||
|
then it would look for <samp>dir</samp> in the *info-paths* directories,
|
||||||
|
and if it were found it would look in the <samp>dir</samp> for a menu item
|
||||||
|
such as
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">* maxima: (/home/wfs/maxima-5.0/info/maxima.info).
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>If such an entry exists then the directory there would be used for the
|
||||||
|
purpose of finding <code>maxima.info</code>
|
||||||
|
</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Type.html#Type" accesskey="n" rel="next">Type</a>, Previous: <a href="User-Interface.html#User-Interface" accesskey="p" rel="prev">User Interface</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,74 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL SI Manual: Environment</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL SI Manual: Environment">
|
||||||
|
<meta name="keywords" content="GCL SI Manual: Environment">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
|
||||||
|
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="Miscellaneous.html#Miscellaneous" rel="up" title="Miscellaneous">
|
||||||
|
<link href="Inititialization.html#Inititialization" rel="next" title="Inititialization">
|
||||||
|
<link href="Miscellaneous.html#Miscellaneous" rel="prev" title="Miscellaneous">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Environment"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Inititialization.html#Inititialization" accesskey="n" rel="next">Inititialization</a>, Previous: <a href="Miscellaneous.html#Miscellaneous" accesskey="p" rel="prev">Miscellaneous</a>, Up: <a href="Miscellaneous.html#Miscellaneous" accesskey="u" rel="up">Miscellaneous</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Environment-1"></a>
|
||||||
|
<h3 class="section">19.1 Environment</h3>
|
||||||
|
|
||||||
|
<p>The environment in GCL which is passed to macroexpand and
|
||||||
|
other functions requesting an environment, should be a
|
||||||
|
list of 3 lists. The first list looks like ((v1 val1) (v2 val2) ..)
|
||||||
|
where vi are variables and vali are their values.
|
||||||
|
The second is a list of ((fname1 . fbody1) (fname2 . fbody2) ...)
|
||||||
|
where fbody1 is either (macro lambda-list lambda-body) or
|
||||||
|
(lambda-list lambda-body) depending on whether this is a macro
|
||||||
|
or a function. The third list contains tags and blocks.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,385 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL SI Manual: GCL Specific</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL SI Manual: GCL Specific">
|
||||||
|
<meta name="keywords" content="GCL SI Manual: GCL Specific">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
|
||||||
|
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="index.html#Top" rel="up" title="Top">
|
||||||
|
<link href="Bignums.html#Bignums" rel="next" title="Bignums">
|
||||||
|
<link href="Type.html#Type" rel="prev" title="Type">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="GCL-Specific"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="C-Interface.html#C-Interface" accesskey="n" rel="next">C Interface</a>, Previous: <a href="Type.html#Type" accesskey="p" rel="prev">Type</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="GCL-Specific-1"></a>
|
||||||
|
<h2 class="chapter">15 GCL Specific</h2>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-SYSTEM"></a>Function: <strong>SYSTEM</strong> <em>(string)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>GCL specific: Executes a Shell command as if STRING is an input to the
|
||||||
|
Shell. Not all versions of GCL support this function. At least on
|
||||||
|
POSIX systems, this call should return two integers represeting the
|
||||||
|
exit status and any possible terminating signal respectively.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002aTMP_002dDIR_002a"></a>Variable: <strong>*TMP-DIR*</strong></dt>
|
||||||
|
<dd><p>Package:COMPILER
|
||||||
|
GCL specific: Directory in which temporary “gazonk” files used by the
|
||||||
|
compiler are to be created.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002aIGNORE_002dMAXIMUM_002dPAGES_002a"></a>Variable: <strong>*IGNORE-MAXIMUM-PAGES*</strong></dt>
|
||||||
|
<dd><p>Package:SI
|
||||||
|
GCL specific: Tells the GCL memory manager whether (non-NIL) or not (NIL) it
|
||||||
|
should expand memory whenever the maximum allocatable pages have been used
|
||||||
|
up.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002aOPTIMIZE_002dMAXIMUM_002dPAGES_002a"></a>Variable: <strong>*OPTIMIZE-MAXIMUM-PAGES*</strong></dt>
|
||||||
|
<dd><p>Package:SI
|
||||||
|
</p>
|
||||||
|
<p>GCL specific: Tells the GCL memory manager whether to attempt to
|
||||||
|
adjust the maximum allowable pages for each type to approximately
|
||||||
|
optimize the garbage collection load in the current process. Defaults
|
||||||
|
to T. Set to NIL if you care more about memory usage than runtime.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-MACHINE_002dVERSION"></a>Function: <strong>MACHINE-VERSION</strong> <em>()</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns a string that identifies the machine version of the machine
|
||||||
|
on which GCL is currently running.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-BY"></a>Function: <strong>BY</strong> <em>()</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>GCL specific: Exits from GCL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-DEFCFUN"></a>Macro: <strong>DEFCFUN</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Syntax:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(defcfun header n {element}*)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<p>GCL specific: Defines a C-language function which calls Lisp functions
|
||||||
|
and/or handles Lisp objects. HEADER gives the header of the C
|
||||||
|
function as a string. Non-negative-integer is the number of the main
|
||||||
|
stack entries used by the C function, primarily for protecting Lisp
|
||||||
|
objects from being garbage-collected. Each ELEMENT may give a C code
|
||||||
|
fragment as a string, or it may be a list
|
||||||
|
((symbol {arg}*) {place}*)
|
||||||
|
which, when executed, calls the Lisp function named by SYMBOL with the
|
||||||
|
specified arguments and saves the value(s) to the specified places.
|
||||||
|
The DEFCFUN form has the above meanings only after compiled; The GCL
|
||||||
|
interpreter simply ignores this form.
|
||||||
|
</p>
|
||||||
|
<p>An example which defines a C function list2 of two arguments, but which
|
||||||
|
calls the ’lisp’ function CONS by name, and refers to the constant ’NIL.
|
||||||
|
Note to be loaded by <code>load</code> the function should be static.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>(defCfun "static object list2(x,y) object x,y;" 0
|
||||||
|
"object z;"
|
||||||
|
(’NIL z)
|
||||||
|
((CONS y z) z)
|
||||||
|
((CONS x z) z)
|
||||||
|
"return(z);"
|
||||||
|
)
|
||||||
|
</p>
|
||||||
|
<p>In lisp the operations in the body would be
|
||||||
|
(setq z ’nil)
|
||||||
|
(setq z (cons y z))
|
||||||
|
(setq z (cons x z))
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p>Syntax:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">
|
||||||
|
(defCfun header non-negative-integer
|
||||||
|
{ string
|
||||||
|
| ( function-symbol { value }* )
|
||||||
|
| (( function-symbol { value }* ) { place }* ) })
|
||||||
|
|
||||||
|
|
||||||
|
value:
|
||||||
|
place:
|
||||||
|
{ C-expr | ( C-type C-expr ) }
|
||||||
|
|
||||||
|
C-function-name:
|
||||||
|
C-expr:
|
||||||
|
{ string | symbol }
|
||||||
|
|
||||||
|
C-type:
|
||||||
|
{ object | int | char | float | double }
|
||||||
|
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CLINES"></a>Macro: <strong>CLINES</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Syntax:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(clines {string}*)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>GCL specific: The GCL compiler embeds STRINGs into the intermediate C
|
||||||
|
language code. The interpreter ignores this form.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-ALLOCATE"></a>Function: <strong>ALLOCATE</strong> <em>(type number &optional (really-allocate nil))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>GCL specific: Sets the maximum number of pages for the type class of the
|
||||||
|
GCL implementation type TYPE to NUMBER. If REALLY-ALLOCATE is given a
|
||||||
|
non-NIL value, then the specified number of pages will be allocated
|
||||||
|
immediately.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-GBC"></a>Function: <strong>GBC</strong> <em>(x)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>GCL specific: Invokes the garbage collector (GC) with the collection level
|
||||||
|
specified by X. NIL as the argument causes GC to collect cells only. T as
|
||||||
|
the argument causes GC to collect everything.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-SAVE"></a>Function: <strong>SAVE</strong> <em>(pathname)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>GCL specific: Saves the current GCL core image into a program file specified
|
||||||
|
by PATHNAME. This function depends on the version of GCL. The function
|
||||||
|
si::save-system is to be preferred in almost all circumstances. Unlike
|
||||||
|
save, it makes the relocatable section permanent, and causes no future gc of
|
||||||
|
currently loaded .o files.
|
||||||
|
</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-HELP_002a"></a>Function: <strong>HELP*</strong> <em>(string &optional (package 'lisp))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>GCL specific: Prints the documentation associated with those symbols in the
|
||||||
|
specified package whose print names contain STRING as substring. STRING may
|
||||||
|
be a symbol, in which case the print-name of that symbol is used. If PACKAGE
|
||||||
|
is NIL, then all packages are searched.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-DEFLA"></a>Macro: <strong>DEFLA</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Syntax:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(defla name lambda-list {decl | doc}* {form}*)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>GCL specific: Used to DEFine Lisp Alternative. For the interpreter, DEFLA is
|
||||||
|
equivalent to DEFUN, but the compiler ignores this form.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-PROCLAMATION"></a>Function: <strong>PROCLAMATION</strong> <em>(decl-spec)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>GCL specific: Returns T if the specified declaration is globally in effect;
|
||||||
|
NIL otherwise. See the doc of DECLARE for possible DECL-SPECs.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-DEFENTRY"></a>Macro: <strong>DEFENTRY</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Syntax:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(defentry name arg-types c-function)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<p>GCL specific: The compiler defines a Lisp function whose body consists of a
|
||||||
|
calling sequence to the C language function specified by C-FUNCTION. The
|
||||||
|
interpreter ignores this form. The ARG-TYPES specifies the C types of the
|
||||||
|
arguments which C-FUNCTION requires. The list of allowed types is (object
|
||||||
|
char int float double string). Code will be produced to coerce from a lisp
|
||||||
|
object to the appropriate type before passing the argument to the C-FUNCTION.
|
||||||
|
The c-function should be of the form (c-result-type c-fname) where
|
||||||
|
c-result-type is a member of (void object char int float double string).
|
||||||
|
c-fname may be a symbol (in which case it will be downcased) or a string. If
|
||||||
|
c-function is not a list, then (object c-function) is assumed. In order
|
||||||
|
for C code to be loaded in by <code>load</code> you should declare any
|
||||||
|
variables and functions to be static. If you will link them in
|
||||||
|
at build time, of course you are allowed to define new externals.
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example"> Sample usage:
|
||||||
|
--File begin-----
|
||||||
|
;; JOE takes X a lisp string and Y a fixnum and returns a character.
|
||||||
|
(clines "#include \"foo.ch\"")
|
||||||
|
(defentry joe (string int) (char "our_c_fun"))
|
||||||
|
---File end------
|
||||||
|
---File foo.ch---
|
||||||
|
/* C function for extracting the i'th element of a string */
|
||||||
|
static char our_c_fun(p,i)
|
||||||
|
char *p;
|
||||||
|
int i;
|
||||||
|
{
|
||||||
|
return p[i];
|
||||||
|
}
|
||||||
|
-----File end---
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>One must be careful of storage allocation issues when passing a string.
|
||||||
|
If the C code invokes storage allocation (either by calling <code>malloc</code>
|
||||||
|
or <code>make_cons</code> etc), then there is a possibility of a garbage
|
||||||
|
collection, so that if the string passed was not constructed with
|
||||||
|
<code>:static t</code> when its array was constructed, then it could move.
|
||||||
|
If the C function may allocate storage, then you should pass a copy:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(defun safe-c-string (x)
|
||||||
|
(let* ((n (length x))
|
||||||
|
(a (make-array (+ n 1) :element-type 'string-char
|
||||||
|
:static t :fill-pointer n)))
|
||||||
|
(si::copy-array-portion x y 0 0 n)
|
||||||
|
(setf (aref a n) (code-char 0)))
|
||||||
|
a)
|
||||||
|
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-COPY_002dARRAY_002dPORTION"></a>Function: <strong>COPY-ARRAY-PORTION</strong> <em>(x,y,i1,i2,n1)</em></dt>
|
||||||
|
<dd><p>Package:SI
|
||||||
|
Copy elements from X to Y starting at X[i1] to Y[i2] and doing N1
|
||||||
|
elements if N1 is supplied otherwise, doing the length of X - I1
|
||||||
|
elements. If the types of the arrays are not the same, this has
|
||||||
|
implementation dependent results.
|
||||||
|
</p></dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-BYE"></a>Function: <strong>BYE</strong> <em>( &optional (exit-status 0))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>GCL specific: Exits from GCL with exit-status.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-USE_002dFAST_002dLINKS"></a>Function: <strong>USE-FAST-LINKS</strong> <em>(turn-on)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>GCL specific: If TURN-ON is not nil, the fast link mechanism is enabled,
|
||||||
|
so that ordinary function calls will not appear in the invocation stack,
|
||||||
|
and calls will be much faster. This is the default. If you anticipate
|
||||||
|
needing to see a stack trace in the debugger, then you should turn this
|
||||||
|
off.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<table class="menu" border="0" cellspacing="0">
|
||||||
|
<tr><td align="left" valign="top">• <a href="Bignums.html#Bignums" accesskey="1">Bignums</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="C-Interface.html#C-Interface" accesskey="n" rel="next">C Interface</a>, Previous: <a href="Type.html#Type" accesskey="p" rel="prev">Type</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,72 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL SI Manual: Inititialization</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL SI Manual: Inititialization">
|
||||||
|
<meta name="keywords" content="GCL SI Manual: Inititialization">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
|
||||||
|
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="Miscellaneous.html#Miscellaneous" rel="up" title="Miscellaneous">
|
||||||
|
<link href="Low-Level-X-Interface.html#Low-Level-X-Interface" rel="next" title="Low Level X Interface">
|
||||||
|
<link href="Environment.html#Environment" rel="prev" title="Environment">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Inititialization"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Low-Level-X-Interface.html#Low-Level-X-Interface" accesskey="n" rel="next">Low Level X Interface</a>, Previous: <a href="Environment.html#Environment" accesskey="p" rel="prev">Environment</a>, Up: <a href="Miscellaneous.html#Miscellaneous" accesskey="u" rel="up">Miscellaneous</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Initialization"></a>
|
||||||
|
<h3 class="section">19.2 Initialization</h3>
|
||||||
|
|
||||||
|
<p>If the file init.lsp exists in the current directory, it is
|
||||||
|
loaded at startup. The first argument passed to the executable image
|
||||||
|
should be the system directory. Normally this would be gcl/unixport.
|
||||||
|
This directory is stored in the si::*system-directory* variable. If
|
||||||
|
the file sys-init.lsp exists in the system directory, it is loaded
|
||||||
|
before init.lsp. See also si::*TOP-LEVEL-HOOK*.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,229 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL SI Manual: Iteration and Tests</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL SI Manual: Iteration and Tests">
|
||||||
|
<meta name="keywords" content="GCL SI Manual: Iteration and Tests">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
|
||||||
|
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="index.html#Top" rel="up" title="Top">
|
||||||
|
<link href="User-Interface.html#User-Interface" rel="next" title="User Interface">
|
||||||
|
<link href="Structures.html#Structures" rel="prev" title="Structures">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Iteration-and-Tests"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="User-Interface.html#User-Interface" accesskey="n" rel="next">User Interface</a>, Previous: <a href="Structures.html#Structures" accesskey="p" rel="prev">Structures</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Iteration-and-Tests-1"></a>
|
||||||
|
<h2 class="chapter">11 Iteration and Tests</h2>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-DO_002dEXTERNAL_002dSYMBOLS"></a>Macro: <strong>DO-EXTERNAL-SYMBOLS</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Syntax:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(do-external-symbols (var [package [result-form]])
|
||||||
|
{decl}* {tag | statement}*)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Executes STATEMENTs once for each external symbol in the PACKAGE (which
|
||||||
|
defaults to the current package), with VAR bound to the current symbol.
|
||||||
|
Then evaluates RESULT-FORM (which defaults to NIL) and returns the value(s).
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-DO_002a"></a>Special Form: <strong>DO*</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Syntax:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(do* ({(var [init [step]])}*) (endtest {result}*)
|
||||||
|
{decl}* {tag | statement}*)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Just like DO, but performs variable bindings and assignments in serial, just
|
||||||
|
like LET* and SETQ do.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-DO_002dALL_002dSYMBOLS"></a>Macro: <strong>DO-ALL-SYMBOLS</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Syntax:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(do-all-symbols (var [result-form]) {decl}* {tag | statement}*)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Executes STATEMENTs once for each symbol in each package, with VAR bound to
|
||||||
|
the current symbol. Then evaluates RESULT-FORM (which defaults to NIL) and
|
||||||
|
returns the value(s).
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-YES_002dOR_002dNO_002dP"></a>Function: <strong>YES-OR-NO-P</strong> <em>(&optional (format-string nil) &rest args)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Asks the user a question whose answer is either ’YES’ or ’NO’. If FORMAT-
|
||||||
|
STRING is non-NIL, then FRESH-LINE operation is performed, a message is
|
||||||
|
printed as if FORMAT-STRING and ARGs were given to FORMAT, and then a prompt
|
||||||
|
"(Yes or No)" is printed. Otherwise, no prompt will appear.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-MAPHASH"></a>Function: <strong>MAPHASH</strong> <em>#'hash-table</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>For each entry in HASH-TABLE, calls FUNCTION on the key and value of the
|
||||||
|
entry; returns NIL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-MAPCAR"></a>Function: <strong>MAPCAR</strong> <em>(fun list &rest more-lists)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Applies FUN to successive cars of LISTs and returns the results as a list.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-DOLIST"></a>Special Form: <strong>DOLIST</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Syntax:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(dolist (var listform [result]) {decl}* {tag | statement}*)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Executes STATEMENTs, with VAR bound to each member of the list value of
|
||||||
|
LISTFORM. Then returns the value(s) of RESULT (which defaults to NIL).
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-EQ"></a>Function: <strong>EQ</strong> <em>(x y)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if X and Y are the same identical object; NIL otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-EQUALP"></a>Function: <strong>EQUALP</strong> <em>(x y)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if X and Y are EQUAL, if they are characters and satisfy CHAR-EQUAL,
|
||||||
|
if they are numbers and have the same numerical value, or if they have
|
||||||
|
components that are all EQUALP. Returns NIL otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-EQUAL"></a>Function: <strong>EQUAL</strong> <em>(x y)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if X and Y are EQL or if they are of the same type and corresponding
|
||||||
|
components are EQUAL. Returns NIL otherwise. Strings and bit-vectors are
|
||||||
|
EQUAL if they are the same length and have identical components. Other
|
||||||
|
arrays must be EQ to be EQUAL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-DO_002dSYMBOLS"></a>Macro: <strong>DO-SYMBOLS</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Syntax:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(do-symbols (var [package [result-form]]) {decl}* {tag |
|
||||||
|
statement}*)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Executes STATEMENTs once for each symbol in the PACKAGE (which defaults to
|
||||||
|
the current package), with VAR bound to the current symbol. Then evaluates
|
||||||
|
RESULT-FORM (which defaults to NIL) and returns the value(s).
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-LOOP"></a>Special Form: <strong>LOOP</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Syntax:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(loop {form}*)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Executes FORMs repeatedly until exited by a THROW or RETURN. The FORMs are
|
||||||
|
surrounded by an implicit NIL block.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="User-Interface.html#User-Interface" accesskey="n" rel="next">User Interface</a>, Previous: <a href="Structures.html#Structures" accesskey="p" rel="prev">Structures</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,84 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL SI Manual: Low Level Debug Functions</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL SI Manual: Low Level Debug Functions">
|
||||||
|
<meta name="keywords" content="GCL SI Manual: Low Level Debug Functions">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
|
||||||
|
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="Debugging.html#Debugging" rel="up" title="Debugging">
|
||||||
|
<link href="Miscellaneous.html#Miscellaneous" rel="next" title="Miscellaneous">
|
||||||
|
<link href="Source-Level-Debugging-in-Emacs.html#Source-Level-Debugging-in-Emacs" rel="prev" title="Source Level Debugging in Emacs">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Low-Level-Debug-Functions"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Previous: <a href="Source-Level-Debugging-in-Emacs.html#Source-Level-Debugging-in-Emacs" accesskey="p" rel="prev">Source Level Debugging in Emacs</a>, Up: <a href="Debugging.html#Debugging" accesskey="u" rel="up">Debugging</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Low-Level-Debug-Functions-1"></a>
|
||||||
|
<h3 class="section">18.2 Low Level Debug Functions</h3>
|
||||||
|
|
||||||
|
<p>Use the following functions to directly access GCL stacks.
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(SI:VS i) Returns the i-th entity in VS.
|
||||||
|
(SI:IHS-VS i) Returns the VS index of the i-th entity in IHS.
|
||||||
|
(SI:IHS-FUN i) Returns the function of the i-th entity in IHS.
|
||||||
|
(SI:FRS-VS i) Returns the VS index of the i-th entity in FRS.
|
||||||
|
(SI:FRS-BDS i) Returns the BDS index of the i-th entity in FRS.
|
||||||
|
(SI:FRS-IHS i) Returns the IHS index of the i-th entity in FRS.
|
||||||
|
(SI:BDS-VAR i) Returns the symbol of the i-th entity in BDS.
|
||||||
|
(SI:BDS-VAL i) Returns the value of the i-th entity in BDS.
|
||||||
|
|
||||||
|
(SI:SUPER-GO i tag)
|
||||||
|
Jumps to the specified tag established by the TAGBODY frame at
|
||||||
|
FRS[i]. Both arguments are evaluated. If FRS[i] happens to be
|
||||||
|
a non-TAGBODY frame, then (THROW (SI:IHS-TAG i) (VALUES)) is
|
||||||
|
performed.
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,79 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL SI Manual: Low Level X Interface</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL SI Manual: Low Level X Interface">
|
||||||
|
<meta name="keywords" content="GCL SI Manual: Low Level X Interface">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
|
||||||
|
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="Miscellaneous.html#Miscellaneous" rel="up" title="Miscellaneous">
|
||||||
|
<link href="Compiler-Definitions.html#Compiler-Definitions" rel="next" title="Compiler Definitions">
|
||||||
|
<link href="Inititialization.html#Inititialization" rel="prev" title="Inititialization">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Low-Level-X-Interface"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Previous: <a href="Inititialization.html#Inititialization" accesskey="p" rel="prev">Inititialization</a>, Up: <a href="Miscellaneous.html#Miscellaneous" accesskey="u" rel="up">Miscellaneous</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Low-Level-X-Interface-1"></a>
|
||||||
|
<h3 class="section">19.3 Low Level X Interface</h3>
|
||||||
|
|
||||||
|
<p>A sample program for drawing things on X windows from lisp
|
||||||
|
is included in the file gcl/lsp/littleXlsp.lsp
|
||||||
|
</p>
|
||||||
|
<p>That routine invokes the corresponding C routines in XLIB.
|
||||||
|
So in order to use it you must ‘faslink’ in the X routines.
|
||||||
|
Directions are given at the beginning of the lisp file,
|
||||||
|
for either building them into the image or using faslink.
|
||||||
|
</p>
|
||||||
|
<p>This program is also a good tutorial on invoking C from lisp.
|
||||||
|
</p>
|
||||||
|
<p>See also defentry and faslink.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,74 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL SI Manual: Miscellaneous</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL SI Manual: Miscellaneous">
|
||||||
|
<meta name="keywords" content="GCL SI Manual: Miscellaneous">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
|
||||||
|
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="index.html#Top" rel="up" title="Top">
|
||||||
|
<link href="Environment.html#Environment" rel="next" title="Environment">
|
||||||
|
<link href="Low-Level-Debug-Functions.html#Low-Level-Debug-Functions" rel="prev" title="Low Level Debug Functions">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Miscellaneous"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Compiler-Definitions.html#Compiler-Definitions" accesskey="n" rel="next">Compiler Definitions</a>, Previous: <a href="Debugging.html#Debugging" accesskey="p" rel="prev">Debugging</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Miscellaneous-1"></a>
|
||||||
|
<h2 class="chapter">19 Miscellaneous</h2>
|
||||||
|
|
||||||
|
<table class="menu" border="0" cellspacing="0">
|
||||||
|
<tr><td align="left" valign="top">• <a href="Environment.html#Environment" accesskey="1">Environment</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Inititialization.html#Inititialization" accesskey="2">Inititialization</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Low-Level-X-Interface.html#Low-Level-X-Interface" accesskey="3">Low Level X Interface</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,419 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL SI Manual: Operating System Definitions</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL SI Manual: Operating System Definitions">
|
||||||
|
<meta name="keywords" content="GCL SI Manual: Operating System Definitions">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
|
||||||
|
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="Operating-System.html#Operating-System" rel="up" title="Operating System">
|
||||||
|
<link href="Structures.html#Structures" rel="next" title="Structures">
|
||||||
|
<link href="Command-Line.html#Command-Line" rel="prev" title="Command Line">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Operating-System-Definitions"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Previous: <a href="Command-Line.html#Command-Line" accesskey="p" rel="prev">Command Line</a>, Up: <a href="Operating-System.html#Operating-System" accesskey="u" rel="up">Operating System</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Operating-System-Definitions-1"></a>
|
||||||
|
<h3 class="section">9.2 Operating System Definitions</h3>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-GET_002dDECODED_002dTIME"></a>Function: <strong>GET-DECODED-TIME</strong> <em>()</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the current time in decoded time format. Returns nine values: second,
|
||||||
|
minute, hour, date, month, year, day-of-week, daylight-saving-time-p, and
|
||||||
|
time-zone.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-HOST_002dNAMESTRING"></a>Function: <strong>HOST-NAMESTRING</strong> <em>(pathname)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the host part of PATHNAME as a string.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-RENAME_002dFILE"></a>Function: <strong>RENAME-FILE</strong> <em>(file new-name)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Renames the file FILE to NEW-NAME. FILE may be a string, a pathname, or
|
||||||
|
a stream.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-FILE_002dAUTHOR"></a>Function: <strong>FILE-AUTHOR</strong> <em>(file)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the author name of the specified file, as a string.
|
||||||
|
FILE may be a string or a stream
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-PATHNAME_002dHOST"></a>Function: <strong>PATHNAME-HOST</strong> <em>(pathname)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the host slot of PATHNAME.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-FILE_002dPOSITION"></a>Function: <strong>FILE-POSITION</strong> <em>(file-stream &optional position)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Sets the file pointer of the specified file to POSITION, if POSITION is given.
|
||||||
|
Otherwise, returns the current file position of the specified file.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-DECODE_002dUNIVERSAL_002dTIME"></a>Function: <strong>DECODE-UNIVERSAL-TIME</strong> <em>(universal-time &optional (timezone -9))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Converts UNIVERSAL-TIME into a decoded time at the TIMEZONE.
|
||||||
|
Returns nine values: second, minute, hour, date, month (1 - 12), year,
|
||||||
|
day-of-week (0 - 6), daylight-saving-time-p, and time-zone.
|
||||||
|
TIMEZONE in GCL defaults to 6, the time zone of Austin, Texas.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-USER_002dHOMEDIR_002dPATHNAME"></a>Function: <strong>USER-HOMEDIR-PATHNAME</strong> <em>(&optional host)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the home directory of the logged in user as a pathname. HOST
|
||||||
|
is ignored.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002aMODULES_002a"></a>Variable: <strong>*MODULES*</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
A list of names of the modules that have been loaded into GCL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-SHORT_002dSITE_002dNAME"></a>Function: <strong>SHORT-SITE-NAME</strong> <em>()</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns a string that identifies the physical location of the current GCL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-DIRECTORY"></a>Function: <strong>DIRECTORY</strong> <em>(name)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns a list of files that match NAME. NAME may be a string, a pathname,
|
||||||
|
or a file stream.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-SOFTWARE_002dVERSION"></a>Function: <strong>SOFTWARE-VERSION</strong> <em>()</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns a string that identifies the software version of the software
|
||||||
|
under which GCL is currently running.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-INTERNAL_002dTIME_002dUNITS_002dPER_002dSECOND"></a>Constant: <strong>INTERNAL-TIME-UNITS-PER-SECOND</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
The number of internal time units that fit into a second.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-ENOUGH_002dNAMESTRING"></a>Function: <strong>ENOUGH-NAMESTRING</strong> <em>(pathname &optional (defaults *default-pathname-defaults*))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns a string which uniquely identifies PATHNAME with respect to
|
||||||
|
DEFAULTS.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-REQUIRE"></a>Function: <strong>REQUIRE</strong> <em>(module-name &optional (pathname))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>If the specified module is not present, then loads the appropriate file(s).
|
||||||
|
PATHNAME may be a single pathname or it may be a list of pathnames.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-ENCODE_002dUNIVERSAL_002dTIME"></a>Function: <strong>ENCODE-UNIVERSAL-TIME</strong> <em>(second minute hour date month year &optional (timezone ))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Does the inverse operation of DECODE-UNIVERSAL-TIME.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-LISP_002dIMPLEMENTATION_002dVERSION"></a>Function: <strong>LISP-IMPLEMENTATION-VERSION</strong> <em>()</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns a string that tells you when the current GCL implementation is
|
||||||
|
brought up.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-MACHINE_002dINSTANCE"></a>Function: <strong>MACHINE-INSTANCE</strong> <em>()</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns a string that identifies the machine instance of the machine
|
||||||
|
on which GCL is currently running.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-ROOM"></a>Function: <strong>ROOM</strong> <em>(&optional (x t))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Displays information about storage allocation in the following format.
|
||||||
|
</p>
|
||||||
|
<ul class="no-bullet">
|
||||||
|
<li> for each type class
|
||||||
|
<ul class="no-bullet">
|
||||||
|
<li> the number of pages so-far allocated for the type class
|
||||||
|
</li><li> the maximum number of pages for the type class
|
||||||
|
</li><li> the percentage of used cells to cells so-far allocated
|
||||||
|
</li><li> the number of times the garbage collector has been called to
|
||||||
|
collect cells of the type class
|
||||||
|
</li><li> the implementation types that belongs to the type class
|
||||||
|
</li></ul>
|
||||||
|
</li><li> the number of pages actually allocated for contiguous blocks
|
||||||
|
</li><li> the maximum number of pages for contiguous blocks
|
||||||
|
</li><li> the number of times the garbage collector has been called to collect
|
||||||
|
contiguous blocks
|
||||||
|
</li><li> the number of pages in the hole
|
||||||
|
</li><li> the maximum number of pages for relocatable blocks
|
||||||
|
</li><li> the number of times the garbage collector has been called to collect
|
||||||
|
relocatable blocks
|
||||||
|
</li><li> the total number of pages allocated for cells
|
||||||
|
</li><li> the total number of pages allocated
|
||||||
|
</li><li> the number of available pages
|
||||||
|
</li><li> the number of pages GCL can use.
|
||||||
|
|
||||||
|
<p>The number of times the garbage collector has been called is not shown,
|
||||||
|
if the number is zero. The optional X is ignored.
|
||||||
|
</p></li></ul>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-GET_002dUNIVERSAL_002dTIME"></a>Function: <strong>GET-UNIVERSAL-TIME</strong> <em>()</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the current time as a single integer in universal time format.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-GET_002dINTERNAL_002dRUN_002dTIME"></a>Function: <strong>GET-INTERNAL-RUN-TIME</strong> <em>()</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the run time in the internal time format. This is useful for
|
||||||
|
finding CPU usage. If the operating system allows, a second value
|
||||||
|
containing CPU usage of child processes is returned.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002aDEFAULT_002dPATHNAME_002dDEFAULTS_002a"></a>Variable: <strong>*DEFAULT-PATHNAME-DEFAULTS*</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
The default pathname-defaults pathname.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-LONG_002dSITE_002dNAME"></a>Function: <strong>LONG-SITE-NAME</strong> <em>()</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns a string that identifies the physical location of the current GCL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-DELETE_002dFILE"></a>Function: <strong>DELETE-FILE</strong> <em>(file)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
Deletes FILE.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-GET_002dINTERNAL_002dREAL_002dTIME"></a>Function: <strong>GET-INTERNAL-REAL-TIME</strong> <em>()</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the real time in the internal time format. This is useful for
|
||||||
|
finding elapsed time.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-MACHINE_002dTYPE"></a>Function: <strong>MACHINE-TYPE</strong> <em>()</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns a string that identifies the machine type of the machine
|
||||||
|
on which GCL is currently running.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-TIME"></a>Macro: <strong>TIME</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Syntax:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(time form)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Evaluates FORM and outputs timing statistics on *TRACE-OUTPUT*.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-SOFTWARE_002dTYPE"></a>Function: <strong>SOFTWARE-TYPE</strong> <em>()</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns a string that identifies the software type of the software
|
||||||
|
under which GCL is currently running.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-LISP_002dIMPLEMENTATION_002dTYPE"></a>Function: <strong>LISP-IMPLEMENTATION-TYPE</strong> <em>()</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns a string that tells you that you are using a version of GCL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-SLEEP"></a>Function: <strong>SLEEP</strong> <em>(n)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>This function causes execution to be suspended for N seconds. N may
|
||||||
|
be any non-negative, non-complex number.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-BREAK_002dON_002dFLOATING_002dPOINT_002dEXCEPTIONS"></a>Function: <strong>BREAK-ON-FLOATING-POINT-EXCEPTIONS</strong> <em>(&key division-by-zero</em></dt>
|
||||||
|
<dd><p>floating-point-invalid-operation
|
||||||
|
floating-point-overflow
|
||||||
|
floating-point-underflow
|
||||||
|
floating-point-inexact)
|
||||||
|
Package:SI
|
||||||
|
</p>
|
||||||
|
<p>Break on the specified IEEE floating point error conditions. With no
|
||||||
|
arguments, report the exceptions currently trapped. Disable the break
|
||||||
|
by setting the key to nil, e.g.
|
||||||
|
</p>
|
||||||
|
<p>> (break-on-floaing-point-exceptions :division-by-zero t)
|
||||||
|
(DIVISION-BY-ZERO)
|
||||||
|
</p>
|
||||||
|
<p>> (break-on-floaing-point-exceptions)
|
||||||
|
(DIVISION-BY-ZERO)
|
||||||
|
</p>
|
||||||
|
<p>> (break-on-floaing-point-exceptions :division-by-zero nil)
|
||||||
|
NIL
|
||||||
|
</p>
|
||||||
|
<p>On some of the most common platforms, the offending instruction will be
|
||||||
|
disassembled, and the register arguments looked up in the saved context
|
||||||
|
and reported in as operands. Within the error handler, addresses may be
|
||||||
|
disassembled, and other registers inspected, using the functions defined
|
||||||
|
in gcl_fpe.lsp.
|
||||||
|
</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Previous: <a href="Command-Line.html#Command-Line" accesskey="p" rel="prev">Command Line</a>, Up: <a href="Operating-System.html#Operating-System" accesskey="u" rel="up">Operating System</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,72 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL SI Manual: Operating System</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL SI Manual: Operating System">
|
||||||
|
<meta name="keywords" content="GCL SI Manual: Operating System">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
|
||||||
|
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="index.html#Top" rel="up" title="Top">
|
||||||
|
<link href="Command-Line.html#Command-Line" rel="next" title="Command Line">
|
||||||
|
<link href="Symbols.html#Symbols" rel="prev" title="Symbols">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Operating-System"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Structures.html#Structures" accesskey="n" rel="next">Structures</a>, Previous: <a href="Symbols.html#Symbols" accesskey="p" rel="prev">Symbols</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Operating-System-1"></a>
|
||||||
|
<h2 class="chapter">9 Operating System</h2>
|
||||||
|
|
||||||
|
<table class="menu" border="0" cellspacing="0">
|
||||||
|
<tr><td align="left" valign="top">• <a href="Command-Line.html#Command-Line" accesskey="1">Command Line</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Operating-System-Definitions.html#Operating-System-Definitions" accesskey="2">Operating System Definitions</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,211 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL SI Manual: Regular Expressions</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL SI Manual: Regular Expressions">
|
||||||
|
<meta name="keywords" content="GCL SI Manual: Regular Expressions">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
|
||||||
|
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="System-Definitions.html#System-Definitions" rel="up" title="System Definitions">
|
||||||
|
<link href="Debugging.html#Debugging" rel="next" title="Debugging">
|
||||||
|
<link href="System-Definitions.html#System-Definitions" rel="prev" title="System Definitions">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Regular-Expressions"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Previous: <a href="System-Definitions.html#System-Definitions" accesskey="p" rel="prev">System Definitions</a>, Up: <a href="System-Definitions.html#System-Definitions" accesskey="u" rel="up">System Definitions</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Regular-Expressions-1"></a>
|
||||||
|
<h3 class="section">17.1 Regular Expressions</h3>
|
||||||
|
|
||||||
|
<p>The function <code>string-match</code> (*Index string-match::) is used to
|
||||||
|
match a regular expression against a string. If the variable
|
||||||
|
<code>*case-fold-search*</code> is not nil, case is ignored in the match.
|
||||||
|
To determine the extent of the match use *Index match-beginning:: and
|
||||||
|
*Index match-end::.
|
||||||
|
</p>
|
||||||
|
<p>Regular expressions are implemented using Henry Spencer’s package
|
||||||
|
(thank you Henry!), and much of the description of regular expressions
|
||||||
|
below is copied verbatim from his manual entry. Code for delimited
|
||||||
|
searches, case insensitive searches, and speedups to allow fast
|
||||||
|
searching of long files was contributed by W. Schelter. The speedups
|
||||||
|
use an adaptation by Schelter of the Boyer and Moore string search
|
||||||
|
algorithm to the case of branched regular expressions. These allow
|
||||||
|
such expressions as ’not_there|really_not’ to be searched for 30 times
|
||||||
|
faster than in GNU emacs (1995), and 200 times faster than in the
|
||||||
|
original Spencer method. Expressions such as [a-u]bcdex get a speedup
|
||||||
|
of 60 and 194 times respectively. This is based on searching a string
|
||||||
|
of 50000 characters (such as the file tk.lisp).
|
||||||
|
</p>
|
||||||
|
<ul>
|
||||||
|
<li> A regular expression is a string containing zero or more <i>branches</i> which are separated by <code>|</code>. A match of the regular expression against a string is simply a match of the string with one of the branches.
|
||||||
|
</li><li> Each branch consists of zero or more <i>pieces</i>, concatenated. A matching
|
||||||
|
string must contain an initial substring matching the first piece, immediately
|
||||||
|
followed by a second substring matching the second piece and so on.
|
||||||
|
</li><li> Each piece is an <i>atom</i> optionally followed by <code>+</code>, <code>*</code>, or <code>?</code>.
|
||||||
|
</li><li> An atom followed by <code>+</code> matches a sequence of 1 or more matches of the atom.
|
||||||
|
</li><li> An atom followed by <code>*</code> matches a sequence of 0 or more matches of the atom.
|
||||||
|
</li><li> An atom followed by <code>?</code> matches a match of the atom, or the null string.
|
||||||
|
</li><li> An atom is
|
||||||
|
<ul class="no-bullet">
|
||||||
|
<li>- a regular expression in parentheses matching a match for the regular expression
|
||||||
|
</li><li>- a <i>range</i> see below
|
||||||
|
</li><li>- a <code>.</code> matching any single character
|
||||||
|
</li><li>- a <code>^</code> matching the null string at the beginning of the input string
|
||||||
|
</li><li>- a <code>$</code> matching the null string at the end of the input string
|
||||||
|
</li><li>- a <code>\</code> followed by a single character matching that character
|
||||||
|
</li><li>- a single character with no other significance
|
||||||
|
(matching that character).
|
||||||
|
</li></ul>
|
||||||
|
</li><li> A <i>range</i> is a sequence of characters enclosed in <code>[]</code>.
|
||||||
|
It normally matches any single character from the sequence.
|
||||||
|
<ul class="no-bullet">
|
||||||
|
<li>- If the sequence begins with <code>^</code>,
|
||||||
|
it matches any single character <i>not</i> from the rest of the sequence.
|
||||||
|
</li><li>- If two characters in the sequence are separated by <code>-</code>, this is shorthand
|
||||||
|
for the full list of ASCII characters between them
|
||||||
|
(e.g. <code>[0-9]</code> matches any decimal digit).
|
||||||
|
</li><li>- To include a literal <code>]</code> in the sequence, make it the first character
|
||||||
|
(following a possible <code>^</code>).
|
||||||
|
</li><li>- To include a literal <code>-</code>, make it the first or last character.
|
||||||
|
</li></ul>
|
||||||
|
</li></ul>
|
||||||
|
|
||||||
|
<a name="Ordering-Multiple-Matches"></a>
|
||||||
|
<h4 class="unnumberedsubsec">Ordering Multiple Matches</h4>
|
||||||
|
|
||||||
|
<p>In general there may be more than one way to match a regular expression
|
||||||
|
to an input string. For example, consider the command
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example"> (string-match "(a*)b*" "aabaaabb")
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Considering only the rules given so far, the value of (list-matches 0 1)
|
||||||
|
might be <code>("aabb" "aa")</code> or <code>("aaab" "aaa")</code> or <code>("ab" "a")</code>
|
||||||
|
or any of several other combinations.
|
||||||
|
To resolve this potential ambiguity <b>string-match</b> chooses among
|
||||||
|
alternatives using the rule <i>first then longest</i>.
|
||||||
|
In other words, it considers the possible matches in order working
|
||||||
|
from left to right across the input string and the pattern, and it
|
||||||
|
attempts to match longer pieces of the input string before shorter
|
||||||
|
ones. More specifically, the following rules apply in decreasing
|
||||||
|
order of priority:
|
||||||
|
</p><ul class="no-bullet">
|
||||||
|
<li> [1]
|
||||||
|
If a regular expression could match two different parts of an input string
|
||||||
|
then it will match the one that begins earliest.
|
||||||
|
</li><li> [2]
|
||||||
|
If a regular expression contains <b>|</b> operators then the leftmost
|
||||||
|
matching sub-expression is chosen.
|
||||||
|
</li><li> [3]
|
||||||
|
In <b>*</b><span class="roman">, </span><b>+</b><span class="roman">, and </span><b>?</b> constructs, longer matches are chosen
|
||||||
|
in preference to shorter ones.
|
||||||
|
</li><li> [4]
|
||||||
|
In sequences of expression components the components are considered
|
||||||
|
from left to right.
|
||||||
|
</li></ul>
|
||||||
|
|
||||||
|
<p>In the example from above, <b>(a*)b*</b><span class="roman"> matches </span><b>aab</b><span class="roman">: the </span><b>(a*)</b>
|
||||||
|
portion of the pattern is matched first and it consumes the leading
|
||||||
|
<b>aa</b><span class="roman">; then the </span><b>b*</b> portion of the pattern consumes the
|
||||||
|
next <b>b</b>. Or, consider the following example:
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example"> (string-match "(ab|a)(b*)c" "xabc") ==> 1
|
||||||
|
(list-matches 0 1 2 3) ==> ("abc" "ab" "" NIL)
|
||||||
|
(match-beginning 0) ==> 1
|
||||||
|
(match-end 0) ==> 4
|
||||||
|
(match-beginning 1) ==> 1
|
||||||
|
(match-end 1) ==> 3
|
||||||
|
(match-beginning 2) ==> 3
|
||||||
|
(match-end 2) ==> 3
|
||||||
|
(match-beginning 3) ==> -1
|
||||||
|
(match-end 3) ==> -1
|
||||||
|
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>In the above example the return value of <code>1</code> (which is <code>> -1</code>)
|
||||||
|
indicates that a match was found. The entire match runs from
|
||||||
|
1 to 4.
|
||||||
|
Rule 4 specifies that <b>(ab|a)</b> gets first shot at the input
|
||||||
|
string and Rule 2 specifies that the <b>ab</b> sub-expression
|
||||||
|
is checked before the <b>a</b> sub-expression.
|
||||||
|
Thus the <b>b</b><span class="roman"> has already been claimed before the </span><b>(b*)</b>
|
||||||
|
component is checked and <b>(b*)</b> must match an empty string.
|
||||||
|
</p>
|
||||||
|
<p>The special characters in the string <code>"\()[]+.*|^$?"</code>,
|
||||||
|
must be quoted, if a simple string search is desired. The function
|
||||||
|
re-quote-string is provided for this purpose.
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(re-quote-string "*standard*") ==> "\\*standard\\*"
|
||||||
|
|
||||||
|
(string-match (re-quote-string "*standard*") "X *standard* ")
|
||||||
|
==> 2
|
||||||
|
|
||||||
|
(string-match "*standard*" "X *standard* ")
|
||||||
|
Error: Regexp Error: ?+* follows nothing
|
||||||
|
</pre></div>
|
||||||
|
<p>Note there is actually just one <code>\</code> before the <code>*</code>
|
||||||
|
but the printer makes two so that the string can be read, since
|
||||||
|
<code>\</code> is also the lisp quote character. In the last example
|
||||||
|
an error is signalled since the special character <code>*</code> must
|
||||||
|
follow an atom if it is interpreted as a regular expression.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Previous: <a href="System-Definitions.html#System-Definitions" accesskey="p" rel="prev">System Definitions</a>, Up: <a href="System-Definitions.html#System-Definitions" accesskey="u" rel="up">System Definitions</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,170 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL SI Manual: Source Level Debugging in Emacs</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL SI Manual: Source Level Debugging in Emacs">
|
||||||
|
<meta name="keywords" content="GCL SI Manual: Source Level Debugging in Emacs">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
|
||||||
|
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="Debugging.html#Debugging" rel="up" title="Debugging">
|
||||||
|
<link href="Low-Level-Debug-Functions.html#Low-Level-Debug-Functions" rel="next" title="Low Level Debug Functions">
|
||||||
|
<link href="Debugging.html#Debugging" rel="prev" title="Debugging">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Source-Level-Debugging-in-Emacs"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Low-Level-Debug-Functions.html#Low-Level-Debug-Functions" accesskey="n" rel="next">Low Level Debug Functions</a>, Previous: <a href="Debugging.html#Debugging" accesskey="p" rel="prev">Debugging</a>, Up: <a href="Debugging.html#Debugging" accesskey="u" rel="up">Debugging</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Source-Level-Debugging-in-Emacs-1"></a>
|
||||||
|
<h3 class="section">18.1 Source Level Debugging in Emacs</h3>
|
||||||
|
|
||||||
|
<p>In emacs load (load "dbl.el") from the gcl/doc directory.
|
||||||
|
[ It also requires gcl.el from that directory. Your system
|
||||||
|
administrator should do make in the doc directory, so that
|
||||||
|
these files are copied to the standard location.]
|
||||||
|
</p>
|
||||||
|
<p>OVERVIEW:
|
||||||
|
</p>
|
||||||
|
<p>Lisp files loaded with si::nload will have source line information about
|
||||||
|
them recorded. Break points may be set, and functions stepped. Source code
|
||||||
|
will be automatically displayed in the other window, with a little arrow beside
|
||||||
|
the current line. The backtrace (command :bt) will show line information and
|
||||||
|
you will get automatic display of the source as you move up and down the stack.
|
||||||
|
</p>
|
||||||
|
<p>FUNCTIONS:
|
||||||
|
break points which have been set.
|
||||||
|
si::nload (file)
|
||||||
|
load a lisp file collecting source line information.
|
||||||
|
</p>
|
||||||
|
<p>si::break-function (function &optional line absolute)
|
||||||
|
set up a breakpoint for FUNCTION at LINE relative to start or ABSOLUTE
|
||||||
|
</p>
|
||||||
|
<p>EMACS COMMANDS:
|
||||||
|
M-x dbl makes a dbl buffer, suitable for running an inferior gcl.
|
||||||
|
It has special keybindings for stepping and viewing sources. You may
|
||||||
|
start your favorite gcl program in the dbl shell buffer.
|
||||||
|
</p>
|
||||||
|
<p>Inferior Dbl Mode:
|
||||||
|
Major mode for interacting with an inferior Dbl process.
|
||||||
|
The following commands are available:
|
||||||
|
</p>
|
||||||
|
<p>C-c l dbl-find-line
|
||||||
|
</p>
|
||||||
|
<p>ESC d dbl-:down
|
||||||
|
ESC u dbl-:up
|
||||||
|
ESC c dbl-:r
|
||||||
|
ESC n dbl-:next
|
||||||
|
ESC i dbl-:step
|
||||||
|
ESC s dbl-:step
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>M-x dbl-display-frame displays in the other window
|
||||||
|
the last line referred to in the dbl buffer.
|
||||||
|
</p>
|
||||||
|
<p>ESC i and ESC n in the dbl window,
|
||||||
|
call dbl to step and next and then update the other window
|
||||||
|
with the current file and position.
|
||||||
|
</p>
|
||||||
|
<p>If you are in a source file, you may select a point to break
|
||||||
|
at, by doing C-x SPC.
|
||||||
|
</p>
|
||||||
|
<p>Commands:
|
||||||
|
Many commands are inherited from shell mode.
|
||||||
|
Additionally we have:
|
||||||
|
</p>
|
||||||
|
<p>M-x dbl-display-frame display frames file in other window
|
||||||
|
ESC i advance one line in program
|
||||||
|
ESC n advance one line in program (skip over calls).
|
||||||
|
M-x send-dbl-command used for special printing of an arg at the current point.
|
||||||
|
C-x SPACE sets break point at current line.
|
||||||
|
</p>
|
||||||
|
<p>—————————-
|
||||||
|
</p>
|
||||||
|
<p>When visiting a lisp buffer (if gcl.el is loaded in your emacs) the command
|
||||||
|
c-m-x evaluates the current defun into the process running in the other window.
|
||||||
|
Line information will be kept. This line information allows you to set break
|
||||||
|
points at a given line (by typing C-x \space on the line in the source file
|
||||||
|
where you want the break to occur. Once stopped within a function you may
|
||||||
|
single step with M-s. This moves one line at a time in the source code,
|
||||||
|
displaying a little arrow beside your current position. M-c is like M-s,
|
||||||
|
except that function invocations are skipped over, rather than entered into.
|
||||||
|
M-c continues execution.
|
||||||
|
</p>
|
||||||
|
<p>Keywords typed at top level, in the debug loop have
|
||||||
|
a special meaning:
|
||||||
|
</p><ul class="no-bullet">
|
||||||
|
<li> :delete [n1] [n2] .. – delete all break points or just n1,n2
|
||||||
|
</li><li> :disable [n1] [n2] .. – disable all break points or just n1,n2
|
||||||
|
</li><li> :enable [n1] [n2] .. – enable all break points or just n1,n2
|
||||||
|
</li><li> :info [:bkpt] –print information about
|
||||||
|
</li><li> :break [fun] [line] – break at the current location, or if
|
||||||
|
fun is supplied in fun. Break at the beginning unless a
|
||||||
|
line offset from the beginning of fun is supplied.
|
||||||
|
</li><li> :fr [n] go to frame n When in frame n, if the frame is interpreted,
|
||||||
|
typing the name of locals, will print their values. If it is compiled
|
||||||
|
you must use (si::loc j) to print ‘locj’. Autodisplay of the source
|
||||||
|
will take place if it is interpreted and the line can be determined.
|
||||||
|
</li><li> :up [n] go up n frames from the current frame.
|
||||||
|
</li><li> :down [n] go down n frames
|
||||||
|
</li><li> :bt [n] back trace starting at the current frame and going to top level
|
||||||
|
If n is specified show only n frames.
|
||||||
|
</li><li> :r If stopped in a function resume. If at top level in the dbl
|
||||||
|
loop, exit and resume an outer loop.
|
||||||
|
</li><li> :q quit the computation back to top level dbl loop.
|
||||||
|
</li><li> :step step to the next line with line information
|
||||||
|
</li><li> :next step to the next line with line information skipping over function
|
||||||
|
invocations.
|
||||||
|
|
||||||
|
</li></ul>
|
||||||
|
<p>Files: debug.lsp dbl.el gcl.el
|
||||||
|
</p>
|
||||||
|
<hr>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Low-Level-Debug-Functions.html#Low-Level-Debug-Functions" accesskey="n" rel="next">Low Level Debug Functions</a>, Previous: <a href="Debugging.html#Debugging" accesskey="p" rel="prev">Debugging</a>, Up: <a href="Debugging.html#Debugging" accesskey="u" rel="up">Debugging</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,108 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL SI Manual: Structures</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL SI Manual: Structures">
|
||||||
|
<meta name="keywords" content="GCL SI Manual: Structures">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
|
||||||
|
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="index.html#Top" rel="up" title="Top">
|
||||||
|
<link href="Iteration-and-Tests.html#Iteration-and-Tests" rel="next" title="Iteration and Tests">
|
||||||
|
<link href="Operating-System-Definitions.html#Operating-System-Definitions" rel="prev" title="Operating System Definitions">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Structures"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Iteration-and-Tests.html#Iteration-and-Tests" accesskey="n" rel="next">Iteration and Tests</a>, Previous: <a href="Operating-System.html#Operating-System" accesskey="p" rel="prev">Operating System</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Structures-1"></a>
|
||||||
|
<h2 class="chapter">10 Structures</h2>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-DEFSTRUCT"></a>Macro: <strong>DEFSTRUCT</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Syntax:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(defstruct
|
||||||
|
{name | (name {:conc-name | (:conc-name prefix-string) |
|
||||||
|
:constructor | (:constructor symbol [lambda-list]) |
|
||||||
|
:copier | (:copier symbol) |
|
||||||
|
:predicate | (:predicate symbol) |
|
||||||
|
(:include symbol) |
|
||||||
|
(:print-function function) |
|
||||||
|
(:type {vector | (vector type) | list}) |
|
||||||
|
:named | (:static { nil | t})
|
||||||
|
(:initial-offset number)}*)}
|
||||||
|
[doc]
|
||||||
|
{slot-name |
|
||||||
|
(slot-name [default-value-form] {:type type | :read-only flag}*) }*
|
||||||
|
)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Defines a structure. The doc-string DOC, if supplied, is saved as a STRUCTURE
|
||||||
|
doc and can be retrieved by (documentation ’NAME ’structure).
|
||||||
|
STATIC is gcl specific and makes the body non relocatable.
|
||||||
|
</p>
|
||||||
|
<p>See the files misc/rusage.lsp misc/cstruct.lsp, for examples of making
|
||||||
|
a lisp structure correspond to a C structure.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-HELP"></a>Function: <strong>HELP</strong> <em>(&optional symbol)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>GCL specific: Prints the documentation associated with SYMBOL. With no
|
||||||
|
argument, this function prints the greeting message to GCL beginners.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,580 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL SI Manual: Symbols</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL SI Manual: Symbols">
|
||||||
|
<meta name="keywords" content="GCL SI Manual: Symbols">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
|
||||||
|
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="index.html#Top" rel="up" title="Top">
|
||||||
|
<link href="Operating-System.html#Operating-System" rel="next" title="Operating System">
|
||||||
|
<link href="Compilation.html#Compilation" rel="prev" title="Compilation">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Symbols"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Operating-System.html#Operating-System" accesskey="n" rel="next">Operating System</a>, Previous: <a href="Compilation.html#Compilation" accesskey="p" rel="prev">Compilation</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Symbols-1"></a>
|
||||||
|
<h2 class="chapter">8 Symbols</h2>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-GENSYM"></a>Function: <strong>GENSYM</strong> <em>(&optional (x nil))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Creates and returns a new uninterned symbol whose name is a prefix string
|
||||||
|
(defaults to "G"), followed by a decimal number. The number is incremented
|
||||||
|
by each call to GENSYM. X, if an integer, resets the counter. If X is a
|
||||||
|
string, it becomes the new prefix.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-KEYWORDP"></a>Function: <strong>KEYWORDP</strong> <em>(x)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if X is a symbol and it belongs to the KEYWORD package; NIL
|
||||||
|
otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-REMPROP"></a>Function: <strong>REMPROP</strong> <em>(symbol indicator)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Look on property list of SYMBOL for property with specified
|
||||||
|
INDICATOR. If found, splice this indicator and its value out of
|
||||||
|
the plist, and return T. If not found, returns NIL with no side effects.
|
||||||
|
</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-SYMBOL_002dPACKAGE"></a>Function: <strong>SYMBOL-PACKAGE</strong> <em>(symbol)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the contents of the package cell of the symbol SYMBOL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002aPACKAGE_002a"></a>Variable: <strong>*PACKAGE*</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
The current package.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-SHADOWING_002dIMPORT"></a>Function: <strong>SHADOWING-IMPORT</strong> <em>(symbols &optional (package *package*))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Imports SYMBOLS into PACKAGE, disregarding any name conflict. If a symbol
|
||||||
|
of the same name is already present, then it is uninterned. SYMBOLS must
|
||||||
|
be a list of symbols or a symbol.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-REMF"></a>Macro: <strong>REMF</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Syntax:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(remf place indicator)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>PLACE may be any place expression acceptable to SETF, and is expected
|
||||||
|
to hold a property list or NIL. This list is destructively altered to
|
||||||
|
remove the property specified by INDICATOR. Returns T if such a
|
||||||
|
property was present; NIL otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-MAKUNBOUND"></a>Function: <strong>MAKUNBOUND</strong> <em>(symbol)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Makes empty the value slot of SYMBOL. Returns SYMBOL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-USE_002dPACKAGE"></a>Function: <strong>USE-PACKAGE</strong> <em>(packages-to-use &optional (package *package*))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Adds all packages in PACKAGE-TO-USE list to the use list for PACKAGE so that
|
||||||
|
the external symbols of the used packages are available as internal symbols
|
||||||
|
in PACKAGE.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-MAKE_002dSYMBOL"></a>Function: <strong>MAKE-SYMBOL</strong> <em>(string)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Creates and returns a new uninterned symbol whose print name is STRING.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-PSETQ"></a>Special Form: <strong>PSETQ</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Syntax:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(psetq {var form}*)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Similar to SETQ, but evaluates all FORMs first, and then assigns each value to
|
||||||
|
the corresponding VAR. Returns NIL always.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-PACKAGE_002dUSED_002dBY_002dLIST"></a>Function: <strong>PACKAGE-USED-BY-LIST</strong> <em>(package)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the list of packages that use PACKAGE.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-SYMBOLP"></a>Function: <strong>SYMBOLP</strong> <em>(x)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if X is a symbol; NIL otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-NIL"></a>Constant: <strong>NIL</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
Holds NIL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-SET"></a>Function: <strong>SET</strong> <em>(symbol value)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Assigns the value of VALUE to the dynamic variable named by SYMBOL, and
|
||||||
|
returns the value assigned.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-SETQ"></a>Special Form: <strong>SETQ</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Syntax:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(setq {var form}*)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>VARs are not evaluated and must be symbols. Assigns the value of the first
|
||||||
|
FORM to the first VAR, then assigns the value of the second FORM to the second
|
||||||
|
VAR, and so on. Returns the last value assigned.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-UNUSE_002dPACKAGE"></a>Function: <strong>UNUSE-PACKAGE</strong> <em>(packages-to-unuse &optional (package *package*))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Removes PACKAGES-TO-UNUSE from the use list for PACKAGE.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-T"></a>Constant: <strong>T</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
Holds T.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-PACKAGE_002dUSE_002dLIST"></a>Function: <strong>PACKAGE-USE-LIST</strong> <em>(package)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the list of packages used by PACKAGE.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-LIST_002dALL_002dPACKAGES"></a>Function: <strong>LIST-ALL-PACKAGES</strong> <em>()</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns a list of all existing packages.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-COPY_002dSYMBOL"></a>Function: <strong>COPY-SYMBOL</strong> <em>(symbol &optional (copy-props nil))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns a new uninterned symbol with the same print name as SYMBOL.
|
||||||
|
If COPY-PROPS is NIL, the function, the variable, and the property slots
|
||||||
|
of the new symbol have no value. Otherwise, these slots are given the
|
||||||
|
values of the corresponding slots of SYMBOL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-SYMBOL_002dPLIST"></a>Function: <strong>SYMBOL-PLIST</strong> <em>(symbol)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the property list of SYMBOL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-SYMBOL_002dNAME"></a>Function: <strong>SYMBOL-NAME</strong> <em>(symbol)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the print name of the symbol SYMBOL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-FIND_002dSYMBOL"></a>Function: <strong>FIND-SYMBOL</strong> <em>(name &optional (package *package*))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the symbol named NAME in
|
||||||
|
PACKAGE. If such a symbol is found, then the second value is :INTERN,
|
||||||
|
:EXTERNAL, or :INHERITED to indicate how the symbol is accessible. If
|
||||||
|
no symbol is found then both values are NIL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-SHADOW"></a>Function: <strong>SHADOW</strong> <em>(symbols &optional (package *package*))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Creates an internal symbol in PACKAGE with the same name as each of the
|
||||||
|
specified SYMBOLS. SYMBOLS must be a list of symbols or a symbol.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-FBOUNDP"></a>Function: <strong>FBOUNDP</strong> <em>(symbol)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if SYMBOL has a global function definition or if SYMBOL names a
|
||||||
|
special form or a macro; NIL otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-MACRO_002dFUNCTION"></a>Function: <strong>MACRO-FUNCTION</strong> <em>(symbol)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>If SYMBOL globally names a macro, then returns the expansion function.
|
||||||
|
Returns NIL otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-IN_002dPACKAGE"></a>Function: <strong>IN-PACKAGE</strong> <em>(package-name &key (nicknames nil) (use '(lisp)))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Sets *PACKAGE* to the package with PACKAGE-NAME, creating the package if
|
||||||
|
it does not exist. If the package already exists then it is modified
|
||||||
|
to agree with USE and NICKNAMES arguments. Any new nicknames are added
|
||||||
|
without removing any old ones not specified. If any package in the USE list
|
||||||
|
is not currently used, then it is added to the use list.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-MAKE_002dPACKAGE"></a>Function: <strong>MAKE-PACKAGE</strong> <em>(package-name &key (nicknames nil) (use '(lisp)))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Makes a new package having the specified PACKAGE-NAME and NICKNAMES. The
|
||||||
|
package will inherit all external symbols from each package in the USE list.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-PACKAGE_002dSHADOWING_002dSYMBOLS"></a>Function: <strong>PACKAGE-SHADOWING-SYMBOLS</strong> <em>(package)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the list of symbols that have been declared as shadowing symbols
|
||||||
|
in PACKAGE.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-INTERN"></a>Function: <strong>INTERN</strong> <em>(name &optional (package *package*))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns a symbol having the specified name, creating it if necessary.
|
||||||
|
Returns as the second value one of the symbols :INTERNAL, :EXTERNAL,
|
||||||
|
:INHERITED, and NIL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-EXPORT"></a>Function: <strong>EXPORT</strong> <em>(symbols &optional (package *package*))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Makes SYMBOLS external symbols of PACKAGE. SYMBOLS must be a list of symbols
|
||||||
|
or a symbol.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-PACKAGEP"></a>Function: <strong>PACKAGEP</strong> <em>(x)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if X is a package; NIL otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-SYMBOL_002dFUNCTION"></a>Function: <strong>SYMBOL-FUNCTION</strong> <em>(symbol)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the current global function definition named by SYMBOL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-SYMBOL_002dVALUE"></a>Function: <strong>SYMBOL-VALUE</strong> <em>(symbol)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the current value of the dynamic (special) variable named by SYMBOL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-BOUNDP"></a>Function: <strong>BOUNDP</strong> <em>(symbol)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if the global variable named by SYMBOL has a value; NIL otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-DOCUMENTATION"></a>Function: <strong>DOCUMENTATION</strong> <em>(symbol doc-type)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the doc-string of DOC-TYPE for SYMBOL; NIL if none exists.
|
||||||
|
Possible doc-types are:
|
||||||
|
FUNCTION (special forms, macros, and functions)
|
||||||
|
VARIABLE (dynamic variables, including constants)
|
||||||
|
TYPE (types defined by DEFTYPE)
|
||||||
|
STRUCTURE (structures defined by DEFSTRUCT)
|
||||||
|
SETF (SETF methods defined by DEFSETF, DEFINE-SETF-METHOD, and
|
||||||
|
DEFINE-MODIFY-MACRO)
|
||||||
|
All built-in special forms, macros, functions, and variables have their
|
||||||
|
doc-strings.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-GENTEMP"></a>Function: <strong>GENTEMP</strong> <em>(&optional (prefix "t") (package *package*))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Creates a new symbol interned in the package PACKAGE with the given PREFIX.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-RENAME_002dPACKAGE"></a>Function: <strong>RENAME-PACKAGE</strong> <em>(package new-name &optional (new-nicknames nil))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Replaces the old name and nicknames of PACKAGE with NEW-NAME and
|
||||||
|
NEW-NICKNAMES.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-UNINTERN"></a>Function: <strong>UNINTERN</strong> <em>(symbol &optional (package *package*))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Makes SYMBOL no longer present in PACKAGE. Returns T if SYMBOL was present;
|
||||||
|
NIL otherwise. If PACKAGE is the home package of SYMBOL, then makes SYMBOL
|
||||||
|
uninterned.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-UNEXPORT"></a>Function: <strong>UNEXPORT</strong> <em>(symbols &optional (package *package*))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Makes SYMBOLS no longer accessible as external symbols in PACKAGE. SYMBOLS
|
||||||
|
must be a list of symbols or a symbol.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-PACKAGE_002dNICKNAMES"></a>Function: <strong>PACKAGE-NICKNAMES</strong> <em>(package)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns as a list the nickname strings for the specified PACKAGE.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-IMPORT"></a>Function: <strong>IMPORT</strong> <em>(symbols &optional (package *package*))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Makes SYMBOLS internal symbols of PACKAGE. SYMBOLS must be a list of symbols
|
||||||
|
or a symbol.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-GET"></a>Function: <strong>GET</strong> <em>(symbol indicator &optional (default nil))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Looks on the property list of SYMBOL for the specified INDICATOR. If this
|
||||||
|
is found, returns the associated value. Otherwise, returns DEFAULT.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-FIND_002dALL_002dSYMBOLS"></a>Function: <strong>FIND-ALL-SYMBOLS</strong> <em>(string-or-symbol)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns a list of all symbols that have the specified name.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-FMAKUNBOUND"></a>Function: <strong>FMAKUNBOUND</strong> <em>(symbol)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Discards the global function definition named by SYMBOL. Returns SYMBOL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-PACKAGE_002dNAME"></a>Function: <strong>PACKAGE-NAME</strong> <em>(package)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the string that names the specified PACKAGE.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-FIND_002dPACKAGE"></a>Function: <strong>FIND-PACKAGE</strong> <em>(name)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the specified package if it already exists; NIL otherwise. NAME may
|
||||||
|
be a string that is the name or nickname of the package. NAME may also be
|
||||||
|
a symbol, in which case the symbol’s print name is used.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-APROPOS_002dLIST"></a>Function: <strong>APROPOS-LIST</strong> <em>(string &optional (package nil))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns, as a list, all symbols whose print-names contain STRING as substring.
|
||||||
|
If PACKAGE is non-NIL, then only the specified package is searched.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Operating-System.html#Operating-System" accesskey="n" rel="next">Operating System</a>, Previous: <a href="Compilation.html#Compilation" accesskey="p" rel="prev">Compilation</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,197 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL SI Manual: Type</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL SI Manual: Type">
|
||||||
|
<meta name="keywords" content="GCL SI Manual: Type">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
|
||||||
|
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="index.html#Top" rel="up" title="Top">
|
||||||
|
<link href="GCL-Specific.html#GCL-Specific" rel="next" title="GCL Specific">
|
||||||
|
<link href="Doc.html#Doc" rel="prev" title="Doc">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Type"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="GCL-Specific.html#GCL-Specific" accesskey="n" rel="next">GCL Specific</a>, Previous: <a href="Doc.html#Doc" accesskey="p" rel="prev">Doc</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Type-1"></a>
|
||||||
|
<h2 class="chapter">14 Type</h2>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-COERCE"></a>Function: <strong>COERCE</strong> <em>(x type)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Coerces X to an object of the type TYPE.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-TYPE_002dOF"></a>Function: <strong>TYPE-OF</strong> <em>(x)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns the type of X.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CONSTANTP"></a>Function: <strong>CONSTANTP</strong> <em>(symbol)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if the variable named by SYMBOL is a constant; NIL otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-TYPEP"></a>Function: <strong>TYPEP</strong> <em>(x type)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if X is of the type TYPE; NIL otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-COMMONP"></a>Function: <strong>COMMONP</strong> <em>(x)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if X is a Common Lisp object; NIL otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-SUBTYPEP"></a>Function: <strong>SUBTYPEP</strong> <em>(type1 type2)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns T if TYPE1 is a subtype of TYPE2; NIL otherwise. If it could not
|
||||||
|
determine, then returns NIL as the second value. Otherwise, the second value
|
||||||
|
is T.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CHECK_002dTYPE"></a>Macro: <strong>CHECK-TYPE</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Syntax:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(check-type place typespec [string])
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Signals an error, if the contents of PLACE are not of the specified type.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-ASSERT"></a>Macro: <strong>ASSERT</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Syntax:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(assert test-form [({place}*) [string {arg}*]])
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Signals an error if the value of TEST-FORM is NIL. STRING is an format string
|
||||||
|
used as the error message. ARGs are arguments to the format string.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-DEFTYPE"></a>Macro: <strong>DEFTYPE</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Syntax:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(deftype name lambda-list {decl | doc}* {form}*)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Defines a new type-specifier abbreviation in terms of an ’expansion’ function
|
||||||
|
(lambda lambda-list1 {decl}* {form}*)
|
||||||
|
where lambda-list1 is identical to LAMBDA-LIST except that all optional
|
||||||
|
parameters with no default value specified in LAMBDA-LIST defaults to the
|
||||||
|
symbol ’*’, but not to NIL. When the type system of GCL encounters a
|
||||||
|
type specifier (NAME arg1 ... argn), it calls the expansion function with
|
||||||
|
the arguments arg1 ... argn, and uses the returned value instead of the
|
||||||
|
original type specifier. When the symbol NAME is used as a type specifier,
|
||||||
|
the expansion function is called with no argument. The doc-string DOC, if
|
||||||
|
supplied, is saved as the TYPE doc of NAME, and is retrieved by
|
||||||
|
(documentation ’NAME ’type).
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-DYNAMIC_002dEXTENT"></a>Declaration: <strong>DYNAMIC-EXTENT</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
Declaration to allow locals to be cons’d on the C stack.
|
||||||
|
For example
|
||||||
|
(defun foo (&rest l) (declare (:dynamic-extent l)) ...)
|
||||||
|
will cause l to be a list formed on the C stack of the foo function
|
||||||
|
frame.
|
||||||
|
Of course passing L out as a value of foo will cause havoc.
|
||||||
|
(setq x (make-list n))
|
||||||
|
(setq x (cons a b))
|
||||||
|
(setq x (list a b c ..))
|
||||||
|
also are handled on the stack, for dynamic-extent x.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="GCL-Specific.html#GCL-Specific" accesskey="n" rel="next">GCL Specific</a>, Previous: <a href="Doc.html#Doc" accesskey="p" rel="prev">Doc</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,485 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL SI Manual: User Interface</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL SI Manual: User Interface">
|
||||||
|
<meta name="keywords" content="GCL SI Manual: User Interface">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
|
||||||
|
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="index.html#Top" rel="up" title="Top">
|
||||||
|
<link href="Doc.html#Doc" rel="next" title="Doc">
|
||||||
|
<link href="Iteration-and-Tests.html#Iteration-and-Tests" rel="prev" title="Iteration and Tests">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="User-Interface"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Doc.html#Doc" accesskey="n" rel="next">Doc</a>, Previous: <a href="Iteration-and-Tests.html#Iteration-and-Tests" accesskey="p" rel="prev">Iteration and Tests</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="User-Interface-1"></a>
|
||||||
|
<h2 class="chapter">12 User Interface</h2>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002d-1"></a>Special Variable: <strong>-</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
Holds the top-level form that GCL is currently evaluating.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002d"></a>Function: <strong>-</strong> <em>(number &rest more-numbers)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Subtracts the second and all subsequent NUMBERs from the first NUMBER.
|
||||||
|
With one arg, negates it.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-UNTRACE"></a>Macro: <strong>UNTRACE</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Syntax:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(untrace {function-name}*)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Removes tracing from the specified functions. With no FUNCTION-NAMEs,
|
||||||
|
untraces all functions.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002a_002a_002a"></a>Variable: <strong>***</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
Gets the previous value of ** when GCL evaluates a top-level form.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-MAKE_002dSTRING_002dINPUT_002dSTREAM-1"></a>Function: <strong>MAKE-STRING-INPUT-STREAM</strong> <em>(string &optional (start 0) (end (length string)))</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Returns an input stream which will supply the characters of String between
|
||||||
|
Start and End in order.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-STEP"></a>Macro: <strong>STEP</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Syntax:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(step form)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Evaluates FORM in the single-step mode and returns the value.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002aBREAK_002dENABLE_002a"></a>Variable: <strong>*BREAK-ENABLE*</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
GCL specific: When an error occurrs, control enters to the break loop only
|
||||||
|
if the value of this variable is non-NIL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002f-1"></a>Special Variable: <strong>/</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
Holds a list of the values of the last top-level form.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-DESCRIBE"></a>Function: <strong>DESCRIBE</strong> <em>(x)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Prints a description of the object X.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-ED"></a>Function: <strong>ED</strong> <em>(&optional x)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Invokes the editor. The action depends on the version of GCL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002aDEBUG_002dIO_002a"></a>Variable: <strong>*DEBUG-IO*</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
Holds the I/O stream used by the GCL debugger.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002aBREAK_002dON_002dWARNINGS_002a"></a>Variable: <strong>*BREAK-ON-WARNINGS*</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
When the function WARN is called, control enters to the break loop only
|
||||||
|
if the value of this varialbe is non-NIL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-CERROR"></a>Function: <strong>CERROR</strong> <em>(continue-format-string error-format-string &rest args)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Signals a correctable error.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002a_002a"></a>Variable: <strong>**</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
Gets the previous value of * when GCL evaluates a top-level form.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002b_002b_002b"></a>Special Variable: <strong>+++</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
Gets the previous value of ++ when GCL evaluates a top-level form.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-INSPECT"></a>Function: <strong>INSPECT</strong> <em>(x)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Shows the information about the object X in an interactive manner
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002f_002f"></a>Special Variable: <strong>//</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
Gets the previous value of / when GCL evaluates a top-level form.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002aTRACE_002dOUTPUT_002a"></a>Variable: <strong>*TRACE-OUTPUT*</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
The trace output stream.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002b_002b"></a>Special Variable: <strong>++</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
Gets the previous value of + when GCL evaluates a top-level form.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002aERROR_002dOUTPUT_002a"></a>Variable: <strong>*ERROR-OUTPUT*</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
Holds the output stream for error messages.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-DRIBBLE"></a>Function: <strong>DRIBBLE</strong> <em>(&optional pathname)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>If PATHNAME is given, begins to record the interaction to the specified file.
|
||||||
|
If PATHNAME is not given, ends the recording.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002a-1"></a>Variable: <strong>*</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
Holds the value of the last top-level form.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002f_002f_002f"></a>Special Variable: <strong>///</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
Gets the previous value of // when GCL evaluates a top-level form.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-WARN"></a>Function: <strong>WARN</strong> <em>(format-string &rest args)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Formats FORMAT-STRING and ARGs to *ERROR-OUTPUT* as a warning message.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-BREAK"></a>Function: <strong>BREAK</strong> <em>(&optional (format-string nil) &rest args)</em></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Enters a break loop. If FORMAT-STRING is non-NIL, formats FORMAT-STRING
|
||||||
|
and ARGS to *ERROR-OUTPUT* before entering a break loop.
|
||||||
|
Typing :HELP at the break loop will list the break-loop commands.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-_002b-1"></a>Special Variable: <strong>+</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
Holds the last top-level form.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a name="index-TRACE"></a>Macro: <strong>TRACE</strong></dt>
|
||||||
|
<dd><p>Package:LISP
|
||||||
|
</p>
|
||||||
|
<p>Syntax:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(trace {function-name}*)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Traces the specified functions. With no FUNCTION-NAMEs, returns a list of
|
||||||
|
functions currently being traced.
|
||||||
|
</p>
|
||||||
|
<p>Additional Keywords are allowed in GCL with the
|
||||||
|
syntax (trace {fn | (fn {:kw form}*)}*)
|
||||||
|
</p>
|
||||||
|
<p>For each FN naming a function, traces that function. Each :KW should
|
||||||
|
be one of the ones listed below, and FORM should have the
|
||||||
|
corresponding form. No :KW may be given more than once for the same
|
||||||
|
FN. Returns a list of all FNs now traced which weren’t already
|
||||||
|
traced.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>EXAMPLE (Try this with your favorite factorial function FACT):
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">;; print entry args and exit values
|
||||||
|
|
||||||
|
(trace FACT)
|
||||||
|
|
||||||
|
;; Break coming out of FACT if the value is bigger than 1000.
|
||||||
|
|
||||||
|
(trace (fact :exit
|
||||||
|
(progn
|
||||||
|
(if (> (car values) 1000)(break "big result"))
|
||||||
|
(car values))))
|
||||||
|
|
||||||
|
;; Hairy example:
|
||||||
|
|
||||||
|
;;make arglist available without the si:: prefix
|
||||||
|
(import 'si::arglist)
|
||||||
|
|
||||||
|
(trace (fact
|
||||||
|
:DECLARATIONS
|
||||||
|
((in-string "Here comes input: ")
|
||||||
|
(out-string "Here comes output: ")
|
||||||
|
all-values
|
||||||
|
(silly (+ 3 4)))
|
||||||
|
:COND
|
||||||
|
(equal (rem (car arglist) 2) 0)
|
||||||
|
:ENTRY
|
||||||
|
(progn
|
||||||
|
(cond
|
||||||
|
((equal (car arglist) 8)
|
||||||
|
(princ "Entering FACT on input 8!! ")
|
||||||
|
(setq out-string "Here comes output from inside (FACT 8): "))
|
||||||
|
(t
|
||||||
|
(princ in-string)))
|
||||||
|
(car arglist))
|
||||||
|
:EXIT
|
||||||
|
(progn
|
||||||
|
(setq all-values (cons (car values) all-values))
|
||||||
|
(princ out-string)
|
||||||
|
(when (equal (car arglist) 8)
|
||||||
|
;; reset out-string
|
||||||
|
(setq out-string "Here comes output: "))
|
||||||
|
(cons 'fact values))
|
||||||
|
:ENTRYCOND
|
||||||
|
(not (= (car arglist) 6))
|
||||||
|
:EXITCOND
|
||||||
|
(not (= (car values) (* 6 (car arglist))))
|
||||||
|
:DEPTH
|
||||||
|
5))
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Syntax is <code>:keyword</code> <i>form1</i> <code>:keyword</code> <i>form2</i> ...
|
||||||
|
</p>
|
||||||
|
<dl compact="compact">
|
||||||
|
<dt><code>:declarations</code></dt>
|
||||||
|
<dd><div class="example">
|
||||||
|
<pre class="example">DEFAULT: NIL
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>FORM is ((var1 form1 )(var2 form2 )...), where
|
||||||
|
the var_i are symbols distinct from each other and from
|
||||||
|
all symbols which are similarly declared for currently
|
||||||
|
traced functions. Each form is evaluated immediately.
|
||||||
|
Upon any invocation of a traced function when not already
|
||||||
|
inside a traced function call, each var is bound to
|
||||||
|
that value of form .
|
||||||
|
</p>
|
||||||
|
</dd>
|
||||||
|
<dt><code>:COND</code></dt>
|
||||||
|
<dd><div class="example">
|
||||||
|
<pre class="example">DEFAULT: T
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Here, FORM is any Lisp form to be evaluated (by EVAL)
|
||||||
|
upon entering a call of FN, in the environment where si::ARGLIST
|
||||||
|
is bound to the current list of arguments of FN. Note that
|
||||||
|
even if the evaluation of FORM changes the value of SI::ARGLIST
|
||||||
|
(e.g. by evaluation of (SETQ si::ARGLIST ...)), the list of
|
||||||
|
arguments passed to FN is unchanged. Users may alter args passed
|
||||||
|
by destructively modifying the list structure of SI::ARGLIST
|
||||||
|
however. The call is traced
|
||||||
|
(thus invoking the :ENTRYCOND and :EXITCOND forms, at least)
|
||||||
|
if and only if FORM does not evaluate to NIL.
|
||||||
|
</p>
|
||||||
|
</dd>
|
||||||
|
<dt><code>:ENTRYCOND</code></dt>
|
||||||
|
<dd><div class="example">
|
||||||
|
<pre class="example">DEFAULT: T
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>This is evaluated (by EVAL) if the :COND form evaluates to
|
||||||
|
non-NIL, both in an environment where SI::ARGLIST is bound to the
|
||||||
|
current list of arguments of FN. If non-NIL, the :ENTRY form
|
||||||
|
is then evaluated and printed with the trace "prompt".
|
||||||
|
</p>
|
||||||
|
</dd>
|
||||||
|
<dt><code>:ENTRY</code></dt>
|
||||||
|
<dd><div class="example">
|
||||||
|
<pre class="example">DEFAULT: (CONS (QUOTE x) SI::ARGLIST),
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>where x is the symbol we call FN
|
||||||
|
If the :COND and :ENTRYCOND forms evaluate to non-NIL,
|
||||||
|
then the trace "prompt" is printed and then this FORM is
|
||||||
|
evaluated (by EVAL) in an environment where SI::ARGLIST is bound
|
||||||
|
to the current list of arguments of FN. The result is then
|
||||||
|
printed.
|
||||||
|
</p>
|
||||||
|
</dd>
|
||||||
|
<dt><code>:EXITCOND</code></dt>
|
||||||
|
<dd><div class="example">
|
||||||
|
<pre class="example">DEFAULT: T
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>This is evaluated (by EVAL) in the environment described
|
||||||
|
below for the :EXIT form. The :EXIT form is then evaluated
|
||||||
|
and printed with the "prompt" if and only if the result here
|
||||||
|
is non-NIL.
|
||||||
|
</p>
|
||||||
|
</dd>
|
||||||
|
<dt><code>:EXIT</code></dt>
|
||||||
|
<dd><div class="example">
|
||||||
|
<pre class="example">DEFAULT: (CONS (QUOTE x) VALUES),
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>where x is the symbol we call FN
|
||||||
|
Upon exit from tracing a given call, this FORM is
|
||||||
|
evaluated (after the appropriate trace "prompt" is printed),
|
||||||
|
using EVAL in an environment where SI::ARGLIST is bound to the
|
||||||
|
current list of arguments of FN and VALUES is bound to the
|
||||||
|
list of values returned by FN (recalling that Common Lisp
|
||||||
|
functions may return multiple values).
|
||||||
|
</p>
|
||||||
|
</dd>
|
||||||
|
<dt><code>:DEPTH</code></dt>
|
||||||
|
<dd><div class="example">
|
||||||
|
<pre class="example">DEFAULT: No depth limit
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>FORM is simply a positive integer specifying the maximum
|
||||||
|
nesting of traced calls of FN, i.e. of calls of FN in which
|
||||||
|
the :COND form evaluated to non-NIL. For calls of FN in
|
||||||
|
which this limit is exceeded, even the :COND form is not
|
||||||
|
evaluated, and the call is not traced.
|
||||||
|
</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Doc.html#Doc" accesskey="n" rel="next">Doc</a>, Previous: <a href="Iteration-and-Tests.html#Iteration-and-Tests" accesskey="p" rel="prev">Iteration and Tests</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,160 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL SI Manual: Top</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL SI Manual: Top">
|
||||||
|
<meta name="keywords" content="GCL SI Manual: Top">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
|
||||||
|
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="http://www.csci.viu.ca/~wesselsd/courses/csci330/code/lisp/dir/index.html" rel="up" title="(dir)">
|
||||||
|
<link href="Numbers.html#Numbers" rel="next" title="Numbers">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="Top"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Numbers.html#Numbers" accesskey="n" rel="next">Numbers</a>, Previous: <a href="http://www.csci.viu.ca/~wesselsd/courses/csci330/code/lisp/dir/index.html" accesskey="p" rel="prev">(dir)</a>, Up: <a href="http://www.csci.viu.ca/~wesselsd/courses/csci330/code/lisp/dir/index.html" accesskey="u" rel="up">(dir)</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="SEC_Top"></a>
|
||||||
|
|
||||||
|
<table class="menu" border="0" cellspacing="0">
|
||||||
|
<tr><td align="left" valign="top">• <a href="Numbers.html#Numbers" accesskey="1">Numbers</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Sequences-and-Arrays-and-Hash-Tables.html#Sequences-and-Arrays-and-Hash-Tables" accesskey="2">Sequences and Arrays and Hash Tables</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Characters.html#Characters" accesskey="3">Characters</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Lists.html#Lists" accesskey="4">Lists</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Streams-and-Reading.html#Streams-and-Reading" accesskey="5">Streams and Reading</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Special-Forms-and-Functions.html#Special-Forms-and-Functions" accesskey="6">Special Forms and Functions</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Compilation.html#Compilation" accesskey="7">Compilation</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Symbols.html#Symbols" accesskey="8">Symbols</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Operating-System.html#Operating-System" accesskey="9">Operating System</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Structures.html#Structures">Structures</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Iteration-and-Tests.html#Iteration-and-Tests">Iteration and Tests</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="User-Interface.html#User-Interface">User Interface</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Doc.html#Doc">Doc</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Type.html#Type">Type</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="GCL-Specific.html#GCL-Specific">GCL Specific</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="C-Interface.html#C-Interface">C Interface</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="System-Definitions.html#System-Definitions">System Definitions</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Debugging.html#Debugging">Debugging</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Miscellaneous.html#Miscellaneous">Miscellaneous</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Compiler-Definitions.html#Compiler-Definitions">Compiler Definitions</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Function-and-Variable-Index.html#Function-and-Variable-Index">Function and Variable Index</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
|
||||||
|
— The Detailed Node Listing —
|
||||||
|
|
||||||
|
Operating System
|
||||||
|
|
||||||
|
</pre></th></tr><tr><td align="left" valign="top">• <a href="Command-Line.html#Command-Line">Command Line</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Operating-System-Definitions.html#Operating-System-Definitions">Operating System Definitions</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
|
||||||
|
GCL Specific
|
||||||
|
|
||||||
|
</pre></th></tr><tr><td align="left" valign="top">• <a href="Bignums.html#Bignums">Bignums</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
|
||||||
|
C Interface
|
||||||
|
|
||||||
|
</pre></th></tr><tr><td align="left" valign="top">• <a href="Available-Symbols.html#Available-Symbols">Available Symbols</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
|
||||||
|
System Definitions
|
||||||
|
|
||||||
|
</pre></th></tr><tr><td align="left" valign="top">• <a href="Regular-Expressions.html#Regular-Expressions">Regular Expressions</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
|
||||||
|
Debugging
|
||||||
|
|
||||||
|
</pre></th></tr><tr><td align="left" valign="top">• <a href="Source-Level-Debugging-in-Emacs.html#Source-Level-Debugging-in-Emacs">Source Level Debugging in Emacs</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Low-Level-Debug-Functions.html#Low-Level-Debug-Functions">Low Level Debug Functions</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
|
||||||
|
Miscellaneous
|
||||||
|
|
||||||
|
</pre></th></tr><tr><td align="left" valign="top">• <a href="Environment.html#Environment">Environment</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Inititialization.html#Inititialization">Inititialization</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Low-Level-X-Interface.html#Low-Level-X-Interface">Low Level X Interface</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Numbers.html#Numbers" accesskey="n" rel="next">Numbers</a>, Previous: <a href="http://www.csci.viu.ca/~wesselsd/courses/csci330/code/lisp/dir/index.html" accesskey="p" rel="prev">(dir)</a>, Up: <a href="http://www.csci.viu.ca/~wesselsd/courses/csci330/code/lisp/dir/index.html" accesskey="u" rel="up">(dir)</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,160 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL TK Manual: Argument Lists</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL TK Manual: Argument Lists">
|
||||||
|
<meta name="keywords" content="GCL TK Manual: Argument Lists">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="wm.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="General.html#General" rel="up" title="General">
|
||||||
|
<link href="Lisp-Functions-Invoked-from-Graphics.html#Lisp-Functions-Invoked-from-Graphics" rel="next" title="Lisp Functions Invoked from Graphics">
|
||||||
|
<link href="Return-Values.html#Return-Values" rel="prev" title="Return Values">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Argument-Lists"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Lisp-Functions-Invoked-from-Graphics.html#Lisp-Functions-Invoked-from-Graphics" accesskey="n" rel="next">Lisp Functions Invoked from Graphics</a>, Previous: <a href="Return-Values.html#Return-Values" accesskey="p" rel="prev">Return Values</a>, Up: <a href="General.html#General" accesskey="u" rel="up">General</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Argument-Lists-1"></a>
|
||||||
|
<h3 class="section">1.5 Argument Lists</h3>
|
||||||
|
|
||||||
|
<a name="Widget-Functions"></a>
|
||||||
|
<h4 class="subsection">1.5.1 Widget Functions</h4>
|
||||||
|
|
||||||
|
<p>The rule is that the first argument for a widget function is a keyword,
|
||||||
|
called the <i>option</i>. The pattern of the remaining arguments depends
|
||||||
|
completely
|
||||||
|
on the <i>option</i> argument. Thus
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(.hello <i>option</i> ?arg1? ?arg2? ...)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>One <i>option</i> which is permitted for every widget function is
|
||||||
|
<code>:configure</code>. The argument pattern following it is the same
|
||||||
|
keyword/value pair list which is used in widget creation. For a
|
||||||
|
<code>button</code> widget, the other valid options are <code>:deactivate</code>,
|
||||||
|
<code>:flash</code>, and <code>:invoke</code>. To find these, since
|
||||||
|
<code>.hello</code> was constructed with the <code>button</code> constructor, you
|
||||||
|
should see See <a href="button.html#button">button</a>.
|
||||||
|
The argument pattern for other options depends completely on the option
|
||||||
|
and the widget function.
|
||||||
|
For example if <code>.scrollbar</code> is a scroll bar window, then the option
|
||||||
|
<code>:set</code> must be followed by 4 numeric arguments, which indicate how
|
||||||
|
the scrollbar should be displayed, see See <a href="scrollbar.html#scrollbar">scrollbar</a>.
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(.scrollbar :set a1 a2 a3 a4)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>If on the other hand <code>.scale</code> is a scale (see <a href="scale.html#scale">scale</a>), then we have
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(.scale :set a1 )
|
||||||
|
</pre></div>
|
||||||
|
<p>only one numeric argument should be supplied, in order to position the
|
||||||
|
scale.
|
||||||
|
</p>
|
||||||
|
<a name="Widget-Constructor-Argument-Lists"></a>
|
||||||
|
<h4 class="subsection">1.5.2 Widget Constructor Argument Lists</h4>
|
||||||
|
|
||||||
|
<p>These are
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(widget-constructor <i>pathname</i> :keyword1 value1 :keyword2 value2 ...)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>to create the widget whose name is <i>pathname</i>. The possible keywords
|
||||||
|
allowed are specified in the corresponding section of See <a href="Widgets.html#Widgets">Widgets</a>.
|
||||||
|
</p>
|
||||||
|
<a name="Concatenation-Using-_0060_003a_0027-in-Argument-List"></a>
|
||||||
|
<h4 class="subsection">1.5.3 Concatenation Using ‘:’ in Argument List</h4>
|
||||||
|
|
||||||
|
<p>What has been said so far about arguments is not quite true. A
|
||||||
|
special string concatenation construction is allowed in argument lists
|
||||||
|
for widgets, widget constructors and control functions.
|
||||||
|
</p>
|
||||||
|
<p>First we introduce the function <code>tk-conc</code> which takes an arbitrary
|
||||||
|
number of arguments, which may be symbols, strings or numbers, and
|
||||||
|
concatenates these into a string. The print names of symbols are
|
||||||
|
converted to lower case, and package names are ignored.
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(tk-conc "a" 1 :b 'cd "e") ==> "a1bcde"
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>One could use <code>tk-conc</code> to construct arguments for widget
|
||||||
|
functions. But even though <code>tk-conc</code> has been made quite
|
||||||
|
efficient, it still would involve the creation of a string. The
|
||||||
|
<code>:</code> construct avoids this. In a call to a widget function,
|
||||||
|
a widget constructor, or a control function you may remove the call to
|
||||||
|
<code>tk-conc</code> and place <code>:</code> in between each of its arguments.
|
||||||
|
Those functions are able to understand this and treat the extra
|
||||||
|
arguments as if they were glued together in one string, but without
|
||||||
|
the extra cost of actually forming that string.
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(tk-conc a b c .. w) <==> a : b : c : ... w
|
||||||
|
(setq i 10)
|
||||||
|
(.hello :configure :text i : " pies")
|
||||||
|
(.hello :configure :text (tk-conc i " pies"))
|
||||||
|
(.hello :configure :text (format nil "~a pies" i))
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>The last three examples would all result in the text string being
|
||||||
|
<code>"10 pies"</code>, but the first method is the most efficient.
|
||||||
|
That call will be made with no string or cons creation. The
|
||||||
|
<b>GC Monitor</b> example, is written in such a way that there is no
|
||||||
|
creation of <code>cons</code> or <code>string</code> types during normal operation.
|
||||||
|
This is particularly useful in that case, since one is trying to
|
||||||
|
monitor usage of conses by other programs, not its own usage.
|
||||||
|
</p>
|
||||||
|
<hr>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Lisp-Functions-Invoked-from-Graphics.html#Lisp-Functions-Invoked-from-Graphics" accesskey="n" rel="next">Lisp Functions Invoked from Graphics</a>, Previous: <a href="Return-Values.html#Return-Values" accesskey="p" rel="prev">Return Values</a>, Up: <a href="General.html#General" accesskey="u" rel="up">General</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,163 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL TK Manual: Common Features of Widgets</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL TK Manual: Common Features of Widgets">
|
||||||
|
<meta name="keywords" content="GCL TK Manual: Common Features of Widgets">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="wm.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="General.html#General" rel="up" title="General">
|
||||||
|
<link href="Return-Values.html#Return-Values" rel="next" title="Return Values">
|
||||||
|
<link href="Getting-Started.html#Getting-Started" rel="prev" title="Getting Started">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Common-Features-of-Widgets"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Return-Values.html#Return-Values" accesskey="n" rel="next">Return Values</a>, Previous: <a href="Getting-Started.html#Getting-Started" accesskey="p" rel="prev">Getting Started</a>, Up: <a href="General.html#General" accesskey="u" rel="up">General</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Common-Features-of-Widgets-1"></a>
|
||||||
|
<h3 class="section">1.3 Common Features of Widgets</h3>
|
||||||
|
|
||||||
|
<p>A <i>widget</i> is a lisp symbol which has a function binding. The
|
||||||
|
first argument is always a keyword and is called the <i>option</i>.
|
||||||
|
The argument pattern for the remaining arguments depends on the
|
||||||
|
<i>option</i>. The most common <i>option</i> is <code>:configure</code> in
|
||||||
|
which case the remaining arguments are alternating keyword/value
|
||||||
|
pairs, with the same keywords being permitted as at the creation
|
||||||
|
of the widget.
|
||||||
|
</p>
|
||||||
|
<p>A <i>widget</i> is created by means of a <i>widget constructor</i>, of
|
||||||
|
which there are currently 15, each of them appearing as the title of a
|
||||||
|
section in <a href="Widgets.html#Widgets">Widgets</a>. They live in the <code>"TK"</code> package, and for
|
||||||
|
the moment we will assume we have switched to this package. Thus for
|
||||||
|
example <code>button</code> is such a widget constructor function. Of course
|
||||||
|
this is lisp, and you can make your own widget constructors, but when
|
||||||
|
you do so it is a good idea to follow the standard argument patterns
|
||||||
|
that are outlined in this section.
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(button '.hello)
|
||||||
|
==> .HELLO
|
||||||
|
</pre></div>
|
||||||
|
<p>creates a <i>widget</i> whose name is <code>.hello</code>. There is a parent child
|
||||||
|
hierarchy among widgets which is implicit in the name used for the
|
||||||
|
widget. This is much like the pathname structure on a Unix or Dos
|
||||||
|
file system, except that <code>'.'</code> is used as the separator rather
|
||||||
|
than a <code>/</code> or <code>\</code>. For this reason the widget instances
|
||||||
|
are sometimes referred to as <i>pathnames</i>. A child of the
|
||||||
|
parent widget <code>.hello</code> might be called <code>.hello.joe</code>, and
|
||||||
|
a child of this last might be <code>.hello.joe.bar</code>. The parent of
|
||||||
|
everyone is called <code>.</code> . Multiple top level windows are created
|
||||||
|
using the <code>toplevel</code> command (see <a href="toplevel.html#toplevel">toplevel</a>).
|
||||||
|
</p>
|
||||||
|
<p>The widget constructor functions take keyword and value pairs, which
|
||||||
|
allow you to specify attributes at the time of creation:
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(button '.hello :text "Hello World" :width 20)
|
||||||
|
==>.HELLO
|
||||||
|
</pre></div>
|
||||||
|
<p>indicating that we want the text in the button window to be
|
||||||
|
<code>Hello World</code> and the width of the window to be 20 characters
|
||||||
|
wide. Other types of windows allow specification in centimeters
|
||||||
|
<code>2c</code>, or in inches (<code>2i</code>) or in millimeters <code>2m</code>
|
||||||
|
or in pixels <code>2</code>. But text windows usually have their
|
||||||
|
dimensions specified as multiples of a character width and height.
|
||||||
|
This latter concept is called a grid.
|
||||||
|
</p>
|
||||||
|
<p>Once the window has been created, if you want to change the
|
||||||
|
text you do NOT do:
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(button '.hello :text "Bye World" :width 20)
|
||||||
|
</pre></div>
|
||||||
|
<p>This would be in error, because the window .hello already exists.
|
||||||
|
You would either have to first call
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(destroy '.hello)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>But usually you just want to change an attribute. <code>.hello</code> is
|
||||||
|
actually a function, as we mentioned earlier, and it is this function
|
||||||
|
that you use:
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(.hello :configure :text "Bye World")
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>This would simply change the text, and not change where the window had
|
||||||
|
been placed on the screen (if it had), or how it had been packed
|
||||||
|
into the window hierarchy. Here the argument <code>:configure</code> is
|
||||||
|
called an <i>option</i>, and it specifies which types of keywords can
|
||||||
|
follow it. For example
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(.hello :flash)
|
||||||
|
</pre></div>
|
||||||
|
<p>is also valid, but in this case the <code>:text</code> keyword is not permitted
|
||||||
|
after flash. If it were, then it would mean something else besides
|
||||||
|
what it means in the above. For example one might have defined
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(.hello :flash :text "PUSH ME")
|
||||||
|
</pre></div>
|
||||||
|
<p>so here the same keyword <code>:text</code> would mean something else, eg
|
||||||
|
to flash a subliminal message on the screen.
|
||||||
|
</p>
|
||||||
|
<p>We often refer to calls to the widget functions
|
||||||
|
as messages. One reason for this is that they actually turn into
|
||||||
|
messages to the graphics process <samp>gcltksrv</samp>. To actually see these
|
||||||
|
messages you can do
|
||||||
|
</p><div class="example">
|
||||||
|
<pre class="example">(debugging t).
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Return-Values.html#Return-Values" accesskey="n" rel="next">Return Values</a>, Previous: <a href="Getting-Started.html#Getting-Started" accesskey="p" rel="prev">Getting Started</a>, Up: <a href="General.html#General" accesskey="u" rel="up">General</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,117 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL TK Manual: Control</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL TK Manual: Control">
|
||||||
|
<meta name="keywords" content="GCL TK Manual: Control">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="wm.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="index.html#Top" rel="up" title="Top">
|
||||||
|
<link href="after.html#after" rel="next" title="after">
|
||||||
|
<link href="toplevel.html#toplevel" rel="prev" title="toplevel">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Control"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Previous: <a href="Widgets.html#Widgets" accesskey="p" rel="prev">Widgets</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Control-1"></a>
|
||||||
|
<h2 class="chapter">3 Control</h2>
|
||||||
|
|
||||||
|
<table class="menu" border="0" cellspacing="0">
|
||||||
|
<tr><td align="left" valign="top">• <a href="after.html#after" accesskey="1">after</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="bind.html#bind" accesskey="2">bind</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="destroy.html#destroy" accesskey="3">destroy</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="tk_002ddialog.html#tk_002ddialog" accesskey="4">tk-dialog</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="exit.html#exit" accesskey="5">exit</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="focus.html#focus" accesskey="6">focus</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="grab.html#grab" accesskey="7">grab</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="tk_002dlistbox_002dsingle_002dselect.html#tk_002dlistbox_002dsingle_002dselect" accesskey="8">tk-listbox-single-select</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="lower.html#lower" accesskey="9">lower</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="tk_002dmenu_002dbar.html#tk_002dmenu_002dbar">tk-menu-bar</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="option.html#option">option</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="options.html#options">options</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="pack_002dold.html#pack_002dold">pack-old</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="pack.html#pack">pack</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="place.html#place">place</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="raise.html#raise">raise</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="selection.html#selection">selection</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="send.html#send">send</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="tk.html#tk">tk</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="tkerror.html#tkerror">tkerror</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="tkvars.html#tkvars">tkvars</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="tkwait.html#tkwait">tkwait</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="update.html#update">update</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="winfo.html#winfo">winfo</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="wm.html#wm">wm</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,83 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL TK Manual: General</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL TK Manual: General">
|
||||||
|
<meta name="keywords" content="GCL TK Manual: General">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="wm.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="index.html#Top" rel="up" title="Top">
|
||||||
|
<link href="Introduction.html#Introduction" rel="next" title="Introduction">
|
||||||
|
<link href="index.html#Top" rel="prev" title="Top">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="General"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Widgets.html#Widgets" accesskey="n" rel="next">Widgets</a>, Previous: <a href="index.html#Top" accesskey="p" rel="prev">Top</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="General-1"></a>
|
||||||
|
<h2 class="chapter">1 General</h2>
|
||||||
|
|
||||||
|
<table class="menu" border="0" cellspacing="0">
|
||||||
|
<tr><td align="left" valign="top">• <a href="Introduction.html#Introduction" accesskey="1">Introduction</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Getting-Started.html#Getting-Started" accesskey="2">Getting Started</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Common-Features-of-Widgets.html#Common-Features-of-Widgets" accesskey="3">Common Features of Widgets</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Return-Values.html#Return-Values" accesskey="4">Return Values</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Argument-Lists.html#Argument-Lists" accesskey="5">Argument Lists</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Lisp-Functions-Invoked-from-Graphics.html#Lisp-Functions-Invoked-from-Graphics" accesskey="6">Lisp Functions Invoked from Graphics</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="Linked-Variables.html#Linked-Variables" accesskey="7">Linked Variables</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="tkconnect.html#tkconnect" accesskey="8">tkconnect</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,96 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL TK Manual: Getting Started</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL TK Manual: Getting Started">
|
||||||
|
<meta name="keywords" content="GCL TK Manual: Getting Started">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="wm.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="General.html#General" rel="up" title="General">
|
||||||
|
<link href="Common-Features-of-Widgets.html#Common-Features-of-Widgets" rel="next" title="Common Features of Widgets">
|
||||||
|
<link href="Introduction.html#Introduction" rel="prev" title="Introduction">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Getting-Started"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Common-Features-of-Widgets.html#Common-Features-of-Widgets" accesskey="n" rel="next">Common Features of Widgets</a>, Previous: <a href="Introduction.html#Introduction" accesskey="p" rel="prev">Introduction</a>, Up: <a href="General.html#General" accesskey="u" rel="up">General</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Getting-Started-1"></a>
|
||||||
|
<h3 class="section">1.2 Getting Started</h3>
|
||||||
|
|
||||||
|
<p>Once <b>GCL</b> has been properly installed you should be able to do the
|
||||||
|
following simple example:
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(in-package "TK")
|
||||||
|
(tkconnect)
|
||||||
|
(button '.hello :text "Hello World" :command '(print "hi"))
|
||||||
|
==>.HELLO
|
||||||
|
(pack '.hello)
|
||||||
|
</pre></div>
|
||||||
|
<p>We first switched to the "TK" package, so that functions like button
|
||||||
|
and pack would be found.
|
||||||
|
After doing the tkconnect, a window should appear on your screen, see See <a href="tkconnect.html#tkconnect">tkconnect</a>.
|
||||||
|
The invocation of the function <code>button</code> creates a new function
|
||||||
|
called <code>.hello</code> which is a <i>widget function</i>. It is then
|
||||||
|
made visible in the window by using the <code>pack</code> function.
|
||||||
|
</p>
|
||||||
|
<p>You may now click on the little window, and you should see the command
|
||||||
|
executed in your lisp. Thus "hi" should be printed in the lisp
|
||||||
|
window. This will happen whether or not you have a job running in
|
||||||
|
the lisp, that is lisp will be interrupted and your command will run,
|
||||||
|
and then return the control to your program.
|
||||||
|
</p>
|
||||||
|
<p>The function <code>button</code> is called a widget constructor, and the
|
||||||
|
function <code>.hello</code> is called a widget. If you have managed to
|
||||||
|
accomplish the above, then <b>GCL</b> is probably installed correctly, and you
|
||||||
|
can graduate to the next section! If you dont like reading but prefer
|
||||||
|
to look at demos and code, then you should look in the demos directory,
|
||||||
|
where you will find a number of examples. A monitor for the garbage
|
||||||
|
collector (mkgcmonitor), a demonstration of canvas widgets (mkitems),
|
||||||
|
a sample listbox with scrolling (mklistbox).
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,91 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL TK Manual: Introduction</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL TK Manual: Introduction">
|
||||||
|
<meta name="keywords" content="GCL TK Manual: Introduction">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="wm.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="General.html#General" rel="up" title="General">
|
||||||
|
<link href="Getting-Started.html#Getting-Started" rel="next" title="Getting Started">
|
||||||
|
<link href="General.html#General" rel="prev" title="General">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Introduction"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Getting-Started.html#Getting-Started" accesskey="n" rel="next">Getting Started</a>, Previous: <a href="General.html#General" accesskey="p" rel="prev">General</a>, Up: <a href="General.html#General" accesskey="u" rel="up">General</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Introduction-1"></a>
|
||||||
|
<h3 class="section">1.1 Introduction</h3>
|
||||||
|
|
||||||
|
<p><b>GCL-TK</b> is a windowing interface for <b>GNU Common Lisp</b>. It provides the
|
||||||
|
functionality of the <b>TK</b> widget set, which in turn implements a widget
|
||||||
|
set which has the look and feel of <b>Motif</b>.
|
||||||
|
</p>
|
||||||
|
<p>The interface allows the user to draw graphics, get input from menus,
|
||||||
|
make regions mouse sensitive, and bind lisp commands to regions. It
|
||||||
|
communicates over a socket with a <samp>gcltksrv</samp> process, which speaks to the
|
||||||
|
display via the <b>TK</b> library. The displaying process may run on
|
||||||
|
a machine which is closer to the display, and so involves less
|
||||||
|
communication. It also may remain active even though the lisp is
|
||||||
|
involved in a separate user computation. The display server can, however,
|
||||||
|
interrupt the lisp at will, to inquire about variables and run
|
||||||
|
commands.
|
||||||
|
</p>
|
||||||
|
<p>The user may also interface with existing <code>TCL/TK</code> programs,
|
||||||
|
binding some buttons, or tracking some objects.
|
||||||
|
</p>
|
||||||
|
<p>The size of the program is moderate. In its current form it adds only
|
||||||
|
about 45K bytes to the lisp image, and the <samp>gcltksrv</samp> program uses shared
|
||||||
|
libraries, and is on the order of 150Kbytes on a sparc.
|
||||||
|
</p>
|
||||||
|
<p>This chapter describes some of the common features of the command
|
||||||
|
structure of widgets, and of control functions. The actual functions
|
||||||
|
for construction of windows
|
||||||
|
are discussed in <a href="Widgets.html#Widgets">Widgets</a>, and more general functions
|
||||||
|
for making them appear, lowering them, querying about them in <a href="Control.html#Control">Control</a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,161 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL TK Manual: Linked Variables</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL TK Manual: Linked Variables">
|
||||||
|
<meta name="keywords" content="GCL TK Manual: Linked Variables">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="wm.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="General.html#General" rel="up" title="General">
|
||||||
|
<link href="tkconnect.html#tkconnect" rel="next" title="tkconnect">
|
||||||
|
<link href="Lisp-Functions-Invoked-from-Graphics.html#Lisp-Functions-Invoked-from-Graphics" rel="prev" title="Lisp Functions Invoked from Graphics">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Linked-Variables"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="tkconnect.html#tkconnect" accesskey="n" rel="next">tkconnect</a>, Previous: <a href="Lisp-Functions-Invoked-from-Graphics.html#Lisp-Functions-Invoked-from-Graphics" accesskey="p" rel="prev">Lisp Functions Invoked from Graphics</a>, Up: <a href="General.html#General" accesskey="u" rel="up">General</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Linked-Variables-1"></a>
|
||||||
|
<h3 class="section">1.7 Linked Variables</h3>
|
||||||
|
|
||||||
|
<p>It is possible to link lisp variables to <b>TK</b> variables. In general
|
||||||
|
when the <b>TK</b> variable is changed, by for instance clicking on a
|
||||||
|
radiobutton, the linked lisp variable will be changed. Conversely
|
||||||
|
changing the lisp variable will be noticed by the <b>TK</b> graphics side, if
|
||||||
|
one does the assignment in lisp using <code>setk</code> instead of
|
||||||
|
<code>setq</code>.
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(button '.hello :textvariable '*message* :text "hi there")
|
||||||
|
(pack '.hello)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>This causes linking of the global variable <code>*message*</code> in lisp
|
||||||
|
to a corresponding variable in <b>TK</b>. Moreover the message that is in
|
||||||
|
the button <code>.hello</code> will be whatever the value of this global
|
||||||
|
variable is (so long as the <b>TK</b> side is notified of the change!).
|
||||||
|
</p>
|
||||||
|
<p>Thus if one does
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(setk *message* "good bye")
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>then the button will change to have <i>good bye</i> as its text.
|
||||||
|
The lisp macro <code>setk</code> expands into
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(prog1 (setf *message* "good bye") (notice-text-variables))
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>which does the assignment, and then goes thru the linked variables
|
||||||
|
checking for those that have changed, and updating the <b>TK</b> side should
|
||||||
|
there be any. Thus if you have a more complex program which might
|
||||||
|
have done the assignment of your global variable, you may include
|
||||||
|
the call to <code>notice-text-variables</code> at the end, to assure that
|
||||||
|
the graphics side knows about the changes.
|
||||||
|
</p>
|
||||||
|
<p>A variable which is linked using the keyword <code>:textvariable</code> is
|
||||||
|
always a variable containing a string.
|
||||||
|
</p>
|
||||||
|
<p>However it is possible to have other types of variables.
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(checkbutton '.checkbutton1 :text "A button" :variable '(boolean *joe*))
|
||||||
|
(checkbutton '.checkbutton2 :text "A button" :variable '*joe*)
|
||||||
|
(checkbutton '.checkbutton3 :text "Debugging" :variable '(t *debug*)
|
||||||
|
:onvalue 100 :offvalue -1)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>The first two examples are the same in that the default variable type
|
||||||
|
for a checkbutton is <code>boolean</code>. Notice that the specification of a
|
||||||
|
variable type is by <code>(<i>type</i> variable)</code>. The types which are
|
||||||
|
permissible are those which have coercion-fucntions, See <a href="Return-Values.html#Return-Values">Return Values</a>. In the first example a variable <code>*joe*</code> will be linked, and
|
||||||
|
its default initial value will be set to nil, since the default initial
|
||||||
|
state of the check button is off, and the default off value is nil.
|
||||||
|
Actually on the <b>TK</b> side, the corresponding boolean values are <code>"1"</code>
|
||||||
|
and <code>"0"</code>, but the <code>boolean</code> type makes these become <code>t</code>
|
||||||
|
and <code>nil</code>.
|
||||||
|
</p>
|
||||||
|
<p>In the third example the variable *debug* may have any lisp value (here
|
||||||
|
<i>type</i> is <code>t</code>). The initial value will be made to be <code>-1</code>,
|
||||||
|
since the checkbutton is off. Clicking on <code>.checkbutton3</code> will
|
||||||
|
result in the value of <code>*debug*</code> being changed to 100, and the light
|
||||||
|
in the button will be toggled to on, See <a href="checkbutton.html#checkbutton">checkbutton</a>. You may
|
||||||
|
set the variable to be another value besides 100.
|
||||||
|
</p>
|
||||||
|
<p>You may also call
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(link-text-variable '*joe* 'boolean)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>to cause the linking of a variable named *joe*. This is done
|
||||||
|
automatically
|
||||||
|
whenever the variable is specified after one of the keys
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">:variable :textvariable.
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Just as one must be cautious about using global variables in lisp, one
|
||||||
|
must be cautious in making such linked variables. In particular note
|
||||||
|
that the <b>TK</b> side, uses variables for various purposes. If you make a
|
||||||
|
checkbutton with pathname <code>.a.b.c</code> then unless you specify a
|
||||||
|
<code>:variable</code> option, the variable <code>c</code> will become associated to
|
||||||
|
the <b>TK</b> value of the checkbutton. We do NOT link this variable by
|
||||||
|
default, feeling that one might inadvertently alter global variables,
|
||||||
|
and that they would not typically use the lisp convention of being of
|
||||||
|
the form <code>*c*</code>. You must specify the <code>:variable</code> option, or
|
||||||
|
call <code>link-variable</code>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="tkconnect.html#tkconnect" accesskey="n" rel="next">tkconnect</a>, Previous: <a href="Lisp-Functions-Invoked-from-Graphics.html#Lisp-Functions-Invoked-from-Graphics" accesskey="p" rel="prev">Lisp Functions Invoked from Graphics</a>, Up: <a href="General.html#General" accesskey="u" rel="up">General</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,212 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL TK Manual: Lisp Functions Invoked from Graphics</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL TK Manual: Lisp Functions Invoked from Graphics">
|
||||||
|
<meta name="keywords" content="GCL TK Manual: Lisp Functions Invoked from Graphics">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="wm.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="General.html#General" rel="up" title="General">
|
||||||
|
<link href="Linked-Variables.html#Linked-Variables" rel="next" title="Linked Variables">
|
||||||
|
<link href="Argument-Lists.html#Argument-Lists" rel="prev" title="Argument Lists">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Lisp-Functions-Invoked-from-Graphics"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Linked-Variables.html#Linked-Variables" accesskey="n" rel="next">Linked Variables</a>, Previous: <a href="Argument-Lists.html#Argument-Lists" accesskey="p" rel="prev">Argument Lists</a>, Up: <a href="General.html#General" accesskey="u" rel="up">General</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Lisp-Functions-Invoked-from-Graphics-1"></a>
|
||||||
|
<h3 class="section">1.6 Lisp Functions Invoked from Graphics</h3>
|
||||||
|
|
||||||
|
|
||||||
|
<p>It is possible to make certain areas of a window mouse sensitive,
|
||||||
|
or to run commands on reception of certain events such as keystrokes,
|
||||||
|
while the focus is in a certain window. This is done by having
|
||||||
|
a lisp function invoked or some lisp form evaluated. We shall
|
||||||
|
refer to such a lisp function or form as a <em>command</em>.
|
||||||
|
</p>
|
||||||
|
<p>For example
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(button '.button :text "Hello" :command '(print "hi"))
|
||||||
|
(button '.jim :text "Call Jim" :command 'call-jim)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>In the first case when the window <code>.button</code> is clicked on, the
|
||||||
|
word "hi" will be printed in the lisp to standard output. In the
|
||||||
|
second case <code>call-jim</code> will be funcalled with no arguments.
|
||||||
|
</p>
|
||||||
|
<p>A command must be one of the following three types. What happens
|
||||||
|
depends on which type it is:
|
||||||
|
</p>
|
||||||
|
<dl compact="compact">
|
||||||
|
<dt>‘<samp>function</samp>’</dt>
|
||||||
|
<dd><p>If the value satisfies <code>functionp</code> then it will be called with
|
||||||
|
a number of arguments which is dependent on the way it was bound,
|
||||||
|
to graphics.
|
||||||
|
</p></dd>
|
||||||
|
<dt>‘<samp>string</samp>’</dt>
|
||||||
|
<dd><p>If the command is a string, then it is passed directly to <b>TCL/TK</b>
|
||||||
|
for evaluation on that side. Lisp will not be required for the
|
||||||
|
evaluation when the command is invoked.
|
||||||
|
</p></dd>
|
||||||
|
<dt>‘<samp>lisp form</samp>’</dt>
|
||||||
|
<dd><p>Any other lisp object is regarded as a lisp form to be eval’d, and
|
||||||
|
this will be done when the command is invoked.
|
||||||
|
</p></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<p>The following keywords accept as their value a command:
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example"> :command
|
||||||
|
:yscroll :yscrollcommand
|
||||||
|
:xscroll :xscrollcommand
|
||||||
|
:scrollcommand
|
||||||
|
:bind
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>and in addition <code>bind</code> takes a command as its third argument,
|
||||||
|
see See <a href="bind.html#bind">bind</a>.
|
||||||
|
</p>
|
||||||
|
<p>Below we give three different examples using the 3 possibilities for
|
||||||
|
a command: functionp, string, and lisp form. They all accomplish
|
||||||
|
exactly the same thing.
|
||||||
|
For given a frame <code>.frame</code> we could construct a listbox
|
||||||
|
in it as:
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(listbox '.frame.listbox :yscroll 'joe)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Then whenever the listbox view position changes, or text is inserted,
|
||||||
|
so that something changes, the function <code>joe</code> will be invoked with 4
|
||||||
|
arguments giving the totalsize of the text, maximum number of units
|
||||||
|
the window can display, the index of the top unit, and finally the
|
||||||
|
index of the bottom unit. What these arguments are is specific
|
||||||
|
to the widget <code>listbox</code> and is documented See <a href="listbox.html#listbox">listbox</a>.
|
||||||
|
</p>
|
||||||
|
<p><code>joe</code> might be used to do anything, but a common usage is to have
|
||||||
|
<code>joe</code> alter the position of some other window, such as a scroll
|
||||||
|
bar window. Indeed if <code>.scrollbar</code> is a scrollbar then
|
||||||
|
the function
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(defun joe (a b c d)
|
||||||
|
(.scrollbar :set a b c d))
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>would look after sizing the scrollbar appropriately for the percentage
|
||||||
|
of the window visible, and positioning it.
|
||||||
|
</p>
|
||||||
|
<p>A second method of accomplishing this identical, using a string (the
|
||||||
|
second type of command),
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(listbox '.frame.listbox :yscroll ".scrollbar set")
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>and this will not involve a call back to lisp. It uses the fact that
|
||||||
|
the <b>TK</b> graphics side understands the window name <code>.scrollbar</code> and
|
||||||
|
that it takes the <i>option</i> <code>set</code>. Note that it does not get
|
||||||
|
the <code>:</code> before the keyword in this case.
|
||||||
|
</p>
|
||||||
|
<p>In the case of a command which is a <i>lisp form</i> but is not installed
|
||||||
|
via <code>bind</code> or <code>:bind</code>, then the form will be installed as
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">#'(lambda (&rest *arglist*) <i>lisp-form</i>)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>where the <i>lisp-form</i> might wish to access the elements of the special
|
||||||
|
variable <code>*arglist*</code>. Most often this list will be empty, but for
|
||||||
|
example if the command was setup for <code>.scale</code> which is a <i>scale</i>,
|
||||||
|
then the command will be supplied one argument which is the new numeric
|
||||||
|
value which is the scale position. A third way of accomplishing the
|
||||||
|
scrollbar setting using a lisp form is:
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(listbox '.frame.listbox :yscroll '(apply '.scrollbar :set *arglist*))
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>The <code>bind</code> command and <code>:bind</code> keyword, have an additional
|
||||||
|
wrinkle, see See <a href="bind.html#bind">bind</a>. These are associated to an event in a
|
||||||
|
particular window, and the lisp function or form to be evaled must have
|
||||||
|
access to that information. For example the x y position, the window
|
||||||
|
name, the key pressed, etc. This is done via <i>percent symbols</i> which
|
||||||
|
are specified, see See <a href="bind.html#bind">bind</a>.
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(bind "Entry" "<Control-KeyPress>" '(emacs-move %W %A ))
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>will cause the function emacs-move to be be invoked whenever a control
|
||||||
|
key is pressed (unless there are more key specific or window specific
|
||||||
|
bindings of said key). It will be invoked with two arguments, the
|
||||||
|
first %W indicating the window in which it was invoked, and the second
|
||||||
|
being a string which is the ascii keysym which was pressed at the same
|
||||||
|
time as the control key.
|
||||||
|
</p>
|
||||||
|
<p>These <i>percent constructs</i> are only permitted in commands which are
|
||||||
|
invoked via <code>bind</code> or <code>:bind</code>. The lisp form which is passed
|
||||||
|
as the command, is searched for the percent constructs, and then a
|
||||||
|
function
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">#'(lambda (%W %A) (emacs-move %W %A))
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>will be invoked with two arguments, which will be supplied by the
|
||||||
|
<b>TK</b> graphics server, at the time the command is invoked. The
|
||||||
|
<code>*arglist*</code> construct is not available for these commands.
|
||||||
|
</p>
|
||||||
|
<hr>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Linked-Variables.html#Linked-Variables" accesskey="n" rel="next">Linked Variables</a>, Previous: <a href="Argument-Lists.html#Argument-Lists" accesskey="p" rel="prev">Argument Lists</a>, Up: <a href="General.html#General" accesskey="u" rel="up">General</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,181 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL TK Manual: Return Values</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL TK Manual: Return Values">
|
||||||
|
<meta name="keywords" content="GCL TK Manual: Return Values">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="wm.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="General.html#General" rel="up" title="General">
|
||||||
|
<link href="Argument-Lists.html#Argument-Lists" rel="next" title="Argument Lists">
|
||||||
|
<link href="Common-Features-of-Widgets.html#Common-Features-of-Widgets" rel="prev" title="Common Features of Widgets">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Return-Values"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Argument-Lists.html#Argument-Lists" accesskey="n" rel="next">Argument Lists</a>, Previous: <a href="Common-Features-of-Widgets.html#Common-Features-of-Widgets" accesskey="p" rel="prev">Common Features of Widgets</a>, Up: <a href="General.html#General" accesskey="u" rel="up">General</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Return-Values-1"></a>
|
||||||
|
<h3 class="section">1.4 Return Values</h3>
|
||||||
|
|
||||||
|
<a name="Widget-Constructor-Return-Values"></a>
|
||||||
|
<h4 class="subsection">1.4.1 Widget Constructor Return Values</h4>
|
||||||
|
|
||||||
|
<p>On successful completion, the widget constructor functions return the
|
||||||
|
symbol passed in as the first argument. It will now have a functional
|
||||||
|
binding. It is an error to pass in a symbol which already corresponds
|
||||||
|
to a widget, without first calling the <code>destroy</code> command. On failure,
|
||||||
|
an error is signalled.
|
||||||
|
</p>
|
||||||
|
<a name="Widget-Return-Values"></a>
|
||||||
|
<h4 class="subsection">1.4.2 Widget Return Values</h4>
|
||||||
|
|
||||||
|
<p>The <i>widget</i> functions themselves, do not normally return any value.
|
||||||
|
Indeed the lisp process does not wait for them to return, but merely
|
||||||
|
dispatches the commands, such as to change the text in themselves.
|
||||||
|
Sometimes however you either wish to wait, in order to synchronize, or
|
||||||
|
you wish to see if your command fails or succeeds. You request values
|
||||||
|
by passing the keyword :return and a value indicating the type.
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(.hello :configure :text "Bye World" :return 'string)
|
||||||
|
==> ""
|
||||||
|
==> T
|
||||||
|
</pre></div>
|
||||||
|
<p>the empty string is returned as first value, and the second value
|
||||||
|
<code>T</code> indicates that the new text value was successfully set. LISP
|
||||||
|
will not continue until the tkclsrv process indicates back that the
|
||||||
|
function call has succeeded. While waiting of course LISP will continue
|
||||||
|
to process other graphics events which arrive, since otherwise a
|
||||||
|
deadlock would arise: the user for instance might click on a mouse, just after
|
||||||
|
we had decided to wait for a return value from the <code>.hello</code> function.
|
||||||
|
More generally a user program may be running in <b>GCL</b> and be interrupted
|
||||||
|
to receive and act on communications from the <samp>gcltksrv</samp>
|
||||||
|
process. If an error occurred then the second return value of the
|
||||||
|
lisp function will be NIL. In this case the first value, the string
|
||||||
|
is usually an informative message about the type of error.
|
||||||
|
</p>
|
||||||
|
<p>A special variable <code>tk::*break-on-errors*</code> which if not
|
||||||
|
<code>nil</code>, requests that that <b>LISP</b> signal an error when a message
|
||||||
|
is received indicating a function failed. Whenever a command fails,
|
||||||
|
whether a return value was requested or not, <samp>gcltksrv</samp> returns a
|
||||||
|
message indicating failure. The default is to not go into the
|
||||||
|
debugger. When debugging your windows it may be convenient however to
|
||||||
|
set this variable to <code>T</code> to track down incorrect messages.
|
||||||
|
</p>
|
||||||
|
<p>The <samp>gcltksrv</samp> process always returns strings as values.
|
||||||
|
If <code>:return</code> <i>type</i> is specified, then conversion to <i>type</i>
|
||||||
|
is accomplished by calling
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(coerce-result <i>return-string</i> <i>type</i>)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Here <i>type</i> must be a symbol with a <code>coercion-functions</code>
|
||||||
|
property.
|
||||||
|
The builtin return types which may be requested are:
|
||||||
|
</p>
|
||||||
|
<dl compact="compact">
|
||||||
|
<dt><code>T</code></dt>
|
||||||
|
<dd><p>in which case
|
||||||
|
the string passed back from the <samp>gcltksrv</samp> process, will be read by the
|
||||||
|
lisp reader.
|
||||||
|
</p></dd>
|
||||||
|
<dt><code>number</code></dt>
|
||||||
|
<dd><p>the string is converted to a number using the current *read-base*
|
||||||
|
</p></dd>
|
||||||
|
<dt><code>list-strings</code></dt>
|
||||||
|
<dd>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(coerce-result "a b {c d} e" 'list-strings)
|
||||||
|
==> ("a" "b" "c d" "e")
|
||||||
|
</pre></div>
|
||||||
|
</dd>
|
||||||
|
<dt><code>boolean</code></dt>
|
||||||
|
<dd><p>(coerce-result "1" ’boolean)
|
||||||
|
==> T
|
||||||
|
(coerce-result "0" ’boolean)
|
||||||
|
==> NIL
|
||||||
|
</p></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<p>The above symbols are in the <code>TK</code> or <code>LISP</code> package.
|
||||||
|
It would be possible to add new types just as the <code>:return t</code>
|
||||||
|
is done:
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(setf (get 't 'coercion-functions)
|
||||||
|
(cons #'(lambda (x) (our-read-from-string x 0))
|
||||||
|
#'(lambda (x) (format nil "~s" x))))
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>The <code>coercion-functions</code> property of a symbol, is a cons whose
|
||||||
|
<code>car</code> is the coercion form from a string to some possibly different
|
||||||
|
lisp object, and whose <code>cdr</code> is a function which builds a string
|
||||||
|
to send to the graphics server. Often the two functions are inverse
|
||||||
|
functions one of the other up to equal.
|
||||||
|
</p>
|
||||||
|
<a name="Control-Function-Return-Values"></a>
|
||||||
|
<h4 class="subsection">1.4.3 Control Function Return Values</h4>
|
||||||
|
|
||||||
|
<p>The <i>control</i> funcions (see <a href="Control.html#Control">Control</a>) do not return a value
|
||||||
|
or wait unless requested to do so, using the <code>:return</code> keyword.
|
||||||
|
The types and method of specification are the same as for the
|
||||||
|
Widget Functions in the previous section.
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">(winfo :width '.hello :return 'number)
|
||||||
|
==> 120
|
||||||
|
</pre></div>
|
||||||
|
<p>indicates that the <code>.hello</code> button is actually 120 pixels
|
||||||
|
wide.
|
||||||
|
</p>
|
||||||
|
<hr>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Argument-Lists.html#Argument-Lists" accesskey="n" rel="next">Argument Lists</a>, Previous: <a href="Common-Features-of-Widgets.html#Common-Features-of-Widgets" accesskey="p" rel="prev">Common Features of Widgets</a>, Up: <a href="General.html#General" accesskey="u" rel="up">General</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,97 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL TK Manual: Widgets</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL TK Manual: Widgets">
|
||||||
|
<meta name="keywords" content="GCL TK Manual: Widgets">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="wm.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="index.html#Top" rel="up" title="Top">
|
||||||
|
<link href="button.html#button" rel="next" title="button">
|
||||||
|
<link href="tkconnect.html#tkconnect" rel="prev" title="tkconnect">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="Widgets"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="Control.html#Control" accesskey="n" rel="next">Control</a>, Previous: <a href="General.html#General" accesskey="p" rel="prev">General</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="Widgets-1"></a>
|
||||||
|
<h2 class="chapter">2 Widgets</h2>
|
||||||
|
|
||||||
|
<table class="menu" border="0" cellspacing="0">
|
||||||
|
<tr><td align="left" valign="top">• <a href="button.html#button" accesskey="1">button</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="listbox.html#listbox" accesskey="2">listbox</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="scale.html#scale" accesskey="3">scale</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="canvas.html#canvas" accesskey="4">canvas</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="menu.html#menu" accesskey="5">menu</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="scrollbar.html#scrollbar" accesskey="6">scrollbar</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="checkbutton.html#checkbutton" accesskey="7">checkbutton</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="menubutton.html#menubutton" accesskey="8">menubutton</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="text.html#text" accesskey="9">text</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="entry.html#entry">entry</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="message.html#message">message</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="frame.html#frame">frame</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="label.html#label">label</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="radiobutton.html#radiobutton">radiobutton</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align="left" valign="top">• <a href="toplevel.html#toplevel">toplevel</a>:</td><td> </td><td align="left" valign="top">
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,97 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL TK Manual: after</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL TK Manual: after">
|
||||||
|
<meta name="keywords" content="GCL TK Manual: after">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="wm.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="Control.html#Control" rel="up" title="Control">
|
||||||
|
<link href="bind.html#bind" rel="next" title="bind">
|
||||||
|
<link href="Control.html#Control" rel="prev" title="Control">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="after"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="bind.html#bind" accesskey="n" rel="next">bind</a>, Previous: <a href="Control.html#Control" accesskey="p" rel="prev">Control</a>, Up: <a href="Control.html#Control" accesskey="u" rel="up">Control</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="after-1"></a>
|
||||||
|
<h3 class="section">3.1 after</h3>
|
||||||
|
|
||||||
|
<p>after - Execute a command after a time delay
|
||||||
|
</p><a name="Synopsis-15"></a>
|
||||||
|
<h4 class="unnumberedsubsec">Synopsis</h4>
|
||||||
|
<p><b>after </b><i>ms </i><span class="roman">?</span><i>arg1 arg2 arg3 ...</i>?
|
||||||
|
</p>
|
||||||
|
<a name="Description-12"></a>
|
||||||
|
<h4 class="unnumberedsubsec">Description</h4>
|
||||||
|
|
||||||
|
<p>This command is used to delay execution of the program or to execute
|
||||||
|
a command in background after a delay. The <i>ms</i> argument gives
|
||||||
|
a time in milliseconds.
|
||||||
|
If <i>ms</i><span class="roman"> is the only argument to </span><b>after</b>
|
||||||
|
then the command sleeps for <i>ms</i> milliseconds and returns.
|
||||||
|
While the command is sleeping the application does not respond to
|
||||||
|
X events and other events.
|
||||||
|
</p>
|
||||||
|
<p>If additional arguments are
|
||||||
|
present after <i>ms</i>, then a Tcl command is formed by concatenating
|
||||||
|
all the additional arguments in the same fashion as the <b>concat</b>
|
||||||
|
command. <b>After</b> returns immediately but arranges for the command
|
||||||
|
to be executed <i>ms</i> milliseconds later in background.
|
||||||
|
The command will be executed at global level (outside the context
|
||||||
|
of any Tcl procedure).
|
||||||
|
If an error occurs while executing the delayed command then the
|
||||||
|
<b>tkerror</b> mechanism is used to report the error.
|
||||||
|
</p>
|
||||||
|
<p>The <b>after</b> command always returns an empty string.
|
||||||
|
</p>
|
||||||
|
<p>See <a href="tkerror.html#tkerror">tkerror</a>.
|
||||||
|
</p>
|
||||||
|
<a name="Keywords-15"></a>
|
||||||
|
<h4 class="unnumberedsubsec">Keywords</h4>
|
||||||
|
<p>delay, sleep, time
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,490 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL TK Manual: bind</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL TK Manual: bind">
|
||||||
|
<meta name="keywords" content="GCL TK Manual: bind">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="wm.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="Control.html#Control" rel="up" title="Control">
|
||||||
|
<link href="destroy.html#destroy" rel="next" title="destroy">
|
||||||
|
<link href="after.html#after" rel="prev" title="after">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="bind"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="destroy.html#destroy" accesskey="n" rel="next">destroy</a>, Previous: <a href="after.html#after" accesskey="p" rel="prev">after</a>, Up: <a href="Control.html#Control" accesskey="u" rel="up">Control</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="bind-1"></a>
|
||||||
|
<h3 class="section">3.2 bind</h3>
|
||||||
|
|
||||||
|
<p>bind \- Arrange for X events to invoke Tcl commands
|
||||||
|
</p><a name="Synopsis-16"></a>
|
||||||
|
<h4 class="unnumberedsubsec">Synopsis</h4>
|
||||||
|
<br><p><b>bind</b><i> windowSpec</i><!-- /@w --><br>
|
||||||
|
<br><b>bind</b><i> windowSpec sequence</i><!-- /@w --><br>
|
||||||
|
<br><b>bind</b><i> windowSpec sequence command</i><!-- /@w --><br>
|
||||||
|
<b>bind</b><i> windowSpec sequence </i><b>+</b><i>command</i>
|
||||||
|
</p>
|
||||||
|
<a name="Description-13"></a>
|
||||||
|
<h4 class="unnumberedsubsec">Description</h4>
|
||||||
|
|
||||||
|
<p>If all three arguments are specified, <b>bind</b> will
|
||||||
|
arrange for <i>command</i> (a Tcl
|
||||||
|
command) to be executed whenever the sequence of events given
|
||||||
|
by <i>sequence</i><span class="roman"> occurs in the window(s) identified by </span><i>windowSpec</i>.
|
||||||
|
If <i>command</i> is prefixed with a “+”, then it is appended to
|
||||||
|
any existing binding for <i>sequence</i><span class="roman">; otherwise </span><i>command</i> replaces
|
||||||
|
the existing binding, if any. If <i>command</i>
|
||||||
|
is an empty string then the current binding for <i>sequence</i>
|
||||||
|
is destroyed, leaving <i>sequence</i> unbound. In all of the cases
|
||||||
|
where a <i>command</i><span class="roman"> argument is provided, </span><b>bind</b> returns
|
||||||
|
an empty string.
|
||||||
|
</p>
|
||||||
|
<p>If <i>sequence</i><span class="roman"> is specified without a </span><i>command</i>, then the
|
||||||
|
command currently bound to <i>sequence</i> is returned, or
|
||||||
|
an empty string if there is no binding for <i>sequence</i>. If
|
||||||
|
neither <i>sequence</i><span class="roman"> nor </span><i>command</i> is specified, then the
|
||||||
|
return value is a list whose elements are all the sequences
|
||||||
|
for which there exist bindings for <i>windowSpec</i>.
|
||||||
|
</p>
|
||||||
|
<p>The <i>windowSpec</i> argument selects which window(s) the binding
|
||||||
|
applies to.
|
||||||
|
It may have one of three forms.
|
||||||
|
If <i>windowSpec</i> is the path name for a window, then the binding
|
||||||
|
applies to that particular window.
|
||||||
|
If <i>windowSpec</i> is the name of a class of widgets, then the
|
||||||
|
binding applies to all widgets in that class.
|
||||||
|
Lastly, <i>windowSpec</i><span class="roman"> may have the value </span><b>all</b>, in which case
|
||||||
|
the binding applies to all windows in the application.
|
||||||
|
</p>
|
||||||
|
<p>The <i>sequence</i> argument specifies a sequence of one or more
|
||||||
|
event patterns, with optional white space between the patterns. Each
|
||||||
|
event pattern may
|
||||||
|
take either of two forms. In the simplest case it is a single
|
||||||
|
printing ASCII character, such as <b>a</b><span class="roman"> or </span><b>[</b>. The character
|
||||||
|
may not be a space character or the character <b><</b>. This form of
|
||||||
|
pattern matches a <b>KeyPress</b> event for the particular
|
||||||
|
character. The second form of pattern is longer but more general.
|
||||||
|
It has the following syntax:
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example"><b><</b><i>modifier-modifier-type-detail</i><b>></b>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>The entire event pattern is surrounded by angle brackets.
|
||||||
|
Inside the angle brackets are zero or more modifiers, an event
|
||||||
|
type, and an extra piece of information (<i>detail</i>) identifying
|
||||||
|
a particular button or keysym. Any of the fields may be omitted,
|
||||||
|
as long as at least one of <i>type</i><span class="roman"> and </span><i>detail</i> is present.
|
||||||
|
The fields must be separated by white space or dashes.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>Modifiers may consist of any of the values in the following list:
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">Control Any
|
||||||
|
Shift Double
|
||||||
|
Lock Triple
|
||||||
|
Button1, B1 Mod1, M1, Meta, M
|
||||||
|
Button2, B2 Mod2, M2, Alt
|
||||||
|
Button3, B3 Mod3, M3
|
||||||
|
Button4, B4 Mod4, M4
|
||||||
|
Button5, B5 Mod5, M5
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Where more than one value is listed, separated by commas, the values
|
||||||
|
are equivalent. All of the modifiers except <b>Any</b>,
|
||||||
|
<b>Double</b><span class="roman">, and </span><b>Triple</b> have
|
||||||
|
the obvious X meanings. For example, <b>Button1</b> requires that
|
||||||
|
button 1 be depressed when the event occurs. Under normal conditions
|
||||||
|
the button and modifier state at the time of the event must
|
||||||
|
match exactly those specified in the <b>bind</b> command. If
|
||||||
|
no modifiers are specified, then events will match only if no modifiers
|
||||||
|
are present. If the <b>Any</b> modifier is specified, then additional
|
||||||
|
modifiers may be present besides those specified explicitly. For
|
||||||
|
example, if button 1 is pressed while the shift and control keys
|
||||||
|
are down, the specifier <b><Any-Control-Button-1></b> will match
|
||||||
|
the event, but the specifier <b><Control-Button-1></b> will not.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>The <b>Double</b><span class="roman"> and </span><b>Triple</b> modifiers are a convenience
|
||||||
|
for specifying double mouse clicks and other repeated
|
||||||
|
events. They cause a particular event pattern to be
|
||||||
|
repeated 2 or 3 times, and also place a time and space requirement
|
||||||
|
on the sequence: for a sequence of events to match a <b>Double</b>
|
||||||
|
or <b>Triple</b> pattern, all of the events must occur close together
|
||||||
|
in time and without substantial mouse motion in between.
|
||||||
|
For example, <b><Double-Button-1></b>
|
||||||
|
is equivalent to <b><Button-1><Button-1></b> with the extra
|
||||||
|
time and space requirement.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>The <i>type</i> field may be any of the standard X event types, with a
|
||||||
|
few extra abbreviations. Below is a list of all the valid types;
|
||||||
|
where two name appear together, they are synonyms.
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">ButtonPress, Button Expose Leave
|
||||||
|
ButtonRelease FocusIn Map
|
||||||
|
Circulate FocusOut Property
|
||||||
|
CirculateRequest Gravity Reparent
|
||||||
|
Colormap Keymap ResizeRequest
|
||||||
|
Configure KeyPress, Key Unmap
|
||||||
|
ConfigureRequest KeyRelease Visibility
|
||||||
|
Destroy MapRequest
|
||||||
|
Enter Motion
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>The last part of a long event specification is <i>detail</i>. In the
|
||||||
|
case of a <b>ButtonPress</b><span class="roman"> or </span><b>ButtonRelease</b> event, it is the
|
||||||
|
number of a button (1-5). If a button number is given, then only an
|
||||||
|
event on that particular button will match; if no button number is
|
||||||
|
given, then an event on any button will match. Note: giving a
|
||||||
|
specific button number is different than specifying a button modifier;
|
||||||
|
in the first case, it refers to a button being pressed or released,
|
||||||
|
while in the second it refers to some other button that is already
|
||||||
|
depressed when the matching event occurs. If a button
|
||||||
|
number is given then <i>type</i> may be omitted: if will default
|
||||||
|
to <b>ButtonPress</b><span class="roman">. For example, the specifier </span><b><1></b>
|
||||||
|
is equivalent to <b><ButtonPress-1></b>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>If the event type is <b>KeyPress</b><span class="roman"> or </span><b>KeyRelease</b>, then
|
||||||
|
<i>detail</i> may be specified in the form of an X keysym. Keysyms
|
||||||
|
are textual specifications for particular keys on the keyboard;
|
||||||
|
they include all the alphanumeric ASCII characters (e.g. “a” is
|
||||||
|
the keysym for the ASCII character “a”), plus descriptions for
|
||||||
|
non-alphanumeric characters (“comma” is the keysym for the comma
|
||||||
|
character), plus descriptions for all the non-ASCII keys on the
|
||||||
|
keyboard (“Shift_L” is the keysm for the left shift key, and
|
||||||
|
“F1” is the keysym for the F1 function key, if it exists). The
|
||||||
|
complete list of keysyms is not presented here; it should be
|
||||||
|
available in other X documentation. If necessary, you can use the
|
||||||
|
<b>%K</b> notation described below to print out the keysym name for
|
||||||
|
an arbitrary key. If a keysym <i>detail</i> is given, then the
|
||||||
|
<i>type</i><span class="roman"> field may be omitted; it will default to </span><b>KeyPress</b>.
|
||||||
|
For example, <b><Control-comma></b> is equivalent to
|
||||||
|
<b><Control-KeyPress-comma></b><span class="roman">. If a keysym </span><i>detail</i> is specified
|
||||||
|
then the <b>Shift</b> modifier need not be specified and will be
|
||||||
|
ignored if specified: each keysym already implies a particular
|
||||||
|
state for the shift key.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>The <i>command</i><span class="roman"> argument to </span><b>bind</b> is a Tcl command string,
|
||||||
|
which will be executed whenever the given event sequence occurs.
|
||||||
|
<i>Command</i> will be executed in the same interpreter that the
|
||||||
|
<b>bind</b><span class="roman"> command was executed in. If </span><i>command</i> contains
|
||||||
|
any <b>%</b> characters, then the command string will not be
|
||||||
|
executed directly. Instead, a new command string will be
|
||||||
|
generated by replacing each <b>%</b>, and the character following
|
||||||
|
it, with information from the current event. The replacement
|
||||||
|
depends on the character following the <b>%</b>, as defined in the
|
||||||
|
list below. Unless otherwise indicated, the
|
||||||
|
replacement string is the decimal value of the given field from
|
||||||
|
the current event.
|
||||||
|
Some of the substitutions are only valid for
|
||||||
|
certain types of events; if they are used for other types of events
|
||||||
|
the value substituted is undefined.
|
||||||
|
</p>
|
||||||
|
<dl compact="compact">
|
||||||
|
<dt><b>%%</b></dt>
|
||||||
|
<dd><p>Replaced with a single percent.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>|%#|</b></dt>
|
||||||
|
<dd><p>The number of the last client request processed by the server
|
||||||
|
(the <i>serial</i> field from the event). Valid for all event
|
||||||
|
types.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>|%a|</b></dt>
|
||||||
|
<dd><p>The <i>above</i> field from the event.
|
||||||
|
Valid only for <b>ConfigureNotify</b> events.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>|%b|</b></dt>
|
||||||
|
<dd><p>The number of the button that was pressed or released. Valid only
|
||||||
|
for <b>ButtonPress</b><span class="roman"> and </span><b>ButtonRelease</b> events.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>|%c|</b></dt>
|
||||||
|
<dd><p>The <i>count</i><span class="roman"> field from the event. Valid only for </span><b>Expose</b>,
|
||||||
|
<b>GraphicsExpose</b><span class="roman">, and </span><b>MappingNotify</b> events.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>|%d|</b></dt>
|
||||||
|
<dd><p>The <i>detail</i><span class="roman"> field from the event. The </span><b>|%d|</b> is replaced by
|
||||||
|
a string identifying the detail. For <b>EnterNotify</b>,
|
||||||
|
<b>LeaveNotify</b><span class="roman">, </span><b>FocusIn</b><span class="roman">, and </span><b>FocusOut</b> events,
|
||||||
|
the string will be one of the following:
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">NotifyAncestor NotifyNonlinearVirtual
|
||||||
|
NotifyDetailNone NotifyPointer
|
||||||
|
NotifyInferior NotifyPointerRoot
|
||||||
|
NotifyNonlinear NotifyVirtual
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>For <b>ConfigureRequest</b> events, the substituted string will be
|
||||||
|
one of the following:
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">Above Opposite
|
||||||
|
Below TopIf
|
||||||
|
BottomIf
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>For events other than these, the substituted string is undefined.
|
||||||
|
.RE
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>|%f|</b></dt>
|
||||||
|
<dd><p>The <i>focus</i><span class="roman"> field from the event (</span><b>0</b><span class="roman"> or </span><b>1</b>). Valid only
|
||||||
|
for <b>EnterNotify</b><span class="roman"> and </span><b>LeaveNotify</b> events.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>|%h|</b></dt>
|
||||||
|
<dd><p>The <i>height</i><span class="roman"> field from the event. Valid only for </span><b>Configure</b>,
|
||||||
|
<b>ConfigureNotify</b><span class="roman">, </span><b>Expose</b><span class="roman">, </span><b>GraphicsExpose</b>, and
|
||||||
|
<b>ResizeRequest</b> events.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>|%k|</b></dt>
|
||||||
|
<dd><p>The <i>keycode</i><span class="roman"> field from the event. Valid only for </span><b>KeyPress</b>
|
||||||
|
and <b>KeyRelease</b> events.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>|%m|</b></dt>
|
||||||
|
<dd><p>The <i>mode</i> field from the event. The substituted string is one of
|
||||||
|
<b>NotifyNormal</b><span class="roman">, </span><b>NotifyGrab</b><span class="roman">, </span><b>NotifyUngrab</b>, or
|
||||||
|
<b>NotifyWhileGrabbed</b><span class="roman">. Valid only for </span><b>EnterWindow</b>,
|
||||||
|
<b>FocusIn</b><span class="roman">, </span><b>FocusOut</b><span class="roman">, and </span><b>LeaveWindow</b> events.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>|%o|</b></dt>
|
||||||
|
<dd><p>The <i>override_redirect</i> field from the event. Valid only for
|
||||||
|
<b>CreateNotify</b><span class="roman">, </span><b>MapNotify</b><span class="roman">, </span><b>ReparentNotify</b>,
|
||||||
|
and <b>ConfigureNotify</b> events.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>|%p|</b></dt>
|
||||||
|
<dd><p>The <i>place</i> field from the event, substituted as one of the
|
||||||
|
strings <b>PlaceOnTop</b><span class="roman"> or </span><b>PlaceOnBottom</b>. Valid only
|
||||||
|
for <b>CirculateNotify</b><span class="roman"> and </span><b>CirculateRequest</b> events.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>|%s|</b></dt>
|
||||||
|
<dd><p>The <i>state</i><span class="roman"> field from the event. For </span><b>ButtonPress</b>,
|
||||||
|
<b>ButtonRelease</b><span class="roman">, </span><b>EnterNotify</b><span class="roman">, </span><b>KeyPress</b><span class="roman">, </span><b>KeyRelease</b>,
|
||||||
|
<b>LeaveNotify</b><span class="roman">, and </span><b>MotionNotify</b> events,
|
||||||
|
a decimal string
|
||||||
|
is substituted. For <b>VisibilityNotify</b>, one of the strings
|
||||||
|
<b>VisibilityUnobscured</b><span class="roman">, </span><b>VisibilityPartiallyObscured</b>,
|
||||||
|
and <b>VisibilityFullyObscured</b> is substituted.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>|%t|</b></dt>
|
||||||
|
<dd><p>The <i>time</i> field from the event. Valid only for events that
|
||||||
|
contain a <i>time</i> field.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>|%v|</b></dt>
|
||||||
|
<dd><p>The <i>value_mask</i> field from the event. Valid only for
|
||||||
|
<b>ConfigureRequest</b> events.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>|%w|</b></dt>
|
||||||
|
<dd><p>The <i>width</i> field from the event. Valid only for
|
||||||
|
<b>Configure</b><span class="roman">, </span><b>ConfigureRequest</b><span class="roman">, </span><b>Expose</b>,
|
||||||
|
<b>GraphicsExpose</b><span class="roman">, and </span><b>ResizeRequest</b> events.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>|%x|</b></dt>
|
||||||
|
<dd><p>The <i>x</i> field from the event. Valid only for events containing
|
||||||
|
an <i>x</i> field.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>|%y|</b></dt>
|
||||||
|
<dd><p>The <i>y</i> field from the event. Valid only for events containing
|
||||||
|
a <i>y</i> field.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>%A</b></dt>
|
||||||
|
<dd><p>Substitutes the ASCII character corresponding to the event, or
|
||||||
|
the empty string if the event doesn’t correspond to an ASCII character
|
||||||
|
(e.g. the shift key was pressed). <b>XLookupString</b> does all the
|
||||||
|
work of translating from the event to an ASCII character.
|
||||||
|
Valid only for <b>KeyPress</b><span class="roman"> and </span><b>KeyRelease</b> events.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>%B</b></dt>
|
||||||
|
<dd><p>The <i>border_width</i> field from the event. Valid only for
|
||||||
|
<b>ConfigureNotify</b><span class="roman"> and </span><b>CreateWindow</b> events.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>%D</b></dt>
|
||||||
|
<dd><p>The <i>display</i> field from the event. Valid for all event types.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>%E</b></dt>
|
||||||
|
<dd><p>The <i>send_event</i> field from the event. Valid for all event types.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>%K</b></dt>
|
||||||
|
<dd><p>The keysym corresponding to the event, substituted as a textual
|
||||||
|
string. Valid only for <b>KeyPress</b><span class="roman"> and </span><b>KeyRelease</b> events.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>%N</b></dt>
|
||||||
|
<dd><p>The keysym corresponding to the event, substituted as
|
||||||
|
a decimal
|
||||||
|
number. Valid only for <b>KeyPress</b><span class="roman"> and </span><b>KeyRelease</b> events.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>%R</b></dt>
|
||||||
|
<dd><p>The <i>root</i> window identifier from the event. Valid only for
|
||||||
|
events containing a <i>root</i> field.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>%S</b></dt>
|
||||||
|
<dd><p>The <i>subwindow</i> window identifier from the event. Valid only for
|
||||||
|
events containing a <i>subwindow</i> field.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>%T</b></dt>
|
||||||
|
<dd><p>The <i>type</i> field from the event. Valid for all event types.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>%W</b></dt>
|
||||||
|
<dd><p>The path name of the window to which the event was reported (the
|
||||||
|
<i>window</i> field from the event). Valid for all event types.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>%X</b></dt>
|
||||||
|
<dd><p>The <i>x_root</i> field from the event.
|
||||||
|
If a virtual-root window manager is being used then the substituted
|
||||||
|
value is the corresponding x-coordinate in the virtual root.
|
||||||
|
Valid only for
|
||||||
|
<b>ButtonPress</b><span class="roman">, </span><b>ButtonRelease</b><span class="roman">, </span><b>KeyPress</b><span class="roman">, </span><b>KeyRelease</b>,
|
||||||
|
and <b>MotionNotify</b> events.
|
||||||
|
</p></dd>
|
||||||
|
<dt><b>%Y</b></dt>
|
||||||
|
<dd><p>The <i>y_root</i> field from the event.
|
||||||
|
If a virtual-root window manager is being used then the substituted
|
||||||
|
value is the corresponding y-coordinate in the virtual root.
|
||||||
|
Valid only for
|
||||||
|
<b>ButtonPress</b><span class="roman">, </span><b>ButtonRelease</b><span class="roman">, </span><b>KeyPress</b><span class="roman">, </span><b>KeyRelease</b>,
|
||||||
|
and <b>MotionNotify</b> events.
|
||||||
|
</p></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
<p>If the replacement string
|
||||||
|
for a %-replacement contains characters that are interpreted
|
||||||
|
specially by the Tcl parser (such as backslashes or square
|
||||||
|
brackets or spaces) additional backslashes are added
|
||||||
|
during replacement so that the result after parsing is the original
|
||||||
|
replacement string.
|
||||||
|
For example, if <i>command</i> is
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">insert %A
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>and the character typed is an open square bracket, then the command
|
||||||
|
actually executed will be
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">insert \e[
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>This will cause the <b>insert</b> to receive the original replacement
|
||||||
|
string (open square bracket) as its first argument.
|
||||||
|
If the extra backslash hadn’t been added, Tcl would not have been
|
||||||
|
able to parse the command correctly.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>At most one binding will trigger for any given X event.
|
||||||
|
If several bindings match the recent events, the most specific binding
|
||||||
|
is chosen and its command will be executed.
|
||||||
|
The following tests are applied, in order, to determine which of
|
||||||
|
several matching sequences is more specific:
|
||||||
|
(a) a binding whose <i>windowSpec</i> names a particular window is
|
||||||
|
more specific than a binding for a class,
|
||||||
|
which is more specific than a binding whose <i>windowSpec</i> is
|
||||||
|
<b>all</b>;
|
||||||
|
(b) a longer sequence (in terms of number
|
||||||
|
of events matched) is more specific than a shorter sequence;
|
||||||
|
(c) an event pattern that specifies a specific button or key is more specific
|
||||||
|
than one that doesn’t; (e) an event pattern that requires a particular
|
||||||
|
modifier is more specific than one that doesn’t require the modifier;
|
||||||
|
(e) an event pattern specifying the <b>Any</b> modifier is less specific
|
||||||
|
than one that doesn’t. If the matching sequences contain more than
|
||||||
|
one event, then tests (c)-(e) are applied in order from the most
|
||||||
|
recent event to the least recent event in the sequences. If these
|
||||||
|
tests fail to determine a winner, then the most recently registered
|
||||||
|
sequence is the winner.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>If an X event does not match any of the existing bindings, then the
|
||||||
|
event is ignored (an unbound event is not considered to be an error).
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>When a <i>sequence</i><span class="roman"> specified in a </span><b>bind</b> command contains
|
||||||
|
more than one event pattern, then its command is executed whenever
|
||||||
|
the recent events (leading up to and including the current event)
|
||||||
|
match the given sequence. This means, for example, that if button 1 is
|
||||||
|
clicked repeatedly the sequence <b><Double-ButtonPress-1></b> will match
|
||||||
|
each button press but the first.
|
||||||
|
If extraneous events that would prevent a match occur in the middle
|
||||||
|
of an event sequence then the extraneous events are
|
||||||
|
ignored unless they are <b>KeyPress</b><span class="roman"> or </span><b>ButtonPress</b> events.
|
||||||
|
For example, <b><Double-ButtonPress-1></b> will match a sequence of
|
||||||
|
presses of button 1, even though there will be <b>ButtonRelease</b>
|
||||||
|
events (and possibly <b>MotionNotify</b> events) between the
|
||||||
|
<b>ButtonPress</b> events.
|
||||||
|
Furthermore, a <b>KeyPress</b> event may be preceded by any number
|
||||||
|
of other <b>KeyPress</b> events for modifier keys without the
|
||||||
|
modifier keys preventing a match.
|
||||||
|
For example, the event sequence <b>aB</b> will match a press of the
|
||||||
|
<b>a</b><span class="roman"> key, a release of the </span><b>a</b><span class="roman"> key, a press of the </span><b>Shift</b>
|
||||||
|
key, and a press of the <b>b</b><span class="roman"> key: the press of </span><b>Shift</b> is
|
||||||
|
ignored because it is a modifier key.
|
||||||
|
Finally, if several <b>MotionNotify</b> events occur in a row, only
|
||||||
|
the last one is used for purposes of matching binding sequences.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>If an error occurs in executing the command for a binding then the
|
||||||
|
<b>tkerror</b> mechanism is used to report the error.
|
||||||
|
The command will be executed at global level (outside the context
|
||||||
|
of any Tcl procedure).
|
||||||
|
</p>
|
||||||
|
<p>See <a href="tkerror.html#tkerror">tkerror</a>.
|
||||||
|
</p>
|
||||||
|
<a name="Keywords-16"></a>
|
||||||
|
<h4 class="unnumberedsubsec">Keywords</h4>
|
||||||
|
<p>form, manual
|
||||||
|
</p><hr>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="destroy.html#destroy" accesskey="n" rel="next">destroy</a>, Previous: <a href="after.html#after" accesskey="p" rel="prev">after</a>, Up: <a href="Control.html#Control" accesskey="u" rel="up">Control</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,263 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL TK Manual: button</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL TK Manual: button">
|
||||||
|
<meta name="keywords" content="GCL TK Manual: button">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="wm.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="Widgets.html#Widgets" rel="up" title="Widgets">
|
||||||
|
<link href="listbox.html#listbox" rel="next" title="listbox">
|
||||||
|
<link href="Widgets.html#Widgets" rel="prev" title="Widgets">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="button"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="listbox.html#listbox" accesskey="n" rel="next">listbox</a>, Previous: <a href="Widgets.html#Widgets" accesskey="p" rel="prev">Widgets</a>, Up: <a href="Widgets.html#Widgets" accesskey="u" rel="up">Widgets</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="button-1"></a>
|
||||||
|
<h3 class="section">2.1 button</h3>
|
||||||
|
|
||||||
|
<p>button \- Create and manipulate button widgets
|
||||||
|
</p><a name="Synopsis"></a>
|
||||||
|
<h4 class="unnumberedsubsec">Synopsis</h4>
|
||||||
|
<p><b>button</b><i> </i><i>pathName </i><span class="roman">?</span><i>options</i>?
|
||||||
|
</p><a name="Standard-Options"></a>
|
||||||
|
<h4 class="unnumberedsubsec">Standard Options</h4>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">activeBackground bitmap font relief
|
||||||
|
activeForeground borderWidth foreground text
|
||||||
|
anchor cursor padX textVariable
|
||||||
|
background disabledForeground padY
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<p>See <a href="options.html#options">options</a>, for more information.
|
||||||
|
</p><a name="Arguments-for-Button"></a>
|
||||||
|
<h4 class="unnumberedsubsec">Arguments for Button</h4>
|
||||||
|
|
||||||
|
|
||||||
|
<dl compact="compact">
|
||||||
|
<dt><code><b>:command</b></code></dt>
|
||||||
|
<dd><p align="right">Name=<code>"<b>command</b><span class="roman">"</span> Class=<code>"</code><b>Command</b>"</code>
|
||||||
|
</p><br>
|
||||||
|
|
||||||
|
<p>Specifies a Tcl command to associate with the button. This command
|
||||||
|
is typically invoked when mouse button 1 is released over the button
|
||||||
|
window.
|
||||||
|
</p></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
<dl compact="compact">
|
||||||
|
<dt><code><b>:height</b></code></dt>
|
||||||
|
<dd><p align="right">Name=<code>"<b>height</b><span class="roman">"</span> Class=<code>"</code><b>Height</b>"</code>
|
||||||
|
</p><br>
|
||||||
|
|
||||||
|
<p>Specifies a desired height for the button.
|
||||||
|
If a bitmap is being displayed in the button then the value is in
|
||||||
|
screen units (i.e. any of the forms acceptable to <b>Tk_GetPixels</b>);
|
||||||
|
for text it is in lines of text.
|
||||||
|
If this option isn’t specified, the button’s desired height is computed
|
||||||
|
from the size of the bitmap or text being displayed in it.
|
||||||
|
</p></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
<dl compact="compact">
|
||||||
|
<dt><code><b>:state</b></code></dt>
|
||||||
|
<dd><p align="right">Name=<code>"<b>state</b><span class="roman">"</span> Class=<code>"</code><b>State</b>"</code>
|
||||||
|
</p><br>
|
||||||
|
|
||||||
|
<p>Specifies one of three states for the button: <b>normal</b><span class="roman">, </span><b>active</b>,
|
||||||
|
or <b>disabled</b>. In normal state the button is displayed using the
|
||||||
|
<b>foreground</b><span class="roman"> and </span><b>background</b> options. The active state is
|
||||||
|
typically used when the pointer is over the button. In active state
|
||||||
|
the button is displayed using the <b>activeForeground</b> and
|
||||||
|
<b>activeBackground</b> options. Disabled state means that the button
|
||||||
|
is insensitive: it doesn’t activate and doesn’t respond to mouse
|
||||||
|
button presses. In this state the <b>disabledForeground</b> and
|
||||||
|
<b>background</b> options determine how the button is displayed.
|
||||||
|
</p></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
<dl compact="compact">
|
||||||
|
<dt><code><b>:width</b></code></dt>
|
||||||
|
<dd><p align="right">Name=<code>"<b>width</b><span class="roman">"</span> Class=<code>"</code><b>Width</b>"</code>
|
||||||
|
</p><br>
|
||||||
|
|
||||||
|
<p>Specifies a desired width for the button.
|
||||||
|
If a bitmap is being displayed in the button then the value is in
|
||||||
|
screen units (i.e. any of the forms acceptable to <b>Tk_GetPixels</b>);
|
||||||
|
for text it is in characters.
|
||||||
|
If this option isn’t specified, the button’s desired width is computed
|
||||||
|
from the size of the bitmap or text being displayed in it.
|
||||||
|
</p></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<a name="Description"></a>
|
||||||
|
<h4 class="unnumberedsubsec">Description</h4>
|
||||||
|
|
||||||
|
<p>The <b>button</b> command creates a new window (given by the
|
||||||
|
<i>pathName</i> argument) and makes it into a button widget.
|
||||||
|
Additional
|
||||||
|
options, described above, may be specified on the command line
|
||||||
|
or in the option database
|
||||||
|
to configure aspects of the button such as its colors, font,
|
||||||
|
text, and initial relief. The <b>button</b> command returns its
|
||||||
|
<i>pathName</i> argument. At the time this command is invoked,
|
||||||
|
there must not exist a window named <i>pathName</i>, but
|
||||||
|
<i>pathName</i>’s parent must exist.
|
||||||
|
</p>
|
||||||
|
<p>A button is a widget
|
||||||
|
that displays a textual string or bitmap.
|
||||||
|
It can display itself in either of three different ways, according
|
||||||
|
to
|
||||||
|
the <b>state</b> option;
|
||||||
|
it can be made to appear raised, sunken, or flat;
|
||||||
|
and it can be made to flash. When a user invokes the
|
||||||
|
button (by pressing mouse button 1 with the cursor over the
|
||||||
|
button), then the Tcl command specified in the <b>:command</b>
|
||||||
|
option is invoked.
|
||||||
|
</p>
|
||||||
|
<a name="A-Button-Widget_0027s-Arguments"></a>
|
||||||
|
<h4 class="unnumberedsubsec">A Button Widget’s Arguments</h4>
|
||||||
|
|
||||||
|
<p>The <b>button</b> command creates a new Tcl command whose
|
||||||
|
name is <i>pathName</i>. This
|
||||||
|
command may be used to invoke various
|
||||||
|
operations on the widget. It has the following general form:
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example"><i>pathName option </i><span class="roman">?</span><i>arg arg ...</i>?
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p><i>Option</i><span class="roman"> and the </span><i>arg</i>s
|
||||||
|
determine the exact behavior of the command. The following
|
||||||
|
commands are possible for button widgets:
|
||||||
|
</p>
|
||||||
|
<dl compact="compact">
|
||||||
|
<dt><i>pathName </i><b>:activate</b></dt>
|
||||||
|
<dd><p>Change the button’s state to <b>active</b> and redisplay the button
|
||||||
|
using its active foreground and background colors instead of normal
|
||||||
|
colors.
|
||||||
|
This command is ignored if the button’s state is <b>disabled</b>.
|
||||||
|
This command is obsolete and will eventually be removed;
|
||||||
|
use “<i>pathName </i><b>:configure :state active</b>” instead.
|
||||||
|
</p></dd>
|
||||||
|
<dt><i>pathName </i><b>:configure</b><span class="roman"> ?</span><i>option</i><span class="roman">? ?</span><i>value option value ...</i>?</dt>
|
||||||
|
<dd><p>Query or modify the configuration options of the widget.
|
||||||
|
If no <i>option</i> is specified, returns a list describing all of
|
||||||
|
the available options for <i>pathName</i><span class="roman"> (see </span><b>Tk_ConfigureInfo</b> for
|
||||||
|
information on the format of this list). If <i>option</i> is specified
|
||||||
|
with no <i>value</i>, then the command returns a list describing the
|
||||||
|
one named option (this list will be identical to the corresponding
|
||||||
|
sublist of the value returned if no <i>option</i> is specified). If
|
||||||
|
one or more <i>option:value</i> pairs are specified, then the command
|
||||||
|
modifies the given widget option(s) to have the given value(s); in
|
||||||
|
this case the command returns an empty string.
|
||||||
|
<i>Option</i><span class="roman"> may have any of the values accepted by the </span><b>button</b>
|
||||||
|
command.
|
||||||
|
</p></dd>
|
||||||
|
<dt><i>pathName </i><b>:deactivate</b></dt>
|
||||||
|
<dd><p>Change the button’s state to <b>normal</b> and redisplay the button
|
||||||
|
using its normal foreground and background colors.
|
||||||
|
This command is ignored if the button’s state is <b>disabled</b>.
|
||||||
|
This command is obsolete and will eventually be removed;
|
||||||
|
use “<i>pathName </i><b>:configure :state normal</b>” instead.
|
||||||
|
</p></dd>
|
||||||
|
<dt><i>pathName </i><b>:flash</b></dt>
|
||||||
|
<dd><p>Flash the button. This is accomplished by redisplaying the button
|
||||||
|
several times, alternating between active and normal colors. At
|
||||||
|
the end of the flash the button is left in the same normal/active
|
||||||
|
state as when the command was invoked.
|
||||||
|
This command is ignored if the button’s state is <b>disabled</b>.
|
||||||
|
</p></dd>
|
||||||
|
<dt><i>pathName </i><b>:invoke</b></dt>
|
||||||
|
<dd><p>Invoke the Tcl command associated with the button, if there is one.
|
||||||
|
The return value is the return value from the Tcl command, or an
|
||||||
|
empty string if there is no command associated with the button.
|
||||||
|
This command is ignored if the button’s state is <b>disabled</b>.
|
||||||
|
</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<a name="g_t_0022Default-Bindings_0022"></a>
|
||||||
|
<h4 class="unnumberedsubsec">"Default Bindings"</h4>
|
||||||
|
|
||||||
|
<p>Tk automatically creates class bindings for buttons that give them
|
||||||
|
the following default behavior:
|
||||||
|
</p><ul class="no-bullet">
|
||||||
|
<li> [1]
|
||||||
|
The button activates whenever the mouse passes over it and deactivates
|
||||||
|
whenever the mouse leaves the button.
|
||||||
|
</li><li> [2]
|
||||||
|
The button’s relief is changed to sunken whenever mouse button 1 is
|
||||||
|
pressed over the button, and the relief is restored to its original
|
||||||
|
value when button 1 is later released.
|
||||||
|
</li><li> [3]
|
||||||
|
If mouse button 1 is pressed over the button and later released over
|
||||||
|
the button, the button is invoked. However, if the mouse is not
|
||||||
|
over the button when button 1 is released, then no invocation occurs.
|
||||||
|
</li></ul>
|
||||||
|
|
||||||
|
<p>If the button’s state is <b>disabled</b> then none of the above
|
||||||
|
actions occur: the button is completely non-responsive.
|
||||||
|
</p>
|
||||||
|
<p>The behavior of buttons can be changed by defining new bindings for
|
||||||
|
individual widgets or by redefining the class bindings.
|
||||||
|
</p>
|
||||||
|
<a name="Keywords"></a>
|
||||||
|
<h4 class="unnumberedsubsec">Keywords</h4>
|
||||||
|
<p>button, widget
|
||||||
|
</p><hr>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="listbox.html#listbox" accesskey="n" rel="next">listbox</a>, Previous: <a href="Widgets.html#Widgets" accesskey="p" rel="prev">Widgets</a>, Up: <a href="Widgets.html#Widgets" accesskey="u" rel="up">Widgets</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,347 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
||||||
|
<head>
|
||||||
|
<title>GCL TK Manual: checkbutton</title>
|
||||||
|
|
||||||
|
<meta name="description" content="GCL TK Manual: checkbutton">
|
||||||
|
<meta name="keywords" content="GCL TK Manual: checkbutton">
|
||||||
|
<meta name="resource-type" content="document">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="Generator" content="makeinfo">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link href="index.html#Top" rel="start" title="Top">
|
||||||
|
<link href="wm.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||||
|
<link href="Widgets.html#Widgets" rel="up" title="Widgets">
|
||||||
|
<link href="menubutton.html#menubutton" rel="next" title="menubutton">
|
||||||
|
<link href="scrollbar.html#scrollbar" rel="prev" title="scrollbar">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
a.summary-letter {text-decoration: none}
|
||||||
|
blockquote.smallquotation {font-size: smaller}
|
||||||
|
div.display {margin-left: 3.2em}
|
||||||
|
div.example {margin-left: 3.2em}
|
||||||
|
div.indentedblock {margin-left: 3.2em}
|
||||||
|
div.lisp {margin-left: 3.2em}
|
||||||
|
div.smalldisplay {margin-left: 3.2em}
|
||||||
|
div.smallexample {margin-left: 3.2em}
|
||||||
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
||||||
|
div.smalllisp {margin-left: 3.2em}
|
||||||
|
kbd {font-style:oblique}
|
||||||
|
pre.display {font-family: inherit}
|
||||||
|
pre.format {font-family: inherit}
|
||||||
|
pre.menu-comment {font-family: serif}
|
||||||
|
pre.menu-preformatted {font-family: serif}
|
||||||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smallexample {font-size: smaller}
|
||||||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||||
|
pre.smalllisp {font-size: smaller}
|
||||||
|
span.nocodebreak {white-space:nowrap}
|
||||||
|
span.nolinebreak {white-space:nowrap}
|
||||||
|
span.roman {font-family:serif; font-weight:normal}
|
||||||
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
||||||
|
ul.no-bullet {list-style: none}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
||||||
|
<a name="checkbutton"></a>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="menubutton.html#menubutton" accesskey="n" rel="next">menubutton</a>, Previous: <a href="scrollbar.html#scrollbar" accesskey="p" rel="prev">scrollbar</a>, Up: <a href="Widgets.html#Widgets" accesskey="u" rel="up">Widgets</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<a name="checkbutton-1"></a>
|
||||||
|
<h3 class="section">2.7 checkbutton</h3>
|
||||||
|
|
||||||
|
<p>checkbutton \- Create and manipulate check-button widgets
|
||||||
|
</p><a name="Synopsis-6"></a>
|
||||||
|
<h4 class="unnumberedsubsec">Synopsis</h4>
|
||||||
|
<p><b>checkbutton</b><i> pathName </i><span class="roman">?</span><i>options</i>?
|
||||||
|
</p><a name="Standard-Options-6"></a>
|
||||||
|
<h4 class="unnumberedsubsec">Standard Options</h4>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example">activeBackground bitmap font relief
|
||||||
|
activeForeground borderWidth foreground text
|
||||||
|
anchor cursor padX textVariable
|
||||||
|
background disabledForeground padY
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<p>See <a href="options.html#options">options</a>, for more information.
|
||||||
|
</p><a name="Arguments-for-Checkbutton"></a>
|
||||||
|
<h4 class="unnumberedsubsec">Arguments for Checkbutton</h4>
|
||||||
|
|
||||||
|
|
||||||
|
<dl compact="compact">
|
||||||
|
<dt><code><b>:command</b></code></dt>
|
||||||
|
<dd><p align="right">Name=<code>"<b>command</b><span class="roman">"</span> Class=<code>"</code><b>Command</b>"</code>
|
||||||
|
</p><br>
|
||||||
|
|
||||||
|
<p>Specifies a Tcl command to associate with the button. This command
|
||||||
|
is typically invoked when mouse button 1 is released over the button
|
||||||
|
window. The button’s global variable (<b>:variable</b> option) will
|
||||||
|
be updated before the command is invoked.
|
||||||
|
</p></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
<dl compact="compact">
|
||||||
|
<dt><code><b>:height</b></code></dt>
|
||||||
|
<dd><p align="right">Name=<code>"<b>height</b><span class="roman">"</span> Class=<code>"</code><b>Height</b>"</code>
|
||||||
|
</p><br>
|
||||||
|
|
||||||
|
<p>Specifies a desired height for the button.
|
||||||
|
If a bitmap is being displayed in the button then the value is in
|
||||||
|
screen units (i.e. any of the forms acceptable to <b>Tk_GetPixels</b>);
|
||||||
|
for text it is in lines of text.
|
||||||
|
If this option isn’t specified, the button’s desired height is computed
|
||||||
|
from the size of the bitmap or text being displayed in it.
|
||||||
|
</p></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
<dl compact="compact">
|
||||||
|
<dt><code><b>:offvalue</b></code></dt>
|
||||||
|
<dd><p align="right">Name=<code>"<b>offValue</b><span class="roman">"</span> Class=<code>"</code><b>Value</b>"</code>
|
||||||
|
</p><br>
|
||||||
|
|
||||||
|
<p>Specifies value to store in the button’s associated variable whenever
|
||||||
|
this button is deselected. Defaults to “0”.
|
||||||
|
</p></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
<dl compact="compact">
|
||||||
|
<dt><code><b>:onvalue</b></code></dt>
|
||||||
|
<dd><p align="right">Name=<code>"<b>onValue</b><span class="roman">"</span> Class=<code>"</code><b>Value</b>"</code>
|
||||||
|
</p><br>
|
||||||
|
|
||||||
|
<p>Specifies value to store in the button’s associated variable whenever
|
||||||
|
this button is selected. Defaults to “1”.
|
||||||
|
</p></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
<dl compact="compact">
|
||||||
|
<dt><code><b>:selector</b></code></dt>
|
||||||
|
<dd><p align="right">Name=<code>"<b>selector</b><span class="roman">"</span> Class=<code>"</code><b>Foreground</b>"</code>
|
||||||
|
</p><br>
|
||||||
|
|
||||||
|
<p>Specifies the color to draw in the selector when this button is
|
||||||
|
selected.
|
||||||
|
If specified as an empty string then no selector is
|
||||||
|
drawn for the button.
|
||||||
|
</p></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
<dl compact="compact">
|
||||||
|
<dt><code><b>:state</b></code></dt>
|
||||||
|
<dd><p align="right">Name=<code>"<b>state</b><span class="roman">"</span> Class=<code>"</code><b>State</b>"</code>
|
||||||
|
</p><br>
|
||||||
|
|
||||||
|
<p>Specifies one of three states for the check button: <b>normal</b><span class="roman">, </span><b>active</b>,
|
||||||
|
or <b>disabled</b>. In normal state the check button is displayed using the
|
||||||
|
<b>foreground</b><span class="roman"> and </span><b>background</b> options. The active state is
|
||||||
|
typically used when the pointer is over the check button. In active state
|
||||||
|
the check button is displayed using the <b>activeForeground</b> and
|
||||||
|
<b>activeBackground</b> options. Disabled state means that the check button
|
||||||
|
is insensitive: it doesn’t activate and doesn’t respond to mouse
|
||||||
|
button presses. In this state the <b>disabledForeground</b> and
|
||||||
|
<b>background</b> options determine how the check button is displayed.
|
||||||
|
</p></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
<dl compact="compact">
|
||||||
|
<dt><code><b>:variable</b></code></dt>
|
||||||
|
<dd><p align="right">Name=<code>"<b>variable</b><span class="roman">"</span> Class=<code>"</code><b>Variable</b>"</code>
|
||||||
|
</p><br>
|
||||||
|
|
||||||
|
<p>Specifies name of global variable to set to indicate whether
|
||||||
|
or not this button is selected. Defaults to the name of the
|
||||||
|
button within its parent (i.e. the last element of the button
|
||||||
|
window’s path name).
|
||||||
|
</p></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
<dl compact="compact">
|
||||||
|
<dt><code><b>:width</b></code></dt>
|
||||||
|
<dd><p align="right">Name=<code>"<b>width</b><span class="roman">"</span> Class=<code>"</code><b>Width</b>"</code>
|
||||||
|
</p><br>
|
||||||
|
|
||||||
|
<p>Specifies a desired width for the button.
|
||||||
|
If a bitmap is being displayed in the button then the value is in
|
||||||
|
screen units (i.e. any of the forms acceptable to <b>Tk_GetPixels</b>);
|
||||||
|
for text it is in characters.
|
||||||
|
If this option isn’t specified, the button’s desired width is computed
|
||||||
|
from the size of the bitmap or text being displayed in it.
|
||||||
|
</p></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<a name="Description-4"></a>
|
||||||
|
<h4 class="unnumberedsubsec">Description</h4>
|
||||||
|
|
||||||
|
<p>The <b>checkbutton</b> command creates a new window (given by the
|
||||||
|
<i>pathName</i> argument) and makes it into a check-button widget.
|
||||||
|
Additional
|
||||||
|
options, described above, may be specified on the command line
|
||||||
|
or in the option database
|
||||||
|
to configure aspects of the check button such as its colors, font,
|
||||||
|
text, and initial relief. The <b>checkbutton</b> command returns its
|
||||||
|
<i>pathName</i> argument. At the time this command is invoked,
|
||||||
|
there must not exist a window named <i>pathName</i>, but
|
||||||
|
<i>pathName</i>’s parent must exist.
|
||||||
|
</p>
|
||||||
|
<p>A check button is a widget
|
||||||
|
that displays a textual string or bitmap
|
||||||
|
and a square called a <i>selector</i>.
|
||||||
|
A check button has
|
||||||
|
all of the behavior of a simple button, including the
|
||||||
|
following: it can display itself in either of three different
|
||||||
|
ways, according to the <b>state</b> option;
|
||||||
|
it can be made to appear
|
||||||
|
raised, sunken, or flat; it can be made to flash; and it invokes
|
||||||
|
a Tcl command whenever mouse button 1 is clicked over the
|
||||||
|
check button.
|
||||||
|
</p>
|
||||||
|
<p>In addition, check buttons can be <i>selected</i>. If a check button is
|
||||||
|
selected then a special highlight appears in the selector, and
|
||||||
|
a Tcl variable associated with the check button is set to a particular
|
||||||
|
value (normally 1). If the check button is not selected, then
|
||||||
|
the selector is drawn in a different fashion and the associated
|
||||||
|
variable is set to a different value (typically 0). By default,
|
||||||
|
the name of the variable associated with a check button is the
|
||||||
|
same as the <i>name</i> used to create the check button. The
|
||||||
|
variable name, and the “on” and “off” values stored in it,
|
||||||
|
may be modified with options on the command line or in the option
|
||||||
|
database. By default a check button is configured to select and deselect
|
||||||
|
itself on alternate button clicks.
|
||||||
|
In addition, each check button monitors its associated variable and
|
||||||
|
automatically selects and deselects itself when the variables value
|
||||||
|
changes to and from the button’s “on” value.
|
||||||
|
</p>
|
||||||
|
<a name="A-Checkbutton-Widget_0027s-Arguments"></a>
|
||||||
|
<h4 class="unnumberedsubsec">A Checkbutton Widget’s Arguments</h4>
|
||||||
|
|
||||||
|
<p>The <b>checkbutton</b> command creates a new Tcl command whose
|
||||||
|
name is <i>pathName</i>. This
|
||||||
|
command may be used to invoke various
|
||||||
|
operations on the widget. It has the following general form:
|
||||||
|
</p>
|
||||||
|
<div class="example">
|
||||||
|
<pre class="example"><i>pathName option </i><span class="roman">?</span><i>arg arg ...</i>?
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p><i>Option</i><span class="roman"> and the </span><i>arg</i>s
|
||||||
|
determine the exact behavior of the command. The following
|
||||||
|
commands are possible for check button widgets:
|
||||||
|
</p>
|
||||||
|
<dl compact="compact">
|
||||||
|
<dt><i>pathName </i><b>:activate</b></dt>
|
||||||
|
<dd><p>Change the check button’s state to <b>active</b> and redisplay the button
|
||||||
|
using its active foreground and background colors instead of normal
|
||||||
|
colors.
|
||||||
|
This command is ignored if the check button’s state is <b>disabled</b>.
|
||||||
|
This command is obsolete and will eventually be removed;
|
||||||
|
use “<i>pathName </i><b>:configure :state active</b>” instead.
|
||||||
|
</p></dd>
|
||||||
|
<dt><i>pathName </i><b>:configure</b><span class="roman"> ?</span><i>option</i><span class="roman">? ?</span><i>value option value ...</i>?</dt>
|
||||||
|
<dd><p>Query or modify the configuration options of the widget.
|
||||||
|
If no <i>option</i> is specified, returns a list describing all of
|
||||||
|
the available options for <i>pathName</i><span class="roman"> (see </span><b>Tk_ConfigureInfo</b> for
|
||||||
|
information on the format of this list). If <i>option</i> is specified
|
||||||
|
with no <i>value</i>, then the command returns a list describing the
|
||||||
|
one named option (this list will be identical to the corresponding
|
||||||
|
sublist of the value returned if no <i>option</i> is specified). If
|
||||||
|
one or more <i>option:value</i> pairs are specified, then the command
|
||||||
|
modifies the given widget option(s) to have the given value(s); in
|
||||||
|
this case the command returns an empty string.
|
||||||
|
<i>Option</i><span class="roman"> may have any of the values accepted by the </span><b>checkbutton</b>
|
||||||
|
command.
|
||||||
|
</p></dd>
|
||||||
|
<dt><i>pathName </i><b>:deactivate</b></dt>
|
||||||
|
<dd><p>Change the check button’s state to <b>normal</b> and redisplay the button
|
||||||
|
using its normal foreground and background colors.
|
||||||
|
This command is ignored if the check button’s state is <b>disabled</b>.
|
||||||
|
This command is obsolete and will eventually be removed;
|
||||||
|
use “<i>pathName </i><b>:configure :state normal</b>” instead.
|
||||||
|
</p></dd>
|
||||||
|
<dt><i>pathName </i><b>:deselect</b></dt>
|
||||||
|
<dd><p>Deselect the check button: redisplay it without a highlight in
|
||||||
|
the selector and set the associated variable to its “off”
|
||||||
|
value.
|
||||||
|
</p></dd>
|
||||||
|
<dt><i>pathName </i><b>:flash</b></dt>
|
||||||
|
<dd><p>Flash the check button. This is accomplished by redisplaying the check button
|
||||||
|
several times, alternating between active and normal colors. At
|
||||||
|
the end of the flash the check button is left in the same normal/active
|
||||||
|
state as when the command was invoked.
|
||||||
|
This command is ignored if the check button’s state is <b>disabled</b>.
|
||||||
|
</p></dd>
|
||||||
|
<dt><i>pathName </i><b>:invoke</b></dt>
|
||||||
|
<dd><p>Does just what would have happened if the user invoked the check button
|
||||||
|
with the mouse: toggle the selection state of the button and invoke
|
||||||
|
the Tcl command associated with the check button, if there is one.
|
||||||
|
The return value is the return value from the Tcl command, or an
|
||||||
|
empty string if there is no command associated with the check button.
|
||||||
|
This command is ignored if the check button’s state is <b>disabled</b>.
|
||||||
|
</p></dd>
|
||||||
|
<dt><i>pathName </i><b>:select</b></dt>
|
||||||
|
<dd><p>Select the check button: display it with a highlighted
|
||||||
|
selector and set the associated variable to its “on”
|
||||||
|
value.
|
||||||
|
</p></dd>
|
||||||
|
<dt><i>pathName </i><b>:toggle</b></dt>
|
||||||
|
<dd><p>Toggle the selection state of the button, redisplaying it and
|
||||||
|
modifying its associated variable to reflect the new state.
|
||||||
|
</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<a name="Bindings-3"></a>
|
||||||
|
<h4 class="unnumberedsubsec">Bindings</h4>
|
||||||
|
|
||||||
|
<p>Tk automatically creates class bindings for check buttons that give them
|
||||||
|
the following default behavior:
|
||||||
|
</p><ul class="no-bullet">
|
||||||
|
<li> [1]
|
||||||
|
The check button activates whenever the mouse passes over it and deactivates
|
||||||
|
whenever the mouse leaves the check button.
|
||||||
|
</li><li> [2]
|
||||||
|
The check button’s relief is changed to sunken whenever mouse button 1 is
|
||||||
|
pressed over it, and the relief is restored to its original
|
||||||
|
value when button 1 is later released.
|
||||||
|
</li><li> [3]
|
||||||
|
If mouse button 1 is pressed over the check button and later released over
|
||||||
|
the check button, the check button is invoked (i.e. its selection
|
||||||
|
state toggles and the command associated with the button is invoked,
|
||||||
|
if there is one). However, if the mouse is not
|
||||||
|
over the check button when button 1 is released, then no invocation occurs.
|
||||||
|
</li></ul>
|
||||||
|
|
||||||
|
<p>If the check button’s state is <b>disabled</b> then none of the above
|
||||||
|
actions occur: the check button is completely non-responsive.
|
||||||
|
</p>
|
||||||
|
<p>The behavior of check buttons can be changed by defining new bindings for
|
||||||
|
individual widgets or by redefining the class bindings.
|
||||||
|
</p>
|
||||||
|
<a name="Keywords-6"></a>
|
||||||
|
<h4 class="unnumberedsubsec">Keywords</h4>
|
||||||
|
<p>check button, widget
|
||||||
|
</p><hr>
|
||||||
|
<div class="header">
|
||||||
|
<p>
|
||||||
|
Next: <a href="menubutton.html#menubutton" accesskey="n" rel="next">menubutton</a>, Previous: <a href="scrollbar.html#scrollbar" accesskey="p" rel="prev">scrollbar</a>, Up: <a href="Widgets.html#Widgets" accesskey="u" rel="up">Widgets</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,158 @@
|
||||||
|
|
||||||
|
;; bug in aix c compiler on optimize??
|
||||||
|
#+aix3 (eval-when (compile) (proclaim '(optimize (speed 0))))
|
||||||
|
|
||||||
|
(in-package "TK")
|
||||||
|
|
||||||
|
(defvar *gc-monitor-types*
|
||||||
|
'(cons fixnum string si::relocatable-blocks stream))
|
||||||
|
|
||||||
|
(defvar *special-type-background* "red")
|
||||||
|
|
||||||
|
(defun make-one-graph (top type)
|
||||||
|
(let* ((f (conc top '.type type)))
|
||||||
|
(setf (get type 'frame) f)
|
||||||
|
(setf (get type 'canvas) (conc top '.canvas type))
|
||||||
|
(frame f )
|
||||||
|
(canvas (get type 'canvas) :relief "sunken" :width "8c" :height ".4c")
|
||||||
|
(label (conc f '.data))
|
||||||
|
(button (conc f '.label) :text (string-capitalize (symbol-name type))
|
||||||
|
:background "gray90"
|
||||||
|
:command `(draw-status ',type t))
|
||||||
|
(pack (conc f '.label) (conc f '.data) :side "left" :anchor "w" :padx "4m")
|
||||||
|
(pack f :side "top" :anchor "w" :padx "1c")
|
||||||
|
(pack (get type 'canvas) :side "top" :expand 1 :pady "2m")
|
||||||
|
))
|
||||||
|
|
||||||
|
(defvar *prev-special-type* nil)
|
||||||
|
|
||||||
|
(defvar *time-to-stay-on-type* 0)
|
||||||
|
|
||||||
|
|
||||||
|
(defvar *values-array* (make-array 20 :fill-pointer 0))
|
||||||
|
(defun push-multiple-values (&rest l)
|
||||||
|
(declare (:dynamic-extent l))
|
||||||
|
(dolist (v l) (vector-push-extend v *values-array*)))
|
||||||
|
|
||||||
|
(defun draw-status (special-type &optional clicked)
|
||||||
|
(setf (fill-pointer *values-array*) 0)
|
||||||
|
(let ((max-size 0) (ar *values-array*) (i 0) (width 7.0s0)
|
||||||
|
(ht ".15c"))
|
||||||
|
(declare (fixnum max-size) (short-float width)(type (array (t)) ar))
|
||||||
|
(dolist (v *gc-monitor-types*)
|
||||||
|
(let ((fp (fill-pointer *values-array*))
|
||||||
|
)
|
||||||
|
(multiple-value-call 'push-multiple-values (si::allocated v))
|
||||||
|
(setq max-size (max max-size (aref ar (the fixnum (+ fp 1)))))))
|
||||||
|
; (nfree npages maxpage nppage gccount nused)
|
||||||
|
(dolist (v *gc-monitor-types*)
|
||||||
|
(let* ((nfree (aref ar i))
|
||||||
|
(npages (aref ar (setq i(+ i 1))))
|
||||||
|
(nppage (aref ar (setq i(+ i 2))))
|
||||||
|
(gccount (aref ar (setq i (+ i 1))))
|
||||||
|
(nused (aref ar (setq i (+ i 1))))
|
||||||
|
(wid (/ (the short-float(* npages width)) max-size))
|
||||||
|
(f (get v 'frame))
|
||||||
|
(tot (* npages nppage))
|
||||||
|
(width-used (the short-float
|
||||||
|
(/ (the short-float
|
||||||
|
(* wid (the fixnum
|
||||||
|
(- tot
|
||||||
|
(the fixnum nfree)))))
|
||||||
|
tot))))
|
||||||
|
(declare (fixnum nppage npages tot)
|
||||||
|
(short-float wid))
|
||||||
|
(setq i (+ i 1))
|
||||||
|
(funcall (get v 'canvas) :delete "graph")
|
||||||
|
(funcall (get v 'canvas) :create "line"
|
||||||
|
0 ht
|
||||||
|
width-used : "c" ht
|
||||||
|
:width "3m" :tag "graph" :fill "red")
|
||||||
|
(funcall (get v 'canvas) :create "line"
|
||||||
|
width-used : "c" ht
|
||||||
|
wid : "c" ht
|
||||||
|
:width "3m" :tag "graph" :fill "aquamarine4" )
|
||||||
|
(funcall (conc f '.data) :configure :text
|
||||||
|
gccount : " gc's for ": npages :
|
||||||
|
" pages (used=" : nused : ")")
|
||||||
|
(cond ((eql special-type v)
|
||||||
|
(cond
|
||||||
|
(clicked
|
||||||
|
(let ((n (* max-size 2)))
|
||||||
|
(.gc.amount :configure :length "8c"
|
||||||
|
:label "Allocate: " : (or special-type "")
|
||||||
|
:tickinterval (truncate n 4) :to n)
|
||||||
|
(.gc.amount :set npages)
|
||||||
|
|
||||||
|
)))))))
|
||||||
|
(set-label-background *prev-special-type* "pink")
|
||||||
|
|
||||||
|
(setq *prev-special-type* special-type)
|
||||||
|
(set-label-background special-type *special-type-background*)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(defun do-allocation ()
|
||||||
|
(when *prev-special-type*
|
||||||
|
(allocate *prev-special-type*
|
||||||
|
(.gc.amount :get :return 'number)
|
||||||
|
t)
|
||||||
|
(draw-status *prev-special-type*)))
|
||||||
|
|
||||||
|
(defun set-label-background (type colour)
|
||||||
|
(and (get type 'frame)
|
||||||
|
(let ((label (conc (get type 'frame) '.label)))
|
||||||
|
(funcall label :configure :background colour))))
|
||||||
|
|
||||||
|
|
||||||
|
(defun mkgcmonitor()
|
||||||
|
(let (si::*after-gbc-hook*)
|
||||||
|
(toplevel '.gc)
|
||||||
|
(wm :title '.gc "GC Monitor")
|
||||||
|
(wm :title '.gc "GC")
|
||||||
|
(or (> (read-from-string (winfo :depth '.gc)) 1)
|
||||||
|
(setq *special-type-background* "white"))
|
||||||
|
(message '.gc.msg :font :Adobe-times-medium-r-normal--*-180* :aspect 400
|
||||||
|
:text
|
||||||
|
"GC monitor displays after each garbage collection the amount of space used (red) and free (green) of the types in the list *gc-monitor-types*. Clicking on a type makes its size appear on the scale at the bottom, and double clicking on the scale causes actual allocation!")
|
||||||
|
(pack '.gc.msg :side "top")
|
||||||
|
(dolist (v *gc-monitor-types*)
|
||||||
|
(make-one-graph '.gc v)
|
||||||
|
)
|
||||||
|
(.gc :configure :borderwidth 4 :relief "ridge")
|
||||||
|
;; it is important to create the frame first, so that
|
||||||
|
;; it is earlier... and the others will show.
|
||||||
|
(frame '.gc.ff)
|
||||||
|
(button '.gc.ok :text "QUIT"
|
||||||
|
:command `(progn (setq si::*after-gbc-hook* nil)
|
||||||
|
(destroy '.gc)))
|
||||||
|
|
||||||
|
(scale '.gc.amount :label "Amount :" :width ".3c"
|
||||||
|
:orient "horizontal" :to 100)
|
||||||
|
(pack '.gc.amount)
|
||||||
|
(button '.gc.reset :text "RESET Number Used"
|
||||||
|
:command '(progn (dolist (v *gc-monitor-types*)
|
||||||
|
(set-label-background v "gray90"))
|
||||||
|
(si::reset-number-used)
|
||||||
|
(draw-status *prev-special-type*)))
|
||||||
|
(button '.gc.update :text "Update"
|
||||||
|
:command '(draw-status *prev-special-type*))
|
||||||
|
|
||||||
|
(pack '.gc.ok '.gc.reset '.gc.update :expand 1 :fill "x"
|
||||||
|
:in '.gc.ff :padx 3 :pady 2 :side 'left)
|
||||||
|
|
||||||
|
(pack '.gc.ff :expand 1 :fill "x")
|
||||||
|
(bind '.gc.amount "<Double-ButtonPress-1>"
|
||||||
|
'do-allocation)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(draw-status nil))
|
||||||
|
(setq si::*after-gbc-hook* 'draw-status)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue