| 1 |
This is gcl-si.info, produced by makeinfo version 6.7 from gcl-si.texi. |
| 2 |
|
| 3 |
INFO-DIR-SECTION GNU Common Lisp |
| 4 |
START-INFO-DIR-ENTRY |
| 5 |
* gcl-si: (gcl-si.info). GNU Common Lisp System Internals |
| 6 |
END-INFO-DIR-ENTRY |
| 7 |
|
| 8 |
This is a Texinfo GCL SYSTEM INTERNALS Manual |
| 9 |
|
| 10 |
Copyright 1994 William F. Schelter |
| 11 |
|
| 12 |
|
| 13 |
File: gcl-si.info, Node: Top, Next: Numbers, Prev: (dir), Up: (dir) |
| 14 |
|
| 15 |
* Menu: |
| 16 |
|
| 17 |
* Numbers:: |
| 18 |
* Sequences and Arrays and Hash Tables:: |
| 19 |
* Characters:: |
| 20 |
* Lists:: |
| 21 |
* Streams and Reading:: |
| 22 |
* Special Forms and Functions:: |
| 23 |
* Compilation:: |
| 24 |
* Symbols:: |
| 25 |
* Operating System:: |
| 26 |
* Structures:: |
| 27 |
* Iteration and Tests:: |
| 28 |
* User Interface:: |
| 29 |
* Doc:: |
| 30 |
* Type:: |
| 31 |
* GCL Specific:: |
| 32 |
* C Interface:: |
| 33 |
* System Definitions:: |
| 34 |
* Debugging:: |
| 35 |
* Miscellaneous:: |
| 36 |
* Compiler Definitions:: |
| 37 |
* Function and Variable Index:: |
| 38 |
|
| 39 |
-- The Detailed Node Listing -- |
| 40 |
|
| 41 |
Operating System |
| 42 |
|
| 43 |
* Command Line:: |
| 44 |
* Operating System Definitions:: |
| 45 |
|
| 46 |
GCL Specific |
| 47 |
|
| 48 |
* Bignums:: |
| 49 |
|
| 50 |
C Interface |
| 51 |
|
| 52 |
* Available Symbols:: |
| 53 |
|
| 54 |
System Definitions |
| 55 |
|
| 56 |
* Regular Expressions:: |
| 57 |
|
| 58 |
Debugging |
| 59 |
|
| 60 |
* Source Level Debugging in Emacs:: |
| 61 |
* Low Level Debug Functions:: |
| 62 |
|
| 63 |
Miscellaneous |
| 64 |
|
| 65 |
* Environment:: |
| 66 |
* Inititialization:: |
| 67 |
* Low Level X Interface:: |
| 68 |
|
| 69 |
|
| 70 |
File: gcl-si.info, Node: Numbers, Next: Sequences and Arrays and Hash Tables, Prev: Top, Up: Top |
| 71 |
|
| 72 |
1 Numbers |
| 73 |
********* |
| 74 |
|
| 75 |
-- Function: SIGNUM (number) |
| 76 |
Package:LISP |
| 77 |
|
| 78 |
If NUMBER is zero, returns NUMBER; else returns (/ NUMBER (ABS |
| 79 |
NUMBER)). |
| 80 |
|
| 81 |
-- Function: LOGNOT (integer) |
| 82 |
Package:LISP |
| 83 |
|
| 84 |
Returns the bit-wise logical NOT of INTEGER. |
| 85 |
|
| 86 |
-- Constant: MOST-POSITIVE-SHORT-FLOAT |
| 87 |
Package:LISP The short-float closest in value to positive infinity. |
| 88 |
|
| 89 |
-- Function: INTEGER-DECODE-FLOAT (float) |
| 90 |
Package:LISP |
| 91 |
|
| 92 |
Returns, as three values, the integer interpretation of significand |
| 93 |
F, the exponent E, and the sign S of the given float, so that E |
| 94 |
FLOAT = S * F * B where B = (FLOAT-RADIX FLOAT) |
| 95 |
|
| 96 |
F is a non-negative integer, E is an integer, and S is either 1 or |
| 97 |
-1. |
| 98 |
|
| 99 |
-- Function: MINUSP (number) |
| 100 |
Package:LISP |
| 101 |
|
| 102 |
Returns T if NUMBER < 0; NIL otherwise. |
| 103 |
|
| 104 |
-- Function: LOGORC1 (integer1 integer2) |
| 105 |
Package:LISP |
| 106 |
|
| 107 |
Returns the logical OR of (LOGNOT INTEGER1) and INTEGER2. |
| 108 |
|
| 109 |
-- Constant: MOST-NEGATIVE-SINGLE-FLOAT |
| 110 |
Package:LISP Same as MOST-NEGATIVE-LONG-FLOAT. |
| 111 |
|
| 112 |
-- Constant: BOOLE-C1 |
| 113 |
Package:LISP Makes BOOLE return the complement of INTEGER1. |
| 114 |
|
| 115 |
-- Constant: LEAST-POSITIVE-SHORT-FLOAT |
| 116 |
Package:LISP The positive short-float closest in value to zero. |
| 117 |
|
| 118 |
-- Function: BIT-NAND (bit-array1 bit-array2 &optional |
| 119 |
(result-bit-array nil)) |
| 120 |
Package:LISP |
| 121 |
|
| 122 |
Performs a bit-wise logical NAND on the elements of BIT-ARRAY1 and |
| 123 |
BIT-ARRAY2. Puts the results into a new bit array if |
| 124 |
RESULT-BIT-ARRAY is NIL, into BIT-ARRAY1 if RESULT-BIT-ARRAY is T, |
| 125 |
or into RESULT-BIT-ARRAY otherwise. |
| 126 |
|
| 127 |
-- Function: INT-CHAR (integer) |
| 128 |
Package:LISP |
| 129 |
|
| 130 |
Performs the inverse of CHAR-INT. Equivalent to CODE-CHAR in GCL. |
| 131 |
|
| 132 |
-- Function: CHAR-INT (char) |
| 133 |
Package:LISP |
| 134 |
|
| 135 |
Returns the font, bits, and code attributes as a single |
| 136 |
non-negative integer. Equivalent to CHAR-CODE in GCL. |
| 137 |
|
| 138 |
-- Constant: LEAST-NEGATIVE-SINGLE-FLOAT |
| 139 |
Package:LISP Same as LEAST-NEGATIVE-LONG-FLOAT. |
| 140 |
|
| 141 |
-- Function: /= (number &rest more-numbers) |
| 142 |
Package:LISP |
| 143 |
|
| 144 |
Returns T if no two of its arguments are numerically equal; NIL |
| 145 |
otherwise. |
| 146 |
|
| 147 |
-- Function: LDB-TEST (bytespec integer) |
| 148 |
Package:LISP |
| 149 |
|
| 150 |
Returns T if at least one of the bits in the specified bytes of |
| 151 |
INTEGER is 1; NIL otherwise. |
| 152 |
|
| 153 |
-- Constant: CHAR-CODE-LIMIT |
| 154 |
Package:LISP The upper exclusive bound on values produced by |
| 155 |
CHAR-CODE. |
| 156 |
|
| 157 |
-- Function: RATIONAL (number) |
| 158 |
Package:LISP |
| 159 |
|
| 160 |
Converts NUMBER into rational accurately and returns it. |
| 161 |
|
| 162 |
-- Constant: PI |
| 163 |
Package:LISP The floating-point number that is appropriately equal |
| 164 |
to the ratio of the circumference of the circle to the diameter. |
| 165 |
|
| 166 |
-- Function: SIN (radians) |
| 167 |
Package:LISP |
| 168 |
|
| 169 |
Returns the sine of RADIANS. |
| 170 |
|
| 171 |
-- Constant: BOOLE-ORC2 |
| 172 |
Package:LISP Makes BOOLE return LOGORC2 of INTEGER1 and INTEGER2. |
| 173 |
|
| 174 |
-- Function: NUMERATOR (rational) |
| 175 |
Package:LISP |
| 176 |
|
| 177 |
Returns as an integer the numerator of the given rational number. |
| 178 |
|
| 179 |
-- Function: MASK-FIELD (bytespec integer) |
| 180 |
Package:LISP |
| 181 |
|
| 182 |
Extracts the specified byte from INTEGER. |
| 183 |
|
| 184 |
-- Special Form: INCF |
| 185 |
Package:LISP |
| 186 |
|
| 187 |
Syntax: |
| 188 |
(incf place [delta]) |
| 189 |
|
| 190 |
Adds the number produced by DELTA (which defaults to 1) to the |
| 191 |
number in PLACE. |
| 192 |
|
| 193 |
-- Function: SINH (number) |
| 194 |
Package:LISP |
| 195 |
|
| 196 |
Returns the hyperbolic sine of NUMBER. |
| 197 |
|
| 198 |
-- Function: PHASE (number) |
| 199 |
Package:LISP |
| 200 |
|
| 201 |
Returns the angle part of the polar representation of a complex |
| 202 |
number. For non-complex numbers, this is 0. |
| 203 |
|
| 204 |
-- Function: BOOLE (op integer1 integer2) |
| 205 |
Package:LISP |
| 206 |
|
| 207 |
Returns an integer produced by performing the logical operation |
| 208 |
specified by OP on the two integers. OP must be the value of one |
| 209 |
of the following constants: BOOLE-CLR BOOLE-C1 BOOLE-XOR |
| 210 |
BOOLE-ANDC1 BOOLE-SET BOOLE-C2 BOOLE-EQV BOOLE-ANDC2 BOOLE-1 |
| 211 |
BOOLE-AND BOOLE-NAND BOOLE-ORC1 BOOLE-2 BOOLE-IOR BOOLE-NOR |
| 212 |
BOOLE-ORC2 See the variable docs of these constants for their |
| 213 |
operations. |
| 214 |
|
| 215 |
-- Constant: SHORT-FLOAT-EPSILON |
| 216 |
Package:LISP The smallest positive short-float that satisfies (not |
| 217 |
(= (float 1 e) (+ (float 1 e) e))). |
| 218 |
|
| 219 |
-- Function: LOGORC2 (integer1 integer2) |
| 220 |
Package:LISP |
| 221 |
|
| 222 |
Returns the logical OR of INTEGER1 and (LOGNOT INTEGER2). |
| 223 |
|
| 224 |
-- Constant: BOOLE-C2 |
| 225 |
Package:LISP Makes BOOLE return the complement of INTEGER2. |
| 226 |
|
| 227 |
-- Function: REALPART (number) |
| 228 |
Package:LISP |
| 229 |
|
| 230 |
Extracts the real part of NUMBER. |
| 231 |
|
| 232 |
-- Constant: BOOLE-CLR |
| 233 |
Package:LISP Makes BOOLE return 0. |
| 234 |
|
| 235 |
-- Constant: BOOLE-IOR |
| 236 |
Package:LISP Makes BOOLE return LOGIOR of INTEGER1 and INTEGER2. |
| 237 |
|
| 238 |
-- Function: FTRUNCATE (number &optional (divisor 1)) |
| 239 |
Package:LISP |
| 240 |
|
| 241 |
Values: (quotient remainder) Same as TRUNCATE, but returns first |
| 242 |
value as a float. |
| 243 |
|
| 244 |
-- Function: EQL (x y) |
| 245 |
Package:LISP |
| 246 |
|
| 247 |
Returns T if X and Y are EQ, or if they are numbers of the same |
| 248 |
type with the same value, or if they are character objects that |
| 249 |
represent the same character. Returns NIL otherwise. |
| 250 |
|
| 251 |
-- Function: LOG (number &optional base) |
| 252 |
Package:LISP |
| 253 |
|
| 254 |
Returns the logarithm of NUMBER in the base BASE. BASE defaults to |
| 255 |
the base of natural logarithms. |
| 256 |
|
| 257 |
-- Constant: DOUBLE-FLOAT-NEGATIVE-EPSILON |
| 258 |
Package:LISP Same as LONG-FLOAT-NEGATIVE-EPSILON. |
| 259 |
|
| 260 |
-- Function: LOGIOR (&rest integers) |
| 261 |
Package:LISP |
| 262 |
|
| 263 |
Returns the bit-wise INCLUSIVE OR of its arguments. |
| 264 |
|
| 265 |
-- Constant: MOST-NEGATIVE-DOUBLE-FLOAT |
| 266 |
Package:LISP Same as MOST-NEGATIVE-LONG-FLOAT. |
| 267 |
|
| 268 |
-- Function: / (number &rest more-numbers) |
| 269 |
Package:LISP |
| 270 |
|
| 271 |
Divides the first NUMBER by each of the subsequent NUMBERS. With |
| 272 |
one arg, returns the reciprocal of the number. |
| 273 |
|
| 274 |
-- Variable: *RANDOM-STATE* |
| 275 |
Package:LISP The default random-state object used by RAMDOM. |
| 276 |
|
| 277 |
-- Function: 1+ (number) |
| 278 |
Package:LISP |
| 279 |
|
| 280 |
Returns NUMBER + 1. |
| 281 |
|
| 282 |
-- Constant: LEAST-NEGATIVE-DOUBLE-FLOAT |
| 283 |
Package:LISP Same as LEAST-NEGATIVE-LONG-FLOAT. |
| 284 |
|
| 285 |
-- Function: FCEILING (number &optional (divisor 1)) |
| 286 |
Package:LISP |
| 287 |
|
| 288 |
Same as CEILING, but returns a float as the first value. |
| 289 |
|
| 290 |
-- Constant: MOST-POSITIVE-FIXNUM |
| 291 |
Package:LISP The fixnum closest in value to positive infinity. |
| 292 |
|
| 293 |
-- Function: BIT-ANDC1 (bit-array1 bit-array2 &optional |
| 294 |
(result-bit-array nil)) |
| 295 |
Package:LISP |
| 296 |
|
| 297 |
Performs a bit-wise logical ANDC1 on the elements of BIT-ARRAY1 and |
| 298 |
BIT-ARRAY2. Puts the results into a new bit array if |
| 299 |
RESULT-BIT-ARRAY is NIL, into BIT-ARRAY1 if RESULT-BIT-ARRAY is T, |
| 300 |
or into RESULT-BIT-ARRAY otherwise. |
| 301 |
|
| 302 |
-- Function: TAN (radians) |
| 303 |
Package:LISP |
| 304 |
|
| 305 |
Returns the tangent of RADIANS. |
| 306 |
|
| 307 |
-- Constant: BOOLE-NAND |
| 308 |
Package:LISP Makes BOOLE return LOGNAND of INTEGER1 and INTEGER2. |
| 309 |
|
| 310 |
-- Function: TANH (number) |
| 311 |
Package:LISP |
| 312 |
|
| 313 |
Returns the hyperbolic tangent of NUMBER. |
| 314 |
|
| 315 |
-- Function: ASIN (number) |
| 316 |
Package:LISP |
| 317 |
|
| 318 |
Returns the arc sine of NUMBER. |
| 319 |
|
| 320 |
-- Function: BYTE (size position) |
| 321 |
Package:LISP |
| 322 |
|
| 323 |
Returns a byte specifier. In GCL, a byte specifier is represented |
| 324 |
by a dotted pair (<size> . <position>). |
| 325 |
|
| 326 |
-- Function: ASINH (number) |
| 327 |
Package:LISP |
| 328 |
|
| 329 |
Returns the hyperbolic arc sine of NUMBER. |
| 330 |
|
| 331 |
-- Constant: MOST-POSITIVE-LONG-FLOAT |
| 332 |
Package:LISP The long-float closest in value to positive infinity. |
| 333 |
|
| 334 |
-- Macro: SHIFTF |
| 335 |
Package:LISP |
| 336 |
|
| 337 |
Syntax: |
| 338 |
(shiftf {place}+ newvalue) |
| 339 |
|
| 340 |
Evaluates all PLACEs and NEWVALUE in turn, then assigns the value |
| 341 |
of each form to the PLACE on its left. Returns the original value |
| 342 |
of the leftmost form. |
| 343 |
|
| 344 |
-- Constant: LEAST-POSITIVE-LONG-FLOAT |
| 345 |
Package:LISP The positive long-float closest in value to zero. |
| 346 |
|
| 347 |
-- Function: DEPOSIT-FIELD (newbyte bytespec integer) |
| 348 |
Package:LISP |
| 349 |
|
| 350 |
Returns an integer computed by replacing the specified byte of |
| 351 |
INTEGER with the specified byte of NEWBYTE. |
| 352 |
|
| 353 |
-- Function: BIT-AND (bit-array1 bit-array2 &optional (result-bit-array |
| 354 |
nil)) |
| 355 |
Package:LISP |
| 356 |
|
| 357 |
Performs a bit-wise logical AND on the elements of BIT-ARRAY1 and |
| 358 |
BIT-ARRAY2. Puts the results into a new bit array if |
| 359 |
RESULT-BIT-ARRAY is NIL, into BIT-ARRAY1 if RESULT-BIT-ARRAY is T, |
| 360 |
or into RESULT-BIT-ARRAY otherwise. |
| 361 |
|
| 362 |
-- Function: LOGNAND (integer1 integer2) |
| 363 |
Package:LISP |
| 364 |
|
| 365 |
Returns the complement of the logical AND of INTEGER1 and INTEGER2. |
| 366 |
|
| 367 |
-- Function: BYTE-POSITION (bytespec) |
| 368 |
Package:LISP |
| 369 |
|
| 370 |
Returns the position part (in GCL, the cdr part) of the byte |
| 371 |
specifier. |
| 372 |
|
| 373 |
-- Macro: ROTATEF |
| 374 |
Package:LISP |
| 375 |
|
| 376 |
Syntax: |
| 377 |
(rotatef {place}*) |
| 378 |
|
| 379 |
Evaluates PLACEs in turn, then assigns to each PLACE the value of |
| 380 |
the form to its right. The rightmost PLACE gets the value of the |
| 381 |
leftmost PLACE. Returns NIL always. |
| 382 |
|
| 383 |
-- Function: BIT-ANDC2 (bit-array1 bit-array2 &optional |
| 384 |
(result-bit-array nil)) |
| 385 |
Package:LISP |
| 386 |
|
| 387 |
Performs a bit-wise logical ANDC2 on the elements of BIT-ARRAY1 and |
| 388 |
BIT-ARRAY2. Puts the results into a new bit array if |
| 389 |
RESULT-BIT-ARRAY is NIL, into BIT-ARRAY1 if RESULT-BIT-ARRAY is T, |
| 390 |
or into RESULT-BIT-ARRAY otherwise. |
| 391 |
|
| 392 |
-- Function: TRUNCATE (number &optional (divisor 1)) |
| 393 |
Package:LISP |
| 394 |
|
| 395 |
Values: (quotient remainder) Returns NUMBER/DIVISOR as an integer, |
| 396 |
rounded toward 0. The second returned value is the remainder. |
| 397 |
|
| 398 |
-- Constant: BOOLE-EQV |
| 399 |
Package:LISP Makes BOOLE return LOGEQV of INTEGER1 and INTEGER2. |
| 400 |
|
| 401 |
-- Constant: BOOLE-SET |
| 402 |
Package:LISP Makes BOOLE return -1. |
| 403 |
|
| 404 |
-- Function: LDB (bytespec integer) |
| 405 |
Package:LISP |
| 406 |
|
| 407 |
Extracts and right-justifies the specified byte of INTEGER, and |
| 408 |
returns the result. |
| 409 |
|
| 410 |
-- Function: BYTE-SIZE (bytespec) |
| 411 |
Package:LISP |
| 412 |
|
| 413 |
Returns the size part (in GCL, the car part) of the byte specifier. |
| 414 |
|
| 415 |
-- Constant: SHORT-FLOAT-NEGATIVE-EPSILON |
| 416 |
Package:LISP The smallest positive short-float that satisfies (not |
| 417 |
(= (float 1 e) (- (float 1 e) e))). |
| 418 |
|
| 419 |
-- Function: REM (number divisor) |
| 420 |
Package:LISP |
| 421 |
|
| 422 |
Returns the second value of (TRUNCATE NUMBER DIVISOR). |
| 423 |
|
| 424 |
-- Function: MIN (number &rest more-numbers) |
| 425 |
Package:LISP |
| 426 |
|
| 427 |
Returns the least of its arguments. |
| 428 |
|
| 429 |
-- Function: EXP (number) |
| 430 |
Package:LISP |
| 431 |
|
| 432 |
Calculates e raised to the power NUMBER, where e is the base of |
| 433 |
natural logarithms. |
| 434 |
|
| 435 |
-- Function: DECODE-FLOAT (float) |
| 436 |
Package:LISP |
| 437 |
|
| 438 |
Returns, as three values, the significand F, the exponent E, and |
| 439 |
the sign S of the given float, so that E FLOAT = S * F * B where B |
| 440 |
= (FLOAT-RADIX FLOAT) |
| 441 |
|
| 442 |
S and F are floating-point numbers of the same float format as |
| 443 |
FLOAT, and E is an integer. |
| 444 |
|
| 445 |
-- Constant: LONG-FLOAT-EPSILON |
| 446 |
Package:LISP The smallest positive long-float that satisfies (not |
| 447 |
(= (float 1 e) (+ (float 1 e) e))). |
| 448 |
|
| 449 |
-- Function: FROUND (number &optional (divisor 1)) |
| 450 |
Package:LISP |
| 451 |
|
| 452 |
Same as ROUND, but returns first value as a float. |
| 453 |
|
| 454 |
-- Function: LOGEQV (&rest integers) |
| 455 |
Package:LISP |
| 456 |
|
| 457 |
Returns the bit-wise EQUIVALENCE of its arguments. |
| 458 |
|
| 459 |
-- Constant: MOST-NEGATIVE-SHORT-FLOAT |
| 460 |
Package:LISP The short-float closest in value to negative infinity. |
| 461 |
|
| 462 |
-- Function: BIT-NOR (bit-array1 bit-array2 &optional (result-bit-array |
| 463 |
nil)) |
| 464 |
Package:LISP |
| 465 |
|
| 466 |
Performs a bit-wise logical NOR on the elements of BIT-ARRAY1 and |
| 467 |
BIT-ARRAY2. Puts the results into a new bit array if |
| 468 |
RESULT-BIT-ARRAY is NIL, into BIT-ARRAY1 if RESULT-BIT-ARRAY is T, |
| 469 |
or into RESULT-BIT-ARRAY otherwise. |
| 470 |
|
| 471 |
-- Function: CEILING (number &optional (divisor 1)) |
| 472 |
Package:LISP |
| 473 |
|
| 474 |
Returns the smallest integer not less than or NUMBER/DIVISOR. |
| 475 |
Returns the remainder as the second value. |
| 476 |
|
| 477 |
-- Constant: LEAST-NEGATIVE-SHORT-FLOAT |
| 478 |
Package:LISP The negative short-float closest in value to zero. |
| 479 |
|
| 480 |
-- Function: 1- (number) |
| 481 |
Package:LISP |
| 482 |
|
| 483 |
Returns NUMBER - 1. |
| 484 |
|
| 485 |
-- Function: <= (number &rest more-numbers) |
| 486 |
Package:LISP |
| 487 |
|
| 488 |
Returns T if arguments are in strictly non-decreasing order; NIL |
| 489 |
otherwise. |
| 490 |
|
| 491 |
-- Function: IMAGPART (number) |
| 492 |
Package:LISP |
| 493 |
|
| 494 |
Extracts the imaginary part of NUMBER. |
| 495 |
|
| 496 |
-- Function: INTEGERP (x) |
| 497 |
Package:LISP |
| 498 |
|
| 499 |
Returns T if X is an integer (fixnum or bignum); NIL otherwise. |
| 500 |
|
| 501 |
-- Function: ASH (integer count) |
| 502 |
Package:LISP |
| 503 |
|
| 504 |
Shifts INTEGER left by COUNT places. Shifts right if COUNT is |
| 505 |
negative. |
| 506 |
|
| 507 |
-- Function: LCM (integer &rest more-integers) |
| 508 |
Package:LISP |
| 509 |
|
| 510 |
Returns the least common multiple of the arguments. |
| 511 |
|
| 512 |
-- Function: COS (radians) |
| 513 |
Package:LISP |
| 514 |
|
| 515 |
Returns the cosine of RADIANS. |
| 516 |
|
| 517 |
-- Special Form: DECF |
| 518 |
Package:LISP |
| 519 |
|
| 520 |
Syntax: |
| 521 |
(decf place [delta]) |
| 522 |
Subtracts the number produced by DELTA (which defaults to 1) from |
| 523 |
the number in PLACE. |
| 524 |
|
| 525 |
-- Function: ATAN (x &optional (y 1)) |
| 526 |
Package:LISP Returns the arc tangent of X/Y. |
| 527 |
|
| 528 |
-- Constant: BOOLE-ANDC1 |
| 529 |
Package:LISP Makes BOOLE return LOGANDC1 of INTEGER1 and INTEGER2. |
| 530 |
|
| 531 |
-- Function: COSH (number) |
| 532 |
Package:LISP Returns the hyperbolic cosine of NUMBER. |
| 533 |
|
| 534 |
-- Function: FLOAT-RADIX (float) |
| 535 |
Package:LISP |
| 536 |
|
| 537 |
Returns the representation radix (or base) of the floating-point |
| 538 |
number. |
| 539 |
|
| 540 |
-- Function: ATANH (number) |
| 541 |
Package:LISP |
| 542 |
|
| 543 |
Returns the hyperbolic arc tangent of NUMBER. |
| 544 |
|
| 545 |
-- Function: EVENP (integer) |
| 546 |
Package:LISP Returns T if INTEGER is even. Returns NIL if INTEGER |
| 547 |
is odd. |
| 548 |
|
| 549 |
-- Function: ZEROP (number) |
| 550 |
Package:LISP Returns T if NUMBER = 0; NIL otherwise. |
| 551 |
|
| 552 |
-- Function: FLOATP (x) |
| 553 |
Package:LISP |
| 554 |
|
| 555 |
Returns T if X is a floating-point number; NIL otherwise. |
| 556 |
|
| 557 |
-- Function: SXHASH (object) |
| 558 |
Package:LISP |
| 559 |
|
| 560 |
Computes a hash code for OBJECT and returns it as an integer. |
| 561 |
|
| 562 |
-- Constant: BOOLE-1 |
| 563 |
Package:LISP Makes BOOLE return INTEGER1. |
| 564 |
|
| 565 |
-- Constant: MOST-POSITIVE-SINGLE-FLOAT |
| 566 |
Package:LISP Same as MOST-POSITIVE-LONG-FLOAT. |
| 567 |
|
| 568 |
-- Function: LOGANDC1 (integer1 integer2) |
| 569 |
Package:LISP |
| 570 |
|
| 571 |
Returns the logical AND of (LOGNOT INTEGER1) and INTEGER2. |
| 572 |
|
| 573 |
-- Constant: LEAST-POSITIVE-SINGLE-FLOAT |
| 574 |
Package:LISP Same as LEAST-POSITIVE-LONG-FLOAT. |
| 575 |
|
| 576 |
-- Function: COMPLEXP (x) |
| 577 |
Package:LISP |
| 578 |
|
| 579 |
Returns T if X is a complex number; NIL otherwise. |
| 580 |
|
| 581 |
-- Constant: BOOLE-AND |
| 582 |
Package:LISP Makes BOOLE return LOGAND of INTEGER1 and INTEGER2. |
| 583 |
|
| 584 |
-- Function: MAX (number &rest more-numbers) |
| 585 |
Package:LISP |
| 586 |
|
| 587 |
Returns the greatest of its arguments. |
| 588 |
|
| 589 |
-- Function: FLOAT-SIGN (float1 &optional (float2 (float 1 float1))) |
| 590 |
Package:LISP |
| 591 |
|
| 592 |
Returns a floating-point number with the same sign as FLOAT1 and |
| 593 |
with the same absolute value as FLOAT2. |
| 594 |
|
| 595 |
-- Constant: BOOLE-ANDC2 |
| 596 |
Package:LISP Makes BOOLE return LOGANDC2 of INTEGER1 and INTEGER2. |
| 597 |
|
| 598 |
-- Function: DENOMINATOR (rational) |
| 599 |
Package:LISP |
| 600 |
|
| 601 |
Returns the denominator of RATIONAL as an integer. |
| 602 |
|
| 603 |
-- Function: FLOAT (number &optional other) |
| 604 |
Package:LISP |
| 605 |
|
| 606 |
Converts a non-complex number to a floating-point number. If |
| 607 |
NUMBER is already a float, FLOAT simply returns NUMBER. Otherwise, |
| 608 |
the format of the returned float depends on OTHER; If OTHER is not |
| 609 |
provided, FLOAT returns a SINGLE-FLOAT. If OTHER is provided, the |
| 610 |
result is in the same float format as OTHER's. |
| 611 |
|
| 612 |
-- Function: ROUND (number &optional (divisor 1)) |
| 613 |
Package:LISP |
| 614 |
|
| 615 |
Rounds NUMBER/DIVISOR to nearest integer. The second returned |
| 616 |
value is the remainder. |
| 617 |
|
| 618 |
-- Function: LOGAND (&rest integers) |
| 619 |
Package:LISP |
| 620 |
|
| 621 |
Returns the bit-wise AND of its arguments. |
| 622 |
|
| 623 |
-- Constant: BOOLE-2 |
| 624 |
Package:LISP Makes BOOLE return INTEGER2. |
| 625 |
|
| 626 |
-- Function: * (&rest numbers) |
| 627 |
Package:LISP |
| 628 |
|
| 629 |
Returns the product of its arguments. With no args, returns 1. |
| 630 |
|
| 631 |
-- Function: < (number &rest more-numbers) |
| 632 |
Package:LISP |
| 633 |
|
| 634 |
Returns T if its arguments are in strictly increasing order; NIL |
| 635 |
otherwise. |
| 636 |
|
| 637 |
-- Function: COMPLEX (realpart &optional (imagpart 0)) |
| 638 |
Package:LISP |
| 639 |
|
| 640 |
Returns a complex number with the given real and imaginary parts. |
| 641 |
|
| 642 |
-- Constant: SINGLE-FLOAT-EPSILON |
| 643 |
Package:LISP Same as LONG-FLOAT-EPSILON. |
| 644 |
|
| 645 |
-- Function: LOGANDC2 (integer1 integer2) |
| 646 |
Package:LISP |
| 647 |
|
| 648 |
Returns the logical AND of INTEGER1 and (LOGNOT INTEGER2). |
| 649 |
|
| 650 |
-- Function: INTEGER-LENGTH (integer) |
| 651 |
Package:LISP |
| 652 |
|
| 653 |
Returns the number of significant bits in the absolute value of |
| 654 |
INTEGER. |
| 655 |
|
| 656 |
-- Constant: MOST-NEGATIVE-FIXNUM |
| 657 |
Package:LISP The fixnum closest in value to negative infinity. |
| 658 |
|
| 659 |
-- Constant: LONG-FLOAT-NEGATIVE-EPSILON |
| 660 |
Package:LISP The smallest positive long-float that satisfies (not |
| 661 |
(= (float 1 e) (- (float 1 e) e))). |
| 662 |
|
| 663 |
-- Function: >= (number &rest more-numbers) |
| 664 |
Package:LISP |
| 665 |
|
| 666 |
Returns T if arguments are in strictly non-increasing order; NIL |
| 667 |
otherwise. |
| 668 |
|
| 669 |
-- Constant: BOOLE-NOR |
| 670 |
Package:LISP Makes BOOLE return LOGNOR of INTEGER1 and INTEGER2. |
| 671 |
|
| 672 |
-- Function: ACOS (number) |
| 673 |
Package:LISP |
| 674 |
|
| 675 |
Returns the arc cosine of NUMBER. |
| 676 |
|
| 677 |
-- Function: MAKE-RANDOM-STATE (&optional (state *random-state*)) |
| 678 |
Package:LISP |
| 679 |
|
| 680 |
Creates and returns a copy of the specified random state. If STATE |
| 681 |
is NIL, then the value of *RANDOM-STATE* is used. If STATE is T, |
| 682 |
then returns a random state object generated from the universal |
| 683 |
time. |
| 684 |
|
| 685 |
-- Function: EXPT (base-number power-number) |
| 686 |
Package:LISP |
| 687 |
|
| 688 |
Returns BASE-NUMBER raised to the power POWER-NUMBER. |
| 689 |
|
| 690 |
-- Function: SQRT (number) |
| 691 |
Package:LISP |
| 692 |
|
| 693 |
Returns the principal square root of NUMBER. |
| 694 |
|
| 695 |
-- Function: SCALE-FLOAT (float integer) |
| 696 |
Package:LISP |
| 697 |
|
| 698 |
Returns (* FLOAT (expt (float-radix FLOAT) INTEGER)). |
| 699 |
|
| 700 |
-- Function: ACOSH (number) |
| 701 |
Package:LISP |
| 702 |
|
| 703 |
Returns the hyperbolic arc cosine of NUMBER. |
| 704 |
|
| 705 |
-- Constant: MOST-NEGATIVE-LONG-FLOAT |
| 706 |
Package:LISP The long-float closest in value to negative infinity. |
| 707 |
|
| 708 |
-- Constant: LEAST-NEGATIVE-LONG-FLOAT |
| 709 |
Package:LISP The negative long-float closest in value to zero. |
| 710 |
|
| 711 |
-- Function: FFLOOR (number &optional (divisor 1)) |
| 712 |
Package:LISP |
| 713 |
|
| 714 |
Same as FLOOR, but returns a float as the first value. |
| 715 |
|
| 716 |
-- Function: LOGNOR (integer1 integer2) |
| 717 |
Package:LISP |
| 718 |
|
| 719 |
Returns the complement of the logical OR of INTEGER1 and INTEGER2. |
| 720 |
|
| 721 |
-- Function: PARSE-INTEGER (string &key (start 0) (end (length string)) |
| 722 |
(radix 10) (junk-allowed nil)) |
| 723 |
Package:LISP |
| 724 |
|
| 725 |
Parses STRING for an integer and returns it. |
| 726 |
|
| 727 |
-- Function: + (&rest numbers) |
| 728 |
Package:LISP |
| 729 |
|
| 730 |
Returns the sum of its arguments. With no args, returns 0. |
| 731 |
|
| 732 |
-- Function: = (number &rest more-numbers) |
| 733 |
Package:LISP |
| 734 |
|
| 735 |
Returns T if all of its arguments are numerically equal; NIL |
| 736 |
otherwise. |
| 737 |
|
| 738 |
-- Function: NUMBERP (x) |
| 739 |
Package:LISP |
| 740 |
|
| 741 |
Returns T if X is any kind of number; NIL otherwise. |
| 742 |
|
| 743 |
-- Constant: MOST-POSITIVE-DOUBLE-FLOAT |
| 744 |
Package:LISP Same as MOST-POSITIVE-LONG-FLOAT. |
| 745 |
|
| 746 |
-- Function: LOGTEST (integer1 integer2) |
| 747 |
Package:LISP |
| 748 |
|
| 749 |
Returns T if LOGAND of INTEGER1 and INTEGER2 is not zero; NIL |
| 750 |
otherwise. |
| 751 |
|
| 752 |
-- Function: RANDOM-STATE-P (x) |
| 753 |
Package:LISP |
| 754 |
|
| 755 |
Returns T if X is a random-state object; NIL otherwise. |
| 756 |
|
| 757 |
-- Constant: LEAST-POSITIVE-DOUBLE-FLOAT |
| 758 |
Package:LISP Same as LEAST-POSITIVE-LONG-FLOAT. |
| 759 |
|
| 760 |
-- Function: FLOAT-PRECISION (float) |
| 761 |
Package:LISP |
| 762 |
|
| 763 |
Returns the number of significant radix-B digits used to represent |
| 764 |
the significand F of the floating-point number, where B = |
| 765 |
(FLOAT-RADIX FLOAT). |
| 766 |
|
| 767 |
-- Constant: BOOLE-XOR |
| 768 |
Package:LISP Makes BOOLE return LOGXOR of INTEGER1 and INTEGER2. |
| 769 |
|
| 770 |
-- Function: DPB (newbyte bytespec integer) |
| 771 |
Package:LISP |
| 772 |
|
| 773 |
Returns an integer computed by replacing the specified byte of |
| 774 |
INTEGER with NEWBYTE. |
| 775 |
|
| 776 |
-- Function: ABS (number) |
| 777 |
Package:LISP |
| 778 |
|
| 779 |
Returns the absolute value of NUMBER. |
| 780 |
|
| 781 |
-- Function: CONJUGATE (number) |
| 782 |
Package:LISP |
| 783 |
|
| 784 |
Returns the complex conjugate of NUMBER. |
| 785 |
|
| 786 |
-- Function: CIS (radians) |
| 787 |
Package:LISP |
| 788 |
|
| 789 |
Returns e raised to i*RADIANS. |
| 790 |
|
| 791 |
-- Function: ODDP (integer) |
| 792 |
Package:LISP |
| 793 |
|
| 794 |
Returns T if INTEGER is odd; NIL otherwise. |
| 795 |
|
| 796 |
-- Function: RATIONALIZE (number) |
| 797 |
Package:LISP |
| 798 |
|
| 799 |
Converts NUMBER into rational approximately and returns it. |
| 800 |
|
| 801 |
-- Function: ISQRT (integer) |
| 802 |
Package:LISP |
| 803 |
|
| 804 |
Returns the greatest integer less than or equal to the square root |
| 805 |
of the given non-negative integer. |
| 806 |
|
| 807 |
-- Function: LOGXOR (&rest integers) |
| 808 |
Package:LISP |
| 809 |
|
| 810 |
Returns the bit-wise EXCLUSIVE OR of its arguments. |
| 811 |
|
| 812 |
-- Function: > (number &rest more-numbers) |
| 813 |
Package:LISP |
| 814 |
|
| 815 |
Returns T if its arguments are in strictly decreasing order; NIL |
| 816 |
otherwise. |
| 817 |
|
| 818 |
-- Function: LOGBITP (index integer) |
| 819 |
Package:LISP |
| 820 |
|
| 821 |
Returns T if the INDEX-th bit of INTEGER is 1. |
| 822 |
|
| 823 |
-- Constant: DOUBLE-FLOAT-EPSILON |
| 824 |
Package:LISP Same as LONG-FLOAT-EPSILON. |
| 825 |
|
| 826 |
-- Function: LOGCOUNT (integer) |
| 827 |
Package:LISP |
| 828 |
|
| 829 |
If INTEGER is negative, returns the number of 0 bits. Otherwise, |
| 830 |
returns the number of 1 bits. |
| 831 |
|
| 832 |
-- Function: GCD (&rest integers) |
| 833 |
Package:LISP |
| 834 |
|
| 835 |
Returns the greatest common divisor of INTEGERs. |
| 836 |
|
| 837 |
-- Function: RATIONALP (x) |
| 838 |
Package:LISP |
| 839 |
|
| 840 |
Returns T if X is an integer or a ratio; NIL otherwise. |
| 841 |
|
| 842 |
-- Function: MOD (number divisor) |
| 843 |
Package:LISP |
| 844 |
|
| 845 |
Returns the second result of (FLOOR NUMBER DIVISOR). |
| 846 |
|
| 847 |
-- Function: MODF (number) |
| 848 |
Package:SYSTEM |
| 849 |
|
| 850 |
Returns the integer and fractional part of a floating point number |
| 851 |
mod 1.0. |
| 852 |
|
| 853 |
-- Constant: BOOLE-ORC1 |
| 854 |
Package:LISP Makes BOOLE return LOGORC1 of INTEGER1 and INTEGER2. |
| 855 |
|
| 856 |
-- Constant: SINGLE-FLOAT-NEGATIVE-EPSILON |
| 857 |
Package:LISP Same as LONG-FLOAT-NEGATIVE-EPSILON. |
| 858 |
|
| 859 |
-- Function: FLOOR (number &optional (divisor 1)) |
| 860 |
Package:LISP |
| 861 |
|
| 862 |
Returns the largest integer not larger than the NUMBER divided by |
| 863 |
DIVISOR. The second returned value is (- NUMBER (* first-value |
| 864 |
DIVISOR)). |
| 865 |
|
| 866 |
-- Function: PLUSP (number) |
| 867 |
Package:LISP |
| 868 |
|
| 869 |
Returns T if NUMBER > 0; NIL otherwise. |
| 870 |
|
| 871 |
-- Function: FLOAT-DIGITS (float) |
| 872 |
Package:LISP |
| 873 |
|
| 874 |
Returns the number of radix-B digits used to represent the |
| 875 |
significand F of the floating-point number, where B = (FLOAT-RADIX |
| 876 |
FLOAT). |
| 877 |
|
| 878 |
-- Function: RANDOM (number &optional (state *random-state*)) |
| 879 |
Package:LISP |
| 880 |
|
| 881 |
Generates a uniformly distributed pseudo-random number between zero |
| 882 |
(inclusive) and NUMBER (exclusive), by using the random state |
| 883 |
object STATE. |
| 884 |
|
| 885 |
|
| 886 |
File: gcl-si.info, Node: Sequences and Arrays and Hash Tables, Next: Characters, Prev: Numbers, Up: Top |
| 887 |
|
| 888 |
2 Sequences and Arrays and Hash Tables |
| 889 |
************************************** |
| 890 |
|
| 891 |
-- Function: VECTOR (&rest objects) |
| 892 |
Package:LISP |
| 893 |
|
| 894 |
Constructs a Simple-Vector from the given objects. |
| 895 |
|
| 896 |
-- Function: SUBSEQ (sequence start &optional (end (length sequence))) |
| 897 |
Package:LISP |
| 898 |
|
| 899 |
Returns a copy of a subsequence of SEQUENCE between START |
| 900 |
(inclusive) and END (exclusive). |
| 901 |
|
| 902 |
-- Function: COPY-SEQ (sequence) |
| 903 |
Package:LISP |
| 904 |
|
| 905 |
Returns a copy of SEQUENCE. |
| 906 |
|
| 907 |
-- Function: POSITION (item sequence &key (from-end nil) (test #'eql) |
| 908 |
test-not (start 0) (end (length sequence)) (key #'identity)) |
| 909 |
Package:LISP |
| 910 |
|
| 911 |
Returns the index of the first element in SEQUENCE that satisfies |
| 912 |
TEST with ITEM; NIL if no such element exists. |
| 913 |
|
| 914 |
-- Function: ARRAY-RANK (array) |
| 915 |
Package:LISP |
| 916 |
|
| 917 |
Returns the number of dimensions of ARRAY. |
| 918 |
|
| 919 |
-- Function: SBIT (simple-bit-array &rest subscripts) |
| 920 |
Package:LISP |
| 921 |
|
| 922 |
Returns the bit from SIMPLE-BIT-ARRAY at SUBSCRIPTS. |
| 923 |
|
| 924 |
-- Function: STRING-CAPITALIZE (string &key (start 0) (end (length |
| 925 |
string))) |
| 926 |
Package:LISP |
| 927 |
|
| 928 |
Returns a copy of STRING with the first character of each word |
| 929 |
converted to upper-case, and remaining characters in the word |
| 930 |
converted to lower case. |
| 931 |
|
| 932 |
-- Function: NSUBSTITUTE-IF-NOT (new test sequence &key (from-end nil) |
| 933 |
(start 0) (end (length sequence)) (count most-positive-fixnum) |
| 934 |
(key #'identity)) |
| 935 |
Package:LISP |
| 936 |
|
| 937 |
Returns a sequence of the same kind as SEQUENCE with the same |
| 938 |
elements |
| 939 |
|
| 940 |
except that all elements not satisfying TEST are replaced with |
| 941 |
NEWITEM. SEQUENCE may be destroyed. |
| 942 |
|
| 943 |
-- Function: FIND-IF (test sequence &key (from-end nil) (start 0) (end |
| 944 |
(length sequence)) (key #'identity)) |
| 945 |
Package:LISP |
| 946 |
|
| 947 |
Returns the index of the first element in SEQUENCE that satisfies |
| 948 |
TEST; NIL if no such element exists. |
| 949 |
|
| 950 |
-- Function: BIT-EQV (bit-array1 bit-array2 &optional (result-bit-array |
| 951 |
nil)) |
| 952 |
Package:LISP |
| 953 |
|
| 954 |
Performs a bit-wise logical EQV on the elements of BIT-ARRAY1 and |
| 955 |
BIT-ARRAY2. Puts the results into a new bit array if |
| 956 |
RESULT-BIT-ARRAY is NIL, into BIT-ARRAY1 if RESULT-BIT-ARRAY is T, |
| 957 |
or into RESULT-BIT-ARRAY otherwise. |
| 958 |
|
| 959 |
-- Function: STRING< (string1 string2 &key (start1 0) (end1 (length |
| 960 |
string1)) (start2 0) (end2 (length string2))) |
| 961 |
Package:LISP |
| 962 |
|
| 963 |
If STRING1 is lexicographically less than STRING2, then returns the |
| 964 |
longest common prefix of the strings. Otherwise, returns NIL. |
| 965 |
|
| 966 |
-- Function: REVERSE (sequence) |
| 967 |
Package:LISP |
| 968 |
|
| 969 |
Returns a new sequence containing the same elements as SEQUENCE but |
| 970 |
in reverse order. |
| 971 |
|
| 972 |
-- Function: NSTRING-UPCASE (string &key (start 0) (end (length |
| 973 |
string))) |
| 974 |
Package:LISP |
| 975 |
|
| 976 |
Returns STRING with all lower case characters converted to |
| 977 |
uppercase. |
| 978 |
|
| 979 |
-- Function: STRING>= (string1 string2 &key (start1 0) (end1 (length |
| 980 |
string1)) (start2 0) (end2 (length string2))) |
| 981 |
Package:LISP |
| 982 |
|
| 983 |
If STRING1 is lexicographically greater than or equal to STRING2, |
| 984 |
then returns the longest common prefix of the strings. Otherwise, |
| 985 |
returns NIL. |
| 986 |
|
| 987 |
-- Function: ARRAY-ROW-MAJOR-INDEX (array &rest subscripts) |
| 988 |
Package:LISP |
| 989 |
|
| 990 |
Returns the index into the data vector of ARRAY for the element of |
| 991 |
ARRAY specified by SUBSCRIPTS. |
| 992 |
|
| 993 |
-- Function: ARRAY-DIMENSION (array axis-number) |
| 994 |
Package:LISP |
| 995 |
|
| 996 |
Returns the length of AXIS-NUMBER of ARRAY. |
| 997 |
|
| 998 |
-- Function: FIND (item sequence &key (from-end nil) (test #'eql) |
| 999 |
test-not (start 0) (end (length sequence)) (key #'identity)) |
| 1000 |
Package:LISP |
| 1001 |
|
| 1002 |
Returns the first element in SEQUENCE satisfying TEST with ITEM; |
| 1003 |
NIL if no such element exists. |
| 1004 |
|
| 1005 |
-- Function: STRING-NOT-EQUAL (string1 string2 &key (start1 0) (end1 |
| 1006 |
(length string1)) (start2 0) (end2 (length string2))) |
| 1007 |
Package:LISP |
| 1008 |
|
| 1009 |
Similar to STRING=, but ignores cases. |
| 1010 |
|
| 1011 |
-- Function: STRING-RIGHT-TRIM (char-bag string) |
| 1012 |
Package:LISP |
| 1013 |
|
| 1014 |
Returns a copy of STRING with the characters in CHAR-BAG removed |
| 1015 |
from the right end. |
| 1016 |
|
| 1017 |
-- Function: DELETE-IF-NOT (test sequence &key (from-end nil) (start 0) |
| 1018 |
(end (length sequence)) (count most-positive-fixnum) (key |
| 1019 |
#'identity)) |
| 1020 |
Package:LISP |
| 1021 |
|
| 1022 |
Returns a sequence formed by destructively removing the elements |
| 1023 |
not satisfying TEST from SEQUENCE. |
| 1024 |
|
| 1025 |
-- Function: REMOVE-IF-NOT (test sequence &key (from-end nil) (start 0) |
| 1026 |
(end (length sequence)) (count most-positive-fixnum) (key |
| 1027 |
#'identity)) |
| 1028 |
Package:LISP |
| 1029 |
|
| 1030 |
Returns a copy of SEQUENCE with elements not satisfying TEST |
| 1031 |
removed. |
| 1032 |
|
| 1033 |
-- Function: STRING= (string1 string2 &key (start1 0) (end1 (length |
| 1034 |
string1)) (start2 0) (end2 (length string2))) |
| 1035 |
Package:LISP |
| 1036 |
|
| 1037 |
Returns T if the two strings are character-wise CHAR=; NIL |
| 1038 |
otherwise. |
| 1039 |
|
| 1040 |
-- Function: NSUBSTITUTE-IF (new test sequence &key (from-end nil) |
| 1041 |
(start 0) (end (length sequence)) (count most-positive-fixnum) |
| 1042 |
(key #'identity)) |
| 1043 |
Package:LISP |
| 1044 |
|
| 1045 |
Returns a sequence of the same kind as SEQUENCE with the same |
| 1046 |
elements except that all elements satisfying TEST are replaced with |
| 1047 |
NEWITEM. SEQUENCE may be destroyed. |
| 1048 |
|
| 1049 |
-- Function: SOME (predicate sequence &rest more-sequences) |
| 1050 |
Package:LISP |
| 1051 |
|
| 1052 |
Returns T if at least one of the elements in SEQUENCEs satisfies |
| 1053 |
PREDICATE; NIL otherwise. |
| 1054 |
|
| 1055 |
-- Function: MAKE-STRING (size &key (initial-element #\Space)) |
| 1056 |
Package:LISP |
| 1057 |
|
| 1058 |
Creates and returns a new string of SIZE length whose elements are |
| 1059 |
all INITIAL-ELEMENT. |
| 1060 |
|
| 1061 |
-- Function: NSUBSTITUTE (newitem olditem sequence &key (from-end nil) |
| 1062 |
(test #'eql) test-not (start 0) (end (length sequence)) (count |
| 1063 |
most-positive-fixnum) (key #'identity)) |
| 1064 |
Package:LISP |
| 1065 |
|
| 1066 |
Returns a sequence of the same kind as SEQUENCE with the same |
| 1067 |
elements except that OLDITEMs are replaced with NEWITEM. SEQUENCE |
| 1068 |
may be destroyed. |
| 1069 |
|
| 1070 |
-- Function: STRING-EQUAL (string1 string2 &key (start1 0) (end1 |
| 1071 |
(length string1)) (start2 0) (end2 (length string2))) |
| 1072 |
Package:LISP |
| 1073 |
|
| 1074 |
Given two strings (string1 and string2), and optional integers |
| 1075 |
start1, start2, end1 and end2, compares characters in string1 to |
| 1076 |
characters in string2 (using char-equal). |
| 1077 |
|
| 1078 |
-- Function: STRING-NOT-GREATERP (string1 string2 &key (start1 0) (end1 |
| 1079 |
(length string1)) (start2 0) (end2 (length string2))) |
| 1080 |
Package:LISP |
| 1081 |
|
| 1082 |
Similar to STRING<=, but ignores cases. |
| 1083 |
|
| 1084 |
-- Function: STRING> (string1 string2 &key (start1 0) (end1 (length |
| 1085 |
string1)) (start2 0) (end2 (length string2))) |
| 1086 |
Package:LISP |
| 1087 |
|
| 1088 |
If STRING1 is lexicographically greater than STRING2, then returns |
| 1089 |
the longest common prefix of the strings. Otherwise, returns NIL. |
| 1090 |
|
| 1091 |
-- Function: STRINGP (x) |
| 1092 |
Package:LISP |
| 1093 |
|
| 1094 |
Returns T if X is a string; NIL otherwise. |
| 1095 |
|
| 1096 |
-- Function: DELETE-IF (test sequence &key (from-end nil) (start 0) |
| 1097 |
(end (length sequence)) (count most-positive-fixnum) (key |
| 1098 |
#'identity)) |
| 1099 |
Package:LISP |
| 1100 |
|
| 1101 |
Returns a sequence formed by removing the elements satisfying TEST |
| 1102 |
destructively from SEQUENCE. |
| 1103 |
|
| 1104 |
-- Function: SIMPLE-STRING-P (x) |
| 1105 |
Package:LISP |
| 1106 |
|
| 1107 |
Returns T if X is a simple string; NIL otherwise. |
| 1108 |
|
| 1109 |
-- Function: REMOVE-IF (test sequence &key (from-end nil) (start 0) |
| 1110 |
(end (length sequence)) (count most-positive-fixnum) (key |
| 1111 |
#'identity)) |
| 1112 |
Package:LISP |
| 1113 |
|
| 1114 |
Returns a copy of SEQUENCE with elements satisfying TEST removed. |
| 1115 |
|
| 1116 |
-- Function: HASH-TABLE-COUNT (hash-table) |
| 1117 |
Package:LISP |
| 1118 |
|
| 1119 |
Returns the number of entries in the given Hash-Table. |
| 1120 |
|
| 1121 |
-- Function: ARRAY-DIMENSIONS (array) |
| 1122 |
Package:LISP |
| 1123 |
|
| 1124 |
Returns a list whose elements are the dimensions of ARRAY |
| 1125 |
|
| 1126 |
-- Function: SUBSTITUTE-IF-NOT (new test sequence &key (from-end nil) |
| 1127 |
(start 0) (end (length sequence)) (count most-positive-fixnum) |
| 1128 |
(key #'identity)) |
| 1129 |
Package:LISP |
| 1130 |
|
| 1131 |
Returns a sequence of the same kind as SEQUENCE with the same |
| 1132 |
elements except that all elements not satisfying TEST are replaced |
| 1133 |
with NEWITEM. |
| 1134 |
|
| 1135 |
-- Function: ADJUSTABLE-ARRAY-P (array) |
| 1136 |
Package:LISP |
| 1137 |
|
| 1138 |
Returns T if ARRAY is adjustable; NIL otherwise. |
| 1139 |
|
| 1140 |
-- Function: SVREF (simple-vector index) |
| 1141 |
Package:LISP |
| 1142 |
|
| 1143 |
Returns the INDEX-th element of SIMPLE-VECTOR. |
| 1144 |
|
| 1145 |
-- Function: VECTOR-PUSH-EXTEND (new-element vector &optional |
| 1146 |
(extension (length vector))) |
| 1147 |
Package:LISP |
| 1148 |
|
| 1149 |
Similar to VECTOR-PUSH except that, if the fill pointer gets too |
| 1150 |
large, extends VECTOR rather then simply returns NIL. |
| 1151 |
|
| 1152 |
-- Function: DELETE (item sequence &key (from-end nil) (test #'eql) |
| 1153 |
test-not (start 0) (end (length sequence)) (count |
| 1154 |
most-positive-fixnum) (key #'identity)) |
| 1155 |
Package:LISP |
| 1156 |
|
| 1157 |
Returns a sequence formed by removing the specified ITEM |
| 1158 |
destructively from SEQUENCE. |
| 1159 |
|
| 1160 |
-- Function: REMOVE (item sequence &key (from-end nil) (test #'eql) |
| 1161 |
test-not (start 0) (end (length sequence)) (count |
| 1162 |
most-positive-fixnum) (key #'identity)) |
| 1163 |
Package:LISP |
| 1164 |
|
| 1165 |
Returns a copy of SEQUENCE with ITEM removed. |
| 1166 |
|
| 1167 |
-- Function: STRING (x) |
| 1168 |
Package:LISP |
| 1169 |
|
| 1170 |
Coerces X into a string. If X is a string, then returns X itself. |
| 1171 |
If X is a symbol, then returns X's print name. If X is a |
| 1172 |
character, then returns a one element string containing that |
| 1173 |
character. Signals an error if X cannot be coerced into a string. |
| 1174 |
|
| 1175 |
-- Function: STRING-UPCASE (string &key (start 0) (end (length |
| 1176 |
string))) |
| 1177 |
Package:LISP |
| 1178 |
|
| 1179 |
Returns a copy of STRING with all lower case characters converted |
| 1180 |
to uppercase. |
| 1181 |
|
| 1182 |
-- Function: GETHASH (key hash-table &optional (default nil)) |
| 1183 |
Package:LISP |
| 1184 |
|
| 1185 |
Finds the entry in HASH-TABLE whose key is KEY and returns the |
| 1186 |
associated value and T, as multiple values. Returns DEFAULT and |
| 1187 |
NIL if there is no such entry. |
| 1188 |
|
| 1189 |
-- Function: MAKE-HASH-TABLE (&key (test 'eql) (size 1024) (rehash-size |
| 1190 |
1.5) (rehash-threshold 0.7)) |
| 1191 |
Package:LISP |
| 1192 |
|
| 1193 |
Creates and returns a hash table. |
| 1194 |
|
| 1195 |
-- Function: STRING/= (string1 string2 &key (start1 0) (end1 (length |
| 1196 |
string1)) (start2 0) (end2 (length string2))) |
| 1197 |
Package:LISP |
| 1198 |
|
| 1199 |
Returns NIL if STRING1 and STRING2 are character-wise CHAR=. |
| 1200 |
Otherwise, returns the index to the longest common prefix of the |
| 1201 |
strings. |
| 1202 |
|
| 1203 |
-- Function: STRING-GREATERP (string1 string2 &key (start1 0) (end1 |
| 1204 |
(length string1)) (start2 0) (end2 (length string2))) |
| 1205 |
Package:LISP |
| 1206 |
|
| 1207 |
Similar to STRING>, but ignores cases. |
| 1208 |
|
| 1209 |
-- Function: ELT (sequence index) |
| 1210 |
Package:LISP |
| 1211 |
|
| 1212 |
Returns the INDEX-th element of SEQUENCE. |
| 1213 |
|
| 1214 |
-- Function: MAKE-ARRAY (dimensions &key (element-type t) |
| 1215 |
initial-element (initial-contents nil) (adjustable nil) |
| 1216 |
(fill-pointer nil) (displaced-to nil) (displaced-index-offset |
| 1217 |
0) static) |
| 1218 |
Package:LISP |
| 1219 |
|
| 1220 |
Creates an array of the specified DIMENSIONS. The default for |
| 1221 |
INITIAL- ELEMENT depends on ELEMENT-TYPE. MAKE-ARRAY will always |
| 1222 |
try to find the 'best' array to accommodate the element-type |
| 1223 |
specified. For example on a SUN element-type (mod 1) -> bit |
| 1224 |
(integer 0 10) -> unsigned-char (integer -3 10) -> signed-char |
| 1225 |
si::best-array-element-type is the function doing this. It is also |
| 1226 |
used by the compiler, for coercing array element types. If you are |
| 1227 |
going to declare an array you should use the same element type as |
| 1228 |
was used in making it. eg (setq my-array (make-array 4 |
| 1229 |
:element-type '(integer 0 10))) (the (array (integer 0 10)) |
| 1230 |
my-array) When wanting to optimize references to an array you need |
| 1231 |
to declare the array eg: (the (array (integer -3 10)) my-array) if |
| 1232 |
ar were constructed using the (integer -3 10) element-type. You |
| 1233 |
could of course have used signed-char, but since the ranges may be |
| 1234 |
implementation dependent it is better to use -3 10 range. |
| 1235 |
MAKE-ARRAY needs to do some calculation with the element-type if |
| 1236 |
you don't provide a primitive data-type. One way of doing this in |
| 1237 |
a machine independent fashion: |
| 1238 |
|
| 1239 |
(defvar *my-elt-type* #. (array-element-type (make-array 1 |
| 1240 |
:element-type '(integer -3 10)))) |
| 1241 |
|
| 1242 |
Then calls to (make-array n :element-type *my-elt-type*) will not |
| 1243 |
have to go through a type inclusion computation. The keyword |
| 1244 |
STATIC (GCL specific) if non nil, will cause the array body to be |
| 1245 |
non relocatable. |
| 1246 |
|
| 1247 |
-- Function: NSTRING-DOWNCASE (string &key (start 0) (end (length |
| 1248 |
string))) |
| 1249 |
Package:LISP Returns STRING with all upper case characters |
| 1250 |
converted to lowercase. |
| 1251 |
|
| 1252 |
-- Function: ARRAY-IN-BOUNDS-P (array &rest subscripts) |
| 1253 |
Package:LISP Returns T if SUBSCRIPTS are valid subscripts for |
| 1254 |
ARRAY; NIL otherwise. |
| 1255 |
|
| 1256 |
-- Function: SORT (sequence predicate &key (key #'identity)) |
| 1257 |
Package:LISP Destructively sorts SEQUENCE. PREDICATE should return |
| 1258 |
non-NIL if its first argument is to precede its second argument. |
| 1259 |
|
| 1260 |
-- Function: HASH-TABLE-P (x) |
| 1261 |
Package:LISP |
| 1262 |
|
| 1263 |
Returns T if X is a hash table object; NIL otherwise. |
| 1264 |
|
| 1265 |
-- Function: COUNT-IF-NOT (test sequence &key (from-end nil) (start 0) |
| 1266 |
(end (length sequence)) (key #'identity)) |
| 1267 |
Package:LISP |
| 1268 |
|
| 1269 |
Returns the number of elements in SEQUENCE not satisfying TEST. |
| 1270 |
|
| 1271 |
-- Function: FILL-POINTER (vector) |
| 1272 |
Package:LISP |
| 1273 |
|
| 1274 |
Returns the fill pointer of VECTOR. |
| 1275 |
|
| 1276 |
-- Function: ARRAYP (x) |
| 1277 |
Package:LISP |
| 1278 |
|
| 1279 |
Returns T if X is an array; NIL otherwise. |
| 1280 |
|
| 1281 |
-- Function: REPLACE (sequence1 sequence2 &key (start1 0) (end1 (length |
| 1282 |
sequence1)) (start2 0) (end2 (length sequence2))) |
| 1283 |
Package:LISP |
| 1284 |
|
| 1285 |
Destructively modifies SEQUENCE1 by copying successive elements |
| 1286 |
into it from SEQUENCE2. |
| 1287 |
|
| 1288 |
-- Function: BIT-XOR (bit-array1 bit-array2 &optional (result-bit-array |
| 1289 |
nil)) |
| 1290 |
Package:LISP |
| 1291 |
|
| 1292 |
Performs a bit-wise logical XOR on the elements of BIT-ARRAY1 and |
| 1293 |
BIT-ARRAY2. Puts the results into a new bit array if |
| 1294 |
RESULT-BIT-ARRAY is NIL, into BIT-ARRAY1 if RESULT-BIT-ARRAY is T, |
| 1295 |
or into RESULT-BIT-ARRAY otherwise. |
| 1296 |
|
| 1297 |
-- Function: CLRHASH (hash-table) |
| 1298 |
Package:LISP |
| 1299 |
|
| 1300 |
Removes all entries of HASH-TABLE and returns the hash table |
| 1301 |
itself. |
| 1302 |
|
| 1303 |
-- Function: SUBSTITUTE-IF (newitem test sequence &key (from-end nil) |
| 1304 |
(start 0) (end (length sequence)) (count most-positive-fixnum) |
| 1305 |
(key #'identity)) |
| 1306 |
Package:LISP |
| 1307 |
|
| 1308 |
Returns a sequence of the same kind as SEQUENCE with the same |
| 1309 |
elements except that all elements satisfying TEST are replaced with |
| 1310 |
NEWITEM. |
| 1311 |
|
| 1312 |
-- Function: MISMATCH (sequence1 sequence2 &key (from-end nil) (test |
| 1313 |
#'eql) test-not (start1 0) (start2 0) (end1 (length |
| 1314 |
sequence1)) (end2 (length sequence2)) (key #'identity)) |
| 1315 |
Package:LISP |
| 1316 |
|
| 1317 |
The specified subsequences of SEQUENCE1 and SEQUENCE2 are compared |
| 1318 |
element-wise. If they are of equal length and match in every |
| 1319 |
element, the result is NIL. Otherwise, the result is a non-negative |
| 1320 |
integer, the index within SEQUENCE1 of the leftmost position at |
| 1321 |
which they fail to match; or, if one is shorter than and a matching |
| 1322 |
prefix of the other, the index within SEQUENCE1 beyond the last |
| 1323 |
position tested is returned. |
| 1324 |
|
| 1325 |
-- Constant: ARRAY-TOTAL-SIZE-LIMIT |
| 1326 |
Package:LISP The exclusive upper bound on the total number of |
| 1327 |
elements of an array. |
| 1328 |
|
| 1329 |
-- Function: VECTOR-POP (vector) |
| 1330 |
Package:LISP |
| 1331 |
|
| 1332 |
Attempts to decrease the fill-pointer of VECTOR by 1 and returns |
| 1333 |
the element pointed to by the new fill pointer. Signals an error |
| 1334 |
if the old value of the fill pointer is 0. |
| 1335 |
|
| 1336 |
-- Function: SUBSTITUTE (newitem olditem sequence &key (from-end nil) |
| 1337 |
(test #'eql) test-not (start 0) (end (length sequence)) (count |
| 1338 |
most-positive-fixnum) (key #'identity)) |
| 1339 |
Package:LISP |
| 1340 |
|
| 1341 |
Returns a sequence of the same kind as SEQUENCE with the same |
| 1342 |
elements except that OLDITEMs are replaced with NEWITEM. |
| 1343 |
|
| 1344 |
-- Function: ARRAY-HAS-FILL-POINTER-P (array) |
| 1345 |
Package:LISP |
| 1346 |
|
| 1347 |
Returns T if ARRAY has a fill pointer; NIL otherwise. |
| 1348 |
|
| 1349 |
-- Function: CONCATENATE (result-type &rest sequences) |
| 1350 |
Package:LISP |
| 1351 |
|
| 1352 |
Returns a new sequence of the specified RESULT-TYPE, consisting of |
| 1353 |
all elements in SEQUENCEs. |
| 1354 |
|
| 1355 |
-- Function: VECTOR-PUSH (new-element vector) |
| 1356 |
Package:LISP |
| 1357 |
|
| 1358 |
Attempts to set the element of ARRAY designated by its fill pointer |
| 1359 |
to NEW-ELEMENT and increments the fill pointer by one. Returns NIL |
| 1360 |
if the fill pointer is too large. Otherwise, returns the new fill |
| 1361 |
pointer value. |
| 1362 |
|
| 1363 |
-- Function: STRING-TRIM (char-bag string) |
| 1364 |
Package:LISP |
| 1365 |
|
| 1366 |
Returns a copy of STRING with the characters in CHAR-BAG removed |
| 1367 |
from both ends. |
| 1368 |
|
| 1369 |
-- Function: ARRAY-ELEMENT-TYPE (array) |
| 1370 |
Package:LISP |
| 1371 |
|
| 1372 |
Returns the type of the elements of ARRAY |
| 1373 |
|
| 1374 |
-- Function: NOTANY (predicate sequence &rest more-sequences) |
| 1375 |
Package:LISP |
| 1376 |
|
| 1377 |
Returns T if none of the elements in SEQUENCEs satisfies PREDICATE; |
| 1378 |
NIL otherwise. |
| 1379 |
|
| 1380 |
-- Function: BIT-NOT (bit-array &optional (result-bit-array nil)) |
| 1381 |
Package:LISP |
| 1382 |
|
| 1383 |
Performs a bit-wise logical NOT in the elements of BIT-ARRAY. Puts |
| 1384 |
the results into a new bit array if RESULT-BIT-ARRAY is NIL, into |
| 1385 |
BIT-ARRAY if RESULT-BIT-ARRAY is T, or into RESULT-BIT-ARRAY |
| 1386 |
otherwise. |
| 1387 |
|
| 1388 |
-- Function: BIT-ORC1 (bit-array1 bit-array2 &optional |
| 1389 |
(result-bit-array nil)) |
| 1390 |
Package:LISP |
| 1391 |
|
| 1392 |
Performs a bit-wise logical ORC1 on the elements of BIT-ARRAY1 and |
| 1393 |
BIT-ARRAY2. Puts the results into a new bit array if |
| 1394 |
RESULT-BIT-ARRAY is NIL, into BIT-ARRAY1 if RESULT-BIT-ARRAY is T, |
| 1395 |
or into RESULT-BIT-ARRAY otherwise. |
| 1396 |
|
| 1397 |
-- Function: COUNT-IF (test sequence &key (from-end nil) (start 0) (end |
| 1398 |
(length sequence)) (key #'identity)) |
| 1399 |
Package:LISP |
| 1400 |
|
| 1401 |
Returns the number of elements in SEQUENCE satisfying TEST. |
| 1402 |
|
| 1403 |
-- Function: MAP (result-type function sequence &rest more-sequences) |
| 1404 |
Package:LISP |
| 1405 |
|
| 1406 |
FUNCTION must take as many arguments as there are sequences |
| 1407 |
provided. The result is a sequence such that the i-th element is |
| 1408 |
the result of applying FUNCTION to the i-th elements of the |
| 1409 |
SEQUENCEs. |
| 1410 |
|
| 1411 |
-- Constant: ARRAY-RANK-LIMIT |
| 1412 |
Package:LISP The exclusive upper bound on the rank of an array. |
| 1413 |
|
| 1414 |
-- Function: COUNT (item sequence &key (from-end nil) (test #'eql) |
| 1415 |
test-not (start 0) (end (length sequence)) (key #'identity)) |
| 1416 |
Package:LISP |
| 1417 |
|
| 1418 |
Returns the number of elements in SEQUENCE satisfying TEST with |
| 1419 |
ITEM. |
| 1420 |
|
| 1421 |
-- Function: BIT-VECTOR-P (x) |
| 1422 |
Package:LISP |
| 1423 |
|
| 1424 |
Returns T if X is a bit vector; NIL otherwise. |
| 1425 |
|
| 1426 |
-- Function: NSTRING-CAPITALIZE (string &key (start 0) (end (length |
| 1427 |
string))) |
| 1428 |
Package:LISP |
| 1429 |
|
| 1430 |
Returns STRING with the first character of each word converted to |
| 1431 |
upper-case, and remaining characters in the word converted to lower |
| 1432 |
case. |
| 1433 |
|
| 1434 |
-- Function: ADJUST-ARRAY (array dimensions &key (element-type |
| 1435 |
(array-element-type array)) initial-element (initial-contents |
| 1436 |
nil) (fill-pointer nil) (displaced-to nil) |
| 1437 |
(displaced-index-offset 0)) |
| 1438 |
Package:LISP |
| 1439 |
|
| 1440 |
Adjusts the dimensions of ARRAY to the given DIMENSIONS. The |
| 1441 |
default value of INITIAL-ELEMENT depends on ELEMENT-TYPE. |
| 1442 |
|
| 1443 |
-- Function: SEARCH (sequence1 sequence2 &key (from-end nil) (test |
| 1444 |
#'eql) test-not (start1 0) (start2 0) (end1 (length |
| 1445 |
sequence1)) (end2 (length sequence2)) (key #'identity)) |
| 1446 |
Package:LISP |
| 1447 |
|
| 1448 |
A search is conducted for the first subsequence of SEQUENCE2 which |
| 1449 |
element-wise matches SEQUENCE1. If there is such a subsequence in |
| 1450 |
SEQUENCE2, the index of the its leftmost element is returned; |
| 1451 |
otherwise, NIL is returned. |
| 1452 |
|
| 1453 |
-- Function: SIMPLE-BIT-VECTOR-P (x) |
| 1454 |
Package:LISP |
| 1455 |
|
| 1456 |
Returns T if X is a simple bit-vector; NIL otherwise. |
| 1457 |
|
| 1458 |
-- Function: MAKE-SEQUENCE (type length &key initial-element) |
| 1459 |
Package:LISP |
| 1460 |
|
| 1461 |
Returns a sequence of the given TYPE and LENGTH, with elements |
| 1462 |
initialized to INITIAL-ELEMENT. The default value of |
| 1463 |
INITIAL-ELEMENT depends on TYPE. |
| 1464 |
|
| 1465 |
-- Function: BIT-ORC2 (bit-array1 bit-array2 &optional |
| 1466 |
(result-bit-array nil)) |
| 1467 |
Package:LISP |
| 1468 |
|
| 1469 |
Performs a bit-wise logical ORC2 on the elements of BIT-ARRAY1 and |
| 1470 |
BIT-ARRAY2. Puts the results into a new bit array if |
| 1471 |
RESULT-BIT-ARRAY is NIL, into BIT-ARRAY1 if RESULT-BIT-ARRAY is T, |
| 1472 |
or into RESULT-BIT-ARRAY otherwise. |
| 1473 |
|
| 1474 |
-- Function: NREVERSE (sequence) |
| 1475 |
Package:LISP |
| 1476 |
|
| 1477 |
Returns a sequence of the same elements as SEQUENCE but in reverse |
| 1478 |
order. SEQUENCE may be destroyed. |
| 1479 |
|
| 1480 |
-- Constant: ARRAY-DIMENSION-LIMIT |
| 1481 |
Package:LISP The exclusive upper bound of the array dimension. |
| 1482 |
|
| 1483 |
-- Function: NOTEVERY (predicate sequence &rest more-sequences) |
| 1484 |
Package:LISP |
| 1485 |
|
| 1486 |
Returns T if at least one of the elements in SEQUENCEs does not |
| 1487 |
satisfy PREDICATE; NIL otherwise. |
| 1488 |
|
| 1489 |
-- Function: POSITION-IF-NOT (test sequence &key (from-end nil) (start |
| 1490 |
0) (end (length sequence)) (key #'identity)) |
| 1491 |
Package:LISP |
| 1492 |
|
| 1493 |
Returns the index of the first element in SEQUENCE that does not |
| 1494 |
satisfy TEST; NIL if no such element exists. |
| 1495 |
|
| 1496 |
-- Function: STRING-DOWNCASE (string &key (start 0) (end (length |
| 1497 |
string))) |
| 1498 |
Package:LISP |
| 1499 |
|
| 1500 |
Returns a copy of STRING with all upper case characters converted |
| 1501 |
to lowercase. |
| 1502 |
|
| 1503 |
-- Function: BIT (bit-array &rest subscripts) |
| 1504 |
Package:LISP |
| 1505 |
|
| 1506 |
Returns the bit from BIT-ARRAY at SUBSCRIPTS. |
| 1507 |
|
| 1508 |
-- Function: STRING-NOT-LESSP (string1 string2 &key (start1 0) (end1 |
| 1509 |
(length string1)) (start2 0) (end2 (length string2))) |
| 1510 |
Package:LISP |
| 1511 |
|
| 1512 |
Similar to STRING>=, but ignores cases. |
| 1513 |
|
| 1514 |
-- Function: CHAR (string index) |
| 1515 |
Package:LISP |
| 1516 |
|
| 1517 |
Returns the INDEX-th character in STRING. |
| 1518 |
|
| 1519 |
-- Function: AREF (array &rest subscripts) |
| 1520 |
Package:LISP |
| 1521 |
|
| 1522 |
Returns the element of ARRAY specified by SUBSCRIPTS. |
| 1523 |
|
| 1524 |
-- Function: FILL (sequence item &key (start 0) (end (length |
| 1525 |
sequence))) |
| 1526 |
Package:LISP |
| 1527 |
|
| 1528 |
Replaces the specified elements of SEQUENCE all with ITEM. |
| 1529 |
|
| 1530 |
-- Function: STABLE-SORT (sequence predicate &key (key #'identity)) |
| 1531 |
Package:LISP |
| 1532 |
|
| 1533 |
Destructively sorts SEQUENCE. PREDICATE should return non-NIL if |
| 1534 |
its first argument is to precede its second argument. |
| 1535 |
|
| 1536 |
-- Function: BIT-IOR (bit-array1 bit-array2 &optional (result-bit-array |
| 1537 |
nil)) |
| 1538 |
Package:LISP |
| 1539 |
|
| 1540 |
Performs a bit-wise logical IOR on the elements of BIT-ARRAY1 and |
| 1541 |
BIT-ARRAY2. Puts the results into a new bit array if |
| 1542 |
RESULT-BIT-ARRAY is NIL, into BIT-ARRAY1 if RESULT-BIT-ARRAY is T, |
| 1543 |
or into RESULT-BIT-ARRAY otherwise. |
| 1544 |
|
| 1545 |
-- Function: REMHASH (key hash-table) |
| 1546 |
Package:LISP |
| 1547 |
|
| 1548 |
Removes any entry for KEY in HASH-TABLE. Returns T if such an entry |
| 1549 |
existed; NIL otherwise. |
| 1550 |
|
| 1551 |
-- Function: VECTORP (x) |
| 1552 |
Package:LISP |
| 1553 |
|
| 1554 |
Returns T if X is a vector; NIL otherwise. |
| 1555 |
|
| 1556 |
-- Function: STRING<= (string1 string2 &key (start1 0) (end1 (length |
| 1557 |
string1)) (start2 0) (end2 (length string2))) |
| 1558 |
Package:LISP |
| 1559 |
|
| 1560 |
If STRING1 is lexicographically less than or equal to STRING2, then |
| 1561 |
returns the longest common prefix of the two strings. Otherwise, |
| 1562 |
returns NIL. |
| 1563 |
|
| 1564 |
-- Function: SIMPLE-VECTOR-P (x) |
| 1565 |
Package:LISP |
| 1566 |
|
| 1567 |
Returns T if X is a simple vector; NIL otherwise. |
| 1568 |
|
| 1569 |
-- Function: STRING-LEFT-TRIM (char-bag string) |
| 1570 |
Package:LISP |
| 1571 |
|
| 1572 |
Returns a copy of STRING with the characters in CHAR-BAG removed |
| 1573 |
from the left end. |
| 1574 |
|
| 1575 |
-- Function: ARRAY-TOTAL-SIZE (array) |
| 1576 |
Package:LISP |
| 1577 |
|
| 1578 |
Returns the total number of elements of ARRAY. |
| 1579 |
|
| 1580 |
-- Function: FIND-IF-NOT (test sequence &key (from-end nil) (start 0) |
| 1581 |
(end (length sequence)) (key #'identity)) |
| 1582 |
Package:LISP |
| 1583 |
|
| 1584 |
Returns the index of the first element in SEQUENCE that does not |
| 1585 |
satisfy TEST; NIL if no such element exists. |
| 1586 |
|
| 1587 |
-- Function: DELETE-DUPLICATES (sequence &key (from-end nil) (test |
| 1588 |
#'eql) test-not (start 0) (end (length sequence)) (key |
| 1589 |
#'identity)) |
| 1590 |
Package:LISP |
| 1591 |
|
| 1592 |
Returns a sequence formed by removing duplicated elements |
| 1593 |
destructively from SEQUENCE. |
| 1594 |
|
| 1595 |
-- Function: REMOVE-DUPLICATES (sequence &key (from-end nil) (test |
| 1596 |
#'eql) test-not (start 0) (end (length sequence)) (key |
| 1597 |
#'identity)) |
| 1598 |
Package:LISP |
| 1599 |
|
| 1600 |
The elements of SEQUENCE are examined, and if any two match, one is |
| 1601 |
discarded. Returns the resulting sequence. |
| 1602 |
|
| 1603 |
-- Function: POSITION-IF (test sequence &key (from-end nil) (start 0) |
| 1604 |
(end (length sequence)) (key #'identity)) |
| 1605 |
Package:LISP |
| 1606 |
|
| 1607 |
Returns the index of the first element in SEQUENCE that satisfies |
| 1608 |
TEST; NIL if no such element exists. |
| 1609 |
|
| 1610 |
-- Function: MERGE (result-type sequence1 sequence2 predicate &key (key |
| 1611 |
#'identity)) |
| 1612 |
Package:LISP |
| 1613 |
|
| 1614 |
SEQUENCE1 and SEQUENCE2 are destructively merged into a sequence of |
| 1615 |
type RESULT-TYPE using PREDICATE to order the elements. |
| 1616 |
|
| 1617 |
-- Function: EVERY (predicate sequence &rest more-sequences) |
| 1618 |
Package:LISP |
| 1619 |
|
| 1620 |
Returns T if every elements of SEQUENCEs satisfy PREDICATE; NIL |
| 1621 |
otherwise. |
| 1622 |
|
| 1623 |
-- Function: REDUCE (function sequence &key (from-end nil) (start 0) |
| 1624 |
(end (length sequence)) initial-value) |
| 1625 |
Package:LISP |
| 1626 |
|
| 1627 |
Combines all the elements of SEQUENCE using a binary operation |
| 1628 |
FUNCTION. If INITIAL-VALUE is supplied, it is logically placed |
| 1629 |
before the SEQUENCE. |
| 1630 |
|
| 1631 |
-- Function: STRING-LESSP (string1 string2 &key (start1 0) (end1 |
| 1632 |
(length string1)) (start2 0) (end2 (length string2))) |
| 1633 |
Package:LISP |
| 1634 |
|
| 1635 |
Similar to STRING<, but ignores cases. |
| 1636 |
|
| 1637 |
|
| 1638 |
File: gcl-si.info, Node: Characters, Next: Lists, Prev: Sequences and Arrays and Hash Tables, Up: Top |
| 1639 |
|
| 1640 |
3 Characters |
| 1641 |
************ |
| 1642 |
|
| 1643 |
-- Function: NAME-CHAR (name) |
| 1644 |
Package:LISP |
| 1645 |
|
| 1646 |
Given an argument acceptable to string, Returns a character object |
| 1647 |
whose name is NAME if one exists. Returns NIL otherwise. NAME |
| 1648 |
must be an object that can be coerced to a string. |
| 1649 |
|
| 1650 |
-- Function: CHAR-NAME (char) |
| 1651 |
Package:LISP |
| 1652 |
|
| 1653 |
Returns the name for CHAR as a string; NIL if CHAR has no name. |
| 1654 |
Only #\Backspace, #\Tab, #\Newline (or #\Linefeed), #\Page, |
| 1655 |
#\Return, and #\Rubout have names. |
| 1656 |
|
| 1657 |
-- Function: BOTH-CASE-P (char) |
| 1658 |
Package:LISP |
| 1659 |
|
| 1660 |
Returns T if CHAR is an alphabetic character; NIL otherwise. |
| 1661 |
Equivalent to ALPHA-CHAR-P. |
| 1662 |
|
| 1663 |
-- Function: SCHAR (simple-string index) |
| 1664 |
Package:LISP |
| 1665 |
|
| 1666 |
Returns the character object representing the INDEX-th character in |
| 1667 |
STRING. This is faster than CHAR. |
| 1668 |
|
| 1669 |
-- Constant: CHAR-SUPER-BIT |
| 1670 |
Package:LISP The bit that indicates a super character. |
| 1671 |
|
| 1672 |
-- Constant: CHAR-FONT-LIMIT |
| 1673 |
Package:LISP The upper exclusive bound on values produced by |
| 1674 |
CHAR-FONT. |
| 1675 |
|
| 1676 |
-- Function: CHAR-DOWNCASE (char) |
| 1677 |
Package:LISP |
| 1678 |
|
| 1679 |
Returns the lower-case equivalent of CHAR, if any. If not, simply |
| 1680 |
returns CHAR. |
| 1681 |
|
| 1682 |
-- Function: STRING-CHAR-P (char) |
| 1683 |
Package:LISP |
| 1684 |
|
| 1685 |
Returns T if CHAR can be stored in a string. In GCL, this function |
| 1686 |
always returns T since any character in GCL can be stored in a |
| 1687 |
string. |
| 1688 |
|
| 1689 |
-- Function: CHAR-NOT-LESSP (char &rest more-chars) |
| 1690 |
Package:LISP |
| 1691 |
|
| 1692 |
Returns T if the codes of CHARs are in strictly non-increasing |
| 1693 |
order; NIL otherwise. For a lower-case character, the code of its |
| 1694 |
upper-case equivalent is used. |
| 1695 |
|
| 1696 |
-- Function: DISASSEMBLE (thing) |
| 1697 |
Package:LISP |
| 1698 |
|
| 1699 |
Compiles the form specified by THING and prints the intermediate C |
| 1700 |
language code for that form. But does NOT install the result of |
| 1701 |
compilation. If THING is a symbol that names a not-yet-compiled |
| 1702 |
function, the function definition is disassembled. If THING is a |
| 1703 |
lambda expression, it is disassembled as a function definition. |
| 1704 |
Otherwise, THING itself is disassembled as a top-level form. |
| 1705 |
|
| 1706 |
-- Function: LOWER-CASE-P (char) |
| 1707 |
Package:LISP |
| 1708 |
|
| 1709 |
Returns T if CHAR is a lower-case character; NIL otherwise. |
| 1710 |
|
| 1711 |
-- Function: CHAR<= (char &rest more-chars) |
| 1712 |
Package:LISP |
| 1713 |
|
| 1714 |
Returns T if the codes of CHARs are in strictly non-decreasing |
| 1715 |
order; NIL otherwise. |
| 1716 |
|
| 1717 |
-- Constant: CHAR-HYPER-BIT |
| 1718 |
Package:LISP The bit that indicates a hyper character. |
| 1719 |
|
| 1720 |
-- Function: CODE-CHAR (code &optional (bits 0) (font 0)) |
| 1721 |
Package:LISP |
| 1722 |
|
| 1723 |
Returns a character object with the specified code, if any. If |
| 1724 |
not, returns NIL. |
| 1725 |
|
| 1726 |
-- Function: CHAR-CODE (char) |
| 1727 |
Package:LISP |
| 1728 |
|
| 1729 |
Returns the code attribute of CHAR. |
| 1730 |
|
| 1731 |
-- Constant: CHAR-CONTROL-BIT |
| 1732 |
Package:LISP The bit that indicates a control character. |
| 1733 |
|
| 1734 |
-- Function: CHAR-LESSP (char &rest more-chars) |
| 1735 |
Package:LISP |
| 1736 |
|
| 1737 |
Returns T if the codes of CHARs are in strictly increasing order; |
| 1738 |
NIL otherwise. For a lower-case character, the code of its |
| 1739 |
upper-case equivalent is used. |
| 1740 |
|
| 1741 |
-- Function: CHAR-FONT (char) |
| 1742 |
Package:LISP |
| 1743 |
|
| 1744 |
Returns the font attribute of CHAR. |
| 1745 |
|
| 1746 |
-- Function: CHAR< (char &rest more-chars) |
| 1747 |
Package:LISP |
| 1748 |
|
| 1749 |
Returns T if the codes of CHARs are in strictly increasing order; |
| 1750 |
NIL otherwise. |
| 1751 |
|
| 1752 |
-- Function: CHAR>= (char &rest more-chars) |
| 1753 |
Package:LISP |
| 1754 |
|
| 1755 |
Returns T if the codes of CHARs are in strictly non-increasing |
| 1756 |
order; NIL otherwise. |
| 1757 |
|
| 1758 |
-- Constant: CHAR-META-BIT |
| 1759 |
Package:LISP The bit that indicates a meta character. |
| 1760 |
|
| 1761 |
-- Function: GRAPHIC-CHAR-P (char) |
| 1762 |
Package:LISP |
| 1763 |
|
| 1764 |
Returns T if CHAR is a printing character, i.e., #\Space through |
| 1765 |
#\~; NIL otherwise. |
| 1766 |
|
| 1767 |
-- Function: CHAR-NOT-EQUAL (char &rest more-chars) |
| 1768 |
Package:LISP |
| 1769 |
|
| 1770 |
Returns T if no two of CHARs are the same character; NIL otherwise. |
| 1771 |
Upper case character and its lower case equivalent are regarded the |
| 1772 |
same. |
| 1773 |
|
| 1774 |
-- Constant: CHAR-BITS-LIMIT |
| 1775 |
Package:LISP The upper exclusive bound on values produced by |
| 1776 |
CHAR-BITS. |
| 1777 |
|
| 1778 |
-- Function: CHARACTERP (x) |
| 1779 |
Package:LISP |
| 1780 |
|
| 1781 |
Returns T if X is a character; NIL otherwise. |
| 1782 |
|
| 1783 |
-- Function: CHAR= (char &rest more-chars) |
| 1784 |
Package:LISP |
| 1785 |
|
| 1786 |
Returns T if all CHARs are the same character; NIL otherwise. |
| 1787 |
|
| 1788 |
-- Function: ALPHA-CHAR-P (char) |
| 1789 |
Package:LISP |
| 1790 |
|
| 1791 |
Returns T if CHAR is an alphabetic character, A-Z or a-z; NIL |
| 1792 |
otherwise. |
| 1793 |
|
| 1794 |
-- Function: UPPER-CASE-P (char) |
| 1795 |
Package:LISP |
| 1796 |
|
| 1797 |
Returns T if CHAR is an upper-case character; NIL otherwise. |
| 1798 |
|
| 1799 |
-- Function: CHAR-BIT (char name) |
| 1800 |
Package:LISP |
| 1801 |
|
| 1802 |
Returns T if the named bit is on in the character CHAR; NIL |
| 1803 |
otherwise. In GCL, this function always returns NIL. |
| 1804 |
|
| 1805 |
-- Function: MAKE-CHAR (char &optional (bits 0) (font 0)) |
| 1806 |
Package:LISP |
| 1807 |
|
| 1808 |
Returns a character object with the same code attribute as CHAR and |
| 1809 |
with the specified BITS and FONT attributes. |
| 1810 |
|
| 1811 |
-- Function: CHARACTER (x) |
| 1812 |
Package:LISP |
| 1813 |
|
| 1814 |
Coerces X into a character object if possible. |
| 1815 |
|
| 1816 |
-- Function: CHAR-EQUAL (char &rest more-chars) |
| 1817 |
Package:LISP |
| 1818 |
|
| 1819 |
Returns T if all of its arguments are the same character; NIL |
| 1820 |
otherwise. Upper case character and its lower case equivalent are |
| 1821 |
regarded the same. |
| 1822 |
|
| 1823 |
-- Function: CHAR-NOT-GREATERP (char &rest more-chars) |
| 1824 |
Package:LISP |
| 1825 |
|
| 1826 |
Returns T if the codes of CHARs are in strictly non-decreasing |
| 1827 |
order; NIL otherwise. For a lower-case character, the code of its |
| 1828 |
upper-case equivalent is used. |
| 1829 |
|
| 1830 |
-- Function: CHAR> (char &rest more-chars) |
| 1831 |
Package:LISP |
| 1832 |
|
| 1833 |
Returns T if the codes of CHARs are in strictly decreasing order; |
| 1834 |
NIL otherwise. |
| 1835 |
|
| 1836 |
-- Function: STANDARD-CHAR-P (char) |
| 1837 |
Package:LISP |
| 1838 |
|
| 1839 |
Returns T if CHAR is a standard character, i.e., one of the 95 |
| 1840 |
ASCII printing characters #\Space to #\~ and #Newline; NIL |
| 1841 |
otherwise. |
| 1842 |
|
| 1843 |
-- Function: CHAR-UPCASE (char) |
| 1844 |
Package:LISP |
| 1845 |
|
| 1846 |
Returns the upper-case equivalent of CHAR, if any. If not, simply |
| 1847 |
returns CHAR. |
| 1848 |
|
| 1849 |
-- Function: DIGIT-CHAR-P (char &optional (radix 10)) |
| 1850 |
Package:LISP |
| 1851 |
|
| 1852 |
If CHAR represents a digit in RADIX, then returns the weight as an |
| 1853 |
integer. Otherwise, returns nil. |
| 1854 |
|
| 1855 |
-- Function: CHAR/= (char &rest more-chars) |
| 1856 |
Package:LISP |
| 1857 |
|
| 1858 |
Returns T if no two of CHARs are the same character; NIL otherwise. |
| 1859 |
|
| 1860 |
-- Function: CHAR-GREATERP (char &rest more-chars) |
| 1861 |
Package:LISP |
| 1862 |
|
| 1863 |
Returns T if the codes of CHARs are in strictly decreasing order; |
| 1864 |
NIL otherwise. For a lower-case character, the code of its |
| 1865 |
upper-case equivalent is used. |
| 1866 |
|
| 1867 |
-- Function: ALPHANUMERICP (char) |
| 1868 |
Package:LISP |
| 1869 |
|
| 1870 |
Returns T if CHAR is either numeric or alphabetic; NIL otherwise. |
| 1871 |
|
| 1872 |
-- Function: CHAR-BITS (char) |
| 1873 |
Package:LISP |
| 1874 |
|
| 1875 |
Returns the bits attribute (which is always 0 in GCL) of CHAR. |
| 1876 |
|
| 1877 |
-- Function: DIGIT-CHAR (digit &optional (radix 10) (font 0)) |
| 1878 |
Package:LISP |
| 1879 |
|
| 1880 |
Returns a character object that represents the DIGIT in the |
| 1881 |
specified RADIX. Returns NIL if no such character exists. |
| 1882 |
|
| 1883 |
-- Function: SET-CHAR-BIT (char name newvalue) |
| 1884 |
Package:LISP |
| 1885 |
|
| 1886 |
Returns a character just like CHAR except that the named bit is set |
| 1887 |
or cleared, according to whether NEWVALUE is non-NIL or NIL. This |
| 1888 |
function is useless in GCL. |
| 1889 |
|
| 1890 |
|
| 1891 |
File: gcl-si.info, Node: Lists, Next: Streams and Reading, Prev: Characters, Up: Top |
| 1892 |
|
| 1893 |
4 Lists |
| 1894 |
******* |
| 1895 |
|
| 1896 |
-- Function: NINTERSECTION (list1 list2 &key (test #'eql) test-not (key |
| 1897 |
#'identity)) |
| 1898 |
Package:LISP |
| 1899 |
|
| 1900 |
Returns the intersection of LIST1 and LIST2. LIST1 may be |
| 1901 |
destroyed. |
| 1902 |
|
| 1903 |
-- Function: RASSOC-IF (predicate alist) |
| 1904 |
Package:LISP |
| 1905 |
|
| 1906 |
Returns the first cons in ALIST whose cdr satisfies PREDICATE. |
| 1907 |
|
| 1908 |
-- Function: MAKE-LIST (size &key (initial-element nil)) |
| 1909 |
Package:LISP |
| 1910 |
|
| 1911 |
Creates and returns a list containing SIZE elements, each of which |
| 1912 |
is initialized to INITIAL-ELEMENT. |
| 1913 |
|
| 1914 |
-- Function: NTH (n list) |
| 1915 |
Package:LISP |
| 1916 |
|
| 1917 |
Returns the N-th element of LIST, where the car of LIST is the |
| 1918 |
zeroth element. |
| 1919 |
|
| 1920 |
-- Function: CAAR (x) |
| 1921 |
Package:LISP |
| 1922 |
|
| 1923 |
Equivalent to (CAR (CAR X)). |
| 1924 |
|
| 1925 |
-- Function: NULL (x) |
| 1926 |
Package:LISP |
| 1927 |
|
| 1928 |
Returns T if X is NIL; NIL otherwise. |
| 1929 |
|
| 1930 |
-- Function: FIFTH (x) |
| 1931 |
Package:LISP |
| 1932 |
|
| 1933 |
Equivalent to (CAR (CDDDDR X)). |
| 1934 |
|
| 1935 |
-- Function: NCONC (&rest lists) |
| 1936 |
Package:LISP |
| 1937 |
|
| 1938 |
Concatenates LISTs by destructively modifying them. |
| 1939 |
|
| 1940 |
-- Function: TAILP (sublist list) |
| 1941 |
Package:LISP |
| 1942 |
|
| 1943 |
Returns T if SUBLIST is one of the conses in LIST; NIL otherwise. |
| 1944 |
|
| 1945 |
-- Function: CONSP (x) |
| 1946 |
Package:LISP |
| 1947 |
|
| 1948 |
Returns T if X is a cons; NIL otherwise. |
| 1949 |
|
| 1950 |
-- Function: TENTH (x) |
| 1951 |
Package:LISP |
| 1952 |
|
| 1953 |
Equivalent to (CADR (CDDDDR (CDDDDR X))). |
| 1954 |
|
| 1955 |
-- Function: LISTP (x) |
| 1956 |
Package:LISP |
| 1957 |
|
| 1958 |
Returns T if X is either a cons or NIL; NIL otherwise. |
| 1959 |
|
| 1960 |
-- Function: MAPCAN (fun list &rest more-lists) |
| 1961 |
Package:LISP |
| 1962 |
|
| 1963 |
Applies FUN to successive cars of LISTs, NCONCs the results, and |
| 1964 |
returns it. |
| 1965 |
|
| 1966 |
-- Function: EIGHTH (x) |
| 1967 |
Package:LISP |
| 1968 |
|
| 1969 |
Equivalent to (CADDDR (CDDDDR X)). |
| 1970 |
|
| 1971 |
-- Function: LENGTH (sequence) |
| 1972 |
Package:LISP |
| 1973 |
|
| 1974 |
Returns the length of SEQUENCE. |
| 1975 |
|
| 1976 |
-- Function: RASSOC (item alist &key (test #'eql) test-not (key |
| 1977 |
#'identity)) |
| 1978 |
Package:LISP |
| 1979 |
|
| 1980 |
Returns the first cons in ALIST whose cdr is equal to ITEM. |
| 1981 |
|
| 1982 |
-- Function: NSUBST-IF-NOT (new test tree &key (key #'identity)) |
| 1983 |
Package:LISP |
| 1984 |
|
| 1985 |
Substitutes NEW for subtrees of TREE that do not satisfy TEST. |
| 1986 |
|
| 1987 |
-- Function: NBUTLAST (list &optional (n 1)) |
| 1988 |
Package:LISP |
| 1989 |
|
| 1990 |
Changes the cdr of the N+1 th cons from the end of the list LIST to |
| 1991 |
NIL. Returns the whole list. |
| 1992 |
|
| 1993 |
-- Function: CDR (list) |
| 1994 |
Package:LISP |
| 1995 |
|
| 1996 |
Returns the cdr of LIST. Returns NIL if LIST is NIL. |
| 1997 |
|
| 1998 |
-- Function: MAPC (fun list &rest more-lists) |
| 1999 |
Package:LISP |
| 2000 |
|
| 2001 |
Applies FUN to successive cars of LISTs. Returns the first LIST. |
| 2002 |
|
| 2003 |
-- Function: MAPL (fun list &rest more-lists) |
| 2004 |
Package:LISP |
| 2005 |
|
| 2006 |
Applies FUN to successive cdrs of LISTs. Returns the first LIST. |
| 2007 |
|
| 2008 |
-- Function: CONS (x y) |
| 2009 |
Package:LISP |
| 2010 |
|
| 2011 |
Returns a new cons whose car and cdr are X and Y, respectively. |
| 2012 |
|
| 2013 |
-- Function: LIST (&rest args) |
| 2014 |
Package:LISP |
| 2015 |
|
| 2016 |
Returns a list of its arguments |
| 2017 |
|
| 2018 |
-- Function: THIRD (x) |
| 2019 |
Package:LISP |
| 2020 |
|
| 2021 |
Equivalent to (CADDR X). |
| 2022 |
|
| 2023 |
-- Function: CDDAAR (x) |
| 2024 |
Package:LISP |
| 2025 |
|
| 2026 |
Equivalent to (CDR (CDR (CAR (CAR X)))). |
| 2027 |
|
| 2028 |
-- Function: CDADAR (x) |
| 2029 |
Package:LISP |
| 2030 |
|
| 2031 |
Equivalent to (CDR (CAR (CDR (CAR X)))). |
| 2032 |
|
| 2033 |
-- Function: CDAADR (x) |
| 2034 |
Package:LISP |
| 2035 |
|
| 2036 |
Equivalent to (CDR (CAR (CAR (CDR X)))). |
| 2037 |
|
| 2038 |
-- Function: CADDAR (x) |
| 2039 |
Package:LISP |
| 2040 |
|
| 2041 |
Equivalent to (CAR (CDR (CDR (CAR X)))). |
| 2042 |
|
| 2043 |
-- Function: CADADR (x) |
| 2044 |
Package:LISP |
| 2045 |
|
| 2046 |
Equivalent to (CAR (CDR (CAR (CDR X)))). |
| 2047 |
|
| 2048 |
-- Function: CAADDR (x) |
| 2049 |
Package:LISP |
| 2050 |
|
| 2051 |
Equivalent to (CAR (CAR (CDR (CDR X)))). |
| 2052 |
|
| 2053 |
-- Function: NTHCDR (n list) |
| 2054 |
Package:LISP |
| 2055 |
|
| 2056 |
Returns the result of performing the CDR operation N times on LIST. |
| 2057 |
|
| 2058 |
-- Function: PAIRLIS (keys data &optional (alist nil)) |
| 2059 |
Package:LISP |
| 2060 |
|
| 2061 |
Constructs an association list from KEYS and DATA adding to ALIST. |
| 2062 |
|
| 2063 |
-- Function: SEVENTH (x) |
| 2064 |
Package:LISP |
| 2065 |
|
| 2066 |
Equivalent to (CADDR (CDDDDR X)). |
| 2067 |
|
| 2068 |
-- Function: SUBSETP (list1 list2 &key (test #'eql) test-not (key |
| 2069 |
#'identity)) |
| 2070 |
Package:LISP |
| 2071 |
|
| 2072 |
Returns T if every element of LIST1 appears in LIST2; NIL |
| 2073 |
otherwise. |
| 2074 |
|
| 2075 |
-- Function: NSUBST-IF (new test tree &key (key #'identity)) |
| 2076 |
Package:LISP |
| 2077 |
|
| 2078 |
Substitutes NEW for subtrees of TREE that satisfy TEST. |
| 2079 |
|
| 2080 |
-- Function: COPY-LIST (list) |
| 2081 |
Package:LISP |
| 2082 |
|
| 2083 |
Returns a new copy of LIST. |
| 2084 |
|
| 2085 |
-- Function: LAST (list) |
| 2086 |
Package:LISP |
| 2087 |
|
| 2088 |
Returns the last cons in LIST |
| 2089 |
|
| 2090 |
-- Function: CAAAR (x) |
| 2091 |
Package:LISP |
| 2092 |
|
| 2093 |
Equivalent to (CAR (CAR (CAR X))). |
| 2094 |
|
| 2095 |
-- Function: LIST-LENGTH (list) |
| 2096 |
Package:LISP |
| 2097 |
|
| 2098 |
Returns the length of LIST, or NIL if LIST is circular. |
| 2099 |
|
| 2100 |
-- Function: CDDDR (x) |
| 2101 |
Package:LISP |
| 2102 |
|
| 2103 |
Equivalent to (CDR (CDR (CDR X))). |
| 2104 |
|
| 2105 |
-- Function: INTERSECTION (list1 list2 &key (test #'eql) test-not (key |
| 2106 |
#'identity)) |
| 2107 |
Package:LISP |
| 2108 |
|
| 2109 |
Returns the intersection of List1 and List2. |
| 2110 |
|
| 2111 |
-- Function: NSUBST (new old tree &key (test #'eql) test-not (key |
| 2112 |
#'identity)) |
| 2113 |
Package:LISP |
| 2114 |
|
| 2115 |
Substitutes NEW for subtrees in TREE that match OLD. |
| 2116 |
|
| 2117 |
-- Function: REVAPPEND (x y) |
| 2118 |
Package:LISP |
| 2119 |
|
| 2120 |
Equivalent to (APPEND (REVERSE X) Y) |
| 2121 |
|
| 2122 |
-- Function: CDAR (x) |
| 2123 |
Package:LISP |
| 2124 |
|
| 2125 |
Equivalent to (CDR (CAR X)). |
| 2126 |
|
| 2127 |
-- Function: CADR (x) |
| 2128 |
Package:LISP |
| 2129 |
|
| 2130 |
Equivalent to (CAR (CDR X)). |
| 2131 |
|
| 2132 |
-- Function: REST (x) |
| 2133 |
Package:LISP |
| 2134 |
|
| 2135 |
Equivalent to (CDR X). |
| 2136 |
|
| 2137 |
-- Function: NSET-EXCLUSIVE-OR (list1 list2 &key (test #'eql) test-not |
| 2138 |
(key #'identity)) |
| 2139 |
Package:LISP |
| 2140 |
|
| 2141 |
Returns a list with elements which appear but once in LIST1 and |
| 2142 |
LIST2. |
| 2143 |
|
| 2144 |
-- Function: ACONS (key datum alist) |
| 2145 |
Package:LISP |
| 2146 |
|
| 2147 |
Constructs a new alist by adding the pair (KEY . DATUM) to ALIST. |
| 2148 |
|
| 2149 |
-- Function: SUBST-IF-NOT (new test tree &key (key #'identity)) |
| 2150 |
Package:LISP |
| 2151 |
|
| 2152 |
Substitutes NEW for subtrees of TREE that do not satisfy TEST. |
| 2153 |
|
| 2154 |
-- Function: RPLACA (x y) |
| 2155 |
Package:LISP |
| 2156 |
|
| 2157 |
Replaces the car of X with Y, and returns the modified X. |
| 2158 |
|
| 2159 |
-- Function: SECOND (x) |
| 2160 |
Package:LISP |
| 2161 |
|
| 2162 |
Equivalent to (CADR X). |
| 2163 |
|
| 2164 |
-- Function: NUNION (list1 list2 &key (test #'eql) test-not (key |
| 2165 |
#'identity)) |
| 2166 |
Package:LISP |
| 2167 |
|
| 2168 |
Returns the union of LIST1 and LIST2. LIST1 and/or LIST2 may be |
| 2169 |
destroyed. |
| 2170 |
|
| 2171 |
-- Function: BUTLAST (list &optional (n 1)) |
| 2172 |
Package:LISP |
| 2173 |
|
| 2174 |
Creates and returns a list with the same elements as LIST but |
| 2175 |
without the last N elements. |
| 2176 |
|
| 2177 |
-- Function: COPY-ALIST (alist) |
| 2178 |
Package:LISP Returns a new copy of ALIST. |
| 2179 |
|
| 2180 |
-- Function: SIXTH (x) |
| 2181 |
Package:LISP Equivalent to (CADR (CDDDDR X)). |
| 2182 |
|
| 2183 |
-- Function: CAAAAR (x) |
| 2184 |
Package:LISP |
| 2185 |
|
| 2186 |
Equivalent to (CAR (CAR (CAR (CAR X)))). |
| 2187 |
|
| 2188 |
-- Function: CDDDAR (x) |
| 2189 |
Package:LISP |
| 2190 |
|
| 2191 |
Equivalent to (CDR (CDR (CDR (CAR X)))). |
| 2192 |
|
| 2193 |
-- Function: CDDADR (x) |
| 2194 |
Package:LISP |
| 2195 |
|
| 2196 |
Equivalent to (CDR (CDR (CAR (CDR X)))). |
| 2197 |
|
| 2198 |
-- Function: CDADDR (x) |
| 2199 |
Package:LISP |
| 2200 |
|
| 2201 |
Equivalent to (CDR (CAR (CDR (CDR X)))). |
| 2202 |
|
| 2203 |
-- Function: CADDDR (x) |
| 2204 |
Package:LISP |
| 2205 |
|
| 2206 |
Equivalent to (CAR (CDR (CDR (CDR X)))). |
| 2207 |
|
| 2208 |
-- Function: FOURTH (x) |
| 2209 |
Package:LISP |
| 2210 |
|
| 2211 |
Equivalent to (CADDDR X). |
| 2212 |
|
| 2213 |
-- Function: NSUBLIS (alist tree &key (test #'eql) test-not (key |
| 2214 |
#'identity)) |
| 2215 |
Package:LISP |
| 2216 |
|
| 2217 |
Substitutes from ALIST for subtrees of TREE. |
| 2218 |
|
| 2219 |
-- Function: SUBST-IF (new test tree &key (key #'identity)) |
| 2220 |
Package:LISP |
| 2221 |
|
| 2222 |
Substitutes NEW for subtrees of TREE that satisfy TEST. |
| 2223 |
|
| 2224 |
-- Function: NSET-DIFFERENCE (list1 list2 &key (test #'eql) test-not |
| 2225 |
(key #'identity)) |
| 2226 |
Package:LISP |
| 2227 |
|
| 2228 |
Returns a list of elements of LIST1 that do not appear in LIST2. |
| 2229 |
LIST1 may be destroyed. |
| 2230 |
|
| 2231 |
-- Special Form: POP |
| 2232 |
Package:LISP |
| 2233 |
|
| 2234 |
Syntax: |
| 2235 |
(pop place) |
| 2236 |
|
| 2237 |
Pops one item off the front of the list in PLACE and returns it. |
| 2238 |
|
| 2239 |
-- Special Form: PUSH |
| 2240 |
Package:LISP |
| 2241 |
|
| 2242 |
Syntax: |
| 2243 |
(push item place) |
| 2244 |
|
| 2245 |
Conses ITEM onto the list in PLACE, and returns the new list. |
| 2246 |
|
| 2247 |
-- Function: CDAAR (x) |
| 2248 |
Package:LISP |
| 2249 |
|
| 2250 |
Equivalent to (CDR (CAR (CAR X))). |
| 2251 |
|
| 2252 |
-- Function: CADAR (x) |
| 2253 |
Package:LISP |
| 2254 |
|
| 2255 |
Equivalent to (CAR (CDR (CAR X))). |
| 2256 |
|
| 2257 |
-- Function: CAADR (x) |
| 2258 |
Package:LISP |
| 2259 |
|
| 2260 |
Equivalent to (CAR (CAR (CDR X))). |
| 2261 |
|
| 2262 |
-- Function: FIRST (x) |
| 2263 |
Package:LISP |
| 2264 |
|
| 2265 |
Equivalent to (CAR X). |
| 2266 |
|
| 2267 |
-- Function: SUBST (new old tree &key (test #'eql) test-not (key |
| 2268 |
#'identity)) |
| 2269 |
Package:LISP |
| 2270 |
|
| 2271 |
Substitutes NEW for subtrees of TREE that match OLD. |
| 2272 |
|
| 2273 |
-- Function: ADJOIN (item list &key (test #'eql) test-not (key |
| 2274 |
#'identity)) |
| 2275 |
Package:LISP |
| 2276 |
|
| 2277 |
Adds ITEM to LIST unless ITEM is already a member of LIST. |
| 2278 |
|
| 2279 |
-- Function: MAPCON (fun list &rest more-lists) |
| 2280 |
Package:LISP |
| 2281 |
|
| 2282 |
Applies FUN to successive cdrs of LISTs, NCONCs the results, and |
| 2283 |
returns it. |
| 2284 |
|
| 2285 |
-- Macro: PUSHNEW |
| 2286 |
Package:LISP |
| 2287 |
|
| 2288 |
Syntax: |
| 2289 |
(pushnew item place {keyword value}*) |
| 2290 |
|
| 2291 |
If ITEM is already in the list stored in PLACE, does nothing. |
| 2292 |
Else, conses ITEM onto the list. Returns NIL. If no KEYWORDs are |
| 2293 |
supplied, each element in the list is compared with ITEM by EQL, |
| 2294 |
but the comparison can be controlled by supplying keywords :TEST, |
| 2295 |
:TEST-NOT, and/or :KEY. |
| 2296 |
|
| 2297 |
-- Function: SET-EXCLUSIVE-OR (list1 list2 &key (test #'eql) test-not |
| 2298 |
(key #'identity)) |
| 2299 |
Package:LISP |
| 2300 |
|
| 2301 |
Returns a list of elements appearing exactly once in LIST1 and |
| 2302 |
LIST2. |
| 2303 |
|
| 2304 |
-- Function: TREE-EQUAL (x y &key (test #'eql) test-not) |
| 2305 |
Package:LISP |
| 2306 |
|
| 2307 |
Returns T if X and Y are isomorphic trees with identical leaves. |
| 2308 |
|
| 2309 |
-- Function: CDDR (x) |
| 2310 |
Package:LISP |
| 2311 |
|
| 2312 |
Equivalent to (CDR (CDR X)). |
| 2313 |
|
| 2314 |
-- Function: GETF (place indicator &optional (default nil)) |
| 2315 |
Package:LISP |
| 2316 |
|
| 2317 |
Searches the property list stored in Place for an indicator EQ to |
| 2318 |
Indicator. If one is found, the corresponding value is returned, |
| 2319 |
else the Default is returned. |
| 2320 |
|
| 2321 |
-- Function: LDIFF (list sublist) |
| 2322 |
Package:LISP |
| 2323 |
|
| 2324 |
Returns a new list, whose elements are those of LIST that appear |
| 2325 |
before SUBLIST. If SUBLIST is not a tail of LIST, a copy of LIST is |
| 2326 |
returned. |
| 2327 |
|
| 2328 |
-- Function: UNION (list1 list2 &key (test #'eql) test-not (key |
| 2329 |
#'identity)) |
| 2330 |
Package:LISP |
| 2331 |
|
| 2332 |
Returns the union of LIST1 and LIST2. |
| 2333 |
|
| 2334 |
-- Function: ASSOC-IF-NOT (test alist) |
| 2335 |
Package:LISP |
| 2336 |
|
| 2337 |
Returns the first pair in ALIST whose car does not satisfy TEST. |
| 2338 |
|
| 2339 |
-- Function: RPLACD (x y) |
| 2340 |
Package:LISP |
| 2341 |
|
| 2342 |
Replaces the cdr of X with Y, and returns the modified X. |
| 2343 |
|
| 2344 |
-- Function: MEMBER-IF-NOT (test list &key (key #'identity)) |
| 2345 |
Package:LISP |
| 2346 |
|
| 2347 |
Returns the tail of LIST beginning with the first element not |
| 2348 |
satisfying TEST. |
| 2349 |
|
| 2350 |
-- Function: CAR (list) |
| 2351 |
Package:LISP |
| 2352 |
|
| 2353 |
Returns the car of LIST. Returns NIL if LIST is NIL. |
| 2354 |
|
| 2355 |
-- Function: ENDP (x) |
| 2356 |
Package:LISP |
| 2357 |
|
| 2358 |
Returns T if X is NIL. Returns NIL if X is a cons. Otherwise, |
| 2359 |
signals an error. |
| 2360 |
|
| 2361 |
-- Function: LIST* (arg &rest others) |
| 2362 |
Package:LISP |
| 2363 |
|
| 2364 |
Returns a list of its arguments with the last cons being a dotted |
| 2365 |
pair of the next to the last argument and the last argument. |
| 2366 |
|
| 2367 |
-- Function: NINTH (x) |
| 2368 |
Package:LISP |
| 2369 |
|
| 2370 |
Equivalent to (CAR (CDDDDR (CDDDDR X))). |
| 2371 |
|
| 2372 |
-- Function: CDAAAR (x) |
| 2373 |
Package:LISP |
| 2374 |
|
| 2375 |
Equivalent to (CDR (CAR (CAR (CAR X)))). |
| 2376 |
|
| 2377 |
-- Function: CADAAR (x) |
| 2378 |
Package:LISP |
| 2379 |
|
| 2380 |
Equivalent to (CAR (CDR (CAR (CAR X)))). |
| 2381 |
|
| 2382 |
-- Function: CAADAR (x) |
| 2383 |
Package:LISP |
| 2384 |
|
| 2385 |
Equivalent to (CAR (CAR (CDR (CAR X)))). |
| 2386 |
|
| 2387 |
-- Function: CAAADR (x) |
| 2388 |
Package:LISP |
| 2389 |
|
| 2390 |
Equivalent to (CAR (CAR (CAR (CDR X)))). |
| 2391 |
|
| 2392 |
-- Function: CDDDDR (x) |
| 2393 |
Package:LISP |
| 2394 |
|
| 2395 |
Equivalent to (CDR (CDR (CDR (CDR X)))). |
| 2396 |
|
| 2397 |
-- Function: SUBLIS (alist tree &key (test #'eql) test-not (key |
| 2398 |
#'identity)) |
| 2399 |
Package:LISP |
| 2400 |
|
| 2401 |
Substitutes from ALIST for subtrees of TREE nondestructively. |
| 2402 |
|
| 2403 |
-- Function: RASSOC-IF-NOT (predicate alist) |
| 2404 |
Package:LISP |
| 2405 |
|
| 2406 |
Returns the first cons in ALIST whose cdr does not satisfy |
| 2407 |
PREDICATE. |
| 2408 |
|
| 2409 |
-- Function: NRECONC (x y) |
| 2410 |
Package:LISP |
| 2411 |
|
| 2412 |
Equivalent to (NCONC (NREVERSE X) Y). |
| 2413 |
|
| 2414 |
-- Function: MAPLIST (fun list &rest more-lists) |
| 2415 |
Package:LISP |
| 2416 |
|
| 2417 |
Applies FUN to successive cdrs of LISTs and returns the results as |
| 2418 |
a list. |
| 2419 |
|
| 2420 |
-- Function: SET-DIFFERENCE (list1 list2 &key (test #'eql) test-not |
| 2421 |
(key #'identity)) |
| 2422 |
Package:LISP |
| 2423 |
|
| 2424 |
Returns a list of elements of LIST1 that do not appear in LIST2. |
| 2425 |
|
| 2426 |
-- Function: ASSOC-IF (test alist) |
| 2427 |
Package:LISP |
| 2428 |
|
| 2429 |
Returns the first pair in ALIST whose car satisfies TEST. |
| 2430 |
|
| 2431 |
-- Function: GET-PROPERTIES (place indicator-list) |
| 2432 |
Package:LISP |
| 2433 |
|
| 2434 |
Looks for the elements of INDICATOR-LIST in the property list |
| 2435 |
stored in PLACE. If found, returns the indicator, the value, and T |
| 2436 |
as multiple-values. If not, returns NILs as its three values. |
| 2437 |
|
| 2438 |
-- Function: MEMBER-IF (test list &key (key #'identity)) |
| 2439 |
Package:LISP |
| 2440 |
|
| 2441 |
Returns the tail of LIST beginning with the first element |
| 2442 |
satisfying TEST. |
| 2443 |
|
| 2444 |
-- Function: COPY-TREE (object) |
| 2445 |
Package:LISP |
| 2446 |
|
| 2447 |
Recursively copies conses in OBJECT and returns the result. |
| 2448 |
|
| 2449 |
-- Function: ATOM (x) |
| 2450 |
Package:LISP |
| 2451 |
|
| 2452 |
Returns T if X is not a cons; NIL otherwise. |
| 2453 |
|
| 2454 |
-- Function: CDDAR (x) |
| 2455 |
Package:LISP |
| 2456 |
|
| 2457 |
Equivalent to (CDR (CDR (CAR X))). |
| 2458 |
|
| 2459 |
-- Function: CDADR (x) |
| 2460 |
Package:LISP |
| 2461 |
|
| 2462 |
Equivalent to (CDR (CAR (CDR X))). |
| 2463 |
|
| 2464 |
-- Function: CADDR (x) |
| 2465 |
Package:LISP |
| 2466 |
|
| 2467 |
Equivalent to (CAR (CDR (CDR X))). |
| 2468 |
|
| 2469 |
-- Function: ASSOC (item alist &key (test #'eql) test-not) |
| 2470 |
Package:LISP |
| 2471 |
|
| 2472 |
Returns the first pair in ALIST whose car is equal (in the sense of |
| 2473 |
TEST) to ITEM. |
| 2474 |
|
| 2475 |
-- Function: APPEND (&rest lists) |
| 2476 |
Package:LISP |
| 2477 |
|
| 2478 |
Constructs a new list by concatenating its arguments. |
| 2479 |
|
| 2480 |
-- Function: MEMBER (item list &key (test #'eql) test-not (key |
| 2481 |
#'identity)) |
| 2482 |
Package:LISP |
| 2483 |
|
| 2484 |
Returns the tail of LIST beginning with the first ITEM. |
| 2485 |
|
| 2486 |
|
| 2487 |
File: gcl-si.info, Node: Streams and Reading, Next: Special Forms and Functions, Prev: Lists, Up: Top |
| 2488 |
|
| 2489 |
5 Streams and Reading |
| 2490 |
********************* |
| 2491 |
|
| 2492 |
-- Function: MAKE-ECHO-STREAM (input-stream output-stream) |
| 2493 |
Package:LISP |
| 2494 |
|
| 2495 |
Returns a bidirectional stream which gets its input from |
| 2496 |
INPUT-STREAM and sends its output to OUTPUT-STREAM. In addition, |
| 2497 |
all input is echoed to OUTPUT-STREAM. |
| 2498 |
|
| 2499 |
-- Variable: *READTABLE* |
| 2500 |
Package:LISP The current readtable. |
| 2501 |
|
| 2502 |
-- Function: LOAD (filename &key (verbose *load-verbose*) (print nil) |
| 2503 |
(if-does-not-exist :error)) |
| 2504 |
Package:LISP |
| 2505 |
|
| 2506 |
Loads the file named by FILENAME into GCL. |
| 2507 |
|
| 2508 |
-- Function: OPEN (filename &key (direction :input) (element-type |
| 2509 |
'string-char) (if-exists :error) (if-does-not-exist :error)) |
| 2510 |
Package:LISP |
| 2511 |
|
| 2512 |
Opens the file specified by FILENAME, which may be a string, a |
| 2513 |
pathname, or a stream. Returns a stream for the open file. |
| 2514 |
DIRECTION is :INPUT, :OUTPUT, :IO or :PROBE. ELEMENT-TYPE is |
| 2515 |
STRING-CHAR, (UNSIGNED-BYTE n), UNSIGNED-BYTE, (SIGNED-BYTE n), |
| 2516 |
SIGNED-BYTE, CHARACTER, BIT, (MOD n), or :DEFAULT. IF-EXISTS is |
| 2517 |
:ERROR, :NEW-VERSION, :RENAME, :RENAME-AND-DELETE, :OVERWRITE, |
| 2518 |
:APPEND, :SUPERSEDE, or NIL. IF-DOES-NOT-EXIST is :ERROR, :CREATE, |
| 2519 |
or NIL. |
| 2520 |
|
| 2521 |
If FILENAME begins with a vertical pipe sign: '|' then the |
| 2522 |
resulting stream is actually a one way pipe. It will be open for |
| 2523 |
reading or writing depending on the direction given. The rest of |
| 2524 |
FILENAME in this case is passed to the /bin/sh command. See the |
| 2525 |
posix description of popen for more details. |
| 2526 |
(setq pipe (open "| wc < /tmp/jim")) |
| 2527 |
(format t "File has ~%d lines" (read pipe)) |
| 2528 |
(close pipe) |
| 2529 |
|
| 2530 |
-- Variable: *PRINT-BASE* |
| 2531 |
Package:LISP The radix in which the GCL printer prints integers and |
| 2532 |
rationals. The value must be an integer from 2 to 36, inclusive. |
| 2533 |
|
| 2534 |
-- Function: MAKE-STRING-INPUT-STREAM (string &optional (start 0) (end |
| 2535 |
(length string))) |
| 2536 |
Package:LISP |
| 2537 |
|
| 2538 |
Returns an input stream which will supply the characters of String |
| 2539 |
between Start and End in order. |
| 2540 |
|
| 2541 |
-- Function: PPRINT (object &optional (stream *standard-output*)) |
| 2542 |
Package:LISP |
| 2543 |
|
| 2544 |
Pretty-prints OBJECT. Returns OBJECT. Equivalent to (WRITE :STREAM |
| 2545 |
STREAM :PRETTY T) The SI:PRETTY-PRINT-FORMAT property N (which must |
| 2546 |
be a non-negative integer) of a symbol SYMBOL controls the |
| 2547 |
pretty-printing of form (SYMBOL f1 ... fN fN+1 ... fM) in such a |
| 2548 |
way that the subforms fN+1, ..., fM are regarded as the 'body' of |
| 2549 |
the entire form. For instance, the property value of 2 is |
| 2550 |
initially given to the symbol DO. |
| 2551 |
|
| 2552 |
-- Variable: *READ-DEFAULT-FLOAT-FORMAT* |
| 2553 |
Package:LISP The floating-point format the GCL reader uses when |
| 2554 |
reading floating-point numbers that have no exponent marker or have |
| 2555 |
e or E for an exponent marker. Must be one of SHORT-FLOAT, |
| 2556 |
SINGLE-FLOAT, DOUBLE-FLOAT, and LONG-FLOAT. |
| 2557 |
|
| 2558 |
-- Function: READ-PRESERVING-WHITESPACE (&optional (stream |
| 2559 |
*standard-input*) (eof-error-p t) (eof-value nil) (recursive-p |
| 2560 |
nil)) |
| 2561 |
Package:LISP |
| 2562 |
|
| 2563 |
Reads an object from STREAM, preserving the whitespace that |
| 2564 |
followed the object. |
| 2565 |
|
| 2566 |
-- Function: STREAMP (x) |
| 2567 |
Package:LISP |
| 2568 |
|
| 2569 |
Returns T if X is a stream object; NIL otherwise. |
| 2570 |
|
| 2571 |
-- Function: SET-DISPATCH-MACRO-CHARACTER (disp-char sub-char function |
| 2572 |
&optional (readtable *readtable*)) |
| 2573 |
Package:LISP |
| 2574 |
|
| 2575 |
Causes FUNCTION to be called when the DISP-CHAR followed by |
| 2576 |
SUB-CHAR is read. |
| 2577 |
|
| 2578 |
-- Macro: WITH-OUTPUT-TO-STRING |
| 2579 |
Package:LISP |
| 2580 |
|
| 2581 |
Syntax: |
| 2582 |
(with-output-to-string (var [string]) {decl}* {form}*) |
| 2583 |
|
| 2584 |
Binds VAR to a string output stream that puts characters into |
| 2585 |
STRING, which defaults to a new string. The stream is |
| 2586 |
automatically closed on exit and the string is returned. |
| 2587 |
|
| 2588 |
-- Function: FILE-LENGTH (file-stream) |
| 2589 |
Package:LISP |
| 2590 |
|
| 2591 |
Returns the length of the specified file stream. |
| 2592 |
|
| 2593 |
-- Variable: *PRINT-CASE* |
| 2594 |
Package:LISP The case in which the GCL printer should print |
| 2595 |
ordinary symbols. The value must be one of the keywords :UPCASE, |
| 2596 |
:DOWNCASE, and :CAPITALIZE. |
| 2597 |
|
| 2598 |
-- Function: PRINT (object &optional (stream *standard-output*)) |
| 2599 |
Package:LISP |
| 2600 |
|
| 2601 |
Outputs a newline character, and then prints OBJECT in the mostly |
| 2602 |
readable representation. Returns OBJECT. Equivalent to (PROGN |
| 2603 |
(TERPRI STREAM) (WRITE OBJECT :STREAM STREAM :ESCAPE T)). |
| 2604 |
|
| 2605 |
-- Function: SET-MACRO-CHARACTER (char function &optional |
| 2606 |
(non-terminating-p nil) (readtable *readtable*)) |
| 2607 |
Package:LISP |
| 2608 |
|
| 2609 |
Causes CHAR to be a macro character that, when seen by READ, causes |
| 2610 |
FUNCTION to be called. |
| 2611 |
|
| 2612 |
-- Function: FORCE-OUTPUT (&optional (stream *standard-output*)) |
| 2613 |
Package:LISP |
| 2614 |
|
| 2615 |
Attempts to force any buffered output to be sent. |
| 2616 |
|
| 2617 |
-- Variable: *PRINT-ARRAY* |
| 2618 |
Package:LISP Whether the GCL printer should print array elements. |
| 2619 |
|
| 2620 |
-- Function: STREAM-ELEMENT-TYPE (stream) |
| 2621 |
Package:LISP |
| 2622 |
|
| 2623 |
Returns a type specifier for the kind of object returned by STREAM. |
| 2624 |
|
| 2625 |
-- Function: WRITE-BYTE (integer stream) |
| 2626 |
Package:LISP |
| 2627 |
|
| 2628 |
Outputs INTEGER to the binary stream STREAM. Returns INTEGER. |
| 2629 |
|
| 2630 |
-- Function: MAKE-CONCATENATED-STREAM (&rest streams) |
| 2631 |
Package:LISP |
| 2632 |
|
| 2633 |
Returns a stream which takes its input from each of the STREAMs in |
| 2634 |
turn, going on to the next at end of stream. |
| 2635 |
|
| 2636 |
-- Function: PRIN1 (object &optional (stream *standard-output*)) |
| 2637 |
Package:LISP |
| 2638 |
|
| 2639 |
Prints OBJECT in the mostly readable representation. Returns |
| 2640 |
OBJECT. Equivalent to (WRITE OBJECT :STREAM STREAM :ESCAPE T). |
| 2641 |
|
| 2642 |
-- Function: PRINC (object &optional (stream *standard-output*)) |
| 2643 |
Package:LISP |
| 2644 |
|
| 2645 |
Prints OBJECT without escape characters. Returns OBJECT. |
| 2646 |
Equivalent to (WRITE OBJECT :STREAM STREAM :ESCAPE NIL). |
| 2647 |
|
| 2648 |
-- Function: CLEAR-OUTPUT (&optional (stream *standard-output*)) |
| 2649 |
Package:LISP |
| 2650 |
|
| 2651 |
Clears the output stream STREAM. |
| 2652 |
|
| 2653 |
-- Function: TERPRI (&optional (stream *standard-output*)) |
| 2654 |
Package:LISP |
| 2655 |
|
| 2656 |
Outputs a newline character. |
| 2657 |
|
| 2658 |
-- Function: FINISH-OUTPUT (&optional (stream *standard-output*)) |
| 2659 |
Package:LISP |
| 2660 |
|
| 2661 |
Attempts to ensure that all output sent to STREAM has reached its |
| 2662 |
destination, and only then returns. |
| 2663 |
|
| 2664 |
-- Macro: WITH-OPEN-FILE |
| 2665 |
Package:LISP |
| 2666 |
|
| 2667 |
Syntax: |
| 2668 |
(with-open-file (stream filename {options}*) {decl}* {form}*) |
| 2669 |
|
| 2670 |
Opens the file whose name is FILENAME, using OPTIONs, and binds the |
| 2671 |
variable STREAM to a stream to/from the file. Then evaluates FORMs |
| 2672 |
as a PROGN. The file is automatically closed on exit. |
| 2673 |
|
| 2674 |
-- Special Form: DO |
| 2675 |
Package:LISP |
| 2676 |
|
| 2677 |
Syntax: |
| 2678 |
(do ({(var [init [step]])}*) (endtest {result}*) |
| 2679 |
{decl}* {tag | statement}*) |
| 2680 |
|
| 2681 |
Creates a NIL block, binds each VAR to the value of the |
| 2682 |
corresponding INIT, and then executes STATEMENTs repeatedly until |
| 2683 |
ENDTEST is satisfied. After each iteration, assigns to each VAR |
| 2684 |
the value of the corresponding STEP. When ENDTEST is satisfied, |
| 2685 |
evaluates RESULTs as a PROGN and returns the value(s) of the last |
| 2686 |
RESULT (or NIL if no RESULTs are supplied). Performs variable |
| 2687 |
bindings and assignments all at once, just like LET and PSETQ do. |
| 2688 |
|
| 2689 |
-- Function: READ-FROM-STRING (string &optional (eof-error-p t) |
| 2690 |
(eof-value nil) &key (start 0) (end (length string)) |
| 2691 |
(preserve-whitespace nil)) |
| 2692 |
Package:LISP |
| 2693 |
|
| 2694 |
Reads an object from STRING. |
| 2695 |
|
| 2696 |
-- Function: WRITE-STRING (string &optional (stream *standard-output*) |
| 2697 |
&key (start 0) (end (length string))) |
| 2698 |
Package:LISP |
| 2699 |
|
| 2700 |
Outputs STRING and returns it. |
| 2701 |
|
| 2702 |
-- Variable: *PRINT-LEVEL* |
| 2703 |
Package:LISP How many levels deep the GCL printer should print. |
| 2704 |
Unlimited if NIL. |
| 2705 |
|
| 2706 |
-- Variable: *PRINT-RADIX* |
| 2707 |
Package:LISP Whether the GCL printer should print the radix |
| 2708 |
indicator when printing integers and rationals. |
| 2709 |
|
| 2710 |
-- Function: Y-OR-N-P (&optional (format-string nil) &rest args) |
| 2711 |
Package:LISP |
| 2712 |
|
| 2713 |
Asks the user a question whose answer is either 'Y' or 'N'. If |
| 2714 |
FORMAT-STRING is non-NIL, then FRESH-LINE operation is performed, a |
| 2715 |
message is printed as if FORMAT-STRING and ARGs were given to |
| 2716 |
FORMAT, and then a prompt "(Y or N)" is printed. Otherwise, no |
| 2717 |
prompt will appear. |
| 2718 |
|
| 2719 |
-- Function: MAKE-BROADCAST-STREAM (&rest streams) |
| 2720 |
Package:LISP |
| 2721 |
|
| 2722 |
Returns an output stream which sends its output to all of the given |
| 2723 |
streams. |
| 2724 |
|
| 2725 |
-- Function: READ-CHAR (&optional (stream *standard-input*) |
| 2726 |
(eof-error-p t) (eof-value nil) (recursive-p nil)) |
| 2727 |
Package:LISP |
| 2728 |
|
| 2729 |
Reads a character from STREAM. |
| 2730 |
|
| 2731 |
-- Function: PEEK-CHAR (&optional (peek-type nil) (stream |
| 2732 |
*standard-input*) (eof-error-p t) (eof-value nil) (recursive-p |
| 2733 |
nil)) |
| 2734 |
Package:LISP |
| 2735 |
|
| 2736 |
Peeks at the next character in the input stream STREAM. |
| 2737 |
|
| 2738 |
-- Function: OUTPUT-STREAM-P (stream) |
| 2739 |
Package:LISP |
| 2740 |
|
| 2741 |
Returns non-nil if STREAM can handle output operations; NIL |
| 2742 |
otherwise. |
| 2743 |
|
| 2744 |
-- Variable: *QUERY-IO* |
| 2745 |
Package:LISP The query I/O stream. |
| 2746 |
|
| 2747 |
-- Variable: *READ-BASE* |
| 2748 |
Package:LISP The radix that the GCL reader reads numbers in. |
| 2749 |
|
| 2750 |
-- Macro: WITH-OPEN-STREAM |
| 2751 |
Package:LISP |
| 2752 |
|
| 2753 |
Syntax: |
| 2754 |
(with-open-stream (var stream) {decl}* {form}*) |
| 2755 |
|
| 2756 |
Evaluates FORMs as a PROGN with VAR bound to the value of STREAM. |
| 2757 |
The stream is automatically closed on exit. |
| 2758 |
|
| 2759 |
-- Macro: WITH-INPUT-FROM-STRING |
| 2760 |
Package:LISP |
| 2761 |
|
| 2762 |
Syntax: |
| 2763 |
(with-input-from-string (var string {keyword value}*) {decl}* |
| 2764 |
{form}*) |
| 2765 |
|
| 2766 |
Binds VAR to an input stream that returns characters from STRING |
| 2767 |
and evaluates the FORMs. The stream is automatically closed on |
| 2768 |
exit. Allowed keywords are :INDEX, :START, and :END. |
| 2769 |
|
| 2770 |
-- Function: CLEAR-INPUT (&optional (stream *standard-input*)) |
| 2771 |
Package:LISP Clears the input stream STREAM. |
| 2772 |
|
| 2773 |
-- Variable: *TERMINAL-IO* |
| 2774 |
Package:LISP The terminal I/O stream. |
| 2775 |
|
| 2776 |
-- Function: LISTEN (&optional (stream *standard-input*)) |
| 2777 |
Package:LISP |
| 2778 |
|
| 2779 |
Returns T if a character is available on STREAM; NIL otherwise. |
| 2780 |
This function does not correctly work in some versions of GCL |
| 2781 |
because of the lack of such mechanism in the underlying operating |
| 2782 |
system. |
| 2783 |
|
| 2784 |
-- Function: MAKE-PATHNAME (&key (defaults (parse-namestring "" |
| 2785 |
(pathname-host *default-pathname-defaults*))) (host |
| 2786 |
(pathname-host defaults)) (device (pathname-device defaults)) |
| 2787 |
(directory (pathname-directory defaults)) (name (pathname-name |
| 2788 |
defaults)) (type (pathname-type defaults)) (version |
| 2789 |
(pathname-version defaults))) |
| 2790 |
Package:LISP |
| 2791 |
|
| 2792 |
Create a pathname from HOST, DEVICE, DIRECTORY, NAME, TYPE and |
| 2793 |
VERSION. |
| 2794 |
|
| 2795 |
-- Function: PATHNAME-TYPE (pathname) |
| 2796 |
Package:LISP |
| 2797 |
|
| 2798 |
Returns the type slot of PATHNAME. |
| 2799 |
|
| 2800 |
-- Variable: *PRINT-GENSYM* |
| 2801 |
Package:LISP Whether the GCL printer should prefix symbols with no |
| 2802 |
home package with "#:". |
| 2803 |
|
| 2804 |
-- Function: READ-LINE (&optional (stream *standard-input*) |
| 2805 |
(eof-error-p t) (eof-value nil) (recursive-p nil)) |
| 2806 |
Package:LISP |
| 2807 |
|
| 2808 |
Returns a line of text read from STREAM as a string, discarding the |
| 2809 |
newline character. |
| 2810 |
|
| 2811 |
Note that when using line at a time input under unix, input forms |
| 2812 |
will always be followed by a #\newline. Thus if you do |
| 2813 |
|
| 2814 |
>(read-line) "" nil |
| 2815 |
|
| 2816 |
the empty string will be returned. After lisp reads the |
| 2817 |
(read-line) it then invokes (read-line). This happens before it |
| 2818 |
does anything else and so happens before the newline character |
| 2819 |
immediately following (read-line) has been read. Thus read-line |
| 2820 |
immediately encounters a #\newline and so returns the empty string. |
| 2821 |
If there had been other characters before the #\newline it would |
| 2822 |
have been different: |
| 2823 |
|
| 2824 |
>(read-line) how are you " how are you" nil |
| 2825 |
|
| 2826 |
If you want to throw away "" input, you can do that with the |
| 2827 |
following: |
| 2828 |
|
| 2829 |
(sloop::sloop while (equal (setq input (read-line)) "")) |
| 2830 |
|
| 2831 |
You may also want to use character at a time input, but that makes |
| 2832 |
input editing harder. nicolas% stty cbreak nicolas% gcl GCL (GNU |
| 2833 |
Common Lisp) Version(1.1.2) Mon Jan 9 12:58:22 MET 1995 Licensed |
| 2834 |
under GNU Public Library License Contains Enhancements by W. |
| 2835 |
Schelter |
| 2836 |
|
| 2837 |
>(let ((ifilename nil)) (format t "~%Input file name: ") (setq |
| 2838 |
ifilename (read-line))) Input file name: /tmp/myfile "/tmp/myfile" |
| 2839 |
|
| 2840 |
>(bye)Bye. |
| 2841 |
|
| 2842 |
-- Function: WRITE-TO-STRING (object &key (escape *print-escape*) |
| 2843 |
(radix *print-radix*) (base *print-base*) (circle |
| 2844 |
*print-circle*) (pretty *print-pretty*) (level *print-level*) |
| 2845 |
(length *print-length*) (case *print-case*) (array |
| 2846 |
*print-array*) (gensym *print-gensym*)) |
| 2847 |
Package:LISP |
| 2848 |
|
| 2849 |
Returns as a string the printed representation of OBJECT in the |
| 2850 |
specified mode. See the variable docs of *PRINT-...* for the mode. |
| 2851 |
|
| 2852 |
-- Function: PATHNAMEP (x) |
| 2853 |
Package:LISP |
| 2854 |
|
| 2855 |
Returns T if X is a pathname object; NIL otherwise. |
| 2856 |
|
| 2857 |
-- Function: READTABLEP (x) |
| 2858 |
Package:LISP |
| 2859 |
|
| 2860 |
Returns T if X is a readtable object; NIL otherwise. |
| 2861 |
|
| 2862 |
-- Function: READ (&optional (stream *standard-input*) (eof-error-p t) |
| 2863 |
(eof-value nil) (recursivep nil)) |
| 2864 |
Package:LISP |
| 2865 |
|
| 2866 |
Reads in the next object from STREAM. |
| 2867 |
|
| 2868 |
-- Function: NAMESTRING (pathname) |
| 2869 |
Package:LISP |
| 2870 |
|
| 2871 |
Returns the full form of PATHNAME as a string. |
| 2872 |
|
| 2873 |
-- Function: UNREAD-CHAR (character &optional (stream |
| 2874 |
*standard-input*)) |
| 2875 |
Package:LISP |
| 2876 |
|
| 2877 |
Puts CHARACTER back on the front of the input stream STREAM. |
| 2878 |
|
| 2879 |
-- Function: CLOSE (stream &key (abort nil)) |
| 2880 |
Package:LISP |
| 2881 |
|
| 2882 |
Closes STREAM. A non-NIL value of :ABORT indicates an abnormal |
| 2883 |
termination. |
| 2884 |
|
| 2885 |
-- Variable: *PRINT-LENGTH* |
| 2886 |
Package:LISP How many elements the GCL printer should print at each |
| 2887 |
level of nested data object. Unlimited if NIL. |
| 2888 |
|
| 2889 |
-- Function: SET-SYNTAX-FROM-CHAR (to-char from-char &optional |
| 2890 |
(to-readtable *readtable*) (from-readtable nil)) |
| 2891 |
Package:LISP |
| 2892 |
|
| 2893 |
Makes the syntax of TO-CHAR in TO-READTABLE be the same as the |
| 2894 |
syntax of FROM-CHAR in FROM-READTABLE. |
| 2895 |
|
| 2896 |
-- Function: INPUT-STREAM-P (stream) |
| 2897 |
Package:LISP |
| 2898 |
|
| 2899 |
Returns non-NIL if STREAM can handle input operations; NIL |
| 2900 |
otherwise. |
| 2901 |
|
| 2902 |
-- Function: PATHNAME (x) |
| 2903 |
Package:LISP |
| 2904 |
|
| 2905 |
Turns X into a pathname. X may be a string, symbol, stream, or |
| 2906 |
pathname. |
| 2907 |
|
| 2908 |
-- Function: FILE-NAMESTRING (pathname) |
| 2909 |
Package:LISP |
| 2910 |
|
| 2911 |
Returns the written representation of PATHNAME as a string. |
| 2912 |
|
| 2913 |
-- Function: MAKE-DISPATCH-MACRO-CHARACTER (char &optional |
| 2914 |
(non-terminating-p nil) (readtable *readtable*)) |
| 2915 |
Package:LISP |
| 2916 |
|
| 2917 |
Causes the character CHAR to be a dispatching macro character in |
| 2918 |
READTABLE. |
| 2919 |
|
| 2920 |
-- Variable: *STANDARD-OUTPUT* |
| 2921 |
Package:LISP The default output stream used by the GCL printer. |
| 2922 |
|
| 2923 |
-- Function: MAKE-TWO-WAY-STREAM (input-stream output-stream) |
| 2924 |
Package:LISP |
| 2925 |
|
| 2926 |
Returns a bidirectional stream which gets its input from |
| 2927 |
INPUT-STREAM and sends its output to OUTPUT-STREAM. |
| 2928 |
|
| 2929 |
-- Variable: *PRINT-ESCAPE* |
| 2930 |
Package:LISP Whether the GCL printer should put escape characters |
| 2931 |
whenever appropriate. |
| 2932 |
|
| 2933 |
-- Function: COPY-READTABLE (&optional (from-readtable *readtable*) |
| 2934 |
(to-readtable nil)) |
| 2935 |
Package:LISP |
| 2936 |
|
| 2937 |
Returns a copy of the readtable FROM-READTABLE. If TO-READTABLE is |
| 2938 |
non-NIL, then copies into TO-READTABLE. Otherwise, creates a new |
| 2939 |
readtable. |
| 2940 |
|
| 2941 |
-- Function: DIRECTORY-NAMESTRING (pathname) |
| 2942 |
Package:LISP |
| 2943 |
|
| 2944 |
Returns the directory part of PATHNAME as a string. |
| 2945 |
|
| 2946 |
-- Function: TRUENAME (pathname) |
| 2947 |
Package:LISP |
| 2948 |
|
| 2949 |
Returns the pathname for the actual file described by PATHNAME. |
| 2950 |
|
| 2951 |
-- Variable: *READ-SUPPRESS* |
| 2952 |
Package:LISP When the value of this variable is NIL, the GCL reader |
| 2953 |
operates normally. When it is non-NIL, then the reader parses |
| 2954 |
input characters but much of what is read is not interpreted. |
| 2955 |
|
| 2956 |
-- Function: GET-DISPATCH-MACRO-CHARACTER (disp-char sub-char &optional |
| 2957 |
(readtable *readtable*)) |
| 2958 |
Package:LISP |
| 2959 |
|
| 2960 |
Returns the macro-character function for SUB-CHAR under DISP-CHAR. |
| 2961 |
|
| 2962 |
-- Function: PATHNAME-DEVICE (pathname) |
| 2963 |
Package:LISP |
| 2964 |
|
| 2965 |
Returns the device slot of PATHNAME. |
| 2966 |
|
| 2967 |
-- Function: READ-CHAR-NO-HANG (&optional (stream *standard-input*) |
| 2968 |
(eof-error-p t) (eof-value nil) (recursive-p nil)) |
| 2969 |
Package:LISP |
| 2970 |
|
| 2971 |
Returns the next character from STREAM if one is available; NIL |
| 2972 |
otherwise. |
| 2973 |
|
| 2974 |
-- Function: FRESH-LINE (&optional (stream *standard-output*)) |
| 2975 |
Package:LISP |
| 2976 |
|
| 2977 |
Outputs a newline if it is not positioned at the beginning of a |
| 2978 |
line. Returns T if it output a newline; NIL otherwise. |
| 2979 |
|
| 2980 |
-- Function: WRITE-CHAR (char &optional (stream *standard-output*)) |
| 2981 |
Package:LISP |
| 2982 |
|
| 2983 |
Outputs CHAR and returns it. |
| 2984 |
|
| 2985 |
-- Function: PARSE-NAMESTRING (thing &optional host (defaults |
| 2986 |
*default-pathname-defaults*) &key (start 0) (end (length |
| 2987 |
thing)) (junk-allowed nil)) |
| 2988 |
Package:LISP |
| 2989 |
|
| 2990 |
Parses a string representation of a pathname into a pathname. HOST |
| 2991 |
is ignored. |
| 2992 |
|
| 2993 |
-- Function: PATHNAME-DIRECTORY (pathname) |
| 2994 |
Package:LISP |
| 2995 |
|
| 2996 |
Returns the directory slot of PATHNAME. |
| 2997 |
|
| 2998 |
-- Function: GET-MACRO-CHARACTER (char &optional (readtable |
| 2999 |
*readtable*)) |
| 3000 |
Package:LISP |
| 3001 |
|
| 3002 |
Returns the function associated with CHAR and, as a second value, |
| 3003 |
returns the non-terminating-p flag. |
| 3004 |
|
| 3005 |
-- Function: FORMAT (destination control-string &rest arguments) |
| 3006 |
Package:LISP |
| 3007 |
|
| 3008 |
Provides various facilities for formatting output. DESTINATION |
| 3009 |
controls where the result will go. If DESTINATION is T, then the |
| 3010 |
output is sent to the standard output stream. If it is NIL, then |
| 3011 |
the output is returned in a string as the value of the call. |
| 3012 |
Otherwise, DESTINATION must be a stream to which the output will be |
| 3013 |
sent. |
| 3014 |
|
| 3015 |
CONTROL-STRING is a string to be output, possibly with embedded |
| 3016 |
formatting directives, which are flagged with the escape character |
| 3017 |
"~". Directives generally expand into additional text to be |
| 3018 |
output, usually consuming one or more of ARGUMENTs in the process. |
| 3019 |
|
| 3020 |
A few useful directives are: |
| 3021 |
|
| 3022 |
~A, ~nA, ~n@A Prints one argument as if by PRINC |
| 3023 |
~S, ~nS, ~n@S Prints one argument as if by PRIN1 |
| 3024 |
~D, ~B, ~O, ~X Prints one integer in decimal, binary, octal, and hexa |
| 3025 |
~% Does TERPRI |
| 3026 |
~& Does FRESH-LINE |
| 3027 |
|
| 3028 |
where n is the minimal width of the field in which the object is |
| 3029 |
printed. ~nA and ~nS put padding spaces on the right; ~n@A and |
| 3030 |
~n@S put on the left. |
| 3031 |
|
| 3032 |
~R is for printing numbers in various formats. |
| 3033 |
|
| 3034 |
~nR prints arg in radix n. |
| 3035 |
~R prints arg as a cardinal english number: two |
| 3036 |
~:R prints arg as an ordinal english number: third |
| 3037 |
~@R prints arg as an a Roman Numeral: VII |
| 3038 |
~:@R prints arg as an old Roman Numeral: IIII |
| 3039 |
|
| 3040 |
~C prints a character. |
| 3041 |
~:C represents non printing characters by their pretty names,eg Space |
| 3042 |
~@C uses the #\ syntax to allow the reader to read it. |
| 3043 |
|
| 3044 |
~F prints a floating point number arg. |
| 3045 |
The full form is ~w,d,k,overflowchar,padcharF |
| 3046 |
w represents the total width of the printed representation (variable if |
| 3047 |
not present) |
| 3048 |
d the number of fractional digits to display |
| 3049 |
(format nil "~,2f" 10010.0314) --> "10010.03" |
| 3050 |
k arg is multiplied by 10^k before printing it as a decimal number. |
| 3051 |
overflowchar width w characters copies of the overflow character will |
| 3052 |
be printed. eg(format t "X>~5,2,,'?F<X" 100.034) --> X>?????<X |
| 3053 |
padchar is the character to pad with |
| 3054 |
(format t "X>~10,2,1,'?,'bF<X" 100.03417) -->X>bbb1000.34<X |
| 3055 |
@ makes + sign print if the arg is positive |
| 3056 |
|
| 3057 |
~@[print-if-true~] |
| 3058 |
if arg is not nil, then it is retained as an arg for further |
| 3059 |
printing, otherwise it is used up |
| 3060 |
|
| 3061 |
(format nil "~@[x = ~d~]~a" nil 'bil) --> "BIL" |
| 3062 |
(format nil "~@[x = ~d ~]~a" 8) --> "x = 8 BIL" |
| 3063 |
|
| 3064 |
-- Function: PATHNAME-NAME (pathname) |
| 3065 |
Package:LISP |
| 3066 |
|
| 3067 |
Returns the name slot of PATHNAME. |
| 3068 |
|
| 3069 |
-- Function: MAKE-STRING-OUTPUT-STREAM () |
| 3070 |
Package:LISP |
| 3071 |
|
| 3072 |
Returns an output stream which will accumulate all output given it |
| 3073 |
for the benefit of the function GET-OUTPUT-STREAM-STRING. |
| 3074 |
|
| 3075 |
-- Function: MAKE-SYNONYM-STREAM (symbol) |
| 3076 |
Package:LISP |
| 3077 |
|
| 3078 |
Returns a stream which performs its operations on the stream which |
| 3079 |
is the value of the dynamic variable named by SYMBOL. |
| 3080 |
|
| 3081 |
-- Variable: *LOAD-VERBOSE* |
| 3082 |
Package:LISP The default for the VERBOSE argument to LOAD. |
| 3083 |
|
| 3084 |
-- Variable: *PRINT-CIRCLE* |
| 3085 |
Package:LISP Whether the GCL printer should take care of circular |
| 3086 |
lists. |
| 3087 |
|
| 3088 |
-- Variable: *PRINT-PRETTY* |
| 3089 |
Package:LISP Whether the GCL printer should pretty-print. See the |
| 3090 |
function doc of PPRINT for more information about pretty-printing. |
| 3091 |
|
| 3092 |
-- Function: FILE-WRITE-DATE (file) |
| 3093 |
Package:LISP |
| 3094 |
|
| 3095 |
Returns the time at which the specified file is written, as an |
| 3096 |
integer in universal time format. FILE may be a string or a |
| 3097 |
stream. |
| 3098 |
|
| 3099 |
-- Function: PRIN1-TO-STRING (object) |
| 3100 |
Package:LISP |
| 3101 |
|
| 3102 |
Returns as a string the printed representation of OBJECT in the |
| 3103 |
mostly readable representation. Equivalent to (WRITE-TO-STRING |
| 3104 |
OBJECT :ESCAPE T). |
| 3105 |
|
| 3106 |
-- Function: MERGE-PATHNAMES (pathname &optional (defaults |
| 3107 |
*default-pathname-defaults*) default-version) |
| 3108 |
Package:LISP |
| 3109 |
|
| 3110 |
Fills in unspecified slots of PATHNAME from DEFAULTS. |
| 3111 |
DEFAULT-VERSION is ignored in GCL. |
| 3112 |
|
| 3113 |
-- Function: READ-BYTE (stream &optional (eof-error-p t) (eof-value |
| 3114 |
nil)) |
| 3115 |
Package:LISP |
| 3116 |
|
| 3117 |
Reads the next byte from STREAM. |
| 3118 |
|
| 3119 |
-- Function: PRINC-TO-STRING (object) |
| 3120 |
Package:LISP |
| 3121 |
|
| 3122 |
Returns as a string the printed representation of OBJECT without |
| 3123 |
escape characters. Equivalent to (WRITE-TO-STRING OBJECT :ESCAPE |
| 3124 |
NIL). |
| 3125 |
|
| 3126 |
-- Variable: *STANDARD-INPUT* |
| 3127 |
Package:LISP The default input stream used by the GCL reader. |
| 3128 |
|
| 3129 |
-- Function: PROBE-FILE (file) |
| 3130 |
Package:LISP |
| 3131 |
|
| 3132 |
Returns the truename of file if the file exists. Returns NIL |
| 3133 |
otherwise. |
| 3134 |
|
| 3135 |
-- Function: PATHNAME-VERSION (pathname) |
| 3136 |
Package:LISP |
| 3137 |
|
| 3138 |
Returns the version slot of PATHNAME. |
| 3139 |
|
| 3140 |
-- Function: WRITE-LINE (string &optional (stream *standard-output*) |
| 3141 |
&key (start 0) (end (length string))) |
| 3142 |
Package:LISP |
| 3143 |
|
| 3144 |
Outputs STRING and then outputs a newline character. Returns |
| 3145 |
STRING. |
| 3146 |
|
| 3147 |
-- Function: WRITE (object &key (stream *standard-output*) (escape |
| 3148 |
*print-escape*) (radix *print-radix*) (base *print-base*) |
| 3149 |
(circle *print-circle*) (pretty *print-pretty*) (level |
| 3150 |
*print-level*) (length *print-length*) (case *print-case*) |
| 3151 |
(array *print-array*) (gensym *print-gensym*)) |
| 3152 |
Package:LISP |
| 3153 |
|
| 3154 |
Prints OBJECT in the specified mode. See the variable docs of |
| 3155 |
*PRINT-...* for the mode. |
| 3156 |
|
| 3157 |
-- Function: GET-OUTPUT-STREAM-STRING (stream) |
| 3158 |
Package:LISP |
| 3159 |
|
| 3160 |
Returns a string of all the characters sent to STREAM made by |
| 3161 |
MAKE-STRING-OUTPUT-STREAM since the last call to this function. |
| 3162 |
|
| 3163 |
-- Function: READ-DELIMITED-LIST (char &optional (stream |
| 3164 |
*standard-input*) (recursive-p nil)) |
| 3165 |
Package:LISP |
| 3166 |
|
| 3167 |
Reads objects from STREAM until the next character after an |
| 3168 |
object's representation is CHAR. Returns a list of the objects |
| 3169 |
read. |
| 3170 |
|
| 3171 |
-- Function: READLINE-ON () |
| 3172 |
Package:SI |
| 3173 |
|
| 3174 |
Begins readline command editing mode when possible. In addition to |
| 3175 |
the basic readline editing features, command word completion is |
| 3176 |
implemented according to the following scheme: |
| 3177 |
|
| 3178 |
[[pkg]:[:]]txt |
| 3179 |
|
| 3180 |
pkg - an optional package specifier. Defaults to the current |
| 3181 |
package. The symbols in this package and those in the packages in |
| 3182 |
this package's use list will be searched. |
| 3183 |
|
| 3184 |
:[:] - an optional internal/external specifier. Defaults to |
| 3185 |
external. The keyword package is denoted by a single colon at the |
| 3186 |
beginning of the token. Only symbols of this type will be searched |
| 3187 |
for completion. |
| 3188 |
|
| 3189 |
txt - a string. Symbol names beginning with this string are |
| 3190 |
completed. The comparison is case insensitive. |
| 3191 |
|
| 3192 |
-- Function: READLINE-OFF () |
| 3193 |
Package:SI |
| 3194 |
|
| 3195 |
Disables readline command editing mode. |
| 3196 |
|
| 3197 |
-- Variable: *READLINE-PREFIX* |
| 3198 |
Package:SI |
| 3199 |
|
| 3200 |
A string implicitly prepended to input text for use in readline |
| 3201 |
command completion. If this string contains one or more colons, it |
| 3202 |
is used to specify the default package and internal/external |
| 3203 |
setting for searched symbols in the case that the supplied text |
| 3204 |
itself contains no explicit package specification. If this string |
| 3205 |
contains characters after the colon(s), or contains no colons at |
| 3206 |
all, it is treated as a symbol name prefix. In this case, the |
| 3207 |
prefix is matched first, then the supplied text, and the completion |
| 3208 |
returned is relative to the supplied text itself, i.e. contains no |
| 3209 |
prefix. For example, the setting "maxima::$" will complete input |
| 3210 |
text "int" according to the internal symbols in the maxima package |
| 3211 |
of the form "maxima::$int...", and return suggestions to the user |
| 3212 |
of the form "int...". |
| 3213 |
|
| 3214 |
|
| 3215 |
File: gcl-si.info, Node: Special Forms and Functions, Next: Compilation, Prev: Streams and Reading, Up: Top |
| 3216 |
|
| 3217 |
6 Special Forms and Functions |
| 3218 |
***************************** |
| 3219 |
|
| 3220 |
-- Constant: LAMBDA-LIST-KEYWORDS |
| 3221 |
Package:LISP List of all the lambda-list keywords used in GCL. |
| 3222 |
|
| 3223 |
-- Special Form: THE |
| 3224 |
Package:LISP |
| 3225 |
|
| 3226 |
Syntax: |
| 3227 |
(the value-type form) |
| 3228 |
|
| 3229 |
Declares that the value of FORM must be of VALUE-TYPE. Signals an |
| 3230 |
error if this is not the case. |
| 3231 |
|
| 3232 |
-- Special Form: SETF |
| 3233 |
Package:LISP |
| 3234 |
|
| 3235 |
Syntax: |
| 3236 |
(setf {place newvalue}*) |
| 3237 |
|
| 3238 |
Replaces the value in PLACE with the value of NEWVALUE, from left |
| 3239 |
to right. Returns the value of the last NEWVALUE. Each PLACE may |
| 3240 |
be any one of the following: |
| 3241 |
A symbol that names a variable. |
| 3242 |
A function call form whose first element is the name of the |
| 3243 |
following functions: |
| 3244 |
nth elt subseq rest first ... tenth |
| 3245 |
c?r c??r c???r c????r |
| 3246 |
aref svref char schar bit sbit fill-poiter |
| 3247 |
get getf documentation symbol-value symbol-function |
| 3248 |
symbol-plist macro-function gethash |
| 3249 |
char-bit ldb mask-field |
| 3250 |
apply |
| 3251 |
where '?' stands for either 'a' or 'd'. |
| 3252 |
the form (THE type place) with PLACE being a place recognized |
| 3253 |
by SETF. |
| 3254 |
a macro call which expands to a place recognized by SETF. |
| 3255 |
any form for which a DEFSETF or DEFINE-SETF-METHOD declaration |
| 3256 |
has been made. |
| 3257 |
|
| 3258 |
-- Special Form: WHEN |
| 3259 |
Package:LISP |
| 3260 |
|
| 3261 |
Syntax: |
| 3262 |
(when test {form}*) |
| 3263 |
|
| 3264 |
If TEST evaluates to non-NIL, then evaluates FORMs as a PROGN. If |
| 3265 |
not, simply returns NIL. |
| 3266 |
|
| 3267 |
-- Macro: CCASE |
| 3268 |
Package:LISP |
| 3269 |
|
| 3270 |
Syntax: |
| 3271 |
(ccase keyplace {({key | ({key}*)} {form}*)}*) |
| 3272 |
|
| 3273 |
Evaluates KEYPLACE and tries to find the KEY that is EQL to the |
| 3274 |
value of KEYPLACE. If one is found, then evaluates FORMs that |
| 3275 |
follow the KEY and returns the value(s) of the last FORM. If not, |
| 3276 |
signals a correctable error. |
| 3277 |
|
| 3278 |
-- Function: MACROEXPAND (form &optional (env nil)) |
| 3279 |
Package:LISP |
| 3280 |
|
| 3281 |
If FORM is a macro form, then expands it repeatedly until it is not |
| 3282 |
a macro any more. Returns two values: the expanded form and a |
| 3283 |
T-or-NIL flag indicating whether the original form was a macro. |
| 3284 |
|
| 3285 |
-- Special Form: MULTIPLE-VALUE-CALL |
| 3286 |
Package:LISP |
| 3287 |
|
| 3288 |
Syntax: |
| 3289 |
(multiple-value-call function {form}*) |
| 3290 |
|
| 3291 |
Calls FUNCTION with all the values of FORMs as arguments. |
| 3292 |
|
| 3293 |
-- Macro: DEFSETF |
| 3294 |
Package:LISP |
| 3295 |
|
| 3296 |
Syntax: |
| 3297 |
(defsetf access-fun {update-fun [doc] | |
| 3298 |
lambda-list (store-var) {decl | doc}* |
| 3299 |
{form}*) |
| 3300 |
|
| 3301 |
Defines how to SETF a generalized-variable reference of the form |
| 3302 |
(ACCESS-FUN ...). The doc-string DOC, if supplied, is saved as a |
| 3303 |
SETF doc and can be retrieved by (documentation 'NAME 'setf). |
| 3304 |
|
| 3305 |
(defsetf access-fun update-fun) defines an expansion from |
| 3306 |
(setf (ACCESS-FUN arg1 ... argn) value) to (UPDATE-FUN arg1 ... argn value). |
| 3307 |
|
| 3308 |
(defsetf access-fun lambda-list (store-var) . body) defines a macro which |
| 3309 |
expands |
| 3310 |
|
| 3311 |
(setf (ACCESS-FUN arg1 ... argn) value) into the form |
| 3312 |
(let* ((temp1 ARG1) ... (tempn ARGn) (temp0 value)) rest) |
| 3313 |
where REST is the value of BODY with parameters in LAMBDA-LIST |
| 3314 |
bound to the symbols TEMP1 ... TEMPn and with STORE-VAR bound to |
| 3315 |
the symbol TEMP0. |
| 3316 |
|
| 3317 |
-- Special Form: TAGBODY |
| 3318 |
Package:LISP |
| 3319 |
|
| 3320 |
Syntax: |
| 3321 |
(tagbody {tag | statement}*) |
| 3322 |
|
| 3323 |
Executes STATEMENTs and returns NIL if it falls off the end. |
| 3324 |
|
| 3325 |
-- Macro: ETYPECASE |
| 3326 |
Package:LISP |
| 3327 |
|
| 3328 |
Syntax: |
| 3329 |
(etypecase keyform {(type {form}*)}*) |
| 3330 |
|
| 3331 |
Evaluates KEYFORM and tries to find the TYPE in which the value of |
| 3332 |
KEYFORM belongs. If one is found, then evaluates FORMs that follow |
| 3333 |
the KEY and returns the value(s) of the last FORM. If not, signals |
| 3334 |
an error. |
| 3335 |
|
| 3336 |
-- Special Form: LET* |
| 3337 |
Package:LISP |
| 3338 |
|
| 3339 |
Syntax: |
| 3340 |
(let* ({var | (var [value])}*) {decl}* {form}*) |
| 3341 |
|
| 3342 |
Initializes VARs, binding them to the values of VALUEs (which |
| 3343 |
defaults to NIL) from left to right, then evaluates FORMs as a |
| 3344 |
PROGN. |
| 3345 |
|
| 3346 |
-- Special Form: PROG1 |
| 3347 |
Package:LISP |
| 3348 |
|
| 3349 |
Syntax: |
| 3350 |
(prog1 first {form}*) |
| 3351 |
|
| 3352 |
Evaluates FIRST and FORMs in order, and returns the (single) value |
| 3353 |
of FIRST. |
| 3354 |
|
| 3355 |
-- Special Form: DEFUN |
| 3356 |
Package:LISP |
| 3357 |
|
| 3358 |
Syntax: |
| 3359 |
(defun name lambda-list {decl | doc}* {form}*) |
| 3360 |
|
| 3361 |
Defines a function as the global function definition of the symbol |
| 3362 |
NAME. The complete syntax of a lambda-list is: ({var}* [&optional |
| 3363 |
{var | (var [initform [svar]])}*] [&rest var] [&key {var | ({var | |
| 3364 |
(keyword var)} [initform [svar]])}* [&allow-other-keys]] [&aux {var |
| 3365 |
| (var [initform])}*]) The doc-string DOC, if supplied, is saved as |
| 3366 |
a FUNCTION doc and can be retrieved by (documentation 'NAME |
| 3367 |
'function). |
| 3368 |
|
| 3369 |
-- Special Form: MULTIPLE-VALUE-BIND |
| 3370 |
Package:LISP |
| 3371 |
|
| 3372 |
Syntax: |
| 3373 |
(multiple-value-bind ({var}*) values-form {decl}* {form}*) |
| 3374 |
|
| 3375 |
Binds the VARiables to the results of VALUES-FORM, in order |
| 3376 |
(defaulting to NIL) and evaluates FORMs in order. |
| 3377 |
|
| 3378 |
-- Special Form: DECLARE |
| 3379 |
Package:LISP |
| 3380 |
|
| 3381 |
Syntax: |
| 3382 |
(declare {decl-spec}*) |
| 3383 |
|
| 3384 |
Gives a declaration. Possible DECL-SPECs are: (SPECIAL {var}*) |
| 3385 |
(TYPE type {var}*) where 'TYPE' is one of the following symbols |
| 3386 |
array fixnum package simple-bit-vector |
| 3387 |
atom float pathname simple-string |
| 3388 |
bignum function random-state simple-vector |
| 3389 |
bit hash-table ratio single-float |
| 3390 |
bit-vector integer rational standard-char |
| 3391 |
character keyword readtable stream |
| 3392 |
common list sequence string |
| 3393 |
compiled-function long-float short-float string-char |
| 3394 |
complex nil signed-byte symbol |
| 3395 |
cons null unsigned-byte t |
| 3396 |
double-float number simple-array vector |
| 3397 |
'TYPE' may also be a list containing one of the above symbols as |
| 3398 |
its first element and more specific information later in the list. |
| 3399 |
For example |
| 3400 |
(vector long-float 80) ; vector of 80 long-floats. |
| 3401 |
(array long-float *) ; array of long-floats |
| 3402 |
(array fixnum) ; array of fixnums |
| 3403 |
(array * 30) ; an array of length 30 but unspecified type |
| 3404 |
|
| 3405 |
A list of 1 element may be replaced by the symbol alone, and a list |
| 3406 |
ending in '*' may drop the the final '*'. |
| 3407 |
(OBJECT {var}*) |
| 3408 |
(FTYPE type {function-name}*) |
| 3409 |
eg: ;; function of two required args and optional args and one value: |
| 3410 |
(ftype (function (t t *) t) sort reduce) |
| 3411 |
;; function with 1 arg of general type returning 1 fixnum as value. |
| 3412 |
(ftype (function (t) fixnum) length) |
| 3413 |
(FUNCTION function-name ({arg-type}*) {return-type}*) |
| 3414 |
(INLINE {function-name}*) |
| 3415 |
(NOTINLINE {function-name}*) |
| 3416 |
(IGNORE {var}*) |
| 3417 |
(OPTIMIZE {({SPEED | SPACE | SAFETY | COMPILATION-SPEED} {0 | 1 | 2 | 3})}*) |
| 3418 |
(DECLARATION {non-standard-decl-name}*) |
| 3419 |
(:DYNAMIC-EXTENT {var}*) ;GCL-specific. |
| 3420 |
|
| 3421 |
-- Special Form: DEFMACRO |
| 3422 |
Package:LISP |
| 3423 |
|
| 3424 |
Syntax: |
| 3425 |
(defmacro name defmacro-lambda-list {decl | doc}* {form}*) |
| 3426 |
|
| 3427 |
Defines a macro as the global macro definition of the symbol NAME. |
| 3428 |
The complete syntax of a defmacro-lambda-list is: |
| 3429 |
|
| 3430 |
( [&whole var] [&environment var] {pseudo-var}* [&optional {var | |
| 3431 |
(pseudo-var [initform [pseudo-var]])}*] {[{&rest | &body} |
| 3432 |
pseudo-var] [&key {var | ({var | (keyword pseudo-var)} [initform |
| 3433 |
[pseudo-var]])}* [&allow-other-keys]] [&aux {var | (pseudo-var |
| 3434 |
[initform])}*] | . var}) |
| 3435 |
|
| 3436 |
where pseudo-var is either a symbol or a list of the following |
| 3437 |
form: |
| 3438 |
|
| 3439 |
( {pseudo-var}* [&optional {var | (pseudo-var [initform |
| 3440 |
[pseudo-var]])}*] {[{&rest | &body} pseudo-var] [&key {var | ({var |
| 3441 |
| (keyword pseudo-var)} [initform [pseudo-var]])}* [ |
| 3442 |
&allow-other-keys ] ] [&aux {var | (pseudo-var [initform])}*] | . |
| 3443 |
var}) |
| 3444 |
|
| 3445 |
As a special case, a non-NIL symbol is accepcted as a |
| 3446 |
defmacro-lambda-list: (DEFMACRO <name> <symbol> ...) is equivalent |
| 3447 |
to (DEFMACRO <name> (&REST <symbol>) ...). The doc-string DOC, if |
| 3448 |
supplied, is saved as a FUNCTION doc and can be retrieved by |
| 3449 |
(documentation 'NAME 'function). See the type doc of LIST for the |
| 3450 |
backquote macro useful for defining macros. Also, see the function |
| 3451 |
doc of PPRINT for the output-formatting. |
| 3452 |
|
| 3453 |
-- Variable: *EVALHOOK* |
| 3454 |
Package:LISP If *EVALHOOK* is not NIL, its value must be a function |
| 3455 |
that can receive two arguments: a form to evaluate and an |
| 3456 |
environment. This function does the evaluation instead of EVAL. |
| 3457 |
|
| 3458 |
-- Function: FUNCTIONP (x) |
| 3459 |
Package:LISP |
| 3460 |
|
| 3461 |
Returns T if X is a function, suitable for use by FUNCALL or APPLY. |
| 3462 |
Returns NIL otherwise. |
| 3463 |
|
| 3464 |
-- Constant: LAMBDA-PARAMETERS-LIMIT |
| 3465 |
Package:LISP The exclusive upper bound on the number of distinct |
| 3466 |
parameter names that may appear in a single lambda-list. Actually, |
| 3467 |
however, there is no such upper bound in GCL. |
| 3468 |
|
| 3469 |
-- Special Form: FLET |
| 3470 |
Package:LISP |
| 3471 |
|
| 3472 |
Syntax: |
| 3473 |
(flet ({(name lambda-list {decl | doc}* {form}*)}*) . body) |
| 3474 |
|
| 3475 |
Evaluates BODY as a PROGN, with local function definitions in |
| 3476 |
effect. BODY is the scope of each local function definition. |
| 3477 |
Since the scope does not include the function definitions |
| 3478 |
themselves, the local function can reference externally defined |
| 3479 |
functions of the same name. See the doc of DEFUN for the complete |
| 3480 |
syntax of a lambda-list. Doc-strings for local functions are |
| 3481 |
simply ignored. |
| 3482 |
|
| 3483 |
-- Macro: ECASE |
| 3484 |
Package:LISP |
| 3485 |
|
| 3486 |
Syntax: |
| 3487 |
(ecase keyform {({key | ({key}*)} {form}*)}*) |
| 3488 |
|
| 3489 |
Evaluates KEYFORM and tries to find the KEY that is EQL to the |
| 3490 |
value of KEYFORM. If one is found, then evaluates FORMs that follow |
| 3491 |
the KEY and returns the value(s) of the last FORM. If not, signals |
| 3492 |
an error. |
| 3493 |
|
| 3494 |
-- Special Form: PROG2 |
| 3495 |
Package:LISP |
| 3496 |
|
| 3497 |
Syntax: |
| 3498 |
(prog2 first second {forms}*) |
| 3499 |
|
| 3500 |
Evaluates FIRST, SECOND, and FORMs in order, and returns the |
| 3501 |
(single) value of SECOND. |
| 3502 |
|
| 3503 |
-- Special Form: PROGV |
| 3504 |
Package:LISP |
| 3505 |
|
| 3506 |
Syntax: |
| 3507 |
(progv symbols values {form}*) |
| 3508 |
|
| 3509 |
SYMBOLS must evaluate to a list of variables. VALUES must evaluate |
| 3510 |
to a list of initial values. Evaluates FORMs as a PROGN, with each |
| 3511 |
variable bound (as special) to the corresponding value. |
| 3512 |
|
| 3513 |
-- Special Form: QUOTE |
| 3514 |
Package:LISP |
| 3515 |
|
| 3516 |
Syntax: |
| 3517 |
(quote x) |
| 3518 |
or 'x Simply returns X without evaluating it. |
| 3519 |
|
| 3520 |
-- Special Form: DOTIMES |
| 3521 |
Package:LISP |
| 3522 |
|
| 3523 |
Syntax: |
| 3524 |
(dotimes (var countform [result]) {decl}* {tag | statement}*) |
| 3525 |
|
| 3526 |
Executes STATEMENTs, with VAR bound to each number between 0 |
| 3527 |
(inclusive) and the value of COUNTFORM (exclusive). Then returns |
| 3528 |
the value(s) of RESULT (which defaults to NIL). |
| 3529 |
|
| 3530 |
-- Function: SPECIAL-FORM-P (symbol) |
| 3531 |
Package:LISP |
| 3532 |
|
| 3533 |
Returns T if SYMBOL globally names a special form; NIL otherwise. |
| 3534 |
The special forms defined in Steele's manual are: |
| 3535 |
block if progv |
| 3536 |
catch labels quote |
| 3537 |
compiler-let let return-from |
| 3538 |
declare let* setq |
| 3539 |
eval-when macrolet tagbody |
| 3540 |
flet multiple-value-call the |
| 3541 |
function multiple-value-prog1 throw |
| 3542 |
go progn unwind-protect |
| 3543 |
|
| 3544 |
In addition, GCL implements the following macros as special forms, |
| 3545 |
though of course macro-expanding functions such as MACROEXPAND work |
| 3546 |
correctly for these macros. |
| 3547 |
|
| 3548 |
and incf prog1 |
| 3549 |
case locally prog2 |
| 3550 |
cond loop psetq |
| 3551 |
decf multiple-value-bind push |
| 3552 |
defmacro multiple-value-list return |
| 3553 |
defun multiple-value-set setf |
| 3554 |
do or unless |
| 3555 |
do* pop when |
| 3556 |
dolist prog |
| 3557 |
dotimes prog* |
| 3558 |
|
| 3559 |
-- Special Form: FUNCTION |
| 3560 |
Package:LISP |
| 3561 |
|
| 3562 |
Syntax: |
| 3563 |
(function x) |
| 3564 |
or #'x If X is a lambda expression, creates and returns a lexical |
| 3565 |
closure of X in the current lexical environment. If X is a symbol |
| 3566 |
that names a function, returns that function. |
| 3567 |
|
| 3568 |
-- Constant: MULTIPLE-VALUES-LIMIT |
| 3569 |
Package:LISP The exclusive upper bound on the number of values that |
| 3570 |
may be returned from a function. Actually, however, there is no |
| 3571 |
such upper bound in GCL. |
| 3572 |
|
| 3573 |
-- Function: APPLYHOOK (function args evalhookfn applyhookfn &optional |
| 3574 |
(env nil)) |
| 3575 |
Package:LISP |
| 3576 |
|
| 3577 |
Applies FUNCTION to ARGS, with *EVALHOOK* bound to EVALHOOKFN and |
| 3578 |
with *APPLYHOOK* bound to APPLYHOOKFN. Ignores the hook function |
| 3579 |
once, for the top-level application of FUNCTION to ARGS. |
| 3580 |
|
| 3581 |
-- Variable: *MACROEXPAND-HOOK* |
| 3582 |
Package:LISP Holds a function that can take two arguments (a macro |
| 3583 |
expansion function and the macro form to be expanded) and returns |
| 3584 |
the expanded form. This function is whenever a macro-expansion |
| 3585 |
takes place. Initially this is set to #'FUNCALL. |
| 3586 |
|
| 3587 |
-- Special Form: PROG* |
| 3588 |
Package:LISP |
| 3589 |
|
| 3590 |
Syntax: |
| 3591 |
(prog* ({var | (var [init])}*) {decl}* {tag | statement}*) |
| 3592 |
|
| 3593 |
Creates a NIL block, binds VARs sequentially, and then executes |
| 3594 |
STATEMENTs. |
| 3595 |
|
| 3596 |
-- Special Form: BLOCK |
| 3597 |
Package:LISP |
| 3598 |
|
| 3599 |
Syntax: |
| 3600 |
(block name {form}*) |
| 3601 |
|
| 3602 |
The FORMs are evaluated in order, but it is possible to exit the |
| 3603 |
block using (RETURN-FROM name value). The RETURN-FROM must be |
| 3604 |
lexically contained within the block. |
| 3605 |
|
| 3606 |
-- Special Form: PROGN |
| 3607 |
Package:LISP |
| 3608 |
|
| 3609 |
Syntax: |
| 3610 |
(progn {form}*) |
| 3611 |
|
| 3612 |
Evaluates FORMs in order, and returns whatever the last FORM |
| 3613 |
returns. |
| 3614 |
|
| 3615 |
-- Function: APPLY (function arg &rest more-args) |
| 3616 |
Package:LISP |
| 3617 |
|
| 3618 |
Applies FUNCTION. The arguments to the function consist of all ARGs |
| 3619 |
except for the last, and all elements of the last ARG. |
| 3620 |
|
| 3621 |
-- Special Form: LABELS |
| 3622 |
Package:LISP |
| 3623 |
|
| 3624 |
Syntax: |
| 3625 |
(labels ({(name lambda-list {decl | doc}* {form}*)}*) . body) |
| 3626 |
|
| 3627 |
Evaluates BODY as a PROGN, with the local function definitions in |
| 3628 |
effect. The scope of the locally defined functions include the |
| 3629 |
function definitions themselves, so their definitions may include |
| 3630 |
recursive references. See the doc of DEFUN for the complete syntax |
| 3631 |
of a lambda-list. Doc-strings for local functions are simply |
| 3632 |
ignored. |
| 3633 |
|
| 3634 |
-- Special Form: RETURN |
| 3635 |
Package:LISP |
| 3636 |
|
| 3637 |
Syntax: |
| 3638 |
(return [result]) |
| 3639 |
|
| 3640 |
Returns from the lexically surrounding NIL block. The value of |
| 3641 |
RESULT, which defaults to NIL, is returned as the value of the |
| 3642 |
block. |
| 3643 |
|
| 3644 |
-- Macro: TYPECASE |
| 3645 |
Package:LISP |
| 3646 |
|
| 3647 |
Syntax: |
| 3648 |
(typecase keyform {(type {form}*)}*) |
| 3649 |
|
| 3650 |
Evaluates KEYFORM and tries to find the TYPE in which the value of |
| 3651 |
KEYFORM belongs. If one is found, then evaluates FORMs that follow |
| 3652 |
the KEY and returns the value of the last FORM. If not, simply |
| 3653 |
returns NIL. |
| 3654 |
|
| 3655 |
-- Special Form: AND |
| 3656 |
Package:LISP |
| 3657 |
|
| 3658 |
Syntax: |
| 3659 |
(and {form}*) |
| 3660 |
|
| 3661 |
Evaluates FORMs in order from left to right. If any FORM evaluates |
| 3662 |
to NIL, returns immediately with the value NIL. Else, returns the |
| 3663 |
value(s) of the last FORM. |
| 3664 |
|
| 3665 |
-- Special Form: LET |
| 3666 |
Package:LISP |
| 3667 |
|
| 3668 |
Syntax: |
| 3669 |
(let ({var | (var [value])}*) {decl}* {form}*) |
| 3670 |
|
| 3671 |
Initializes VARs, binding them to the values of VALUEs (which |
| 3672 |
defaults to NIL) all at once, then evaluates FORMs as a PROGN. |
| 3673 |
|
| 3674 |
-- Special Form: COND |
| 3675 |
Package:LISP |
| 3676 |
|
| 3677 |
Syntax: |
| 3678 |
(cond {(test {form}*)}*) |
| 3679 |
Evaluates each TEST in order until one evaluates to a non-NIL |
| 3680 |
value. Then evaluates the associated FORMs in order and returns |
| 3681 |
the value(s) of the last FORM. If no forms follow the TEST, then |
| 3682 |
returns the value of the TEST. Returns NIL, if all TESTs evaluate |
| 3683 |
to NIL. |
| 3684 |
|
| 3685 |
-- Function: GET-SETF-METHOD-MULTIPLE-VALUE (form) |
| 3686 |
Package:LISP Returns the five values (or five 'gangs') constituting |
| 3687 |
the SETF method for FORM. See the doc of DEFINE-SETF-METHOD for the |
| 3688 |
meanings of the gangs. The third value (i.e., the list of store |
| 3689 |
variables) may consist of any number of elements. See the doc of |
| 3690 |
GET-SETF-METHOD for comparison. |
| 3691 |
|
| 3692 |
-- Special Form: CATCH |
| 3693 |
Package:LISP |
| 3694 |
|
| 3695 |
Syntax: |
| 3696 |
(catch tag {form}*) |
| 3697 |
|
| 3698 |
Sets up a catcher with that value TAG. Then evaluates FORMs as a |
| 3699 |
PROGN, but may possibly abort the evaluation by a THROW form that |
| 3700 |
specifies the value EQ to the catcher tag. |
| 3701 |
|
| 3702 |
-- Macro: DEFINE-MODIFY-MACRO |
| 3703 |
Package:LISP |
| 3704 |
|
| 3705 |
Syntax: |
| 3706 |
(define-modify-macro name lambda-list fun [doc]) |
| 3707 |
|
| 3708 |
Defines a read-modify-write macro, like PUSH and INCF. The defined |
| 3709 |
macro will expand a form (NAME place val1 ... valn) into a form |
| 3710 |
that in effect SETFs the value of the call (FUN PLACE arg1 ... |
| 3711 |
argm) into PLACE, where arg1 ... argm are parameters in |
| 3712 |
LAMBDA-LIST which are bound to the forms VAL1 ... VALn. The |
| 3713 |
doc-string DOC, if supplied, is saved as a FUNCTION doc and can be |
| 3714 |
retrieved by (documentation 'NAME 'function). |
| 3715 |
|
| 3716 |
-- Function: MACROEXPAND-1 (form &optional (env nil)) |
| 3717 |
Package:LISP |
| 3718 |
|
| 3719 |
If FORM is a macro form, then expands it once. Returns two values: |
| 3720 |
the expanded form and a T-or-NIL flag indicating whether the |
| 3721 |
original form was a macro. |
| 3722 |
|
| 3723 |
-- Function: FUNCALL (function &rest arguments) |
| 3724 |
Package:LISP |
| 3725 |
|
| 3726 |
Applies FUNCTION to the ARGUMENTs |
| 3727 |
|
| 3728 |
-- Constant: CALL-ARGUMENTS-LIMIT |
| 3729 |
Package:LISP The upper exclusive bound on the number of arguments |
| 3730 |
that may be passed to a function. Actually, however, there is no |
| 3731 |
such upper bound in GCL. |
| 3732 |
|
| 3733 |
-- Special Form: CASE |
| 3734 |
Package:LISP |
| 3735 |
|
| 3736 |
Syntax: |
| 3737 |
(case keyform {({key | ({key}*)} {form}*)}*) |
| 3738 |
|
| 3739 |
Evaluates KEYFORM and tries to find the KEY that is EQL to the |
| 3740 |
value of KEYFORM. If one is found, then evaluates FORMs that follow |
| 3741 |
the KEY and returns the value(s) of the last FORM. If not, simply |
| 3742 |
returns NIL. |
| 3743 |
|
| 3744 |
-- Macro: DEFINE-SETF-METHOD |
| 3745 |
Package:LISP |
| 3746 |
|
| 3747 |
Syntax: |
| 3748 |
(define-setf-method access-fun defmacro-lambda-list {decl | doc}* |
| 3749 |
{form}*) |
| 3750 |
|
| 3751 |
Defines how to SETF a generalized-variable reference of the form |
| 3752 |
(ACCESS-FUN ...). When a form (setf (ACCESS-FUN arg1 ... argn) |
| 3753 |
value) is being evaluated, the FORMs are first evaluated as a PROGN |
| 3754 |
with the parameters in DEFMACRO-LAMBDA-LIST bound to ARG1 ... |
| 3755 |
ARGn. Assuming that the last FORM returns five values (temp-var-1 |
| 3756 |
... temp-var-k) (value-from-1 ... value-form-k) (store-var) |
| 3757 |
storing-form access-form in order, the whole SETF is then expanded |
| 3758 |
into (let* ((temp-var-1 value-from-1) ... (temp-k value-form-k) |
| 3759 |
(store-var VALUE)) storing-from) Incidentally, the five values are |
| 3760 |
called the five gangs of a SETF method. The doc-string DOC, if |
| 3761 |
supplied, is saved as a SETF doc and can be retrieved by |
| 3762 |
(documentation 'NAME 'setf). |
| 3763 |
|
| 3764 |
-- Special Form: COMPILER-LET |
| 3765 |
Package:LISP |
| 3766 |
|
| 3767 |
Syntax: |
| 3768 |
(compiler-let ({var | (var [value])}*) {form}*) |
| 3769 |
|
| 3770 |
When interpreted, this form works just like a LET form with all |
| 3771 |
VARs declared special. When compiled, FORMs are processed with the |
| 3772 |
VARs bound at compile time, but no bindings occur when the compiled |
| 3773 |
code is executed. |
| 3774 |
|
| 3775 |
-- Function: VALUES (&rest args) |
| 3776 |
Package:LISP |
| 3777 |
|
| 3778 |
Returns ARGs in order, as values. |
| 3779 |
|
| 3780 |
-- Special Form: MULTIPLE-VALUE-LIST |
| 3781 |
Package:LISP |
| 3782 |
|
| 3783 |
Syntax: |
| 3784 |
(multiple-value-list form) |
| 3785 |
|
| 3786 |
Evaluates FORM, and returns a list of multiple values it returned. |
| 3787 |
|
| 3788 |
-- Special Form: MULTIPLE-VALUE-PROG1 |
| 3789 |
Package:LISP |
| 3790 |
|
| 3791 |
Syntax: |
| 3792 |
(multiple-value-prog1 form {form}*) |
| 3793 |
|
| 3794 |
Evaluates the first FORM, saves all the values produced, then |
| 3795 |
evaluates the other FORMs. Returns the saved values. |
| 3796 |
|
| 3797 |
-- Special Form: MACROLET |
| 3798 |
Package:LISP |
| 3799 |
|
| 3800 |
Syntax: |
| 3801 |
(macrolet ({(name defmacro-lambda-list {decl | doc}* . body)}*) |
| 3802 |
{form}*) |
| 3803 |
|
| 3804 |
Evaluates FORMs as a PROGN, with the local macro definitions in |
| 3805 |
effect. See the doc of DEFMACRO for the complete syntax of a |
| 3806 |
defmacro-lambda-list. Doc-strings for local macros are simply |
| 3807 |
ignored. |
| 3808 |
|
| 3809 |
-- Special Form: GO |
| 3810 |
Package:LISP |
| 3811 |
|
| 3812 |
Syntax: |
| 3813 |
(go tag) |
| 3814 |
|
| 3815 |
Jumps to the specified TAG established by a lexically surrounding |
| 3816 |
TAGBODY. |
| 3817 |
|
| 3818 |
-- Special Form: PROG |
| 3819 |
Package:LISP |
| 3820 |
|
| 3821 |
Syntax: |
| 3822 |
(prog ({var | (var [init])}*) {decl}* {tag | statement}*) |
| 3823 |
|
| 3824 |
Creates a NIL block, binds VARs in parallel, and then executes |
| 3825 |
STATEMENTs. |
| 3826 |
|
| 3827 |
-- Variable: *APPLYHOOK* |
| 3828 |
Package:LISP Used to substitute another function for the implicit |
| 3829 |
APPLY normally done within EVAL. If *APPLYHOOK* is not NIL, its |
| 3830 |
value must be a function which takes three arguments: a function to |
| 3831 |
be applied, a list of arguments, and an environment. This function |
| 3832 |
does the application instead of APPLY. |
| 3833 |
|
| 3834 |
-- Special Form: RETURN-FROM |
| 3835 |
Package:LISP |
| 3836 |
|
| 3837 |
Syntax: |
| 3838 |
(return-from name [result]) |
| 3839 |
|
| 3840 |
Returns from the lexically surrounding block whose name is NAME. |
| 3841 |
The value of RESULT, which defaults to NIL, is returned as the |
| 3842 |
value of the block. |
| 3843 |
|
| 3844 |
-- Special Form: UNLESS |
| 3845 |
Package:LISP |
| 3846 |
|
| 3847 |
Syntax: |
| 3848 |
(unless test {form}*) |
| 3849 |
|
| 3850 |
If TEST evaluates to NIL, then evaluates FORMs as a PROGN. If not, |
| 3851 |
simply returns NIL. |
| 3852 |
|
| 3853 |
-- Special Form: MULTIPLE-VALUE-SETQ |
| 3854 |
Package:LISP |
| 3855 |
|
| 3856 |
Syntax: |
| 3857 |
(multiple-value-setq variables form) |
| 3858 |
|
| 3859 |
Sets each variable in the list VARIABLES to the corresponding value |
| 3860 |
of FORM. Returns the value assigned to the first variable. |
| 3861 |
|
| 3862 |
-- Special Form: LOCALLY |
| 3863 |
Package:LISP |
| 3864 |
|
| 3865 |
Syntax: |
| 3866 |
(locally {decl}* {form}*) |
| 3867 |
|
| 3868 |
Gives local pervasive declarations. |
| 3869 |
|
| 3870 |
-- Function: IDENTITY (x) |
| 3871 |
Package:LISP |
| 3872 |
|
| 3873 |
Simply returns X. |
| 3874 |
|
| 3875 |
-- Function: NOT (x) |
| 3876 |
Package:LISP |
| 3877 |
|
| 3878 |
Returns T if X is NIL; NIL otherwise. |
| 3879 |
|
| 3880 |
-- Macro: DEFCONSTANT |
| 3881 |
Package:LISP |
| 3882 |
|
| 3883 |
Syntax: |
| 3884 |
(defconstant name initial-value [doc]) |
| 3885 |
|
| 3886 |
Declares that the variable NAME is a constant whose value is the |
| 3887 |
value of INITIAL-VALUE. The doc-string DOC, if supplied, is saved |
| 3888 |
as a VARIABLE doc and can be retrieved by (documentation 'NAME |
| 3889 |
'variable). |
| 3890 |
|
| 3891 |
-- Function: VALUES-LIST (list) |
| 3892 |
Package:LISP |
| 3893 |
|
| 3894 |
Returns all of the elements of LIST in order, as values. |
| 3895 |
|
| 3896 |
-- Function: ERROR (control-string &rest args) |
| 3897 |
Package:LISP |
| 3898 |
|
| 3899 |
Signals a fatal error. |
| 3900 |
|
| 3901 |
-- Special Form: IF |
| 3902 |
Package:LISP |
| 3903 |
|
| 3904 |
Syntax: |
| 3905 |
(if test then [else]) |
| 3906 |
|
| 3907 |
If TEST evaluates to non-NIL, then evaluates THEN and returns the |
| 3908 |
result. If not, evaluates ELSE (which defaults to NIL) and returns |
| 3909 |
the result. |
| 3910 |
|
| 3911 |
-- Special Form: UNWIND-PROTECT |
| 3912 |
Package:LISP |
| 3913 |
|
| 3914 |
Syntax: |
| 3915 |
(unwind-protect protected-form {cleanup-form}*) |
| 3916 |
|
| 3917 |
Evaluates PROTECTED-FORM and returns whatever it returned. |
| 3918 |
Guarantees that CLEANUP-FORMs be always evaluated before exiting |
| 3919 |
from the UNWIND-PROTECT form. |
| 3920 |
|
| 3921 |
-- Function: EVALHOOK (form evalhookfn applyhookfn &optional (env nil)) |
| 3922 |
Package:LISP |
| 3923 |
|
| 3924 |
Evaluates FORM with *EVALHOOK* bound to EVALHOOKFN and *APPLYHOOK* |
| 3925 |
bound to APPLYHOOKFN. Ignores these hooks once, for the top-level |
| 3926 |
evaluation of FORM. |
| 3927 |
|
| 3928 |
-- Special Form: OR |
| 3929 |
Package:LISP |
| 3930 |
|
| 3931 |
Syntax: |
| 3932 |
(or {form}*) |
| 3933 |
|
| 3934 |
Evaluates FORMs in order from left to right. If any FORM evaluates |
| 3935 |
to non-NIL, quits and returns that (single) value. If the last |
| 3936 |
FORM is reached, returns whatever values it returns. |
| 3937 |
|
| 3938 |
-- Macro: CTYPECASE |
| 3939 |
Package:LISP |
| 3940 |
|
| 3941 |
Syntax: |
| 3942 |
(ctypecase keyplace {(type {form}*)}*) |
| 3943 |
|
| 3944 |
Evaluates KEYPLACE and tries to find the TYPE in which the value of |
| 3945 |
KEYPLACE belongs. If one is found, then evaluates FORMs that |
| 3946 |
follow the KEY and returns the value(s) of the last FORM. If not, |
| 3947 |
signals a correctable error. |
| 3948 |
|
| 3949 |
-- Function: EVAL (exp) |
| 3950 |
Package:LISP |
| 3951 |
|
| 3952 |
Evaluates EXP and returns the result(s). |
| 3953 |
|
| 3954 |
-- Macro: PSETF |
| 3955 |
Package:LISP |
| 3956 |
|
| 3957 |
Syntax: |
| 3958 |
(psetf {place newvalue}*) |
| 3959 |
|
| 3960 |
Similar to SETF, but evaluates all NEWVALUEs first, and then |
| 3961 |
replaces the value in each PLACE with the value of the |
| 3962 |
corresponding NEWVALUE. Returns NIL always. |
| 3963 |
|
| 3964 |
-- Special Form: THROW |
| 3965 |
Package:LISP |
| 3966 |
|
| 3967 |
Syntax: |
| 3968 |
(throw tag result) |
| 3969 |
|
| 3970 |
Evaluates TAG and aborts the execution of the most recent CATCH |
| 3971 |
form that sets up a catcher with the same tag value. The CATCH |
| 3972 |
form returns whatever RESULT returned. |
| 3973 |
|
| 3974 |
-- Macro: DEFPARAMETER |
| 3975 |
Package:LISP |
| 3976 |
|
| 3977 |
Syntax: |
| 3978 |
(defparameter name initial-value [doc]) |
| 3979 |
|
| 3980 |
Declares the variable NAME as a special variable and initializes |
| 3981 |
the value. The doc-string DOC, if supplied, is saved as a VARIABLE |
| 3982 |
doc and can be retrieved by (documentation 'NAME 'variable). |
| 3983 |
|
| 3984 |
-- Macro: DEFVAR |
| 3985 |
Package:LISP |
| 3986 |
|
| 3987 |
Syntax: |
| 3988 |
(defvar name [initial-value [doc]]) |
| 3989 |
|
| 3990 |
Declares the variable NAME as a special variable and, optionally, |
| 3991 |
initializes it. The doc-string DOC, if supplied, is saved as a |
| 3992 |
VARIABLE doc and can be retrieved by (documentation 'NAME |
| 3993 |
'variable). |
| 3994 |
|
| 3995 |
|
| 3996 |
File: gcl-si.info, Node: Compilation, Next: Symbols, Prev: Special Forms and Functions, Up: Top |
| 3997 |
|
| 3998 |
7 Compilation |
| 3999 |
************* |
| 4000 |
|
| 4001 |
-- Function: COMPILE (name &optional (definition nil)) |
| 4002 |
Package:LISP |
| 4003 |
|
| 4004 |
If DEFINITION is NIL, NAME must be the name of a not-yet-compiled |
| 4005 |
function. In this case, COMPILE compiles the function, installs |
| 4006 |
the compiled function as the global function definition of NAME, |
| 4007 |
and returns NAME. If DEFINITION is non-NIL, it must be a lambda |
| 4008 |
expression and NAME must be a symbol. COMPILE compiles the lambda |
| 4009 |
expression, installs the compiled function as the function |
| 4010 |
definition of NAME, and returns NAME. There is only one exception |
| 4011 |
for this: If NAME is NIL, then the compiled function is not |
| 4012 |
installed but is simply returned as the value of COMPILE. In any |
| 4013 |
case, COMPILE creates temporary files whose filenames are |
| 4014 |
"gazonk***". By default, i.e. if :LEAVE-GAZONK is not supplied or |
| 4015 |
is NIL, these files are automatically deleted after compilation. |
| 4016 |
|
| 4017 |
-- Function: LINK (files image &optional post extra-libs (run-user-init |
| 4018 |
t) &aux raw init) |
| 4019 |
Package:LISP |
| 4020 |
|
| 4021 |
On systems where dlopen is used for relocations, one cannot make |
| 4022 |
custom images containing loaded binary object files simply by |
| 4023 |
loading the files and executing save-system. This function is |
| 4024 |
provided for such cases. |
| 4025 |
|
| 4026 |
After compiling source files into objects, LINK can be called with |
| 4027 |
a list of binary and source FILES which would otherwise normally be |
| 4028 |
loaded in sequence before saving the image to IMAGE. LINK will use |
| 4029 |
the system C linker to link the binary files thus supplied with |
| 4030 |
GCL's objects, using EXTRA-LIBS as well if provided, and producing |
| 4031 |
a raw_IMAGE executable. This executable is then run to initialize |
| 4032 |
first GCL's objects, followed by the supplied files, in order, if |
| 4033 |
RUN-USER-INIT is set. In such a case, source files are loaded at |
| 4034 |
their position in the sequence. Any optional code which should be |
| 4035 |
run after file initialization can be supplied in the POST variable. |
| 4036 |
The image is then saved using save-system to IMAGE. |
| 4037 |
|
| 4038 |
This method of creating lisp images may also have the advantage |
| 4039 |
that all new object files are kept out of the lisp core and placed |
| 4040 |
instead in the final image's .text section. This should in |
| 4041 |
principle reduce the core size, speed up garbage collection, and |
| 4042 |
forego any performance penalty induced by data cache flushing on |
| 4043 |
some machines. |
| 4044 |
|
| 4045 |
In both the RAW and SAVED image, any calls to LOAD binary object |
| 4046 |
files which have been specified in this list will bypass the normal |
| 4047 |
load procedure, and simply initialize the already linked in module. |
| 4048 |
One can rely on this feature by disabling RUN-USER-INIT, and |
| 4049 |
instead passing the normal build commands in POST. In the course of |
| 4050 |
executing this code, binary modules previously linked into the |
| 4051 |
.text section of the executable will be initialized at the same |
| 4052 |
point at which they would have normally been loaded into the lisp |
| 4053 |
core, in the executable's .data section. In this way, the user can |
| 4054 |
choose to take advantage of the aforementioned possible benefits of |
| 4055 |
this linking method in a relatively transparent way. |
| 4056 |
|
| 4057 |
All binary objects specified in FILES must have been compiled with |
| 4058 |
:SYSTEM-P set to T. |
| 4059 |
|
| 4060 |
-- Special Form: EVAL-WHEN |
| 4061 |
Package:LISP |
| 4062 |
|
| 4063 |
Syntax: |
| 4064 |
(eval-when ({situation}*) {form}*) |
| 4065 |
|
| 4066 |
A situation must be either COMPILE, LOAD, or EVAL. The interpreter |
| 4067 |
evaluates only when EVAL is specified. If COMPILE is specified, |
| 4068 |
FORMs are evaluated at compile time. If LOAD is specified, the |
| 4069 |
compiler arranges so that FORMs be evaluated when the compiled code |
| 4070 |
is loaded. |
| 4071 |
|
| 4072 |
-- Function: COMPILE-FILE (input-pathname &key output-file (load nil) |
| 4073 |
(message-file nil) ;GCL specific keywords: system-p c-debug |
| 4074 |
c-file h-file data-file) |
| 4075 |
Package:LISP |
| 4076 |
|
| 4077 |
Compiles the file specified by INPUT-PATHNAME and generates a fasl |
| 4078 |
file specified by OUTPUT-FILE. If the filetype is not specified in |
| 4079 |
INPUT-PATHNAME, then ".lsp" is used as the default file type for |
| 4080 |
the source file. :LOAD specifies whether to load the generated |
| 4081 |
fasl file after compilation. :MESSAGE-FILE specifies the log file |
| 4082 |
for the compiler messages. It defaults to the value of the |
| 4083 |
variable COMPILER:*DEFAULT-MESSAGE-FILE*. A non-NIL value of |
| 4084 |
COMPILER::*COMPILE-PRINT* forces the compiler to indicate the form |
| 4085 |
currently being compiled. More keyword parameters are accepted, |
| 4086 |
depending on the version. Most versions of GCL can receive |
| 4087 |
:O-FILE, :C-FILE, :H-FILE, and :DATA-FILE keyword parameters, with |
| 4088 |
which you can control the intermediate files generated by the GCL |
| 4089 |
compiler. Also :C-DEBUG will pass the -g flag to the C compiler. |
| 4090 |
|
| 4091 |
By top level forms in a file, we mean the value of |
| 4092 |
*top-level-forms* after doing (TF form) for each form read from a |
| 4093 |
file. We define TF as follows: |
| 4094 |
|
| 4095 |
(defun TF (x) (when (consp x) (setq x (macroexpand x)) (when (consp |
| 4096 |
x) (cond ((member (car x) '(progn eval-when)) (mapcar 'tf (cdr x))) |
| 4097 |
(t (push x *top-level-forms*)))))) |
| 4098 |
|
| 4099 |
Among the common lisp special forms only DEFUN and DEFMACRO will |
| 4100 |
cause actual native machine code to be generated. The rest will be |
| 4101 |
specially treated in an init section of the .data file. This is |
| 4102 |
done so that things like putprop,setq, and many other forms would |
| 4103 |
use up space which could not be usefully freed, if we were to |
| 4104 |
compile to native machine code. If you have other 'ordinary' top |
| 4105 |
level forms which you need to have compiled fully to machine code |
| 4106 |
you may either set compiler::*COMPILE-ORDINARIES* to t, or put them |
| 4107 |
inside a |
| 4108 |
|
| 4109 |
(PROGN 'COMPILE ...forms-which-need-to-be-compiled) |
| 4110 |
|
| 4111 |
The compiler will take each of them and make a temporary function |
| 4112 |
which will be compiled and invoked once. It is permissible to wrap |
| 4113 |
a (PROGN 'COMPILE ..) around the whole file. Currently this |
| 4114 |
construction binds the compiler::*COMPILE-ORDINARIES* flag to t. |
| 4115 |
Setting this flag globally to a non nil value to cause all top |
| 4116 |
level forms to generate machine code. This might be useful in a |
| 4117 |
system such as PCL, where a number of top level lambda expressions |
| 4118 |
are given. Note that most common lisps will simply ignore the top |
| 4119 |
level atom 'compile, since it has no side effects. |
| 4120 |
|
| 4121 |
Defentry, clines, and defcfun also result in machine code being |
| 4122 |
generated. |
| 4123 |
|
| 4124 |
subsection Evaluation at Compile time |
| 4125 |
************************************* |
| 4126 |
|
| 4127 |
In GCL the eval-when behaviour was changed in order to allow more |
| 4128 |
efficient init code, and also to bring it into line with the resolution |
| 4129 |
passed by the X3j13 committee. Evaluation at compile time is controlled |
| 4130 |
by placing eval-when special forms in the code, or by the value of the |
| 4131 |
variable compiler::*eval-when-defaults* [default value :defaults]. If |
| 4132 |
that variable has value :defaults, then the following hold: |
| 4133 |
|
| 4134 |
Eval at Compile Type of Top Level Form |
| 4135 |
|
| 4136 |
Partial: |
| 4137 |
defstructs, defvar, defparameter |
| 4138 |
Full: |
| 4139 |
defmacro, defconstant, defsetf, define-setf-method, deftype, |
| 4140 |
package ops, proclaim |
| 4141 |
None: |
| 4142 |
defun, others |
| 4143 |
|
| 4144 |
By 'partial' we mean (see the X3J13 Common Lisp document |
| 4145 |
(doc/compile-file-handling-of-top-level-forms) for more detail), that |
| 4146 |
functions will not be defined, values will not be set, but other |
| 4147 |
miscellaneous compiler properties will be set: eg properties to inline |
| 4148 |
expand defstruct accessors and testers, defstruct properties allowing |
| 4149 |
subsequent defstructs to include this one, any type hierarch |
| 4150 |
information, special variable information will be set up. |
| 4151 |
|
| 4152 |
Example: |
| 4153 |
(defun foo () 3) |
| 4154 |
(defstruct jo a b) |
| 4155 |
|
| 4156 |
As a side effect of compiling these two forms, foo would not have its |
| 4157 |
function cell changed. Neither would jo-a, although it would gain a |
| 4158 |
property which allows it to expand inline to a structure access. Thus |
| 4159 |
if it had a previous definition (as commonly happens from previously |
| 4160 |
loading the file), this previous definition would not be touched, and |
| 4161 |
could well be inconsistent with the compiler properties. Unfortunately |
| 4162 |
this is what the CL standard says to do, and I am just trying to follow |
| 4163 |
it. |
| 4164 |
|
| 4165 |
If you prefer a more intuitive scheme, of evaling all forms in the |
| 4166 |
file, so that there are no inconsistencies, (previous behaviour of AKCL) |
| 4167 |
you may set compiler::*eval-when-defaults* to '(compile eval load). |
| 4168 |
|
| 4169 |
The variable compiler::*FASD-DATA* [default t] controls whether an |
| 4170 |
ascii output is used for the data section of the object file. The data |
| 4171 |
section will be in ascii if *fasd-data* is nil or if the system-p |
| 4172 |
keyword is supplied to compile-file and *fasd-data* is not eq to |
| 4173 |
:system-p. |
| 4174 |
|
| 4175 |
The old GCL variable *compile-time-too* has disappeared. |
| 4176 |
|
| 4177 |
See OPTIMIZE on how to enable warnings of slow constructs. |
| 4178 |
|
| 4179 |
-- Function: PROCLAIM (decl-spec) |
| 4180 |
Package:LISP |
| 4181 |
|
| 4182 |
Puts the declaration given by DECL-SPEC into effect globally. See |
| 4183 |
the doc of DECLARE for possible DECL-SPECs. |
| 4184 |
|
| 4185 |
-- Function: PROVIDE (module-name) |
| 4186 |
Package:LISP |
| 4187 |
|
| 4188 |
Adds the specified module to the list of modules maintained in |
| 4189 |
*MODULES*. |
| 4190 |
|
| 4191 |
-- Function: COMPILED-FUNCTION-P (x) |
| 4192 |
Package:LISP |
| 4193 |
|
| 4194 |
Returns T if X is a compiled function; NIL otherwise. |
| 4195 |
|
| 4196 |
-- Function: GPROF-START () |
| 4197 |
Package:SYSTEM |
| 4198 |
|
| 4199 |
GCL now has preliminary support for profiling with gprof, an |
| 4200 |
externally supplied profiling tool at the C level which typically |
| 4201 |
accompanies gcc. Support must be enabled at compile time with |
| 4202 |
-enable-gprof. This function starts the profiling timers and |
| 4203 |
counters. |
| 4204 |
|
| 4205 |
-- Function: GPROF-QUIT () |
| 4206 |
Package:SYSTEM |
| 4207 |
|
| 4208 |
GCL now has preliminary support for profiling with gprof, an |
| 4209 |
externally supplied profiling tool at the C level which typically |
| 4210 |
accompanies gcc. Support must be enabled at compile time with |
| 4211 |
-enable-gprof. This function reports the profiling results in the |
| 4212 |
form of a call graph to standard output, and clears the profiling |
| 4213 |
arrays. Please note that lisp functions are not (yet) displayed |
| 4214 |
with their lisp names. Please see also the PROFILE function. |
| 4215 |
|
| 4216 |
-- Function: GPROF-SET (begin end) |
| 4217 |
Package:SYSTEM |
| 4218 |
|
| 4219 |
GCL now has preliminary support for profiling with gprof, an |
| 4220 |
externally supplied profiling tool at the C level which typically |
| 4221 |
accompanies gcc. Support must be enabled at compile time with |
| 4222 |
-enable-gprof. This function sets the address range used by |
| 4223 |
GPROF-START in specifying the section of the running program which |
| 4224 |
is to be profiled. All subsequent calls to GPROF-START will use |
| 4225 |
this new address range. By default, the range is set to begin at |
| 4226 |
the starting address of the .text section, and to end at the |
| 4227 |
current end of the running core. These default values can be |
| 4228 |
restored by calling GPROF-SET with both argments set to 0. |
| 4229 |
|
| 4230 |
-- Variable: *DEFAULT-SYSTEM-P* |
| 4231 |
Pakcage:COMPILER Specifies the default setting of :SYSTEM-P used by |
| 4232 |
COMPILE. Defaults to NIL. |
| 4233 |
|
| 4234 |
-- Variable: *DEFAULT-C-FILE* |
| 4235 |
Pakcage:COMPILER Specifies the default setting of :C-FILE used by |
| 4236 |
COMPILE. Defaults to NIL. |
| 4237 |
|
| 4238 |
-- Variable: *DEFAULT-H-FILE* |
| 4239 |
Pakcage:COMPILER Specifies the default setting of :H-FILE used by |
| 4240 |
COMPILE. Defaults to NIL. |
| 4241 |
|
| 4242 |
-- Variable: *DEFAULT-DATA-FILE* |
| 4243 |
Pakcage:COMPILER Specifies the default setting of :DATA-FILE used |
| 4244 |
by COMPILE. Defaults to NIL. |
| 4245 |
|
| 4246 |
-- Variable: *FEATURES* |
| 4247 |
Package:LISP List of symbols that name features of the current |
| 4248 |
version of GCL. These features are used to decide the read-time |
| 4249 |
conditionalization facility provided by '#+' and '#-' read macros. |
| 4250 |
When the GCL reader encounters |
| 4251 |
#+ feature-description form |
| 4252 |
it reads FORM in the usual manner if FEATURE-DESCRIPTION is true. |
| 4253 |
Otherwise, the reader just skips FORM. |
| 4254 |
#- feature-description form |
| 4255 |
is equivalent to |
| 4256 |
#- (not feature-description) form |
| 4257 |
A feature-description may be a symbol, which is true only when it |
| 4258 |
is an element of *FEATURES*. Or else, it must be one of the |
| 4259 |
following: |
| 4260 |
(and feature-desciption-1 ... feature-desciption-n) |
| 4261 |
(or feature-desciption-1 ... feature-desciption-n) |
| 4262 |
(not feature-desciption) |
| 4263 |
The AND description is true only when all of its sub-descriptions |
| 4264 |
are true. The OR description is true only when at least one of its |
| 4265 |
sub-descriptions is true. The NOT description is true only when |
| 4266 |
its sub-description is false. |
| 4267 |
|
| 4268 |
|
| 4269 |
File: gcl-si.info, Node: Symbols, Next: Operating System, Prev: Compilation, Up: Top |
| 4270 |
|
| 4271 |
8 Symbols |
| 4272 |
********* |
| 4273 |
|
| 4274 |
-- Function: GENSYM (&optional (x nil)) |
| 4275 |
Package:LISP |
| 4276 |
|
| 4277 |
Creates and returns a new uninterned symbol whose name is a prefix |
| 4278 |
string (defaults to "G"), followed by a decimal number. The number |
| 4279 |
is incremented by each call to GENSYM. X, if an integer, resets the |
| 4280 |
counter. If X is a string, it becomes the new prefix. |
| 4281 |
|
| 4282 |
-- Function: KEYWORDP (x) |
| 4283 |
Package:LISP |
| 4284 |
|
| 4285 |
Returns T if X is a symbol and it belongs to the KEYWORD package; |
| 4286 |
NIL otherwise. |
| 4287 |
|
| 4288 |
-- Function: REMPROP (symbol indicator) |
| 4289 |
Package:LISP |
| 4290 |
|
| 4291 |
Look on property list of SYMBOL for property with specified |
| 4292 |
INDICATOR. If found, splice this indicator and its value out of the |
| 4293 |
plist, and return T. If not found, returns NIL with no side |
| 4294 |
effects. |
| 4295 |
|
| 4296 |
-- Function: SYMBOL-PACKAGE (symbol) |
| 4297 |
Package:LISP |
| 4298 |
|
| 4299 |
Returns the contents of the package cell of the symbol SYMBOL. |
| 4300 |
|
| 4301 |
-- Variable: *PACKAGE* |
| 4302 |
Package:LISP The current package. |
| 4303 |
|
| 4304 |
-- Function: SHADOWING-IMPORT (symbols &optional (package *package*)) |
| 4305 |
Package:LISP |
| 4306 |
|
| 4307 |
Imports SYMBOLS into PACKAGE, disregarding any name conflict. If a |
| 4308 |
symbol of the same name is already present, then it is uninterned. |
| 4309 |
SYMBOLS must be a list of symbols or a symbol. |
| 4310 |
|
| 4311 |
-- Macro: REMF |
| 4312 |
Package:LISP |
| 4313 |
|
| 4314 |
Syntax: |
| 4315 |
(remf place indicator) |
| 4316 |
|
| 4317 |
PLACE may be any place expression acceptable to SETF, and is |
| 4318 |
expected to hold a property list or NIL. This list is destructively |
| 4319 |
altered to remove the property specified by INDICATOR. Returns T if |
| 4320 |
such a property was present; NIL otherwise. |
| 4321 |
|
| 4322 |
-- Function: MAKUNBOUND (symbol) |
| 4323 |
Package:LISP |
| 4324 |
|
| 4325 |
Makes empty the value slot of SYMBOL. Returns SYMBOL. |
| 4326 |
|
| 4327 |
-- Function: USE-PACKAGE (packages-to-use &optional (package |
| 4328 |
*package*)) |
| 4329 |
Package:LISP |
| 4330 |
|
| 4331 |
Adds all packages in PACKAGE-TO-USE list to the use list for |
| 4332 |
PACKAGE so that the external symbols of the used packages are |
| 4333 |
available as internal symbols in PACKAGE. |
| 4334 |
|
| 4335 |
-- Function: MAKE-SYMBOL (string) |
| 4336 |
Package:LISP |
| 4337 |
|
| 4338 |
Creates and returns a new uninterned symbol whose print name is |
| 4339 |
STRING. |
| 4340 |
|
| 4341 |
-- Special Form: PSETQ |
| 4342 |
Package:LISP |
| 4343 |
|
| 4344 |
Syntax: |
| 4345 |
(psetq {var form}*) |
| 4346 |
|
| 4347 |
Similar to SETQ, but evaluates all FORMs first, and then assigns |
| 4348 |
each value to the corresponding VAR. Returns NIL always. |
| 4349 |
|
| 4350 |
-- Function: PACKAGE-USED-BY-LIST (package) |
| 4351 |
Package:LISP |
| 4352 |
|
| 4353 |
Returns the list of packages that use PACKAGE. |
| 4354 |
|
| 4355 |
-- Function: SYMBOLP (x) |
| 4356 |
Package:LISP |
| 4357 |
|
| 4358 |
Returns T if X is a symbol; NIL otherwise. |
| 4359 |
|
| 4360 |
-- Constant: NIL |
| 4361 |
Package:LISP Holds NIL. |
| 4362 |
|
| 4363 |
-- Function: SET (symbol value) |
| 4364 |
Package:LISP |
| 4365 |
|
| 4366 |
Assigns the value of VALUE to the dynamic variable named by SYMBOL, |
| 4367 |
and returns the value assigned. |
| 4368 |
|
| 4369 |
-- Special Form: SETQ |
| 4370 |
Package:LISP |
| 4371 |
|
| 4372 |
Syntax: |
| 4373 |
(setq {var form}*) |
| 4374 |
|
| 4375 |
VARs are not evaluated and must be symbols. Assigns the value of |
| 4376 |
the first FORM to the first VAR, then assigns the value of the |
| 4377 |
second FORM to the second VAR, and so on. Returns the last value |
| 4378 |
assigned. |
| 4379 |
|
| 4380 |
-- Function: UNUSE-PACKAGE (packages-to-unuse &optional (package |
| 4381 |
*package*)) |
| 4382 |
Package:LISP |
| 4383 |
|
| 4384 |
Removes PACKAGES-TO-UNUSE from the use list for PACKAGE. |
| 4385 |
|
| 4386 |
-- Constant: T |
| 4387 |
Package:LISP Holds T. |
| 4388 |
|
| 4389 |
-- Function: PACKAGE-USE-LIST (package) |
| 4390 |
Package:LISP |
| 4391 |
|
| 4392 |
Returns the list of packages used by PACKAGE. |
| 4393 |
|
| 4394 |
-- Function: LIST-ALL-PACKAGES () |
| 4395 |
Package:LISP |
| 4396 |
|
| 4397 |
Returns a list of all existing packages. |
| 4398 |
|
| 4399 |
-- Function: COPY-SYMBOL (symbol &optional (copy-props nil)) |
| 4400 |
Package:LISP |
| 4401 |
|
| 4402 |
Returns a new uninterned symbol with the same print name as SYMBOL. |
| 4403 |
If COPY-PROPS is NIL, the function, the variable, and the property |
| 4404 |
slots of the new symbol have no value. Otherwise, these slots are |
| 4405 |
given the values of the corresponding slots of SYMBOL. |
| 4406 |
|
| 4407 |
-- Function: SYMBOL-PLIST (symbol) |
| 4408 |
Package:LISP |
| 4409 |
|
| 4410 |
Returns the property list of SYMBOL. |
| 4411 |
|
| 4412 |
-- Function: SYMBOL-NAME (symbol) |
| 4413 |
Package:LISP |
| 4414 |
|
| 4415 |
Returns the print name of the symbol SYMBOL. |
| 4416 |
|
| 4417 |
-- Function: FIND-SYMBOL (name &optional (package *package*)) |
| 4418 |
Package:LISP |
| 4419 |
|
| 4420 |
Returns the symbol named NAME in PACKAGE. If such a symbol is |
| 4421 |
found, then the second value is :INTERN, :EXTERNAL, or :INHERITED |
| 4422 |
to indicate how the symbol is accessible. If no symbol is found |
| 4423 |
then both values are NIL. |
| 4424 |
|
| 4425 |
-- Function: SHADOW (symbols &optional (package *package*)) |
| 4426 |
Package:LISP |
| 4427 |
|
| 4428 |
Creates an internal symbol in PACKAGE with the same name as each of |
| 4429 |
the specified SYMBOLS. SYMBOLS must be a list of symbols or a |
| 4430 |
symbol. |
| 4431 |
|
| 4432 |
-- Function: FBOUNDP (symbol) |
| 4433 |
Package:LISP |
| 4434 |
|
| 4435 |
Returns T if SYMBOL has a global function definition or if SYMBOL |
| 4436 |
names a special form or a macro; NIL otherwise. |
| 4437 |
|
| 4438 |
-- Function: MACRO-FUNCTION (symbol) |
| 4439 |
Package:LISP |
| 4440 |
|
| 4441 |
If SYMBOL globally names a macro, then returns the expansion |
| 4442 |
function. Returns NIL otherwise. |
| 4443 |
|
| 4444 |
-- Function: IN-PACKAGE (package-name &key (nicknames nil) (use |
| 4445 |
'(lisp))) |
| 4446 |
Package:LISP |
| 4447 |
|
| 4448 |
Sets *PACKAGE* to the package with PACKAGE-NAME, creating the |
| 4449 |
package if it does not exist. If the package already exists then |
| 4450 |
it is modified to agree with USE and NICKNAMES arguments. Any new |
| 4451 |
nicknames are added without removing any old ones not specified. |
| 4452 |
If any package in the USE list is not currently used, then it is |
| 4453 |
added to the use list. |
| 4454 |
|
| 4455 |
-- Function: MAKE-PACKAGE (package-name &key (nicknames nil) (use |
| 4456 |
'(lisp))) |
| 4457 |
Package:LISP |
| 4458 |
|
| 4459 |
Makes a new package having the specified PACKAGE-NAME and |
| 4460 |
NICKNAMES. The package will inherit all external symbols from each |
| 4461 |
package in the USE list. |
| 4462 |
|
| 4463 |
-- Function: PACKAGE-SHADOWING-SYMBOLS (package) |
| 4464 |
Package:LISP |
| 4465 |
|
| 4466 |
Returns the list of symbols that have been declared as shadowing |
| 4467 |
symbols in PACKAGE. |
| 4468 |
|
| 4469 |
-- Function: INTERN (name &optional (package *package*)) |
| 4470 |
Package:LISP |
| 4471 |
|
| 4472 |
Returns a symbol having the specified name, creating it if |
| 4473 |
necessary. Returns as the second value one of the symbols |
| 4474 |
:INTERNAL, :EXTERNAL, :INHERITED, and NIL. |
| 4475 |
|
| 4476 |
-- Function: EXPORT (symbols &optional (package *package*)) |
| 4477 |
Package:LISP |
| 4478 |
|
| 4479 |
Makes SYMBOLS external symbols of PACKAGE. SYMBOLS must be a list |
| 4480 |
of symbols or a symbol. |
| 4481 |
|
| 4482 |
-- Function: PACKAGEP (x) |
| 4483 |
Package:LISP |
| 4484 |
|
| 4485 |
Returns T if X is a package; NIL otherwise. |
| 4486 |
|
| 4487 |
-- Function: SYMBOL-FUNCTION (symbol) |
| 4488 |
Package:LISP |
| 4489 |
|
| 4490 |
Returns the current global function definition named by SYMBOL. |
| 4491 |
|
| 4492 |
-- Function: SYMBOL-VALUE (symbol) |
| 4493 |
Package:LISP |
| 4494 |
|
| 4495 |
Returns the current value of the dynamic (special) variable named |
| 4496 |
by SYMBOL. |
| 4497 |
|
| 4498 |
-- Function: BOUNDP (symbol) |
| 4499 |
Package:LISP |
| 4500 |
|
| 4501 |
Returns T if the global variable named by SYMBOL has a value; NIL |
| 4502 |
otherwise. |
| 4503 |
|
| 4504 |
-- Function: DOCUMENTATION (symbol doc-type) |
| 4505 |
Package:LISP |
| 4506 |
|
| 4507 |
Returns the doc-string of DOC-TYPE for SYMBOL; NIL if none exists. |
| 4508 |
Possible doc-types are: FUNCTION (special forms, macros, and |
| 4509 |
functions) VARIABLE (dynamic variables, including constants) TYPE |
| 4510 |
(types defined by DEFTYPE) STRUCTURE (structures defined by |
| 4511 |
DEFSTRUCT) SETF (SETF methods defined by DEFSETF, |
| 4512 |
DEFINE-SETF-METHOD, and DEFINE-MODIFY-MACRO) All built-in special |
| 4513 |
forms, macros, functions, and variables have their doc-strings. |
| 4514 |
|
| 4515 |
-- Function: GENTEMP (&optional (prefix "t") (package *package*)) |
| 4516 |
Package:LISP |
| 4517 |
|
| 4518 |
Creates a new symbol interned in the package PACKAGE with the given |
| 4519 |
PREFIX. |
| 4520 |
|
| 4521 |
-- Function: RENAME-PACKAGE (package new-name &optional (new-nicknames |
| 4522 |
nil)) |
| 4523 |
Package:LISP |
| 4524 |
|
| 4525 |
Replaces the old name and nicknames of PACKAGE with NEW-NAME and |
| 4526 |
NEW-NICKNAMES. |
| 4527 |
|
| 4528 |
-- Function: UNINTERN (symbol &optional (package *package*)) |
| 4529 |
Package:LISP |
| 4530 |
|
| 4531 |
Makes SYMBOL no longer present in PACKAGE. Returns T if SYMBOL was |
| 4532 |
present; NIL otherwise. If PACKAGE is the home package of SYMBOL, |
| 4533 |
then makes SYMBOL uninterned. |
| 4534 |
|
| 4535 |
-- Function: UNEXPORT (symbols &optional (package *package*)) |
| 4536 |
Package:LISP |
| 4537 |
|
| 4538 |
Makes SYMBOLS no longer accessible as external symbols in PACKAGE. |
| 4539 |
SYMBOLS must be a list of symbols or a symbol. |
| 4540 |
|
| 4541 |
-- Function: PACKAGE-NICKNAMES (package) |
| 4542 |
Package:LISP |
| 4543 |
|
| 4544 |
Returns as a list the nickname strings for the specified PACKAGE. |
| 4545 |
|
| 4546 |
-- Function: IMPORT (symbols &optional (package *package*)) |
| 4547 |
Package:LISP |
| 4548 |
|
| 4549 |
Makes SYMBOLS internal symbols of PACKAGE. SYMBOLS must be a list |
| 4550 |
of symbols or a symbol. |
| 4551 |
|
| 4552 |
-- Function: GET (symbol indicator &optional (default nil)) |
| 4553 |
Package:LISP |
| 4554 |
|
| 4555 |
Looks on the property list of SYMBOL for the specified INDICATOR. |
| 4556 |
If this is found, returns the associated value. Otherwise, returns |
| 4557 |
DEFAULT. |
| 4558 |
|
| 4559 |
-- Function: FIND-ALL-SYMBOLS (string-or-symbol) |
| 4560 |
Package:LISP |
| 4561 |
|
| 4562 |
Returns a list of all symbols that have the specified name. |
| 4563 |
|
| 4564 |
-- Function: FMAKUNBOUND (symbol) |
| 4565 |
Package:LISP |
| 4566 |
|
| 4567 |
Discards the global function definition named by SYMBOL. Returns |
| 4568 |
SYMBOL. |
| 4569 |
|
| 4570 |
-- Function: PACKAGE-NAME (package) |
| 4571 |
Package:LISP |
| 4572 |
|
| 4573 |
Returns the string that names the specified PACKAGE. |
| 4574 |
|
| 4575 |
-- Function: FIND-PACKAGE (name) |
| 4576 |
Package:LISP |
| 4577 |
|
| 4578 |
Returns the specified package if it already exists; NIL otherwise. |
| 4579 |
NAME may be a string that is the name or nickname of the package. |
| 4580 |
NAME may also be a symbol, in which case the symbol's print name is |
| 4581 |
used. |
| 4582 |
|
| 4583 |
-- Function: APROPOS-LIST (string &optional (package nil)) |
| 4584 |
Package:LISP |
| 4585 |
|
| 4586 |
Returns, as a list, all symbols whose print-names contain STRING as |
| 4587 |
substring. If PACKAGE is non-NIL, then only the specified package |
| 4588 |
is searched. |
| 4589 |
|
| 4590 |
|
| 4591 |
File: gcl-si.info, Node: Operating System, Next: Structures, Prev: Symbols, Up: Top |
| 4592 |
|
| 4593 |
9 Operating System |
| 4594 |
****************** |
| 4595 |
|
| 4596 |
* Menu: |
| 4597 |
|
| 4598 |
* Command Line:: |
| 4599 |
* Operating System Definitions:: |
| 4600 |
|
| 4601 |
|
| 4602 |
File: gcl-si.info, Node: Command Line, Next: Operating System Definitions, Prev: Operating System, Up: Operating System |
| 4603 |
|
| 4604 |
9.1 Command Line |
| 4605 |
================ |
| 4606 |
|
| 4607 |
The variable si::*command-args* is set to the list of strings passed in |
| 4608 |
when gcl is invoked. |
| 4609 |
|
| 4610 |
Various flags are understood. |
| 4611 |
'-eval' |
| 4612 |
Call read and then eval on the command argument following '-eval' |
| 4613 |
'-load' |
| 4614 |
Load the file whose pathname is specified after '-load'. |
| 4615 |
'-f' |
| 4616 |
Replace si::*command-args* by the the list starting after '-f'. |
| 4617 |
Open the file following '-f' for input, skip the first line, and |
| 4618 |
then read and eval the rest of the forms in the file. This can be |
| 4619 |
used as with the shells to write small shell programs: |
| 4620 |
#!/usr/local/bin/gcl.exe -f |
| 4621 |
(format t "hello world ~a~%" (nth 1 si::*command-args*)) |
| 4622 |
The value si::*command-args* will have the appropriate value. Thus |
| 4623 |
if the above 2 line file is made executable and called 'foo' then |
| 4624 |
tutorial% foo billy |
| 4625 |
hello world billy |
| 4626 |
NOTE: On many systems (eg SunOs) the first line of an executable |
| 4627 |
script file such as: |
| 4628 |
#!/usr/local/bin/gcl.exe -f |
| 4629 |
only reads the first 32 characters! So if your pathname where the |
| 4630 |
executable together with the '-f' amount to more than 32 characters |
| 4631 |
the file will not be recognized. Also the executable must be the |
| 4632 |
actual large binary file, [or a link to it], and not just a |
| 4633 |
'/bin/sh' script. In latter case the '/bin/sh' interpreter would |
| 4634 |
get invoked on the file. |
| 4635 |
|
| 4636 |
Alternately one could invoke the file 'foo' without making it |
| 4637 |
executable: |
| 4638 |
tutorial% gcl -f foo "from bill" |
| 4639 |
hello world from bill |
| 4640 |
|
| 4641 |
Finally perhaps the best way (why do we save the best for last.. I |
| 4642 |
guess because we only figure it out after all the others..) The |
| 4643 |
following file 'myhello' has 4 lines: |
| 4644 |
#!/bin/sh |
| 4645 |
#| Lisp will skip the next 2 lines on reading |
| 4646 |
exec gcl -f "$0" $ |# |
| 4647 |
(format t "hello world ~a~%" (nth 1 si::*command-args*)) |
| 4648 |
|
| 4649 |
marie% chmod a+x myhello |
| 4650 |
marie% myhello bill |
| 4651 |
hello world bill |
| 4652 |
|
| 4653 |
The advantage of this method is that 'gcl' can itself be a shell |
| 4654 |
script, which sets up environment and so on. Also the normal path |
| 4655 |
will be searched to find 'gcl' The disadvantage is that this would |
| 4656 |
cause 2 invocations of 'sh' and one invocation of 'gcl'. The plan |
| 4657 |
using 'gcl.exe' bypasses the 'sh' entirely. Inded invoking |
| 4658 |
'gcl.exe' to print 'hello world' is faster on most systems than a |
| 4659 |
similar 'csh' or 'bash' script, but slightly slower than the old |
| 4660 |
'sh'. |
| 4661 |
|
| 4662 |
'-batch' |
| 4663 |
Do not enter the command print loop. Useful if the other command |
| 4664 |
line arguments do something. Do not print the License and |
| 4665 |
acknowledgement information. Note if your program does print any |
| 4666 |
License information, it must print the GCL header information also. |
| 4667 |
'-dir' |
| 4668 |
Directory where the executable binary that is running is located. |
| 4669 |
Needed by save and friends. This gets set as |
| 4670 |
si::*system-directory* |
| 4671 |
'-libdir' |
| 4672 |
-libdir /d/wfs/gcl-2.0/ |
| 4673 |
would mean that the files like gcl-tk/tk.o would be found by |
| 4674 |
concatting the path to the libdir path, ie in |
| 4675 |
/d/wfs/gcl-2.0/gcl-tk/tk.o |
| 4676 |
'-compile' |
| 4677 |
Invoke the compiler on the filename following '-compile'. Other |
| 4678 |
flags affect compilation. |
| 4679 |
'-o-file' |
| 4680 |
If nil follows '-o-file' then do not produce an '.o' file. |
| 4681 |
'-c-file' |
| 4682 |
If '-c-file' is specified, leave the intermediate '.c' file there. |
| 4683 |
'-h-file' |
| 4684 |
If '-h-file' is specified, leave the intermediate '.h' file there. |
| 4685 |
'-data-file' |
| 4686 |
If '-data-file' is specified, leave the intermediate '.data' file |
| 4687 |
there. |
| 4688 |
'-system-p' |
| 4689 |
If '-system-p' is specified then invoke 'compile-file' with the |
| 4690 |
':system-p t' keyword argument, meaning that the C init function |
| 4691 |
will bear a name based on the name of the file, so that it may be |
| 4692 |
invoked by name by C code. |
| 4693 |
|
| 4694 |
|
| 4695 |
File: gcl-si.info, Node: Operating System Definitions, Prev: Command Line, Up: Operating System |
| 4696 |
|
| 4697 |
9.2 Operating System Definitions |
| 4698 |
================================ |
| 4699 |
|
| 4700 |
-- Function: GET-DECODED-TIME () |
| 4701 |
Package:LISP |
| 4702 |
|
| 4703 |
Returns the current time in decoded time format. Returns nine |
| 4704 |
values: second, minute, hour, date, month, year, day-of-week, |
| 4705 |
daylight-saving-time-p, and time-zone. |
| 4706 |
|
| 4707 |
-- Function: HOST-NAMESTRING (pathname) |
| 4708 |
Package:LISP |
| 4709 |
|
| 4710 |
Returns the host part of PATHNAME as a string. |
| 4711 |
|
| 4712 |
-- Function: RENAME-FILE (file new-name) |
| 4713 |
Package:LISP |
| 4714 |
|
| 4715 |
Renames the file FILE to NEW-NAME. FILE may be a string, a |
| 4716 |
pathname, or a stream. |
| 4717 |
|
| 4718 |
-- Function: FILE-AUTHOR (file) |
| 4719 |
Package:LISP |
| 4720 |
|
| 4721 |
Returns the author name of the specified file, as a string. FILE |
| 4722 |
may be a string or a stream |
| 4723 |
|
| 4724 |
-- Function: PATHNAME-HOST (pathname) |
| 4725 |
Package:LISP |
| 4726 |
|
| 4727 |
Returns the host slot of PATHNAME. |
| 4728 |
|
| 4729 |
-- Function: FILE-POSITION (file-stream &optional position) |
| 4730 |
Package:LISP |
| 4731 |
|
| 4732 |
Sets the file pointer of the specified file to POSITION, if |
| 4733 |
POSITION is given. Otherwise, returns the current file position of |
| 4734 |
the specified file. |
| 4735 |
|
| 4736 |
-- Function: DECODE-UNIVERSAL-TIME (universal-time &optional (timezone |
| 4737 |
-9)) |
| 4738 |
Package:LISP |
| 4739 |
|
| 4740 |
Converts UNIVERSAL-TIME into a decoded time at the TIMEZONE. |
| 4741 |
Returns nine values: second, minute, hour, date, month (1 - 12), |
| 4742 |
year, day-of-week (0 - 6), daylight-saving-time-p, and time-zone. |
| 4743 |
TIMEZONE in GCL defaults to 6, the time zone of Austin, Texas. |
| 4744 |
|
| 4745 |
-- Function: USER-HOMEDIR-PATHNAME (&optional host) |
| 4746 |
Package:LISP |
| 4747 |
|
| 4748 |
Returns the home directory of the logged in user as a pathname. |
| 4749 |
HOST is ignored. |
| 4750 |
|
| 4751 |
-- Variable: *MODULES* |
| 4752 |
Package:LISP A list of names of the modules that have been loaded |
| 4753 |
into GCL. |
| 4754 |
|
| 4755 |
-- Function: SHORT-SITE-NAME () |
| 4756 |
Package:LISP |
| 4757 |
|
| 4758 |
Returns a string that identifies the physical location of the |
| 4759 |
current GCL. |
| 4760 |
|
| 4761 |
-- Function: DIRECTORY (name) |
| 4762 |
Package:LISP |
| 4763 |
|
| 4764 |
Returns a list of files that match NAME. NAME may be a string, a |
| 4765 |
pathname, or a file stream. |
| 4766 |
|
| 4767 |
-- Function: SOFTWARE-VERSION () |
| 4768 |
Package:LISP |
| 4769 |
|
| 4770 |
Returns a string that identifies the software version of the |
| 4771 |
software under which GCL is currently running. |
| 4772 |
|
| 4773 |
-- Constant: INTERNAL-TIME-UNITS-PER-SECOND |
| 4774 |
Package:LISP The number of internal time units that fit into a |
| 4775 |
second. |
| 4776 |
|
| 4777 |
-- Function: ENOUGH-NAMESTRING (pathname &optional (defaults |
| 4778 |
*default-pathname-defaults*)) |
| 4779 |
Package:LISP |
| 4780 |
|
| 4781 |
Returns a string which uniquely identifies PATHNAME with respect to |
| 4782 |
DEFAULTS. |
| 4783 |
|
| 4784 |
-- Function: REQUIRE (module-name &optional (pathname)) |
| 4785 |
Package:LISP |
| 4786 |
|
| 4787 |
If the specified module is not present, then loads the appropriate |
| 4788 |
file(s). PATHNAME may be a single pathname or it may be a list of |
| 4789 |
pathnames. |
| 4790 |
|
| 4791 |
-- Function: ENCODE-UNIVERSAL-TIME (second minute hour date month year |
| 4792 |
&optional (timezone )) |
| 4793 |
Package:LISP |
| 4794 |
|
| 4795 |
Does the inverse operation of DECODE-UNIVERSAL-TIME. |
| 4796 |
|
| 4797 |
-- Function: LISP-IMPLEMENTATION-VERSION () |
| 4798 |
Package:LISP |
| 4799 |
|
| 4800 |
Returns a string that tells you when the current GCL implementation |
| 4801 |
is brought up. |
| 4802 |
|
| 4803 |
-- Function: MACHINE-INSTANCE () |
| 4804 |
Package:LISP |
| 4805 |
|
| 4806 |
Returns a string that identifies the machine instance of the |
| 4807 |
machine on which GCL is currently running. |
| 4808 |
|
| 4809 |
-- Function: ROOM (&optional (x t)) |
| 4810 |
Package:LISP |
| 4811 |
|
| 4812 |
Displays information about storage allocation in the following |
| 4813 |
format. |
| 4814 |
|
| 4815 |
for each type class |
| 4816 |
the number of pages so-far allocated for the type class |
| 4817 |
the maximum number of pages for the type class |
| 4818 |
the percentage of used cells to cells so-far allocated |
| 4819 |
the number of times the garbage collector has been called |
| 4820 |
to collect cells of the type class |
| 4821 |
the implementation types that belongs to the type class |
| 4822 |
the number of pages actually allocated for contiguous blocks |
| 4823 |
the maximum number of pages for contiguous blocks |
| 4824 |
the number of times the garbage collector has been called to |
| 4825 |
collect contiguous blocks |
| 4826 |
the number of pages in the hole |
| 4827 |
the maximum number of pages for relocatable blocks |
| 4828 |
the number of times the garbage collector has been called to |
| 4829 |
collect relocatable blocks |
| 4830 |
the total number of pages allocated for cells |
| 4831 |
the total number of pages allocated |
| 4832 |
the number of available pages |
| 4833 |
the number of pages GCL can use. |
| 4834 |
|
| 4835 |
The number of times the garbage collector has been called is |
| 4836 |
not shown, if the number is zero. The optional X is ignored. |
| 4837 |
|
| 4838 |
-- Function: GET-UNIVERSAL-TIME () |
| 4839 |
Package:LISP |
| 4840 |
|
| 4841 |
Returns the current time as a single integer in universal time |
| 4842 |
format. |
| 4843 |
|
| 4844 |
-- Function: GET-INTERNAL-RUN-TIME () |
| 4845 |
Package:LISP |
| 4846 |
|
| 4847 |
Returns the run time in the internal time format. This is useful |
| 4848 |
for finding CPU usage. If the operating system allows, a second |
| 4849 |
value containing CPU usage of child processes is returned. |
| 4850 |
|
| 4851 |
-- Variable: *DEFAULT-PATHNAME-DEFAULTS* |
| 4852 |
Package:LISP The default pathname-defaults pathname. |
| 4853 |
|
| 4854 |
-- Function: LONG-SITE-NAME () |
| 4855 |
Package:LISP |
| 4856 |
|
| 4857 |
Returns a string that identifies the physical location of the |
| 4858 |
current GCL. |
| 4859 |
|
| 4860 |
-- Function: DELETE-FILE (file) |
| 4861 |
Package:LISP Deletes FILE. |
| 4862 |
|
| 4863 |
-- Function: GET-INTERNAL-REAL-TIME () |
| 4864 |
Package:LISP |
| 4865 |
|
| 4866 |
Returns the real time in the internal time format. This is useful |
| 4867 |
for finding elapsed time. |
| 4868 |
|
| 4869 |
-- Function: MACHINE-TYPE () |
| 4870 |
Package:LISP |
| 4871 |
|
| 4872 |
Returns a string that identifies the machine type of the machine on |
| 4873 |
which GCL is currently running. |
| 4874 |
|
| 4875 |
-- Macro: TIME |
| 4876 |
Package:LISP |
| 4877 |
|
| 4878 |
Syntax: |
| 4879 |
(time form) |
| 4880 |
|
| 4881 |
Evaluates FORM and outputs timing statistics on *TRACE-OUTPUT*. |
| 4882 |
|
| 4883 |
-- Function: SOFTWARE-TYPE () |
| 4884 |
Package:LISP |
| 4885 |
|
| 4886 |
Returns a string that identifies the software type of the software |
| 4887 |
under which GCL is currently running. |
| 4888 |
|
| 4889 |
-- Function: LISP-IMPLEMENTATION-TYPE () |
| 4890 |
Package:LISP |
| 4891 |
|
| 4892 |
Returns a string that tells you that you are using a version of |
| 4893 |
GCL. |
| 4894 |
|
| 4895 |
-- Function: SLEEP (n) |
| 4896 |
Package:LISP |
| 4897 |
|
| 4898 |
This function causes execution to be suspended for N seconds. N |
| 4899 |
may be any non-negative, non-complex number. |
| 4900 |
|
| 4901 |
-- Function: BREAK-ON-FLOATING-POINT-EXCEPTIONS (&key division-by-zero |
| 4902 |
floating-point-invalid-operation floating-point-overflow |
| 4903 |
floating-point-underflow floating-point-inexact) Package:SI |
| 4904 |
|
| 4905 |
Break on the specified IEEE floating point error conditions. With |
| 4906 |
no arguments, report the exceptions currently trapped. Disable the |
| 4907 |
break by setting the key to nil, e.g. |
| 4908 |
|
| 4909 |
> (break-on-floaing-point-exceptions :division-by-zero t) |
| 4910 |
(DIVISION-BY-ZERO) |
| 4911 |
|
| 4912 |
> (break-on-floaing-point-exceptions) (DIVISION-BY-ZERO) |
| 4913 |
|
| 4914 |
> (break-on-floaing-point-exceptions :division-by-zero nil) NIL |
| 4915 |
|
| 4916 |
On some of the most common platforms, the offending instruction |
| 4917 |
will be disassembled, and the register arguments looked up in the |
| 4918 |
saved context and reported in as operands. Within the error |
| 4919 |
handler, addresses may be disassembled, and other registers |
| 4920 |
inspected, using the functions defined in gcl_fpe.lsp. |
| 4921 |
|
| 4922 |
|
| 4923 |
File: gcl-si.info, Node: Structures, Next: Iteration and Tests, Prev: Operating System, Up: Top |
| 4924 |
|
| 4925 |
10 Structures |
| 4926 |
************* |
| 4927 |
|
| 4928 |
-- Macro: DEFSTRUCT |
| 4929 |
Package:LISP |
| 4930 |
|
| 4931 |
Syntax: |
| 4932 |
(defstruct |
| 4933 |
{name | (name {:conc-name | (:conc-name prefix-string) | |
| 4934 |
:constructor | (:constructor symbol [lambda-list]) | |
| 4935 |
:copier | (:copier symbol) | |
| 4936 |
:predicate | (:predicate symbol) | |
| 4937 |
(:include symbol) | |
| 4938 |
(:print-function function) | |
| 4939 |
(:type {vector | (vector type) | list}) | |
| 4940 |
:named | (:static { nil | t}) |
| 4941 |
(:initial-offset number)}*)} |
| 4942 |
[doc] |
| 4943 |
{slot-name | |
| 4944 |
(slot-name [default-value-form] {:type type | :read-only flag}*) }* |
| 4945 |
) |
| 4946 |
|
| 4947 |
Defines a structure. The doc-string DOC, if supplied, is saved as |
| 4948 |
a STRUCTURE doc and can be retrieved by (documentation 'NAME |
| 4949 |
'structure). STATIC is gcl specific and makes the body non |
| 4950 |
relocatable. |
| 4951 |
|
| 4952 |
See the files misc/rusage.lsp misc/cstruct.lsp, for examples of |
| 4953 |
making a lisp structure correspond to a C structure. |
| 4954 |
|
| 4955 |
-- Function: HELP (&optional symbol) |
| 4956 |
Package:LISP |
| 4957 |
|
| 4958 |
GCL specific: Prints the documentation associated with SYMBOL. With |
| 4959 |
no argument, this function prints the greeting message to GCL |
| 4960 |
beginners. |
| 4961 |
|
| 4962 |
|
| 4963 |
File: gcl-si.info, Node: Iteration and Tests, Next: User Interface, Prev: Structures, Up: Top |
| 4964 |
|
| 4965 |
11 Iteration and Tests |
| 4966 |
********************** |
| 4967 |
|
| 4968 |
-- Macro: DO-EXTERNAL-SYMBOLS |
| 4969 |
Package:LISP |
| 4970 |
|
| 4971 |
Syntax: |
| 4972 |
(do-external-symbols (var [package [result-form]]) |
| 4973 |
{decl}* {tag | statement}*) |
| 4974 |
|
| 4975 |
Executes STATEMENTs once for each external symbol in the PACKAGE |
| 4976 |
(which defaults to the current package), with VAR bound to the |
| 4977 |
current symbol. Then evaluates RESULT-FORM (which defaults to NIL) |
| 4978 |
and returns the value(s). |
| 4979 |
|
| 4980 |
-- Special Form: DO* |
| 4981 |
Package:LISP |
| 4982 |
|
| 4983 |
Syntax: |
| 4984 |
(do* ({(var [init [step]])}*) (endtest {result}*) |
| 4985 |
{decl}* {tag | statement}*) |
| 4986 |
|
| 4987 |
Just like DO, but performs variable bindings and assignments in |
| 4988 |
serial, just like LET* and SETQ do. |
| 4989 |
|
| 4990 |
-- Macro: DO-ALL-SYMBOLS |
| 4991 |
Package:LISP |
| 4992 |
|
| 4993 |
Syntax: |
| 4994 |
(do-all-symbols (var [result-form]) {decl}* {tag | statement}*) |
| 4995 |
|
| 4996 |
Executes STATEMENTs once for each symbol in each package, with VAR |
| 4997 |
bound to the current symbol. Then evaluates RESULT-FORM (which |
| 4998 |
defaults to NIL) and returns the value(s). |
| 4999 |
|
| 5000 |
-- Function: YES-OR-NO-P (&optional (format-string nil) &rest args) |
| 5001 |
Package:LISP |
| 5002 |
|
| 5003 |
Asks the user a question whose answer is either 'YES' or 'NO'. If |
| 5004 |
FORMAT- STRING is non-NIL, then FRESH-LINE operation is performed, |
| 5005 |
a message is printed as if FORMAT-STRING and ARGs were given to |
| 5006 |
FORMAT, and then a prompt "(Yes or No)" is printed. Otherwise, no |
| 5007 |
prompt will appear. |
| 5008 |
|
| 5009 |
-- Function: MAPHASH #'hash-table |
| 5010 |
Package:LISP |
| 5011 |
|
| 5012 |
For each entry in HASH-TABLE, calls FUNCTION on the key and value |
| 5013 |
of the entry; returns NIL. |
| 5014 |
|
| 5015 |
-- Function: MAPCAR (fun list &rest more-lists) |
| 5016 |
Package:LISP |
| 5017 |
|
| 5018 |
Applies FUN to successive cars of LISTs and returns the results as |
| 5019 |
a list. |
| 5020 |
|
| 5021 |
-- Special Form: DOLIST |
| 5022 |
Package:LISP |
| 5023 |
|
| 5024 |
Syntax: |
| 5025 |
(dolist (var listform [result]) {decl}* {tag | statement}*) |
| 5026 |
|
| 5027 |
Executes STATEMENTs, with VAR bound to each member of the list |
| 5028 |
value of LISTFORM. Then returns the value(s) of RESULT (which |
| 5029 |
defaults to NIL). |
| 5030 |
|
| 5031 |
-- Function: EQ (x y) |
| 5032 |
Package:LISP |
| 5033 |
|
| 5034 |
Returns T if X and Y are the same identical object; NIL otherwise. |
| 5035 |
|
| 5036 |
-- Function: EQUALP (x y) |
| 5037 |
Package:LISP |
| 5038 |
|
| 5039 |
Returns T if X and Y are EQUAL, if they are characters and satisfy |
| 5040 |
CHAR-EQUAL, if they are numbers and have the same numerical value, |
| 5041 |
or if they have components that are all EQUALP. Returns NIL |
| 5042 |
otherwise. |
| 5043 |
|
| 5044 |
-- Function: EQUAL (x y) |
| 5045 |
Package:LISP |
| 5046 |
|
| 5047 |
Returns T if X and Y are EQL or if they are of the same type and |
| 5048 |
corresponding components are EQUAL. Returns NIL otherwise. Strings |
| 5049 |
and bit-vectors are EQUAL if they are the same length and have |
| 5050 |
identical components. Other arrays must be EQ to be EQUAL. |
| 5051 |
|
| 5052 |
-- Macro: DO-SYMBOLS |
| 5053 |
Package:LISP |
| 5054 |
|
| 5055 |
Syntax: |
| 5056 |
(do-symbols (var [package [result-form]]) {decl}* {tag | |
| 5057 |
statement}*) |
| 5058 |
|
| 5059 |
Executes STATEMENTs once for each symbol in the PACKAGE (which |
| 5060 |
defaults to the current package), with VAR bound to the current |
| 5061 |
symbol. Then evaluates RESULT-FORM (which defaults to NIL) and |
| 5062 |
returns the value(s). |
| 5063 |
|
| 5064 |
-- Special Form: LOOP |
| 5065 |
Package:LISP |
| 5066 |
|
| 5067 |
Syntax: |
| 5068 |
(loop {form}*) |
| 5069 |
|
| 5070 |
Executes FORMs repeatedly until exited by a THROW or RETURN. The |
| 5071 |
FORMs are surrounded by an implicit NIL block. |
| 5072 |
|
| 5073 |
|
| 5074 |
File: gcl-si.info, Node: User Interface, Next: Doc, Prev: Iteration and Tests, Up: Top |
| 5075 |
|
| 5076 |
12 User Interface |
| 5077 |
***************** |
| 5078 |
|
| 5079 |
-- Special Variable: - |
| 5080 |
Package:LISP Holds the top-level form that GCL is currently |
| 5081 |
evaluating. |
| 5082 |
|
| 5083 |
-- Function: - (number &rest more-numbers) |
| 5084 |
Package:LISP |
| 5085 |
|
| 5086 |
Subtracts the second and all subsequent NUMBERs from the first |
| 5087 |
NUMBER. With one arg, negates it. |
| 5088 |
|
| 5089 |
-- Macro: UNTRACE |
| 5090 |
Package:LISP |
| 5091 |
|
| 5092 |
Syntax: |
| 5093 |
(untrace {function-name}*) |
| 5094 |
|
| 5095 |
Removes tracing from the specified functions. With no |
| 5096 |
FUNCTION-NAMEs, untraces all functions. |
| 5097 |
|
| 5098 |
-- Variable: *** |
| 5099 |
Package:LISP Gets the previous value of ** when GCL evaluates a |
| 5100 |
top-level form. |
| 5101 |
|
| 5102 |
-- Function: MAKE-STRING-INPUT-STREAM (string &optional (start 0) (end |
| 5103 |
(length string))) |
| 5104 |
Package:LISP |
| 5105 |
|
| 5106 |
Returns an input stream which will supply the characters of String |
| 5107 |
between Start and End in order. |
| 5108 |
|
| 5109 |
-- Macro: STEP |
| 5110 |
Package:LISP |
| 5111 |
|
| 5112 |
Syntax: |
| 5113 |
(step form) |
| 5114 |
|
| 5115 |
Evaluates FORM in the single-step mode and returns the value. |
| 5116 |
|
| 5117 |
-- Variable: *BREAK-ENABLE* |
| 5118 |
Package:LISP GCL specific: When an error occurrs, control enters to |
| 5119 |
the break loop only if the value of this variable is non-NIL. |
| 5120 |
|
| 5121 |
-- Special Variable: / |
| 5122 |
Package:LISP Holds a list of the values of the last top-level form. |
| 5123 |
|
| 5124 |
-- Function: DESCRIBE (x) |
| 5125 |
Package:LISP |
| 5126 |
|
| 5127 |
Prints a description of the object X. |
| 5128 |
|
| 5129 |
-- Function: ED (&optional x) |
| 5130 |
Package:LISP |
| 5131 |
|
| 5132 |
Invokes the editor. The action depends on the version of GCL. |
| 5133 |
|
| 5134 |
-- Variable: *DEBUG-IO* |
| 5135 |
Package:LISP Holds the I/O stream used by the GCL debugger. |
| 5136 |
|
| 5137 |
-- Variable: *BREAK-ON-WARNINGS* |
| 5138 |
Package:LISP When the function WARN is called, control enters to |
| 5139 |
the break loop only if the value of this varialbe is non-NIL. |
| 5140 |
|
| 5141 |
-- Function: CERROR (continue-format-string error-format-string &rest |
| 5142 |
args) |
| 5143 |
Package:LISP |
| 5144 |
|
| 5145 |
Signals a correctable error. |
| 5146 |
|
| 5147 |
-- Variable: ** |
| 5148 |
Package:LISP Gets the previous value of * when GCL evaluates a |
| 5149 |
top-level form. |
| 5150 |
|
| 5151 |
-- Special Variable: +++ |
| 5152 |
Package:LISP Gets the previous value of ++ when GCL evaluates a |
| 5153 |
top-level form. |
| 5154 |
|
| 5155 |
-- Function: INSPECT (x) |
| 5156 |
Package:LISP |
| 5157 |
|
| 5158 |
Shows the information about the object X in an interactive manner |
| 5159 |
|
| 5160 |
-- Special Variable: // |
| 5161 |
Package:LISP Gets the previous value of / when GCL evaluates a |
| 5162 |
top-level form. |
| 5163 |
|
| 5164 |
-- Variable: *TRACE-OUTPUT* |
| 5165 |
Package:LISP The trace output stream. |
| 5166 |
|
| 5167 |
-- Special Variable: ++ |
| 5168 |
Package:LISP Gets the previous value of + when GCL evaluates a |
| 5169 |
top-level form. |
| 5170 |
|
| 5171 |
-- Variable: *ERROR-OUTPUT* |
| 5172 |
Package:LISP Holds the output stream for error messages. |
| 5173 |
|
| 5174 |
-- Function: DRIBBLE (&optional pathname) |
| 5175 |
Package:LISP |
| 5176 |
|
| 5177 |
If PATHNAME is given, begins to record the interaction to the |
| 5178 |
specified file. If PATHNAME is not given, ends the recording. |
| 5179 |
|
| 5180 |
-- Variable: * |
| 5181 |
Package:LISP Holds the value of the last top-level form. |
| 5182 |
|
| 5183 |
-- Special Variable: /// |
| 5184 |
Package:LISP Gets the previous value of // when GCL evaluates a |
| 5185 |
top-level form. |
| 5186 |
|
| 5187 |
-- Function: WARN (format-string &rest args) |
| 5188 |
Package:LISP |
| 5189 |
|
| 5190 |
Formats FORMAT-STRING and ARGs to *ERROR-OUTPUT* as a warning |
| 5191 |
message. |
| 5192 |
|
| 5193 |
-- Function: BREAK (&optional (format-string nil) &rest args) |
| 5194 |
Package:LISP |
| 5195 |
|
| 5196 |
Enters a break loop. If FORMAT-STRING is non-NIL, formats |
| 5197 |
FORMAT-STRING and ARGS to *ERROR-OUTPUT* before entering a break |
| 5198 |
loop. Typing :HELP at the break loop will list the break-loop |
| 5199 |
commands. |
| 5200 |
|
| 5201 |
-- Special Variable: + |
| 5202 |
Package:LISP Holds the last top-level form. |
| 5203 |
|
| 5204 |
-- Macro: TRACE |
| 5205 |
Package:LISP |
| 5206 |
|
| 5207 |
Syntax: |
| 5208 |
(trace {function-name}*) |
| 5209 |
|
| 5210 |
Traces the specified functions. With no FUNCTION-NAMEs, returns a |
| 5211 |
list of functions currently being traced. |
| 5212 |
|
| 5213 |
Additional Keywords are allowed in GCL with the syntax (trace {fn | |
| 5214 |
(fn {:kw form}*)}*) |
| 5215 |
|
| 5216 |
For each FN naming a function, traces that function. Each :KW |
| 5217 |
should be one of the ones listed below, and FORM should have the |
| 5218 |
corresponding form. No :KW may be given more than once for the |
| 5219 |
same FN. Returns a list of all FNs now traced which weren't already |
| 5220 |
traced. |
| 5221 |
|
| 5222 |
EXAMPLE (Try this with your favorite factorial function FACT): |
| 5223 |
|
| 5224 |
;; print entry args and exit values |
| 5225 |
|
| 5226 |
(trace FACT) |
| 5227 |
|
| 5228 |
;; Break coming out of FACT if the value is bigger than 1000. |
| 5229 |
|
| 5230 |
(trace (fact :exit |
| 5231 |
(progn |
| 5232 |
(if (> (car values) 1000)(break "big result")) |
| 5233 |
(car values)))) |
| 5234 |
|
| 5235 |
;; Hairy example: |
| 5236 |
|
| 5237 |
;;make arglist available without the si:: prefix |
| 5238 |
(import 'si::arglist) |
| 5239 |
|
| 5240 |
(trace (fact |
| 5241 |
:DECLARATIONS |
| 5242 |
((in-string "Here comes input: ") |
| 5243 |
(out-string "Here comes output: ") |
| 5244 |
all-values |
| 5245 |
(silly (+ 3 4))) |
| 5246 |
:COND |
| 5247 |
(equal (rem (car arglist) 2) 0) |
| 5248 |
:ENTRY |
| 5249 |
(progn |
| 5250 |
(cond |
| 5251 |
((equal (car arglist) 8) |
| 5252 |
(princ "Entering FACT on input 8!! ") |
| 5253 |
(setq out-string "Here comes output from inside (FACT 8): ")) |
| 5254 |
(t |
| 5255 |
(princ in-string))) |
| 5256 |
(car arglist)) |
| 5257 |
:EXIT |
| 5258 |
(progn |
| 5259 |
(setq all-values (cons (car values) all-values)) |
| 5260 |
(princ out-string) |
| 5261 |
(when (equal (car arglist) 8) |
| 5262 |
;; reset out-string |
| 5263 |
(setq out-string "Here comes output: ")) |
| 5264 |
(cons 'fact values)) |
| 5265 |
:ENTRYCOND |
| 5266 |
(not (= (car arglist) 6)) |
| 5267 |
:EXITCOND |
| 5268 |
(not (= (car values) (* 6 (car arglist)))) |
| 5269 |
:DEPTH |
| 5270 |
5)) |
| 5271 |
|
| 5272 |
Syntax is ':keyword' form1 ':keyword' form2 ... |
| 5273 |
|
| 5274 |
':declarations' |
| 5275 |
DEFAULT: NIL |
| 5276 |
|
| 5277 |
FORM is ((var1 form1 )(var2 form2 )...), where the var_i are |
| 5278 |
symbols distinct from each other and from all symbols which |
| 5279 |
are similarly declared for currently traced functions. Each |
| 5280 |
form is evaluated immediately. Upon any invocation of a |
| 5281 |
traced function when not already inside a traced function |
| 5282 |
call, each var is bound to that value of form . |
| 5283 |
|
| 5284 |
':COND' |
| 5285 |
DEFAULT: T |
| 5286 |
|
| 5287 |
Here, FORM is any Lisp form to be evaluated (by EVAL) upon |
| 5288 |
entering a call of FN, in the environment where si::ARGLIST is |
| 5289 |
bound to the current list of arguments of FN. Note that even |
| 5290 |
if the evaluation of FORM changes the value of SI::ARGLIST |
| 5291 |
(e.g. by evaluation of (SETQ si::ARGLIST ...)), the list of |
| 5292 |
arguments passed to FN is unchanged. Users may alter args |
| 5293 |
passed by destructively modifying the list structure of |
| 5294 |
SI::ARGLIST however. The call is traced (thus invoking the |
| 5295 |
:ENTRYCOND and :EXITCOND forms, at least) if and only if FORM |
| 5296 |
does not evaluate to NIL. |
| 5297 |
|
| 5298 |
':ENTRYCOND' |
| 5299 |
DEFAULT: T |
| 5300 |
|
| 5301 |
This is evaluated (by EVAL) if the :COND form evaluates to |
| 5302 |
non-NIL, both in an environment where SI::ARGLIST is bound to |
| 5303 |
the current list of arguments of FN. If non-NIL, the :ENTRY |
| 5304 |
form is then evaluated and printed with the trace "prompt". |
| 5305 |
|
| 5306 |
':ENTRY' |
| 5307 |
DEFAULT: (CONS (QUOTE x) SI::ARGLIST), |
| 5308 |
|
| 5309 |
where x is the symbol we call FN If the :COND and :ENTRYCOND |
| 5310 |
forms evaluate to non-NIL, then the trace "prompt" is printed |
| 5311 |
and then this FORM is evaluated (by EVAL) in an environment |
| 5312 |
where SI::ARGLIST is bound to the current list of arguments of |
| 5313 |
FN. The result is then printed. |
| 5314 |
|
| 5315 |
':EXITCOND' |
| 5316 |
DEFAULT: T |
| 5317 |
|
| 5318 |
This is evaluated (by EVAL) in the environment described below |
| 5319 |
for the :EXIT form. The :EXIT form is then evaluated and |
| 5320 |
printed with the "prompt" if and only if the result here is |
| 5321 |
non-NIL. |
| 5322 |
|
| 5323 |
':EXIT' |
| 5324 |
DEFAULT: (CONS (QUOTE x) VALUES), |
| 5325 |
|
| 5326 |
where x is the symbol we call FN Upon exit from tracing a |
| 5327 |
given call, this FORM is evaluated (after the appropriate |
| 5328 |
trace "prompt" is printed), using EVAL in an environment where |
| 5329 |
SI::ARGLIST is bound to the current list of arguments of FN |
| 5330 |
and VALUES is bound to the list of values returned by FN |
| 5331 |
(recalling that Common Lisp functions may return multiple |
| 5332 |
values). |
| 5333 |
|
| 5334 |
':DEPTH' |
| 5335 |
DEFAULT: No depth limit |
| 5336 |
|
| 5337 |
FORM is simply a positive integer specifying the maximum |
| 5338 |
nesting of traced calls of FN, i.e. of calls of FN in which |
| 5339 |
the :COND form evaluated to non-NIL. For calls of FN in which |
| 5340 |
this limit is exceeded, even the :COND form is not evaluated, |
| 5341 |
and the call is not traced. |
| 5342 |
|
| 5343 |
|
| 5344 |
File: gcl-si.info, Node: Doc, Next: Type, Prev: User Interface, Up: Top |
| 5345 |
|
| 5346 |
13 Doc |
| 5347 |
****** |
| 5348 |
|
| 5349 |
-- Function: APROPOS (string &optional (package nil)) |
| 5350 |
Package:LISP |
| 5351 |
|
| 5352 |
Prints those symbols whose print-names contain STRING as substring. |
| 5353 |
If PACKAGE is non-NIL, then only the specified package is searched. |
| 5354 |
|
| 5355 |
-- Function: INFO (string &optional (list-of-info-files |
| 5356 |
*default-info-files*)) |
| 5357 |
PACKAGE:SI |
| 5358 |
|
| 5359 |
Find all documentation about STRING in LIST-OF-INFO-FILES. The |
| 5360 |
search is done for STRING as a substring of a node name, or for |
| 5361 |
STRING in the indexed entries in the first index for each info |
| 5362 |
file. Typically that should be a variable and function definition |
| 5363 |
index, if the info file is about a programming language. If the |
| 5364 |
windowing system is connected, then a choice box is offered and |
| 5365 |
double clicking on an item brings up its documentation. |
| 5366 |
|
| 5367 |
Otherwise a list of choices is offered and the user may select some |
| 5368 |
of these choices. |
| 5369 |
|
| 5370 |
list-of-info-files is of the form |
| 5371 |
("gcl-si.info" "gcl-tk.info" "gcl.info") |
| 5372 |
The above list is the default value of *default-info-files*, a |
| 5373 |
variable in the SI package. To find these files in the file |
| 5374 |
system, the search path *info-paths* is consulted as is the master |
| 5375 |
info directory 'dir'. |
| 5376 |
|
| 5377 |
see *Index *default-info-files*:: and *Index *info-paths*::. For |
| 5378 |
example |
| 5379 |
(info "defun") |
| 5380 |
|
| 5381 |
0: DEFUN :(gcl-si.info)Special Forms and Functions. |
| 5382 |
1: (gcl.info)defun. |
| 5383 |
Enter n, all, none, or multiple choices eg 1 3 : 1 |
| 5384 |
|
| 5385 |
Info from file /home/wfs/gcl-doc/gcl.info: |
| 5386 |
defun [Macro] |
| 5387 |
--------------------------------------------------------------------------- |
| 5388 |
`Defun' function-name lambda-list [[{declaration}* | documentation]] |
| 5389 |
... |
| 5390 |
|
| 5391 |
would list the node '(gcl.info)defun'. That is the node entitled |
| 5392 |
'defun' from the info file gcl.info. That documentation is based |
| 5393 |
on the ANSI common lisp standard. The choice |
| 5394 |
DEFUN :(gcl-si.info)Special Forms and Functions. |
| 5395 |
|
| 5396 |
refers to the documentation on DEFUN from the info file gcl-si.info |
| 5397 |
in the node Special Forms And Functions. This is an index |
| 5398 |
reference and only the part of the node which refers to 'defun' |
| 5399 |
will be printed. |
| 5400 |
|
| 5401 |
(info "factor" '("maxima.info")) |
| 5402 |
would search the maxima info files index and nodes for 'factor'. |
| 5403 |
|
| 5404 |
-- Variable: *info-paths* |
| 5405 |
Package SI: |
| 5406 |
|
| 5407 |
A list of strings such as |
| 5408 |
'("" "/usr/info/" "/usr/local/lib/info/" "/usr/local/info/" |
| 5409 |
"/usr/local/gnu/info/" ) |
| 5410 |
saying where to look for the info files. It is used implicitly by |
| 5411 |
'info', see *Index info::. |
| 5412 |
|
| 5413 |
Looking for maxima.info would look for the file maxima.info in all |
| 5414 |
the directories listed in *info-paths*. If nto found then it would |
| 5415 |
look for 'dir' in the *info-paths* directories, and if it were |
| 5416 |
found it would look in the 'dir' for a menu item such as |
| 5417 |
|
| 5418 |
* maxima: (/home/wfs/maxima-5.0/info/maxima.info). |
| 5419 |
|
| 5420 |
If such an entry exists then the directory there would be used for |
| 5421 |
the purpose of finding 'maxima.info' |
| 5422 |
|
| 5423 |
|
| 5424 |
File: gcl-si.info, Node: Type, Next: GCL Specific, Prev: Doc, Up: Top |
| 5425 |
|
| 5426 |
14 Type |
| 5427 |
******* |
| 5428 |
|
| 5429 |
-- Function: COERCE (x type) |
| 5430 |
Package:LISP |
| 5431 |
|
| 5432 |
Coerces X to an object of the type TYPE. |
| 5433 |
|
| 5434 |
-- Function: TYPE-OF (x) |
| 5435 |
Package:LISP |
| 5436 |
|
| 5437 |
Returns the type of X. |
| 5438 |
|
| 5439 |
-- Function: CONSTANTP (symbol) |
| 5440 |
Package:LISP |
| 5441 |
|
| 5442 |
Returns T if the variable named by SYMBOL is a constant; NIL |
| 5443 |
otherwise. |
| 5444 |
|
| 5445 |
-- Function: TYPEP (x type) |
| 5446 |
Package:LISP |
| 5447 |
|
| 5448 |
Returns T if X is of the type TYPE; NIL otherwise. |
| 5449 |
|
| 5450 |
-- Function: COMMONP (x) |
| 5451 |
Package:LISP |
| 5452 |
|
| 5453 |
Returns T if X is a Common Lisp object; NIL otherwise. |
| 5454 |
|
| 5455 |
-- Function: SUBTYPEP (type1 type2) |
| 5456 |
Package:LISP |
| 5457 |
|
| 5458 |
Returns T if TYPE1 is a subtype of TYPE2; NIL otherwise. If it |
| 5459 |
could not determine, then returns NIL as the second value. |
| 5460 |
Otherwise, the second value is T. |
| 5461 |
|
| 5462 |
-- Macro: CHECK-TYPE |
| 5463 |
Package:LISP |
| 5464 |
|
| 5465 |
Syntax: |
| 5466 |
(check-type place typespec [string]) |
| 5467 |
|
| 5468 |
Signals an error, if the contents of PLACE are not of the specified |
| 5469 |
type. |
| 5470 |
|
| 5471 |
-- Macro: ASSERT |
| 5472 |
Package:LISP |
| 5473 |
|
| 5474 |
Syntax: |
| 5475 |
(assert test-form [({place}*) [string {arg}*]]) |
| 5476 |
|
| 5477 |
Signals an error if the value of TEST-FORM is NIL. STRING is an |
| 5478 |
format string used as the error message. ARGs are arguments to the |
| 5479 |
format string. |
| 5480 |
|
| 5481 |
-- Macro: DEFTYPE |
| 5482 |
Package:LISP |
| 5483 |
|
| 5484 |
Syntax: |
| 5485 |
(deftype name lambda-list {decl | doc}* {form}*) |
| 5486 |
|
| 5487 |
Defines a new type-specifier abbreviation in terms of an |
| 5488 |
'expansion' function (lambda lambda-list1 {decl}* {form}*) where |
| 5489 |
lambda-list1 is identical to LAMBDA-LIST except that all optional |
| 5490 |
parameters with no default value specified in LAMBDA-LIST defaults |
| 5491 |
to the symbol '*', but not to NIL. When the type system of GCL |
| 5492 |
encounters a type specifier (NAME arg1 ... argn), it calls the |
| 5493 |
expansion function with the arguments arg1 ... argn, and uses the |
| 5494 |
returned value instead of the original type specifier. When the |
| 5495 |
symbol NAME is used as a type specifier, the expansion function is |
| 5496 |
called with no argument. The doc-string DOC, if supplied, is saved |
| 5497 |
as the TYPE doc of NAME, and is retrieved by (documentation 'NAME |
| 5498 |
'type). |
| 5499 |
|
| 5500 |
-- Declaration: DYNAMIC-EXTENT |
| 5501 |
Package:LISP Declaration to allow locals to be cons'd on the C |
| 5502 |
stack. For example (defun foo (&rest l) (declare (:dynamic-extent |
| 5503 |
l)) ...) will cause l to be a list formed on the C stack of the |
| 5504 |
foo function frame. Of course passing L out as a value of foo will |
| 5505 |
cause havoc. (setq x (make-list n)) (setq x (cons a b)) (setq x |
| 5506 |
(list a b c ..)) also are handled on the stack, for dynamic-extent |
| 5507 |
x. |
| 5508 |
|
| 5509 |
|
| 5510 |
File: gcl-si.info, Node: GCL Specific, Next: C Interface, Prev: Type, Up: Top |
| 5511 |
|
| 5512 |
15 GCL Specific |
| 5513 |
*************** |
| 5514 |
|
| 5515 |
-- Function: SYSTEM (string) |
| 5516 |
Package:LISP |
| 5517 |
|
| 5518 |
GCL specific: Executes a Shell command as if STRING is an input to |
| 5519 |
the Shell. Not all versions of GCL support this function. At |
| 5520 |
least on POSIX systems, this call should return two integers |
| 5521 |
represeting the exit status and any possible terminating signal |
| 5522 |
respectively. |
| 5523 |
|
| 5524 |
-- Variable: *TMP-DIR* |
| 5525 |
Package:COMPILER GCL specific: Directory in which temporary |
| 5526 |
"gazonk" files used by the compiler are to be created. |
| 5527 |
|
| 5528 |
-- Variable: *IGNORE-MAXIMUM-PAGES* |
| 5529 |
Package:SI GCL specific: Tells the GCL memory manager whether |
| 5530 |
(non-NIL) or not (NIL) it should expand memory whenever the maximum |
| 5531 |
allocatable pages have been used up. |
| 5532 |
|
| 5533 |
-- Variable: *OPTIMIZE-MAXIMUM-PAGES* |
| 5534 |
Package:SI |
| 5535 |
|
| 5536 |
GCL specific: Tells the GCL memory manager whether to attempt to |
| 5537 |
adjust the maximum allowable pages for each type to approximately |
| 5538 |
optimize the garbage collection load in the current process. |
| 5539 |
Defaults to T. Set to NIL if you care more about memory usage than |
| 5540 |
runtime. |
| 5541 |
|
| 5542 |
-- Function: MACHINE-VERSION () |
| 5543 |
Package:LISP |
| 5544 |
|
| 5545 |
Returns a string that identifies the machine version of the machine |
| 5546 |
on which GCL is currently running. |
| 5547 |
|
| 5548 |
-- Function: BY () |
| 5549 |
Package:LISP |
| 5550 |
|
| 5551 |
GCL specific: Exits from GCL. |
| 5552 |
|
| 5553 |
-- Macro: DEFCFUN |
| 5554 |
Package:LISP |
| 5555 |
|
| 5556 |
Syntax: |
| 5557 |
(defcfun header n {element}*) |
| 5558 |
|
| 5559 |
GCL specific: Defines a C-language function which calls Lisp |
| 5560 |
functions and/or handles Lisp objects. HEADER gives the header of |
| 5561 |
the C function as a string. Non-negative-integer is the number of |
| 5562 |
the main stack entries used by the C function, primarily for |
| 5563 |
protecting Lisp objects from being garbage-collected. Each ELEMENT |
| 5564 |
may give a C code fragment as a string, or it may be a list |
| 5565 |
((symbol {arg}*) {place}*) which, when executed, calls the Lisp |
| 5566 |
function named by SYMBOL with the specified arguments and saves the |
| 5567 |
value(s) to the specified places. The DEFCFUN form has the above |
| 5568 |
meanings only after compiled; The GCL interpreter simply ignores |
| 5569 |
this form. |
| 5570 |
|
| 5571 |
An example which defines a C function list2 of two arguments, but |
| 5572 |
which calls the 'lisp' function CONS by name, and refers to the |
| 5573 |
constant 'NIL. Note to be loaded by 'load' the function should be |
| 5574 |
static. |
| 5575 |
|
| 5576 |
(defCfun "static object list2(x,y) object x,y;" 0 "object z;" ('NIL |
| 5577 |
z) ((CONS y z) z) ((CONS x z) z) "return(z);" ) |
| 5578 |
|
| 5579 |
In lisp the operations in the body would be (setq z 'nil) (setq z |
| 5580 |
(cons y z)) (setq z (cons x z)) |
| 5581 |
|
| 5582 |
Syntax: |
| 5583 |
|
| 5584 |
(defCfun header non-negative-integer |
| 5585 |
{ string |
| 5586 |
| ( function-symbol { value }* ) |
| 5587 |
| (( function-symbol { value }* ) { place }* ) }) |
| 5588 |
|
| 5589 |
|
| 5590 |
value: |
| 5591 |
place: |
| 5592 |
{ C-expr | ( C-type C-expr ) } |
| 5593 |
|
| 5594 |
C-function-name: |
| 5595 |
C-expr: |
| 5596 |
{ string | symbol } |
| 5597 |
|
| 5598 |
C-type: |
| 5599 |
{ object | int | char | float | double } |
| 5600 |
|
| 5601 |
|
| 5602 |
-- Macro: CLINES |
| 5603 |
Package:LISP |
| 5604 |
|
| 5605 |
Syntax: |
| 5606 |
(clines {string}*) |
| 5607 |
|
| 5608 |
GCL specific: The GCL compiler embeds STRINGs into the intermediate |
| 5609 |
C language code. The interpreter ignores this form. |
| 5610 |
|
| 5611 |
-- Function: ALLOCATE (type number &optional (really-allocate nil)) |
| 5612 |
Package:LISP |
| 5613 |
|
| 5614 |
GCL specific: Sets the maximum number of pages for the type class |
| 5615 |
of the GCL implementation type TYPE to NUMBER. If REALLY-ALLOCATE |
| 5616 |
is given a non-NIL value, then the specified number of pages will |
| 5617 |
be allocated immediately. |
| 5618 |
|
| 5619 |
-- Function: GBC (x) |
| 5620 |
Package:LISP |
| 5621 |
|
| 5622 |
GCL specific: Invokes the garbage collector (GC) with the |
| 5623 |
collection level specified by X. NIL as the argument causes GC to |
| 5624 |
collect cells only. T as the argument causes GC to collect |
| 5625 |
everything. |
| 5626 |
|
| 5627 |
-- Function: SAVE (pathname) |
| 5628 |
Package:LISP |
| 5629 |
|
| 5630 |
GCL specific: Saves the current GCL core image into a program file |
| 5631 |
specified by PATHNAME. This function depends on the version of GCL. |
| 5632 |
The function si::save-system is to be preferred in almost all |
| 5633 |
circumstances. Unlike save, it makes the relocatable section |
| 5634 |
permanent, and causes no future gc of currently loaded .o files. |
| 5635 |
|
| 5636 |
-- Function: HELP* (string &optional (package 'lisp)) |
| 5637 |
Package:LISP |
| 5638 |
|
| 5639 |
GCL specific: Prints the documentation associated with those |
| 5640 |
symbols in the specified package whose print names contain STRING |
| 5641 |
as substring. STRING may be a symbol, in which case the print-name |
| 5642 |
of that symbol is used. If PACKAGE is NIL, then all packages are |
| 5643 |
searched. |
| 5644 |
|
| 5645 |
-- Macro: DEFLA |
| 5646 |
Package:LISP |
| 5647 |
|
| 5648 |
Syntax: |
| 5649 |
(defla name lambda-list {decl | doc}* {form}*) |
| 5650 |
|
| 5651 |
GCL specific: Used to DEFine Lisp Alternative. For the |
| 5652 |
interpreter, DEFLA is equivalent to DEFUN, but the compiler ignores |
| 5653 |
this form. |
| 5654 |
|
| 5655 |
-- Function: PROCLAMATION (decl-spec) |
| 5656 |
Package:LISP |
| 5657 |
|
| 5658 |
GCL specific: Returns T if the specified declaration is globally in |
| 5659 |
effect; NIL otherwise. See the doc of DECLARE for possible |
| 5660 |
DECL-SPECs. |
| 5661 |
|
| 5662 |
-- Macro: DEFENTRY |
| 5663 |
Package:LISP |
| 5664 |
|
| 5665 |
Syntax: |
| 5666 |
(defentry name arg-types c-function) |
| 5667 |
|
| 5668 |
GCL specific: The compiler defines a Lisp function whose body |
| 5669 |
consists of a calling sequence to the C language function specified |
| 5670 |
by C-FUNCTION. The interpreter ignores this form. The ARG-TYPES |
| 5671 |
specifies the C types of the arguments which C-FUNCTION requires. |
| 5672 |
The list of allowed types is (object char int float double string). |
| 5673 |
Code will be produced to coerce from a lisp object to the |
| 5674 |
appropriate type before passing the argument to the C-FUNCTION. The |
| 5675 |
c-function should be of the form (c-result-type c-fname) where |
| 5676 |
c-result-type is a member of (void object char int float double |
| 5677 |
string). c-fname may be a symbol (in which case it will be |
| 5678 |
downcased) or a string. If c-function is not a list, then (object |
| 5679 |
c-function) is assumed. In order for C code to be loaded in by |
| 5680 |
'load' you should declare any variables and functions to be static. |
| 5681 |
If you will link them in at build time, of course you are allowed |
| 5682 |
to define new externals. |
| 5683 |
|
| 5684 |
Sample usage: |
| 5685 |
--File begin----- |
| 5686 |
;; JOE takes X a lisp string and Y a fixnum and returns a character. |
| 5687 |
(clines "#include \"foo.ch\"") |
| 5688 |
(defentry joe (string int) (char "our_c_fun")) |
| 5689 |
---File end------ |
| 5690 |
---File foo.ch--- |
| 5691 |
/* C function for extracting the i'th element of a string */ |
| 5692 |
static char our_c_fun(p,i) |
| 5693 |
char *p; |
| 5694 |
int i; |
| 5695 |
{ |
| 5696 |
return p[i]; |
| 5697 |
} |
| 5698 |
-----File end--- |
| 5699 |
|
| 5700 |
One must be careful of storage allocation issues when passing a |
| 5701 |
string. If the C code invokes storage allocation (either by |
| 5702 |
calling 'malloc' or 'make_cons' etc), then there is a possibility |
| 5703 |
of a garbage collection, so that if the string passed was not |
| 5704 |
constructed with ':static t' when its array was constructed, then |
| 5705 |
it could move. If the C function may allocate storage, then you |
| 5706 |
should pass a copy: |
| 5707 |
(defun safe-c-string (x) |
| 5708 |
(let* ((n (length x)) |
| 5709 |
(a (make-array (+ n 1) :element-type 'string-char |
| 5710 |
:static t :fill-pointer n))) |
| 5711 |
(si::copy-array-portion x y 0 0 n) |
| 5712 |
(setf (aref a n) (code-char 0))) |
| 5713 |
a) |
| 5714 |
|
| 5715 |
|
| 5716 |
-- Function: COPY-ARRAY-PORTION (x,y,i1,i2,n1) |
| 5717 |
Package:SI Copy elements from X to Y starting at X[i1] to Y[i2] and |
| 5718 |
doing N1 elements if N1 is supplied otherwise, doing the length of |
| 5719 |
X - I1 elements. If the types of the arrays are not the same, this |
| 5720 |
has implementation dependent results. |
| 5721 |
|
| 5722 |
-- Function: BYE ( &optional (exit-status 0)) |
| 5723 |
Package:LISP |
| 5724 |
|
| 5725 |
GCL specific: Exits from GCL with exit-status. |
| 5726 |
|
| 5727 |
-- Function: USE-FAST-LINKS (turn-on) |
| 5728 |
Package:LISP |
| 5729 |
|
| 5730 |
GCL specific: If TURN-ON is not nil, the fast link mechanism is |
| 5731 |
enabled, so that ordinary function calls will not appear in the |
| 5732 |
invocation stack, and calls will be much faster. This is the |
| 5733 |
default. If you anticipate needing to see a stack trace in the |
| 5734 |
debugger, then you should turn this off. |
| 5735 |
|
| 5736 |
* Menu: |
| 5737 |
|
| 5738 |
* Bignums:: |
| 5739 |
|
| 5740 |
|
| 5741 |
File: gcl-si.info, Node: Bignums, Prev: GCL Specific, Up: GCL Specific |
| 5742 |
|
| 5743 |
15.1 Bignums |
| 5744 |
============ |
| 5745 |
|
| 5746 |
A directory mp was added to hold the new multi precision arithmetic |
| 5747 |
code. The layout and a fair amount of code in the mp directory is an |
| 5748 |
enhanced version of gpari version 34. The gpari c code was rewritten to |
| 5749 |
be more efficient, and gcc assembler macros were added to allow inlining |
| 5750 |
of operations not possible to do in C. On a 68K machine, this allows the |
| 5751 |
C version to be as efficient as the very carefully written assembler in |
| 5752 |
the gpari distribution. For the main machines, an assembler file |
| 5753 |
(produced by gcc) based on this new method, is included. This is for |
| 5754 |
sites which do not have gcc, or do not wish to compile the whole system |
| 5755 |
with gcc. |
| 5756 |
|
| 5757 |
Bignum arithmetic is much faster now. Many changes were made to |
| 5758 |
cmpnew also, to add 'integer' as a new type. It differs from variables |
| 5759 |
of other types, in that storage is associated to each such variable, and |
| 5760 |
assignments mean copying the storage. This allows a function which does |
| 5761 |
a good deal of bignum arithmetic, to do very little consing in the heap. |
| 5762 |
An example is the computation of PI-INV in scratchpad, which calculates |
| 5763 |
the inverse of pi to a prescribed number of bits accuracy. That |
| 5764 |
function is now about 20 times faster, and no longer causes garbage |
| 5765 |
collection. In versions of GCL where HAVE_ALLOCA is defined, the |
| 5766 |
temporary storage growth is on the C stack, although this often not so |
| 5767 |
critical (for example it makes virtually no difference in the PI-INV |
| 5768 |
example, since in spite of the many operations, only one storage |
| 5769 |
allocation takes place. |
| 5770 |
|
| 5771 |
Below is the actual code for PI-INV |
| 5772 |
|
| 5773 |
On a sun3/280 (cli.com) |
| 5774 |
|
| 5775 |
Here is the comparison of lucid and gcl before and after on that |
| 5776 |
pi-inv. Times are in seconds with multiples of the gcl/akcl time in |
| 5777 |
parentheses. |
| 5778 |
|
| 5779 |
On a sun3/280 (cli.com) |
| 5780 |
|
| 5781 |
|
| 5782 |
pi-inv akcl-566 franz lucid old kcl/akcl |
| 5783 |
---------------------------------------- |
| 5784 |
10000 3.3 9.2(2.8 X) 15.3 (4.6X) 92.7 (29.5 X) |
| 5785 |
20000 12.7 31.0(2.4 X) 62.2 (4.9X) 580.0 (45.5 X) |
| 5786 |
|
| 5787 |
|
| 5788 |
(defun pi-inv (bits &aux (m 0)) |
| 5789 |
(declare (integer bits m)) |
| 5790 |
(let* ((n (+ bits (integer-length bits) 11)) |
| 5791 |
(tt (truncate (ash 1 n) 882)) |
| 5792 |
(d (* 4 882 882)) |
| 5793 |
(s 0)) |
| 5794 |
(declare (integer s d tt n)) |
| 5795 |
(do ((i 2 (+ i 2)) |
| 5796 |
(j 1123 (+ j 21460))) |
| 5797 |
((zerop tt) (cons s (- (+ n 2)))) |
| 5798 |
(declare (integer i j)) |
| 5799 |
(setq s (+ s (* j tt)) |
| 5800 |
m (- (* (- i 1) (- (* 2 i) 1) (- (* 2 i) 3))) |
| 5801 |
tt (truncate (* m tt) (* d (the integer (expt i 3)))))))) |
| 5802 |
|
| 5803 |
|
| 5804 |
|
| 5805 |
File: gcl-si.info, Node: C Interface, Next: System Definitions, Prev: GCL Specific, Up: Top |
| 5806 |
|
| 5807 |
16 C Interface |
| 5808 |
************** |
| 5809 |
|
| 5810 |
* Menu: |
| 5811 |
|
| 5812 |
* Available Symbols:: |
| 5813 |
|
| 5814 |
|
| 5815 |
File: gcl-si.info, Node: Available Symbols, Prev: C Interface, Up: C Interface |
| 5816 |
|
| 5817 |
16.1 Available Symbols |
| 5818 |
====================== |
| 5819 |
|
| 5820 |
When GCL is built, those symbols in the system libraries which are |
| 5821 |
referenced by functions linked in in the list of objects given in |
| 5822 |
'unixport/makefile', become available for reference by GCL code. |
| 5823 |
|
| 5824 |
On some systems it is possible with 'faslink' to load '.o' files |
| 5825 |
which reference other libraries, but in general this practice is not |
| 5826 |
portable. |
| 5827 |
|
| 5828 |
|
| 5829 |
File: gcl-si.info, Node: System Definitions, Next: Debugging, Prev: C Interface, Up: Top |
| 5830 |
|
| 5831 |
17 System Definitions |
| 5832 |
********************* |
| 5833 |
|
| 5834 |
-- Function: ALLOCATE-CONTIGUOUS-PAGES (number &optional |
| 5835 |
(really-allocate nil)) |
| 5836 |
Package:SI |
| 5837 |
|
| 5838 |
GCL specific: Sets the maximum number of pages for contiguous |
| 5839 |
blocks to NUMBER. If REALLY-ALLOCATE is non-NIL, then the specified |
| 5840 |
number of pages will be allocated immediately. |
| 5841 |
|
| 5842 |
-- Function: FREEZE-DEFSTRUCT (name) |
| 5843 |
Package:SI |
| 5844 |
|
| 5845 |
The inline defstruct type checker will be made more efficient, in |
| 5846 |
that it will only check for types which currently include NAME. |
| 5847 |
After calling this the defstruct should not be altered. |
| 5848 |
|
| 5849 |
-- Function: MAXIMUM-ALLOCATABLE-PAGES (type) |
| 5850 |
Package:SI |
| 5851 |
|
| 5852 |
GCL specific: Returns the current maximum number of pages for the |
| 5853 |
type class of the GCL implementation type TYPE. |
| 5854 |
|
| 5855 |
-- Function: ALLOCATED-RELOCATABLE-PAGES () |
| 5856 |
Package:SI |
| 5857 |
|
| 5858 |
GCL specific: Returns the number of pages currently allocated for |
| 5859 |
relocatable blocks. |
| 5860 |
|
| 5861 |
-- Function: PUTPROP (symbol value indicator) |
| 5862 |
Package:SI |
| 5863 |
|
| 5864 |
Give SYMBOL the VALUE on INDICATOR property. |
| 5865 |
|
| 5866 |
-- Function: ALLOCATED-PAGES (type) |
| 5867 |
Package:SI |
| 5868 |
|
| 5869 |
GCL specific: Returns the number of pages currently allocated for |
| 5870 |
the type class of the GCL implementation type TYPE. |
| 5871 |
|
| 5872 |
-- Function: ALLOCATE-RELOCATABLE-PAGES (number) |
| 5873 |
Package:SI |
| 5874 |
|
| 5875 |
GCL specific: Sets the maximum number of pages for relocatable |
| 5876 |
blocks to NUMBER. |
| 5877 |
|
| 5878 |
-- Function: ALLOCATED-CONTIGUOUS-PAGES () |
| 5879 |
Package:SI |
| 5880 |
|
| 5881 |
GCL specific: Returns the number of pages currently allocated for |
| 5882 |
contiguous blocks. |
| 5883 |
|
| 5884 |
-- Function: MAXIMUM-CONTIGUOUS-PAGES () |
| 5885 |
Package:SI |
| 5886 |
|
| 5887 |
GCL specific: Returns the current maximum number of pages for |
| 5888 |
contiguous blocks. |
| 5889 |
|
| 5890 |
-- Function: GET-HOLE-SIZE () |
| 5891 |
Package:SI |
| 5892 |
|
| 5893 |
GCL specific: Returns as a fixnum the size of the memory hole (in |
| 5894 |
pages). |
| 5895 |
|
| 5896 |
-- Function: SPECIALP (symbol) |
| 5897 |
Package:SI |
| 5898 |
|
| 5899 |
GCL specific: Returns T if the SYMBOL is a globally special |
| 5900 |
variable; NIL otherwise. |
| 5901 |
|
| 5902 |
-- Function: OUTPUT-STREAM-STRING (string-output-stream) |
| 5903 |
Package:SI |
| 5904 |
|
| 5905 |
GCL specific: Returns the string corresponding to the |
| 5906 |
STRING-OUTPUT-STREAM. |
| 5907 |
|
| 5908 |
-- Function: GET-STRING-INPUT-STREAM-INDEX (string-input-stream) |
| 5909 |
Package:SI |
| 5910 |
|
| 5911 |
GCL specific: Returns the current index of the STRING-INPUT-STREAM. |
| 5912 |
|
| 5913 |
-- Function: STRING-CONCATENATE (&rest strings) |
| 5914 |
Package:SI |
| 5915 |
|
| 5916 |
GCL specific: Returns the result of concatenating the given |
| 5917 |
STRINGS. |
| 5918 |
|
| 5919 |
-- Function: BDS-VAR (i) |
| 5920 |
Package:SI |
| 5921 |
|
| 5922 |
GCL specific: Returns the symbol of the i-th entity in the bind |
| 5923 |
stack. |
| 5924 |
|
| 5925 |
-- Function: ERROR-SET (form) |
| 5926 |
Package:SI |
| 5927 |
|
| 5928 |
GCL specific: Evaluates the FORM in the null environment. If the |
| 5929 |
evaluation of the FORM has successfully completed, SI:ERROR-SET |
| 5930 |
returns NIL as the first value and the result of the evaluation as |
| 5931 |
the rest of the values. If, in the course of the evaluation, a |
| 5932 |
non-local jump from the FORM is atempted, SI:ERROR-SET traps the |
| 5933 |
jump and returns the corresponding jump tag as its value. |
| 5934 |
|
| 5935 |
-- Function: COMPILED-FUNCTION-NAME (compiled-function-object) |
| 5936 |
Package:SI |
| 5937 |
|
| 5938 |
GCL specific: Returns the name of the COMPILED-FUNCTION-OBJECT. |
| 5939 |
|
| 5940 |
-- Function: STRUCTUREP (object) |
| 5941 |
Package:SI |
| 5942 |
|
| 5943 |
GCL specific: Returns T if the OBJECT is a structure; NIL |
| 5944 |
otherwise. |
| 5945 |
|
| 5946 |
-- Function: IHS-VS (i) |
| 5947 |
Package:SI |
| 5948 |
|
| 5949 |
GCL specific: Returns the value stack index of the i-th entity in |
| 5950 |
the invocation history stack. |
| 5951 |
|
| 5952 |
-- Function: UNIVERSAL-ERROR-HANDLER (error-name correctable |
| 5953 |
function-name continue-format-string error-format-string &rest |
| 5954 |
args) |
| 5955 |
Package:SI |
| 5956 |
|
| 5957 |
GCL specific: Starts the error handler of GCL. When an error is |
| 5958 |
detected, GCL calls SI:UNIVERSAL-ERROR-HANDLER with the specified |
| 5959 |
arguments. ERROR-NAME is the name of the error. CORRECTABLE is T |
| 5960 |
for a correctable error and NIL for a fatal error. FUNCTION-NAME |
| 5961 |
is the name of the function that caused the error. |
| 5962 |
CONTINUE-FORMAT-STRING and ERROR-FORMAT-STRING are the format |
| 5963 |
strings of the error message. ARGS are the arguments to the format |
| 5964 |
strings. To change the error handler of GCL, redefine |
| 5965 |
SI:UNIVERSAL-ERROR- HANDLER. |
| 5966 |
|
| 5967 |
-- Variable: *INTERRUPT-ENABLE* |
| 5968 |
Package:SI GCL specific: If the value of SI:*INTERRUPT-ENABLE* is |
| 5969 |
non-NIL, GCL signals an error on the terminal interrupt (this is |
| 5970 |
the default case). If it is NIL, GCL ignores the interrupt and |
| 5971 |
assigns T to SI:*INTERRUPT-ENABLE*. |
| 5972 |
|
| 5973 |
-- Function: CHDIR (pathname) |
| 5974 |
Package:SI |
| 5975 |
|
| 5976 |
GCL/UNIX specific: Changes the current working directory to the |
| 5977 |
specified pathname. |
| 5978 |
|
| 5979 |
-- Function: COPY-STREAM (in-stream out-stream) |
| 5980 |
Package:SI |
| 5981 |
|
| 5982 |
GCL specific: Copies IN-STREAM to OUT-STREAM until the end-of-file |
| 5983 |
on IN- STREAM. |
| 5984 |
|
| 5985 |
-- Function: INIT-SYSTEM () |
| 5986 |
Package:SI |
| 5987 |
|
| 5988 |
GCL specific: Initializes the library and the compiler of GCL. |
| 5989 |
Since they have already been initialized in the standard image of |
| 5990 |
GCL, calling SI:INIT- SYSTEM will cause an error. |
| 5991 |
|
| 5992 |
-- Variable: *INDENT-FORMATTED-OUTPUT* |
| 5993 |
Package:SI GCL specific: The FORMAT directive ~% indents the next |
| 5994 |
line if the value of this variable is non-NIL. If NIL, ~% simply |
| 5995 |
does Newline. |
| 5996 |
|
| 5997 |
-- Function: SET-HOLE-SIZE (fixnum) |
| 5998 |
Package:SI |
| 5999 |
|
| 6000 |
GCL specific: Sets the size of the memory hole (in pages). |
| 6001 |
|
| 6002 |
-- Function: FRS-BDS (i) |
| 6003 |
Package:SI |
| 6004 |
|
| 6005 |
GCL specific: Returns the bind stack index of the i-th entity in |
| 6006 |
the frame stack. |
| 6007 |
|
| 6008 |
-- Function: IHS-FUN (i) |
| 6009 |
Package:SI |
| 6010 |
|
| 6011 |
GCL specific: Returns the function value of the i-th entity in the |
| 6012 |
invocation history stack. |
| 6013 |
|
| 6014 |
-- Function: *MAKE-CONSTANT (symbol value) |
| 6015 |
Package:SI |
| 6016 |
|
| 6017 |
GCL specific: Makes the SYMBOL a constant with the specified VALUE. |
| 6018 |
|
| 6019 |
-- Function: FIXNUMP (object) |
| 6020 |
Package:SI |
| 6021 |
|
| 6022 |
GCL specific: Returns T if the OBJECT is a fixnum; NIL otherwise. |
| 6023 |
|
| 6024 |
-- Function: BDS-VAL (i) |
| 6025 |
Package:SI |
| 6026 |
|
| 6027 |
GCL specific: Returns the value of the i-th entity in the bind |
| 6028 |
stack. |
| 6029 |
|
| 6030 |
-- Function: STRING-TO-OBJECT (string) |
| 6031 |
Package:SI |
| 6032 |
|
| 6033 |
GCL specific: (SI:STRING-TO-OBJECT STRING) is equivalent to |
| 6034 |
(READ-FROM-STRING STRING), but much faster. |
| 6035 |
|
| 6036 |
-- Variable: *SYSTEM-DIRECTORY* |
| 6037 |
Package:SI GCL specific: Holds the name of the system directory of |
| 6038 |
GCL. |
| 6039 |
|
| 6040 |
-- Function: FRS-IHS (i) |
| 6041 |
Package:SI |
| 6042 |
|
| 6043 |
GCL specific: Returns the invocation history stack index of the |
| 6044 |
i-th entity in the frame stack. |
| 6045 |
|
| 6046 |
-- Function: RESET-GBC-COUNT () |
| 6047 |
Package:SI |
| 6048 |
|
| 6049 |
GCL specific: Resets the counter of the garbage collector that |
| 6050 |
records how many times the garbage collector has been called for |
| 6051 |
each implementation type. |
| 6052 |
|
| 6053 |
-- Function: CATCH-BAD-SIGNALS () |
| 6054 |
Package:SI |
| 6055 |
|
| 6056 |
GCL/BSD specific: Installs a signal catcher for bad signals: |
| 6057 |
SIGILL, SIGIOT, SIGEMT, SIGBUS, SIGSEGV, SIGSYS. The signal |
| 6058 |
catcher, upon catching the signal, signals an error (and enter the |
| 6059 |
break-level). Since the internal memory of GCL may be broken, the |
| 6060 |
user should check the signal and exit from GCL if necessary. When |
| 6061 |
the signal is caught during garbage collection, GCL terminates |
| 6062 |
immediately. |
| 6063 |
|
| 6064 |
-- Function: RESET-STACK-LIMITS () |
| 6065 |
Package:SI |
| 6066 |
|
| 6067 |
GCL specific: Resets the stack limits to the normal state. When a |
| 6068 |
stack has overflowed, GCL extends the limit for the stack in order |
| 6069 |
to execute the error handler. After processing the error, GCL |
| 6070 |
resets the stack limit by calling SI:RESET-STACK-LIMITS. |
| 6071 |
|
| 6072 |
-- Variable: *GBC-MESSAGE* |
| 6073 |
Package:SI GCL specific: If the value of SI:*GBC-MESSAGE* is |
| 6074 |
non-NIL, the garbage collector prints some information on the |
| 6075 |
terminal. Usually SI:*GBC-MESSAGE* should be set NIL. |
| 6076 |
|
| 6077 |
-- Variable: *GBC-NOTIFY* |
| 6078 |
Package:SI GCL specific: If the value is non-NIL, the garbage |
| 6079 |
collector prints a very brief one line message about the area |
| 6080 |
causing the collection, and the time spent in internal time units. |
| 6081 |
|
| 6082 |
-- Variable: *AFTER-GBC-HOOK* |
| 6083 |
Package:SI Defaults to nil, but may be set to a function of one |
| 6084 |
argument TYPE which is a lisp variable indicating the TYPE which |
| 6085 |
caused the current collection. |
| 6086 |
|
| 6087 |
-- Funcition: ALLOCATED (type) |
| 6088 |
Package:SI |
| 6089 |
|
| 6090 |
Returns 6 values: |
| 6091 |
nfree |
| 6092 |
number free |
| 6093 |
npages |
| 6094 |
number of pages |
| 6095 |
maxpage |
| 6096 |
number of pages to grow to |
| 6097 |
nppage |
| 6098 |
number per page |
| 6099 |
gbccount |
| 6100 |
number of gc's due to running out of items of this size |
| 6101 |
nused |
| 6102 |
number of items used |
| 6103 |
|
| 6104 |
Note that all items of the same size are stored on similar pages. |
| 6105 |
Thus for example on a 486 under linux the following basic types are |
| 6106 |
all the same size and so will share the same allocated information: |
| 6107 |
CONS BIGNUM RATIO COMPLEX STRUCTURE. |
| 6108 |
|
| 6109 |
-- Function: *MAKE-SPECIAL (symbol) |
| 6110 |
Package:SI |
| 6111 |
|
| 6112 |
GCL specific: Makes the SYMBOL globally special. |
| 6113 |
|
| 6114 |
-- Function: MAKE-STRING-OUTPUT-STREAM-FROM-STRING (string) |
| 6115 |
Package:SI |
| 6116 |
|
| 6117 |
GCL specific: Creates a string-output-stream corresponding to the |
| 6118 |
STRING and returns it. The STRING should have a fill-pointer. |
| 6119 |
|
| 6120 |
-- Variable: *IGNORE-EOF-ON-TERMINAL-IO* |
| 6121 |
Package:SI GCL specific: If the value of |
| 6122 |
SI:*IGNORE-EOF-ON-TERMINAL-IO* is non-NIL, GCL ignores the |
| 6123 |
eof-character (usually ^D) on the terminal and the terminal never |
| 6124 |
becomes end-of-file. The default value of |
| 6125 |
SI:*IGNORE-EOF-ON-TERMINAL-IO* is NIL. |
| 6126 |
|
| 6127 |
-- Function: ADDRESS (object) |
| 6128 |
Package:SI |
| 6129 |
|
| 6130 |
GCL specific: Returns the address of the OBJECT as a fixnum. The |
| 6131 |
address of an object depends on the version of GCL. E.g. |
| 6132 |
(SI:ADDRESS NIL) returns 1879062044 on GCL/AOSVS dated March 14, |
| 6133 |
1986. |
| 6134 |
|
| 6135 |
-- Variable: *LISP-MAXPAGES* |
| 6136 |
Package:SI GCL specific: Holds the maximum number of pages (1 page |
| 6137 |
= 2048 bytes) for the GCL process. The result of changing the |
| 6138 |
value of SI:*LISP-MAXPAGES* is unpredictable. |
| 6139 |
|
| 6140 |
-- Function: ARGC () |
| 6141 |
Package:SI |
| 6142 |
|
| 6143 |
GCL specific: Returns the number of arguments on the command line |
| 6144 |
that invoked the GCL process. |
| 6145 |
|
| 6146 |
-- Function: NANI (fixnum) |
| 6147 |
Package:SI |
| 6148 |
|
| 6149 |
GCL specific: Returns the object in the address FIXNUM. This |
| 6150 |
function is the inverse of SI:ADDRESS. Although SI:ADDRESS is a |
| 6151 |
harmless operation, SI:NANI is quite dangerous and should be used |
| 6152 |
with care. |
| 6153 |
|
| 6154 |
-- Variable: *NOTIFY-GBC* |
| 6155 |
Package:SI GCL specific: If the value of this variable is non-NIL, |
| 6156 |
then the garbage collector notifies that it begins to run whenever |
| 6157 |
it is invoked. Otherwise, garbage collection begins silently. |
| 6158 |
|
| 6159 |
-- Function: SAVE-SYSTEM (pathname) |
| 6160 |
Package:SI |
| 6161 |
|
| 6162 |
GCL specific: Saves the current GCL core imange into a program file |
| 6163 |
specified by PATHNAME. This function differs from SAVE in that the |
| 6164 |
contiguous and relocatable areas are made permanent in the saved |
| 6165 |
image. Usually the standard image of GCL interpreter/compiler is |
| 6166 |
saved by SI:SAVE-SYSTEM. This function causes an exit from lisp. |
| 6167 |
Various changes are made to the memory of the running system, such |
| 6168 |
as closing files and resetting io streams. It would not be |
| 6169 |
possible to continue normally. |
| 6170 |
|
| 6171 |
-- Function: UNCATCH-BAD-SIGNALS () |
| 6172 |
Package:SI |
| 6173 |
|
| 6174 |
GCL/BSD specific: Undoes the effect of SI:CATCH-BAD-SIGNALS. |
| 6175 |
|
| 6176 |
-- Function: VS (i) |
| 6177 |
Package:SI |
| 6178 |
|
| 6179 |
GCL specific: Returns the i-th entity in the value stack. |
| 6180 |
|
| 6181 |
-- Function: DISPLACED-ARRAY-P (array) |
| 6182 |
Package:SI |
| 6183 |
|
| 6184 |
GCL specific: Returns T if the ARRAY is a displaced array; NIL |
| 6185 |
otherwise. |
| 6186 |
|
| 6187 |
-- Function: ARGV (fixnum) |
| 6188 |
Package:SI |
| 6189 |
|
| 6190 |
GCL specific: Returns the FIXNUM-th argument on the command line |
| 6191 |
that invoked the GCL process. |
| 6192 |
|
| 6193 |
-- Variable: *DEFAULT-TIME-ZONE* |
| 6194 |
Package:SI GCL specific: Holds the default time zone. The initial |
| 6195 |
value of SI:*DEFAULT- TIME-ZONE* is 6 (the time zone of Austin, |
| 6196 |
Texas). |
| 6197 |
|
| 6198 |
-- Function: GETENV (string) |
| 6199 |
Package:SI |
| 6200 |
|
| 6201 |
GCL/UNIX specific: Returns the environment with the name STRING as |
| 6202 |
a string; if the environment specified by STRING is not found, |
| 6203 |
returns NIL. |
| 6204 |
|
| 6205 |
-- Function: FASLINK (file string) |
| 6206 |
Package:SI |
| 6207 |
|
| 6208 |
GCL/BSD specific: Loads the FASL file FILE while linking the object |
| 6209 |
files and libraries specified by STRING. For example, (faslink |
| 6210 |
"foo.o" "bar.o boo.o -lpixrect") loads foo.o while linking two |
| 6211 |
object files (bar.o and boo.o) and the library pixrect. Usually, |
| 6212 |
foo.o consists of the C language interface for the functions |
| 6213 |
defined in the object files or the libraries. |
| 6214 |
|
| 6215 |
A more portable way of making references to C code, is to build it |
| 6216 |
in at the time of the original make. If foo.c references things in |
| 6217 |
-lpixrect, and foo.o is its compilation in the gcl/unixport |
| 6218 |
directory |
| 6219 |
|
| 6220 |
(cd gcl/unixport ; make "EXTRAS= foo.o -lpixrect ") |
| 6221 |
|
| 6222 |
should add them. If EXTRAS was already joe.o in the |
| 6223 |
unixport/makefile you should of course add joe.o to the above |
| 6224 |
"EXTRAS= joe.o foo.o.." |
| 6225 |
|
| 6226 |
Faslink does not work on most UNIX systems which are derived from |
| 6227 |
SYS V or AIX. |
| 6228 |
|
| 6229 |
-- Function: TOP-LEVEL () |
| 6230 |
Package:SI |
| 6231 |
|
| 6232 |
GCL specific: Starts the standard top-level listner of GCL. When |
| 6233 |
the GCL process is invoked, it calls SI:TOP-LEVEL by (FUNCALL |
| 6234 |
'SI:TOP-LEVEL). To change the top-level of GCL, redefine |
| 6235 |
SI:TOP-LEVEL and save the core imange in a file. When the saved |
| 6236 |
imange is invoked, it will start the redefined top-level. |
| 6237 |
|
| 6238 |
-- Function: FRS-VS (i) |
| 6239 |
Package:SI |
| 6240 |
|
| 6241 |
GCL specific: Returns the value stack index of the i-th entity in |
| 6242 |
the frame stack. |
| 6243 |
|
| 6244 |
-- Function: WRITE-DEBUG-SYMBOLS (start file &key (main-file |
| 6245 |
"/usr/local/schelter/xgcl/unixport/raw_gcl") (output-file |
| 6246 |
"debug-symbols.o" )) |
| 6247 |
Package:SI |
| 6248 |
|
| 6249 |
Write out a file of debug-symbols using address START as the place |
| 6250 |
where FILE will be loaded into the running executable MAIN-FILE. |
| 6251 |
The last is a keyword argument. |
| 6252 |
|
| 6253 |
-- Function: PROF (x y) |
| 6254 |
Package:SI |
| 6255 |
|
| 6256 |
These functions in the SI package are GCL specific, and allow |
| 6257 |
monitoring the run time of functions loaded into GCL, as well as |
| 6258 |
the basic functions. Sample Usage: (si::set-up-profile 1000000) |
| 6259 |
(si::prof 0 90) run program (si::prof 0 0) ;; turn off profile |
| 6260 |
(si::display-prof) (si::clear-profile) (si::prof 0 90) ;; start |
| 6261 |
profile again run program .. Profile can be stopped with (si::prof |
| 6262 |
0 0) and restarted with (si::prof 0 90) The START-ADDRESS will |
| 6263 |
correspond to the beginning of the profile array, and the SCALE |
| 6264 |
will mean that 256 bytes of code correspond to SCALE bytes in the |
| 6265 |
profile array. |
| 6266 |
|
| 6267 |
Thus if the profile array is 1,000,000 bytes long and the code |
| 6268 |
segment is 5 megabytes long you can profile the whole thing using a |
| 6269 |
scale of 50 Note that long runs may result in overflow, and so an |
| 6270 |
understating of the time in a function. |
| 6271 |
|
| 6272 |
You must run intensively however since, with a scale of 128 it |
| 6273 |
takes 6,000,000 times through a loop to overflow the sampling in |
| 6274 |
one part of the code. |
| 6275 |
|
| 6276 |
-- Function: CATCH-FATAL (i) |
| 6277 |
Package:SI |
| 6278 |
|
| 6279 |
Sets the value of the C variable catch_fatal to I which should be |
| 6280 |
an integer. If catch_fatal is 1, then most unrecoverable fatal |
| 6281 |
errors will be caught. Upon catching such an error catch_fatal |
| 6282 |
becomes -1, to avoid recursive errors. The top level loop |
| 6283 |
automatically sets catch_fatal to 1, if the value is less than |
| 6284 |
zero. Catching can be turned off by making catch_fatal = 0. |
| 6285 |
|
| 6286 |
-- Variable: *MULTIPLY-STACKS* |
| 6287 |
Package:SI |
| 6288 |
|
| 6289 |
If this variable is set to a positive fixnum, then the next time |
| 6290 |
through the TOP-LEVEL loop, the loop will be exited. The size of |
| 6291 |
the stacks will be multiplied by the value of *multiply-stacks*, |
| 6292 |
and the TOP-LEVEL will be called again. Thus to double the size of |
| 6293 |
the stacks: |
| 6294 |
|
| 6295 |
>(setq si::*multiply-stacks* 2) [exits top level and reinvokes it, |
| 6296 |
with the new stacks in place] > |
| 6297 |
|
| 6298 |
We must exit TOP-LEVEL, because it and any other lisp functions |
| 6299 |
maintain many pointers into the stacks, which would be incorrect |
| 6300 |
when the stacks have been moved. Interrupting the process of |
| 6301 |
growing the stacks, can leave you in an inconsistent state. |
| 6302 |
|
| 6303 |
-- Function: GBC-TIME (&optional x) |
| 6304 |
Package:SI |
| 6305 |
|
| 6306 |
Sets the internal C variable gc_time to X if X is supplied and then |
| 6307 |
returns gc_time. If gc_time is greater or equal to 0, then gc_time |
| 6308 |
is incremented by the garbage collector, according to the number of |
| 6309 |
internal time units spent there. The initial value of gc_time is |
| 6310 |
-1. |
| 6311 |
|
| 6312 |
-- Function: FWRITE (string start count stream) |
| 6313 |
Package:SI |
| 6314 |
|
| 6315 |
Write from STRING starting at char START (or 0 if it is nil) COUNT |
| 6316 |
characters (or to end if COUNT is nil) to STREAM. STREAM must be a |
| 6317 |
stream such as returned by FP-OUTPUT-STREAM. Returns nil if it |
| 6318 |
fails. |
| 6319 |
|
| 6320 |
-- Function: FREAD (string start count stream) |
| 6321 |
Package:SI |
| 6322 |
|
| 6323 |
Read characters into STRING starting at char START (or 0 if it is |
| 6324 |
nil) COUNT characters (or from start to length of STRING if COUNT |
| 6325 |
is nil). Characters are read from STREAM. STREAM must be a stream |
| 6326 |
such as returned by FP-INPUT-STREAM. Returns nil if it fails. |
| 6327 |
Return number of characters read if it succeeds. |
| 6328 |
|
| 6329 |
-- Function: SGC-ON (&optional ON) |
| 6330 |
Package:SI |
| 6331 |
|
| 6332 |
If ON is not nil then SGC (stratified garbage collection) is turned |
| 6333 |
on. If ON is supplied and is nil, then SGC is turned off. If ON |
| 6334 |
is not supplied, then it returns T if SGC is on, and NIL if SGC is |
| 6335 |
off. |
| 6336 |
|
| 6337 |
The purpose of SGC is to prevent paging activity during garbage |
| 6338 |
collection. It is efficient if the actual number of pages being |
| 6339 |
written to form a small percentage of the total image size. The |
| 6340 |
image should be built as compactly as possible. This can be |
| 6341 |
accomplished by using a settings such as (si::allocate-growth 'cons |
| 6342 |
1 10 50 20) to limit the growth in the cons maxpage to 10 pages per |
| 6343 |
time. Then just before calling si::save-system to save your image |
| 6344 |
you can do something like: |
| 6345 |
|
| 6346 |
(si::set-hole-size 500)(gbc nil) (si::sgc-on t) (si::save-system |
| 6347 |
..) |
| 6348 |
|
| 6349 |
This makes the saved image come up with SGC on. We have set a |
| 6350 |
reasonably large hole size. This is so that allocation of pages |
| 6351 |
either because they fill up, or through specific calls to |
| 6352 |
si::allocate, will not need to move all the relocatable data. |
| 6353 |
Moving relocatable data requires turning SGC off, performing a full |
| 6354 |
gc, and then turning it back on. New relocatable data is collected |
| 6355 |
by SGC, but moving the old requires going through all pages of |
| 6356 |
memory to change pointers into it. |
| 6357 |
|
| 6358 |
Using si::*notify-gbc* gives information about the number of pages |
| 6359 |
used by SGC. |
| 6360 |
|
| 6361 |
Note that SGC is only available on operating systems which provide |
| 6362 |
the mprotect system call, to write protect pages. Otherwise we |
| 6363 |
cannot tell which pages have been written too. |
| 6364 |
|
| 6365 |
-- Function: ALLOCATE-SGC (type min-pages max-pages percent-free) |
| 6366 |
Package:SI |
| 6367 |
|
| 6368 |
If MIN-PAGES is 0, then this type will not be swept by SGC. |
| 6369 |
Otherwise this is the minimum number of pages to make available to |
| 6370 |
SGC. MAX-PAGES is the upper limit of such pages. Only pages with |
| 6371 |
PERCENT-FREE objects on them, will be assigned to SGC. A list of |
| 6372 |
the previous values for min, max and percent are returned. |
| 6373 |
|
| 6374 |
-- Function: ALLOCATE-GROWTH (type min max percent percent-free) |
| 6375 |
Package:SI |
| 6376 |
|
| 6377 |
The next time after a garbage collection for TYPE, if PERCENT-FREE |
| 6378 |
of the objects of this TYPE are not actually free, and if the |
| 6379 |
maximum number of pages for this type has already been allocated, |
| 6380 |
then the maximum number will be increased by PERCENT of the old |
| 6381 |
maximum, subject to the condition that this increment be at least |
| 6382 |
MIN pages and at most MAX pages. A list of the previous values for |
| 6383 |
min, max, percent, and percent-free for the type TYPE is returned. |
| 6384 |
A value of 0 means use the system default, and if an argument is |
| 6385 |
out of range then the current values are returned with no change |
| 6386 |
made. |
| 6387 |
|
| 6388 |
Examples: (si::allocate-growth 'cons 1 10 50 10) would insist that |
| 6389 |
after a garbage collection for cons, there be at least 10% cons's |
| 6390 |
free. If not the number of cons pages would be grown by 50% or 10 |
| 6391 |
pages which ever was smaller. This might be reasonable if you were |
| 6392 |
trying to build an image which was 'full', ie had few free objects |
| 6393 |
of this type. |
| 6394 |
|
| 6395 |
(si::allocate-growth 'fixnum 0 10000 30 40) would grow space till |
| 6396 |
there were normally 40% free fixnums, usually growing by 30% per |
| 6397 |
time. |
| 6398 |
|
| 6399 |
(si::allocate-growth 'cons 0 0 0 40) would require 40% free conses |
| 6400 |
after garbage collection for conses, and would use system defaults |
| 6401 |
for the the rate to grow towards this goal. |
| 6402 |
|
| 6403 |
(si::allocate-growth 'cons -1 0 0 0) would return the current |
| 6404 |
values, but not make any changes. |
| 6405 |
|
| 6406 |
-- Function: OPEN-FASD (stream direction eof-value table) |
| 6407 |
Package:SI |
| 6408 |
|
| 6409 |
Given file STREAM open for input or output in DIRECTION, set it up |
| 6410 |
to start writing or reading in fasd format. When reading from this |
| 6411 |
stream the EOF-VALUE will be returned when the end a fasd end of |
| 6412 |
dump marker is encountered. TABLE should be an eq hashtable on |
| 6413 |
output, a vector on input, or nil. In this last case a default one |
| 6414 |
will be constructed. |
| 6415 |
|
| 6416 |
We shall refer to the result as a 'fasd stream'. It is suitable as |
| 6417 |
the arg to CLOSE-FASD, READ-FASD-TOP, and as the second second arg |
| 6418 |
to WRITE-FASD. As a lisp object it is actually a vector, whose body |
| 6419 |
coincides with: |
| 6420 |
|
| 6421 |
struct fasd { object stream; /* lisp object of type stream */ |
| 6422 |
object table; /* hash table used in dumping or vector on input*/ |
| 6423 |
object eof; /* lisp object to be returned on coming to eof mark */ |
| 6424 |
object direction; /* holds Cnil or Kinput or Koutput */ object |
| 6425 |
package; /* the package symbols are in by default */ object index; |
| 6426 |
/* integer. The current_dump index on write */ object filepos; /* |
| 6427 |
nil or the position of the start */ object table_length; /* On read |
| 6428 |
it is set to the size dump array needed or 0 */ object macro ; } |
| 6429 |
|
| 6430 |
We did not use a defstruct for this, because we want the compiler |
| 6431 |
to use this and it makes bootstrapping more difficult. It is in |
| 6432 |
"cmpnew/fasdmacros.lsp" |
| 6433 |
|
| 6434 |
-- Function: WRITE-FASD-TOP (X FASD-STREAM) |
| 6435 |
Package:SI |
| 6436 |
|
| 6437 |
Write X to FASD-STREAM. |
| 6438 |
|
| 6439 |
-- Function: READ-FASD-TOP (FASD-STREAM) |
| 6440 |
Package:SI |
| 6441 |
|
| 6442 |
Read the next object from FASD-STREAM. Return the eof-value of |
| 6443 |
FASD-STREAM if we encounter an eof marker put out by CLOSE-FASD. |
| 6444 |
Encountering end of actual file stream causes an error. |
| 6445 |
|
| 6446 |
-- Function: CLOSE-FASD (FASD-STREAM) |
| 6447 |
Package:SI |
| 6448 |
|
| 6449 |
On output write an eof marker to the associated file stream, and |
| 6450 |
then make FASD-STREAM invalid for further output. It also attempts |
| 6451 |
to write information to the stream on the size of the index table |
| 6452 |
needed to read from the stream from the last open. This is useful |
| 6453 |
in growing the array. It does not alter the file stream, other |
| 6454 |
than for writing this information to it. The file stream may be |
| 6455 |
reopened for further use. It is an error to OPEN-FASD the same |
| 6456 |
file or file stream again with out first calling CLOSE-FASD. |
| 6457 |
|
| 6458 |
-- Function: FIND-SHARING-TOP (x table) |
| 6459 |
Package:SI |
| 6460 |
|
| 6461 |
X is any lisp object and TABLE is an eq hash table. This walks |
| 6462 |
through X making entries to indicate the frequency of |
| 6463 |
symbols,lists, and arrays. Initially items get -1 when they are |
| 6464 |
first met, and this is decremented by 1 each time the object |
| 6465 |
occurs. Call this function on all the objects in a fasd file, |
| 6466 |
which you wish to share structure. |
| 6467 |
|
| 6468 |
-- Variable: *LOAD-PATHNAME* |
| 6469 |
Package:SI Load binds this to the pathname of the file being |
| 6470 |
loaded. |
| 6471 |
|
| 6472 |
-- Macro: DEFINE-INLINE-FUNCTION (fname vars &body body) |
| 6473 |
Package:SI |
| 6474 |
|
| 6475 |
This is equivalent to defun except that VARS may not contain |
| 6476 |
&optional, &rest, &key or &aux. Also a compiler property is added, |
| 6477 |
which essentially saves the body and turns this into a let of the |
| 6478 |
VARS and then execution of the body. This last is done using |
| 6479 |
si::DEFINE-COMPILER-MACRO Example: (si::define-inline-function |
| 6480 |
myplus (a b c) (+ a b c)) |
| 6481 |
|
| 6482 |
-- Macro: DEFINE-COMPILER-MACRO (fname vars &body body) |
| 6483 |
Package:SI |
| 6484 |
|
| 6485 |
FNAME may be the name of a function, but at compile time the macro |
| 6486 |
expansion given by this is used. |
| 6487 |
|
| 6488 |
(si::define-compiler-macro mycar (a) '(car ,a)) |
| 6489 |
|
| 6490 |
-- Function: DBL () |
| 6491 |
Package:SI |
| 6492 |
|
| 6493 |
Invoke a top level loop, in which debug commands may be entered. |
| 6494 |
These commands may also be entered at breaks, or in the error |
| 6495 |
handler. See SOURCE-LEVEL-DEBUG |
| 6496 |
|
| 6497 |
-- Function: NLOAD (file) |
| 6498 |
Package:SI |
| 6499 |
|
| 6500 |
Load a file with the readtable bound to a special readtable, which |
| 6501 |
permits tracking of source line information as the file is loaded. |
| 6502 |
see SOURCE-LEVEL-DEBUG |
| 6503 |
|
| 6504 |
-- Function: BREAK-FUNCTION (function &optional line absolute) |
| 6505 |
Package:SI |
| 6506 |
|
| 6507 |
Set a breakpoint for a FUNCTION at LINE if the function has source |
| 6508 |
information loaded. If ABSOLUTE is not nil, then the line is |
| 6509 |
understood to be relative to the beginning of the buffer. See also |
| 6510 |
dbl-break-function, the emacs command. |
| 6511 |
|
| 6512 |
-- Function: XDR-OPEN (stream) |
| 6513 |
Package:SI |
| 6514 |
|
| 6515 |
Returns an object suitable for passing to XDR-READ if the stream is |
| 6516 |
an input stream, and XDR-WRITE if it was an output stream. Note |
| 6517 |
the stream must be a unix stream, on which si::fp-input-stream or |
| 6518 |
si::fp-output-stream would act as the identity. |
| 6519 |
|
| 6520 |
-- Function: FP-INPUT-STREAM (stream) |
| 6521 |
Package:SI |
| 6522 |
|
| 6523 |
Return a unix stream for input associated to STREAM if possible, |
| 6524 |
otherwise return nil. |
| 6525 |
|
| 6526 |
-- Function: FP-OUTPUT-STREAM (stream) |
| 6527 |
Package:SI |
| 6528 |
|
| 6529 |
Return a unix stream for output associated to STREAM if possible, |
| 6530 |
otherwise return nil. |
| 6531 |
|
| 6532 |
-- Function: XDR-READ (stream element) |
| 6533 |
Package:SI |
| 6534 |
|
| 6535 |
Read one item from STREAM of type the type of ELEMENT. The |
| 6536 |
representation of the elements is machine independent. The xdr |
| 6537 |
routines are what is used by the basic unix rpc calls. |
| 6538 |
|
| 6539 |
-- Function: XDR-WRITE (stream element) |
| 6540 |
Package:SI |
| 6541 |
|
| 6542 |
Write to STREAM the given ELEMENT. |
| 6543 |
|
| 6544 |
-- Variable: *TOP-LEVEL-HOOK* |
| 6545 |
Package:SI If this variable is has a function as its value at start |
| 6546 |
up time, then it is run immediately after the init.lsp file is |
| 6547 |
loaded. This is useful for starting up an alternate top level |
| 6548 |
loop. |
| 6549 |
|
| 6550 |
-- Function: RUN-PROCESS (string arglist) |
| 6551 |
Package:SI |
| 6552 |
|
| 6553 |
Execute the command STRING in a subshell passing the strings in the |
| 6554 |
list ARGLIST as arguments to the command. Return a two way stream |
| 6555 |
associated to this. Use si::fp-output-stream to get an associated |
| 6556 |
output stream or si::fp-input-stream. |
| 6557 |
|
| 6558 |
Bugs: It does not properly deallocate everything, so that it will |
| 6559 |
fail if you call it too many times. |
| 6560 |
|
| 6561 |
-- Variable: *CASE-FOLD-SEARCH* |
| 6562 |
Package: SI Non nil means that a string-match should ignore case |
| 6563 |
|
| 6564 |
-- Function: STRING-MATCH (pattern string &optional start end) |
| 6565 |
Package: SI Match regexp PATTERN in STRING starting in string |
| 6566 |
starting at START and ending at END. Return -1 if match not found, |
| 6567 |
otherwise return the start index of the first matchs. The variable |
| 6568 |
*MATCH-DATA* will be set to a fixnum array of sufficient size to |
| 6569 |
hold the matches, to be obtained with match-beginning and |
| 6570 |
match-end. If it already contains such an array, then the contents |
| 6571 |
of it will be over written. |
| 6572 |
|
| 6573 |
The form of a regexp pattern is discussed in *Note Regular |
| 6574 |
Expressions::. |
| 6575 |
|
| 6576 |
-- Function: MATCH-BEGINNING (index) |
| 6577 |
Returns the beginning of the I'th match from the previous |
| 6578 |
STRING-MATCH, where the 0th is for the whole regexp and the |
| 6579 |
subsequent ones match parenthetical expressions. -1 is returned if |
| 6580 |
there is no match, or if the *match-data* vector is not a fixnum |
| 6581 |
array. |
| 6582 |
|
| 6583 |
-- Function: MATCH-END (index) |
| 6584 |
Returns the end of the I'th match from the previous STRING-MATCH |
| 6585 |
|
| 6586 |
-- Function: SOCKET (port &key host server async myaddr myport daemon) |
| 6587 |
|
| 6588 |
Establishes a socket connection to the specified PORT under a |
| 6589 |
variety of circumstances. |
| 6590 |
|
| 6591 |
If HOST is specified, then it is a string designating the IP |
| 6592 |
address of the server to which we are the client. ASYNC specifies |
| 6593 |
that the connection should be made asynchronously, and the call |
| 6594 |
return immediately. MYADDR and MYPORT can specify the IP address |
| 6595 |
and port respectively of a client connection, for example when the |
| 6596 |
running machine has several network interfaces. |
| 6597 |
|
| 6598 |
If SERVER is specified, then it is a function which will handle |
| 6599 |
incoming connections to this PORT. DAEMON specifies that the |
| 6600 |
running process should be forked to handle incoming connections in |
| 6601 |
the background. If DAEMON is set to the keyword PERSISTENT, then |
| 6602 |
the backgrounded process will survive when the parent process |
| 6603 |
exits, and the SOCKET call returns NIL. Any other non-NIL setting |
| 6604 |
of DAEMON causes the socket call to return the process id of the |
| 6605 |
backgrounded process. DAEMON currently only works on BSD and Linux |
| 6606 |
based systems. |
| 6607 |
|
| 6608 |
If DAEMON is not set or nil, or if the socket is not a SERVER |
| 6609 |
socket, then the SOCKET call returns a two way stream. In this |
| 6610 |
case, the running process is responsible for all I/O operations on |
| 6611 |
the stream. Specifically, if a SERVER socket is created as a |
| 6612 |
non-DAEMON, then the running process must LISTEN for connections, |
| 6613 |
ACCEPT them when present, and call the SERVER function on the |
| 6614 |
stream returned by ACCEPT. |
| 6615 |
|
| 6616 |
-- Function: ACCEPT (stream) |
| 6617 |
|
| 6618 |
Creates a new two-way stream to handle an individual incoming |
| 6619 |
connection to STREAM, which must have been created with the SOCKET |
| 6620 |
function with the SERVER keyword set. ACCEPT should only be |
| 6621 |
invoked when LISTEN on STREAM returns T. If the STREAM was created |
| 6622 |
with the DAEMON keyword set in the call to SOCKET, ACCEPT is |
| 6623 |
unnecessary and will be called automatically as needed. |
| 6624 |
|
| 6625 |
* Menu: |
| 6626 |
|
| 6627 |
* Regular Expressions:: |
| 6628 |
|
| 6629 |
|
| 6630 |
File: gcl-si.info, Node: Regular Expressions, Prev: System Definitions, Up: System Definitions |
| 6631 |
|
| 6632 |
17.1 Regular Expressions |
| 6633 |
======================== |
| 6634 |
|
| 6635 |
The function 'string-match' (*Index string-match::) is used to match a |
| 6636 |
regular expression against a string. If the variable |
| 6637 |
'*case-fold-search*' is not nil, case is ignored in the match. To |
| 6638 |
determine the extent of the match use *Index match-beginning:: and |
| 6639 |
*Index match-end::. |
| 6640 |
|
| 6641 |
Regular expressions are implemented using Henry Spencer's package |
| 6642 |
(thank you Henry!), and much of the description of regular expressions |
| 6643 |
below is copied verbatim from his manual entry. Code for delimited |
| 6644 |
searches, case insensitive searches, and speedups to allow fast |
| 6645 |
searching of long files was contributed by W. Schelter. The speedups |
| 6646 |
use an adaptation by Schelter of the Boyer and Moore string search |
| 6647 |
algorithm to the case of branched regular expressions. These allow such |
| 6648 |
expressions as 'not_there|really_not' to be searched for 30 times faster |
| 6649 |
than in GNU emacs (1995), and 200 times faster than in the original |
| 6650 |
Spencer method. Expressions such as [a-u]bcdex get a speedup of 60 and |
| 6651 |
194 times respectively. This is based on searching a string of 50000 |
| 6652 |
characters (such as the file tk.lisp). |
| 6653 |
|
| 6654 |
* A regular expression is a string containing zero or more branches |
| 6655 |
which are separated by '|'. A match of the regular expression |
| 6656 |
against a string is simply a match of the string with one of the |
| 6657 |
branches. |
| 6658 |
* Each branch consists of zero or more pieces, concatenated. A |
| 6659 |
matching string must contain an initial substring matching the |
| 6660 |
first piece, immediately followed by a second substring matching |
| 6661 |
the second piece and so on. |
| 6662 |
* Each piece is an atom optionally followed by '+', '*', or '?'. |
| 6663 |
* An atom followed by '+' matches a sequence of 1 or more matches of |
| 6664 |
the atom. |
| 6665 |
* An atom followed by '*' matches a sequence of 0 or more matches of |
| 6666 |
the atom. |
| 6667 |
* An atom followed by '?' matches a match of the atom, or the null |
| 6668 |
string. |
| 6669 |
* An atom is |
| 6670 |
- a regular expression in parentheses matching a match for the |
| 6671 |
regular expression |
| 6672 |
- a range see below |
| 6673 |
- a '.' matching any single character |
| 6674 |
- a '^' matching the null string at the beginning of the input |
| 6675 |
string |
| 6676 |
- a '$' matching the null string at the end of the input string |
| 6677 |
- a '\' followed by a single character matching that character |
| 6678 |
- a single character with no other significance (matching that |
| 6679 |
character). |
| 6680 |
* A range is a sequence of characters enclosed in '[]'. It normally |
| 6681 |
matches any single character from the sequence. |
| 6682 |
- If the sequence begins with '^', it matches any single |
| 6683 |
character not from the rest of the sequence. |
| 6684 |
- If two characters in the sequence are separated by '-', this |
| 6685 |
is shorthand for the full list of ASCII characters between |
| 6686 |
them (e.g. '[0-9]' matches any decimal digit). |
| 6687 |
- To include a literal ']' in the sequence, make it the first |
| 6688 |
character (following a possible '^'). |
| 6689 |
- To include a literal '-', make it the first or last character. |
| 6690 |
|
| 6691 |
Ordering Multiple Matches |
| 6692 |
------------------------- |
| 6693 |
|
| 6694 |
In general there may be more than one way to match a regular expression |
| 6695 |
to an input string. For example, consider the command |
| 6696 |
|
| 6697 |
(string-match "(a*)b*" "aabaaabb") |
| 6698 |
|
| 6699 |
Considering only the rules given so far, the value of (list-matches 0 |
| 6700 |
1) might be '("aabb" "aa")' or '("aaab" "aaa")' or '("ab" "a")' or any |
| 6701 |
of several other combinations. To resolve this potential ambiguity |
| 6702 |
string-match chooses among alternatives using the rule first then |
| 6703 |
longest. In other words, it considers the possible matches in order |
| 6704 |
working from left to right across the input string and the pattern, and |
| 6705 |
it attempts to match longer pieces of the input string before shorter |
| 6706 |
ones. More specifically, the following rules apply in decreasing order |
| 6707 |
of priority: |
| 6708 |
[1] If a regular expression could match two different parts of an |
| 6709 |
input string then it will match the one that begins earliest. |
| 6710 |
[2] If a regular expression contains | operators then the leftmost |
| 6711 |
matching sub-expression is chosen. |
| 6712 |
[3] In *, +, and ? constructs, longer matches are chosen in |
| 6713 |
preference to shorter ones. |
| 6714 |
[4] In sequences of expression components the components are |
| 6715 |
considered from left to right. |
| 6716 |
|
| 6717 |
In the example from above, (a*)b* matches aab: the (a*) portion of |
| 6718 |
the pattern is matched first and it consumes the leading aa; then the b* |
| 6719 |
portion of the pattern consumes the next b. Or, consider the following |
| 6720 |
example: |
| 6721 |
|
| 6722 |
(string-match "(ab|a)(b*)c" "xabc") ==> 1 |
| 6723 |
(list-matches 0 1 2 3) ==> ("abc" "ab" "" NIL) |
| 6724 |
(match-beginning 0) ==> 1 |
| 6725 |
(match-end 0) ==> 4 |
| 6726 |
(match-beginning 1) ==> 1 |
| 6727 |
(match-end 1) ==> 3 |
| 6728 |
(match-beginning 2) ==> 3 |
| 6729 |
(match-end 2) ==> 3 |
| 6730 |
(match-beginning 3) ==> -1 |
| 6731 |
(match-end 3) ==> -1 |
| 6732 |
|
| 6733 |
|
| 6734 |
In the above example the return value of '1' (which is '> -1') |
| 6735 |
indicates that a match was found. The entire match runs from 1 to 4. |
| 6736 |
Rule 4 specifies that (ab|a) gets first shot at the input string and |
| 6737 |
Rule 2 specifies that the ab sub-expression is checked before the a |
| 6738 |
sub-expression. Thus the b has already been claimed before the (b*) |
| 6739 |
component is checked and (b*) must match an empty string. |
| 6740 |
|
| 6741 |
The special characters in the string '"\()[]+.*|^$?"', must be |
| 6742 |
quoted, if a simple string search is desired. The function |
| 6743 |
re-quote-string is provided for this purpose. |
| 6744 |
(re-quote-string "*standard*") ==> "\\*standard\\*" |
| 6745 |
|
| 6746 |
(string-match (re-quote-string "*standard*") "X *standard* ") |
| 6747 |
==> 2 |
| 6748 |
|
| 6749 |
(string-match "*standard*" "X *standard* ") |
| 6750 |
Error: Regexp Error: ?+* follows nothing |
| 6751 |
Note there is actually just one '\' before the '*' but the printer |
| 6752 |
makes two so that the string can be read, since '\' is also the lisp |
| 6753 |
quote character. In the last example an error is signalled since the |
| 6754 |
special character '*' must follow an atom if it is interpreted as a |
| 6755 |
regular expression. |
| 6756 |
|
| 6757 |
|
| 6758 |
File: gcl-si.info, Node: Debugging, Next: Miscellaneous, Prev: System Definitions, Up: Top |
| 6759 |
|
| 6760 |
18 Debugging |
| 6761 |
************ |
| 6762 |
|
| 6763 |
* Menu: |
| 6764 |
|
| 6765 |
* Source Level Debugging in Emacs:: |
| 6766 |
* Low Level Debug Functions:: |
| 6767 |
|
| 6768 |
|
| 6769 |
File: gcl-si.info, Node: Source Level Debugging in Emacs, Next: Low Level Debug Functions, Prev: Debugging, Up: Debugging |
| 6770 |
|
| 6771 |
18.1 Source Level Debugging in Emacs |
| 6772 |
==================================== |
| 6773 |
|
| 6774 |
In emacs load (load "dbl.el") from the gcl/doc directory. [ It also |
| 6775 |
requires gcl.el from that directory. Your system administrator should |
| 6776 |
do make in the doc directory, so that these files are copied to the |
| 6777 |
standard location.] |
| 6778 |
|
| 6779 |
OVERVIEW: |
| 6780 |
|
| 6781 |
Lisp files loaded with si::nload will have source line information |
| 6782 |
about them recorded. Break points may be set, and functions stepped. |
| 6783 |
Source code will be automatically displayed in the other window, with a |
| 6784 |
little arrow beside the current line. The backtrace (command :bt) will |
| 6785 |
show line information and you will get automatic display of the source |
| 6786 |
as you move up and down the stack. |
| 6787 |
|
| 6788 |
FUNCTIONS: break points which have been set. si::nload (file) load a |
| 6789 |
lisp file collecting source line information. |
| 6790 |
|
| 6791 |
si::break-function (function &optional line absolute) set up a |
| 6792 |
breakpoint for FUNCTION at LINE relative to start or ABSOLUTE |
| 6793 |
|
| 6794 |
EMACS COMMANDS: M-x dbl makes a dbl buffer, suitable for running an |
| 6795 |
inferior gcl. It has special keybindings for stepping and viewing |
| 6796 |
sources. You may start your favorite gcl program in the dbl shell |
| 6797 |
buffer. |
| 6798 |
|
| 6799 |
Inferior Dbl Mode: Major mode for interacting with an inferior Dbl |
| 6800 |
process. The following commands are available: |
| 6801 |
|
| 6802 |
C-c l dbl-find-line |
| 6803 |
|
| 6804 |
ESC d dbl-:down ESC u dbl-:up ESC c dbl-:r ESC n dbl-:next ESC i |
| 6805 |
dbl-:step ESC s dbl-:step |
| 6806 |
|
| 6807 |
M-x dbl-display-frame displays in the other window the last line |
| 6808 |
referred to in the dbl buffer. |
| 6809 |
|
| 6810 |
ESC i and ESC n in the dbl window, call dbl to step and next and then |
| 6811 |
update the other window with the current file and position. |
| 6812 |
|
| 6813 |
If you are in a source file, you may select a point to break at, by |
| 6814 |
doing C-x SPC. |
| 6815 |
|
| 6816 |
Commands: Many commands are inherited from shell mode. Additionally |
| 6817 |
we have: |
| 6818 |
|
| 6819 |
M-x dbl-display-frame display frames file in other window ESC i |
| 6820 |
advance one line in program ESC n advance one line in program (skip over |
| 6821 |
calls). M-x send-dbl-command used for special printing of an arg at the |
| 6822 |
current point. C-x SPACE sets break point at current line. |
| 6823 |
|
| 6824 |
------------------- |
| 6825 |
|
| 6826 |
When visiting a lisp buffer (if gcl.el is loaded in your emacs) the |
| 6827 |
command c-m-x evaluates the current defun into the process running in |
| 6828 |
the other window. Line information will be kept. This line information |
| 6829 |
allows you to set break points at a given line (by typing C-x \space on |
| 6830 |
the line in the source file where you want the break to occur. Once |
| 6831 |
stopped within a function you may single step with M-s. This moves one |
| 6832 |
line at a time in the source code, displaying a little arrow beside your |
| 6833 |
current position. M-c is like M-s, except that function invocations are |
| 6834 |
skipped over, rather than entered into. M-c continues execution. |
| 6835 |
|
| 6836 |
Keywords typed at top level, in the debug loop have a special |
| 6837 |
meaning: |
| 6838 |
|
| 6839 |
:delete [n1] [n2] .. - delete all break points or just n1,n2 |
| 6840 |
:disable [n1] [n2] .. - disable all break points or just n1,n2 |
| 6841 |
:enable [n1] [n2] .. - enable all break points or just n1,n2 |
| 6842 |
:info [:bkpt] -print information about |
| 6843 |
:break [fun] [line] - break at the current location, or if fun is |
| 6844 |
supplied in fun. Break at the beginning unless a line offset from |
| 6845 |
the beginning of fun is supplied. |
| 6846 |
:fr [n] go to frame n When in frame n, if the frame is interpreted, |
| 6847 |
typing the name of locals, will print their values. If it is |
| 6848 |
compiled you must use (si::loc j) to print 'locj'. Autodisplay of |
| 6849 |
the source will take place if it is interpreted and the line can be |
| 6850 |
determined. |
| 6851 |
:up [n] go up n frames from the current frame. |
| 6852 |
:down [n] go down n frames |
| 6853 |
:bt [n] back trace starting at the current frame and going to top |
| 6854 |
level If n is specified show only n frames. |
| 6855 |
:r If stopped in a function resume. If at top level in the dbl |
| 6856 |
loop, exit and resume an outer loop. |
| 6857 |
:q quit the computation back to top level dbl loop. |
| 6858 |
:step step to the next line with line information |
| 6859 |
:next step to the next line with line information skipping over |
| 6860 |
function invocations. |
| 6861 |
|
| 6862 |
Files: debug.lsp dbl.el gcl.el |
| 6863 |
|
| 6864 |
|
| 6865 |
File: gcl-si.info, Node: Low Level Debug Functions, Prev: Source Level Debugging in Emacs, Up: Debugging |
| 6866 |
|
| 6867 |
18.2 Low Level Debug Functions |
| 6868 |
============================== |
| 6869 |
|
| 6870 |
Use the following functions to directly access GCL stacks. |
| 6871 |
(SI:VS i) Returns the i-th entity in VS. |
| 6872 |
(SI:IHS-VS i) Returns the VS index of the i-th entity in IHS. |
| 6873 |
(SI:IHS-FUN i) Returns the function of the i-th entity in IHS. |
| 6874 |
(SI:FRS-VS i) Returns the VS index of the i-th entity in FRS. |
| 6875 |
(SI:FRS-BDS i) Returns the BDS index of the i-th entity in FRS. |
| 6876 |
(SI:FRS-IHS i) Returns the IHS index of the i-th entity in FRS. |
| 6877 |
(SI:BDS-VAR i) Returns the symbol of the i-th entity in BDS. |
| 6878 |
(SI:BDS-VAL i) Returns the value of the i-th entity in BDS. |
| 6879 |
|
| 6880 |
(SI:SUPER-GO i tag) |
| 6881 |
Jumps to the specified tag established by the TAGBODY frame at |
| 6882 |
FRS[i]. Both arguments are evaluated. If FRS[i] happens to be |
| 6883 |
a non-TAGBODY frame, then (THROW (SI:IHS-TAG i) (VALUES)) is |
| 6884 |
performed. |
| 6885 |
|
| 6886 |
|
| 6887 |
File: gcl-si.info, Node: Miscellaneous, Next: Compiler Definitions, Prev: Debugging, Up: Top |
| 6888 |
|
| 6889 |
19 Miscellaneous |
| 6890 |
**************** |
| 6891 |
|
| 6892 |
* Menu: |
| 6893 |
|
| 6894 |
* Environment:: |
| 6895 |
* Inititialization:: |
| 6896 |
* Low Level X Interface:: |
| 6897 |
|
| 6898 |
|
| 6899 |
File: gcl-si.info, Node: Environment, Next: Inititialization, Prev: Miscellaneous, Up: Miscellaneous |
| 6900 |
|
| 6901 |
19.1 Environment |
| 6902 |
================ |
| 6903 |
|
| 6904 |
The environment in GCL which is passed to macroexpand and other |
| 6905 |
functions requesting an environment, should be a list of 3 lists. The |
| 6906 |
first list looks like ((v1 val1) (v2 val2) ..) where vi are variables |
| 6907 |
and vali are their values. The second is a list of ((fname1 . fbody1) |
| 6908 |
(fname2 . fbody2) ...) where fbody1 is either (macro lambda-list |
| 6909 |
lambda-body) or (lambda-list lambda-body) depending on whether this is a |
| 6910 |
macro or a function. The third list contains tags and blocks. |
| 6911 |
|
| 6912 |
|
| 6913 |
File: gcl-si.info, Node: Inititialization, Next: Low Level X Interface, Prev: Environment, Up: Miscellaneous |
| 6914 |
|
| 6915 |
19.2 Initialization |
| 6916 |
=================== |
| 6917 |
|
| 6918 |
If the file init.lsp exists in the current directory, it is loaded at |
| 6919 |
startup. The first argument passed to the executable image should be |
| 6920 |
the system directory. Normally this would be gcl/unixport. This |
| 6921 |
directory is stored in the si::*system-directory* variable. If the file |
| 6922 |
sys-init.lsp exists in the system directory, it is loaded before |
| 6923 |
init.lsp. See also si::*TOP-LEVEL-HOOK*. |
| 6924 |
|
| 6925 |
|
| 6926 |
File: gcl-si.info, Node: Low Level X Interface, Prev: Inititialization, Up: Miscellaneous |
| 6927 |
|
| 6928 |
19.3 Low Level X Interface |
| 6929 |
========================== |
| 6930 |
|
| 6931 |
A sample program for drawing things on X windows from lisp is included |
| 6932 |
in the file gcl/lsp/littleXlsp.lsp |
| 6933 |
|
| 6934 |
That routine invokes the corresponding C routines in XLIB. So in |
| 6935 |
order to use it you must 'faslink' in the X routines. Directions are |
| 6936 |
given at the beginning of the lisp file, for either building them into |
| 6937 |
the image or using faslink. |
| 6938 |
|
| 6939 |
This program is also a good tutorial on invoking C from lisp. |
| 6940 |
|
| 6941 |
See also defentry and faslink. |
| 6942 |
|
| 6943 |
|
| 6944 |
File: gcl-si.info, Node: Compiler Definitions, Next: Function and Variable Index, Prev: Miscellaneous, Up: Top |
| 6945 |
|
| 6946 |
20 Compiler Definitions |
| 6947 |
*********************** |
| 6948 |
|
| 6949 |
-- Function: EMIT-FN (turn-on) |
| 6950 |
Package:COMPILER |
| 6951 |
|
| 6952 |
If TURN-ON is t, the subsequent calls to COMPILE-FILE will cause |
| 6953 |
compilation of foo.lisp to emit a foo.fn as well as foo.o. The .fn |
| 6954 |
file contains cross referencing information as well as information |
| 6955 |
useful to the collection utilities in cmpnew/collectfn This latter |
| 6956 |
file must be manually loaded to call emit-fn. |
| 6957 |
|
| 6958 |
-- Variable: *CMPINCLUDE-STRING* |
| 6959 |
Package:COMPILER If it is a string it holds the text of the |
| 6960 |
cmpinclude.h file appropriate for this version. Otherwise the |
| 6961 |
usual #include of *cmpinclude* will be used. To disable this |
| 6962 |
feature set *cmpinclude-string* to NIL in the init-form. |
| 6963 |
|
| 6964 |
-- Function: EMIT-FN (turn-on) |
| 6965 |
Package:COMPILER |
| 6966 |
|
| 6967 |
If TURN-ON is t, then subsequent calls to compile-file on a file |
| 6968 |
foo.lisp cause output of a file foo.fn. This .fn file contains |
| 6969 |
lisp structures describing the functions in foo.lisp. Some tools |
| 6970 |
for analyzing this data base are WHO-CALLS, |
| 6971 |
LIST-UNDEFINED-FUNCTIONS, LIST-UNCALLED-FUNCTIONS, and |
| 6972 |
MAKE-PROCLAIMS. |
| 6973 |
|
| 6974 |
Usage: (compiler::emit-fn t) (compile-file "foo1.lisp") |
| 6975 |
(compile-file "foo2.lisp") |
| 6976 |
|
| 6977 |
This would create foo1.fn and foo2.fn. These may be loaded using |
| 6978 |
LOAD. Each time compile-file is called the data base is cleared. |
| 6979 |
Immediately after the compilation, the data base consists of data |
| 6980 |
from the compilation. Thus if you wished to find functions called |
| 6981 |
but not defined in the current file, you could do |
| 6982 |
(list-undefined-functions), immediately following the compilation. |
| 6983 |
If you have a large system, you would load all the .fn files before |
| 6984 |
using the above tools. |
| 6985 |
|
| 6986 |
-- Function: MAKE-ALL-PROCLAIMS (&rest directories) |
| 6987 |
Package:COMPILER |
| 6988 |
|
| 6989 |
For each D in DIRECTORIES all files in (directory D) are loaded. |
| 6990 |
|
| 6991 |
For example (make-all-proclaims "lsp/*.fn" "cmpnew/*.fn") would |
| 6992 |
load any files in lsp/*.fn and cmpnew/*.fn. |
| 6993 |
|
| 6994 |
[See EMIT-FN for details on creation of .fn files] |
| 6995 |
|
| 6996 |
Then calculations on the newly loaded .fn files are made, to |
| 6997 |
determine function proclamations. If number of values of a |
| 6998 |
function cannot be determined [for example because of a final |
| 6999 |
funcall, or call of a function totally unknown at this time] then |
| 7000 |
return type * is assigned. |
| 7001 |
|
| 7002 |
Finally a file sys-proclaim.lisp is written out. This file |
| 7003 |
contains function proclamations. |
| 7004 |
|
| 7005 |
(load "sys-proclaim.lisp") (compile-file "foo1.lisp") (compile-file |
| 7006 |
"foo2.lisp") |
| 7007 |
|
| 7008 |
-- Function: MAKE-PROCLAIMS (&optional (stream *standard-output*)) |
| 7009 |
Package:COMPILER |
| 7010 |
|
| 7011 |
Write to STREAM the function proclaims from the current data base. |
| 7012 |
Usually a number of .fn files are loaded prior to running this. |
| 7013 |
See EMIT-FN for details on how to collect this. Simply use LOAD to |
| 7014 |
load in .fn files. |
| 7015 |
|
| 7016 |
-- Function: LIST-UNDEFINED-FUNCTIONS () |
| 7017 |
Package:COMPILER |
| 7018 |
|
| 7019 |
Return a list of all functions called but not defined, in the |
| 7020 |
current data base (see EMIT-FN). |
| 7021 |
|
| 7022 |
Sample: |
| 7023 |
(compiler::emit-fn t) |
| 7024 |
(compile-file "foo1.lisp") |
| 7025 |
(compiler::list-undefined-functions) |
| 7026 |
or |
| 7027 |
(mapcar 'load (directory "*.fn")) (compiler::list-undefined-functions) |
| 7028 |
|
| 7029 |
|
| 7030 |
-- Function: WHO-CALLS (function-name) |
| 7031 |
Package:COMPILER |
| 7032 |
|
| 7033 |
List all functions in the data base [see emit-fn] which call |
| 7034 |
FUNCTION-NAME. |
| 7035 |
|
| 7036 |
-- Function: LIST-UNCALLED-FUNCTIONS () |
| 7037 |
Package:COMPILER |
| 7038 |
|
| 7039 |
Examine the current data base [see emit-fn] for any functions or |
| 7040 |
macros which are called but are not: fboundp, OR defined in the |
| 7041 |
data base, OR having special compiler optimizer properties which |
| 7042 |
would eliminate an actual call. |
| 7043 |
|
| 7044 |
-- Variable: *CC* |
| 7045 |
Package:COMPILER Has value a string which controls which C compiler |
| 7046 |
is used by GCL. Usually this string is obtained from the |
| 7047 |
machine.defs file, but may be reset by the user, to change |
| 7048 |
compilers or add an include path. |
| 7049 |
|
| 7050 |
-- Variable: *SPLIT-FILES* |
| 7051 |
Package:COMPILER This affects the behaviour of compile-file, and is |
| 7052 |
useful for cases where the C compiler cannot handle large C files |
| 7053 |
resulting from lisp compilation. This scheme should allow |
| 7054 |
arbitrarily long lisp files to be compiled. |
| 7055 |
|
| 7056 |
If the value [default NIL] is a positive integer, then the source |
| 7057 |
file will be compiled into several object files whose names have |
| 7058 |
0,1,2,.. prepended, and which will be loaded by the main object |
| 7059 |
file. File 0 will contain compilation of top level forms thru |
| 7060 |
position *split-files* in the lisp source file, and file 1 the next |
| 7061 |
forms, etc. Thus a 180k file would probably result in three object |
| 7062 |
files (plus the master object file of the same name) if |
| 7063 |
*split-files* was set to 60000. The package information will be |
| 7064 |
inserted in each file. |
| 7065 |
|
| 7066 |
-- Variable: *COMPILE-ORDINARIES* |
| 7067 |
Package:COMPILER If this has a non nil value [default = nil], then |
| 7068 |
all top level forms will be compiled into machine instructions. |
| 7069 |
Otherwise only defun's, defmacro's, and top level forms beginning |
| 7070 |
with (progn 'compile ...) will do so. |
| 7071 |
|
| 7072 |
|
| 7073 |
File: gcl-si.info, Node: Function and Variable Index, Prev: Compiler Definitions, Up: Top |
| 7074 |
|
| 7075 |
Appendix A Function and Variable Index |
| 7076 |
************************************** |
| 7077 |
|
| 7078 |
|