changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/std/pkg.lisp

changeset 696: 38e9c3be2392
parent: 2bad47888dbf
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 04 Oct 2024 21:11:52 -0400
permissions: -rw-r--r--
description: prep for adding zdict wrapper, change default control stack size of inferior-lisp to 8M
1 ;;; std/pkg.lisp --- Standard Packages
2 
3 ;;
4 
5 ;;; Code:
6 (pkg:defpkg :std-int
7  (:use :cl)
8  (:use-reexport :std/named-readtables :std/defpkg))
9 
10 (in-package :std-int)
11 
12 (defpackage :std/condition
13  (:use :cl)
14  (:export ;; err
15  :std-error :std-error-message
16  :define-error-reporter
17  :deferror
18  :nyi!
19  :required-argument
20  :ignore-some-conditions
21  :simple-style-warning
22  :simple-reader-error
23  :simple-parse-error
24  :simple-program-error
25  :circular-dependency
26  :circular-dependency-items
27  :unknown-argument
28  :unknown-argument-name
29  :unknown-argument-kind
30  :unknown-argument-p
31  :missing-argument
32  :missing-argument-command
33  :missing-argument-p
34  :invalid-argument
35  :invalid-argument-item
36  :invalid-argument-reason
37  :invalid-argument-p
38  :unwind-protect-case
39  :define-simple-error
40  :define-simple-error-reporter
41  :def-simple-error-reporter
42  :std-warning
43  :defwarning
44  :def-simple-warning-reporter
45  :def-warning-reporter))
46 
47 (defpackage :std/sym
48  (:use :cl)
49  (:shadowing-import-from :sb-int
50  :with-unique-names :symbolicate :package-symbolicate :keywordicate :gensymify*
51  :gensymify)
52  (:export
53  :ensure-symbol
54  :format-symbol
55  :make-keyword
56  :make-slot-name
57  :make-gensym
58  :make-gensym-list
59  :with-gensyms
60  :with-unique-names
61  :symbolicate
62  :keywordicate
63  :gensymify
64  :gensymify*))
65 
66 (defpkg :std/list
67  (:use :cl)
68  (:shadowing-import-from :sb-int
69  :ensure-list :recons :memq :assq
70  :ensure-list :proper-list-of-length-p :proper-list-p :singleton-p)
71  (:import-from :std/sym :symb)
72  (:import-from :std/named-readtables :parse-body)
73  (:export
74  :ensure-car
75  :ensure-cons
76  :appendf
77  :nconcf
78  :unionf
79  :nunionf
80  :reversef
81  :nreversef
82  :deletef
83  :flatten
84  :group
85  :let-binding-transform
86  :ensure-list :recons :memq :assq
87  :circular-list :circular-list-p :circular-tree-p :merge!
88  :sort!
89  :set-equal))
90 
91 (defpkg :std/type
92  (:use :cl)
93  (:import-from :std/sym :format-symbol :with-gensyms)
94  (:import-from :std/list :ensure-car)
95  (:export :+default-element-type+
96  :array-index :array-length
97  #:negative-double-float
98  #:negative-fixnum-p
99  #:negative-float
100  #:negative-float-p
101  #:negative-long-float
102  #:negative-long-float-p
103  #:negative-rational
104  #:negative-rational-p
105  #:negative-real
106  #:negative-single-float-p
107  #:non-negative-double-float
108  #:non-negative-double-float-p
109  #:non-negative-fixnum
110  #:non-negative-fixnum-p
111  #:non-negative-float
112  #:non-negative-float-p
113  #:non-negative-integer-p
114  #:non-negative-long-float
115  #:non-negative-rational
116  #:non-negative-real-p
117  #:non-negative-short-float-p
118  #:non-negative-single-float
119  #:non-negative-single-float-p
120  #:non-positive-double-float
121  #:non-positive-double-float-p
122  #:non-positive-fixnum
123  #:non-positive-fixnum-p
124  #:non-positive-float
125  #:non-positive-float-p
126  #:non-positive-integer
127  #:non-positive-rational
128  #:non-positive-real
129  #:non-positive-real-p
130  #:non-positive-short-float
131  #:non-positive-short-float-p
132  #:non-positive-single-float-p
133  #:positive-double-float
134  #:positive-double-float-p
135  #:positive-fixnum
136  #:positive-fixnum-p
137  #:positive-float
138  #:positive-float-p
139  #:positive-integer
140  #:positive-rational
141  #:positive-real
142  #:positive-real-p
143  #:positive-short-float
144  #:positive-short-float-p
145  #:positive-single-float
146  #:positive-single-float-p
147  :negative-integer
148  #:negative-double-float-p
149  #:negative-fixnum
150  #:negative-integer
151  #:negative-integer-p
152  #:negative-real-p
153  #:negative-short-float
154  #:negative-short-float-p
155  #:negative-single-float
156  #:non-negative-integer
157  #:non-negative-long-float-p
158  #:non-negative-rational-p
159  #:non-negative-real
160  #:non-negative-short-float
161  #:non-positive-integer-p
162  #:non-positive-long-float
163  #:non-positive-long-float-p
164  #:non-positive-rational-p
165  #:non-positive-single-float
166  :coercef
167  :octet
168  :octet-vector
169  #:positive-integer-p
170  #:positive-long-float
171  #:positive-long-float-p
172  #:positive-rational-p
173  :of-type
174  :type=))
175 
176 (defpkg :std/num
177  (:use :cl)
178  (:export
179  ;; num/parse
180  :parse-number
181  :parse-real-number
182  :parse-positive-real-number
183  :invalid-number
184  :invalid-number-value
185  :invalid-number-reason
186  ;; num/float
187  :make-float-converters
188  :encode-float32
189  :decode-float32
190  :encode-float64
191  :decode-float64
192  ;; num/leb128
193  :read-leb128
194  :encode-leb128
195  :decode-leb128
196  :read-uleb128
197  :encode-uleb128
198  :decode-uleb128))
199 
200 (defpkg :std/stream
201  (:use :cl :sb-gray)
202  (:import-from :std/type :non-negative-integer :positive-integer)
203  (:export
204  ;; stream
205  :copy-stream
206  :wrapped-stream
207  :wrapped-character-input-stream
208  :wrapped-character-output-stream
209  :counting-character-input-stream
210  :prefixed-character-output-stream
211  :stream-of :char-count-of :line-count-of :col-count-of
212  :prev-col-count-of :col-index-of :write-prefix
213  :prefix-of))
214 
215 (defpkg :std/array
216  (:use :cl)
217  (:export :copy-array :signed-array-length))
218 
219 (defpkg :std/hash-table
220  (:use :cl)
221  (:nicknames :std/ht)
222  (:export :hash-table-alist
223  :maphash-keys :hash-table-keys
224  :maphash-values :hash-table-values))
225 
226 (defpkg :std/alien
227  (:use :cl :sb-alien)
228  (:import-from :std/sym :symbolicate :with-gensyms)
229  (:export
230  :setfa
231  :copy-c-string
232  :clone-strings
233  :octets-to-alien-array
234  :with-alien-slots
235  :clone-octets-to-alien
236  :octets-to-alien
237  :clone-octets-from-alien
238  :foreign-int-to-integer
239  :foreign-int-to-bool
240  :bool-to-foreign-int
241  :define-alien-enum
242  :define-opaque
243  :shared-object-name
244  :define-alien-loader
245  :c-string-to-string-list
246  :list-all-shared-objects
247  :num-cpus
248  :*cpus*
249  :loff-t
250  :memset
251  :memcpy
252  :posix-memalign))
253 
254 (defpkg :std/mop
255  (:use :cl :sb-mop :sb-pcl)
256  (:import-from :std/sym :symb :make-keyword)
257  (:export :list-slot-values-using-class
258  :list-class-methods :list-class-slots :list-indirect-slot-methods
259  :ensure-finalized :subclassp))
260 
261 (defpkg :std/fu
262  (:use :cl)
263  (:import-from :std/sym :make-gensym-list)
264  (:export
265  :ensure-function
266  :ensure-functionf
267  :disjoin
268  :conjoin
269  :compose
270  :multiple-value-compose
271  :curry
272  :rcurry))
273 
274 (defpkg :std/macs
275  (:use :cl)
276  (:import-from :std/sym :symb :mkstr :make-gensym-list :once-only :with-gensyms)
277  (:import-from :std/fu :compose)
278  (:import-from :std/named-readtables :in-readtable :parse-body)
279  (:import-from :std/list :flatten :defmacro!)
280  (:export
281  :named-lambda
282  :nested-loop
283  :g!-symbol-p
284  :defmacro/g!
285  :o!-symbol-p
286  :o!-symbol-to-g!-symbol
287  :defmacro!
288  :defun!
289  :dlambda
290  :until
291  :fact
292  :choose
293  :make-tlist
294  :tlist-left
295  :tlist-right
296  :tlist-empty-p
297  :tlist-add-left
298  :tlist-add-right
299  :tlist-rem-left
300  :tlist-update
301  :build-batcher-sn
302  :sortf
303  :dollar-symbol-p
304  :if-match
305  :when-match
306  :once-only
307  :destructuring-case
308  :destructuring-ccase
309  :destructuring-ecase
310  :when-let
311  :when-let*
312  :if-let
313  :if-let*
314  :if*
315  :define-constant
316  :defvar-unbound
317  :def!
318  :eval-always
319  ;; ana
320  :awhen
321  :acond
322  :alambda
323  :nlet-tail
324  :alet%
325  :alet
326  :acond2
327  :aif
328  :it
329  :%a
330  ;; pan
331  :%p
332  :pandoriclet
333  :pandoriclet-get
334  :pandoriclet-set
335  :get-pandoric
336  :with-pandoric
337  :pandoric-hotpatch
338  :pandoric-recode
339  :plambda
340  :pandoric-eval
341  :with-collectors
342  :collecting
343  :xor))
344 
345 (defpkg :std/thread
346  (:use :cl :sb-thread :sb-concurrency)
347  (:import-from :std/list :flatten)
348  (:use-reexport :sb-thread)
349  (:export
350  :std-thread-error
351  :print-top-level :thread-support-p
352  :find-thread-by-id :thread-id-list
353  :timed-join-thread :kill-thread
354  :wait-for-threads
355  :hang :finish-threads
356  :make-threads :with-threads
357  :thread-count :dump-thread))
358 
359 (defpkg :std/task
360  (:use :cl :std/thread :sb-concurrency)
361  (:import-from :std/thread :%make-thread)
362  (:import-from :std/macs :if-let :eval-always)
363  (:import-from :std/list :deletef)
364  (:export
365  :spawn-workers
366  :make-oracle :make-supervisor
367  :oracle
368  :oracle-id :find-thread
369  :push-job :push-task
370  :push-worker :push-task-result
371  :run-object
372  :work
373  :pop-job :pop-task
374  :workers
375  :tasks
376  :results
377  :kill-workers
378  :kill-worker
379  :join-worker
380  :worker-thread
381  :start-task-worker
382  :start-task-workers
383  :pop-worker :pop-task-result
384  :*task-pool*
385  :*tasks*
386  :*oracles*
387  :*oracle-threads*
388  :*worker-threads*
389  :*supervisor-threads*
390  :*jobs*
391  :*stages*
392  :*task*
393  :*task-result*
394  :define-task-kernel
395  :*task-kernel*
396  :default-task-kernel
397  :make-worker
398  :make-workers
399  :run-tasks
400  :run-jobs
401  :worker-count
402  :init-task-pool
403  :make-task-pool
404  :start-task-pool :pause-task-pool
405  :shutdown-task-pool
406  :push-stage :designate-oracle
407  :make-task-pool
408  :task :job :task-pool
409  :stage :task-pool-p
410  :job-tasks :make-job
411  :job-p :task-object
412  :make-task :task-p :task
413  :task-pool-oracle :task-pool-jobs
414  :task-pool-stages
415  :task-pool-workers :task-pool-results
416  :with-task-pool))
417 
418 (defpkg :std/readtable
419  (:use :cl)
420  (:import-from :std/named-readtables :defreadtable)
421  (:import-from :std/fu :curry :rcurry :compose)
422  (:import-from :std/sym :symb)
423  (:import-from :std/list :defmacro!) ;; kludge
424  (:export
425  ;; readtable
426  :|#"-reader|
427  :|#`-reader|
428  :|#f-reader|
429  :|#$-reader|
430  :segment-reader
431  :match-mode-ppcre-lambda-form
432  :subst-mode-ppcre-lambda-form
433  :|#~-reader|
434  :_))
435 
436 (defpkg :std/bit
437  (:use :cl)
438  (:import-from :std/type :octet :octet-vector)
439  (:export
440  :make-bits
441  :sign-bit
442  :different-signs-p
443  :mortify-bits
444  :int-list-bits
445  :aref-bit
446  :make-bit-vector
447  :logbit
448  :bitfield
449  :bitfield-slot-name
450  :bitfield-slot-start
451  :bitfield-slot-end
452  :bitfield-slot-size
453  :bitfield-slot-reader
454  :bitfield-slot-initform
455  :bitfield-slot-pack
456  :bitfield-slot-unpack
457  :parse-atomic-bitfield-slot-specifier
458  :parse-compound-bitfield-slot-specifier
459  :bitfield-slot
460  :bitfield-boolean-slot
461  :bitfield-integer-slot
462  :bitfield-member-slot
463  :define-bitfield
464  :hex-string-to-octet-vector
465  :octet-vector-to-hex-string
466  :octets-to-integer
467  :integer-to-octets
468  :octets-to-integer-le
469  :integer-to-octets-le
470  :read-little-endian
471  :write-little-endian
472  :hexchar-to-int))
473 
474 (defpkg :std/fmt
475  (:use :cl)
476  (:import-from :std/list :group :ensure-cons)
477  (:shadowing-import-from :uiop :println)
478  (:export :printer-status :fmt-row :format-sxhash :iprintln :fmt-tree :println))
479 
480 (defpkg :std/path
481  (:use :cl)
482  (:export
483  :wild-pathname
484  :non-wild-pathname
485  :absolute-pathname
486  :relative-pathname
487  :directory-pathname
488  :symlink-pathname
489  :symlinkp
490  :absolute-directory-pathname
491  :+wildfile+ :+pathsep+ :set-pathname-suffix :*tmp-suffix*
492  :tmpize-pathname))
493 
494 (defpkg :std/os
495  (:use :cl)
496  (:import-from :std/macs :with-gensyms)
497  (:export
498  :list-all-users
499  :list-all-groups
500  :with-umask
501  :with-fd))
502 
503 (defpkg :std/file
504  (:use :cl)
505  (:import-from :std/macs :define-constant :once-only :eval-always)
506  (:import-from :std/stream :copy-stream)
507  (:import-from :std/type :octet :octet-vector :array-index :array-length :+default-element-type+)
508  (:export
509  :tmpfile
510  :file-pathname
511  :with-open-files
512  :write-stream-into-file
513  :write-file-into-stream
514  :file=
515  :file-size
516  :file-size-in-octets
517  :octet-vector=
518  :file-date
519  :file-timestamp
520  :directory-path-p
521  :*hidden-paths*
522  :hidden-path-p
523  :directory-path
524  :find-files
525  :count-file-lines))
526 
527 (defpkg :std/string
528  (:use :cl)
529  (:export
530  :*omit-nulls*
531  :*whitespaces*
532  :string-designator
533  :ssplit
534  :trim
535  :collapse-whitespaces
536  :make-template-parser
537  :string-case))
538 
539 (defpkg :std/seq
540  (:use :cl)
541  (:import-from :sb-int :collect)
542  (:import-from :std/array :signed-array-length)
543  (:export :take :starts-with-subseq :ends-with-subseq
544  :split-sequence :split-sequence-if :split-sequence-if-not))
545 
546 (defpkg :std/sys
547  (:use :cl)
548  (:shadowing-import-from :sb-kernel :get-lisp-obj-address :with-pinned-objects :unbound-marker-p :generation-of)
549  (:shadowing-import-from :sb-vm :list-allocated-objects)
550  (:import-from :sb-impl :*logical-hosts*)
551  (:export
552  :*default-arena-size*
553  :current-lisp-implementation
554  :current-machine
555  :list-package-symbols
556  :package-symbols
557  :package-symbol-names
558  :append-logical-hosts
559  :save-lisp-tree-shake-and-die
560  :save-lisp-and-live
561  :forget-shared-object
562  :forget-shared-objects
563  :compile-lisp))
564 
565 (defpkg :std
566  (:use :cl :sb-unicode :cl-ppcre :sb-mop :sb-c :sb-thread :sb-alien :sb-gray :sb-concurrency)
567  (:use-reexport :std/named-readtables :std/defpkg :std/condition
568  :std/sym :std/list :std/type :std/num
569  :std/stream :std/fu :std/array :std/hash-table
570  :std/alien :std/mop :std/thread :std/task
571  :std/macs :std/bit :std/fmt :std/path
572  :std/os :std/file :std/string :std/seq
573  :std/sys :std/readtable))
574 
575 (defpkg :std-user
576  (:use :cl :cl-user :sb-ext :std
577  :std-int :sb-alien :sb-thread :sb-bsd-sockets
578  :sb-gray :sb-mop :sb-debug))
579 
580 (pkg:define-lisp-package :std)