more-packages.scm 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. ; Copyright (c) 1993-2008 by Richard Kelsey and Jonathan Rees. See file COPYING.
  2. ; More and more packages. Some of these get loaded into the initial
  3. ; image to create scheme48.image; those that aren't can be loaded later
  4. ; using ,load-package.
  5. ; Things to load into initial.image to make scheme48.image.
  6. (define-structure usual-features (export ) ;No exports
  7. (open analysis ;auto-integration
  8. disclosers
  9. command-processor
  10. debuginfo
  11. ;; Choose any combination of bignums, ratnums, recnums
  12. ;; bignums ; now in the VM
  13. ratnums recnums
  14. ;; Choose either innums, floatnums, or neither
  15. ;; innums ;Silly inexact numbers
  16. floatnums
  17. ;; pp
  18. ;; The following is listed because this structure is used to
  19. ;; generate a dependency list used by the Makefile...
  20. usual-commands
  21. unicode-char-maps
  22. ))
  23. ; Large integers and rational and complex numbers.
  24. (define-structure extended-numbers extended-numbers-interface
  25. (open scheme-level-2
  26. methods meta-methods
  27. define-record-types
  28. primitives
  29. architecture
  30. simple-signals
  31. (subset vm-exceptions (extend-opcode!))
  32. util
  33. number-i/o)
  34. (files (rts xnum)))
  35. (define-structure innums (export ) ;inexact numbers
  36. (open scheme-level-2
  37. extended-numbers
  38. methods simple-signals
  39. number-i/o) ;string->integer
  40. (files (rts innum)))
  41. (define-structure ratnums (export ) ;No exports
  42. (open scheme-level-2
  43. extended-numbers
  44. methods simple-signals
  45. number-i/o) ;string->integer
  46. (files (rts ratnum)))
  47. (define-structure recnums (export ) ;No exports
  48. (open scheme-level-2
  49. extended-numbers
  50. methods simple-signals
  51. number-i/o) ;really-number->string
  52. (files (rts recnum)))
  53. (define-structure floatnums
  54. (export floatnum? exp log sin cos tan asin acos atan sqrt)
  55. (open scheme-level-2
  56. extended-numbers
  57. code-vectors
  58. methods simple-signals
  59. enumerated
  60. loopholes
  61. more-types ;:double
  62. primitives) ;vm-extension double?
  63. (files (rts floatnum))
  64. (optimize auto-integrate))
  65. (define-structure unicode-char-maps unicode-char-maps-interface
  66. (open scheme
  67. set-text-procedures
  68. unicode
  69. finite-types
  70. define-record-types
  71. tables
  72. bitwise)
  73. (files (env unicode-category)
  74. (env unicode-info)
  75. (env unicode-charmap)))
  76. (define-structure time time-interface
  77. (open scheme-level-1 primitives architecture enumerated)
  78. (begin
  79. (define (real-time)
  80. (time (enum time-option real-time) #f))
  81. (define (run-time)
  82. (time (enum time-option run-time) #f))))
  83. (define-structure placeholders placeholder-interface
  84. (open scheme-level-1 proposals queues
  85. (subset util (unspecific))
  86. threads threads-internal
  87. interrupts
  88. simple-signals)
  89. (files (big placeholder))
  90. (optimize auto-integrate))
  91. (define-structure locks locks-interface
  92. (open scheme-level-2 queues
  93. threads threads-internal
  94. interrupts
  95. proposals)
  96. (optimize auto-integrate)
  97. (files (big lock)))
  98. ;--------
  99. ; Unicode
  100. (define-structure text-codec-utils text-codec-utils-interface
  101. (open scheme-level-2
  102. ports
  103. i/o
  104. text-codecs)
  105. (files (big text-codec-util)))
  106. (define-structure unicode-normalizations unicode-normalizations-interface
  107. (open scheme
  108. unicode
  109. bitwise)
  110. (files (big unicode-normalization-info)
  111. (big unicode-normalization)))
  112. (define-structure r6rs-unicode r6rs-unicode-interface
  113. (open scheme
  114. unicode-normalizations
  115. (subset unicode-char-maps (char-titlecase
  116. char-title-case?
  117. char-foldcase
  118. string-upcase string-downcase
  119. string-foldcase
  120. string-titlecase
  121. general-category-symbol))
  122. (modify unicode-char-maps
  123. (rename (char-general-category s48:char-general-category))
  124. (expose char-general-category)))
  125. (begin
  126. ;; R6RS uses a symbol instead of an enumeration
  127. (define (char-general-category c)
  128. (general-category-symbol (s48:char-general-category c)))))
  129. ;----------------
  130. ; Big Scheme
  131. (define-structure random (export make-random)
  132. (open scheme-level-2 bitwise
  133. signals) ;call-error
  134. (files (big random)))
  135. (define-structure sort (export sort-list sort-list!)
  136. (open scheme-level-2
  137. vector-heap-sort list-merge-sort)
  138. (begin
  139. (define (sort-list l obj-<)
  140. (let ((v (list->vector l)))
  141. (vector-heap-sort! obj-< v)
  142. (vector->list v)))
  143. (define (sort-list! l obj-<)
  144. (list-merge-sort! obj-< l))))
  145. (define-structure pp (export p pretty-print define-indentation)
  146. (open scheme-level-2
  147. tables
  148. methods) ;disclose
  149. (files (big pp)))
  150. (define-structure formats (export format)
  151. (open scheme-level-2 ascii signals
  152. extended-ports)
  153. (files (big format)))
  154. (define-structure extended-ports extended-ports-interface
  155. (open scheme-level-2 define-record-types ascii byte-vectors
  156. ports
  157. i/o i/o-internal
  158. proposals
  159. util ; unspecific
  160. signals
  161. (subset primitives (copy-bytes! write-byte encode-char decode-char))
  162. (subset architecture (text-encoding-option))
  163. enumerated
  164. encodings
  165. (subset text-codecs
  166. (set-port-text-codec! utf-8-codec define-text-codec)))
  167. (files (big more-port)))
  168. (define-structure destructuring (export (destructure :syntax))
  169. (open scheme-level-2)
  170. (files (big destructure)))
  171. (define-structure mvlet (export ((mvlet mvlet*) :syntax))
  172. (open scheme-level-2)
  173. (files (big mvlet)))
  174. (define-structure reduce (export ((reduce iterate)
  175. :syntax)
  176. ((list* list%
  177. vector* vector%
  178. string* string%
  179. count* count%
  180. bits* bits%
  181. input* input%
  182. stream* stream%)
  183. :syntax))
  184. (open scheme-level-2
  185. bitwise
  186. signals)
  187. (files (big iterate)))
  188. (define-structure arrays arrays-interface
  189. (open scheme-level-2 define-record-types signals)
  190. (files (big array)))
  191. (define-structure lu-decompositions lu-decompositions-interface
  192. (open scheme receiving arrays floatnums signals)
  193. (files (big lu-decomp)))
  194. (define-structure compact-tables compact-tables-interface
  195. (open scheme)
  196. (files (big compact-table)))
  197. (define-structure inversion-lists inversion-lists-interface
  198. (open scheme
  199. bitwise
  200. define-record-types
  201. signals)
  202. (files (big inversion-list)))
  203. (define-structure receiving (export (receive :syntax))
  204. (open scheme-level-2)
  205. (files (big receive)))
  206. (define-structure defrecord defrecord-interface
  207. (open scheme-level-1 records record-types loopholes
  208. primitives) ; unspecific, low-level record ops
  209. (files (big defrecord)))
  210. (define-structures ((masks masks-interface)
  211. (mask-types mask-types-interface))
  212. (open scheme-level-1 define-record-types
  213. bitwise
  214. util ; every
  215. number-i/o ; number->string
  216. signals) ; call-error
  217. (files (big mask)))
  218. (define-structures ((enum-sets enum-sets-interface)
  219. (enum-sets-internal enum-sets-internal-interface))
  220. (open scheme define-record-types
  221. finite-types
  222. bitwise
  223. util
  224. signals
  225. external-calls)
  226. (optimize auto-integrate)
  227. (files (big enum-set)))
  228. (define general-tables tables) ; backward compatibility
  229. (define-structure big-util big-util-interface
  230. (open scheme-level-2
  231. formats
  232. features ; immutable? make-immutable!
  233. (modify signals
  234. (rename (error rts-error))
  235. (expose error))
  236. (modify debugging (rename (breakpoint rts-breakpoint))
  237. (expose breakpoint))
  238. (subset primitives (copy-bytes!)))
  239. (files (big big-util)))
  240. (define-structure big-scheme big-scheme-interface
  241. (open scheme-level-2
  242. formats
  243. sort
  244. extended-ports
  245. pp
  246. enumerated
  247. bitwise
  248. ascii
  249. big-util
  250. tables
  251. destructuring
  252. receiving))
  253. ; Things needed for connecting with external code.
  254. (define-structure external-calls (export call-imported-binding
  255. lookup-imported-binding
  256. define-exported-binding
  257. shared-binding-ref
  258. ((import-definition
  259. import-lambda-definition)
  260. :syntax)
  261. add-finalizer!
  262. define-record-resumer
  263. call-external-value)
  264. (open scheme-level-2 define-record-types
  265. primitives
  266. architecture
  267. vm-exceptions interrupts signals
  268. placeholders
  269. shared-bindings
  270. byte-vectors
  271. ;bitwise ;for {enter|extract}_integer() helpers
  272. (subset record-types (define-record-resumer))
  273. (subset records-internal (:record-type)))
  274. (files (big import-def)
  275. (big callback)))
  276. (define-structure shared-objects shared-objects-interface
  277. (open scheme-level-2
  278. define-record-types
  279. exceptions
  280. external-calls
  281. os-strings text-codecs)
  282. (files (big shared-object)))
  283. (define-structure load-dynamic-externals load-dynamic-externals-interface
  284. (open scheme-level-2
  285. define-record-types
  286. shared-objects
  287. (subset usual-resumer (add-initialization-thunk!))
  288. (subset big-util (delq delete any))
  289. filenames
  290. (subset signals (error)))
  291. (files (big dynamic-external)))
  292. (define-structure c-system-function (export have-system? system)
  293. (open scheme-level-2 byte-vectors os-strings external-calls signals)
  294. (begin
  295. (import-lambda-definition s48-system (string))
  296. (define (have-system?)
  297. (not (= 0 (s48-system #f))))
  298. ;; Kludge
  299. (define (system cmd-line)
  300. (s48-system (os-string->byte-vector (x->os-string cmd-line))))))
  301. ; Rudimentary object dump and restore
  302. (define-structure dump/restore dump/restore-interface
  303. (open scheme-level-1
  304. number-i/o
  305. tables
  306. records record-types
  307. signals ;error
  308. locations ;make-undefined-location
  309. closures
  310. code-vectors ;code vectors
  311. fluids
  312. ascii
  313. bitwise
  314. methods ;disclose
  315. templates) ;template-info
  316. (files (big dump)))
  317. ; Pipes containing values.
  318. (define-structure value-pipes value-pipes-interface
  319. (open scheme queues
  320. proposals
  321. threads-internal
  322. signals) ;call-error
  323. (optimize auto-integrate)
  324. (files (big value-pipe)))
  325. ; Unix Sockets
  326. (define-structures ((sockets (export open-socket
  327. close-socket
  328. socket-accept
  329. socket-port-number
  330. socket-client
  331. get-host-name
  332. get-host-by-name
  333. get-host-by-address
  334. ; From the old interface
  335. ; I would like to get rid of these.
  336. socket-listen
  337. socket-listen-channels
  338. socket-client-channels))
  339. (udp-sockets (export get-host-name
  340. close-socket
  341. open-udp-socket
  342. udp-send
  343. udp-receive
  344. lookup-udp-address
  345. socket-port-number
  346. udp-address?
  347. udp-address-address
  348. udp-address-hostname
  349. udp-address-port)))
  350. (open scheme define-record-types
  351. external-calls
  352. channels ; channel? close-channel
  353. signals ; error call-error
  354. proposals ; atomically!
  355. interrupts ; enable-interrupts! disable-interrupts!
  356. channel-ports ; {in|out}put-channel->port
  357. channel-i/o ; wait-for-channel
  358. condvars ; for wait-for-channel
  359. external-events
  360. byte-vectors)
  361. (files (big socket)))
  362. ; Heap traverser
  363. (define-structure traverse
  364. (export traverse-depth-first traverse-breadth-first trail
  365. set-leaf-predicate! usual-leaf-predicate)
  366. (open scheme-level-2
  367. primitives
  368. queues tables
  369. bitwise locations closures code-vectors
  370. features ; string-hash
  371. low-level ; vector-unassigned?
  372. more-types loopholes)
  373. (files (env traverse)))
  374. ; Reinitializing upon image resumption
  375. (define-structure reinitializers reinitializers-interface
  376. (open scheme-level-2
  377. define-record-types
  378. (subset record-types (define-record-resumer)))
  379. (files (big reinitializer)))
  380. ; Space analyzer
  381. (define-structure spatial (export space vector-space record-space)
  382. (open scheme
  383. architecture primitives assembler packages enumerated
  384. features sort locations display-conditions)
  385. (files (env space)))
  386. ; Listing what is in an interface. Here because it needs sort.
  387. (define-structure list-interfaces (export list-interface)
  388. (open scheme-level-2 interfaces packages meta-types sort bindings)
  389. (files (env list-interface)))
  390. ; red-black balanced binary search trees
  391. (define-structure search-trees search-trees-interface
  392. (open scheme-level-2 define-record-types)
  393. (optimize auto-integrate)
  394. (files (big search-tree)))
  395. ; vectors that grow as large as they need to
  396. (define-structure sparse-vectors sparse-vectors-interface
  397. (open scheme
  398. bitwise
  399. define-record-types)
  400. (files (big hilbert)))
  401. ; utilities for dealing with variable argument lists
  402. (define-structure variable-argument-lists variable-argument-lists-interface
  403. (open scheme-level-2)
  404. (files (big vararg)))
  405. ; record types with a fixed number of instances
  406. (define-structure finite-types (export ((define-finite-type
  407. define-enumerated-type) :syntax))
  408. (open scheme-level-2 code-quote define-record-types
  409. enumerated
  410. features) ; make-immutable
  411. (files (big finite-type)))
  412. ; nondeterminism via call/cc
  413. (define-structure nondeterminism (export with-nondeterminism
  414. ((either one-value all-values) :syntax)
  415. fail)
  416. (open scheme-level-2
  417. fluids cells
  418. (subset signals (error)))
  419. (files (big either)))
  420. ; test suites
  421. (define-structure test-suites test-suites-interface
  422. (open scheme
  423. cells
  424. big-util
  425. signals
  426. define-record-types
  427. exceptions conditions
  428. display-conditions
  429. (subset i/o (current-error-port))
  430. fluids)
  431. (files (big test-suite)))
  432. ;----------------
  433. ; Obsolete packages
  434. ; Bignums and bitwise logical operators on bignums. These are now handled
  435. ; by the VM. These packages are here to keep from breaking scripts that
  436. ; load them. They will be removed in a later release.
  437. (define-structure bignums (export)
  438. (open scheme-level-2))
  439. (define-structure bigbit (export)
  440. (open scheme-level-2))
  441. ; ... end of package definitions.
  442. ; Temporary compatibility stuff
  443. (define-syntax define-signature
  444. (syntax-rules () ((define-signature . ?rest) (define-interface . ?rest))))
  445. (define-syntax define-package
  446. (syntax-rules () ((define-package . ?rest) (define-structures . ?rest))))
  447. (define table tables)
  448. (define record records)