Coverage report: /home/ellis/comp/core/std/pkg.lisp

KindCoveredAll%
expression050 0.0
branch00nil
Key
Not instrumented
Conditionalized out
Executed
Not executed
 
Both branches taken
One branch taken
Neither branch taken
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
   (:export :*std-packages*))
10
 
11
 (in-package :std-int)
12
 (defparameter *std-packages* nil)
13
 (setq *defpkg-hook* (lambda (x) (pushnew (package-name x) *std-packages* :test 'string=)))
14
 
15
 (defpkg :std/sym
16
   (:use :cl)
17
   (:mix :sb-int)
18
   (:shadowing-import-from :sb-int :once-only)
19
   (:shadow :make-gensym :make-gensyms :make-gensym-list)
20
   (:export
21
    :ensure-symbol
22
    :symb
23
    :format-symbol
24
    :make-keyword
25
    :make-slot-name
26
    :make-gensym
27
    :make-gensym-list
28
    :with-gensyms
29
    :with-unique-names
30
    :symbolicate
31
    :keywordicate
32
    :gensymify
33
    :gensymify* 
34
    :fboundp! :vboundp!
35
    :alias-macro
36
    :alias-function))
37
 
38
 (defpkg :std/list
39
   (:use :cl)
40
   (:shadowing-import-from :sb-int 
41
    :ensure-list :recons :memq :assq
42
    :proper-list-of-length-p :proper-list-p :singleton-p)
43
   (:import-from :std/sym :with-gensyms)
44
   (:import-from :sb-int :doplist)
45
   (:import-from :sb-kernel :topological-sort)
46
   (:shadow :group)
47
   (:export
48
    :flatten*
49
    :safe-endp
50
    :singleton-p
51
    :circular-list-error
52
    :proper-list-length
53
    :lastcar
54
    :doplist
55
    :assoc-value
56
    :ensure-car
57
    :ensure-cons
58
    :appendf
59
    :nconcf
60
    :unionf
61
    :nunionf
62
    :reversef
63
    :nreversef
64
    :removef
65
    :deletef
66
    :flatten
67
    :group
68
    :firstn
69
    :zip-list :zip-tree
70
    :zipsym
71
    :ziprm
72
    :pairs
73
    :nconsc
74
    :cart :mapcart
75
    :cart-case :cart-ecase
76
    :cart-typecase :cart-etypecase
77
    :recursive-append :list-dimensions
78
    :maptree :maptree-if
79
    :let-binding-transform
80
    :ensure-list :recons :memq :assq
81
    :circular-list :circular-list-p :circular-tree-p :merge!
82
    :sort!
83
    :set-equal
84
    :dcons :dpush
85
    :dpop :dlist :drdc :dcdr :dcar :dappendf
86
    :topological-sort :match-lambda-lists
87
    :toposort))
88
 
89
 (defpkg :std/prim
90
   (:use :cl :std/list)
91
   (:import-from :std/sym :symb :with-gensyms)
92
   (:import-from :std/named-readtables :parse-body)
93
   (:export 
94
    :g!-symbol-p
95
    :defmacro/g!
96
    :o!-symbol-p
97
    :o!-symbol-to-g!-symbol
98
    :defmacro!
99
    :unquote-args
100
    :defun!
101
    :definline
102
    :defnotinline
103
    :with-optimization
104
    :macrofy
105
    :with-marking
106
    :using-gensyms
107
    :binding-gensyms))
108
 
109
 (defpkg :std/condition
110
   (:use :cl)
111
   (:shadowing-import-from :asdf :error-name)
112
   (:import-from :std/list :flatten :removef)
113
   (:export
114
    :*error-message*
115
    :*handlers*
116
    :std-error :error-message
117
    :define-error-reporter
118
    :deferror
119
    :nyi!
120
    :required-argument
121
    :ignore-some-conditions
122
    :simple-style-warning
123
    :simple-reader-error
124
    :simple-parse-error
125
    :simple-program-error
126
    :circular-dependencies
127
    :unknown-argument
128
    :error-name
129
    :error-kind
130
    :missing-argument
131
    :error-item
132
    :error-items
133
    :error-reason
134
    :invalid-argument
135
    :unwind-protect-case
136
    :def-simple-error-reporter
137
    :std-warning
138
    :defwarning
139
    :def-simple-warning-reporter
140
    :def-warning-reporter
141
    :meta-condition
142
    :missing-method
143
    :missing-methods
144
    :conflicting-arguments
145
    :unknown-token
146
    :condition-handler
147
    :wrapped-condition
148
    :wrapped-condition-value
149
    :wrap-condition
150
    :wrapped-error
151
    :wrap-error))
152
 
153
 (defpkg :std/type
154
   (:use :cl)
155
   (:import-from :std/sym :format-symbol :with-gensyms)
156
   (:import-from :std/list :ensure-car)
157
   (:import-from :std/prim :definline)
158
   (:import-from :sb-impl :sfunction)
159
   (:import-from :sb-int :unsigned-byte*)
160
   (:import-from :sb-c :integer-type-length :ctype-of :ctype)
161
   (:import-from :sb-kernel :*type-classes* :type-class 
162
    :make-type-class :*type-cache-nonce* :type-class-name :type-class-id
163
    :classoid :type-id->type-class
164
    :type-hash-value :*ctype-hashsets*
165
    :find-classoid :classoid-of
166
    :ctype-of :ctype
167
    :layout-of)
168
   (:shadowing-import-from :sb-ext :word)
169
   (:export :+default-element-type+
170
    :type-class-of :unsigned-byte*
171
    :type-class-id :find-classoid
172
    :classoid :type-class-id-of
173
    :classoid-of :layout-of
174
    :type-id->type-class :type-hash-value
175
    :type-class-name-of :type-class-name
176
    :*type-cache-nonce* :make-type-class
177
    :*type-classes* :type-class
178
    :array-index :array-length
179
    #:negative-double-float :*ctype-hashsets*
180
    #:negative-fixnum-p
181
    #:negative-float
182
    #:negative-float-p
183
    #:negative-long-float
184
    #:negative-long-float-p
185
    #:negative-rational
186
    #:negative-rational-p
187
    #:negative-real
188
    #:negative-single-float-p
189
    #:non-negative-double-float
190
    #:non-negative-double-float-p
191
    #:non-negative-fixnum
192
    #:non-negative-fixnum-p
193
    #:non-negative-float
194
    #:non-negative-float-p
195
    #:non-negative-integer-p
196
    #:non-negative-long-float
197
    #:non-negative-rational
198
    #:non-negative-real-p
199
    #:non-negative-short-float-p
200
    #:non-negative-single-float
201
    #:non-negative-single-float-p
202
    #:non-positive-double-float
203
    #:non-positive-double-float-p
204
    #:non-positive-fixnum
205
    #:non-positive-fixnum-p
206
    #:non-positive-float
207
    #:non-positive-float-p
208
    #:non-positive-integer
209
    #:non-positive-rational
210
    #:non-positive-real
211
    #:non-positive-real-p
212
    #:non-positive-short-float
213
    #:non-positive-short-float-p
214
    #:non-positive-single-float-p
215
    #:positive-double-float
216
    #:positive-double-float-p
217
    #:positive-fixnum
218
    #:positive-fixnum-p
219
    #:positive-float
220
    #:positive-float-p
221
    #:positive-integer
222
    #:positive-rational
223
    #:positive-real
224
    #:positive-real-p
225
    #:positive-short-float
226
    #:positive-short-float-p
227
    #:positive-single-float
228
    #:positive-single-float-p
229
    #:negative-integer
230
    #:negative-double-float-p
231
    #:negative-fixnum
232
    #:negative-integer
233
    #:negative-integer-p
234
    #:negative-real-p
235
    #:negative-short-float
236
    #:negative-short-float-p
237
    #:negative-single-float
238
    #:non-negative-integer
239
    #:non-negative-long-float-p
240
    #:non-negative-rational-p
241
    #:non-negative-real
242
    #:non-negative-short-float
243
    #:non-positive-integer-p
244
    #:non-positive-long-float
245
    #:non-positive-long-float-p
246
    #:non-positive-rational-p
247
    #:non-positive-single-float
248
    #:integer-type-length
249
    #:coercef
250
    #:octet
251
    #:octet-vector
252
    #:octet-vector-p
253
    #:positive-integer-p
254
    #:positive-long-float
255
    #:positive-long-float-p
256
    #:positive-rational-p
257
    #:of-type
258
    #:type=
259
    #:word))
260
 
261
 (defpkg :std/string
262
   (:use :cl)
263
   (:use-reexport :sb-unicode)
264
   (:import-from :sb-impl :ef-octets-to-string-fun :ef-string-to-octets-fun)
265
   (:import-from :sb-kernel :character-coding-error :character-encoding-error :character-decoding-error)
266
   (:export
267
    :ef-octets-to-string-fun :ef-string-to-octets-fun
268
    :character-coding-error :character-encoding-error
269
    :character-decoding-error :*suppress-character-coding-errors*
270
    :*omit-nulls*
271
    :*whitespaces*
272
    :*tab-width*
273
    :string-designator
274
    :ssplit
275
    :remove-string
276
    :trim
277
    :collapse-whitespaces
278
    :make-template-parser
279
    :string-case
280
    :detabify
281
    :make-growable-string
282
    :nconcat
283
    :nconcatf
284
    :char-range
285
    :ascii-ichar=
286
    :ascii-istring=))
287
 
288
 (defpkg :std/num
289
   (:use :cl)
290
   (:import-from :sb-int :power-of-two-ceiling)
291
   (:import-from :std/string :*whitespaces*)
292
   (:export
293
    ;; num/parse
294
    :parse-number
295
    :parse-real-number
296
    :parse-positive-real-number
297
    :invalid-number
298
    :invalid-number-value
299
    :invalid-number-reason
300
    ;; num/float
301
    :make-float-converters
302
    :encode-float32
303
    :decode-float32
304
    :encode-float64
305
    :decode-float64
306
    ;; num/leb128
307
    :read-leb128
308
    :encode-leb128
309
    :decode-leb128
310
    :read-uleb128
311
    :encode-uleb128
312
    :decode-uleb128
313
    ;; num/math
314
    :power-of-two-ceiling
315
    :power-of-two-p
316
    :clamp
317
    :gaussian-random
318
    :iota
319
    :map-iota
320
    :%lerp
321
    :%mean
322
    :%median
323
    :variance
324
    :standard-deviation
325
    :maxf 
326
    :minf
327
    :factorial
328
    :binomial-coefficient
329
    :subfactorial
330
    :count-permutations))
331
 
332
 (defpkg :std/stream
333
   (:use :cl :sb-gray)
334
   (:import-from :std/type :non-negative-integer :positive-integer)
335
   (:import-from :std/sym :with-gensyms)
336
   (:import-from :std/prim :definline)
337
   (:export
338
    :read-lisp-until-end
339
    :read-until-end
340
    ;; stream
341
    :copy-stream
342
    :wrapped-stream :wrapped-stream-p
343
    :wrapped-character-input-stream
344
    :wrapped-character-output-stream
345
    :counting-character-input-stream
346
    :prefixed-character-output-stream
347
    :stream-of :char-count-of :line-count-of :col-count-of
348
    :prev-col-count-of :col-index-of :write-prefix
349
    :prefix-of
350
    :with-input-from-file :with-output-to-file))
351
 
352
 (defpkg :std/array
353
   (:use :cl)
354
   (:import-from :sb-ext :maybe-inline)
355
   (:import-from :std/prim :definline)
356
   (:import-from :sb-kernel :with-array-data :array-rank-limit)
357
   (:export :copy-array :signed-array-length :array-shift 
358
    :vector-push-extend-position :vector-pop-position
359
    :vectorify :make-array-allocator
360
    :vector-foldl :vector-foldr
361
    :vector-map-foldl :vector-map-foldr
362
    :vector-max :vector-min
363
    :vector-eq :with-array-data
364
    :vector-to-list :copy-vector-to-list
365
    :modproj :simplify-array :array-rank-limit))
366
 
367
 (defpkg :std/hash-table
368
   (:use :cl)
369
   (:nicknames :std/ht)
370
   (:recycle :sb-int)
371
   (:import-from :sb-int :ensure-gethash)
372
   (:import-from :std/prim :definline)
373
   (:shadowing-import-from :sb-lockless :endp)
374
   (:import-from :sb-lockless
375
    :make-so-map/fixnum :+hash-nbits+
376
    :node-hash :%node-next
377
    :get-next :node-hash
378
    :so-head :so-bins
379
    :so-key :so-data
380
    :so-count :so-key-node-p
381
    :so-insert :so-delete
382
    :so-find :so-find/string
383
    :so-maplist :make-so-map/string
384
    :make-so-set/string :make-so-set/fixnum :make-so-map/addr :make-marked-ref
385
    :make-so-set/addr :unbound-marker-p)
386
   (:export :hash-table-alist
387
    :maphash-keys :hash-table-keys
388
    :maphash-values :hash-table-values
389
    :alist-hash-table :plist-hash-table :hash-table-plist :ensure-gethash
390
    :pophash :*global-hasher*
391
    :*global-hash* :djb
392
    :hash-object :hash-object-address
393
    :dumb-string-hash :table))
394
 
395
 (defpkg :std/curry
396
   (:use :cl)
397
   (:import-from :std/sym :make-gensym-list)
398
   (:export
399
    :ensure-function
400
    :ensure-functionf
401
    :disjoin
402
    :conjoin
403
    :compose
404
    :multiple-value-compose
405
    :curry
406
    :rcurry
407
    :map-product))
408
 
409
 (defpkg :std/readtable
410
   (:use :cl)
411
   (:import-from :std/named-readtables :defreadtable)
412
   (:import-from :std/curry :curry :rcurry :compose)
413
   (:import-from :std/sym :symb)
414
   (:import-from :std/prim :defmacro!)
415
   (:export
416
    ;; readtable
417
    :|#"-reader|
418
    :|#`-reader|
419
    :|#f-reader|
420
    :|#$-reader|
421
    :|[-reader|
422
    :|{-reader|
423
    :|#l-reader|
424
    :segment-reader
425
    :match-mode-ppcre-lambda-form
426
    :subst-mode-ppcre-lambda-form
427
    :|#~-reader|
428
    :_))
429
 
430
 (defpkg :std/macs
431
   (:use :cl :std/prim)
432
   (:import-from :std/sym :symb :mkstr :make-gensym-list :with-gensyms :symbolicate :keywordicate)
433
   (:import-from :sb-int :make-macro-lambda :parse-lambda-list)
434
   (:import-from :std/curry :compose)
435
   (:import-from :std/named-readtables :in-readtable :parse-body)
436
   (:import-from :std/list :flatten :recursive-append :zip-tree :group)
437
   (:import-from :std/prim :defmacro! :defun! :defmacro/g! :g!-symbol-p :o1-symbol-to-g!-symbol)
438
   (:export
439
    :make-macro-lambda
440
    :parse-lambda-list
441
    :once-only
442
    :define-class
443
    :defclass*
444
    :dlet
445
    :named-lambda
446
    :nested-loop
447
    :dlambda
448
    :until
449
    :build-batcher-sn
450
    :sortf
451
    :dollar-symbol-p
452
    :if-match
453
    :when-match
454
    :destructuring-case
455
    :destructuring-ccase
456
    :destructuring-ecase
457
    :when-let
458
    :when-let*
459
    :if-let
460
    :if-let*
461
    :if*
462
    :define-constant
463
    :defvar-unbound
464
    :def!
465
    :eval-always
466
    :compile-and-eval
467
    :compile-and-eval*
468
    :compile-and-load
469
    ;; ana
470
    :awhen
471
    :acond
472
    :acase
473
    :alambda
474
    :nlet-tail
475
    :alet*
476
    :alet
477
    :acond2
478
    :aif
479
    :it
480
    :%a
481
    ;; pan
482
    :%p
483
    :pandoriclet
484
    :pandoriclet-get
485
    :pandoriclet-set
486
    :get-pandoric
487
    :with-pandoric
488
    ;; :pandoric-hotpatch
489
    :pandoric-recode
490
    :plambda
491
    :pandoric-eval
492
    :with-collectors
493
    :collecting
494
    :collect
495
    :switch
496
    :eswitch
497
    :cswitch
498
    :xor
499
    :ifret
500
    :letv*
501
    :lety
502
    :lety*
503
    :defunits :unit-of-distance 
504
    :distance-designator))
505
 
506
 (defpkg :std/sys
507
   (:use :cl :sb-int)
508
   (:import-from :sb-kernel :get-lisp-obj-address :with-pinned-objects 
509
    :unbound-marker-p :generation-of
510
    :current-sp :current-fp)
511
   (:import-from :std/prim :definline)
512
   (:import-from :sb-impl :*external-formats*)
513
   (:import-from :sb-vm :list-allocated-objects :fun-signature= 
514
    :map-allocated-objects :fset :*linkage-name-map* :ldb-monitor
515
    :map-immobile-objects :memory-usage :references-p :show-ctype-ctor-cache-metrics
516
    :n-lowtag-bits :lowtag-mask :lowtag-limit :n-fixnum-tag-bits
517
    :fixnum-tag-mask :n-fixnum-bits :word-shift :n-word-bytes
518
    :n-machine-word-bytes :n-widetag-bits :widetag-mask :most-positive-word
519
    :lowtag-of :widetag-of :hexdump :print-allocated-objects)
520
   (:import-from :sb-sys :int-sap)
521
   (:import-from :sb-fasl :*assembler-routines* :+fasl-file-version+ 
522
    :*fasl-file-type* :get-asm-routine :asm-routine-index-from-addr)
523
   (:use-reexport :sb-cltl2)
524
   (:recycle :sb-assem)
525
   (:import-from :sb-c :lexenv-user-data :lexenv-find 
526
    :make-null-lexenv :name-reserved-by-ansi-p :default-gc-strategy)
527
   (:import-from :sb-c :parse-eval-when-situations :source-location :*backend-byte-order*)
528
   (:recycle :sb-sys)
529
   (:import-from :sb-ext :maybe-inline :defglobal :define-load-time-global :finalize :cancel-finalization)
530
   (:import-from :std/sym :with-gensyms :search-roots)
531
   (:import-from :std/list :appendf)
532
   (:import-from :sb-loop :*loop-ansi-universe* :loop-standard-expansion)
533
   (:import-from :sb-assem :*backend-instruction-set-package*)
534
   (:import-from :sb-impl :*logical-hosts* :make-logical-host 
535
    :logical-host :info :show-info :*info-types*
536
    :*finalizer-thread* :show-finalizers :dx-flet :dx-let
537
    :read-only-space-obj-p :dynamic-space-obj-p :tune-image-for-dump :get-external-format)
538
   (:import-from :sb-debug :untrace-all :untrace-package)
539
   (:import-from :sb-ext :fold-identical-code)
540
   (:import-from :std/macs :if-let :defmacro! :eval-always)
541
   (:export
542
    :*external-formats*
543
    :get-external-format
544
    :revive-image
545
    :int-sap :print-allocated-objects
546
    :current-sp :current-fp
547
    :hexdump :hexdump-object
548
    :n-lowtag-bits :lowtag-mask :lowtag-limit :n-fixnum-tag-bits
549
    :fixnum-tag-mask :n-fixnum-bits :word-shift :n-word-bytes
550
    :n-machine-word-bytes :n-widetag-bits :widetag-mask :shake-packages
551
    :lowtag-of :widetag-of
552
    :most-positive-word
553
    :tune-image-for-dump
554
    :show-ctype-ctor-cache-metrics
555
    :memory-usage
556
    :references-p
557
    :untrace-all
558
    :defprinter
559
    :untrace-package
560
    :ldb-monitor
561
    :read-only-space-obj-p
562
    :dynamic-space-obj-p
563
    :*loops-ansi-universe*
564
    :loop-standard-expansion
565
    :asm-routine-index-from-addr
566
    :*assembler-routines*
567
    :+fasl-file-version+
568
    :*fasl-file-type*
569
    :get-asm-routine
570
    :fun-signature=
571
    :fset
572
    :*linkage-name-map*
573
    :map-immobile-objects
574
    :map-allocated-objects
575
    :fold-identical-code
576
    :*finalizer-thread*
577
    :show-finalizers
578
    :with-pinned-objects
579
    :finalize
580
    :cancel-finalization
581
    :get-lisp-obj-address
582
    :list-allocated-objects
583
    :generation-of
584
    :default-gc-strategy
585
    :name-reserved-by-ansi-p
586
    :*backend-byte-order*
587
    :.i ;; alias for *inspected*
588
    :info
589
    :maybe-inline
590
    :defglobal :define-load-time-global
591
    :register-project-directory
592
    :parse-eval-when-situations 
593
    :source-location
594
    :lexenv-user-data
595
    :lexenv-find
596
    :make-null-lexenv
597
    :revive-image
598
    :64-bit-p :32-bit-p
599
    :*logical-hosts*
600
    :save-shared-objects
601
    :make-logical-host
602
    :logical-host :info 
603
    :show-info :*info-types*
604
    :hooks
605
    :*default-arena-size*
606
    :current-lisp-implementation
607
    :current-machine
608
    :list-package-symbols
609
    :list-all-symbols
610
    :do-internal-symbols
611
    :package-symbols
612
    :package-symbol-names
613
    :define-logical-pathname
614
    :logical-host-names
615
    :save-lisp-tree-shake-and-die
616
    :forget-shared-object
617
    :forget-shared-objects
618
    :compile-lisp
619
    :without-fp-traps
620
    :little-endian-p
621
    :cpuid
622
    :cpu-vendor
623
    :get-real-time-seconds 
624
    :time-remaining 
625
    :with-countdown))
626
 
627
 (defpkg :std/bit
628
   (:use :cl)
629
   (:import-from :std/type :octet :octet-vector)
630
   (:mix :sb-sys)
631
   (:export
632
    :read-n-bytes
633
    :make-bits
634
    :sign-bit
635
    :different-signs-p
636
    :mortify-bits
637
    :int-list-bits
638
    :aref-bit
639
    :make-bit-vector
640
    :logbit
641
    :bitfield
642
    :bitfield-slot-name
643
    :bitfield-slot-start
644
    :bitfield-slot-end
645
    :bitfield-slot-size
646
    :bitfield-slot-initform
647
    :bitfield-slot-pack
648
    :bitfield-slot-unpack
649
    :parse-atomic-bitfield-slot-specifier
650
    :parse-compound-bitfield-slot-specifier
651
    :bitfield-slot
652
    :bitfield-boolean-slot
653
    :bitfield-integer-slot
654
    :bitfield-member-slot
655
    :define-bitfield
656
    :hex-string-to-octet-vector
657
    :octet-vector-to-hex-string
658
    :octets-to-integer
659
    :integer-to-octets
660
    :octets-to-integer-le
661
    :integer-to-octets-le
662
    :read-little-endian
663
    :write-little-endian
664
    :hexchar-to-int
665
    :make-octets
666
    :octets))
667
 
668
 (defpkg :std/comp
669
   (:use :cl)
670
   (:import-from :std/prim :definline)
671
   (:import-from :sb-c :deftransform :defoptimizer 
672
    :define-vop :parse-deftransform 
673
    :ctypecase :ctype-array-dimensions :ctypep :define-source-transform
674
    :inline-vop :immediate-constant-sc :boxed-immediate-sc-p :emit
675
    :assemble :without-scheduling :inst :inst* 
676
    :*emit-cfasl* :compile-component :describe-component :describe-ir2-component
677
    :make-file-source-info :make-lisp-source-info
678
    :def-ir1-translator :defknown)
679
   (:import-from :sb-c :vop)
680
   (:import-from :sb-c :*compilation-unit* :*backend-sc-numbers* 
681
    :*backend-sbs* :*backend-sc-names* :*backend-primitive-type-names* :*backend-primitive-type-aliases*
682
    :*backend-predicate-types* :*backend-type-predicates*
683
    :*compile-progress* :*compile-component-hook* :primitive-type :primitive-type-of
684
    :primitive-type-name)
685
   (:import-from :sb-vm :*register-arg-tns* :*primitive-objects*
686
    :primitive-object-name :primitive-object-lowtag :primitive-object-widetag)
687
   (:import-from :sb-ext :*compiler-print-variable-alist*)
688
   (:export :deftransform :*compiler-print-variable-alist* :parse-deftransform
689
    :defoptimizer :defknown :ctypecase :ctypep :ctype-array-dimensions :def-ir1-translator
690
    :*register-arg-tns* :immediate-constant-sc :boxed-immediate-sc-p :*backend-sc-numbers* 
691
    :*primitive-objects* :*compilation-unit* :define-vop :define-source-transform :inline-vop :vop*
692
    :*backend-sbs* :*backend-sc-names* :*backend-primitive-type-names* :*backend-primitive-type-aliases*
693
    :*backend-predicate-types* :*backend-type-predicates* :emit :assemble
694
    :without-scheduling :dump-symbolic-asm :inst :inst* :primitive-type :primitive-type-of
695
    :primitive-type-name :primitive-object-name :primitive-object-lowtag :primitive-object-widetag
696
    :*compile-progress* :*emit-cfasl* :compile-component :*compile-component-hook*
697
    :describe-component :describe-ir2-component :make-file-source-info :make-lisp-source-info
698
    :vop :primitive-type-name-of))
699
 
700
 (defpkg :std/serde
701
   (:use :cl)
702
   (:import-from :std/named-readtables :parse-body)
703
   (:import-from :std/prim :definline)
704
   (:import-from :std/condition :deferror)
705
   (:import-from :std/macs :when-let :eval-always :once-only)
706
   (:import-from :std/sym :symbolicate :with-gensyms)
707
   (:import-from :std/type :octet-vector :*type-classes* :type-class-name-of :type-class-name :type=)
708
   (:import-from :std/comp :*primitive-objects* :primitive-object-size 
709
    :widetag-of :lowtag-of :primitive-type-of :backend-primitive-type-name
710
    :*backend-primitive-type-names* :primitive-object-name :primitive-object-lowtag :primitive-object-widetag)
711
   (:export :define-io
712
    :*simple-objects* :*primitive-object-table* 
713
    :*core-object-table* :serde
714
    :prim-type :serializable-p 
715
    :deserializable-p :ser :de :serialize 
716
    :deserialize :serde-condition :serde-error :serializer-error :deserializer-error))
717
 
718
 (defpkg :std/alien
719
   (:use :cl :sb-alien)
720
   (:import-from :std/sym :symbolicate :with-gensyms)
721
   (:import-from :std/sys :little-endian-p :32-bit-p)
722
   (:import-from :std/bit :make-octets)
723
   (:import-from :std/type :octet-vector :octet)
724
   (:import-from :std/serde :define-io)
725
   (:import-from :sb-alien :sap+ :*linkage-info* :*shared-objects*)
726
   (:export
727
    :*linkage-info*
728
    :*shared-objects*
729
    :with-vector-sap
730
    :setfa
731
    :double-array-pointer
732
    :float-array-pointer
733
    :octet-vector-pointer
734
    :copy-c-string
735
    :clone-strings
736
    :clone-octet-vector-list
737
    :clone-integer-list
738
    :clone-octet-vector-list*
739
    :octets-to-alien-array
740
    :with-alien-slots
741
    :clone-octets-to-alien
742
    :octets-to-alien
743
    :clone-octets-from-alien
744
    :foreign-int-to-integer
745
    :foreign-int-to-bool
746
    :bool-to-foreign-int
747
    :define-alien-enum
748
    :define-opaque
749
    :shared-object-name
750
    :define-alien-loader
751
    :c-strings-to-string-list
752
    :list-all-shared-objects
753
    :read-alien-signed-byte-32 :read-alien-fixnum
754
    :read-alien-signed-byte-64 :read-alien-unsigned-byte-32
755
    :read-alien-unsigned-byte-64 :read-alien-single-float
756
    :read-alien-double-float :write-alien-signed-byte-32
757
    :write-alien-fixnum :write-alien-unsigned-byte-32
758
    :write-alien-signed-byte-64
759
    :write-alien-unsigned-byte-64 :write-alien-single-float
760
    :write-alien-double-float :offset-char-pointer
761
    :num-cpus
762
    :*cpus*
763
    :alien-or-lisp-octets
764
    :foreign-alloc
765
    :foreign-free
766
    :read-alien
767
    :write-alien
768
    :loff-t
769
    :pid-t
770
    :uid-t
771
    :gid-t
772
    :memset
773
    :memcpy
774
    :posix-memalign
775
    :timeval
776
    :timespec
777
    :sap
778
    :free
779
    :push-sap
780
    :push-sap*
781
    :pull-sap
782
    :pull-sap*
783
    :defar))
784
 
785
 (defpkg :std/meta
786
   (:use :cl :sb-pcl)
787
   (:use-reexport :sb-mop)
788
   (:import-from :std/sym :symb :make-keyword :with-gensyms)
789
   (:import-from :sb-ext :without-package-locks)
790
   (:import-from :std/macs :eval-always)
791
   (:import-from :std/prim :definline)
792
   (:shadow :reset)
793
   (:export :list-slot-values-using-class
794
    :list-class-methods :list-class-slots :ensure-finalized :subclassp :write-object :start 
795
    :stop :stopped-p :shutdown :reset
796
    :defaccessor :defaccessor* :defmethods :defclass!
797
    :data :name :tags :shallow-copy-object
798
    :exec :copy-object :safe-superclasses :run-object
799
    :slot-boundp* :slot-values
800
    :explore :with-fslots
801
    :upgrade :version
802
    :status :validate
803
    :lock :bind
804
    :started-p))
805
 
806
 (defpkg :std/seq
807
   (:use :cl)
808
   (:shadow :queue :make-queue :queue-count :queue-empty-p)
809
   (:import-from :sb-thread :with-mutex :make-mutex :condition-notify :make-waitqueue :condition-wait)
810
   (:import-from :std/macs :once-only)
811
   (:import-from :std/sym :with-gensyms)
812
   (:import-from :std/meta :data :defaccessor :lock)
813
   (:import-from :std/list :firstn)
814
   (:import-from :sb-int :collect)
815
   (:import-from :std/prim :definline)
816
   (:import-from :std/array :signed-array-length)
817
   (:import-from :std/sym :symbolicate)
818
   (:import-from :std/type :array-length :array-index)
819
   (:import-from :std/sys :get-internal-time-seconds :time-remaining :with-countdown)
820
   (:export :sequencep :take :starts-with-subseq 
821
    :take* :starts-with
822
    :ends-with-subseq :nth-value-or
823
    :split-sequence :split-sequence-if :split-sequence-if-not :starts-with-p
824
    :starts-with-one-of-p :copy-n
825
    :basic-queue :raw-queue-count :raw-queue :make-raw-queue
826
    :pop-raw-queue :peek-raw-queue :raw-queue-empty-p :raw-queue-full-p
827
    :raw-queue-capacity :cons-queue :push-cons-queue :raw-queue
828
    :pop-cons-queue :make-cons-queue :peek-cons-queue :cons-queue-empty-p
829
    :push-queue :push-queue* :pop-queue :pop-queue* :peek-queue :peek-queue*
830
    :queue-count :queue-count* :queue-empty-p :queue-empty-p* :queue-full-p :queue-full-p*
831
    :try-pop-queue :try-pop-queue* :call-with-queue-lock :with-queue-lock
832
    :queue :make-queue
833
    :priority-queue :vector-queue
834
    :*default-priority* :*default-priority-queue-size*
835
    :push-priority-queue :pop-priority-queue
836
    ;; spin queue
837
    :spin-queue :make-spin-queue :push-spin-queue :make-spin-lock
838
    :pop-spin-queue :peek-spin-queue :spin-queue-count :spin-queue-empty-p
839
    ;; accumulator
840
    :accumulated :accumulate :accumulator :max-accumulator :min-accumulator
841
    :counter :make-counter :counter-value :inc-counter 
842
    :dec-counter
843
    ;; iterator protocol
844
    :iterator :next
845
    :key :val
846
    :prev :iter
847
    :seek :seek-to-first
848
    :seek-to-last :seek-for-prev
849
    :iter-valid-p :*iter*
850
    :idx :with-iter
851
    :make-priority-queue))
852
 
853
 (defpkg :std/path
854
   (:use :cl)
855
   (:import-from :uiop :directory-files :subdirectories)
856
   (:export
857
    :directory-files
858
    :subdirectories
859
    :path
860
    :directory-wildcard
861
    :wild-pathname
862
    :file-pathname
863
    :non-wild-pathname
864
    :absolute-pathname
865
    :relative-pathname
866
    :directory-pathname
867
    :directory-empty-p
868
    :symlink-pathname
869
    :symlinkp
870
    :directory-path
871
    :directory-path-p
872
    :merge-homedir-pathnames
873
    :ensure-directory-truename
874
    :absolute-directory-pathname
875
    :+wildfile+ :+pathsep+ :set-pathname-suffix :*tmp-suffix*
876
    :tmpize-pathname
877
    :with-directory
878
    :call-with-directory
879
    :with-tmp
880
    :walk-directory))
881
 
882
 (defpkg :std/file
883
   (:use :cl)
884
   (:import-from :std/macs :define-constant :eval-always :once-only :when-let)
885
   (:import-from :std/condition :deferror)
886
   (:import-from :std/path :directory-path :directory-path-p)
887
   (:import-from :std/stream :copy-stream)
888
   (:import-from :std/type :octet :octet-vector :array-index :array-length :+default-element-type+)
889
   (:import-from :sb-ext :delete-directory :delete-file-error)
890
   (:import-from :uiop :delete-file-if-exists)
891
   (:export
892
    :delete-directory :delete-file-error
893
    :unknown-file-type
894
    :delete-file-if-exists
895
    :probe-delete-file
896
    :probe-delete-directory
897
    :delete-directories
898
    :read-file
899
    :tmpfile
900
    :dir
901
    :file
902
    :with-open-files
903
    :write-stream-into-file
904
    :write-file-into-stream
905
    :file=
906
    :file-size
907
    :file-size-in-octets
908
    :octet-vector=
909
    :file-date
910
    :file-timestamp
911
    :*hidden-paths*
912
    :hidden-path-p
913
    :find-files
914
    :count-file-lines
915
    :probe-merge-file
916
    :probe-directory
917
    :move-file))
918
 
919
 (defpkg :std/pipe
920
   (:use :cl :std/array)
921
   (:import-from :std/condition :required-argument :invalid-item :invalid-argument)
922
   (:import-from :std/sym :with-gensyms)
923
   (:import-from :std/type :octet)
924
   (:import-from :std/macs :when-let :eval-always :once-only)
925
   (:import-from :std/list :removef)
926
   (:import-from :std/file :file)
927
   (:export :sink :source :element 
928
    :pipe :msg :print-filter :switch-filter :predicate-filter :bin :predicate :filter
929
    :element-stream :value :index :resolve-element
930
    :find-element :find-parent-element :insert-element :withdraw-element
931
    :remove-element :set-element-id :move-element :message
932
    :event :buffer :bus :format-message
933
    :condition-message :message-condition
934
    :stream-sink :stream-source :file-sink :file-source
935
    :add-element :insert-element*
936
    :defpipe :make-pipe :simple-message :message-content
937
    :defpipe*))
938
 
939
 (defpkg :std/thread
940
   (:use :cl)
941
   (:shadowing-import-from :std/seq :queue-empty-p :queue :queue-count :make-queue)
942
   (:use :sb-thread :std/meta :std/macs :std/sym :std/type :std/condition :std/seq)
943
   (:import-from :std/pipe :index)
944
   (:import-from :sb-thread :*all-threads* :make-foreign-thread)
945
   (:import-from :std/list :flatten)
946
   (:import-from :std/prim :definline)
947
   (:import-from :std/prim :defmacro!)
948
   (:import-from :std/curry :ensure-function)
949
   (:import-from :std/macs :eval-always)
950
   (:use-reexport :sb-thread)
951
   (:import-from :std/macs :if-let :eval-always)
952
   (:import-from :std/list :deletef)
953
   (:export
954
    :*default-spint-count*
955
    :make-foreign-thread
956
    :*all-threads*
957
    :*worker-class*
958
    :*worker*
959
    :work
960
    :scheduler
961
    :kernel-function
962
    :defkernel
963
    :kernel-object
964
    :worker-kernel-function
965
    :pool-kernel-function
966
    :channel-kernel-function
967
    :*worker-kernel*
968
    :*pool-kernel*
969
    :*thread-pool*
970
    :*thread-pool-table*
971
    :worker-count*
972
    :worker-index*
973
    :find-work
974
    :do-workers
975
    :submit-work
976
    :receive-result
977
    :try-receive-result
978
    :shutdown-channel
979
    :broadcast-work
980
    :find-thread-pool
981
    :run-thread
982
    :thread-support-p
983
    :print-top-level :println-top-level
984
    :find-thread-by-id :thread-id-list
985
    :timed-join-thread :kill-thread
986
    :wait-for-threads :worker
987
    :wait-for-worker
988
    :hang :finish-threads
989
    :make-oracle
990
    :kill-worker
991
    :join-worker
992
    :start-worker
993
    :run-worker
994
    :with-default-special-bindings
995
    :worker-thread
996
    :*worker-restarts*
997
    :worker-count
998
    :worker-count*
999
    :worker-index
1000
    :worker-index*
1001
    :oracle 
1002
    :oracle-id :find-thread
1003
    :make-threads :with-threads 
1004
    :with-thread
1005
    :thread-count :dump-thread
1006
    :channel
1007
    :channel-pool
1008
    :channel-queue
1009
    :thread-pool :workers
1010
    :make-thread-pool :end-thread-pool
1011
    :make-worker :designate-oracle
1012
    :make-workers
1013
    :condition-wait*
1014
    :sync-message
1015
    :with-sync-message
1016
    :schedule
1017
    :+standard-io-bindings+
1018
    :*default-special-bindings*
1019
    :*kernel*
1020
    :kernel
1021
    :check-thread-pool :check-kernel
1022
    :*oracle-table*
1023
    :*worker-threads*
1024
    :*super-threads*
1025
    :compute-special-bindings))
1026
 
1027
 (defpkg :std/task
1028
   (:use :cl :std/thread :std/meta :std/seq)
1029
   (:import-from :std/thread :%make-thread)
1030
   (:import-from :std/type :positive-fixnum)
1031
   (:import-from :std/macs :if-let)
1032
   (:export
1033
    :push-worker
1034
    :task-schedule
1035
    :jobs
1036
    :tasks
1037
    :results
1038
    :kill-workers
1039
    :start-task-worker
1040
    :start-task-workers
1041
    :pop-worker
1042
    :*task-class*
1043
    :*task-priority*
1044
    :*tasks*
1045
    :*jobs*
1046
    :*stages*
1047
    :*task*
1048
    :*result*
1049
    :define-task-kernel
1050
    :task :job :task-pool :scheduled-task
1051
    :make-job :make-task-pool
1052
    :jobp :taskp :task :with-task-pool))
1053
 
1054
 (defpkg :std/async
1055
   (:use :cl :std/task :std/thread)
1056
   (:import-from :std/macs :with-gensyms :when-let)
1057
   (:export :future :promise :await 
1058
    :fulfill :fulfilledp :while-waiting-for))
1059
 
1060
 (defpkg :std/par
1061
   (:use :cl :std/task :std/thread :std/macs :std/sym)
1062
   (:export))
1063
 
1064
 (defpkg :std/rand
1065
   (:use :cl)
1066
   (:import-from :std/type :octet)
1067
   (:export
1068
    :random-elt
1069
    :random-ref
1070
    :random-char
1071
    :random-chars
1072
    :random-bytes
1073
    :random-booleans
1074
    :random-do))
1075
 
1076
 (defpkg :std/fmt
1077
   (:use :cl)
1078
   (:import-from :std/list :group :ensure-cons)
1079
   (:import-from :std/rand :random-booleans)
1080
   (:import-from :sb-ext :*print-circle-not-shared* :*suppress-print-errors*)
1081
   (:import-from :sb-impl :prin1-to-line)
1082
   (:shadowing-import-from :uiop :println)
1083
   (:export :printer-status :fmt-row :format-sxhash 
1084
    :iprintln :fmt-tree :println :human-readable-size 
1085
    :print-slots :format-slots :*print-slot-indent* :make-bitmap
1086
    :with-bitmap :set-pixel :outside-bounds :draw
1087
    :pattern-to-bitmap :draw-border :draw-circle :bullseye
1088
    :moire :draw-line :sunbeam :fill-bitmap 
1089
    :draw-filled-circle :sun :peace :with-comic-strip
1090
    :plot-function :print-table :print-heading :print-in-box
1091
    :print-boxed :smile :draw-one-in-chance :draw-chance))
1092
 
1093
 (defpkg :std/os
1094
   (:use :cl :sb-alien)
1095
   (:import-from :std/macs :with-gensyms :if-let)
1096
   (:import-from :std/file :probe-directory)
1097
   (:import-from :std/path :directory-path)
1098
   (:import-from :sb-posix :tcgetattr :tcsetattr 
1099
    :termios :termios-cc :termios-cflag :termios-iflag 
1100
    :termios-oflag :termios-lflag)
1101
   (:import-from :std/alien :defar)
1102
   (:export
1103
    :sudo-p
1104
    :user-info
1105
    :user-add
1106
    :group-add
1107
    :list-all-users
1108
    :list-all-groups
1109
    :with-umask
1110
    :with-fd
1111
    :cfmakeraw
1112
    :termios-iflag
1113
    :termios-oflag
1114
    :termios-lflag
1115
    :termios-cflag
1116
    :pathname-executable-p
1117
    :set-signal-handler
1118
    :open-pipe
1119
    :+tiocgwinsz+
1120
    :+tiocswinsz+
1121
    :+tiocnotty+
1122
    :+tcsanow+
1123
    :+tcsaflush+
1124
    :+tcsadrain+
1125
    :+opost+
1126
    :*user*
1127
    :*xdg-user-dirs*
1128
    :xdg-user-dir
1129
    :xdg-base-dir
1130
    :termios
1131
    :winsize
1132
    :isatty
1133
    :tcgetattr
1134
    :tcsetattr
1135
    :tcgetattr*
1136
    :tcsetattr*
1137
    :*xdg-base-dirs*
1138
    :init-xdg-user-dirs
1139
    :init-xdg-base-dirs
1140
    :relative-pathname-p
1141
    :absolute-pathname-p
1142
    :unmerge-pathnames
1143
    :current-directory
1144
    :with-directory-iterator
1145
    :file-kind
1146
    :merge-env-pathnames))
1147
 
1148
 (pkg:defpkg :std/defsys
1149
   (:use :cl)
1150
   (:nicknames :sys)
1151
   (:import-from :sb-impl :*requiring* :module-provide-contrib)
1152
   ;; (:shadowing-import-from :asdf :retry)
1153
   (:import-from :asdf :module-provide-asdf :compile-system :defsystem :load-system)
1154
   (:shadowing-import-from :std/meta :version)
1155
   (:export 
1156
    ;; re-exports from ASDF
1157
    ;; :defsystem
1158
    ;; :compile-system
1159
    ;; :load-system
1160
    :defsys
1161
    :find-system*
1162
    :defsystem*))
1163
 
1164
 (setq *defpkg-hook* nil)
1165
 
1166
 (defpkg :std
1167
   (:use :cl)
1168
   (:use-reexport :std/named-readtables :std/defpkg :std/condition
1169
    :std/sym :std/list :std/type :std/num 
1170
    :std/stream :std/curry :std/array :std/hash-table
1171
    :std/alien :std/meta :std/thread :std/task
1172
    :std/macs :std/bit :std/fmt :std/path
1173
    :std/os :std/file :std/string :std/sys 
1174
    :std/readtable :std/pipe :std/serde :std/rand 
1175
    :std/async :std/par :std/seq :std/prim
1176
    :std/comp :std/defsys))
1177
 
1178
 (define-lisp-package :std)
1179
 
1180
 (defpkg :std-user
1181
   (:use :std-lisp :sb-ext :sb-alien 
1182
    :sb-thread :sb-bsd-sockets :sb-gray :sb-mop 
1183
    :sb-debug :std/defsys)
1184
   (:shadowing-import-from :std/meta :reset)
1185
   (:shadowing-import-from :cl-user :path))
1186
 
1187
 (asdf:register-system-packages "STD" *std-packages*)
1188
 
1189
 (setq *default-package* "STD-USER")
1190
 
1191
 (eval-when (:load-toplevel) (pushnew :std *features*))