| 1 | ;;; known-functions.lisp |
|---|
| 2 | ;;; |
|---|
| 3 | ;;; Copyright (C) 2005-2006 Peter Graves |
|---|
| 4 | ;;; $Id: known-functions.lisp 14478 2013-04-24 12:51:14Z rschlatte $ |
|---|
| 5 | ;;; |
|---|
| 6 | ;;; This program is free software; you can redistribute it and/or |
|---|
| 7 | ;;; modify it under the terms of the GNU General Public License |
|---|
| 8 | ;;; as published by the Free Software Foundation; either version 2 |
|---|
| 9 | ;;; of the License, or (at your option) any later version. |
|---|
| 10 | ;;; |
|---|
| 11 | ;;; This program is distributed in the hope that it will be useful, |
|---|
| 12 | ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | ;;; GNU General Public License for more details. |
|---|
| 15 | ;;; |
|---|
| 16 | ;;; You should have received a copy of the GNU General Public License |
|---|
| 17 | ;;; along with this program; if not, write to the Free Software |
|---|
| 18 | ;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|---|
| 19 | ;;; |
|---|
| 20 | ;;; As a special exception, the copyright holders of this library give you |
|---|
| 21 | ;;; permission to link this library with independent modules to produce an |
|---|
| 22 | ;;; executable, regardless of the license terms of these independent |
|---|
| 23 | ;;; modules, and to copy and distribute the resulting executable under |
|---|
| 24 | ;;; terms of your choice, provided that you also meet, for each linked |
|---|
| 25 | ;;; independent module, the terms and conditions of the license of that |
|---|
| 26 | ;;; module. An independent module is a module which is not derived from |
|---|
| 27 | ;;; or based on this library. If you modify this library, you may extend |
|---|
| 28 | ;;; this exception to your version of the library, but you are not |
|---|
| 29 | ;;; obligated to do so. If you do not wish to do so, delete this |
|---|
| 30 | ;;; exception statement from your version. |
|---|
| 31 | |
|---|
| 32 | (in-package #:system) |
|---|
| 33 | |
|---|
| 34 | (require '#:compiler-types) |
|---|
| 35 | |
|---|
| 36 | ;; (declaim (ftype (function * symbol) copy-symbol gensym)) |
|---|
| 37 | ;; (declaim (ftype (function * symbol) fdefinition-block-name)) |
|---|
| 38 | (defknown (copy-symbol gensym fdefinition-block-name) * symbol) |
|---|
| 39 | |
|---|
| 40 | ;; (declaim (ftype (function (t t) t) gethash1)) |
|---|
| 41 | (defknown gethash1 (t t) t) |
|---|
| 42 | ;; (declaim (ftype (function (t) symbol) make-keyword)) |
|---|
| 43 | (defknown make-keyword (t) symbol) |
|---|
| 44 | |
|---|
| 45 | ;; (declaim (ftype (function * list) |
|---|
| 46 | ;; backq-list backq-list* backq-append backq-nconc |
|---|
| 47 | ;; %class-precedence-list)) |
|---|
| 48 | (defknown (backq-list backq-list* backq-append backq-nconc %class-precedence-list) |
|---|
| 49 | * list) |
|---|
| 50 | |
|---|
| 51 | ;; (declaim (ftype (function * cons) backq-cons)) |
|---|
| 52 | (defknown backq-cons * cons) |
|---|
| 53 | |
|---|
| 54 | ;; (declaim (ftype (function (character) character) char-downcase char-upcase)) |
|---|
| 55 | (defknown (char-downcase char-upcase) (character) character) |
|---|
| 56 | |
|---|
| 57 | ;; (declaim (ftype (function * t) finish-output force-output clear-output terpri fresh-line)) |
|---|
| 58 | (defknown (finish-output force-output clear-output terpri fresh-line) * t) |
|---|
| 59 | |
|---|
| 60 | ;; (declaim (ftype (function (symbol) string) symbol-name)) |
|---|
| 61 | (defknown symbol-name (symbol) string) |
|---|
| 62 | |
|---|
| 63 | ;; (declaim |
|---|
| 64 | ;; (ftype (function * string) |
|---|
| 65 | ;; get-output-stream-string |
|---|
| 66 | ;; nstring-capitalize |
|---|
| 67 | ;; nstring-downcase |
|---|
| 68 | ;; nstring-upcase |
|---|
| 69 | ;; string-capitalize |
|---|
| 70 | ;; string-downcase |
|---|
| 71 | ;; string-upcase |
|---|
| 72 | ;; write-line |
|---|
| 73 | ;; write-string |
|---|
| 74 | ;; )) |
|---|
| 75 | (defknown (get-output-stream-string |
|---|
| 76 | nstring-capitalize |
|---|
| 77 | nstring-downcase |
|---|
| 78 | nstring-upcase |
|---|
| 79 | string-capitalize |
|---|
| 80 | string-downcase |
|---|
| 81 | string-upcase |
|---|
| 82 | write-line |
|---|
| 83 | write-string) * string) |
|---|
| 84 | |
|---|
| 85 | (defknown (%failed-aver |
|---|
| 86 | %ldb |
|---|
| 87 | %make-structure |
|---|
| 88 | %method-function |
|---|
| 89 | put |
|---|
| 90 | %set-cddr |
|---|
| 91 | %stream-terpri |
|---|
| 92 | %stream-write-char |
|---|
| 93 | alphanumericp |
|---|
| 94 | array-has-fill-pointer-p |
|---|
| 95 | aset |
|---|
| 96 | bit-and |
|---|
| 97 | bit-andc1 |
|---|
| 98 | bit-andc2 |
|---|
| 99 | bit-eqv |
|---|
| 100 | bit-ior |
|---|
| 101 | bit-nand |
|---|
| 102 | bit-nor |
|---|
| 103 | bit-not |
|---|
| 104 | bit-orc1 |
|---|
| 105 | bit-orc2 |
|---|
| 106 | bit-xor |
|---|
| 107 | both-case-p |
|---|
| 108 | built-in-function-p |
|---|
| 109 | caadr |
|---|
| 110 | char-equal |
|---|
| 111 | characterp |
|---|
| 112 | charpos |
|---|
| 113 | close |
|---|
| 114 | coerce |
|---|
| 115 | coerce-to-function |
|---|
| 116 | compile-file-pathname |
|---|
| 117 | complex |
|---|
| 118 | conjugate |
|---|
| 119 | count |
|---|
| 120 | count-if |
|---|
| 121 | count-if-not |
|---|
| 122 | delete-file |
|---|
| 123 | directory-namestring |
|---|
| 124 | eighth |
|---|
| 125 | enough-namestring |
|---|
| 126 | every |
|---|
| 127 | fifth |
|---|
| 128 | file-directory-p |
|---|
| 129 | file-namestring |
|---|
| 130 | file-position |
|---|
| 131 | fill |
|---|
| 132 | first |
|---|
| 133 | float |
|---|
| 134 | fmakunbound |
|---|
| 135 | fourth |
|---|
| 136 | fset |
|---|
| 137 | ftype-result-type |
|---|
| 138 | get-internal-real-time |
|---|
| 139 | getf |
|---|
| 140 | hash-table-count |
|---|
| 141 | hash-table-p |
|---|
| 142 | host-namestring |
|---|
| 143 | intersection |
|---|
| 144 | ldb |
|---|
| 145 | ldb-test |
|---|
| 146 | list-all-packages |
|---|
| 147 | list-find* |
|---|
| 148 | load-compiled-function |
|---|
| 149 | lower-case-p |
|---|
| 150 | make-string-output-stream |
|---|
| 151 | make-structure |
|---|
| 152 | map |
|---|
| 153 | merge-pathnames |
|---|
| 154 | namestring |
|---|
| 155 | neq |
|---|
| 156 | nintersection |
|---|
| 157 | ninth |
|---|
| 158 | normalize-type |
|---|
| 159 | nsubst |
|---|
| 160 | nsubst-if |
|---|
| 161 | nsubst-if-not |
|---|
| 162 | nth |
|---|
| 163 | pathname-type |
|---|
| 164 | pathname-type |
|---|
| 165 | pathnamep |
|---|
| 166 | phase |
|---|
| 167 | probe-file |
|---|
| 168 | proclaimed-ftype |
|---|
| 169 | random |
|---|
| 170 | read |
|---|
| 171 | read-char |
|---|
| 172 | read-sequence |
|---|
| 173 | reduce |
|---|
| 174 | replace |
|---|
| 175 | rest |
|---|
| 176 | scale-float |
|---|
| 177 | search |
|---|
| 178 | second |
|---|
| 179 | set |
|---|
| 180 | set-char |
|---|
| 181 | set-schar |
|---|
| 182 | set-std-slot-value |
|---|
| 183 | setf-function-name-p |
|---|
| 184 | seventh |
|---|
| 185 | simple-condition-format-arguments |
|---|
| 186 | simple-condition-format-control |
|---|
| 187 | simple-search |
|---|
| 188 | sixth |
|---|
| 189 | some |
|---|
| 190 | sort |
|---|
| 191 | stable-sort |
|---|
| 192 | standard-object-p |
|---|
| 193 | std-instance-layout |
|---|
| 194 | std-slot-value |
|---|
| 195 | stream-element-type |
|---|
| 196 | stream-line-number |
|---|
| 197 | string-find |
|---|
| 198 | string<= |
|---|
| 199 | structure-object-p |
|---|
| 200 | structure-ref |
|---|
| 201 | structure-set |
|---|
| 202 | subst |
|---|
| 203 | subst-if |
|---|
| 204 | subst-if-not |
|---|
| 205 | svref |
|---|
| 206 | svset |
|---|
| 207 | tenth |
|---|
| 208 | third |
|---|
| 209 | truename |
|---|
| 210 | upper-case-p |
|---|
| 211 | vector |
|---|
| 212 | vector-find* |
|---|
| 213 | vectorp |
|---|
| 214 | write-byte |
|---|
| 215 | write-sequence |
|---|
| 216 | zerop) |
|---|
| 217 | * t) |
|---|
| 218 | |
|---|
| 219 | (defknown length (sequence) (integer 0 #.(1- most-positive-fixnum))) |
|---|
| 220 | |
|---|
| 221 | (defknown (deposit-field dpb logand logcount lognor |
|---|
| 222 | mask-field |
|---|
| 223 | numerator denominator |
|---|
| 224 | boole |
|---|
| 225 | array-dimension |
|---|
| 226 | array-row-major-index |
|---|
| 227 | array-rank |
|---|
| 228 | array-total-size |
|---|
| 229 | %dpb |
|---|
| 230 | ash) |
|---|
| 231 | * integer) |
|---|
| 232 | |
|---|
| 233 | ;; (declaim (ftype (function (t) (integer 0 2147483647)) sxhash)) |
|---|
| 234 | (defknown sxhash (t) (integer 0 2147483647)) |
|---|
| 235 | |
|---|
| 236 | ;; (declaim (ftype (function (character) (unsigned-byte 16)) char-code)) |
|---|
| 237 | (defknown char-code (character) (unsigned-byte 16)) |
|---|
| 238 | |
|---|
| 239 | ;; (declaim (ftype (function (simple-string index) character) schar)) |
|---|
| 240 | (defknown schar (simple-string index) character) |
|---|
| 241 | |
|---|
| 242 | ;; (declaim (ftype (function * character) char write-char)) |
|---|
| 243 | (defknown (char write-char) * character) |
|---|
| 244 | |
|---|
| 245 | (defknown (char= char/= char< char> char<= char>= char-equal char-not-equal |
|---|
| 246 | char-lessp char-greaterp char-not-greaterp char-not-lessp) |
|---|
| 247 | * t) |
|---|
| 248 | |
|---|
| 249 | ;; (declaim |
|---|
| 250 | ;; (ftype (function (real real) real) |
|---|
| 251 | ;; mod rem)) |
|---|
| 252 | (defknown (mod rem) (real real) real) |
|---|
| 253 | |
|---|
| 254 | ;; (declaim (ftype (function (number) rational) rational rationalize)) |
|---|
| 255 | (defknown (rational rationalize) (number) rational) |
|---|
| 256 | |
|---|
| 257 | ;; (declaim (ftype (function * bit) bit sbit)) |
|---|
| 258 | (defknown (bit sbit) * bit) |
|---|
| 259 | |
|---|
| 260 | ;; (declaim (ftype (function * function) make-macro)) |
|---|
| 261 | (defknown make-macro * function) |
|---|
| 262 | |
|---|
| 263 | ;; (declaim (ftype (function * t) %set-arglist)) |
|---|
| 264 | (defknown %set-arglist * t) |
|---|
| 265 | |
|---|
| 266 | ;; (declaim (ftype (function * t) %type-error check-sequence-bounds)) |
|---|
| 267 | (defknown (%type-error check-sequence-bounds) * t) |
|---|
| 268 | |
|---|
| 269 | ;; (declaim (ftype (function * t) out-synonym-of)) |
|---|
| 270 | (defknown out-synonym-of * t) |
|---|
| 271 | |
|---|
| 272 | (defknown (error |
|---|
| 273 | compiler-style-warn |
|---|
| 274 | compiler-warn |
|---|
| 275 | compiler-error |
|---|
| 276 | compiler-unsupported) |
|---|
| 277 | * t) |
|---|
| 278 | |
|---|
| 279 | ;; (declaim (ftype (function (symbol) function) resolve)) |
|---|
| 280 | (defknown resolve (symbol) function) |
|---|
| 281 | |
|---|
| 282 | ;; (declaim (ftype (function (string fixnum character) character) %set-char)) |
|---|
| 283 | (defknown %set-char (string index character) character) |
|---|
| 284 | |
|---|
| 285 | ;; (declaim (ftype (function (t t t) t) set-function-info-value)) |
|---|
| 286 | (defknown set-function-info-value (t t t) t) |
|---|
| 287 | |
|---|
| 288 | ;; (declaim (ftype (function * hash-table) make-hash-table)) |
|---|
| 289 | (defknown make-hash-table * hash-table) |
|---|
| 290 | |
|---|
| 291 | (defknown %class-slots (class) t) |
|---|
| 292 | (defknown set-class-slots (class list) t) |
|---|
| 293 | (defknown %slot-definition-initfunction * t) |
|---|
| 294 | (defknown std-slot-boundp * t) |
|---|
| 295 | (defknown std-slot-value * t) |
|---|
| 296 | (defknown set-std-slot-value * t) |
|---|
| 297 | (defknown open * (or stream null)) |
|---|
| 298 | (defknown make-string-input-stream * stream) |
|---|
| 299 | |
|---|
| 300 | ;; Boolean predicates that can return unboxed Java booleans. |
|---|
| 301 | (defknown (arrayp |
|---|
| 302 | atom |
|---|
| 303 | consp |
|---|
| 304 | endp |
|---|
| 305 | evenp |
|---|
| 306 | floatp |
|---|
| 307 | integerp |
|---|
| 308 | listp |
|---|
| 309 | minusp |
|---|
| 310 | numberp |
|---|
| 311 | oddp |
|---|
| 312 | packagep |
|---|
| 313 | plusp |
|---|
| 314 | rationalp |
|---|
| 315 | readtablep |
|---|
| 316 | realp |
|---|
| 317 | simple-bit-vector-p |
|---|
| 318 | simple-vector-p |
|---|
| 319 | stringp |
|---|
| 320 | symbolp |
|---|
| 321 | zerop) |
|---|
| 322 | (t) boolean) |
|---|
| 323 | |
|---|
| 324 | (defknown (constantp simple-typep typep sys::%typep) |
|---|
| 325 | * boolean) |
|---|
| 326 | |
|---|
| 327 | ;; Boolean comparison operators. |
|---|
| 328 | (defknown (/= |
|---|
| 329 | < |
|---|
| 330 | <= |
|---|
| 331 | = |
|---|
| 332 | > |
|---|
| 333 | >= |
|---|
| 334 | eq |
|---|
| 335 | eql |
|---|
| 336 | equal |
|---|
| 337 | equalp) |
|---|
| 338 | * boolean) |
|---|
| 339 | |
|---|
| 340 | ;; Boolean predicates that can not (currently) return unboxed Java booleans. |
|---|
| 341 | (defknown (bit-vector-p |
|---|
| 342 | compiled-function-p |
|---|
| 343 | complexp |
|---|
| 344 | fboundp |
|---|
| 345 | functionp |
|---|
| 346 | keywordp |
|---|
| 347 | simple-string-p |
|---|
| 348 | typep) |
|---|
| 349 | (t) t) |
|---|
| 350 | |
|---|
| 351 | (defknown (boundp special-operator-p special-variable-p) |
|---|
| 352 | (symbol) t) |
|---|
| 353 | |
|---|
| 354 | ;; Moved here from jvm.lisp. |
|---|
| 355 | (defknown (+ - * / |
|---|
| 356 | 1+ 1- |
|---|
| 357 | car cdr caar cadr cdar cddr cadar caddr cdddr cddddr |
|---|
| 358 | first second third |
|---|
| 359 | list list* |
|---|
| 360 | macro-function |
|---|
| 361 | compiler-macro-function |
|---|
| 362 | sys::%defun |
|---|
| 363 | get |
|---|
| 364 | fdefinition |
|---|
| 365 | array-dimensions array-rank array-total-size |
|---|
| 366 | array-element-type upgraded-array-element-type |
|---|
| 367 | row-major-aref |
|---|
| 368 | quote function |
|---|
| 369 | map |
|---|
| 370 | mapcar |
|---|
| 371 | find position |
|---|
| 372 | append nconc subseq adjoin |
|---|
| 373 | revappend nreconc |
|---|
| 374 | copy-seq |
|---|
| 375 | assoc assoc-if assoc-if-not acons assq assql |
|---|
| 376 | char-int digit-char-p |
|---|
| 377 | member ext:memq |
|---|
| 378 | remove remove-if remove-if-not delete delete-if delete-if-not |
|---|
| 379 | symbol-function |
|---|
| 380 | coerce |
|---|
| 381 | reverse nreverse |
|---|
| 382 | last |
|---|
| 383 | cons rplaca rplacd |
|---|
| 384 | set-car set-cdr |
|---|
| 385 | copy-list copy-tree |
|---|
| 386 | make-sequence make-list make-array make-package |
|---|
| 387 | find-package |
|---|
| 388 | pathname make-pathname pathname-name directory |
|---|
| 389 | package-used-by-list package-shadowing-symbols |
|---|
| 390 | nthcdr |
|---|
| 391 | aref elt |
|---|
| 392 | not null concatenate |
|---|
| 393 | format sys::%format |
|---|
| 394 | prin1 princ print write |
|---|
| 395 | compute-restarts find-restart restart-name |
|---|
| 396 | string |
|---|
| 397 | string= |
|---|
| 398 | setq |
|---|
| 399 | multiple-value-list push pop |
|---|
| 400 | type-of class-of |
|---|
| 401 | abs |
|---|
| 402 | float-radix |
|---|
| 403 | logand logandc1 logandc2 logeqv logior lognand |
|---|
| 404 | lognot logorc1 logorc2 logxor |
|---|
| 405 | logbitp |
|---|
| 406 | slot-boundp slot-value slot-exists-p |
|---|
| 407 | allocate-instance |
|---|
| 408 | find-class |
|---|
| 409 | class-name |
|---|
| 410 | constantly |
|---|
| 411 | exp expt log |
|---|
| 412 | min max |
|---|
| 413 | realpart imagpart |
|---|
| 414 | integer-length |
|---|
| 415 | sqrt isqrt gcd lcm signum |
|---|
| 416 | open |
|---|
| 417 | svref |
|---|
| 418 | fill-pointer |
|---|
| 419 | symbol-value symbol-package package-name |
|---|
| 420 | fourth |
|---|
| 421 | vector-push vector-push-extend |
|---|
| 422 | union nunion |
|---|
| 423 | remove-duplicates delete-duplicates |
|---|
| 424 | read-byte |
|---|
| 425 | fresh-line terpri |
|---|
| 426 | lambda |
|---|
| 427 | ext:classp |
|---|
| 428 | ext:fixnump |
|---|
| 429 | ext:memql |
|---|
| 430 | sys::puthash |
|---|
| 431 | precompiler::precompile1 |
|---|
| 432 | declare |
|---|
| 433 | go |
|---|
| 434 | inst |
|---|
| 435 | emit |
|---|
| 436 | label |
|---|
| 437 | maybe-emit-clear-values |
|---|
| 438 | single-valued-p |
|---|
| 439 | sys:read-8-bits |
|---|
| 440 | sys:write-8-bits |
|---|
| 441 | sys::require-type |
|---|
| 442 | sys::arg-count-error |
|---|
| 443 | sys:subclassp |
|---|
| 444 | sys:cache-emf |
|---|
| 445 | sys:get-cached-emf |
|---|
| 446 | ext:autoloadp |
|---|
| 447 | sys::proclaim-ftype-1 |
|---|
| 448 | sys::proclaim-ftype |
|---|
| 449 | ) |
|---|
| 450 | * t) |
|---|
| 451 | |
|---|
| 452 | (defknown make-string * simple-string) |
|---|
| 453 | (defknown concatenate-to-string * simple-string) |
|---|
| 454 | |
|---|
| 455 | (defknown code-char * (or character null)) |
|---|
| 456 | |
|---|
| 457 | (defknown lookup-known-symbol (symbol) t) |
|---|
| 458 | (defknown %class-name (class) symbol) |
|---|
| 459 | |
|---|
| 460 | (defknown adjoin-eql (t t) list) |
|---|
| 461 | |
|---|
| 462 | (provide '#:known-functions) |
|---|