more-packages.scm 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. ; Copyright (c) 1993-2007 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-1 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 dynamic-externals dynamic-externals-interface
  277. (open scheme-level-2 define-record-types tables
  278. signals ;warn
  279. primitives ;find-all-records
  280. i/o ;current-error-port
  281. code-vectors
  282. os-strings text-codecs
  283. external-calls)
  284. (files (big external)))
  285. (define-structure shared-objects shared-objects-interface
  286. (open scheme-level-2
  287. define-record-types
  288. external-calls
  289. os-strings text-codecs)
  290. (files (big shared-object)))
  291. (define-structure load-dynamic-externals load-dynamic-externals-interface
  292. (open scheme-level-2
  293. define-record-types
  294. shared-objects
  295. (subset usual-resumer (add-initialization-thunk!))
  296. (subset big-util (delq delete any))
  297. (subset signals (error)))
  298. (files (big dynamic-external)))
  299. (define-structure c-system-function (export have-system? system)
  300. (open scheme-level-2 byte-vectors os-strings external-calls signals)
  301. (begin
  302. (import-lambda-definition s48-system (string))
  303. (define (have-system?)
  304. (not (= 0 (s48-system #f))))
  305. ;; Kludge
  306. (define (system cmd-line)
  307. (s48-system (os-string->byte-vector (x->os-string cmd-line))))))
  308. ; Rudimentary object dump and restore
  309. (define-structure dump/restore dump/restore-interface
  310. (open scheme-level-1
  311. number-i/o
  312. tables
  313. records record-types
  314. signals ;error
  315. locations ;make-undefined-location
  316. closures
  317. code-vectors ;code vectors
  318. fluids
  319. ascii
  320. bitwise
  321. methods ;disclose
  322. templates) ;template-info
  323. (files (big dump)))
  324. ; Pipes containing values.
  325. (define-structure value-pipes value-pipes-interface
  326. (open scheme queues
  327. proposals
  328. threads-internal
  329. signals) ;call-error
  330. (optimize auto-integrate)
  331. (files (big value-pipe)))
  332. ; Unix Sockets
  333. (define-structures ((sockets (export open-socket
  334. close-socket
  335. socket-accept
  336. socket-port-number
  337. socket-client
  338. get-host-name
  339. ; From the old interface
  340. ; I would like to get rid of these.
  341. socket-listen
  342. socket-listen-channels
  343. socket-client-channels))
  344. (udp-sockets (export get-host-name
  345. close-socket
  346. open-udp-socket
  347. udp-send
  348. udp-receive
  349. lookup-udp-address
  350. socket-port-number
  351. udp-address?
  352. udp-address-address
  353. udp-address-hostname
  354. udp-address-port)))
  355. (open scheme define-record-types
  356. external-calls
  357. channels ; channel? close-channel
  358. signals ; error call-error
  359. proposals ; atomically!
  360. interrupts ; enable-interrupts! disable-interrupts!
  361. channel-ports ; {in|out}put-channel->port
  362. channel-i/o ; wait-for-channel
  363. condvars ; for wait-for-channel
  364. byte-vectors)
  365. (files (big socket)))
  366. ; Heap traverser
  367. (define-structure traverse
  368. (export traverse-depth-first traverse-breadth-first trail
  369. set-leaf-predicate! usual-leaf-predicate)
  370. (open scheme-level-2
  371. primitives
  372. queues tables
  373. bitwise locations closures code-vectors
  374. features ; string-hash
  375. low-level ; vector-unassigned?
  376. more-types loopholes)
  377. (files (env traverse)))
  378. ; Reinitializing upon image resumption
  379. (define-structure reinitializers reinitializers-interface
  380. (open scheme-level-2
  381. define-record-types
  382. (subset record-types (define-record-resumer)))
  383. (files (big reinitializer)))
  384. ; Space analyzer
  385. (define-structure spatial (export space vector-space record-space)
  386. (open scheme
  387. architecture primitives assembler packages enumerated
  388. features sort locations display-conditions)
  389. (files (env space)))
  390. ; Listing what is in an interface. Here because it needs sort.
  391. (define-structure list-interfaces (export list-interface)
  392. (open scheme-level-2 interfaces packages meta-types sort bindings)
  393. (files (env list-interface)))
  394. ; red-black balanced binary search trees
  395. (define-structure search-trees search-trees-interface
  396. (open scheme-level-2 define-record-types)
  397. (optimize auto-integrate)
  398. (files (big search-tree)))
  399. ; vectors that grow as large as they need to
  400. (define-structure sparse-vectors sparse-vectors-interface
  401. (open scheme
  402. bitwise
  403. define-record-types)
  404. (files (big hilbert)))
  405. ; utilities for dealing with variable argument lists
  406. (define-structure variable-argument-lists variable-argument-lists-interface
  407. (open scheme-level-2)
  408. (files (big vararg)))
  409. ; record types with a fixed number of instances
  410. (define-structure finite-types (export ((define-finite-type
  411. define-enumerated-type) :syntax))
  412. (open scheme-level-2 code-quote define-record-types
  413. enumerated
  414. features) ; make-immutable
  415. (files (big finite-type)))
  416. ; nondeterminism via call/cc
  417. (define-structure nondeterminism (export with-nondeterminism
  418. ((either one-value all-values) :syntax)
  419. fail)
  420. (open scheme-level-2
  421. fluids cells
  422. (subset signals (error)))
  423. (files (big either)))
  424. ; test suites
  425. (define-structure test-suites test-suites-interface
  426. (open scheme
  427. cells
  428. big-util
  429. signals
  430. define-record-types
  431. exceptions conditions
  432. display-conditions
  433. (subset i/o (current-error-port))
  434. fluids)
  435. (files (big test-suite)))
  436. ;----------------
  437. ; Obsolete packages
  438. ; Bignums and bitwise logical operators on bignums. These are now handled
  439. ; by the VM. These packages are here to keep from breaking scripts that
  440. ; load them. They will be removed in a later release.
  441. (define-structure bignums (export)
  442. (open scheme-level-2))
  443. (define-structure bigbit (export)
  444. (open scheme-level-2))
  445. ; Externals - this is obsolete; use external-calls and dynamic-externals
  446. ; instead.
  447. (define-structure externals (compound-interface
  448. dynamic-externals-interface
  449. (export external-call
  450. null-terminate))
  451. (open scheme-level-2 dynamic-externals
  452. (subset external-calls (import-lambda-definition)))
  453. (begin
  454. ; We fake the old external-call primitive using the new one and a
  455. ; a C helper procedure from c/unix/dynamo.c.
  456. (define (external-call proc . args)
  457. (let ((args (apply vector args)))
  458. (old-external-call (external-value proc) args)))
  459. (import-lambda-definition old-external-call
  460. (proc args)
  461. "s48_old_external_call")
  462. ; All strings are now null terminated.
  463. (define (null-terminate string) string)))
  464. ;----------------
  465. ; ... end of package definitions.
  466. ; Temporary compatibility stuff
  467. (define-syntax define-signature
  468. (syntax-rules () ((define-signature . ?rest) (define-interface . ?rest))))
  469. (define-syntax define-package
  470. (syntax-rules () ((define-package . ?rest) (define-structures . ?rest))))
  471. (define table tables)
  472. (define record records)