changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/std/pkg.lisp

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