If NUMBER is zero, returns NUMBER; else returns (/ NUMBER (ABS NUMBER)).
Returns the bit-wise logical NOT of INTEGER.
Returns, as three values, the integer interpretation of significand F, the exponent E, and the sign S of the given float, so that E FLOAT = S * F * B where B = (FLOAT-RADIX FLOAT)
F is a non-negative integer, E is an integer, and S is either 1 or -1.
Returns T if NUMBER < 0; NIL otherwise.
Returns the logical OR of (LOGNOT INTEGER1) and INTEGER2.
Performs a bit-wise logical NAND on the elements of BIT-ARRAY1 and BIT-ARRAY2. Puts the results into a new bit array if RESULT-BIT-ARRAY is NIL, into BIT-ARRAY1 if RESULT-BIT-ARRAY is T, or into RESULT-BIT-ARRAY otherwise.
Performs the inverse of CHAR-INT. Equivalent to CODE-CHAR in GCL.
Returns the font, bits, and code attributes as a single non-negative integer. Equivalent to CHAR-CODE in GCL.
Returns T if no two of its arguments are numerically equal; NIL otherwise.
Returns T if at least one of the bits in the specified bytes of INTEGER is 1; NIL otherwise.
Converts NUMBER into rational accurately and returns it.
Returns the sine of RADIANS.
Returns as an integer the numerator of the given rational number.
Extracts the specified byte from INTEGER.
Syntax:
(incf place [delta])
Adds the number produced by DELTA (which defaults to 1) to the number in PLACE.
Returns the hyperbolic sine of NUMBER.
Returns the angle part of the polar representation of a complex number. For non-complex numbers, this is 0.
Returns an integer produced by performing the logical operation specified by OP on the two integers. OP must be the value of one of the following constants: BOOLE-CLR BOOLE-C1 BOOLE-XOR BOOLE-ANDC1 BOOLE-SET BOOLE-C2 BOOLE-EQV BOOLE-ANDC2 BOOLE-1 BOOLE-AND BOOLE-NAND BOOLE-ORC1 BOOLE-2 BOOLE-IOR BOOLE-NOR BOOLE-ORC2 See the variable docs of these constants for their operations.
Returns the logical OR of INTEGER1 and (LOGNOT INTEGER2).
Extracts the real part of NUMBER.
Values: (quotient remainder) Same as TRUNCATE, but returns first value as a float.
Returns T if X and Y are EQ, or if they are numbers of the same type with the same value, or if they are character objects that represent the same character. Returns NIL otherwise.
Returns the logarithm of NUMBER in the base BASE. BASE defaults to the base of natural logarithms.
Returns the bit-wise INCLUSIVE OR of its arguments.
Divides the first NUMBER by each of the subsequent NUMBERS. With one arg, returns the reciprocal of the number.
Returns NUMBER + 1.
Same as CEILING, but returns a float as the first value.
Performs a bit-wise logical ANDC1 on the elements of BIT-ARRAY1 and BIT-ARRAY2. Puts the results into a new bit array if RESULT-BIT-ARRAY is NIL, into BIT-ARRAY1 if RESULT-BIT-ARRAY is T, or into RESULT-BIT-ARRAY otherwise.
Returns the tangent of RADIANS.
Returns the hyperbolic tangent of NUMBER.
Returns the arc sine of NUMBER.
Returns a byte specifier. In GCL, a byte specifier is represented by a dotted pair (<size> . <position>).
Returns the hyperbolic arc sine of NUMBER.
Syntax:
(shiftf {place}+ newvalue)
Evaluates all PLACEs and NEWVALUE in turn, then assigns the value of each form to the PLACE on its left. Returns the original value of the leftmost form.
Returns an integer computed by replacing the specified byte of INTEGER with the specified byte of NEWBYTE.
Performs a bit-wise logical AND on the elements of BIT-ARRAY1 and BIT-ARRAY2. Puts the results into a new bit array if RESULT-BIT-ARRAY is NIL, into BIT-ARRAY1 if RESULT-BIT-ARRAY is T, or into RESULT-BIT-ARRAY otherwise.
Returns the complement of the logical AND of INTEGER1 and INTEGER2.
Returns the position part (in GCL, the cdr part) of the byte specifier.
Syntax:
(rotatef {place}*)
Evaluates PLACEs in turn, then assigns to each PLACE the value of the form to its right. The rightmost PLACE gets the value of the leftmost PLACE. Returns NIL always.
Performs a bit-wise logical ANDC2 on the elements of BIT-ARRAY1 and BIT-ARRAY2. Puts the results into a new bit array if RESULT-BIT-ARRAY is NIL, into BIT-ARRAY1 if RESULT-BIT-ARRAY is T, or into RESULT-BIT-ARRAY otherwise.
Values: (quotient remainder) Returns NUMBER/DIVISOR as an integer, rounded toward 0. The second returned value is the remainder.
Extracts and right-justifies the specified byte of INTEGER, and returns the result.
Returns the size part (in GCL, the car part) of the byte specifier.
Returns the second value of (TRUNCATE NUMBER DIVISOR).
Returns the least of its arguments.
Calculates e raised to the power NUMBER, where e is the base of natural logarithms.
Returns, as three values, the significand F, the exponent E, and the sign S of the given float, so that E FLOAT = S * F * B where B = (FLOAT-RADIX FLOAT)
S and F are floating-point numbers of the same float format as FLOAT, and E is an integer.
Same as ROUND, but returns first value as a float.
Returns the bit-wise EQUIVALENCE of its arguments.
Performs a bit-wise logical NOR on the elements of BIT-ARRAY1 and BIT-ARRAY2. Puts the results into a new bit array if RESULT-BIT-ARRAY is NIL, into BIT-ARRAY1 if RESULT-BIT-ARRAY is T, or into RESULT-BIT-ARRAY otherwise.
Returns the smallest integer not less than or NUMBER/DIVISOR. Returns the remainder as the second value.
Returns NUMBER - 1.
Returns T if arguments are in strictly non-decreasing order; NIL otherwise.
Extracts the imaginary part of NUMBER.
Returns T if X is an integer (fixnum or bignum); NIL otherwise.
Shifts INTEGER left by COUNT places. Shifts right if COUNT is negative.
Returns the least common multiple of the arguments.
Returns the cosine of RADIANS.
Syntax:
(decf place [delta])
Subtracts the number produced by DELTA (which defaults to 1) from the number in PLACE.
Returns the representation radix (or base) of the floating-point number.
Returns the hyperbolic arc tangent of NUMBER.
Returns T if X is a floating-point number; NIL otherwise.
Computes a hash code for OBJECT and returns it as an integer.
Returns the logical AND of (LOGNOT INTEGER1) and INTEGER2.
Returns T if X is a complex number; NIL otherwise.
Returns the greatest of its arguments.
Returns a floating-point number with the same sign as FLOAT1 and with the same absolute value as FLOAT2.
Returns the denominator of RATIONAL as an integer.
Converts a non-complex number to a floating-point number. If NUMBER is already a float, FLOAT simply returns NUMBER. Otherwise, the format of the returned float depends on OTHER; If OTHER is not provided, FLOAT returns a SINGLE-FLOAT. If OTHER is provided, the result is in the same float format as OTHER's.
Rounds NUMBER/DIVISOR to nearest integer. The second returned value is the remainder.
Returns the bit-wise AND of its arguments.
Returns the product of its arguments. With no args, returns 1.
Returns T if its arguments are in strictly increasing order; NIL otherwise.
Returns a complex number with the given real and imaginary parts.
Returns the logical AND of INTEGER1 and (LOGNOT INTEGER2).
Returns the number of significant bits in the absolute value of INTEGER.
Returns T if arguments are in strictly non-increasing order; NIL otherwise.
Returns the arc cosine of NUMBER.
Creates and returns a copy of the specified random state. If STATE is NIL, then the value of *RANDOM-STATE* is used. If STATE is T, then returns a random state object generated from the universal time.
Returns BASE-NUMBER raised to the power POWER-NUMBER.
Returns the principal square root of NUMBER.
Returns (* FLOAT (expt (float-radix FLOAT) INTEGER)).
Returns the hyperbolic arc cosine of NUMBER.
Same as FLOOR, but returns a float as the first value.
Returns the complement of the logical OR of INTEGER1 and INTEGER2.
Parses STRING for an integer and returns it.
Returns the sum of its arguments. With no args, returns 0.
Returns T if all of its arguments are numerically equal; NIL otherwise.
Returns T if X is any kind of number; NIL otherwise.
Returns T if LOGAND of INTEGER1 and INTEGER2 is not zero; NIL otherwise.
Returns T if X is a random-state object; NIL otherwise.
Returns the number of significant radix-B digits used to represent the significand F of the floating-point number, where B = (FLOAT-RADIX FLOAT).
Returns an integer computed by replacing the specified byte of INTEGER with NEWBYTE.
Returns the absolute value of NUMBER.
Returns the complex conjugate of NUMBER.
Returns e raised to i*RADIANS.
Returns T if INTEGER is odd; NIL otherwise.
Converts NUMBER into rational approximately and returns it.
Returns the greatest integer less than or equal to the square root of the given non-negative integer.
Returns the bit-wise EXCLUSIVE OR of its arguments.
Returns T if its arguments are in strictly decreasing order; NIL otherwise.
Returns T if the INDEX-th bit of INTEGER is 1.
If INTEGER is negative, returns the number of 0 bits. Otherwise, returns the number of 1 bits.
Returns the greatest common divisor of INTEGERs.
Returns T if X is an integer or a ratio; NIL otherwise.
Returns the second result of (FLOOR NUMBER DIVISOR).
Returns the largest integer not larger than the NUMBER divided by DIVISOR. The second returned value is (- NUMBER (* first-value DIVISOR)).
Returns T if NUMBER > 0; NIL otherwise.
Returns the number of radix-B digits used to represent the significand F of the floating-point number, where B = (FLOAT-RADIX FLOAT).
Generates a uniformly distributed pseudo-random number between zero (inclusive) and NUMBER (exclusive), by using the random state object STATE.
Constructs a Simple-Vector from the given objects.
Returns a copy of a subsequence of SEQUENCE between START (inclusive) and END (exclusive).
Returns a copy of SEQUENCE.
Returns the index of the first element in SEQUENCE that satisfies TEST with ITEM; NIL if no such element exists.
Returns the number of dimensions of ARRAY.
Returns the bit from SIMPLE-BIT-ARRAY at SUBSCRIPTS.
Returns a copy of STRING with the first character of each word converted to upper-case, and remaining characters in the word converted to lower case.
Returns a sequence of the same kind as SEQUENCE with the same elements
except that all elements not satisfying TEST are replaced with NEWITEM. SEQUENCE may be destroyed.
Returns the index of the first element in SEQUENCE that satisfies TEST; NIL if no such element exists.
Performs a bit-wise logical EQV on the elements of BIT-ARRAY1 and BIT-ARRAY2. Puts the results into a new bit array if RESULT-BIT-ARRAY is NIL, into BIT-ARRAY1 if RESULT-BIT-ARRAY is T, or into RESULT-BIT-ARRAY otherwise.
If STRING1 is lexicographically less than STRING2, then returns the longest common prefix of the strings. Otherwise, returns NIL.
Returns a new sequence containing the same elements as SEQUENCE but in reverse order.
Returns STRING with all lower case characters converted to uppercase.
If STRING1 is lexicographically greater than or equal to STRING2, then returns the longest common prefix of the strings. Otherwise, returns NIL.
Returns the index into the data vector of ARRAY for the element of ARRAY specified by SUBSCRIPTS.
Returns the length of AXIS-NUMBER of ARRAY.
Returns the first element in SEQUENCE satisfying TEST with ITEM; NIL if no such element exists.
Similar to STRING=, but ignores cases.
Returns a copy of STRING with the characters in CHAR-BAG removed from the right end.
Returns a sequence formed by destructively removing the elements not satisfying TEST from SEQUENCE.
Returns a copy of SEQUENCE with elements not satisfying TEST removed.
Returns T if the two strings are character-wise CHAR=; NIL otherwise.
Returns a sequence of the same kind as SEQUENCE with the same elements except that all elements satisfying TEST are replaced with NEWITEM. SEQUENCE may be destroyed.
Returns T if at least one of the elements in SEQUENCEs satisfies PREDICATE; NIL otherwise.
Creates and returns a new string of SIZE length whose elements are all INITIAL-ELEMENT.
Returns a sequence of the same kind as SEQUENCE with the same elements except that OLDITEMs are replaced with NEWITEM. SEQUENCE may be destroyed.
Given two strings (string1 and string2), and optional integers start1, start2, end1 and end2, compares characters in string1 to characters in string2 (using char-equal).
Similar to STRING<=, but ignores cases.
If STRING1 is lexicographically greater than STRING2, then returns the longest common prefix of the strings. Otherwise, returns NIL.
Returns T if X is a string; NIL otherwise.
Returns a sequence formed by removing the elements satisfying TEST destructively from SEQUENCE.
Returns T if X is a simple string; NIL otherwise.
Returns a copy of SEQUENCE with elements satisfying TEST removed.
Returns the number of entries in the given Hash-Table.
Returns a list whose elements are the dimensions of ARRAY
Returns a sequence of the same kind as SEQUENCE with the same elements except that all elements not satisfying TEST are replaced with NEWITEM.
Returns T if ARRAY is adjustable; NIL otherwise.
Returns the INDEX-th element of SIMPLE-VECTOR.
Similar to VECTOR-PUSH except that, if the fill pointer gets too large, extends VECTOR rather then simply returns NIL.
Returns a sequence formed by removing the specified ITEM destructively from SEQUENCE.
Returns a copy of SEQUENCE with ITEM removed.
Coerces X into a string. If X is a string, then returns X itself. If X is a symbol, then returns X's print name. If X is a character, then returns a one element string containing that character. Signals an error if X cannot be coerced into a string.
Returns a copy of STRING with all lower case characters converted to uppercase.
Finds the entry in HASH-TABLE whose key is KEY and returns the associated value and T, as multiple values. Returns DEFAULT and NIL if there is no such entry.
Creates and returns a hash table.
Returns NIL if STRING1 and STRING2 are character-wise CHAR=. Otherwise, returns the index to the longest common prefix of the strings.
Similar to STRING>, but ignores cases.
Returns the INDEX-th element of SEQUENCE.
Creates an array of the specified DIMENSIONS. The default for INITIAL- ELEMENT depends on ELEMENT-TYPE. MAKE-ARRAY will always try to find the `best' array to accommodate the element-type specified. For example on a SUN element-type (mod 1) --> bit (integer 0 10) --> unsigned-char (integer -3 10) --> signed-char si::best-array-element-type is the function doing this. It is also used by the compiler, for coercing array element types. If you are going to declare an array you should use the same element type as was used in making it. eg (setq my-array (make-array 4 :element-type '(integer 0 10))) (the (array (integer 0 10)) my-array) When wanting to optimize references to an array you need to declare the array eg: (the (array (integer -3 10)) my-array) if ar were constructed using the (integer -3 10) element-type. You could of course have used signed-char, but since the ranges may be implementation dependent it is better to use -3 10 range. MAKE-ARRAY needs to do some calculation with the element-type if you don't provide a primitive data-type. One way of doing this in a machine independent fashion:
(defvar *my-elt-type* #. (array-element-type (make-array 1 :element-type '(integer -3 10))))
Then calls to (make-array n :element-type *my-elt-type*) will not have to go through a type inclusion computation. The keyword STATIC (GCL specific) if non nil, will cause the array body to be non relocatable.
Returns T if X is a hash table object; NIL otherwise.
Returns the number of elements in SEQUENCE not satisfying TEST.
Returns the fill pointer of VECTOR.
Returns T if X is an array; NIL otherwise.
Destructively modifies SEQUENCE1 by copying successive elements into it from SEQUENCE2.
Performs a bit-wise logical XOR on the elements of BIT-ARRAY1 and BIT-ARRAY2. Puts the results into a new bit array if RESULT-BIT-ARRAY is NIL, into BIT-ARRAY1 if RESULT-BIT-ARRAY is T, or into RESULT-BIT-ARRAY otherwise.
Removes all entries of HASH-TABLE and returns the hash table itself.
Returns a sequence of the same kind as SEQUENCE with the same elements except that all elements satisfying TEST are replaced with NEWITEM.
The specified subsequences of SEQUENCE1 and SEQUENCE2 are compared element-wise. If they are of equal length and match in every element, the result is NIL. Otherwise, the result is a non-negative integer, the index within SEQUENCE1 of the leftmost position at which they fail to match; or, if one is shorter than and a matching prefix of the other, the index within SEQUENCE1 beyond the last position tested is returned.
Attempts to decrease the fill-pointer of VECTOR by 1 and returns the element pointed to by the new fill pointer. Signals an error if the old value of the fill pointer is 0.
Returns a sequence of the same kind as SEQUENCE with the same elements except that OLDITEMs are replaced with NEWITEM.
Returns T if ARRAY has a fill pointer; NIL otherwise.
Returns a new sequence of the specified RESULT-TYPE, consisting of all elements in SEQUENCEs.
Attempts to set the element of ARRAY designated by its fill pointer to NEW-ELEMENT and increments the fill pointer by one. Returns NIL if the fill pointer is too large. Otherwise, returns the new fill pointer value.
Returns a copy of STRING with the characters in CHAR-BAG removed from both ends.
Returns the type of the elements of ARRAY
Returns T if none of the elements in SEQUENCEs satisfies PREDICATE; NIL otherwise.
Performs a bit-wise logical NOT in the elements of BIT-ARRAY. Puts the results into a new bit array if RESULT-BIT-ARRAY is NIL, into BIT-ARRAY if RESULT-BIT-ARRAY is T, or into RESULT-BIT-ARRAY otherwise.
Performs a bit-wise logical ORC1 on the elements of BIT-ARRAY1 and BIT-ARRAY2. Puts the results into a new bit array if RESULT-BIT-ARRAY is NIL, into BIT-ARRAY1 if RESULT-BIT-ARRAY is T, or into RESULT-BIT-ARRAY otherwise.
Returns the number of elements in SEQUENCE satisfying TEST.
FUNCTION must take as many arguments as there are sequences provided. The result is a sequence such that the i-th element is the result of applying FUNCTION to the i-th elements of the SEQUENCEs.
Returns the number of elements in SEQUENCE satisfying TEST with ITEM.
Returns T if X is a bit vector; NIL otherwise.
Returns STRING with the first character of each word converted to upper-case, and remaining characters in the word converted to lower case.
Adjusts the dimensions of ARRAY to the given DIMENSIONS. The default value of INITIAL-ELEMENT depends on ELEMENT-TYPE.
A search is conducted for the first subsequence of SEQUENCE2 which element-wise matches SEQUENCE1. If there is such a subsequence in SEQUENCE2, the index of the its leftmost element is returned; otherwise, NIL is returned.
Returns T if X is a simple bit-vector; NIL otherwise.
Returns a sequence of the given TYPE and LENGTH, with elements initialized to INITIAL-ELEMENT. The default value of INITIAL-ELEMENT depends on TYPE.
Performs a bit-wise logical ORC2 on the elements of BIT-ARRAY1 and BIT-ARRAY2. Puts the results into a new bit array if RESULT-BIT-ARRAY is NIL, into BIT-ARRAY1 if RESULT-BIT-ARRAY is T, or into RESULT-BIT-ARRAY otherwise.
Returns a sequence of the same elements as SEQUENCE but in reverse order. SEQUENCE may be destroyed.
Returns T if at least one of the elements in SEQUENCEs does not satisfy PREDICATE; NIL otherwise.
Returns the index of the first element in SEQUENCE that does not satisfy TEST; NIL if no such element exists.
Returns a copy of STRING with all upper case characters converted to lowercase.
Returns the bit from BIT-ARRAY at SUBSCRIPTS.
Similar to STRING>=, but ignores cases.
Returns the INDEX-th character in STRING.
Returns the element of ARRAY specified by SUBSCRIPTS.
Replaces the specified elements of SEQUENCE all with ITEM.
Destructively sorts SEQUENCE. PREDICATE should return non-NIL if its first argument is to precede its second argument.
Performs a bit-wise logical IOR on the elements of BIT-ARRAY1 and BIT-ARRAY2. Puts the results into a new bit array if RESULT-BIT-ARRAY is NIL, into BIT-ARRAY1 if RESULT-BIT-ARRAY is T, or into RESULT-BIT-ARRAY otherwise.
Removes any entry for KEY in HASH-TABLE. Returns T if such an entry existed; NIL otherwise.
Returns T if X is a vector; NIL otherwise.
If STRING1 is lexicographically less than or equal to STRING2, then returns the longest common prefix of the two strings. Otherwise, returns NIL.
Returns T if X is a simple vector; NIL otherwise.
Returns a copy of STRING with the characters in CHAR-BAG removed from the left end.
Returns the total number of elements of ARRAY.
Returns the index of the first element in SEQUENCE that does not satisfy TEST; NIL if no such element exists.
Returns a sequence formed by removing duplicated elements destructively from SEQUENCE.
The elements of SEQUENCE are examined, and if any two match, one is discarded. Returns the resulting sequence.
Returns the index of the first element in SEQUENCE that satisfies TEST; NIL if no such element exists.
SEQUENCE1 and SEQUENCE2 are destructively merged into a sequence of type RESULT-TYPE using PREDICATE to order the elements.
Returns T if every elements of SEQUENCEs satisfy PREDICATE; NIL otherwise.
Combines all the elements of SEQUENCE using a binary operation FUNCTION. If INITIAL-VALUE is supplied, it is logically placed before the SEQUENCE.
Similar to STRING<, but ignores cases.
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.
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.
Returns T if CHAR is an alphabetic character; NIL otherwise. Equivalent to ALPHA-CHAR-P.
Returns the character object representing the INDEX-th character in STRING. This is faster than CHAR.
Returns the lower-case equivalent of CHAR, if any. If not, simply returns CHAR.
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.
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.
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.
Returns T if CHAR is a lower-case character; NIL otherwise.
Returns T if the codes of CHARs are in strictly non-decreasing order; NIL otherwise.
Returns a character object with the specified code, if any. If not, returns NIL.
Returns the code attribute of CHAR.
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.
Returns the font attribute of CHAR.
Returns T if the codes of CHARs are in strictly increasing order; NIL otherwise.
Returns T if the codes of CHARs are in strictly non-increasing order; NIL otherwise.
Returns T if CHAR is a printing character, i.e., #\Space through #\~; NIL otherwise.
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.
Returns T if X is a character; NIL otherwise.
Returns T if all CHARs are the same character; NIL otherwise.
Returns T if CHAR is an alphabetic character, A-Z or a-z; NIL otherwise.
Returns T if CHAR is an upper-case character; NIL otherwise.
Returns T if the named bit is on in the character CHAR; NIL otherwise. In GCL, this function always returns NIL.
Returns a character object with the same code attribute as CHAR and with the specified BITS and FONT attributes.
Coerces X into a character object if possible.
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.
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.
Returns T if the codes of CHARs are in strictly decreasing order; NIL otherwise.
Returns T if CHAR is a standard character, i.e., one of the 95 ASCII printing characters #\Space to #\~ and #Newline; NIL otherwise.
Returns the upper-case equivalent of CHAR, if any. If not, simply returns CHAR.
If CHAR represents a digit in RADIX, then returns the weight as an integer. Otherwise, returns nil.
Returns T if no two of CHARs are the same character; NIL otherwise.
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.
Returns T if CHAR is either numeric or alphabetic; NIL otherwise.
Returns the bits attribute (which is always 0 in GCL) of CHAR.
Returns a character object that represents the DIGIT in the specified RADIX. Returns NIL if no such character exists.
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.
Returns the intersection of LIST1 and LIST2. LIST1 may be destroyed.
Returns the first cons in ALIST whose cdr satisfies PREDICATE.
Creates and returns a list containing SIZE elements, each of which is initialized to INITIAL-ELEMENT.
Returns the N-th element of LIST, where the car of LIST is the zeroth element.
Equivalent to (CAR (CAR X)).
Returns T if X is NIL; NIL otherwise.
Equivalent to (CAR (CDDDDR X)).
Concatenates LISTs by destructively modifying them.
Returns T if SUBLIST is one of the conses in LIST; NIL otherwise.
Returns T if X is a cons; NIL otherwise.
Equivalent to (CADR (CDDDDR (CDDDDR X))).
Returns T if X is either a cons or NIL; NIL otherwise.
Applies FUN to successive cars of LISTs, NCONCs the results, and returns it.
Equivalent to (CADDDR (CDDDDR X)).
Returns the length of SEQUENCE.
Returns the first cons in ALIST whose cdr is equal to ITEM.
Substitutes NEW for subtrees of TREE that do not satisfy TEST.
Changes the cdr of the N+1 th cons from the end of the list LIST to NIL. Returns the whole list.
Returns the cdr of LIST. Returns NIL if LIST is NIL.
Applies FUN to successive cars of LISTs. Returns the first LIST.
Applies FUN to successive cdrs of LISTs. Returns the first LIST.
Returns a new cons whose car and cdr are X and Y, respectively.
Returns a list of its arguments
Equivalent to (CADDR X).
Equivalent to (CDR (CDR (CAR (CAR X)))).
Equivalent to (CDR (CAR (CDR (CAR X)))).
Equivalent to (CDR (CAR (CAR (CDR X)))).
Equivalent to (CAR (CDR (CDR (CAR X)))).
Equivalent to (CAR (CDR (CAR (CDR X)))).
Equivalent to (CAR (CAR (CDR (CDR X)))).
Returns the result of performing the CDR operation N times on LIST.
Constructs an association list from KEYS and DATA adding to ALIST.
Equivalent to (CADDR (CDDDDR X)).
Returns T if every element of LIST1 appears in LIST2; NIL otherwise.
Substitutes NEW for subtrees of TREE that satisfy TEST.
Returns a new copy of LIST.
Returns the last cons in LIST
Equivalent to (CAR (CAR (CAR X))).
Returns the length of LIST, or NIL if LIST is circular.
Equivalent to (CDR (CDR (CDR X))).
Returns the intersection of List1 and List2.
Substitutes NEW for subtrees in TREE that match OLD.
Equivalent to (APPEND (REVERSE X) Y)
Equivalent to (CDR (CAR X)).
Equivalent to (CAR (CDR X)).
Equivalent to (CDR X).
Returns a list with elements which appear but once in LIST1 and LIST2.
Constructs a new alist by adding the pair (KEY . DATUM) to ALIST.
Substitutes NEW for subtrees of TREE that do not satisfy TEST.
Replaces the car of X with Y, and returns the modified X.
Equivalent to (CADR X).
Returns the union of LIST1 and LIST2. LIST1 and/or LIST2 may be destroyed.
Creates and returns a list with the same elements as LIST but without the last N elements.
Equivalent to (CAR (CAR (CAR (CAR X)))).
Equivalent to (CDR (CDR (CDR (CAR X)))).
Equivalent to (CDR (CDR (CAR (CDR X)))).
Equivalent to (CDR (CAR (CDR (CDR X)))).
Equivalent to (CAR (CDR (CDR (CDR X)))).
Equivalent to (CADDDR X).
Substitutes from ALIST for subtrees of TREE.
Substitutes NEW for subtrees of TREE that satisfy TEST.
Returns a list of elements of LIST1 that do not appear in LIST2. LIST1 may be destroyed.
Syntax:
(pop place)
Pops one item off the front of the list in PLACE and returns it.
Syntax:
(push item place)
Conses ITEM onto the list in PLACE, and returns the new list.
Equivalent to (CDR (CAR (CAR X))).
Equivalent to (CAR (CDR (CAR X))).
Equivalent to (CAR (CAR (CDR X))).
Equivalent to (CAR X).
Substitutes NEW for subtrees of TREE that match OLD.
Adds ITEM to LIST unless ITEM is already a member of LIST.
Applies FUN to successive cdrs of LISTs, NCONCs the results, and returns it.
Syntax:
(pushnew item place {keyword value}*)
If ITEM is already in the list stored in PLACE, does nothing. Else, conses ITEM onto the list. Returns NIL. If no KEYWORDs are supplied, each element in the list is compared with ITEM by EQL, but the comparison can be controlled by supplying keywords :TEST, :TEST-NOT, and/or :KEY.
Returns a list of elements appearing exactly once in LIST1 and LIST2.
Returns T if X and Y are isomorphic trees with identical leaves.
Equivalent to (CDR (CDR X)).
Searches the property list stored in Place for an indicator EQ to Indicator. If one is found, the corresponding value is returned, else the Default is returned.
Returns a new list, whose elements are those of LIST that appear before SUBLIST. If SUBLIST is not a tail of LIST, a copy of LIST is returned.
Returns the union of LIST1 and LIST2.
Returns the first pair in ALIST whose car does not satisfy TEST.
Replaces the cdr of X with Y, and returns the modified X.
Returns the tail of LIST beginning with the first element not satisfying TEST.
Returns the car of LIST. Returns NIL if LIST is NIL.
Returns T if X is NIL. Returns NIL if X is a cons. Otherwise, signals an error.
Returns a list of its arguments with the last cons being a dotted pair of the next to the last argument and the last argument.
Equivalent to (CAR (CDDDDR (CDDDDR X))).
Equivalent to (CDR (CAR (CAR (CAR X)))).
Equivalent to (CAR (CDR (CAR (CAR X)))).
Equivalent to (CAR (CAR (CDR (CAR X)))).
Equivalent to (CAR (CAR (CAR (CDR X)))).
Equivalent to (CDR (CDR (CDR (CDR X)))).
Substitutes from ALIST for subtrees of TREE nondestructively.
Returns the first cons in ALIST whose cdr does not satisfy PREDICATE.
Equivalent to (NCONC (NREVERSE X) Y).
Applies FUN to successive cdrs of LISTs and returns the results as a list.
Returns a list of elements of LIST1 that do not appear in LIST2.
Returns the first pair in ALIST whose car satisfies TEST.
Looks for the elements of INDICATOR-LIST in the property list stored in PLACE. If found, returns the indicator, the value, and T as multiple-values. If not, returns NILs as its three values.
Returns the tail of LIST beginning with the first element satisfying TEST.
Recursively copies conses in OBJECT and returns the result.
Returns T if X is not a cons; NIL otherwise.
Equivalent to (CDR (CDR (CAR X))).
Equivalent to (CDR (CAR (CDR X))).
Equivalent to (CAR (CDR (CDR X))).
Returns the first pair in ALIST whose car is equal (in the sense of TEST) to ITEM.
Constructs a new list by concatenating its arguments.
Returns the tail of LIST beginning with the first ITEM.
Returns a bidirectional stream which gets its input from INPUT-STREAM and sends its output to OUTPUT-STREAM. In addition, all input is echoed to OUTPUT-STREAM.
Loads the file named by FILENAME into GCL.
Opens the file specified by FILENAME, which may be a string, a pathname, or a stream. Returns a stream for the open file. DIRECTION is :INPUT, :OUTPUT, :IO or :PROBE. ELEMENT-TYPE is STRING-CHAR, (UNSIGNED-BYTE n), UNSIGNED-BYTE, (SIGNED-BYTE n), SIGNED-BYTE, CHARACTER, BIT, (MOD n), or :DEFAULT. IF-EXISTS is :ERROR, :NEW-VERSION, :RENAME, :RENAME-AND-DELETE, :OVERWRITE, :APPEND, :SUPERSEDE, or NIL. IF-DOES-NOT-EXIST is :ERROR, :CREATE, or NIL.
Returns an input stream which will supply the characters of String between Start and End in order.
Pretty-prints OBJECT. Returns OBJECT. Equivalent to (WRITE :STREAM STREAM :PRETTY T) The SI:PRETTY-PRINT-FORMAT property N (which must be a non-negative integer) of a symbol SYMBOL controls the pretty-printing of form (SYMBOL f1 ... fN fN+1 ... fM) in such a way that the subforms fN+1, ..., fM are regarded as the 'body' of the entire form. For instance, the property value of 2 is initially given to the symbol DO.
Reads an object from STREAM, preserving the whitespace that followed the object.
Returns T if X is a stream object; NIL otherwise.
Causes FUNCTION to be called when the DISP-CHAR followed by SUB-CHAR is read.
Syntax:
(with-output-to-string (var [string]) {decl}* {form}*)
Binds VAR to a string output stream that puts characters into STRING, which defaults to a new string. The stream is automatically closed on exit and the string is returned.
Returns the length of the specified file stream.
Outputs a newline character, and then prints OBJECT in the mostly readable representation. Returns OBJECT. Equivalent to (PROGN (TERPRI STREAM) (WRITE OBJECT :STREAM STREAM :ESCAPE T)).
Causes CHAR to be a macro character that, when seen by READ, causes FUNCTION to be called.
Attempts to force any buffered output to be sent.
Returns a type specifier for the kind of object returned by STREAM.
Outputs INTEGER to the binary stream STREAM. Returns INTEGER.
Returns a stream which takes its input from each of the STREAMs in turn, going on to the next at end of stream.
Prints OBJECT in the mostly readable representation. Returns OBJECT. Equivalent to (WRITE OBJECT :STREAM STREAM :ESCAPE T).
Prints OBJECT without escape characters. Returns OBJECT. Equivalent to (WRITE OBJECT :STREAM STREAM :ESCAPE NIL).
Clears the output stream STREAM.
Outputs a newline character.
Attempts to ensure that all output sent to STREAM has reached its destination, and only then returns.
Syntax:
(with-open-file (stream filename {options}*) {decl}* {form}*)
Opens the file whose name is FILENAME, using OPTIONs, and binds the variable STREAM to a stream to/from the file. Then evaluates FORMs as a PROGN. The file is automatically closed on exit.
Syntax:
(do ({(var [init [step]])}*) (endtest {result}*) {decl}* {tag | statement}*)
Creates a NIL block, binds each VAR to the value of the corresponding INIT, and then executes STATEMENTs repeatedly until ENDTEST is satisfied. After each iteration, assigns to each VAR the value of the corresponding STEP. When ENDTEST is satisfied, evaluates RESULTs as a PROGN and returns the value(s) of the last RESULT (or NIL if no RESULTs are supplied). Performs variable bindings and assignments all at once, just like LET and PSETQ do.
Reads an object from STRING.
Outputs STRING and returns it.
Asks the user a question whose answer is either 'Y' or 'N'. 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 "(Y or N)" is printed. Otherwise, no prompt will appear.
Returns an output stream which sends its output to all of the given streams.
Reads a character from STREAM.
Peeks at the next character in the input stream STREAM.
Returns non-nil if STREAM can handle output operations; NIL otherwise.
Syntax:
(with-open-stream (var stream) {decl}* {form}*)
Evaluates FORMs as a PROGN with VAR bound to the value of STREAM. The stream is automatically closed on exit.
Syntax:
(with-input-from-string (var string {keyword value}*) {decl}* {form}*)
Binds VAR to an input stream that returns characters from STRING and evaluates the FORMs. The stream is automatically closed on exit. Allowed keywords are :INDEX, :START, and :END.
Returns T if a character is available on STREAM; NIL otherwise. This function does not correctly work in some versions of GCL because of the lack of such mechanism in the underlying operating system.
Create a pathname from HOST, DEVICE, DIRECTORY, NAME, TYPE and VERSION.
Returns the type slot of PATHNAME.
Returns a line of text read from STREAM as a string, discarding the newline character.
Note that when using line at a time input under unix, input forms will always be followed by a #\newline. Thus if you do
>(read-line) "" nil
the empty string will be returned. After lisp reads the (read-line) it then invokes (read-line). This happens before it does anything else and so happens before the newline character immediately following (read-line) has been read. Thus read-line immediately encounters a #\newline and so returns the empty string. If there had been other characters before the #\newline it would have been different:
>(read-line) how are you " how are you" nil
If you want to throw away "" input, you can do that with the following:
(sloop::sloop while (equal (setq input (read-line)) ""))
You may also want to use character at a time input, but that makes input editing harder. nicolas% stty cbreak nicolas% gcl GCL (GNU Common Lisp) Version(1.1.2) Mon Jan 9 12:58:22 MET 1995 Licensed under GNU Public Library License Contains Enhancements by W. Schelter
>(let ((ifilename nil)) (format t "~%Input file name: ") (setq ifilename (read-line))) Input file name: /tmp/myfile "/tmp/myfile"
>(bye)Bye.
Returns as a string the printed representation of OBJECT in the specified mode. See the variable docs of *PRINT-...* for the mode.
Returns T if X is a pathname object; NIL otherwise.
Returns T if X is a readtable object; NIL otherwise.
Reads in the next object from STREAM.
Returns the full form of PATHNAME as a string.
Puts CHARACTER back on the front of the input stream STREAM.
Closes STREAM. A non-NIL value of :ABORT indicates an abnormal termination.
Makes the syntax of TO-CHAR in TO-READTABLE be the same as the syntax of FROM-CHAR in FROM-READTABLE.
Returns non-NIL if STREAM can handle input operations; NIL otherwise.
Turns X into a pathname. X may be a string, symbol, stream, or pathname.
Returns the written representation of PATHNAME as a string.
Causes the character CHAR to be a dispatching macro character in READTABLE.
Returns a bidirectional stream which gets its input from INPUT-STREAM and sends its output to OUTPUT-STREAM.
Returns a copy of the readtable FROM-READTABLE. If TO-READTABLE is non-NIL, then copies into TO-READTABLE. Otherwise, creates a new readtable.
Returns the directory part of PATHNAME as a string.
Returns the pathname for the actual file described by PATHNAME.
Returns the macro-character function for SUB-CHAR under DISP-CHAR.
Returns the device slot of PATHNAME.
Returns the next character from STREAM if one is available; NIL otherwise.
Outputs a newline if it is not positioned at the beginning of a line. Returns T if it output a newline; NIL otherwise.
Outputs CHAR and returns it.
Parses a string representation of a pathname into a pathname. HOST is ignored.
Returns the directory slot of PATHNAME.
Returns the function associated with CHAR and, as a second value, returns the non-terminating-p flag.
Provides various facilities for formatting output. DESTINATION controls where the result will go. If DESTINATION is T, then the output is sent to the standard output stream. If it is NIL, then the output is returned in a string as the value of the call. Otherwise, DESTINATION must be a stream to which the output will be sent.
CONTROL-STRING is a string to be output, possibly with embedded formatting directives, which are flagged with the escape character "~". Directives generally expand into additional text to be output, usually consuming one or more of ARGUMENTs in the process.
A few useful directives are:
~A, ~nA, ~n@A Prints one argument as if by PRINC ~S, ~nS, ~n@S Prints one argument as if by PRIN1 ~D, ~B, ~O, ~X Prints one integer in decimal, binary, octal, and hexa ~% Does TERPRI ~& Does FRESH-LINE
where n is the minimal width of the field in which the object is printed. ~nA and ~nS put padding spaces on the right; ~n@A and ~n@S put on the left.
~R is for printing numbers in various formats.
~nR prints arg in radix n. ~R prints arg as a cardinal english number: two ~:R prints arg as an ordinal english number: third ~@R prints arg as an a Roman Numeral: VII ~:@R prints arg as an old Roman Numeral: IIII
~C prints a character. ~:C represents non printing characters by their pretty names,eg Space ~@C uses the #\ syntax to allow the reader to read it.
~F prints a floating point number arg. The full form is ~w,d,k,overflowchar,padcharF w represents the total width of the printed representation (variable if not present) d the number of fractional digits to display (format nil "~,2f" 10010.0314) --> "10010.03" k arg is multiplied by 10^k before printing it as a decimal number. overflowchar width w characters copies of the overflow character will be printed. eg(format t "X>~5,2,,'?F<X" 100.034) --> X>?????<X padchar is the character to pad with (format t "X>~10,2,1,'?,'bF<X" 100.03417) -->X>bbb1000.34<X @ makes + sign print if the arg is positive
~@[print-if-true~] if arg is not nil, then it is retained as an arg for further printing, otherwise it is used up (format nil "~@[x = ~d~]~a" nil 'bil) --> "BIL" (format nil "~@[x = ~d ~]~a" 8) --> "x = 8 BIL"
Returns the name slot of PATHNAME.
Returns an output stream which will accumulate all output given it for the benefit of the function GET-OUTPUT-STREAM-STRING.
Returns a stream which performs its operations on the stream which is the value of the dynamic variable named by SYMBOL.
Returns the time at which the specified file is written, as an integer in universal time format. FILE may be a string or a stream.
Returns as a string the printed representation of OBJECT in the mostly readable representation. Equivalent to (WRITE-TO-STRING OBJECT :ESCAPE T).
Fills in unspecified slots of PATHNAME from DEFAULTS. DEFAULT-VERSION is ignored in GCL.
Reads the next byte from STREAM.
Returns as a string the printed representation of OBJECT without escape characters. Equivalent to (WRITE-TO-STRING OBJECT :ESCAPE NIL).
Returns the truename of file if the file exists. Returns NIL otherwise.
Returns the version slot of PATHNAME.
Outputs STRING and then outputs a newline character. Returns STRING.
Prints OBJECT in the specified mode. See the variable docs of *PRINT-...* for the mode.
Returns a string of all the characters sent to STREAM made by MAKE-STRING-OUTPUT-STREAM since the last call to this function.
Reads objects from STREAM until the next character after an object's representation is CHAR. Returns a list of the objects read.
Returns the five values (or five 'gangs') constituting the SETF method for FORM. See the doc of DEFINE-SETF-METHOD for the meanings of the gangs. It is an error if the third value (i.e., the list of store variables) is not a one-element list. See the doc of GET-SETF-METHOD-MULTIPLE-VALUE for comparison.
Syntax:
(the value-type form)
Declares that the value of FORM must be of VALUE-TYPE. Signals an error if this is not the case.
Syntax:
(setf {place newvalue}*)
Replaces the value in PLACE with the value of NEWVALUE, from left to right. Returns the value of the last NEWVALUE. Each PLACE may be any one of the following:
nth elt subseq rest first ... tenth c?r c??r c???r c????r aref svref char schar bit sbit fill-poiter get getf documentation symbol-value symbol-function symbol-plist macro-function gethash char-bit ldb mask-field applywhere '?' stands for either 'a' or 'd'.
Syntax:
(when test {form}*)
If TEST evaluates to non-NIL, then evaluates FORMs as a PROGN. If not, simply returns NIL.
Syntax:
(ccase keyplace {({key | ({key}*)} {form}*)}*)
Evaluates KEYPLACE and tries to find the KEY that is EQL to the value of KEYPLACE. If one is found, then evaluates FORMs that follow the KEY and returns the value(s) of the last FORM. If not, signals a correctable error.
If FORM is a macro form, then expands it repeatedly until it is not a macro any more. Returns two values: the expanded form and a T-or-NIL flag indicating whether the original form was a macro.
Syntax:
(multiple-value-call function {form}*)
Calls FUNCTION with all the values of FORMs as arguments.
Syntax:
(defsetf access-fun {update-fun [doc] | lambda-list (store-var) {decl | doc}* {form}*)
Defines how to SETF a generalized-variable reference of the form (ACCESS-FUN ...). The doc-string DOC, if supplied, is saved as a SETF doc and can be retrieved by (documentation 'NAME 'setf).
(defsetf access-fun update-fun) defines an expansion from (setf (ACCESS-FUN arg1 ... argn) value) to (UPDATE-FUN arg1 ... argn value). (defsetf access-fun lambda-list (store-var) . body) defines a macro which
expands
(setf (ACCESS-FUN arg1 ... argn) value) into the form (let* ((temp1 ARG1) ... (tempn ARGn) (temp0 value)) rest)
where REST is the value of BODY with parameters in LAMBDA-LIST bound to the symbols TEMP1 ... TEMPn and with STORE-VAR bound to the symbol TEMP0.
Syntax:
(tagbody {tag | statement}*)
Executes STATEMENTs and returns NIL if it falls off the end.
Syntax:
(etypecase keyform {(type {form}*)}*)
Evaluates KEYFORM and tries to find the TYPE in which the value of KEYFORM belongs. If one is found, then evaluates FORMs that follow the KEY and returns the value(s) of the last FORM. If not, signals an error.
Syntax:
(let* ({var | (var [value])}*) {decl}* {form}*)
Initializes VARs, binding them to the values of VALUEs (which defaults to NIL) from left to right, then evaluates FORMs as a PROGN.
Syntax:
(prog1 first {form}*)
Evaluates FIRST and FORMs in order, and returns the (single) value of FIRST.
Syntax:
(defun name lambda-list {decl | doc}* {form}*)
Defines a function as the global function definition of the symbol NAME. The complete syntax of a lambda-list is: ({var}* [&optional {var | (var [initform [svar]])}*] [&rest var] [&key {var | ({var | (keyword var)} [initform [svar]])}* [&allow-other-keys]] [&aux {var | (var [initform])}*]) The doc-string DOC, if supplied, is saved as a FUNCTION doc and can be retrieved by (documentation 'NAME 'function).
Syntax:
(multiple-value-bind ({var}*) values-form {decl}* {form}*)
Binds the VARiables to the results of VALUES-FORM, in order (defaulting to NIL) and evaluates FORMs in order.
Syntax:
(declare {decl-spec}*)
Gives a declaration. Possible DECL-SPECs are: (SPECIAL {var}*) (TYPE type {var}*) where 'TYPE' is one of the following symbols
array fixnum package simple-bit-vector atom float pathname simple-string bignum function random-state simple-vector bit hash-table ratio single-float bit-vector integer rational standard-char character keyword readtable stream common list sequence string compiled-function long-float short-float string-char complex nil signed-byte symbol cons null unsigned-byte t double-float number simple-array vector
'TYPE' may also be a list containing one of the above symbols as its first element and more specific information later in the list. For example
(vector long-float 80) ; vector of 80 long-floats. (array long-float *) ; array of long-floats (array fixnum) ; array of fixnums (array * 30) ; an array of length 30 but unspecified type
A list of 1 element may be replaced by the symbol alone, and a list ending in '*' may drop the the final '*'. @example (OBJECT {var}*) (FTYPE type {function-name}*) eg: ;; function of two required args and optional args and one value: (ftype (function (t t *) t) sort reduce) ;; function with 1 arg of general type returning 1 fixnum as value. (ftype (function (t) fixnum) length) (FUNCTION function-name ({arg-type}*) {return-type}*) (INLINE {function-name}*) (NOTINLINE {function-name}*) (IGNORE {var}*) (OPTIMIZE {({SPEED | SPACE | SAFETY | COMPILATION-SPEED} {0 | 1 | 2 | 3})}*) (DECLARATION {non-standard-decl-name}*) (:DYNAMIC-EXTENT {var}*) ;GCL-specific.
(defmacro name defmacro-lambda-list {decl | doc}* {form}*)Defines a macro as the global macro definition of the symbol NAME. The complete syntax of a defmacro-lambda-list is: ( [&whole var] [&environment var] {pseudo-var}* [&optional {var | (pseudo-var [initform [pseudo-var]])}*] {[{&rest | &body} pseudo-var] [&key {var | ({var | (keyword pseudo-var)} [initform [pseudo-var]])}* [&allow-other-keys]] [&aux {var | (pseudo-var [initform])}*] | . var}) where pseudo-var is either a symbol or a list of the following form: ( {pseudo-var}* [&optional {var | (pseudo-var [initform [pseudo-var]])}*] {[{&rest | &body} pseudo-var] [&key {var | ({var | (keyword pseudo-var)} [initform [pseudo-var]])}* [ &allow-other-keys ] ] [&aux {var | (pseudo-var [initform])}*] | . var}) As a special case, a non-NIL symbol is accepcted as a defmacro-lambda-list: (DEFMACRO <name> <symbol> ...) is equivalent to (DEFMACRO <name> (&REST <symbol>) ...). The doc-string DOC, if supplied, is saved as a FUNCTION doc and can be retrieved by (documentation 'NAME 'function). See the type doc of LIST for the backquote macro useful for defining macros. Also, see the function doc of PPRINT for the output-formatting.
(flet ({(name lambda-list {decl | doc}* {form}*)}*) . body)Evaluates BODY as a PROGN, with local function definitions in effect. BODY is the scope of each local function definition. Since the scope does not include the function definitions themselves, the local function can reference externally defined functions of the same name. See the doc of DEFUN for the complete syntax of a lambda-list. Doc-strings for local functions are simply ignored.
(ecase keyform {({key | ({key}*)} {form}*)}*)Evaluates KEYFORM and tries to find the KEY that is EQL to the value of KEYFORM. If one is found, then evaluates FORMs that follow the KEY and returns the value(s) of the last FORM. If not, signals an error.
(prog2 first second {forms}*)Evaluates FIRST, SECOND, and FORMs in order, and returns the (single) value of SECOND.
(progv symbols values {form}*)SYMBOLS must evaluate to a list of variables. VALUES must evaluate to a list of initial values. Evaluates FORMs as a PROGN, with each variable bound (as special) to the corresponding value.
(quote x)or 'x Simply returns X without evaluating it.
(dotimes (var countform [result]) {decl}* {tag | statement}*)Executes STATEMENTs, with VAR bound to each number between 0 (inclusive) and the value of COUNTFORM (exclusive). Then returns the value(s) of RESULT (which defaults to NIL).
block if progv catch labels quote compiler-let let return-from declare let* setq eval-when macrolet tagbody flet multiple-value-call the function multiple-value-prog1 throw go progn unwind-protectIn addition, GCL implements the following macros as special forms, though of course macro-expanding functions such as MACROEXPAND work correctly for these macros.
and incf prog1 case locally prog2 cond loop psetq decf multiple-value-bind push defmacro multiple-value-list return defun multiple-value-set setf do or unless do* pop when dolist prog dotimes prog*
(function x)or #'x If X is a lambda expression, creates and returns a lexical closure of X in the current lexical environment. If X is a symbol that names a function, returns that function.
(prog* ({var | (var [init])}*) {decl}* {tag | statement}*)Creates a NIL block, binds VARs sequentially, and then executes STATEMENTs.
(block name {form}*)The FORMs are evaluated in order, but it is possible to exit the block using (RETURN-FROM name value). The RETURN-FROM must be lexically contained within the block.
(progn {form}*)Evaluates FORMs in order, and returns whatever the last FORM returns.
(labels ({(name lambda-list {decl | doc}* {form}*)}*) . body)Evaluates BODY as a PROGN, with the local function definitions in effect. The scope of the locally defined functions include the function definitions themselves, so their definitions may include recursive references. See the doc of DEFUN for the complete syntax of a lambda-list. Doc-strings for local functions are simply ignored.
(return [result])Returns from the lexically surrounding NIL block. The value of RESULT, which defaults to NIL, is returned as the value of the block.
(typecase keyform {(type {form}*)}*)Evaluates KEYFORM and tries to find the TYPE in which the value of KEYFORM belongs. If one is found, then evaluates FORMs that follow the KEY and returns the value of the last FORM. If not, simply returns NIL.
(and {form}*)Evaluates FORMs in order from left to right. If any FORM evaluates to NIL, returns immediately with the value NIL. Else, returns the value(s) of the last FORM.
(let ({var | (var [value])}*) {decl}* {form}*)Initializes VARs, binding them to the values of VALUEs (which defaults to NIL) all at once, then evaluates FORMs as a PROGN.
(cond {(test {form}*)}*)Evaluates each TEST in order until one evaluates to a non-NIL value. Then evaluates the associated FORMs in order and returns the value(s) of the last FORM. If no forms follow the TEST, then returns the value of the TEST. Returns NIL, if all TESTs evaluate to NIL.
(catch tag {form}*)Sets up a catcher with that value TAG. Then evaluates FORMs as a PROGN, but may possibly abort the evaluation by a THROW form that specifies the value EQ to the catcher tag.
(define-modify-macro name lambda-list fun [doc])Defines a read-modify-write macro, like PUSH and INCF. The defined macro will expand a form (NAME place val1 ... valn) into a form that in effect SETFs the value of the call (FUN PLACE arg1 ... argm) into PLACE, where arg1 ... argm are parameters in LAMBDA-LIST which are bound to the forms VAL1 ... VALn. The doc-string DOC, if supplied, is saved as a FUNCTION doc and can be retrieved by (documentation 'NAME 'function).
(case keyform {({key | ({key}*)} {form}*)}*)Evaluates KEYFORM and tries to find the KEY that is EQL to the value of KEYFORM. If one is found, then evaluates FORMs that follow the KEY and returns the value(s) of the last FORM. If not, simply returns NIL.
(define-setf-method access-fun defmacro-lambda-list {decl | doc}* {form}*)Defines how to SETF a generalized-variable reference of the form (ACCESS-FUN ...). When a form (setf (ACCESS-FUN arg1 ... argn) value) is being evaluated, the FORMs are first evaluated as a PROGN with the parameters in DEFMACRO-LAMBDA-LIST bound to ARG1 ... ARGn. Assuming that the last FORM returns five values (temp-var-1 ... temp-var-k) (value-from-1 ... value-form-k) (store-var) storing-form access-form in order, the whole SETF is then expanded into (let* ((temp-var-1 value-from-1) ... (temp-k value-form-k) (store-var VALUE)) storing-from) Incidentally, the five values are called the five gangs of a SETF method. The doc-string DOC, if supplied, is saved as a SETF doc and can be retrieved by (documentation 'NAME 'setf).
(compiler-let ({var | (var [value])}*) {form}*)When interpreted, this form works just like a LET form with all VARs declared special. When compiled, FORMs are processed with the VARs bound at compile time, but no bindings occur when the compiled code is executed.
(multiple-value-list form)Evaluates FORM, and returns a list of multiple values it returned.
(multiple-value-prog1 form {form}*)Evaluates the first FORM, saves all the values produced, then evaluates the other FORMs. Returns the saved values.
(macrolet ({(name defmacro-lambda-list {decl | doc}* . body)}*) {form}*)Evaluates FORMs as a PROGN, with the local macro definitions in effect. See the doc of DEFMACRO for the complete syntax of a defmacro-lambda-list. Doc-strings for local macros are simply ignored.
(go tag)Jumps to the specified TAG established by a lexically surrounding TAGBODY.
(prog ({var | (var [init])}*) {decl}* {tag | statement}*)Creates a NIL block, binds VARs in parallel, and then executes STATEMENTs.
(return-from name [result])Returns from the lexically surrounding block whose name is NAME. The value of RESULT, which defaults to NIL, is returned as the value of the block.
(unless test {form}*)If TEST evaluates to NIL, then evaluates FORMs as a PROGN. If not, simply returns NIL.
(multiple-value-setq variables form)Sets each variable in the list VARIABLES to the corresponding value of FORM. Returns the value assigned to the first variable.
(locally {decl}* {form}*)Gives local pervasive declarations.
(defconstant name initial-value [doc])Declares that the variable NAME is a constant whose value is the value of INITIAL-VALUE. The doc-string DOC, if supplied, is saved as a VARIABLE doc and can be retrieved by (documentation 'NAME 'variable).
(if test then [else])If TEST evaluates to non-NIL, then evaluates THEN and returns the result. If not, evaluates ELSE (which defaults to NIL) and returns the result.
(unwind-protect protected-form {cleanup-form}*)Evaluates PROTECTED-FORM and returns whatever it returned. Guarantees that CLEANUP-FORMs be always evaluated before exiting from the UNWIND-PROTECT form.
(or {form}*)Evaluates FORMs in order from left to right. If any FORM evaluates to non-NIL, quits and returns that (single) value. If the last FORM is reached, returns whatever values it returns.
(ctypecase keyplace {(type {form}*)}*)Evaluates KEYPLACE and tries to find the TYPE in which the value of KEYPLACE belongs. If one is found, then evaluates FORMs that follow the KEY and returns the value(s) of the last FORM. If not, signals a correctable error.
(psetf {place newvalue}*)Similar to SETF, but evaluates all NEWVALUEs first, and then replaces the value in each PLACE with the value of the corresponding NEWVALUE. Returns NIL always.
(throw tag result)Evaluates TAG and aborts the execution of the most recent CATCH form that sets up a catcher with the same tag value. The CATCH form returns whatever RESULT returned.
(defparameter name initial-value [doc])Declares the variable NAME as a special variable and initializes the value. The doc-string DOC, if supplied, is saved as a VARIABLE doc and can be retrieved by (documentation 'NAME 'variable).
(defvar name [initial-value [doc]])Declares the variable NAME as a special variable and, optionally, initializes it. The doc-string DOC, if supplied, is saved as a VARIABLE doc and can be retrieved by (documentation 'NAME 'variable).
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.
Syntax:
(eval-when ({situation}*) {form}*)
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.
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.
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:
(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*))))))
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
(PROGN 'COMPILE ...forms-which-need-to-be-compiled)
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.
Defentry, clines, and defcfun also result in machine code being generated.
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:
Eval at Compile Type of Top Level Form
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.
Example:
(defun foo () 3) (defstruct jo a b)
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.
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).
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.
The old GCL variable *compile-time-too* has disappeared.
See OPTIMIZE on how to enable warnings of slow constructs.
Puts the declaration given by DECL-SPEC into effect globally. See the doc of DECLARE for possible DECL-SPECs.
Adds the specified module to the list of modules maintained in *MODULES*.
Returns T if X is a compiled function; NIL otherwise.
#+ feature-description form
it reads FORM in the usual manner if FEATURE-DESCRIPTION is true. Otherwise, the reader just skips FORM.
#- feature-description form
is equivalent to
#- (not feature-description) form
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:
(and feature-desciption-1 ... feature-desciption-n) (or feature-desciption-1 ... feature-desciption-n) (not feature-desciption)
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.
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.
Returns T if X is a symbol and it belongs to the KEYWORD package; NIL otherwise.
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.
Returns the contents of the package cell of the symbol SYMBOL.
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.
Syntax:
(remf place indicator)
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.
Makes empty the value slot of SYMBOL. Returns SYMBOL.
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.
Creates and returns a new uninterned symbol whose print name is STRING.
Syntax:
(psetq {var form}*)
Similar to SETQ, but evaluates all FORMs first, and then assigns each value to the corresponding VAR. Returns NIL always.
Returns the list of packages that use PACKAGE.
Returns T if X is a symbol; NIL otherwise.
Assigns the value of VALUE to the dynamic variable named by SYMBOL, and returns the value assigned.
Syntax:
(setq {var form}*)
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.
Removes PACKAGES-TO-UNUSE from the use list for PACKAGE.
Returns the list of packages used by PACKAGE.
Returns a list of all existing packages.
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.
Returns the property list of SYMBOL.
Returns the print name of the symbol SYMBOL.
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.
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.
Returns T if SYMBOL has a global function definition or if SYMBOL names a special form or a macro; NIL otherwise.
If SYMBOL globally names a macro, then returns the expansion function. Returns NIL otherwise.
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.
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.
Returns the list of symbols that have been declared as shadowing symbols in PACKAGE.
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.
Makes SYMBOLS external symbols of PACKAGE. SYMBOLS must be a list of symbols or a symbol.
Returns T if X is a package; NIL otherwise.
Returns the current global function definition named by SYMBOL.
Returns the current value of the dynamic (special) variable named by SYMBOL.
Returns T if the global variable named by SYMBOL has a value; NIL otherwise.
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.
Creates a new symbol interned in the package PACKAGE with the given PREFIX.
Replaces the old name and nicknames of PACKAGE with NEW-NAME and NEW-NICKNAMES.
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.
Makes SYMBOLS no longer accessible as external symbols in PACKAGE. SYMBOLS must be a list of symbols or a symbol.
Returns as a list the nickname strings for the specified PACKAGE.
Makes SYMBOLS internal symbols of PACKAGE. SYMBOLS must be a list of symbols or a symbol.
Looks on the property list of SYMBOL for the specified INDICATOR. If this is found, returns the associated value. Otherwise, returns DEFAULT.
Returns a list of all symbols that have the specified name.
Discards the global function definition named by SYMBOL. Returns SYMBOL.
Returns the string that names the specified PACKAGE.
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.
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.
The variable si::*command-args* is set to the list of strings passed in when gcl is invoked.
Various flags are understood.
-eval
-eval
-load
-load
.
-f
-f
.
Open the file following -f
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:
#!/usr/local/bin/gcl.exe -f (format t "hello world ~a~%" (nth 1 si::*command-args*))The value si::*command-args* will have the appropriate value. Thus if the above 2 line file is made executable and called `foo' then
tutorial% foo billy hello world billyNOTE: On many systems (eg SunOs) the first line of an executable script file such as:
#!/usr/local/bin/gcl.exe -fonly 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
/bin/sh
script. In latter case the
/bin/sh
interpreter would get invoked on the file.
Alternately one could invoke the file `foo' without making it
executable:
tutorial% gcl -f foo "from bill" hello world from bill
-batch
-dir
-libdir
-libdir `/d/wfs/gcl-2.0/'would mean that the files like gcl-tk/tk.o would be found by concatting the path to the libdir path, ie in
`/d/wfs/gcl-2.0/gcl-tk/tk.o'
-compile
-compile
.
Other flags affect compilation.
-o-file
-o-file
then do not produce an .o
file.
-c-file
-c-file
is specified, leave the intermediate .c
file there.
-h-file
-h-file
is specified, leave the intermediate .h
file there.
-data-file
-data-file
is specified, leave the intermediate .data
file there.
-system-p
-system-p
is specified then invoke compile-file
with the
:system-p t
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.
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.
Returns the host part of PATHNAME as a string.
Renames the file FILE to NEW-NAME. FILE may be a string, a pathname, or a stream.
Returns the author name of the specified file, as a string. FILE may be a string or a stream
Returns the host slot of PATHNAME.
Sets the file pointer of the specified file to POSITION, if POSITION is given. Otherwise, returns the current file position of the specified file.
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.
Returns the home directory of the logged in user as a pathname. HOST is ignored.
Returns a string that identifies the physical location of the current GCL.
Returns a list of files that match NAME. NAME may be a string, a pathname, or a file stream.
Returns a string that identifies the software version of the software under which GCL is currently running.
Returns a string which uniquely identifies PATHNAME with respect to DEFAULTS.
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.
Does the inverse operation of DECODE-UNIVERSAL-TIME.
Returns a string that tells you when the current GCL implementation is brought up.
Returns a string that identifies the machine instance of the machine on which GCL is currently running.
Displays information about storage allocation in the following format.
Returns the current time as a single integer in universal time format.
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.
Returns a string that identifies the physical location of the current GCL.
Returns the real time in the internal time format. This is useful for finding elapsed time.
Returns a string that identifies the machine type of the machine on which GCL is currently running.
Syntax:
(time form)
Evaluates FORM and outputs timing statistics on *TRACE-OUTPUT*.
Returns a string that identifies the software type of the software under which GCL is currently running.
Returns a string that tells you that you are using a version of GCL.
This function causes execution to be suspended for N seconds. N may be any non-negative, non-complex number.
Syntax:
(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}*) }* )
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.
See the files misc/rusage.lsp misc/cstruct.lsp, for examples of making a lisp structure correspond to a C structure.
GCL specific: Prints the documentation associated with SYMBOL. With no argument, this function prints the greeting message to GCL beginners.
Syntax:
(do-external-symbols (var [package [result-form]]) {decl}* {tag | statement}*)
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).
Syntax:
(do* ({(var [init [step]])}*) (endtest {result}*) {decl}* {tag | statement}*)
Just like DO, but performs variable bindings and assignments in serial, just like LET* and SETQ do.
Syntax:
(do-all-symbols (var [result-form]) {decl}* {tag | statement}*)
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).
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.
For each entry in HASH-TABLE, calls FUNCTION on the key and value of the entry; returns NIL.
Applies FUN to successive cars of LISTs and returns the results as a list.
Syntax:
(dolist (var listform [result]) {decl}* {tag | statement}*)
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).
Returns T if X and Y are the same identical object; NIL otherwise.
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.
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.
Syntax:
(do-symbols (var [package [result-form]]) {decl}* {tag | statement}*)
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).
Syntax:
(loop {form}*)
Executes FORMs repeatedly until exited by a THROW or RETURN. The FORMs are surrounded by an implicit NIL block.
Subtracts the second and all subsequent NUMBERs from the first NUMBER. With one arg, negates it.
Syntax:
(untrace {function-name}*)
Removes tracing from the specified functions. With no FUNCTION-NAMEs, untraces all functions.
Returns an input stream which will supply the characters of String between Start and End in order.
Syntax:
(step form)
Evaluates FORM in the single-step mode and returns the value.
Prints a description of the object X.
Invokes the editor. The action depends on the version of GCL.
Signals a correctable error.
Shows the information about the object X in an interactive manner
If PATHNAME is given, begins to record the interaction to the specified file. If PATHNAME is not given, ends the recording.
Formats FORMAT-STRING and ARGs to *ERROR-OUTPUT* as a warning message.
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.
Syntax:
(trace {function-name}*)
Traces the specified functions. With no FUNCTION-NAMEs, returns a list of functions currently being traced.
Additional Keywords are allowed in GCL with the syntax (trace {fn | (fn {:kw form}*)}*)
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.
EXAMPLE (Try this with your favorite factorial function FACT):
;; 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))
Syntax is :keyword
form1 :keyword
form2 ...
:declarations
DEFAULT: NILFORM 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 .
:COND
DEFAULT: THere, 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.
:ENTRYCOND
DEFAULT: TThis 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".
:ENTRY
DEFAULT: (CONS (QUOTE x) SI::ARGLIST),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.
:EXITCOND
DEFAULT: TThis 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.
:EXIT
DEFAULT: (CONS (QUOTE x) VALUES),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).
:DEPTH
DEFAULT: No depth limitFORM 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.
Prints those symbols whose print-names contain STRING as substring. If PACKAGE is non-NIL, then only the specified package is searched.
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.
Otherwise a list of choices is offered and the user may select some of these choices.
list-of-info-files is of the form
("gcl-si.info" "gcl-tk.info" "gcl.info")
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 `dir'.
see *Index *default-info-files*:: and *Index *info-paths*::. For 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]] ...
would list the node (gcl.info)defun
.
That is the node entitled defun
from the info file gcl.info. That
documentation is based on the ANSI common lisp standard. The choice
DEFUN :(gcl-si.info)Special Forms and Functions.
refers to the documentation on DEFUN from the info file gcl-si.info in
the node Special Forms And Functions. This is an index reference
and only the part of the node which refers to defun
will be
printed.
(info "factor" '("maxima.info"))
would search the maxima info files index and nodes for factor
.
A list of strings such as
'("" "/usr/info/" "/usr/local/lib/info/" "/usr/local/info/" "/usr/local/gnu/info/" )
saying where to look for the info files. It is used implicitly
by info
, see *Index info::.
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 `dir' in the *info-paths* directories, and if it were found it would look in the `dir' for a menu item such as
* maxima: (/home/wfs/maxima-5.0/info/maxima.info).
If such an entry exists then the directory there would be used for the
purpose of finding maxima.info
Coerces X to an object of the type TYPE.
Returns the type of X.
Returns T if the variable named by SYMBOL is a constant; NIL otherwise.
Returns T if X is of the type TYPE; NIL otherwise.
Returns T if X is a Common Lisp object; NIL otherwise.
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.
Syntax:
(check-type place typespec [string])
Signals an error, if the contents of PLACE are not of the specified type.
Syntax:
(assert test-form [({place}*) [string {arg}*]])
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.
Syntax:
(deftype name lambda-list {decl | doc}* {form}*)
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).
GCL specific: Executes a Shell command as if STRING is an input to the Shell. Not all versions of GCL support this function.
Returns a string that identifies the machine version of the machine on which GCL is currently running.
GCL specific: Exits from GCL.
Syntax:
(defcfun header n {element}*)
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.
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.
(defCfun "object list2(x,y) object x,y;" 0 "object z;" ('NIL z) ((CONS y z) z) ((CONS x z) z) "return(z);" )
In lisp the operations in the body would be (setq z 'nil) (setq z (cons y z)) (setq z (cons x z))
Syntax:
(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 }
Syntax:
(clines {string}*)
GCL specific: The GCL compiler embeds STRINGs into the intermediate C language code. The interpreter ignores this form.
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.
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.
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.
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.
Syntax:
(defla name lambda-list {decl | doc}* {form}*)
GCL specific: Used to DEFine Lisp Alternative. For the interpreter, DEFLA is equivalent to DEFUN, but the compiler ignores this form.
GCL specific: Returns T if the specified declaration is globally in effect; NIL otherwise. See the doc of DECLARE for possible DECL-SPECs.
Syntax:
(defentry name arg-types c-function)
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.
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---
One must be careful of storage allocation issues when passing a string.
If the C code invokes storage allocation (either by calling malloc
or make_cons
etc), then there is a possibility of a garbage
collection, so that if the string passed was not constructed with
:static t
when its array was constructed, then it could move.
If the C function may allocate storage, then you should pass a copy:
(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)
GCL specific: Exits from GCL.
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.
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.
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. Below is the actual code for PI-INV
On a sun3/280 (cli.com)
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.
On a sun3/280 (cli.com)
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))))))))
When GCL is built, those symbols in the system libraries which are referenced by functions linked in in the list of objects given in `unixport/makefile', become available for reference by GCL code.
On some systems it is possible with faslink
to load `.o' files
which reference other libraries, but in general this practice is not
portable.
GCL specific: Sets the maximum number of pages for contiguous blocks to NUMBER. If REALLY-ALLOCATE is non-NIL, then the specified number of pages will be allocated immediately.
The inline defstruct type checker will be made more efficient, in that it will only check for types which currently include NAME. After calling this the defstruct should not be altered.
GCL specific: Returns the current maximum number of pages for the type class of the GCL implementation type TYPE.
GCL specific: Returns the number of pages currently allocated for relocatable blocks.
Give SYMBOL the VALUE on INDICATOR property.
GCL specific: Returns the number of pages currently allocated for the type class of the GCL implementation type TYPE.
GCL specific: Sets the maximum number of pages for relocatable blocks to NUMBER.
GCL specific: Returns the number of pages currently allocated for contiguous blocks.
GCL specific: Returns the current maximum number of pages for contiguous blocks.
GCL specific: Returns as a fixnum the size of the memory hole (in pages).
GCL specific: Returns T if the SYMBOL is a globally special variable; NIL otherwise.
GCL specific: Returns the string corresponding to the STRING-OUTPUT-STREAM.
GCL specific: Returns the current index of the STRING-INPUT-STREAM.
GCL specific: Returns the result of concatenating the given STRINGS.
GCL specific: Returns the symbol of the i-th entity in the bind stack.
GCL specific: Evaluates the FORM in the null environment. If the evaluation of the FORM has successfully completed, SI:ERROR-SET returns NIL as the first value and the result of the evaluation as the rest of the values. If, in the course of the evaluation, a non-local jump from the FORM is atempted, SI:ERROR-SET traps the jump and returns the corresponding jump tag as its value.
GCL specific: Returns the name of the COMPILED-FUNCTION-OBJECT.
GCL specific: Returns T if the OBJECT is a structure; NIL otherwise.
GCL specific: Returns the value stack index of the i-th entity in the invocation history stack.
GCL specific: Starts the error handler of GCL. When an error is detected, GCL calls SI:UNIVERSAL-ERROR-HANDLER with the specified arguments. ERROR-NAME is the name of the error. CORRECTABLE is T for a correctable error and NIL for a fatal error. FUNCTION-NAME is the name of the function that caused the error. CONTINUE-FORMAT-STRING and ERROR-FORMAT-STRING are the format strings of the error message. ARGS are the arguments to the format strings. To change the error handler of GCL, redefine SI:UNIVERSAL-ERROR- HANDLER.
GCL/UNIX specific: Changes the current working directory to the specified pathname.
GCL specific: Copies IN-STREAM to OUT-STREAM until the end-of-file on IN- STREAM.
GCL specific: Initializes the library and the compiler of GCL. Since they have already been initialized in the standard image of GCL, calling SI:INIT- SYSTEM will cause an error.
GCL specific: Sets the size of the memory hole (in pages).
GCL specific: Returns the bind stack index of the i-th entity in the frame stack.
GCL specific: Returns the function value of the i-th entity in the invocation history stack.
GCL specific: Makes the SYMBOL a constant with the specified VALUE.
GCL specific: Returns T if the OBJECT is a fixnum; NIL otherwise.
GCL specific: Returns the value of the i-th entity in the bind stack.
GCL specific: (SI:STRING-TO-OBJECT STRING) is equivalent to (READ-FROM-STRING STRING), but much faster.
GCL specific: Returns the invocation history stack index of the i-th entity in the frame stack.
GCL specific: Resets the counter of the garbage collector that records how many times the garbage collector has been called for each implementation type.
GCL/BSD specific: Installs a signal catcher for bad signals: SIGILL, SIGIOT, SIGEMT, SIGBUS, SIGSEGV, SIGSYS. The signal catcher, upon catching the signal, signals an error (and enter the break-level). Since the internal memory of GCL may be broken, the user should check the signal and exit from GCL if necessary. When the signal is caught during garbage collection, GCL terminates immediately.
GCL specific: Resets the stack limits to the normal state. When a stack has overflowed, GCL extends the limit for the stack in order to execute the error handler. After processing the error, GCL resets the stack limit by calling SI:RESET-STACK-LIMITS.
Returns 6 values:
Note that all items of the same size are stored on similar pages. Thus for example on a 486 under linux the following basic types are all the same size and so will share the same allocated information: CONS BIGNUM RATIO COMPLEX STRUCTURE.
GCL specific: Makes the SYMBOL globally special.
GCL specific: Creates a string-output-stream corresponding to the STRING and returns it. The STRING should have a fill-pointer.
GCL specific: Returns the address of the OBJECT as a fixnum. The address of an object depends on the version of GCL. E.g. (SI:ADDRESS NIL) returns 1879062044 on GCL/AOSVS dated March 14, 1986.
GCL specific: Returns the number of arguments on the command line that invoked the GCL process.
GCL specific: Returns the object in the address FIXNUM. This function is the inverse of SI:ADDRESS. Although SI:ADDRESS is a harmless operation, SI:NANI is quite dangerous and should be used with care.
GCL specific: Saves the current GCL core imange into a program file specified by PATHNAME. This function differs from SAVE in that the contiguous and relocatable areas are made permanent in the saved image. Usually the standard image of GCL interpreter/compiler is saved by SI:SAVE-SYSTEM. This function causes an exit from lisp. Various changes are made to the memory of the running system, such as closing files and resetting io streams. It would not be possible to continue normally.
GCL/BSD specific: Undoes the effect of SI:CATCH-BAD-SIGNALS.
GCL specific: Returns the i-th entity in the value stack.
GCL specific: Returns T if the ARRAY is a displaced array; NIL otherwise.
GCL specific: Returns the FIXNUM-th argument on the command line that invoked the GCL process.
GCL/UNIX specific: Returns the environment with the name STRING as a string; if the environment specified by STRING is not found, returns NIL.
GCL/BSD specific: Loads the FASL file FILE while linking the object files and libraries specified by STRING. For example, (faslink "foo.o" "bar.o boo.o -lpixrect") loads foo.o while linking two object files (bar.o and boo.o) and the library pixrect. Usually, foo.o consists of the C language interface for the functions defined in the object files or the libraries.
A more portable way of making references to C code, is to build it in at the time of the original make. If foo.c references things in -lpixrect, and foo.o is its compilation in the gcl/unixport directory
(cd gcl/unixport ; make "EXTRAS= foo.o -lpixrect ")
should add them. If EXTRAS was already joe.o in the unixport/makefile you should of course add joe.o to the above "EXTRAS= joe.o foo.o.."
Faslink does not work on most UNIX systems which are derived from SYS V or AIX.
GCL specific: Starts the standard top-level listner of GCL. When the GCL process is invoked, it calls SI:TOP-LEVEL by (FUNCALL 'SI:TOP-LEVEL). To change the top-level of GCL, redefine SI:TOP-LEVEL and save the core imange in a file. When the saved imange is invoked, it will start the redefined top-level.
GCL specific: Returns the value stack index of the i-th entity in the frame stack.
Write out a file of debug-symbols using address START as the place where FILE will be loaded into the running executable MAIN-FILE. The last is a keyword argument.
These functions in the SI package are GCL specific, and allow monitoring the run time of functions loaded into GCL, as well as the basic functions. Sample Usage: (si::set-up-profile 1000000) (si::prof 0 90) run program (si::prof 0 0) ;; turn off profile (si::display-prof) (si::clear-profile) (si::prof 0 90) ;; start profile again run program .. Profile can be stopped with (si::prof 0 0) and restarted with (si::prof 0 90) The START-ADDRESS will correspond to the beginning of the profile array, and the SCALE will mean that 256 bytes of code correspond to SCALE bytes in the profile array.
Thus if the profile array is 1,000,000 bytes long and the code segment is 5 megabytes long you can profile the whole thing using a scale of 50 Note that long runs may result in overflow, and so an understating of the time in a function.
You must run intensively however since, with a scale of 128 it takes 6,000,000 times through a loop to overflow the sampling in one part of the code.
Sets the value of the C variable catch_fatal to I which should be an integer. If catch_fatal is 1, then most unrecoverable fatal errors will be caught. Upon catching such an error catch_fatal becomes -1, to avoid recursive errors. The top level loop automatically sets catch_fatal to 1, if the value is less than zero. Catching can be turned off by making catch_fatal = 0.
If this variable is set to a positive fixnum, then the next time through the TOP-LEVEL loop, the loop will be exited. The size of the stacks will be multiplied by the value of *multiply-stacks*, and the TOP-LEVEL will be called again. Thus to double the size of the stacks:
>(setq si::*multiply-stacks* 2) [exits top level and reinvokes it, with the new stacks in place] >
We must exit TOP-LEVEL, because it and any other lisp functions maintain many pointers into the stacks, which would be incorrect when the stacks have been moved. Interrupting the process of growing the stacks, can leave you in an inconsistent state.
Sets the internal C variable gc_time to X if X is supplied and then returns gc_time. If gc_time is greater or equal to 0, then gc_time is incremented by the garbage collector, according to the number of internal time units spent there. The initial value of gc_time is -1.
Write from STRING starting at char START (or 0 if it is nil) COUNT characters (or to end if COUNT is nil) to STREAM. STREAM must be a stream such as returned by FP-OUTPUT-STREAM. Returns nil if it fails.
Read characters into STRING starting at char START (or 0 if it is nil) COUNT characters (or from start to length of STRING if COUNT is nil). Characters are read from STREAM. STREAM must be a stream such as returned by FP-INPUT-STREAM. Returns nil if it fails. Return number of characters read if it succeeds.
If ON is not nil then SGC (stratified garbage collection) is turned on. If ON is supplied and is nil, then SGC is turned off. If ON is not supplied, then it returns T if SGC is on, and NIL if SGC is off.
The purpose of SGC is to prevent paging activity during garbage collection. It is efficient if the actual number of pages being written to form a small percentage of the total image size. The image should be built as compactly as possible. This can be accomplished by using a settings such as (si::allocate-growth 'cons 1 10 50 20) to limit the growth in the cons maxpage to 10 pages per time. Then just before calling si::save-system to save your image you can do something like:
(si::set-hole-size 500)(gbc nil) (si::sgc-on t) (si::save-system ..)
This makes the saved image come up with SGC on. We have set a reasonably large hole size. This is so that allocation of pages either because they fill up, or through specific calls to si::allocate, will not need to move all the relocatable data. Moving relocatable data requires turning SGC off, performing a full gc, and then turning it back on. New relocatable data is collected by SGC, but moving the old requires going through all pages of memory to change pointers into it.
Using si::*notify-gbc* gives information about the number of pages used by SGC.
Note that SGC is only available on operating systems which provide the mprotect system call, to write protect pages. Otherwise we cannot tell which pages have been written too.
If MIN-PAGES is 0, then this type will not be swept by SGC. Otherwise this is the minimum number of pages to make available to SGC. MAX-PAGES is the upper limit of such pages. Only pages with PERCENT-FREE objects on them, will be assigned to SGC. A list of the previous values for min, max and percent are returned.
The next time after a garbage collection for TYPE, if PERCENT-FREE of the objects of this TYPE are not actually free, and if the maximum number of pages for this type has already been allocated, then the maximum number will be increased by PERCENT of the old maximum, subject to the condition that this increment be at least MIN pages and at most MAX pages. A list of the previous values for min, max, percent, and percent-free for the type TYPE is returned. A value of 0 means use the system default, and if an argument is out of range then the current values are returned with no change made.
Examples: (si::allocate-growth 'cons 1 10 50 10) would insist that after a garbage collection for cons, there be at least 10% cons's free. If not the number of cons pages would be grown by 50% or 10 pages which ever was smaller. This might be reasonable if you were trying to build an image which was `full', ie had few free objects of this type.
(si::allocate-growth 'fixnum 0 10000 30 40) would grow space till there were normally 40% free fixnums, usually growing by 30% per time.
(si::allocate-growth 'cons 0 0 0 40) would require 40% free conses after garbage collection for conses, and would use system defaults for the the rate to grow towards this goal.
(si::allocate-growth 'cons -1 0 0 0) would return the current values, but not make any changes.
Given file STREAM open for input or output in DIRECTION, set it up to start writing or reading in fasd format. When reading from this stream the EOF-VALUE will be returned when the end a fasd end of dump marker is encountered. TABLE should be an eq hashtable on output, a vector on input, or nil. In this last case a default one will be constructed.
We shall refer to the result as a `fasd stream'. It is suitable as the arg to CLOSE-FASD, READ-FASD-TOP, and as the second second arg to WRITE-FASD. As a lisp object it is actually a vector, whose body coincides with:
struct fasd { object stream; /* lisp object of type stream */ object table; /* hash table used in dumping or vector on input*/ object eof; /* lisp object to be returned on coming to eof mark */ object direction; /* holds Cnil or Kinput or Koutput */ object package; /* the package symbols are in by default */ object index; /* integer. The current_dump index on write */ object filepos; /* nil or the position of the start */ object table_length; /* On read it is set to the size dump array needed or 0 */ object macro ; }
We did not use a defstruct for this, because we want the compiler to use this and it makes bootstrapping more difficult. It is in "cmpnew/fasdmacros.lsp"
Write X to FASD-STREAM.
Read the next object from FASD-STREAM. Return the eof-value of FASD-STREAM if we encounter an eof marker put out by CLOSE-FASD. Encountering end of actual file stream causes an error.
On output write an eof marker to the associated file stream, and then make FASD-STREAM invalid for further output. It also attempts to write information to the stream on the size of the index table needed to read from the stream from the last open. This is useful in growing the array. It does not alter the file stream, other than for writing this information to it. The file stream may be reopened for further use. It is an error to OPEN-FASD the same file or file stream again with out first calling CLOSE-FASD.
X is any lisp object and TABLE is an eq hash table. This walks through X making entries to indicate the frequency of symbols,lists, and arrays. Initially items get -1 when they are first met, and this is decremented by 1 each time the object occurs. Call this function on all the objects in a fasd file, which you wish to share structure.
This is equivalent to defun except that VARS may not contain &optional, &rest, &key or &aux. Also a compiler property is added, which essentially saves the body and turns this into a let of the VARS and then execution of the body. This last is done using si::DEFINE-COMPILER-MACRO Example: (si::define-inline-function myplus (a b c) (+ a b c))
FNAME may be the name of a function, but at compile time the macro expansion given by this is used.
(si::define-compiler-macro mycar (a) `(car ,a))
Invoke a top level loop, in which debug commands may be entered. These commands may also be entered at breaks, or in the error handler. See SOURCE-LEVEL-DEBUG
Load a file with the readtable bound to a special readtable, which permits tracking of source line information as the file is loaded. see SOURCE-LEVEL-DEBUG
Set a breakpoint for a FUNCTION at LINE if the function has source information loaded. If ABSOLUTE is not nil, then the line is understood to be relative to the beginning of the buffer. See also dbl-break-function, the emacs command.
Returns an object suitable for passing to XDR-READ if the stream is an input stream, and XDR-WRITE if it was an output stream. Note the stream must be a unix stream, on which si::fp-input-stream or si::fp-output-stream would act as the identity.
Return a unix stream for input associated to STREAM if possible, otherwise return nil.
Return a unix stream for output associated to STREAM if possible, otherwise return nil.
Read one item from STREAM of type the type of ELEMENT. The representation of the elements is machine independent. The xdr routines are what is used by the basic unix rpc calls.
Write to STREAM the given ELEMENT.
Increase the internal bignum stack by a factor of N. Normally space on this stack is recovered after each complete lisp expression is evaluated. However if you are dealing with large integers, you may need to use this function to increase the stack.
Execute the command STRING in a subshell passing the strings in the list ARGLIST as arguments to the command. Return a two way stream associated to this. Use si::fp-output-stream to get an associated output stream or si::fp-input-stream.
Bugs: It does not properly deallocate everything, so that it will fail if you call it too many times.
The form of a regexp pattern is discussed in See section Regular Expressions.
The function string-match
(*Index string-match::) is used to
match a regular expression against a string. If the variable
*case-fold-search*
is not nil, case is ignored in the match.
To determine the extent of the match use *Index match-beginning:: and
*Index match-end::.
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).
|
. A match of the regular expression against a string is simply a match of the string with one of the branches.
+
, *
, or ?
.
+
matches a sequence of 1 or more matches of the atom.
*
matches a sequence of 0 or more matches of the atom.
?
matches a match of the atom, or the null string.
.
matching any single character
^
matching the null string at the beginning of the input string
$
matching the null string at the end of the input string
\
followed by a single character matching that character
[]
.
It normally matches any single character from the sequence.
^
,
it matches any single character not from the rest of the sequence.
-
, this is shorthand
for the full list of ASCII characters between them
(e.g. [0-9]
matches any decimal digit).
]
in the sequence, make it the first character
(following a possible ^
).
-
, make it the first or last character.
In general there may be more than one way to match a regular expression to an input string. For example, consider the command
(string-match "(a*)b*" "aabaaabb")
Considering only the rules given so far, the value of (list-matches 0 1)
might be ("aabb" "aa")
or ("aaab" "aaa")
or ("ab" "a")
or any of several other combinations.
To resolve this potential ambiguity string-match chooses among
alternatives using the rule first then longest.
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:
In the example from above, (a*)b* matches aab: the (a*) portion of the pattern is matched first and it consumes the leading aa; then the b* portion of the pattern consumes the next b. Or, consider the following 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
In the above example the return value of 1
(which is > -1
)
indicates that a match was found. The entire match runs from
1 to 4.
Rule 4 specifies that (ab|a) gets first shot at the input
string and Rule 2 specifies that the ab sub-expression
is checked before the a sub-expression.
Thus the b has already been claimed before the (b*)
component is checked and (b*) must match an empty string.
The special characters in the string "\()[]+.*|^$?"
,
must be quoted, if a simple string search is desired. The function
re-quote-string is provided for this purpose.
(re-quote-string "*standard*") ==> "\\*standard\\*" (string-match (re-quote-string "*standard*") "X *standard* ") ==> 2 (string-match "*standard*" "X *standard* ") Error: Regexp Error: ?+* follows nothing
Note there is actually just one \
before the *
but the printer makes two so that the string can be read, since
\
is also the lisp quote character. In the last example
an error is signalled since the special character *
must
follow an atom if it is interpreted as a regular expression.
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.]
OVERVIEW:
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.
FUNCTIONS: break points which have been set. si::nload (file) load a lisp file collecting source line information. si::break-function (function &optional line absolute) set up a breakpoint for FUNCTION at LINE relative to start or ABSOLUTE
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.
Inferior Dbl Mode: Major mode for interacting with an inferior Dbl process. The following commands are available:
C-c l dbl-find-line
ESC d dbl-:down ESC u dbl-:up ESC c dbl-:r ESC n dbl-:next ESC i dbl-:step ESC s dbl-:step
M-x dbl-display-frame displays in the other window the last line referred to in the dbl buffer.
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.
If you are in a source file, you may select a point to break at, by doing C-x SPC.
Commands: Many commands are inherited from shell mode. Additionally we have:
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.
----------------------------
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.
Keywords typed at top level, in the debug loop have a special meaning:
Files: debug.lsp dbl.el gcl.el
Use the following functions to directly access GCL stacks.
(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.
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.
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*.
A sample program for drawing things on X windows from lisp is included in the file gcl/lsp/littleXlsp.lsp
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.
This program is also a good tutorial on invoking C from lisp.
See also defentry and faslink.
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.
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.
Usage: (compiler::emit-fn t) (compile-file "foo1.lisp") (compile-file "foo2.lisp")
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.
For each D in DIRECTORIES all files in (directory D) are loaded.
For example (make-all-proclaims "lsp/*.fn" "cmpnew/*.fn") would load any files in lsp/*.fn and cmpnew/*.fn.
[See EMIT-FN for details on creation of .fn files]
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.
Finally a file sys-proclaim.lisp is written out. This file contains function proclamations.
(load "sys-proclaim.lisp") (compile-file "foo1.lisp") (compile-file "foo2.lisp")
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.
Return a list of all functions called but not defined, in the current data base (see EMIT-FN).
Sample: (compiler::emit-fn t) (compile-file "foo1.lisp") (compiler::list-undefined-functions) or (mapcar 'load (directory "*.fn")) (compiler::list-undefined-functions)
List all functions in the data base [see emit-fn] which call FUNCTION-NAME.
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.
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.
This document was generated on 7 November 1996 using the texi2html translator version 1.51.