changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/std/pkg.lisp

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