changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/std/pkg.lisp

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