more-packages.scm 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. ; Part of Scheme 48 1.9. See file COPYING for notices and license.
  2. ; Authors: Richard Kelsey, Jonathan Rees, Mike Sperber, Michael Zabka,
  3. ; Robert Ransom, Marcel Turino, Manuel Dietrich, Marcus Crestani,
  4. ; Harald Glab-Phlak
  5. ; More and more packages. Some of these get loaded into the initial
  6. ; image to create scheme48.image; those that aren't can be loaded later
  7. ; using ,load-package.
  8. ; Things to load into initial.image to make scheme48.image.
  9. (define-structure usual-features (export ) ;No exports
  10. (open analysis ;auto-integration
  11. command-processor
  12. debuginfo
  13. disclosers
  14. floatnums
  15. more-vm-exceptions
  16. ;; pp
  17. ;; Choose either innums, floatnums, or neither
  18. ;; innums ;Silly inexact numbers
  19. ;; bignums ; now in the VM
  20. ;; Choose any combination of bignums, ratnums, recnums
  21. ratnums recnums
  22. ;; The following is listed because this structure is used to
  23. ;; generate a dependency list used by the Makefile...
  24. usual-commands
  25. unicode-char-maps
  26. ))
  27. ; Large integers and rational and complex numbers.
  28. (define-structure extended-numbers extended-numbers-interface
  29. (open scheme-level-2
  30. methods meta-methods
  31. define-record-types
  32. primitives
  33. architecture
  34. exceptions
  35. (subset vm-exceptions (extend-opcode!))
  36. util
  37. number-i/o)
  38. (files (rts xnum)))
  39. (define-structure innums (export ) ;inexact numbers
  40. (open scheme-level-2
  41. extended-numbers
  42. methods exceptions
  43. number-i/o) ;string->integer
  44. (files (rts innum)))
  45. (define-structure ratnums (export ) ;No exports
  46. (open scheme-level-2
  47. extended-numbers
  48. methods exceptions
  49. number-i/o) ;string->integer
  50. (files (rts ratnum)))
  51. (define-structure recnums (export ) ;No exports
  52. (open scheme-level-2
  53. extended-numbers
  54. methods exceptions
  55. number-i/o) ;really-number->string
  56. (files (rts recnum)))
  57. (define-structure floatnums
  58. (export floatnum? exp log sin cos tan asin acos atan sqrt)
  59. (open scheme-level-2
  60. extended-numbers
  61. code-vectors
  62. methods exceptions
  63. enumerated
  64. loopholes
  65. more-types ;<double>
  66. primitives) ;vm-extension double?
  67. (files (rts floatnum))
  68. (optimize auto-integrate))
  69. (define-structure unicode-char-maps unicode-char-maps-interface
  70. (open (modify scheme (hide string-ci=? string-ci<?))
  71. set-text-procedures
  72. unicode
  73. finite-types
  74. define-record-types
  75. tables
  76. bitwise)
  77. (files (env unicode-category)
  78. (env unicode-info)
  79. (env unicode-charmap)))
  80. (define-structure time time-interface
  81. (open scheme-level-1 primitives architecture enumerated)
  82. (begin
  83. (define (real-time)
  84. (time (enum time-option real-time) #f))
  85. (define (run-time)
  86. (time (enum time-option run-time) #f))))
  87. (define-structure placeholders placeholder-interface
  88. (open scheme-level-1 proposals queues
  89. (subset util (unspecific))
  90. threads threads-internal
  91. interrupts
  92. exceptions)
  93. (files (big placeholder))
  94. (optimize auto-integrate))
  95. (define-structure locks locks-interface
  96. (open scheme-level-2 queues
  97. threads threads-internal
  98. interrupts
  99. proposals)
  100. (optimize auto-integrate)
  101. (files (big lock)))
  102. ;--------
  103. ; Unicode
  104. (define-structure text-codec-utils text-codec-utils-interface
  105. (open scheme-level-2
  106. ports
  107. i/o
  108. text-codecs)
  109. (files (big text-codec-util)))
  110. (define-structure unicode-normalizations unicode-normalizations-interface
  111. (open scheme
  112. unicode
  113. bitwise)
  114. (files (big unicode-normalization-info)
  115. (big unicode-normalization)))
  116. ; --------------------
  117. ; Transport Link Cell Tables
  118. (define-structure tconc-queues tconc-queues-interface
  119. (open scheme-level-1 exceptions)
  120. (files (big tconc-queue))
  121. (optimize auto-integrate))
  122. (define-structure tlc-tables tlc-tables-interface
  123. (open scheme-level-1
  124. exceptions
  125. features ; string-hash, make-immutable!
  126. define-record-types
  127. tconc-queues
  128. unicode-char-maps
  129. tables
  130. variable-argument-lists
  131. (subset primitives (make-transport-link-cell
  132. transport-link-cell?
  133. transport-link-cell-key
  134. transport-link-cell-value
  135. set-transport-link-cell-value!
  136. transport-link-cell-next
  137. set-transport-link-cell-next!
  138. transport-link-cell-tconc
  139. set-transport-link-cell-tconc!
  140. memory-status))
  141. (subset architecture (memory-status-option))
  142. enumerated)
  143. (files (big tlc-table))
  144. (optimize auto-integrate))
  145. ; --------------------
  146. ; Standards
  147. (define-structure r5rs r5rs-interface
  148. (open scheme))
  149. ;----------------
  150. ; Big Scheme
  151. (define-structure random (export make-random)
  152. (open scheme-level-2 bitwise
  153. exceptions)
  154. (files (big random)))
  155. (define-structure sort (export sort-list sort-list!)
  156. (open scheme-level-2
  157. vector-heap-sort list-merge-sort)
  158. (begin
  159. (define (sort-list l obj-<)
  160. (let ((v (list->vector l)))
  161. (vector-heap-sort! obj-< v)
  162. (vector->list v)))
  163. (define (sort-list! l obj-<)
  164. (list-merge-sort! obj-< l))))
  165. (define-structure pp (export p pretty-print define-indentation)
  166. (open scheme-level-2
  167. tables
  168. (subset methods (disclose)))
  169. (files (big pp)))
  170. (define-structure formats (export format)
  171. (open scheme-level-2 ascii exceptions
  172. extended-ports)
  173. (files (big format)))
  174. (define-structure extended-ports extended-ports-interface
  175. (open scheme-level-2 define-record-types ascii byte-vectors
  176. ports
  177. i/o i/o-internal
  178. proposals
  179. util ; unspecific
  180. exceptions
  181. (subset primitives (copy-bytes! write-byte char->utf utf->char))
  182. (subset architecture (text-encoding-option))
  183. enumerated
  184. encodings
  185. (subset text-codecs
  186. (set-port-text-codec! utf-8-codec define-text-codec)))
  187. (files (big more-port)))
  188. (define-structure destructuring (export (destructure :syntax))
  189. (open scheme-level-2)
  190. (files (big destructure)))
  191. (define-structure mvlet (export ((mvlet mvlet*) :syntax))
  192. (open scheme-level-2)
  193. (files (big mvlet)))
  194. (define-structure reduce (export ((reduce iterate)
  195. :syntax)
  196. ((list* list%
  197. list-spine* list-spine%
  198. list-spine-cycle-safe*
  199. list-spine-cycle-safe%
  200. vector* vector%
  201. string* string%
  202. count* count%
  203. bits* bits%
  204. input* input%
  205. stream* stream%)
  206. :syntax))
  207. (open scheme-level-2
  208. bitwise
  209. exceptions)
  210. (files (big iterate)))
  211. (define-structure arrays arrays-interface
  212. (open scheme-level-2 define-record-types exceptions)
  213. (files (big array)))
  214. (define-structure lu-decompositions lu-decompositions-interface
  215. (open scheme receiving arrays floatnums exceptions)
  216. (files (big lu-decomp)))
  217. (define-structure compact-tables compact-tables-interface
  218. (open scheme)
  219. (files (big compact-table)))
  220. (define-structure inversion-lists inversion-lists-interface
  221. (open scheme
  222. bitwise
  223. define-record-types
  224. exceptions)
  225. (files (big inversion-list)))
  226. (define-structure constant-tables constant-tables-interface
  227. (open scheme
  228. bitwise
  229. define-record-types)
  230. (files (big constant-table)))
  231. (define-structure receiving (export (receive :syntax))
  232. (open scheme-level-2
  233. util))
  234. (define-structure defrecord defrecord-interface
  235. (open scheme-level-1 records record-types loopholes
  236. primitives) ; unspecific, low-level record ops
  237. (files (big defrecord)))
  238. (define-structures ((masks masks-interface)
  239. (mask-types mask-types-interface))
  240. (open scheme-level-1 define-record-types
  241. bitwise
  242. util ; every
  243. number-i/o ; number->string
  244. exceptions) ; assertion-violation
  245. (files (big mask)))
  246. (define-structures ((enum-sets enum-sets-interface)
  247. (enum-sets-internal enum-sets-internal-interface))
  248. (open scheme define-record-types
  249. finite-types
  250. bitwise
  251. util
  252. exceptions
  253. external-calls)
  254. (optimize auto-integrate)
  255. (files (big enum-set)))
  256. (define general-tables tables) ; backward compatibility
  257. (define-structure big-util big-util-interface
  258. (open scheme-level-2
  259. formats
  260. features ; immutable? make-immutable!
  261. (modify exceptions
  262. (rename (error rts-error))
  263. (expose error assertion-violation))
  264. (modify debugging (rename (breakpoint rts-breakpoint))
  265. (expose breakpoint))
  266. (subset primitives (copy-bytes!))
  267. (subset util (filter)))
  268. (files (big big-util)))
  269. (define-structure big-scheme big-scheme-interface
  270. (open scheme-level-2
  271. formats
  272. sort
  273. extended-ports
  274. pp
  275. enumerated
  276. bitwise
  277. ascii
  278. big-util
  279. tables
  280. destructuring
  281. receiving))
  282. ; Things needed for connecting with external code.
  283. (define-structure external-calls (export call-imported-binding
  284. call-imported-binding-2
  285. lookup-imported-binding
  286. define-exported-binding
  287. shared-binding-ref
  288. ((import-definition
  289. import-lambda-definition
  290. import-lambda-definition-2)
  291. :syntax)
  292. add-finalizer!
  293. define-record-resumer
  294. call-external-value
  295. call-external-value-2)
  296. (open scheme-level-2 define-record-types
  297. primitives
  298. os-strings
  299. architecture ; includes ENUM
  300. enum-case
  301. vm-exceptions interrupts exceptions conditions
  302. placeholders
  303. shared-bindings
  304. byte-vectors
  305. ;bitwise ;for {enter|extract}_integer() helpers
  306. (subset record-types (define-record-resumer))
  307. (subset records-internal (:record-type)))
  308. (files (big import-def)
  309. (big callback)))
  310. (define-structure shared-objects shared-objects-interface
  311. (open scheme-level-2
  312. define-record-types
  313. exceptions
  314. external-calls
  315. os-strings text-codecs)
  316. (files (big shared-object)))
  317. (define-structure load-dynamic-externals load-dynamic-externals-interface
  318. (open scheme-level-2
  319. define-record-types
  320. shared-objects
  321. (subset usual-resumer (add-initialization-thunk!))
  322. (subset big-util (delq delete any))
  323. filenames
  324. (subset exceptions (assertion-violation)))
  325. (files (big dynamic-external)))
  326. (define-structure c-system-function (export have-system? system)
  327. (open scheme-level-2 byte-vectors os-strings external-calls exceptions)
  328. (begin
  329. (import-lambda-definition-2 s48-system (string) "s48_system_2")
  330. (define (have-system?)
  331. (not (= 0 (s48-system #f))))
  332. ;; Kludge
  333. (define (system cmd-line)
  334. (s48-system (x->os-byte-vector cmd-line)))))
  335. ; Rudimentary object dump and restore
  336. (define-structure dump/restore dump/restore-interface
  337. (open scheme-level-1
  338. number-i/o
  339. tables
  340. records record-types
  341. exceptions ;error
  342. locations ;make-undefined-location
  343. closures
  344. code-vectors ;code vectors
  345. fluids
  346. ascii
  347. bitwise
  348. (subset methods (disclose))
  349. templates) ;template-info
  350. (files (big dump)))
  351. ; Pipes containing values.
  352. (define-structure value-pipes value-pipes-interface
  353. (open scheme queues
  354. proposals
  355. threads-internal
  356. exceptions) ;assertion-violation
  357. (optimize auto-integrate)
  358. (files (big value-pipe)))
  359. ; Heap traverser
  360. (define-structure traverse
  361. (export traverse-depth-first traverse-breadth-first trail
  362. set-leaf-predicate! usual-leaf-predicate)
  363. (open scheme-level-2
  364. primitives
  365. queues tables
  366. bitwise locations closures code-vectors
  367. features ; string-hash
  368. low-level ; vector-unassigned?
  369. more-types loopholes)
  370. (files (env traverse)))
  371. ; Reinitializing upon image resumption
  372. (define-structure reinitializers reinitializers-interface
  373. (open scheme-level-2
  374. define-record-types
  375. (subset record-types (define-record-resumer)))
  376. (files (big reinitializer)))
  377. ; Profiler.
  378. (define-structure profiler profiler-interface
  379. (open scheme
  380. architecture
  381. cells
  382. closures
  383. continuations
  384. debug-data
  385. debugging
  386. define-record-types
  387. disclosers
  388. environments
  389. escapes
  390. interrupts
  391. locks
  392. exceptions
  393. (modify primitives (prefix primitives:)
  394. (expose collect time memory-status
  395. continuation-length continuation-ref
  396. unspecific))
  397. session-data
  398. sort
  399. tables
  400. templates
  401. command-processor
  402. )
  403. (files (env profile)))
  404. (define-structure profile-commands (export)
  405. (open scheme
  406. command-processor
  407. profiler
  408. profiler-instrumentation ; make sure it gets loaded
  409. (subset environments (environment-define!)))
  410. (files (env profile-command)))
  411. (define-structure profiler-instrumentation (export instrument-form)
  412. (open scheme
  413. bindings
  414. compiler-envs
  415. environments
  416. features
  417. exceptions
  418. nodes
  419. optimizer
  420. package-commands-internal
  421. packages
  422. packages-internal
  423. primops
  424. profiler
  425. util)
  426. (files (env profile-instr)))
  427. ; Space analyzer
  428. (define-structure spatial (export space vector-space record-space)
  429. (open scheme
  430. architecture primitives assembler packages enumerated
  431. features sort locations display-conditions)
  432. (files (env space)))
  433. ; Listing what is in an interface. Here because it needs sort.
  434. (define-structure list-interfaces (export list-interface)
  435. (open scheme-level-2 interfaces packages meta-types sort bindings)
  436. (files (env list-interface)))
  437. ; red-black balanced binary search trees
  438. (define-structure search-trees search-trees-interface
  439. (open scheme-level-2 define-record-types)
  440. (optimize auto-integrate)
  441. (files (big search-tree)))
  442. (define-structures ((functional-search-trees functional-search-trees-interface)
  443. (functional-search-trees-internal functional-search-trees-internal-interface))
  444. (open scheme-level-2
  445. exceptions
  446. define-record-types)
  447. (files (big functional-search-tree)))
  448. ; vectors that grow as large as they need to
  449. (define-structure sparse-vectors sparse-vectors-interface
  450. (open scheme
  451. bitwise
  452. define-record-types)
  453. (files (big hilbert)))
  454. ; utilities for dealing with variable argument lists
  455. (define-structure variable-argument-lists variable-argument-lists-interface
  456. (open scheme-level-2)
  457. (files (big vararg)))
  458. ; record types with a fixed number of instances
  459. (define-structure finite-types (export ((define-finite-type
  460. define-enumerated-type) :syntax))
  461. (open scheme-level-2 code-quotation define-record-types
  462. enumerated
  463. features) ; make-immutable
  464. (files (big finite-type)))
  465. ; nondeterminism via call/cc
  466. (define-structure nondeterminism (export with-nondeterminism
  467. ((either one-value all-values) :syntax)
  468. fail)
  469. (open scheme-level-2
  470. fluids cells
  471. exceptions
  472. (subset exceptions (error)))
  473. (files (big either)))
  474. ; test suites
  475. (define-structure matchers matchers-interface
  476. (open scheme
  477. define-record-types
  478. big-util)
  479. (files (big matcher)))
  480. (define-structure test-suites test-suites-interface
  481. (open scheme
  482. cells
  483. (subset big-util (any delete))
  484. matchers
  485. exceptions
  486. define-record-types
  487. exceptions conditions
  488. display-conditions
  489. escapes continuations previews
  490. (subset i/o (current-error-port))
  491. (subset i/o-internal (output-port-forcers))
  492. fluids)
  493. (files (big test-suite)))
  494. (define-structure libscheme48 (export dump-libscheme48-image)
  495. (open scheme
  496. (subset escapes (with-continuation))
  497. build)
  498. (files (big libscheme48)))
  499. ;----------------
  500. ; Obsolete packages
  501. ; Bignums and bitwise logical operators on bignums. These are now handled
  502. ; by the VM. These packages are here to keep from breaking scripts that
  503. ; load them. They will be removed in a later release.
  504. (define-structure bignums (export)
  505. (open scheme-level-2))
  506. (define-structure bigbit (export)
  507. (open scheme-level-2))
  508. ; The old signals
  509. (define-structure signals signals-interface
  510. (open scheme-level-2
  511. signal-conditions
  512. conditions)
  513. (files (big signal)))
  514. ; ... end of package definitions.
  515. ; Temporary compatibility stuff
  516. (define-syntax define-signature
  517. (syntax-rules () ((define-signature . ?rest) (define-interface . ?rest))))
  518. (define-syntax define-package
  519. (syntax-rules () ((define-package . ?rest) (define-structures . ?rest))))
  520. (define table tables)
  521. (define record records)
  522. ; It used to be called `code-quote', so this is the name the linker imports.
  523. (define code-quote code-quotation)
  524. ; Time
  525. (define-interface os-time-interface
  526. (export current-utc-time
  527. timezone-offset
  528. time-seconds
  529. time-microseconds
  530. time?))
  531. (define-structure os-time os-time-interface
  532. (open scheme
  533. define-record-types
  534. os-strings
  535. external-calls
  536. shared-bindings)
  537. (files (big os-time)))