changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/lib/dat/pkg.lisp

changeset 664: 4d8451fe5423
parent: b88bf15f60d0
author: Richard Westhaver <ellis@rwest.io>
date: Sun, 22 Sep 2024 01:02:49 -0400
permissions: -rw-r--r--
description: moved web to lib/web, added dat/css
1 ;;; dat/pkg.lisp --- Data
2 
3 ;;; Code:
4 (defpackage :dat/proto
5  (:use :cl :std)
6  (:export :serialize :deserialize
7  :serializer-error :deserializer-error
8  :serde :serde-error :dat-error))
9 
10 (defpackage :dat/sxp
11  (:nicknames :sxp)
12  (:use :cl :sb-mop :std)
13  (:import-from :uiop :read-file-forms :slurp-stream-forms :with-output-file)
14  ;; TODO: hot-patch readtables into sxp classes/parsers
15  (:import-from :std/named-readtables :defreadtable :in-readtable)
16  (:export
17  :sxp-fmt-designator
18  :form :formp :sxp-error :sxp-syntax-error :reader :writer :fmt
19  :wrap :unwrap
20  :unwrap-or
21  :sxpp :build-ast :load-ast :load-ast*
22  :ast
23  :define-macro :define-fmt :read-sxp-file :write-sxp-file
24  :read-sxp-string :write-sxp-string :read-sxp-stream :write-sxp-stream
25  :make-sxp :sxp :formp :form
26  :file-read-forms
27  :wrap-object :unwrap-object))
28 
29 (defpackage :dat/dot
30  (:use :cl :std :dat/proto :obj/graph)
31  (:export
32  :read-dot-file :write-dot-file
33  :read-dot-stream :write-dot-stream
34  :parse-dot-string))
35 
36 (defpackage :dat/csv
37  (:use :cl :std :dat/proto :obj/query)
38  (:export
39  :read-csv-file
40  :*csv-separator*
41  #:read-csv-stream
42  :write-csv-file
43  :write-csv-stream
44  :read-csv-file-and-sort
45  :parse-csv-string
46  #:write-csv-string))
47 
48 (defpackage :dat/ini
49  (:use :cl :std :dat/proto)
50  (:export
51  :ini-encode
52  :ini-decode))
53 
54 (defpackage :dat/toml
55  (:use :cl :std :dat/proto :obj/time)
56  (:export
57  #:parse
58  #:parse-toml-blocks
59  #:toml-collection
60  #:children
61  #:toml-table
62  #:inline-toml-table
63  #:toml-table-array
64  #:toml-redefine-table-error
65  #:toml-redefine-property-error
66  #:toml-modify-inline-table-error
67  #:toml-dotted-key-redefine-table-error
68  #:toml-dotted-key-open-table-array-error))
69 
70 (defpackage :dat/arff
71  (:use :cl :std :dat/proto :dat/csv)
72  (:export
73  :arff :arff-relation :arff-attributes :arff-data :arff-path
74  :parse-arff :parse-arff-string :parse-arff-stream
75  :remove-attribute-by-name))
76 
77 (defpackage :dat/json
78  (:use :cl :std :dat/proto)
79  (:export
80  :*allow-json-trailing-commas*
81  :json-trailing-commas-p
82  #:json-decode
83  #:json-encode
84  #:json-read
85  #:json-enable-reader-macro
86  #:json-object
87  #:json-object-members
88  #:json-getf
89  #:json-setf))
90 
91 (defpackage :dat/base64
92  (:use :cl :std :dat/proto)
93  (:export #:base64-stream-to-integer
94  #:base64-stream-to-string
95  #:base64-stream-to-stream
96  #:base64-stream-to-usb8-array
97  #:base64-string-to-integer
98  #:base64-string-to-string
99  #:base64-string-to-stream
100  #:base64-string-to-usb8-array
101  #:string-to-base64-string
102  #:string-to-base64-stream
103  #:usb8-array-to-base64-string
104  #:usb8-array-to-base64-stream
105  #:stream-to-base64-string
106  #:stream-to-base64-stream
107  #:integer-to-base64-string
108  #:integer-to-base64-stream
109  ;; Conditions.
110  #:base64-error
111  #:bad-base64-character
112  #:incomplete-base64-data
113  ;; For creating custom encode/decode tables.
114  #:make-decode-table
115  #:+decode-table+
116  #:+uri-decode-table+))
117 
118 (defpackage :dat/css
119  (:use :cl :std :dat/proto)
120  (:export
121  :parse-css
122  :*minify-css*
123  :*css-indent-offset*
124  :parse-css-selector
125  :parse-css-fragment
126  :generate-css
127  :compile-css-selector
128  :compile-css
129  :compile-css-block))
130 
131 (defpackage :dat/html
132  (:use :cl :std :dat/proto)
133  (:import-from :sb-ext :defglobal)
134  (:export
135  :parse-html5
136  :parse-html5-fragment
137  :transform-html5-dom
138  :xml-escape-name
139  :xml-unescape-name
140  ;; A simple DOM
141  :make-document
142  :make-fragment
143  :make-doctype
144  :make-comment
145  :make-element
146  :make-text-node
147  :node-type
148  :node-name
149  :node-namespace
150  :node-value
151  :node-public-id
152  :node-system-id
153  :element-attribute
154  :node-append-child
155  :node-insert-before
156  :node-remove-child
157  :node-parent
158  :node-first-child
159  :node-last-child
160  :node-previous-sibling
161  :node-next-sibling
162  :element-map-attributes
163  :element-map-attributes*
164  :element-map-children))
165 
166 (defpackage :dat/xml
167  (:use :cl :std :dat/proto :log)
168  (:shadow :read-char :unread-char)
169  (:export
170  :xml-node-name
171  :xml-node-ns
172  :xml-node-attrs
173  :xml-node-children
174  :make-xml-node
175  :xml-parse
176  :to-xml
177  :write-xml
178  :xml-node-p
179  :xml-node ; needed to support use in typep
180  ;; processing instruction objects
181  :proc-inst-p
182  :proc-inst-target
183  :proc-inst-contents
184  :write-prologue
185  :write-prolog
186  ;; rpg utils
187  :make-xmlrep :xmlrep-add-child!
188  :xmlrep-tag :xmlrep-tagmatch
189  :xmlrep-attribs :xmlrep-children
190  :xmlrep-string-child :xmlrep-integer-child
191  :xmlrep-find-child-tags :xmlrep-find-child-tag
192  :xmlrep-attrib-value :xmlrep-boolean-attrib-value
193  ;; tree searching from Daniel Eliason
194  :extract-path-list
195  :extract-path))
196 
197 (defpackage :dat/handlebars
198  (:use :cl :std :dat/proto :dat/html)
199  (:export))
200 
201 (defpackage :dat/mime
202  (:use :cl :std :dat/proto :dat/xml)
203  (:export :*mime-database*
204  :load-mime-info :update-mime-database
205  :mime-magic :mime-magic-offset :mime-magic-type :mime-magic-value
206  :mime-type :mime-type-name :mime-type-superclasses :mime-type-glob
207  :mime-type-glob :mime-type-magic
208  :mime :get-mime :get-mime*))
209 
210 (defpackage :dat/bencode
211  (:use :cl :std :dat/proto :sb-gray)
212  (:export
213  :bencode-encode
214  :bencode-decode
215  :*bencode-binary-key-p*))
216 
217 (defpackage :dat/midi
218  (:nicknames :midi)
219  (:use :cl :std :dat/proto)
220  (:export #:read-midi-file #:write-midi-file
221  #:midifile
222  #:midifile-format #:midifile-tracks #:midifile-division
223  #:message #:note-off-message #:note-on-message #:tempo-message
224  #:program-change-message #:pitch-bend-message
225  #:key-signature-message #:time-signature-message
226  #:smpte-offset-message
227  #:sequence/track-name-message
228  #:message-channel #:message-key #:message-time
229  #:message-velocity #:message-numerator #:message-denominator
230  #:message-sf #:message-mi #:message-tempo #:message-program
231  #:message-value
232  #:header #:header-type
233  #:unknown-event #:status #:data-byte #:dd #:bb #:cc #:nn))
234 
235 (defpackage :dat/qrcode
236  (:nicknames :qrcode)
237  (:use :cl :std :dat/proto)
238  (:export
239  :encode-symbol
240  ;; QR code representation
241  ;; this should be enough to write another backend for QR symbol
242  :qr-symbol
243  :matrix
244  :modules
245  :dark-module-p
246  :read-file-content))
247 
248 (defpackage :dat/gif
249  (:nicknames :gif)
250  (:use :cl :std :dat/proto)
251  (:export))
252 
253 (defpackage :dat/png
254  (:use :cl :std :dat/proto #+png :png)
255  (:export))
256 
257 (defpackage :dat/tar
258  (:use :cl :std :dat/proto)
259  (:export))
260 
261 (defpackage :dat/parquet
262  (:use :cl :std :obj/id :dat/proto :dat/json)
263  (:export
264  :parquet-object
265  :parquet-enum-object
266  :parquet-struct-object
267  :parquet-read
268  :parquet-write
269  :parquet-encode
270  :parquet-decode))
271 
272 
273 (pkg:defpkg :dat
274  (:use-reexport :dat/proto :dat/csv :dat/arff
275  :dat/toml :dat/json :dat/sxp :dat/xml
276  :dat/bencode :dat/qrcode))