changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/std/pkg.lisp

changeset 658: 804b5ee20a46
parent: 937a6f354047
child: 4d8451fe5423
author: Richard Westhaver <ellis@rwest.io>
date: Thu, 19 Sep 2024 23:23:02 -0400
permissions: -rw-r--r--
description: zstd completed (besides zdict), working on readline
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  :print-top-level :thread-support-p
273  :find-thread-by-id :thread-id-list
274  :timed-join-thread :kill-thread
275  :wait-for-threads
276  :hang :finish-threads
277  :make-threads :with-threads
278  :thread-count :dump-thread))
279 
280 (defpkg :std/task
281  (:use :cl :std/thread :sb-concurrency)
282  (:import-from :std/thread :%make-thread)
283  (:import-from :std/macs :if-let)
284  (:export
285  :spawn-workers
286  :make-oracle :make-supervisor
287  :oracle :run-task
288  :oracle-id :find-thread
289  :push-job :push-task
290  :push-worker :push-task-result
291  :run-job :run-stage
292  :pop-job :pop-task
293  :pop-worker :pop-task-result
294  :*task-pool*
295  :*tasks*
296  :*oracles*
297  :*workers*
298  :*jobs*
299  :*stages*
300  :define-task-kernel
301  :*task-kernel*
302  :default-task-kernel
303  :make-worker
304  :make-workers
305  :worker-count
306  :init-task-pool
307  :make-task-pool
308  :start-task-pool :pause-task-pool
309  :shutdown-task-pool
310  :push-stage :designate-oracle
311  :make-task-pool
312  :task :job :task-pool
313  :stage :task-pool-p
314  :job-tasks :make-job
315  :job-p :task-object
316  :make-task :task-p :task
317  :task-pool-oracle :task-pool-jobs
318  :task-pool-stages
319  :task-pool-workers :task-pool-results
320  :with-task-pool))
321 
322 (defpkg :std/readtable
323  (:use :cl)
324  (:import-from :std/named-readtables :defreadtable)
325  (:import-from :std/fu :curry :rcurry :compose)
326  (:import-from :std/sym :symb)
327  (:import-from :std/list :defmacro!) ;; kludge
328  (:export
329  ;; readtable
330  :|#"-reader|
331  :|#`-reader|
332  :|#f-reader|
333  :|#$-reader|
334  :segment-reader
335  :match-mode-ppcre-lambda-form
336  :subst-mode-ppcre-lambda-form
337  :|#~-reader|
338  :_))
339 
340 (defpkg :std/bit
341  (:use :cl)
342  (:import-from :std/type :octet :octet-vector)
343  (:export
344  :make-bits
345  :sign-bit
346  :different-signs-p
347  :mortify-bits
348  :int-list-bits
349  :aref-bit
350  :make-bit-vector
351  :logbit
352  :bitfield
353  :bitfield-slot-name
354  :bitfield-slot-start
355  :bitfield-slot-end
356  :bitfield-slot-size
357  :bitfield-slot-reader
358  :bitfield-slot-initform
359  :bitfield-slot-pack
360  :bitfield-slot-unpack
361  :parse-atomic-bitfield-slot-specifier
362  :parse-compound-bitfield-slot-specifier
363  :bitfield-slot
364  :bitfield-boolean-slot
365  :bitfield-integer-slot
366  :bitfield-member-slot
367  :define-bitfield
368  :hex-string-to-octet-vector
369  :octet-vector-to-hex-string
370  :octets-to-integer
371  :integer-to-octets
372  :octets-to-integer-le
373  :integer-to-octets-le
374  :read-little-endian
375  :write-little-endian
376  :hexchar-to-int))
377 
378 (defpkg :std/fmt
379  (:use :cl)
380  (:import-from :std/list :group :ensure-cons)
381  (:shadowing-import-from :uiop :println)
382  (:export :printer-status :fmt-row :format-sxhash :iprintln :fmt-tree :println))
383 
384 (defpkg :std/path
385  (:use :cl)
386  (:export
387  :wild-pathname
388  :non-wild-pathname
389  :absolute-pathname
390  :relative-pathname
391  :directory-pathname
392  :symlink-pathname
393  :symlinkp
394  :absolute-directory-pathname
395  :+wildfile+ :+pathsep+ :set-pathname-suffix :*tmp-suffix*
396  :tmpize-pathname))
397 
398 (defpkg :std/os
399  (:use :cl)
400  (:import-from :std/macs :with-gensyms)
401  (:export
402  :list-all-users
403  :list-all-groups
404  :with-umask))
405 
406 (defpkg :std/file
407  (:use :cl)
408  (:import-from :std/macs :define-constant :once-only :eval-always)
409  (:import-from :std/stream :copy-stream)
410  (:import-from :std/type :octet :octet-vector :array-index :array-length :+default-element-type+)
411  (:export
412  :tmpfile
413  :file-pathname
414  :with-open-files
415  :write-stream-into-file
416  :write-file-into-stream
417  :file=
418  :file-size
419  :file-size-in-octets
420  :octet-vector=
421  :file-date
422  :file-timestamp
423  :directory-path-p
424  :*hidden-paths*
425  :hidden-path-p
426  :directory-path
427  :find-files
428  :count-file-lines))
429 
430 (defpkg :std/string
431  (:use :cl)
432  (:export
433  :*omit-nulls*
434  :*whitespaces*
435  :string-designator
436  :ssplit
437  :trim
438  :collapse-whitespaces
439  :make-template-parser
440  :string-case))
441 
442 (defpkg :std/seq
443  (:use :cl)
444  (:import-from :sb-int :collect)
445  (:import-from :std/array :signed-array-length)
446  (:export :take :starts-with-subseq :ends-with-subseq
447  :split-sequence :split-sequence-if :split-sequence-if-not))
448 
449 (defpkg :std/sys
450  (:use :cl)
451  (:shadowing-import-from :sb-kernel :get-lisp-obj-address :with-pinned-objects :unbound-marker-p :generation-of)
452  (:shadowing-import-from :sb-vm :list-allocated-objects)
453  (:import-from :sb-impl :*logical-hosts*)
454  (:export
455  :current-lisp-implementation
456  :current-machine
457  :list-package-symbols
458  :package-symbols
459  :package-symbol-names
460  :append-logical-hosts
461  :save-lisp-tree-shake-and-die
462  :save-lisp-and-live
463  :forget-shared-object
464  :forget-shared-objects
465  :compile-lisp))
466 
467 (defpkg :std
468  (:use :cl :sb-unicode :cl-ppcre :sb-mop :sb-c :sb-thread :sb-alien :sb-gray :sb-concurrency)
469  (:use-reexport :std/named-readtables :std/defpkg :std/condition
470  :std/sym :std/list :std/type :std/num
471  :std/stream :std/fu :std/array :std/hash-table
472  :std/alien :std/mop :std/thread :std/task
473  :std/macs :std/bit :std/fmt :std/path
474  :std/os :std/file :std/string :std/seq
475  :std/sys :std/readtable))
476 
477 (defpkg :std-user
478  (:use :cl :cl-user :sb-ext :std
479  :std-int :sb-alien :sb-thread :sb-bsd-sockets
480  :sb-gray :sb-mop :sb-debug))
481 
482 (pkg:define-lisp-package :std)