more-interfaces.scm 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817
  1. ; Part of Scheme 48 1.9. See file COPYING for notices and license.
  2. ; Authors: Richard Kelsey, Jonathan Rees, Mike Sperber, Robert Ransom,
  3. ; Marcel Turino, Manuel Dietrich, Marcus Crestani, Eric Knauel,
  4. ; Martin Gasbichler, Harald Glab-Phlak
  5. ; Interfaces for packages that can get loaded after the initial.image
  6. ; starts up.
  7. ; Command processor
  8. (define-interface command-processor-interface
  9. (export abort-to-command-level
  10. add-sentinel!
  11. command-continuation
  12. command-threads
  13. command-loop
  14. command-level-condition
  15. command-processor
  16. execute-command
  17. exit-command-processor
  18. evaluate-and-select
  19. gobble-line
  20. greet-user
  21. environment-for-commands
  22. pop-command-level
  23. read-command ;take
  24. read-command-carefully ;inspect
  25. read-form
  26. with-sharp-sharp ; ##
  27. current-sharp-sharp ; ##
  28. run-sentinels
  29. set-command-results!
  30. start-command-processor
  31. restart-command-processor
  32. y-or-n?
  33. help
  34. define-command-syntax
  35. define-user-command-syntax
  36. user-command-environment
  37. ;; set-command-structure! ;startup
  38. ;; command-structure ;pacman
  39. set-user-command-environment! ;pacman
  40. read-command-error ;inspect
  41. &environment-id-string
  42. ;&evaluate
  43. ; Settings
  44. add-setting
  45. lookup-setting
  46. setting-boolean?
  47. setting-value
  48. setting-set!
  49. setting-doc
  50. list-settings
  51. ))
  52. (define-interface command-levels-interface
  53. (export start-command-levels
  54. command-levels
  55. top-command-level
  56. push-command-level
  57. throw-to-command-level
  58. restart-command-level
  59. proceed-with-command-level
  60. kill-paused-thread!
  61. reset-command-input-condition?
  62. terminate-command-processor!
  63. command-level
  64. command-level-threads
  65. command-level-condition
  66. command-level-paused-thread
  67. command-level?))
  68. (define-interface command-state-interface
  69. (export user-context
  70. user-context-accessor
  71. user-context-modifier
  72. push-command-levels?
  73. set-push-command-levels?!
  74. focus-object
  75. set-focus-object!
  76. pop-value-stack!
  77. command-input
  78. command-output
  79. command-error-output
  80. batch-mode? set-batch-mode?!
  81. break-on-warnings? set-break-on-warnings?!
  82. load-noisily? set-load-noisily?!
  83. trace-writing-depth set-trace-writing-depth!
  84. inspector-menu-limit set-inspector-menu-limit!
  85. inspector-writing-depth set-inspector-writing-depth!
  86. inspector-writing-length set-inspector-writing-length!
  87. condition-writing-depth set-condition-writing-depth!
  88. condition-writing-length set-condition-writing-length!
  89. translations set-translations!
  90. maybe-menu
  91. set-menu!
  92. menu-position
  93. set-menu-position!
  94. value-stack
  95. set-value-stack!
  96. pop-value-stack!))
  97. (define-interface menus-interface
  98. (export present-menu
  99. present-more-menu
  100. current-menu-length
  101. current-menu-ref
  102. selection-command?
  103. write-line
  104. write-carefully
  105. with-limited-output))
  106. (define-interface basic-commands-interface
  107. (export exit
  108. exit-when-done
  109. go
  110. load
  111. load-script
  112. help
  113. run
  114. ?))
  115. (define-interface build-commands-interface
  116. (export dump
  117. build))
  118. (define-interface inspect-commands-interface
  119. (export inspect
  120. debug
  121. threads
  122. where
  123. menu
  124. m
  125. q
  126. u
  127. d
  128. template
  129. select-menu-item))
  130. (define-interface disassemble-commands-interface
  131. (export dis))
  132. (define-interface profile-commands-interface
  133. (export profile))
  134. (define-interface profiler-interface
  135. (export profile
  136. profile-thunk
  137. profile-count
  138. make-empty-profile-data
  139. ;; general data
  140. profile-data-starttime
  141. profile-data-endtime
  142. profile-data-memoryuse
  143. profile-data-gcruns
  144. profile-data-runtime
  145. profile-data-samples
  146. profile-data-templates
  147. profile-data-cycles
  148. profile-data-root
  149. ;; printing
  150. profile-display ; everything
  151. profile-display-overview
  152. profile-display-flat
  153. profile-display-tree
  154. profile-display-function-flat
  155. profile-display-function-tree
  156. profile-display-function-cycle
  157. ;; flat accessors
  158. profile-function-calls
  159. profile-function-reccalls
  160. profile-function-nonreccalls
  161. profile-function-occurs
  162. profile-function-hist
  163. profile-function-memoryuse
  164. profile-function-timeshare
  165. profile-function-time-cumulative
  166. profile-function-time-self
  167. ))
  168. (define-interface package-commands-interface
  169. (export in
  170. new-package
  171. load-package
  172. reload-package
  173. structure
  174. open
  175. for-syntax
  176. exec
  177. user
  178. user-package-is
  179. config
  180. config-package-is
  181. undefine
  182. set-reader
  183. show-known-packages
  184. show-interface))
  185. (define-interface debug-commands-interface
  186. (export translate
  187. preview
  188. proceed
  189. push
  190. pop
  191. reset
  192. resume
  193. level
  194. condition
  195. set
  196. unset
  197. batch
  198. bench
  199. break-on-warnings
  200. levels
  201. flush
  202. keep
  203. collect
  204. trace
  205. untrace
  206. time
  207. from-file
  208. forget
  209. bound?
  210. expand
  211. expand-once
  212. show-default-package))
  213. (define-interface usual-commands-interface
  214. (compound-interface
  215. basic-commands-interface
  216. build-commands-interface
  217. package-commands-interface
  218. debug-commands-interface
  219. inspect-commands-interface
  220. disassemble-commands-interface
  221. ))
  222. (define-interface package-commands-internal-interface
  223. (export config-package
  224. new-command-processor
  225. get-structure
  226. ;get-package
  227. ;set-package-evaluator!
  228. ))
  229. (define-interface display-conditions-interface
  230. (export display-condition ;command.scm
  231. limited-write))
  232. (define-interface debuginfo-interface
  233. (export read-debug-info
  234. write-debug-info))
  235. (define-interface disclosers-interface
  236. (export make-print-name
  237. template-file-name
  238. value->expression
  239. error-form
  240. location-info
  241. location-name
  242. location-package-name
  243. template-debug-data
  244. template-id
  245. template-name
  246. template-names
  247. debug-data-names))
  248. (define-interface package-mutation-interface
  249. (export package-system-sentinel ;env/command.scm
  250. package-open! ;env/debug.scm
  251. package-undefine!
  252. ))
  253. ; --------------------
  254. ; Linker
  255. (define-interface linker-interface
  256. (export link-simple-system
  257. link-reified-system
  258. link-semireified-system
  259. (struct-list :syntax)
  260. compile-structures))
  261. (define-interface expander-interface
  262. (export expand-form
  263. expand-stuff
  264. expand
  265. usage-reference-count
  266. usage-operator-count
  267. usage-assignment-count
  268. free-top-level-variables))
  269. ; --------------------
  270. ; Extended numbers: bignums, ratnums, etc.
  271. (define-interface extended-numbers-interface
  272. (export (define-extended-number-type :syntax)
  273. (define-opcode-extension :syntax)
  274. <exact> <inexact>
  275. string-position
  276. &+
  277. &-
  278. &*
  279. &/
  280. &=
  281. &<
  282. &quotient
  283. &remainder
  284. &integer?
  285. &rational?
  286. &real?
  287. &complex?
  288. &number?
  289. &exact?
  290. &exact->inexact
  291. &inexact->exact
  292. &real-part
  293. &imag-part
  294. &magnitude
  295. &angle
  296. &floor
  297. &numerator
  298. &denominator
  299. &exp &log
  300. &sin &cos &tan &asin &acos &atan1 &atan2
  301. &sqrt
  302. &make-rectangular
  303. &make-polar
  304. &number->string
  305. &really-string->number))
  306. (define-interface time-interface
  307. (export real-time
  308. run-time))
  309. (define-interface unicode-char-maps-interface
  310. (export (primary-category :syntax)
  311. primary-category?
  312. (general-category :syntax)
  313. general-category?
  314. general-category-id
  315. general-category-symbol
  316. general-category-primary-category
  317. general-categories
  318. general-category-index
  319. char-general-category
  320. char-titlecase
  321. char-title-case?
  322. char-foldcase
  323. string-upcase string-downcase
  324. string-foldcase
  325. string-titlecase))
  326. (define-interface signals-internal-interface
  327. (export simple-condition->condition
  328. condition->simple-condition
  329. coerce-to-condition
  330. coerce-to-simple-condition))
  331. ; Experimental DEFINE-RECORD-TYPE that is now officially a failure.
  332. (define-interface defrecord-interface ;RK's
  333. (export (define-record-type :syntax)
  334. define-record-discloser))
  335. ; Unicode
  336. ; -------
  337. (define-interface text-codec-utils-interface
  338. (export guess-port-text-codec-according-to-bom
  339. set-port-text-codec-according-to-bom!))
  340. (define-interface unicode-normalizations-interface
  341. (export string-normalize-nfd
  342. string-normalize-nfkd
  343. string-normalize-nfc
  344. string-normalize-nfkc))
  345. ; --------------------
  346. ; Transport Link Cell Tables
  347. (define-interface tconc-queues-interface
  348. (export make-tconc-queue
  349. tconc-queue?
  350. tconc-queue-empty?
  351. tconc-queue-enqueue!
  352. tconc-queue-dequeue!
  353. tconc-queue-peek
  354. tconc-queue-clear!
  355. tconc-queue-size))
  356. (define-interface tlc-tables-interface
  357. (export make-tlc-table
  358. make-eq-tlc-table
  359. make-eqv-tlc-table
  360. make-non-default-tlc-table
  361. tlc-table?
  362. tlc-table-size
  363. tlc-table-ref
  364. tlc-table-set!
  365. tlc-table-delete!
  366. tlc-table-contains?
  367. tlc-table-update!
  368. tlc-table-clear!
  369. tlc-table-resize!
  370. tlc-table-copy
  371. tlc-table-keys
  372. tlc-table-entries
  373. tlc-table-equivalence-function
  374. tlc-table-hash-function
  375. tlc-table-has-tconc-queue?
  376. equal-hash string-hash string-ci-hash symbol-hash
  377. tlc-table-distribution))
  378. ; --------------------
  379. ; Standards
  380. ; As R5RS is fixed, we duplicate much of the scheme-level-X-interfaces
  381. ; to decouple them from scheme, which will change.
  382. (define-interface r5rs-interface
  383. (export
  384. ;; from scheme-level-0-interface
  385. ((if begin lambda letrec quote set!
  386. define define-syntax let-syntax letrec-syntax)
  387. :syntax)
  388. ;; The basic derived expression types.
  389. ((and cond do let let* or) :syntax)
  390. apply
  391. ;; Scalar primitives
  392. eq?
  393. number? integer? rational? real? complex?
  394. exact? exact->inexact inexact->exact
  395. + - * / = < > <= >=
  396. quotient remainder
  397. floor numerator denominator
  398. real-part imag-part
  399. exp log sin cos tan asin acos atan sqrt
  400. angle magnitude make-polar make-rectangular
  401. char?
  402. char=? char<?
  403. eof-object?
  404. input-port? output-port?
  405. ;; Data manipulation
  406. pair? cons car cdr set-car! set-cdr!
  407. symbol? symbol->string
  408. string? make-string string-length string-ref string-set!
  409. vector? make-vector vector-length vector-ref vector-set!
  410. ;; Unnecessarily primitive
  411. string=?
  412. vector
  413. assq
  414. ;; New in Revised^5 Scheme
  415. values call-with-values
  416. ;; Things that aren't primitive at the VM level, but have
  417. ;; to be defined using VM primitives.
  418. string-copy
  419. string->symbol
  420. procedure?
  421. integer->char char->integer
  422. ;; from scheme-level-1-interface
  423. ((case delay quasiquote syntax-rules) :syntax)
  424. abs
  425. append assoc assv
  426. boolean?
  427. caaaar caaadr caadar caaddr caaar caadr caar
  428. cadaar cadadr caddar cadddr cadar caddr cadr
  429. cdaaar cdaadr cdadar cdaddr cdaar cdadr cdar
  430. cddaar cddadr cdddar cddddr cddar cdddr cddr
  431. char-alphabetic?
  432. ceiling
  433. char-ci<=? char-ci<? char-ci=? char-ci>=? char-ci>?
  434. char-downcase char-lower-case? char-numeric?
  435. char-upcase
  436. char-upper-case? char-whitespace? char<=?
  437. char>=? char>?
  438. equal? eqv? even? expt
  439. for-each force
  440. gcd
  441. inexact?
  442. lcm length list list->string list->vector
  443. list? ;New in R4RS
  444. list-ref list-tail
  445. map max member memq memv min modulo
  446. negative? not null?
  447. odd?
  448. positive?
  449. rationalize
  450. reverse
  451. round
  452. string string->list
  453. string-append
  454. string-ci<=? string-ci<? string-ci=? string-ci>=? string-ci>?
  455. string-fill!
  456. string<=? string<? string=? string>=? string>?
  457. substring
  458. truncate
  459. vector->list vector-fill!
  460. zero?
  461. ;; from scheme-level-2-interface
  462. (char-ready? (proc (&opt :input-port) :boolean))
  463. call-with-current-continuation
  464. call-with-input-file call-with-output-file
  465. current-input-port current-output-port
  466. dynamic-wind ;New in R5RS
  467. close-input-port close-output-port
  468. open-input-file open-output-file
  469. with-input-from-file with-output-to-file
  470. number->string string->number
  471. read-char peek-char write-char
  472. newline display write
  473. read
  474. ;; from scheme-adds-interface
  475. eval load
  476. interaction-environment
  477. scheme-report-environment
  478. null-environment))
  479. ; --------------------
  480. ; Big Scheme
  481. (define-interface dynamic-externals-interface
  482. (export dynamic-load
  483. get-external
  484. lookup-external
  485. lookup-all-externals
  486. external?
  487. external-name
  488. external-value
  489. call-external))
  490. (define-interface shared-objects-interface
  491. (export open-shared-object
  492. close-shared-object
  493. shared-object?
  494. shared-object-name
  495. shared-object-address shared-object-address-or-false
  496. shared-object-address?
  497. shared-object-address-value
  498. call-shared-object-address))
  499. (define-interface load-dynamic-externals-interface
  500. (export load-dynamic-externals
  501. import-dynamic-externals
  502. reload-dynamic-externals
  503. unload-dynamic-externals))
  504. (define-interface dump/restore-interface
  505. (export dump
  506. restore
  507. note-location!
  508. $dump-index
  509. $restore-index))
  510. (define-interface extended-ports-interface
  511. (export byte-source->input-port char-source->input-port
  512. byte-sink->output-port char-sink->output-port
  513. make-tracking-input-port make-tracking-output-port
  514. make-byte-vector-input-port make-string-input-port
  515. make-byte-vector-output-port make-string-output-port
  516. byte-vector-output-port-output string-output-port-output
  517. write-byte-vector-output-port-output write-string-output-port-output
  518. limit-output
  519. current-row current-column fresh-line
  520. call-with-string-output-port ; deprecated
  521. write-one-line)) ; deprecated
  522. (define-interface arrays-interface
  523. (export make-array ; <initial-value> <bound1> ...
  524. array?
  525. array-shape ; <array>
  526. array-ref ; <array> <index1> ...
  527. array-set! ; <array> <value> <index1> ...
  528. make-shared-array ; <array> <linear-map> <bound1> ...
  529. copy-array ; <array>
  530. array->vector ; <array>
  531. array)) ; <bounds> . <elements>
  532. (define-interface lu-decompositions-interface
  533. (export lu-decomposition))
  534. (define-interface compact-tables-interface
  535. (export compute-compact-table))
  536. (define-interface inversion-lists-interface
  537. (export make-empty-inversion-list
  538. inversion-list?
  539. inversion-list-member?
  540. inversion-list-complement
  541. inversion-list-union inversion-list-intersection
  542. inversion-list-difference
  543. number->inversion-list numbers->inversion-list
  544. range->inversion-list ranges->inversion-list
  545. inversion-list-adjoin inversion-list-remove
  546. inversion-list-size
  547. inversion-list-copy
  548. inversion-list=?
  549. inversion-list-hash
  550. inversion-list-fold/done?
  551. inversion-list-cursor?
  552. inversion-list-cursor inversion-list-cursor-at-end?
  553. inversion-list-cursor-next inversion-list-cursor-ref))
  554. (define-interface constant-tables-interface
  555. (export make-constant-table
  556. constant-table-lookup))
  557. (define-interface mask-types-interface
  558. (export make-mask-type
  559. mask-type?
  560. mask-type
  561. mask-has-type?
  562. integer->mask
  563. list->mask
  564. mask?))
  565. (define-interface masks-interface
  566. (export mask->integer
  567. mask->list
  568. mask-member?
  569. mask-set
  570. mask-clear
  571. mask-union
  572. mask-intersection
  573. mask-subtract
  574. mask-negate))
  575. (define-interface enum-sets-interface
  576. (export (define-enum-set-type :syntax)
  577. enum-set->list
  578. enum-set-member?
  579. enum-set=?
  580. enum-set-subset?
  581. enum-set-union
  582. enum-set-intersection
  583. enum-set-difference
  584. enum-set-negation))
  585. (define-interface enum-sets-internal-interface
  586. (export enum-set-has-type?
  587. enum-set?
  588. enum-set-type
  589. enum-set->integer
  590. integer->enum-set
  591. ;; for r6rs-enums
  592. make-enum-set-type
  593. enum-set-type-values
  594. enum-set-type-member?
  595. elements->enum-set
  596. (define-enum-set-maker :syntax)
  597. enum-set-type-element-index
  598. ))
  599. (define-interface search-trees-interface
  600. (export make-search-tree
  601. search-tree?
  602. search-tree-ref
  603. search-tree-set!
  604. search-tree-modify!
  605. search-tree-max pop-search-tree-max!
  606. search-tree-min pop-search-tree-min!
  607. walk-search-tree))
  608. (define-interface sparse-vectors-interface
  609. (export make-sparse-vector
  610. sparse-vector-ref sparse-vector-set!
  611. sparse-vector->list))
  612. (define-interface variable-argument-lists-interface
  613. (export (opt-lambda :syntax)))
  614. ; This is getting to be a hodge-podge.
  615. (define-interface big-util-interface
  616. (export concatenate-symbol
  617. error breakpoint
  618. atom? null-list? neq? n=
  619. identity no-op
  620. memq? first any? any every?
  621. filter filter! filter-map partition-list partition-list!
  622. remove-duplicates delq delq! delete
  623. reverse!
  624. string->immutable-string
  625. ))
  626. (define-interface big-scheme-interface
  627. (compound-interface
  628. (interface-of ascii)
  629. (interface-of bitwise)
  630. (interface-of tables)
  631. (interface-of enumerated)
  632. ;defrecord-interface
  633. extended-ports-interface
  634. big-util-interface
  635. (export (destructure :syntax)
  636. (receive :syntax)
  637. format
  638. p pretty-print
  639. sort-list sort-list!)))
  640. ; --------------------
  641. ; Miscellaneous
  642. ; Copied from interfaces.scm.
  643. (define-interface define-record-types-interface
  644. (export (define-record-type :syntax)
  645. define-record-discloser))
  646. (define-interface parse-bytecode-interface
  647. (export byte-code?
  648. parse-template
  649. parse-template-code
  650. parse-instruction
  651. parse-protocol
  652. with-template
  653. make-attribution
  654. make-opcode-table
  655. opcode-table-set! opcode-table-ref
  656. protocol-protocol protocol-nargs n-ary-protocol?
  657. protocol-cwv-tailcall? call-with-values-protocol-target
  658. env-data? env-data-total-count env-data-frame-offsets
  659. env-data-maybe-template-index env-data-closure-offsets
  660. env-data-env-offsets
  661. cont-data? cont-data-length cont-data-mask-bytes cont-data-live-offsets cont-data-pc
  662. cont-data-template cont-data-gc-mask-size cont-data-depth))
  663. (define-interface reinitializers-interface
  664. (export (define-reinitializer :syntax)))
  665. (define-interface locks-interface
  666. (export lock?
  667. make-lock
  668. obtain-lock
  669. maybe-obtain-lock
  670. release-lock
  671. with-lock
  672. lock-owner)) ;really should be internal
  673. (define-interface value-pipes-interface
  674. (export make-pipe
  675. empty-pipe?
  676. pipe-read!
  677. pipe-write!
  678. pipe-push!
  679. empty-pipe!
  680. pipe-maybe-read!
  681. pipe-maybe-read?!
  682. pipe-maybe-write!))
  683. (define-interface placeholder-interface
  684. (export make-placeholder
  685. placeholder?
  686. placeholder-value
  687. placeholder-set!))
  688. (define-interface matchers-interface
  689. (export matcher? matcher-sexpr
  690. matches?
  691. is
  692. anything
  693. opposite
  694. is-true is-false is-null
  695. is-within
  696. member-of
  697. all-of any-of list-where-all list-where-any
  698. list-of vector-of pair-of))
  699. (define-interface test-suites-interface
  700. (export ((define-test-suite define-test-case define-test-cases) :syntax)
  701. ((check check-terminates check-exception check-that check-exception-that) :syntax)
  702. run-test-suite run-test-cases
  703. =within
  704. zap-test-suite!))
  705. ; Backwards compatibility
  706. (define-interface signals-interface
  707. (export error warn syntax-error call-error note
  708. signal signal-condition
  709. make-condition))