changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/std/pkg.lisp

changeset 694: a36280d2ef4e
parent: f51b73f49946
child: 2bad47888dbf
author: Richard Westhaver <ellis@rwest.io>
date: Thu, 03 Oct 2024 21:54:07 -0400
permissions: -rw-r--r--
description: tasks
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-integer :non-negative-integer
98  :positive-integer :octet
99  :octet-vector))
100 
101 (defpkg :std/num
102  (:use :cl)
103  (:export
104  ;; num/parse
105  :parse-number
106  :parse-real-number
107  :parse-positive-real-number
108  :invalid-number
109  :invalid-number-value
110  :invalid-number-reason
111  ;; num/float
112  :make-float-converters
113  :encode-float32
114  :decode-float32
115  :encode-float64
116  :decode-float64
117  ;; num/leb128
118  :read-leb128
119  :encode-leb128
120  :decode-leb128
121  :read-uleb128
122  :encode-uleb128
123  :decode-uleb128))
124 
125 (defpkg :std/stream
126  (:use :cl :sb-gray)
127  (:import-from :std/type :non-negative-integer :positive-integer)
128  (:export
129  ;; stream
130  :copy-stream
131  :wrapped-stream
132  :wrapped-character-input-stream
133  :wrapped-character-output-stream
134  :counting-character-input-stream
135  :prefixed-character-output-stream
136  :stream-of :char-count-of :line-count-of :col-count-of
137  :prev-col-count-of :col-index-of :write-prefix
138  :prefix-of))
139 
140 (defpkg :std/array
141  (:use :cl)
142  (:export :copy-array :signed-array-length))
143 
144 (defpkg :std/hash-table
145  (:use :cl)
146  (:nicknames :std/ht)
147  (:export :hash-table-alist
148  :maphash-keys :hash-table-keys
149  :maphash-values :hash-table-values))
150 
151 (defpkg :std/alien
152  (:use :cl :sb-alien)
153  (:import-from :std/sym :symbolicate :with-gensyms)
154  (:export
155  :setfa
156  :copy-c-string
157  :clone-strings
158  :octets-to-alien-array
159  :with-alien-slots
160  :clone-octets-to-alien
161  :octets-to-alien
162  :clone-octets-from-alien
163  :foreign-int-to-integer
164  :foreign-int-to-bool
165  :bool-to-foreign-int
166  :define-alien-enum
167  :define-opaque
168  :shared-object-name
169  :define-alien-loader
170  :c-string-to-string-list
171  :list-all-shared-objects
172  :num-cpus
173  :*cpus*
174  :loff-t
175  :memset))
176 
177 (defpkg :std/mop
178  (:use :cl :sb-mop :sb-pcl)
179  (:import-from :std/sym :symb :make-keyword)
180  (:export :list-slot-values-using-class
181  :list-class-methods :list-class-slots :list-indirect-slot-methods
182  :ensure-finalized :subclassp))
183 
184 (defpkg :std/fu
185  (:use :cl)
186  (:import-from :std/sym :make-gensym-list)
187  (:export
188  :ensure-function
189  :ensure-functionf
190  :disjoin
191  :conjoin
192  :compose
193  :multiple-value-compose
194  :curry
195  :rcurry))
196 
197 (defpkg :std/macs
198  (:use :cl)
199  (:import-from :std/sym :symb :mkstr :make-gensym-list :once-only :with-gensyms)
200  (:import-from :std/fu :compose)
201  (:import-from :std/named-readtables :in-readtable :parse-body)
202  (:import-from :std/list :flatten :defmacro!)
203  (:export
204  :named-lambda
205  :nested-loop
206  :g!-symbol-p
207  :defmacro/g!
208  :o!-symbol-p
209  :o!-symbol-to-g!-symbol
210  :defmacro!
211  :defun!
212  :dlambda
213  :until
214  :fact
215  :choose
216  :make-tlist
217  :tlist-left
218  :tlist-right
219  :tlist-empty-p
220  :tlist-add-left
221  :tlist-add-right
222  :tlist-rem-left
223  :tlist-update
224  :build-batcher-sn
225  :sortf
226  :dollar-symbol-p
227  :if-match
228  :when-match
229  :once-only
230  :destructuring-case
231  :destructuring-ccase
232  :destructuring-ecase
233  :when-let
234  :when-let*
235  :if-let
236  :if-let*
237  :if*
238  :define-constant
239  :defvar-unbound
240  :def!
241  :eval-always
242  ;; ana
243  :awhen
244  :acond
245  :alambda
246  :nlet-tail
247  :alet%
248  :alet
249  :acond2
250  :aif
251  :it
252  :%a
253  ;; pan
254  :%p
255  :pandoriclet
256  :pandoriclet-get
257  :pandoriclet-set
258  :get-pandoric
259  :with-pandoric
260  :pandoric-hotpatch
261  :pandoric-recode
262  :plambda
263  :pandoric-eval
264  :with-collectors
265  :collecting
266  :xor))
267 
268 (defpkg :std/thread
269  (:use :cl :sb-thread :sb-concurrency)
270  (:import-from :std/list :flatten)
271  (:use-reexport :sb-thread)
272  (:export
273  :std-thread-error
274  :print-top-level :thread-support-p
275  :find-thread-by-id :thread-id-list
276  :timed-join-thread :kill-thread
277  :wait-for-threads
278  :hang :finish-threads
279  :make-threads :with-threads
280  :thread-count :dump-thread))
281 
282 (defpkg :std/task
283  (:use :cl :std/thread :sb-concurrency)
284  (:import-from :std/thread :%make-thread)
285  (:import-from :std/macs :if-let)
286  (:import-from :std/list :deletef)
287  (:export
288  :spawn-workers
289  :make-oracle :make-supervisor
290  :oracle
291  :oracle-id :find-thread
292  :push-job :push-task
293  :push-worker :push-task-result
294  :run :run-object
295  :work
296  :pop-job :pop-task
297  :workers
298  :tasks
299  :results
300  :kill-workers
301  :kill-worker
302  :join-worker
303  :worker-thread
304  :start-task-worker
305  :start-task-workers
306  :pop-worker :pop-task-result
307  :*task-pool*
308  :*tasks*
309  :*oracles*
310  :*oracle-threads*
311  :*worker-threads*
312  :*supervisor-threads*
313  :*jobs*
314  :*stages*
315  :*task*
316  :*task-result*
317  :define-task-kernel
318  :*task-kernel*
319  :default-task-kernel
320  :make-worker
321  :make-workers
322  :run-tasks
323  :run-jobs
324  :worker-count
325  :init-task-pool
326  :make-task-pool
327  :start-task-pool :pause-task-pool
328  :shutdown-task-pool
329  :push-stage :designate-oracle
330  :make-task-pool
331  :task :job :task-pool
332  :stage :task-pool-p
333  :job-tasks :make-job
334  :job-p :task-object
335  :make-task :task-p :task
336  :task-pool-oracle :task-pool-jobs
337  :task-pool-stages
338  :task-pool-workers :task-pool-results
339  :with-task-pool))
340 
341 (defpkg :std/readtable
342  (:use :cl)
343  (:import-from :std/named-readtables :defreadtable)
344  (:import-from :std/fu :curry :rcurry :compose)
345  (:import-from :std/sym :symb)
346  (:import-from :std/list :defmacro!) ;; kludge
347  (:export
348  ;; readtable
349  :|#"-reader|
350  :|#`-reader|
351  :|#f-reader|
352  :|#$-reader|
353  :segment-reader
354  :match-mode-ppcre-lambda-form
355  :subst-mode-ppcre-lambda-form
356  :|#~-reader|
357  :_))
358 
359 (defpkg :std/bit
360  (:use :cl)
361  (:import-from :std/type :octet :octet-vector)
362  (:export
363  :make-bits
364  :sign-bit
365  :different-signs-p
366  :mortify-bits
367  :int-list-bits
368  :aref-bit
369  :make-bit-vector
370  :logbit
371  :bitfield
372  :bitfield-slot-name
373  :bitfield-slot-start
374  :bitfield-slot-end
375  :bitfield-slot-size
376  :bitfield-slot-reader
377  :bitfield-slot-initform
378  :bitfield-slot-pack
379  :bitfield-slot-unpack
380  :parse-atomic-bitfield-slot-specifier
381  :parse-compound-bitfield-slot-specifier
382  :bitfield-slot
383  :bitfield-boolean-slot
384  :bitfield-integer-slot
385  :bitfield-member-slot
386  :define-bitfield
387  :hex-string-to-octet-vector
388  :octet-vector-to-hex-string
389  :octets-to-integer
390  :integer-to-octets
391  :octets-to-integer-le
392  :integer-to-octets-le
393  :read-little-endian
394  :write-little-endian
395  :hexchar-to-int))
396 
397 (defpkg :std/fmt
398  (:use :cl)
399  (:import-from :std/list :group :ensure-cons)
400  (:shadowing-import-from :uiop :println)
401  (:export :printer-status :fmt-row :format-sxhash :iprintln :fmt-tree :println))
402 
403 (defpkg :std/path
404  (:use :cl)
405  (:export
406  :wild-pathname
407  :non-wild-pathname
408  :absolute-pathname
409  :relative-pathname
410  :directory-pathname
411  :symlink-pathname
412  :symlinkp
413  :absolute-directory-pathname
414  :+wildfile+ :+pathsep+ :set-pathname-suffix :*tmp-suffix*
415  :tmpize-pathname))
416 
417 (defpkg :std/os
418  (:use :cl)
419  (:import-from :std/macs :with-gensyms)
420  (:export
421  :list-all-users
422  :list-all-groups
423  :with-umask
424  :with-fd))
425 
426 (defpkg :std/file
427  (:use :cl)
428  (:import-from :std/macs :define-constant :once-only :eval-always)
429  (:import-from :std/stream :copy-stream)
430  (:import-from :std/type :octet :octet-vector :array-index :array-length :+default-element-type+)
431  (:export
432  :tmpfile
433  :file-pathname
434  :with-open-files
435  :write-stream-into-file
436  :write-file-into-stream
437  :file=
438  :file-size
439  :file-size-in-octets
440  :octet-vector=
441  :file-date
442  :file-timestamp
443  :directory-path-p
444  :*hidden-paths*
445  :hidden-path-p
446  :directory-path
447  :find-files
448  :count-file-lines))
449 
450 (defpkg :std/string
451  (:use :cl)
452  (:export
453  :*omit-nulls*
454  :*whitespaces*
455  :string-designator
456  :ssplit
457  :trim
458  :collapse-whitespaces
459  :make-template-parser
460  :string-case))
461 
462 (defpkg :std/seq
463  (:use :cl)
464  (:import-from :sb-int :collect)
465  (:import-from :std/array :signed-array-length)
466  (:export :take :starts-with-subseq :ends-with-subseq
467  :split-sequence :split-sequence-if :split-sequence-if-not))
468 
469 (defpkg :std/sys
470  (:use :cl)
471  (:shadowing-import-from :sb-kernel :get-lisp-obj-address :with-pinned-objects :unbound-marker-p :generation-of)
472  (:shadowing-import-from :sb-vm :list-allocated-objects)
473  (:import-from :sb-impl :*logical-hosts*)
474  (:export
475  :*default-arena-size*
476  :current-lisp-implementation
477  :current-machine
478  :list-package-symbols
479  :package-symbols
480  :package-symbol-names
481  :append-logical-hosts
482  :save-lisp-tree-shake-and-die
483  :save-lisp-and-live
484  :forget-shared-object
485  :forget-shared-objects
486  :compile-lisp))
487 
488 (defpkg :std
489  (:use :cl :sb-unicode :cl-ppcre :sb-mop :sb-c :sb-thread :sb-alien :sb-gray :sb-concurrency)
490  (:use-reexport :std/named-readtables :std/defpkg :std/condition
491  :std/sym :std/list :std/type :std/num
492  :std/stream :std/fu :std/array :std/hash-table
493  :std/alien :std/mop :std/thread :std/task
494  :std/macs :std/bit :std/fmt :std/path
495  :std/os :std/file :std/string :std/seq
496  :std/sys :std/readtable))
497 
498 (defpkg :std-user
499  (:use :cl :cl-user :sb-ext :std
500  :std-int :sb-alien :sb-thread :sb-bsd-sockets
501  :sb-gray :sb-mop :sb-debug))
502 
503 (pkg:define-lisp-package :std)