changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/std/pkg.lisp

changeset 691: 295ea43ceb2d
parent: ebe3315b7add
child: f51b73f49946
author: Richard Westhaver <ellis@rwest.io>
date: Wed, 02 Oct 2024 23:39: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 
183 (defpkg :std/fu
184  (:use :cl)
185  (:import-from :std/sym :make-gensym-list)
186  (:export
187  :ensure-function
188  :ensure-functionf
189  :disjoin
190  :conjoin
191  :compose
192  :multiple-value-compose
193  :curry
194  :rcurry))
195 
196 (defpkg :std/macs
197  (:use :cl)
198  (:import-from :std/sym :symb :mkstr :make-gensym-list :once-only :with-gensyms)
199  (:import-from :std/fu :compose)
200  (:import-from :std/named-readtables :in-readtable :parse-body)
201  (:import-from :std/list :flatten :defmacro!)
202  (:export
203  :named-lambda
204  :nested-loop
205  :g!-symbol-p
206  :defmacro/g!
207  :o!-symbol-p
208  :o!-symbol-to-g!-symbol
209  :defmacro!
210  :defun!
211  :dlambda
212  :until
213  :fact
214  :choose
215  :make-tlist
216  :tlist-left
217  :tlist-right
218  :tlist-empty-p
219  :tlist-add-left
220  :tlist-add-right
221  :tlist-rem-left
222  :tlist-update
223  :build-batcher-sn
224  :sortf
225  :dollar-symbol-p
226  :if-match
227  :when-match
228  :once-only
229  :destructuring-case
230  :destructuring-ccase
231  :destructuring-ecase
232  :when-let
233  :when-let*
234  :if-let
235  :if-let*
236  :if*
237  :define-constant
238  :defvar-unbound
239  :def!
240  :eval-always
241  ;; ana
242  :awhen
243  :acond
244  :alambda
245  :nlet-tail
246  :alet%
247  :alet
248  :acond2
249  :aif
250  :it
251  :%a
252  ;; pan
253  :%p
254  :pandoriclet
255  :pandoriclet-get
256  :pandoriclet-set
257  :get-pandoric
258  :with-pandoric
259  :pandoric-hotpatch
260  :pandoric-recode
261  :plambda
262  :pandoric-eval
263  :with-collectors
264  :collecting
265  :xor))
266 
267 (defpkg :std/thread
268  (:use :cl :sb-thread :sb-concurrency)
269  (:import-from :std/list :flatten)
270  (:use-reexport :sb-thread)
271  (:export
272  :std-thread-error
273  :print-top-level :thread-support-p
274  :find-thread-by-id :thread-id-list
275  :timed-join-thread :kill-thread
276  :wait-for-threads
277  :hang :finish-threads
278  :make-threads :with-threads
279  :thread-count :dump-thread))
280 
281 (defpkg :std/task
282  (:use :cl :std/thread :sb-concurrency)
283  (:import-from :std/thread :%make-thread)
284  (:import-from :std/macs :if-let)
285  (:export
286  :spawn-workers
287  :make-oracle :make-supervisor
288  :oracle :run-task
289  :oracle-id :find-thread
290  :push-job :push-task
291  :push-worker :push-task-result
292  :run-job :run-stage
293  :pop-job :pop-task
294  :pop-worker :pop-task-result
295  :*task-pool*
296  :*tasks*
297  :*oracles*
298  :*workers*
299  :*jobs*
300  :*stages*
301  :define-task-kernel
302  :*task-kernel*
303  :default-task-kernel
304  :make-worker
305  :make-workers
306  :run-tasks
307  :run-jobs
308  :worker-count
309  :init-task-pool
310  :make-task-pool
311  :start-task-pool :pause-task-pool
312  :shutdown-task-pool
313  :push-stage :designate-oracle
314  :make-task-pool
315  :task :job :task-pool
316  :stage :task-pool-p
317  :job-tasks :make-job
318  :job-p :task-object
319  :make-task :task-p :task
320  :task-pool-oracle :task-pool-jobs
321  :task-pool-stages
322  :task-pool-workers :task-pool-results
323  :with-task-pool))
324 
325 (defpkg :std/readtable
326  (:use :cl)
327  (:import-from :std/named-readtables :defreadtable)
328  (:import-from :std/fu :curry :rcurry :compose)
329  (:import-from :std/sym :symb)
330  (:import-from :std/list :defmacro!) ;; kludge
331  (:export
332  ;; readtable
333  :|#"-reader|
334  :|#`-reader|
335  :|#f-reader|
336  :|#$-reader|
337  :segment-reader
338  :match-mode-ppcre-lambda-form
339  :subst-mode-ppcre-lambda-form
340  :|#~-reader|
341  :_))
342 
343 (defpkg :std/bit
344  (:use :cl)
345  (:import-from :std/type :octet :octet-vector)
346  (:export
347  :make-bits
348  :sign-bit
349  :different-signs-p
350  :mortify-bits
351  :int-list-bits
352  :aref-bit
353  :make-bit-vector
354  :logbit
355  :bitfield
356  :bitfield-slot-name
357  :bitfield-slot-start
358  :bitfield-slot-end
359  :bitfield-slot-size
360  :bitfield-slot-reader
361  :bitfield-slot-initform
362  :bitfield-slot-pack
363  :bitfield-slot-unpack
364  :parse-atomic-bitfield-slot-specifier
365  :parse-compound-bitfield-slot-specifier
366  :bitfield-slot
367  :bitfield-boolean-slot
368  :bitfield-integer-slot
369  :bitfield-member-slot
370  :define-bitfield
371  :hex-string-to-octet-vector
372  :octet-vector-to-hex-string
373  :octets-to-integer
374  :integer-to-octets
375  :octets-to-integer-le
376  :integer-to-octets-le
377  :read-little-endian
378  :write-little-endian
379  :hexchar-to-int))
380 
381 (defpkg :std/fmt
382  (:use :cl)
383  (:import-from :std/list :group :ensure-cons)
384  (:shadowing-import-from :uiop :println)
385  (:export :printer-status :fmt-row :format-sxhash :iprintln :fmt-tree :println))
386 
387 (defpkg :std/path
388  (:use :cl)
389  (:export
390  :wild-pathname
391  :non-wild-pathname
392  :absolute-pathname
393  :relative-pathname
394  :directory-pathname
395  :symlink-pathname
396  :symlinkp
397  :absolute-directory-pathname
398  :+wildfile+ :+pathsep+ :set-pathname-suffix :*tmp-suffix*
399  :tmpize-pathname))
400 
401 (defpkg :std/os
402  (:use :cl)
403  (:import-from :std/macs :with-gensyms)
404  (:export
405  :list-all-users
406  :list-all-groups
407  :with-umask
408  :with-fd))
409 
410 (defpkg :std/file
411  (:use :cl)
412  (:import-from :std/macs :define-constant :once-only :eval-always)
413  (:import-from :std/stream :copy-stream)
414  (:import-from :std/type :octet :octet-vector :array-index :array-length :+default-element-type+)
415  (:export
416  :tmpfile
417  :file-pathname
418  :with-open-files
419  :write-stream-into-file
420  :write-file-into-stream
421  :file=
422  :file-size
423  :file-size-in-octets
424  :octet-vector=
425  :file-date
426  :file-timestamp
427  :directory-path-p
428  :*hidden-paths*
429  :hidden-path-p
430  :directory-path
431  :find-files
432  :count-file-lines))
433 
434 (defpkg :std/string
435  (:use :cl)
436  (:export
437  :*omit-nulls*
438  :*whitespaces*
439  :string-designator
440  :ssplit
441  :trim
442  :collapse-whitespaces
443  :make-template-parser
444  :string-case))
445 
446 (defpkg :std/seq
447  (:use :cl)
448  (:import-from :sb-int :collect)
449  (:import-from :std/array :signed-array-length)
450  (:export :take :starts-with-subseq :ends-with-subseq
451  :split-sequence :split-sequence-if :split-sequence-if-not))
452 
453 (defpkg :std/sys
454  (:use :cl)
455  (:shadowing-import-from :sb-kernel :get-lisp-obj-address :with-pinned-objects :unbound-marker-p :generation-of)
456  (:shadowing-import-from :sb-vm :list-allocated-objects)
457  (:import-from :sb-impl :*logical-hosts*)
458  (:export
459  :*default-arena-size*
460  :current-lisp-implementation
461  :current-machine
462  :list-package-symbols
463  :package-symbols
464  :package-symbol-names
465  :append-logical-hosts
466  :save-lisp-tree-shake-and-die
467  :save-lisp-and-live
468  :forget-shared-object
469  :forget-shared-objects
470  :compile-lisp))
471 
472 (defpkg :std
473  (:use :cl :sb-unicode :cl-ppcre :sb-mop :sb-c :sb-thread :sb-alien :sb-gray :sb-concurrency)
474  (:use-reexport :std/named-readtables :std/defpkg :std/condition
475  :std/sym :std/list :std/type :std/num
476  :std/stream :std/fu :std/array :std/hash-table
477  :std/alien :std/mop :std/thread :std/task
478  :std/macs :std/bit :std/fmt :std/path
479  :std/os :std/file :std/string :std/seq
480  :std/sys :std/readtable))
481 
482 (defpkg :std-user
483  (:use :cl :cl-user :sb-ext :std
484  :std-int :sb-alien :sb-thread :sb-bsd-sockets
485  :sb-gray :sb-mop :sb-debug))
486 
487 (pkg:define-lisp-package :std)