id
int64 0
45.1k
| file_name
stringlengths 4
68
| file_path
stringlengths 14
193
| content
stringlengths 32
9.62M
| size
int64 32
9.62M
| language
stringclasses 1
value | extension
stringclasses 6
values | total_lines
int64 1
136k
| avg_line_length
float64 3
903k
| max_line_length
int64 3
4.51M
| alphanum_fraction
float64 0
1
| repo_name
stringclasses 779
values | repo_stars
int64 0
882
| repo_forks
int64 0
108
| repo_open_issues
int64 0
90
| repo_license
stringclasses 8
values | repo_extraction_date
stringclasses 146
values | sha
stringlengths 64
64
| __index_level_0__
int64 0
45.1k
| exdup_ids_cmlisp_stkv2
sequencelengths 1
47
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1,520 | h5ex-d-hyper.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datasets/h5ex-d-hyper.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write data to a
;;; dataset by hyberslabs. The program first writes integers
;;; in a hyperslab selection to a dataset with dataspace
;;; dimensions of DIM0xDIM1, then closes the file. Next, it
;;; reopens the file, reads back the data, and outputs it to
;;; the screen. Finally it reads the data again using a
;;; different hyperslab selection, and outputs the result to
;;; the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5D/h5ex_d_hyper.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_d_hyper.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *DIM0* 6)
(defparameter *DIM1* 8)
(defun print-data (data)
(dotimes (i *DIM0*)
(format t " [")
(dotimes (j *DIM1*)
(format t " ~3d" (cffi:mem-aref data :int (h5ex:pos2D *DIM1* i j))))
(format t "]~%")))
(cffi:with-foreign-objects ((start 'hsize-t 2)
(stride 'hsize-t 2)
(count 'hsize-t 2)
(block 'hsize-t 2)
(wdata :int (* *DIM0* *DIM1*))
(rdata :int (* *DIM0* *DIM1*)))
;; Initialize data to "1", to make it easier to see the selections.
(dotimes (i *DIM0*)
(dotimes (j *DIM1*)
(setf (cffi:mem-aref wdata :int (h5ex:pos2D *DIM1* i j)) 1)))
;; Print the data to the screen.
(format t "Original Data:~%")
(print-data wdata)
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((space (h5ex:create-simple-dataspace `(,*DIM0* ,*DIM1*)))
(dset (h5dcreate2 file *DATASET* +H5T-STD-I32BE+ space
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+)))
;; Define and select the first part of the hyperslab selection.
(setf (cffi:mem-aref start 'hsize-t 0) 0
(cffi:mem-aref start 'hsize-t 1) 0
(cffi:mem-aref stride 'hsize-t 0) 3
(cffi:mem-aref stride 'hsize-t 1) 3
(cffi:mem-aref count 'hsize-t 0) 2
(cffi:mem-aref count 'hsize-t 1) 3
(cffi:mem-aref block 'hsize-t 0) 2
(cffi:mem-aref block 'hsize-t 1) 2)
(h5sselect-hyperslab space :H5S-SELECT-SET start stride count block)
;; Define and select the second part of the hyperslab selection,
;; which is subtracted from the first selection by the use of
;; H5S_SELECT_NOTB
(setf (cffi:mem-aref block 'hsize-t 0) 1
(cffi:mem-aref block 'hsize-t 1) 1)
(h5sselect-hyperslab space :H5S-SELECT-NOTB start stride count block)
;; Write the data to the dataset
(h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ space +H5P-DEFAULT+ wdata)
;; Close and release resources.
(h5ex:close-handles (list dset space)))
(h5ex:close-handles (list file fapl))))
;; Open file and dataset using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(space (h5dget-space dset)))
;; Read the data using the default properties
(h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
rdata)
;; Output the data to the screen.
(format t "~%Data as written to disk by hyberslabs:~%")
(print-data rdata)
;; Initialize the read array.
(dotimes (i *DIM0*)
(dotimes (j *DIM1*)
(setf (cffi:mem-aref rdata :int (h5ex:pos2D *DIM1* i j)) 0)))
;; Define and select the hyperslab to use for reading.
(setf (cffi:mem-aref start 'hsize-t 0) 0
(cffi:mem-aref start 'hsize-t 1) 1
(cffi:mem-aref stride 'hsize-t 0) 4
(cffi:mem-aref stride 'hsize-t 1) 4
(cffi:mem-aref count 'hsize-t 0) 2
(cffi:mem-aref count 'hsize-t 1) 2
(cffi:mem-aref block 'hsize-t 0) 2
(cffi:mem-aref block 'hsize-t 1) 3)
(h5sselect-hyperslab space :H5S-SELECT-SET start stride count block)
;; Read the data using the previously defined hyperslab.
(h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ space +H5P-DEFAULT+ rdata)
;; Output the data to the screen.
(format t "~%Data as read from disk by hyperslab:~%")
(print-data rdata)
(h5ex:close-handles (list space dset)))
(h5ex:close-handles (list file fapl)))))
| 4,758 | Common Lisp | .lisp | 104 | 41.105769 | 100 | 0.667675 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 48ba7b873ff15136a15842b570c3877258cb91249cf06f8191a2522639ba6f3b | 1,520 | [
-1
] |
1,521 | h5ex-d-fillval.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datasets/h5ex-d-fillval.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to set the fill value for a
;;; dataset. The program first sets the fill value to
;;; FILLVAL, creates a dataset with dimensions of DIM0xDIM1,
;;; reads from the uninitialized dataset, and outputs the
;;; contents to the screen. Next, it writes integers to the
;;; dataset, reads the data back, and outputs it to the
;;; screen. Finally it extends the dataset, reads from it,
;;; and outputs the result to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5D/h5ex_d_fillval.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_d_fillval.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *DIM0* 4)
(defparameter *DIM1* 7)
(defparameter *EDIM0* 6)
(defparameter *EDIM1* 10)
(defparameter *CHUNK0* 4)
(defparameter *CHUNK1* 4)
(defparameter *FILLVAL* 99)
(cffi:with-foreign-objects ((extdims 'hsize-t 2)
(chunk 'hsize-t 2)
(wdata :int (* *DIM0* *DIM1*))
(rdata :int (* *DIM0* *DIM1*))
(rdata2 :int (* *EDIM0* *EDIM1*))
(fillval :int 1))
;; initialize the data to be written
(dotimes (i *DIM0*)
(dotimes (j *DIM1*)
(setf (cffi:mem-aref wdata :int (h5ex:pos2D *DIM1* i j)) (- (* i j) j))))
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((space (h5ex:create-simple-dataspace `(,*DIM0* ,*DIM1*)
`(,+H5S-UNLIMITED+
,+H5S-UNLIMITED+)))
(dcpl (h5pcreate +H5P-DATASET-CREATE+))
;; Create the dataset using the dataset creation property
;; list.
(dset (progn
(setf (cffi:mem-aref chunk 'hsize-t 0) *CHUNK0*
(cffi:mem-aref chunk 'hsize-t 1) *CHUNK1*)
;; Set the chunk size
(h5pset-chunk dcpl 2 chunk)
(setf (cffi:mem-aref fillval :int 0) 99)
(h5pset-fill-value dcpl +H5T-NATIVE-INT+ fillval)
;; Set the allocation time to "early". This way we
;; can be sure that reading from the dataset immediately
;; after creation will return the fill value.
(h5pset-alloc-time dcpl :H5D-ALLOC-TIME-EARLY)
(h5dcreate2 file *DATASET* +H5T-STD-I32LE+ space
+H5P-DEFAULT+ dcpl +H5P-DEFAULT+))))
;; Read values from the dataset, which has not been written to yet.
(h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
rdata)
;; Output the data to the screen.
(format t "Dataset before being written to:~%")
(dotimes (i *DIM0*)
(format t " [")
(dotimes (j *DIM1*)
(format t " ~3d" (cffi:mem-aref rdata :int
(h5ex:pos2D *DIM1* i j))))
(format t "]~%"))
;; Write the data to the dataset
(h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
wdata)
;; Read the data back
(h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
rdata)
;; Output the data to the screen.
(format t "~%Dataset after being written:~%")
(dotimes (i *DIM0*)
(format t " [")
(dotimes (j *DIM1*)
(format t " ~3d" (cffi:mem-aref rdata :int
(h5ex:pos2D *DIM1* i j))))
(format t "]~%"))
;; Extend the dataset.
(setf (cffi:mem-aref extdims 'hsize-t 0) *EDIM0*
(cffi:mem-aref extdims 'hsize-t 1) *EDIM1*)
(h5dset-extent dset extdims)
;; Read from the extended dataset.
(h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
rdata2)
;; Output the data to the screen.
(format t "~%Dataset after extension:~%")
(dotimes (i *EDIM0*)
(format t " [")
(dotimes (j *EDIM1*)
(format t " ~3d" (cffi:mem-aref rdata2 :int
(h5ex:pos2D *EDIM1* i j))))
(format t "]~%"))
;; Close and release resources.
(h5ex:close-handles (list dset dcpl space)))
(h5ex:close-handles (list file fapl)))))
| 5,187 | Common Lisp | .lisp | 104 | 36.740385 | 102 | 0.534925 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 68415f415c7dd573af568ca584687bc4029e5168292db34d8ee64957949cdb15 | 1,521 | [
-1
] |
1,522 | h5ex-d-unlimadd.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datasets/h5ex-d-unlimadd.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to create and extend an unlimited
;;; dataset. The program first writes integers to a dataset
;;; with dataspace dimensions of DIM0xDIM1, then closes the
;;; file. Next, it reopens the file, reads back the data,
;;; outputs it to the screen, extends the dataset, and writes
;;; new data to the extended portions of the dataset. Finally
;;; it reopens the file again, reads back the data, and
;;; outputs it to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5D/h5ex_d_unlimadd.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_d_unlimadd.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *DIM0* 4)
(defparameter *DIM1* 7)
(defparameter *EDIM0* 6)
(defparameter *EDIM1* 10)
(defparameter *CHUNK0* 4)
(defparameter *CHUNK1* 4)
(defun print-data (data rows cols)
(dotimes (i rows)
(format t " [")
(dotimes (j cols)
(format t " ~3d" (cffi:mem-aref data :int (h5ex:pos2D cols i j))))
(format t "]~%")))
(cffi:with-foreign-objects ((dims 'hsize-t 2)
(extdims 'hsize-t 2)
(chunk 'hsize-t 2)
(start 'hsize-t 2)
(count 'hsize-t 2)
(wdata :int (* *DIM0* *DIM1*))
(wdata2 :int (* *EDIM0* *EDIM1*)))
;; initialize data
(dotimes (i *DIM0*)
(dotimes (j *DIM1*)
(setf (cffi:mem-aref wdata :int (h5ex:pos2D *DIM1* i j)) (- (* i j) j))))
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((space (h5ex:create-simple-dataspace `(,*DIM0* ,*DIM1*)
`(,+H5S-UNLIMITED+
,+H5S-UNLIMITED+)))
;; Create the dataset creation property list, and set the chunk
;; size.
(dcpl (let ((tmp (h5pcreate +H5P-DATASET-CREATE+)))
(setf (cffi:mem-aref chunk 'hsize-t 0) *CHUNK0*
(cffi:mem-aref chunk 'hsize-t 1) *CHUNK1*)
(h5pset-chunk tmp 2 chunk)
tmp))
;; Create the unlimited dataset.
(dset (h5dcreate2 file *DATASET* +H5T-STD-I32LE+ space
+H5P-DEFAULT+ dcpl +H5P-DEFAULT+)))
;; Write the data to the dataset.
(h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
wdata)
;; Close and release resources.
(h5ex:close-handles (list dcpl dset space)))
(h5ex:close-handles (list file fapl))))
;; In this next section we read back the data, extend the dataset,
;; and write new data to the extended portions.
;; Open file and dataset using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDWR+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(space (let ((tmp (h5dget-space dset)))
(h5sget-simple-extent-dims tmp dims +NULL+)
tmp))
(dims[0] (cffi:mem-aref dims 'hsize-t 0))
(dims[1] (cffi:mem-aref dims 'hsize-t 1)))
;; Allocate space for integer data.
(cffi:with-foreign-object (rdata :int (* dims[0] dims[1]))
;; Read the data using the default properties
(h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
rdata)
;; Output the data to the screen.
(format t "~%Dataset before extension:~%")
(print-data rdata dims[0] dims[1]))
(h5sclose space)
;; Extend the dataset.
(setf (cffi:mem-aref extdims 'hsize-t 0) *EDIM0*
(cffi:mem-aref extdims 'hsize-t 1) *EDIM1*)
(h5dset-extent dset extdims)
;; Retrieve the dataspace for the newly extended dataset.
(setq space (h5dget-space dset))
;; Initialize data for writing to the extended dataset.
(dotimes (i *EDIM0*)
(dotimes (j *EDIM1*)
(setf (cffi:mem-aref wdata2 :int (h5ex:pos2D *EDIM1* i j)) j)))
;; Select the entire dataspace.
(h5sselect-all space)
;; Subtract a hyperslab reflecting the original dimensions from the
;; selection. The selection now contains only the newly extended
;; portions of the dataset.
(setf (cffi:mem-aref start 'hsize-t 0) 0
(cffi:mem-aref start 'hsize-t 1) 0
(cffi:mem-aref count 'hsize-t 0)
(cffi:mem-aref dims 'hsize-t 0)
(cffi:mem-aref count 'hsize-t 1)
(cffi:mem-aref dims 'hsize-t 1))
(h5sselect-hyperslab space :H5S-SELECT-NOTB start +NULL+ count
+NULL+)
;; Write the data to the selected portion of the dataset.
(h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ space +H5P-DEFAULT+ wdata2)
;; Close and release resources.
(h5ex:close-handles (list space dset)))
(h5ex:close-handles (list file fapl))))
;; Now we simply read back the data and output it to the screen.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(space (let ((tmp (h5dget-space dset)))
(h5sget-simple-extent-dims tmp dims +NULL+)
tmp))
(dims[0] (cffi:mem-aref dims 'hsize-t 0))
(dims[1] (cffi:mem-aref dims 'hsize-t 1)))
;; Get dataspace and allocate memory for the read buffer as before.
(cffi:with-foreign-object (rdata :int (* dims[0] dims[1]))
;; Read the data using the default properties
(h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
rdata)
;; Output the data to the screen.
(format t "~%Dataset after extension:~%")
(print-data rdata *EDIM0* *EDIM1*))
;; Close and release resources.
(h5ex:close-handles (list space dset)))
(h5ex:close-handles (list file fapl)))))
| 6,417 | Common Lisp | .lisp | 140 | 39.328571 | 103 | 0.639179 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 83ccf8035f7b39c14187056fbe80954dfd82ea7b313282e0aa4e5c37e1d5c0f6 | 1,522 | [
-1
] |
1,523 | h5ex-d-chunk.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datasets/h5ex-d-chunk.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to create a chunked dataset. The
;;; program first writes integers in a hyperslab selection to
;;; a chunked dataset with dataspace dimensions of DIM0xDIM1
;;; and chunk size of CHUNK0xCHUNK1, then closes the file.
;;; Next, it reopens the file, reads back the data, and
;;; outputs it to the screen. Finally it reads the data again
;;; using a different hyperslab selection, and outputs
;;; the result to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5D/h5ex_d_chunk.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_d_chunk.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *DIM0* 6)
(defparameter *DIM1* 8)
(defparameter *CHUNK0* 4)
(defparameter *CHUNK1* 4)
(cffi:with-foreign-objects ((chunk 'hsize-t 2)
(start 'hsize-t 2)
(stride 'hsize-t 2)
(count 'hsize-t 2)
(block 'hsize-t 2)
(wdata :int (* *DIM0* *DIM1*))
(rdata :int (* *DIM0* *DIM1*)))
;; Initialize data to "1", to make it easier to see the selections.
(dotimes (i *DIM0*)
(dotimes (j *DIM1*)
(setf (cffi:mem-aref wdata :int (h5ex:pos2D *DIM1* i j)) 1)))
;; Print the data to the screen.
(format t "Original Data:~%")
(dotimes (i *DIM0*)
(format t " [")
(dotimes (j *DIM1*)
(format t " ~3d" (cffi:mem-aref wdata :int (h5ex:pos2D *DIM1* i j))))
(format t "]~%"))
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((space (h5ex:create-simple-dataspace `(,*DIM0* ,*DIM1*)))
(dcpl (h5pcreate +H5P-DATASET-CREATE+))
;; Create the dataset using the dataset creation property
;; list.
(dset (progn
;; Create the dataset creation property list, and
;; set the chunk size.
(setf (cffi:mem-aref chunk 'hsize-t 0) *CHUNK0*
(cffi:mem-aref chunk 'hsize-t 1) *CHUNK1*)
(h5pset-chunk dcpl 2 chunk)
;; Create the chunked dataset.
(h5dcreate2 file *DATASET* +H5T-STD-I32LE+ space
+H5P-DEFAULT+ dcpl +H5P-DEFAULT+))))
;; Define and select the first part of the hyperslab selection.
(setf (cffi:mem-aref start 'hsize-t 0) 0
(cffi:mem-aref start 'hsize-t 1) 0
(cffi:mem-aref stride 'hsize-t 0) 3
(cffi:mem-aref stride 'hsize-t 1) 3
(cffi:mem-aref count 'hsize-t 0) 2
(cffi:mem-aref count 'hsize-t 1) 3
(cffi:mem-aref block 'hsize-t 0) 2
(cffi:mem-aref block 'hsize-t 1) 2)
(h5sselect-hyperslab space :H5S-SELECT-SET start stride count block)
;; Define and select the second part of the hyperslab selection,
;; which is subtracted from the first selection by the use of
;; H5S_SELECT_NOTB
(setf (cffi:mem-aref block 'hsize-t 0) 1
(cffi:mem-aref block 'hsize-t 1) 1)
(h5sselect-hyperslab space :H5S-SELECT-NOTB start stride count block)
;; Write the data to the dataset.
(h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ space +H5P-DEFAULT+
wdata)
;; Close and release resources.
(h5ex:close-handles (list dset dcpl space)))
(h5ex:close-handles (list file fapl))))
;; Now we begin the read section of this example.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(dcpl (h5dget-create-plist dset))
(layout (h5pget-layout dcpl))
(space (h5dget-space dset)))
(format t "~%Storage layout for ~a is: " *DATASET*)
;; Retrieve the dataset creation property list, and print the
;; storage layout.
(cond ((eql layout :H5D-COMPACT) (format t "H5D_COMPACT~%"))
((eql layout :H5D-CONTIGUOUS) (format t "H5D_CONTIGUOUS~%"))
((eql layout :H5D-CHUNKED) (format t "H5D_CHUNKED~%")))
;;Read the data using the default properties.
(h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
rdata)
;; Output the data to the screen.
(format t "~%Data as written to disk by hyberslabs:~%")
(dotimes (i *DIM0*)
(format t " [")
(dotimes (j *DIM1*)
(format t " ~3d" (cffi:mem-aref rdata :int
(h5ex:pos2D *DIM1* i j))))
(format t "]~%"))
;; Initialize the read array.
(dotimes (i *DIM0*)
(dotimes (j *DIM1*)
(setf (cffi:mem-aref rdata :int (h5ex:pos2D *DIM1* i j)) 0)))
;; Define and select the hyperslab to use for reading.
(setf (cffi:mem-aref start 'hsize-t 0) 0
(cffi:mem-aref start 'hsize-t 1) 1
(cffi:mem-aref stride 'hsize-t 0) 4
(cffi:mem-aref stride 'hsize-t 1) 4
(cffi:mem-aref count 'hsize-t 0) 2
(cffi:mem-aref count 'hsize-t 1) 2
(cffi:mem-aref block 'hsize-t 0) 2
(cffi:mem-aref block 'hsize-t 1) 3)
(h5sselect-hyperslab space :H5S-SELECT-SET start stride count block)
;; Read the data using the previously defined hyperslab.
(h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ space +H5P-DEFAULT+
rdata)
;; Output the data to the screen.
(format t "~%Data as read from disk by hyperslab:~%")
(dotimes (i *DIM0*)
(format t " [")
(dotimes (j *DIM1*)
(format t " ~3d" (cffi:mem-aref rdata :int
(h5ex:pos2D *DIM1* i j))))
(format t "]~%"))
;; Close and release resources.
(h5ex:close-handles (list space dcpl dset)))
(h5ex:close-handles (list file fapl)))))
| 6,266 | Common Lisp | .lisp | 137 | 38.905109 | 100 | 0.626474 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | bb4461f2368ce5c0aa1d69f26627ade3c18d386075b35cc6b6a98e3ee69dc7b0 | 1,523 | [
-1
] |
1,524 | h5ex-d-gzip.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datasets/h5ex-d-gzip.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write data to a dataset
;;; using gzip compression (also called zlib or deflate). The
;;; program first checks if gzip compression is available,
;;; then if it is it writes integers to a dataset using gzip,
;;; then closes the file. Next, it reopens the file, reads
;;; back the data, and outputs the type of compression and the
;;; maximum value in the dataset to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5D/h5ex_d_gzip.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_d_gzip.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *DIM0* 32)
(defparameter *DIM1* 64)
(defparameter *CHUNK0* 4)
(defparameter *CHUNK1* 8)
(cffi:with-foreign-objects ((chunk 'hsize-t 2)
(filter-info :unsigned-int 1)
(flags :unsigned-int 1)
(nelmts 'size-t 1)
(wdata :int (* *DIM0* *DIM1*))
(rdata :int (* *DIM0* *DIM1*)))
(setf (cffi:mem-aref nelmts 'size-t 0) 0)
;; Check if gzip compression is available and can be used for both
;; compression and decompression. Normally we do not perform error
;; checking in these examples for the sake of clarity, but in this
;; case we will make an exception because this filter is an
;; optional part of the hdf5 library.
(if (< (h5zfilter-avail +H5Z-FILTER-DEFLATE+) 1)
(error "gzip filter not available."))
(h5zget-filter-info +H5Z-FILTER-DEFLATE+ filter-info)
(if (or (eql 0 (logand (cffi:mem-ref filter-info :unsigned-int)
+H5Z-FILTER-CONFIG-ENCODE-ENABLED+))
(eql 0 (logand (cffi:mem-ref filter-info :unsigned-int)
+H5Z-FILTER-CONFIG-DECODE-ENABLED+)))
(error "gzip filter not available for encoding and decoding."))
;; Initialize data.
(dotimes (i *DIM0*)
(dotimes (j *DIM1*)
(setf (cffi:mem-aref wdata :int (h5ex:pos2D *DIM1* i j)) (- (* i j) j))))
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((space (h5ex:create-simple-dataspace `(,*DIM0* ,*DIM1*)))
(dcpl (h5pcreate +H5P-DATASET-CREATE+))
;; Create the dataset using the dataset creation property
;; list.
(dset (progn
;; Create the dataset creation property list, add the
;; compression filter and set the chunk size.
(h5pset-deflate dcpl 9)
(setf (cffi:mem-aref chunk 'hsize-t 0) *CHUNK0*
(cffi:mem-aref chunk 'hsize-t 1) *CHUNK1*)
(h5pset-chunk dcpl 2 chunk)
;; Create the chunked dataset.
(h5dcreate2 file *DATASET* +H5T-STD-I32LE+ space
+H5P-DEFAULT+ dcpl +H5P-DEFAULT+))))
;; Write the data to the dataset.
(h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ space +H5P-DEFAULT+ wdata)
;; Close and release resources.
(h5ex:close-handles (list dset dcpl space)))
(h5ex:close-handles (list file fapl))))
;; Now we begin the read section of this example.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(dcpl (h5dget-create-plist dset))
;; Retrieve and print the filter type. Here we only retrieve
;; the first filter because we know that we only added one
;; filter.
(filter-type (prog2 (setf (cffi:mem-aref nelmts 'size-t 0) 0)
(h5pget-filter2 dcpl 0 flags nelmts +NULL+
0 +NULL+ filter-info))))
(format t "Filter type is: ")
(cond ((eql filter-type +H5Z-FILTER-DEFLATE+)
(format t "H5Z_FILTER_DEFLATE~%"))
((eql filter-type +H5Z-FILTER-SHUFFLE+)
(format t "H5Z_FILTER_SHUFFLE~%"))
((eql filter-type +H5Z-FILTER-FLETCHER32+)
(format t "H5Z_FILTER_FLETCHER32~%"))
((eql filter-type +H5Z-FILTER-SZIP+)
(format t "H5Z_FILTER_SZIP~%"))
((eql filter-type +H5Z-FILTER-NBIT+)
(format t "H5Z_FILTER_NBIT~%"))
((eql filter-type +H5Z-FILTER-SCALEOFFSET+)
(format t "H5Z_FILTER_SCALEOFFSET~%")))
;; Read the data using the default properties.
(h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
rdata)
;; Find the maximum value in the dataset, to verify that it was
;; read correctly.
(format t "Maximum value in ~a is: ~a~%" *DATASET*
(reduce #'max
(mapcar #'(lambda (i) (cffi:mem-aref rdata :int i))
(loop for i from 0 to (1- (* *DIM0* *DIM1*))
collect i))))
;; Close and release resources.
(h5ex:close-handles (list dcpl dset)))
(h5ex:close-handles (list file fapl)))))
| 5,470 | Common Lisp | .lisp | 111 | 41.918919 | 99 | 0.63437 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 47af89abcaefb124ce7be42be88ec72b9b3b8b3ab163529c16f141bcc2bb5a36 | 1,524 | [
-1
] |
1,525 | h5ex-d-szip.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datasets/h5ex-d-szip.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write data to a dataset
;;; using szip compression. The program first checks if
;;; szip compression is available, then if it is it writes
;;; integers to a dataset using szip, then closes the file.
;;; Next, it reopens the file, reads back the data, and
;;; outputs the type of compression and the maximum value in
;;; the dataset to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5D/h5ex_d_szip.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_d_szip.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *DIM0* 32)
(defparameter *DIM1* 64)
(defparameter *CHUNK0* 4)
(defparameter *CHUNK1* 8)
(cffi:with-foreign-objects ((chunk 'hsize-t 2)
(filter-info :unsigned-int 1)
(flags :unsigned-int 1)
(nelmts 'size-t 1)
(wdata :int (* *DIM0* *DIM1*))
(rdata :int (* *DIM0* *DIM1*)))
(setf (cffi:mem-aref nelmts 'size-t 0) 0)
;; Check if szip compression is available and can be used for both
;; compression and decompression. Normally we do not perform error
;; checking in these examples for the sake of clarity, but in this
;; case we will make an exception because this filter is an
;; optional part of the hdf5 library.
(if (< (h5zfilter-avail +H5Z-FILTER-SZIP+) 1)
(error "szip filter not available."))
(h5zget-filter-info +H5Z-FILTER-SZIP+ filter-info)
(if (or (eql 0 (logand (cffi:mem-ref filter-info :unsigned-int)
+H5Z-FILTER-CONFIG-ENCODE-ENABLED+))
(eql 0 (logand (cffi:mem-ref filter-info :unsigned-int)
+H5Z-FILTER-CONFIG-DECODE-ENABLED+)))
(error "szip filter not available for encoding and decoding."))
;; Initialize data.
(dotimes (i *DIM0*)
(dotimes (j *DIM1*)
(setf (cffi:mem-aref wdata :int (h5ex:pos2D *DIM1* i j)) (- (* i j) j))))
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((space (h5ex:create-simple-dataspace `(,*DIM0* ,*DIM1*)))
(dcpl (h5pcreate +H5P-DATASET-CREATE+))
;; Create the dataset using the dataset creation property
;; list.
(dset (progn
;; Create the dataset creation property list, add the
;; Scale-Offset filter and set the chunk size.
(h5pset-szip dcpl +H5-SZIP-NN-OPTION-MASK+ 8)
(setf (cffi:mem-aref chunk 'hsize-t 0) *CHUNK0*
(cffi:mem-aref chunk 'hsize-t 1) *CHUNK1*)
(h5pset-chunk dcpl 2 chunk)
;; Create the chunked dataset.
(h5dcreate2 file *DATASET* +H5T-STD-I32LE+ space
+H5P-DEFAULT+ dcpl +H5P-DEFAULT+))))
;; Write the data to the dataset.
(h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ space +H5P-DEFAULT+ wdata)
;; Close and release resources.
(h5ex:close-handles (list dset dcpl space)))
(h5ex:close-handles (list file fapl))))
;; Now we begin the read section of this example.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(dcpl (h5dget-create-plist dset))
;; Retrieve and print the filter type. Here we only retrieve
;; the first filter because we know that we only added one
;; filter.
(filter-type (prog2 (setf (cffi:mem-ref nelmts 'size-t) 0)
(h5pget-filter2 dcpl 0 flags nelmts +NULL+
0 +NULL+ filter-info))))
(format t "Filter type is: ")
(cond ((eql filter-type +H5Z-FILTER-DEFLATE+)
(format t "H5Z_FILTER_DEFLATE~%"))
((eql filter-type +H5Z-FILTER-SHUFFLE+)
(format t "H5Z_FILTER_SHUFFLE~%"))
((eql filter-type +H5Z-FILTER-FLETCHER32+)
(format t "H5Z_FILTER_FLETCHER32~%"))
((eql filter-type +H5Z-FILTER-SZIP+)
(format t "H5Z_FILTER_SZIP~%"))
((eql filter-type +H5Z-FILTER-NBIT+)
(format t "H5Z_FILTER_NBIT~%"))
((eql filter-type +H5Z-FILTER-SCALEOFFSET+)
(format t "H5Z_FILTER_SCALEOFFSET~%")))
;; Read the data using the default properties.
(h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
rdata)
;; Find the maximum value in the dataset, to verify that it was
;; read correctly.
(format t "Maximum value in ~a is: ~a~%" *DATASET*
(reduce #'max
(mapcar #'(lambda (i) (cffi:mem-aref rdata :int i))
(loop for i from 0 to (1- (* *DIM0* *DIM1*))
collect i))))
;; Close and release resources.
(h5ex:close-handles (list dcpl dset)))
(h5ex:close-handles (list file fapl)))))
| 5,455 | Common Lisp | .lisp | 111 | 41.783784 | 99 | 0.633152 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 9334d7877199f7e76855f212f009206fd42e03bb50dcb6fa1aef9794820998e4 | 1,525 | [
-1
] |
1,526 | h5ex-d-soint.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datasets/h5ex-d-soint.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write data to a dataset
;;; using the Scale-Offset filter. The program first checks
;;; if the Scale-Offset filter is available, then if it is it
;;; writes integers to a dataset using Scale-Offset, then
;;; closes the file Next, it reopens the file, reads back the
;;; data, and outputs the type of filter and the maximum value
;;; in the dataset to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5D/h5ex_d_soint.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_d_soint.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *DIM0* 32)
(defparameter *DIM1* 64)
(defparameter *CHUNK0* 4)
(defparameter *CHUNK1* 8)
(cffi:with-foreign-objects ((chunk 'hsize-t 2)
(filter-info :unsigned-int 1)
(flags :unsigned-int 1)
(nelmts 'size-t 1)
(wdata :int (* *DIM0* *DIM1*))
(rdata :int (* *DIM0* *DIM1*)))
(setf (cffi:mem-aref nelmts 'size-t 0) 0)
;; Check if Scale-Offset compression is available and can be used for both
;; compression and decompression. Normally we do not perform error
;; checking in these examples for the sake of clarity, but in this
;; case we will make an exception because this filter is an
;; optional part of the hdf5 library.
(if (< (h5zfilter-avail +H5Z-FILTER-SCALEOFFSET+) 1)
(error "Scale-Offset filter not available."))
(h5zget-filter-info +H5Z-FILTER-SCALEOFFSET+ filter-info)
(if (or (eql 0 (logand (cffi:mem-ref filter-info :unsigned-int)
+H5Z-FILTER-CONFIG-ENCODE-ENABLED+))
(eql 0 (logand (cffi:mem-ref filter-info :unsigned-int)
+H5Z-FILTER-CONFIG-DECODE-ENABLED+)))
(error "Scale-Offset filter not available for encoding and decoding."))
;; Initialize data.
(dotimes (i *DIM0*)
(dotimes (j *DIM1*)
(setf (cffi:mem-aref wdata :int (h5ex:pos2D *DIM1* i j)) (- (* i j) j))))
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2
(h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((space (h5ex:create-simple-dataspace `(,*DIM0* ,*DIM1*)))
(dcpl (h5pcreate +H5P-DATASET-CREATE+))
;; Create the dataset using the dataset creation property
;; list.
(dset (progn
;; Create the dataset creation property list, add the
;; Scale-Offset filter and set the chunk size.
(h5pset-scaleoffset dcpl :H5Z-SO-INT
+H5Z-SO-INT-MINBITS-DEFAULT+)
(setf (cffi:mem-aref chunk 'hsize-t 0) *CHUNK0*
(cffi:mem-aref chunk 'hsize-t 1) *CHUNK1*)
(h5pset-chunk dcpl 2 chunk)
;; Create the chunked dataset.
(h5dcreate2 file *DATASET* +H5T-STD-I32LE+ space
+H5P-DEFAULT+ dcpl +H5P-DEFAULT+))))
;; Write the data to the dataset.
(h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ space +H5P-DEFAULT+ wdata)
;; Close and release resources.
(h5ex:close-handles (list dset dcpl space)))
(h5ex:close-handles (list file fapl))))
;; Now we begin the read section of this example.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(dcpl (h5dget-create-plist dset))
;; Retrieve and print the filter type. Here we only retrieve
;; the first filter because we know that we only added one
;; filter.
(filter-type (h5pget-filter2 dcpl 0 flags nelmts +NULL+
0 +NULL+ filter-info)))
(format t "Filter type is: ")
(cond ((eql filter-type +H5Z-FILTER-DEFLATE+)
(format t "H5Z_FILTER_DEFLATE~%"))
((eql filter-type +H5Z-FILTER-SHUFFLE+)
(format t "H5Z_FILTER_SHUFFLE~%"))
((eql filter-type +H5Z-FILTER-FLETCHER32+)
(format t "H5Z_FILTER_FLETCHER32~%"))
((eql filter-type +H5Z-FILTER-SZIP+)
(format t "H5Z_FILTER_SZIP~%"))
((eql filter-type +H5Z-FILTER-NBIT+)
(format t "H5Z_FILTER_NBIT~%"))
((eql filter-type +H5Z-FILTER-SCALEOFFSET+)
(format t "H5Z_FILTER_SCALEOFFSET~%")))
;; Read the data using the default properties.
(h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
rdata)
;; Find the maximum value in the dataset, to verify that it was
;; read correctly.
(format t "Maximum value in ~a is: ~a~%" *DATASET*
(reduce #'max
(mapcar #'(lambda (i) (cffi:mem-aref rdata :int i))
(loop for i from 0 to (1- (* *DIM0* *DIM1*))
collect i))))
;; Close and release resources.
(h5ex:close-handles (list dcpl dset)))
(h5ex:close-handles (list file fapl)))))
| 5,531 | Common Lisp | .lisp | 112 | 41.651786 | 100 | 0.63114 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 5efaf16d161b5e355bf06ada33214591d3b1b29b996e1f2aeffb1692efb8e8f8 | 1,526 | [
-1
] |
1,527 | h5ex-d-compact.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datasets/h5ex-d-compact.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write data to a compact
;;; dataset. The program first writes integers to a compact
;;; dataset with dataspace dimensions of DIM0xDIM1, then
;;; closes the file. Next, it reopens the file, reads back
;;; the data, and outputs it to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5D/h5ex_d_compact.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_d_compact.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *DIM0* 4)
(defparameter *DIM1* 7)
(cffi:with-foreign-objects ((wdata :int (* *DIM0* *DIM1*))
(rdata :int (* *DIM0* *DIM1*)))
;; initialize data
(dotimes (i *DIM0*)
(dotimes (j *DIM1*)
(setf (cffi:mem-aref wdata :int (h5ex:pos2D *DIM1* i j)) (- (* i j) j))))
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((space (h5ex:create-simple-dataspace `(,*DIM0* ,*DIM1*)))
(dcpl (h5pcreate +H5P-DATASET-CREATE+))
;; Create the dataset using the dataset creation property
;; list.
(dset (progn
;; Create the dataset creation property list, set the
;; layout to compact.
(h5pset-layout dcpl :H5D-COMPACT)
;; Create the dataset. We will use all default
;; properties for this example.
(h5dcreate2 file *DATASET* +H5T-STD-I32LE+ space
+H5P-DEFAULT+ dcpl +H5P-DEFAULT+))))
;; Write the data to the dataset.
(h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
wdata)
;; Close and release resources.
(h5ex:close-handles (list dset dcpl space)))
(h5ex:close-handles (list file fapl))))
;; Now we begin the read section of this example.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(dcpl (h5dget-create-plist dset))
(layout (h5pget-layout dcpl)))
(format t "Storage layout for ~a is: " *DATASET*)
;; Retrieve the dataset creation property list, and print the
;; storage layout.
(cond ((eql layout :H5D-COMPACT) (format t "H5D_COMPACT~%"))
((eql layout :H5D-CONTIGUOUS) (format t "H5D_CONTIGUOUS~%"))
((eql layout :H5D-CHUNKED) (format t "H5D_CHUNKED~%")))
;;Read the data using the default properties.
(h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
rdata)
;; Output the data to the screen.
(format t "~a:~%" *DATASET*)
(dotimes (i *DIM0*)
(format t " [")
(dotimes (j *DIM1*)
(format t " ~3d" (cffi:mem-aref rdata :int
(h5ex:pos2D *DIM1* i j))))
(format t "]~%"))
;; Close and release resources.
(h5ex:close-handles (list dcpl dset)))
(h5ex:close-handles (list file fapl)))))
| 3,628 | Common Lisp | .lisp | 76 | 40.5 | 102 | 0.623197 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | fa125b91948c624b5f2ab7fe5a4f19191af59dc3af56dba8ae96a2501729b676 | 1,527 | [
-1
] |
1,528 | h5ex-d-transform.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datasets/h5ex-d-transform.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write data to a dataset
;;; using a data transform expression. The program first
;;; writes integers to a dataset using the transform
;;; expression TRANSFORM, then closes the file. Next, it
;;; reopens the file, reads back the data without a transform,
;;; and outputs the data to the screen. Finally it reads the
;;; data using the transform expression RTRANSFORM and outputs
;;; the results to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5D/h5ex_d_transform.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_d_transform.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *DIM0* 4)
(defparameter *DIM1* 7)
(defparameter *TRANSFORM* (cffi:foreign-string-alloc "x+1"))
(defparameter *RTRANSFORM* (cffi:foreign-string-alloc "x-1"))
(defun print-data (data)
(dotimes (i *DIM0*)
(format t " [")
(dotimes (j *DIM1*)
(format t " ~3d" (cffi:mem-aref data :int (h5ex:pos2D *DIM1* i j))))
(format t "]~%")))
(cffi:with-foreign-objects ((wdata :int (* *DIM0* *DIM1*))
(rdata :int (* *DIM0* *DIM1*)))
;; initialize data
(dotimes (i *DIM0*)
(dotimes (j *DIM1*)
(setf (cffi:mem-aref wdata :int (h5ex:pos2D *DIM1* i j)) (- (* i j) j))))
;; Output the data to the screen.
(format t "Original Data:~%")
(print-data wdata)
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((space (h5ex:create-simple-dataspace `(,*DIM0* ,*DIM1*)))
;; Create the dataset transfer property list
(dxpl (h5pcreate +H5P-DATASET-XFER+))
;; Create the dataset using the default properties.
;; Unfortunately we must save as a native type or the
;; transform operation will fail.
(dset (h5dcreate2 file *DATASET* +H5T-NATIVE-INT+ space
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+)))
;; Define the transform expression.
(h5pset-data-transform dxpl *TRANSFORM*)
;; Write the data to the dataset using the dataset transfer
;; property list.
(h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ dxpl wdata)
;; Close and release resources.
(h5ex:close-handles (list dxpl dset space)))
(h5ex:close-handles (list file fapl))))
;; Open file and dataset using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(dxpl (h5pcreate +H5P-DATASET-XFER+)))
;; Read the data using the default properties
(h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
rdata)
;; Output the data to the screen.
(format t "~%Data as written with transform \"~a\":~%"
(cffi:foreign-string-to-lisp *TRANSFORM*))
(print-data rdata)
(h5pset-data-transform dxpl *RTRANSFORM*)
;; Read the data using the dataset transfer property list.
(h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ dxpl rdata)
;; Output the data to the screen.
(format t
"~%Data as written with transform \"~a\" and read with transform \"~a\":~%"
(cffi:foreign-string-to-lisp *TRANSFORM*)
(cffi:foreign-string-to-lisp *RTRANSFORM*))
(print-data rdata)
(h5ex:close-handles (list dxpl dset)))
(h5ex:close-handles (list file fapl)))))
(cffi:foreign-string-free *RTRANSFORM*)
(cffi:foreign-string-free *TRANSFORM*)
| 4,080 | Common Lisp | .lisp | 87 | 42.563218 | 104 | 0.678922 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 26533374561aa8c7dd050b7332bb7d0332536248c13c2531a6520c26e7c90832 | 1,528 | [
-1
] |
1,529 | h5ex-d-rdwr.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datasets/h5ex-d-rdwr.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write data to a
;;; dataset. The program first writes integers to a dataset
;;; with dataspace dimensions of DIM0xDIM1, then closes the
;;; file. Next, it reopens the file, reads back the data, and
;;; outputs it to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5D/h5ex_d_rdwr.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_d_rdwr.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *DIM0* 4)
(defparameter *DIM1* 7)
(cffi:with-foreign-objects ((wdata :int (* *DIM0* *DIM1*))
(rdata :int (* *DIM0* *DIM1*)))
;; initialize the data to be written
(dotimes (i *DIM0*)
(dotimes (j *DIM1*)
(setf (cffi:mem-aref wdata :int (h5ex:pos2D *DIM1* i j)) (- (* i j) j))))
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((space (h5ex:create-simple-dataspace `(,*DIM0* ,*DIM1*)))
;; Create the dataset. We will use all default properties for
;; this example.
(dset (h5dcreate2 file *DATASET* +H5T-STD-I32BE+ space
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+)))
;; Write the data to the dataset
(h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
wdata)
;; Close and release resources.
(h5ex:close-handles (list dset space)))
(h5ex:close-handles (list file fapl))))
;; Open file and dataset using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+)))
;; Read the data using the default properties
(h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
rdata)
;; Output the data to the screen.
(format t "~a:~%" *DATASET*)
(dotimes (i *DIM0*)
(format t " [")
(dotimes (j *DIM1*)
(format t " ~3d" (cffi:mem-aref rdata :int
(h5ex:pos2D *DIM1* i j))))
(format t "]~%"))
(h5dclose dset))
(h5ex:close-handles (list file fapl)))))
| 2,979 | Common Lisp | .lisp | 60 | 40.75 | 99 | 0.597935 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | a0299732a35bc4c1d8929718e687ffccd4acde6c1fc20eb1c18299804a71130a | 1,529 | [
-1
] |
1,530 | h5ex-d-sofloat.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datasets/h5ex-d-sofloat.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write data to a dataset
;;; using the Scale-Offset filter. The program first checks
;;; if the Scale-Offset filter is available, then if it is it
;;; writes floating point numbers to a dataset using
;;; Scale-Offset, then closes the file Next, it reopens the
;;; file, reads back the data, and outputs the type of filter
;;; and the maximum value in the dataset to the screen.
;;;http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5D/h5ex_d_sofloat.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_d_sofloat.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *DIM0* 32)
(defparameter *DIM1* 64)
(defparameter *CHUNK0* 4)
(defparameter *CHUNK1* 8)
(cffi:with-foreign-objects ((chunk 'hsize-t 2)
(filter-info :unsigned-int 1)
(flags :unsigned-int 1)
(nelmts 'size-t 1)
(wdata :double (* *DIM0* *DIM1*))
(rdata :double (* *DIM0* *DIM1*)))
(setf (cffi:mem-aref nelmts 'size-t 0) 0)
;; Check if Scale-Offset compression is available and can be used for both
;; compression and decompression. Normally we do not perform error
;; checking in these examples for the sake of clarity, but in this
;; case we will make an exception because this filter is an
;; optional part of the hdf5 library.
(if (< (h5zfilter-avail +H5Z-FILTER-SCALEOFFSET+) 1)
(error "Scale-Offset filter not available."))
(h5zget-filter-info +H5Z-FILTER-SCALEOFFSET+ filter-info)
(if (or (eql 0 (logand (cffi:mem-ref filter-info :unsigned-int)
+H5Z-FILTER-CONFIG-ENCODE-ENABLED+))
(eql 0 (logand (cffi:mem-ref filter-info :unsigned-int)
+H5Z-FILTER-CONFIG-DECODE-ENABLED+)))
(error "Scale-Offset filter not available for encoding and decoding."))
;; Initialize data.
(dotimes (i *DIM0*)
(dotimes (j *DIM1*)
(setf (cffi:mem-aref wdata :double (h5ex:pos2D *DIM1* i j))
(+ (/ (1+ i) (+ j 0.3d0)) j))))
;; Print the minimum and maximum values.
(format t "Maximum value in write buffer is: ~a~%"
(reduce #'max
(mapcar #'(lambda (i) (cffi:mem-aref wdata :double i))
(loop for i from 0 to (1- (* *DIM0* *DIM1*))
collect i))))
(format t "Minimum value in write buffer is: ~a~%"
(reduce #'min
(mapcar #'(lambda (i) (cffi:mem-aref wdata :double i))
(loop for i from 0 to (1- (* *DIM0* *DIM1*))
collect i))))
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((space (h5ex:create-simple-dataspace `(,*DIM0* ,*DIM1*)))
(dcpl (h5pcreate +H5P-DATASET-CREATE+))
;; Create the dataset using the dataset creation property
;; list.
(dset (progn
;; Create the dataset creation property list, add the
;; Scale-Offset filter and set the chunk size.
(h5pset-scaleoffset dcpl :H5Z-SO-FLOAT-DSCALE 2)
(setf (cffi:mem-aref chunk 'hsize-t 0) *CHUNK0*
(cffi:mem-aref chunk 'hsize-t 1) *CHUNK1*)
(h5pset-chunk dcpl 2 chunk)
;; Create the chunked dataset.
(h5dcreate2 file *DATASET* +H5T-IEEE-F64LE+ space
+H5P-DEFAULT+ dcpl +H5P-DEFAULT+))))
;; Write the data to the dataset.
(h5dwrite dset +H5T-NATIVE-DOUBLE+ +H5S-ALL+ space +H5P-DEFAULT+
wdata)
;; Close and release resources.
(h5ex:close-handles (list dset dcpl space)))
(h5ex:close-handles (list file fapl))))
;; Now we begin the read section of this example.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(dcpl (h5dget-create-plist dset))
;; Retrieve and print the filter type. Here we only retrieve
;; the first filter because we know that we only added one
;; filter.
(filter-type (prog2 (setf (cffi:mem-ref nelmts 'size-t) 0)
(h5pget-filter2 dcpl 0 flags nelmts +NULL+
0 +NULL+ filter-info))))
(format t "Filter type is: ")
(cond ((eql filter-type +H5Z-FILTER-DEFLATE+)
(format t "H5Z_FILTER_DEFLATE~%"))
((eql filter-type +H5Z-FILTER-SHUFFLE+)
(format t "H5Z_FILTER_SHUFFLE~%"))
((eql filter-type +H5Z-FILTER-FLETCHER32+)
(format t "H5Z_FILTER_FLETCHER32~%"))
((eql filter-type +H5Z-FILTER-SZIP+)
(format t "H5Z_FILTER_SZIP~%"))
((eql filter-type +H5Z-FILTER-NBIT+)
(format t "H5Z_FILTER_NBIT~%"))
((eql filter-type +H5Z-FILTER-SCALEOFFSET+)
(format t "H5Z_FILTER_SCALEOFFSET~%")))
;; Read the data using the default properties.
(h5dread dset +H5T-NATIVE-DOUBLE+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
rdata)
;; Find the minimum and maximum values in the dataset, to verify
;; that it was read correctly.
(format t "Maximum value in ~a is: ~a~%" *DATASET*
(reduce #'max
(mapcar #'(lambda (i)
(cffi:mem-aref rdata :double i))
(loop for i from 0 to (1- (* *DIM0* *DIM1*))
collect i))))
(format t "Minimum value in ~a is: ~a~%" *DATASET*
(reduce #'min
(mapcar #'(lambda (i)
(cffi:mem-aref rdata :double i))
(loop for i from 0 to (1- (* *DIM0* *DIM1*))
collect i))))
;; Close and release resources.
(h5ex:close-handles (list dcpl dset)))
(h5ex:close-handles (list file fapl)))))
| 6,600 | Common Lisp | .lisp | 131 | 40.587786 | 101 | 0.59587 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 0fddbaac11809330489040dcf0ffa5d23e577bd4f75cafbe92596630cf66190a | 1,530 | [
-1
] |
1,531 | h5ex-d-shuffle.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datasets/h5ex-d-shuffle.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write data to a dataset
;;; using the shuffle filter with gzip compression. The
;;; program first checks if the shuffle and gzip filters are
;;; available, then if they are it writes integers to a
;;; dataset using shuffle+gzip, then closes the file. Next,
;;; it reopens the file, reads back the data, and outputs the
;;; types of filters and the maximum value in the dataset to
;;; the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5D/h5ex_d_shuffle.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_d_shuffle.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *DIM0* 32)
(defparameter *DIM1* 64)
(defparameter *CHUNK0* 4)
(defparameter *CHUNK1* 8)
(cffi:with-foreign-objects ((chunk 'hsize-t 2)
(filter-info :unsigned-int 1)
(flags :unsigned-int 1)
(nelmts 'size-t 1)
(wdata :int (* *DIM0* *DIM1*))
(rdata :int (* *DIM0* *DIM1*)))
(setf (cffi:mem-aref nelmts 'size-t 0) 0)
;; Check if gzip compression is available and can be used for both
;; compression and decompression. Normally we do not perform error
;; checking in these examples for the sake of clarity, but in this
;; case we will make an exception because this filter is an
;; optional part of the hdf5 library.
(if (< (h5zfilter-avail +H5Z-FILTER-DEFLATE+) 1)
(error "gzip filter not available."))
(h5zget-filter-info +H5Z-FILTER-DEFLATE+ filter-info)
(if (or (eql 0 (logand (cffi:mem-ref filter-info :unsigned-int)
+H5Z-FILTER-CONFIG-ENCODE-ENABLED+))
(eql 0 (logand (cffi:mem-ref filter-info :unsigned-int)
+H5Z-FILTER-CONFIG-DECODE-ENABLED+)))
(error "gzip filter not available for encoding and decoding."))
;; Similarly, check for availability of the shuffle filter.
(if (< (h5zfilter-avail +H5Z-FILTER-SHUFFLE+) 1)
(error "Shuffle filter not available."))
(h5zget-filter-info +H5Z-FILTER-SHUFFLE+ filter-info)
(if (or (eql 0 (logand (cffi:mem-ref filter-info :unsigned-int)
+H5Z-FILTER-CONFIG-ENCODE-ENABLED+))
(eql 0 (logand (cffi:mem-ref filter-info :unsigned-int)
+H5Z-FILTER-CONFIG-DECODE-ENABLED+)))
(error "Shuffle filter not available for encoding and decoding."))
;; Initialize data.
(dotimes (i *DIM0*)
(dotimes (j *DIM1*)
(setf (cffi:mem-aref wdata :int (h5ex:pos2D *DIM1* i j)) (- (* i j) j))))
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((space (h5ex:create-simple-dataspace `(,*DIM0* ,*DIM1*)))
(dcpl (h5pcreate +H5P-DATASET-CREATE+))
;; Create the dataset.
(dset (progn
;; Create the dataset creation property list, add the
;; shuffle filter and the gzip compression filter and
;; set the chunk size. The order in which the filters
;; are added here is significant - we will see much
;; greater results when the shuffle is applied first.
;; The order in which the filters are added to the
;; property list is the order in which they
;; will be invoked when writing data.
(h5pset-shuffle dcpl)
(h5pset-deflate dcpl 9)
(setf (cffi:mem-aref chunk 'hsize-t 0) *CHUNK0*
(cffi:mem-aref chunk 'hsize-t 1) *CHUNK1*)
(h5pset-chunk dcpl 2 chunk)
;; Create the chunked dataset.
(h5dcreate2 file *DATASET* +H5T-STD-I32LE+ space
+H5P-DEFAULT+ dcpl +H5P-DEFAULT+))))
;; Write the data to the dataset.
(h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ space +H5P-DEFAULT+ wdata)
;; Close and release resources.
(h5ex:close-handles (list dset dcpl space)))
(h5ex:close-handles (list file fapl))))
;; Now we begin the read section of this example.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(dcpl (h5dget-create-plist dset))
(nfilters (h5pget-nfilters dcpl)))
;; Retrieve the number of filters, and retrieve and print the
;; type of each.
(dotimes (i nfilters)
(setf (cffi:mem-ref nelmts 'size-t) 0)
(let ((filter-type (h5pget-filter2 dcpl i flags nelmts +NULL+
0 +NULL+ filter-info)))
(format t "Filter ~a: Type is: " i)
(cond ((eql filter-type +H5Z-FILTER-DEFLATE+)
(format t "H5Z_FILTER_DEFLATE~%"))
((eql filter-type +H5Z-FILTER-SHUFFLE+)
(format t "H5Z_FILTER_SHUFFLE~%"))
((eql filter-type +H5Z-FILTER-FLETCHER32+)
(format t "H5Z_FILTER_FLETCHER32~%"))
((eql filter-type +H5Z-FILTER-SZIP+)
(format t "H5Z_FILTER_SZIP~%"))
((eql filter-type +H5Z-FILTER-NBIT+)
(format t "H5Z_FILTER_NBIT~%"))
((eql filter-type +H5Z-FILTER-SCALEOFFSET+)
(format t "H5Z_FILTER_SCALEOFFSET~%")))))
;; Read the data using the default properties.
(h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
rdata)
;; Find the maximum value in the dataset, to verify that it was
;; read correctly.
(format t "Maximum value in ~a is: ~a~%" *DATASET*
(reduce #'max
(mapcar #'(lambda (i) (cffi:mem-aref rdata :int i))
(loop for i from 0 to (1- (* *DIM0* *DIM1*))
collect i))))
;; Close and release resources.
(h5ex:close-handles (list dcpl dset)))
(h5ex:close-handles (list file fapl)))))
| 6,518 | Common Lisp | .lisp | 128 | 42.296875 | 102 | 0.622837 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 43b528cff4684e910a9786cc83f69a2b77830ec081e64f26c238849bcfd73ec7 | 1,531 | [
-1
] |
1,532 | h5-crtgrpar.lisp | ghollisjr_cl-ana/hdf-cffi/examples/basics/h5-crtgrpar.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example illustrates the creation of groups using absolute and
;;; relative names.
;;; http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/examples/h5_crtgrpar.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "groups.h5" *load-pathname*)))
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2
(h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((g1 (h5gcreate2 file "/MyGroup"
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+))
(g2 (h5gcreate2 file "/MyGroup/Group_A"
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+))
(g3 (h5gcreate2 g1 "Group_B"
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5ex:close-handles (list g3 g2 g1)))
(h5ex:close-handles (list file fapl))))
| 1,271 | Common Lisp | .lisp | 27 | 42.888889 | 80 | 0.684466 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 7cbef469c1a8c0e09800f15edc71379b7cccf296b68d029e27ce3d9f899b965c | 1,532 | [
-1
] |
1,533 | h5-crtgrp.lisp | ghollisjr_cl-ana/hdf-cffi/examples/basics/h5-crtgrp.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example illustrates how to create and close a group.
;;; http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/examples/h5_crtgrp.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "group.h5" *load-pathname*)))
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let ((g (h5gcreate2 file "/MyGroup"
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5gclose g))
(h5ex:close-handles (list file fapl))))
| 1,010 | Common Lisp | .lisp | 21 | 45.190476 | 79 | 0.706422 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 16a545a4361296fe4c9357ab5da9caa22bdcb6d4bc433ba62ac4c95d45af694d | 1,533 | [
-1
] |
1,534 | h5-rdwt.lisp | ghollisjr_cl-ana/hdf-cffi/examples/basics/h5-rdwt.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example illustrates how to write and read data in an existing
;;; dataset. It depends on the HDF5 file created by h5-crtdat.lisp.
;;; http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/examples/h5_rdwt.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "dset.h5" *load-pathname*)))
(cffi:with-foreign-object (dset-data :int (* 4 6))
;; initialize the data to be written
(dotimes (i 4)
(dotimes (j 6)
(let ((pos (h5ex:pos2D 6 i j)))
(setf (cffi:mem-aref dset-data :int pos) (1+ pos)))))
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDWR+ fapl))))
(unwind-protect
(let ((dset (h5dopen2 file "/dset" +H5P-DEFAULT+))) ; open the dataset
;; write the dataset
(h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
dset-data)
;; and read it back
(h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
dset-data)
(h5dclose dset))
(h5ex:close-handles (list file fapl)))))
| 1,499 | Common Lisp | .lisp | 33 | 42 | 78 | 0.684066 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 28d7c40e25dee8f1ee8475a233370d0d9642e9aef4d87c3a32ca54d1e52a51b1 | 1,534 | [
-1
] |
1,535 | h5-crtgrpd.lisp | ghollisjr_cl-ana/hdf-cffi/examples/basics/h5-crtgrpd.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example illustrates how to create a dataset in a group.
;;; It depends on the HDF5 file created by h5-crtgrpar.lisp.
;;; http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/examples/h5_crtgrpd.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "groups.h5" *load-pathname*)))
(cffi:with-foreign-objects
((dset1-data :int (* 3 3))
(dset2-data :int (* 2 10)))
;; initialize the data of the first dataset
(dotimes (i 3)
(dotimes (j 3)
(setf (cffi:mem-aref dset1-data :int (h5ex:pos2D 3 i j)) (1+ j))))
;; initialize the data of the second dataset
(dotimes (i 2)
(dotimes (j 10)
(setf (cffi:mem-aref dset2-data :int (h5ex:pos2D 10 i j)) (1+ j))))
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDWR+ fapl))))
(unwind-protect
(progn
;; create a first dataset in group '/MyGroup'
(let* ((shape (h5ex:create-simple-dataspace '(3 3)))
(dset (h5dcreate2 file "/MyGroup/dset1" +H5T-STD-I32BE+ shape
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+)))
;; write to the first dataset
(h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
dset1-data)
(h5ex:close-handles (list dset shape)))
;; create a second dataset in '/MyGroup/Group_A'
(let* ((grp (h5gopen2 file "/MyGroup/Group_A" +H5P-DEFAULT+))
(shape (h5ex:create-simple-dataspace '(2 10)))
(dset (h5dcreate2 grp "dset2" +H5T-STD-I32BE+ shape
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+)))
;; write to the second dataset
(h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
dset2-data)
(h5ex:close-handles (list dset shape grp))))
(h5ex:close-handles (list file fapl)))))
| 2,230 | Common Lisp | .lisp | 48 | 41.9375 | 80 | 0.66682 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 1446e776b7e93492c13225bcaa0c495574a1faa53ee306ca041f09b67d29307e | 1,535 | [
-1
] |
1,536 | h5-extend.lisp | ghollisjr_cl-ana/hdf-cffi/examples/basics/h5-extend.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example how to work with extendible datasets. The dataset
;;; must be chunked in order to be extendible.
;;; http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/examples/h5_extend.c
(in-package :hdf5)
(defparameter *FILENAME* (namestring (merge-pathnames "extend.h5" *load-pathname*)))
(defparameter *DATASETNAME* "ExtendibleArray")
(defparameter *RANK* 2)
(cffi:with-foreign-objects
((dims 'hsize-t 2)
(chunk-dims 'hsize-t 2)
(data :int (* 3 3))
(size 'hsize-t 2)
(offset 'hsize-t 2)
(dimsext 'hsize-t 2)
(dataext :int (* 7 3))
(chunk-dimsr 'hsize-t 2)
(dimsr 'hsize-t 2)
(rdata :int (* 10 3)))
(setf (cffi:mem-aref dims 'hsize-t 0) 3
(cffi:mem-aref dims 'hsize-t 1) 3)
(setf (cffi:mem-aref chunk-dims 'hsize-t 0) 2
(cffi:mem-aref chunk-dims 'hsize-t 1) 5)
(dotimes (i 3)
(dotimes (j 3)
(setf (cffi:mem-aref data :int (h5ex:pos2D 3 i j)) 1)))
(setf (cffi:mem-aref dimsext 'hsize-t 0) 7
(cffi:mem-aref dimsext 'hsize-t 1) 3)
(dotimes (i 7)
(dotimes (j 3)
(let ((pos (h5ex:pos2D 3 i j)))
(cond ((= j 0) (setf (cffi:mem-aref dataext :int pos) 2))
((= j 1) (setf (cffi:mem-aref dataext :int pos) 3))
((= j 2) (setf (cffi:mem-aref dataext :int pos) 4))))))
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILENAME* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((shape (h5ex:create-simple-dataspace '(3 3)
`(,+H5S-UNLIMITED+
,+H5S-UNLIMITED+)))
(dcpl (h5pcreate +H5P-DATASET-CREATE+))
(dset (prog2 (h5pset-chunk dcpl *RANK* chunk-dims)
(h5dcreate2 file *DATASETNAME* +H5T-NATIVE-INT+ shape
+H5P-DEFAULT+ dcpl +H5P-DEFAULT+))))
(h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
data)
;; extend the dataset
(setf (cffi:mem-aref size 'hsize-t 0)
(+ (cffi:mem-ref dims 'hsize-t 0)
(cffi:mem-ref dimsext 'hsize-t 0))
(cffi:mem-aref size 'hsize-t 1) 3)
(h5dset-extent dset size)
(let ((fshape (h5dget-space dset))
(mshape (h5ex:create-simple-dataspace '(7 3))))
(setf (cffi:mem-aref offset 'hsize-t 0) 3
(cffi:mem-aref offset 'hsize-t 1) 0)
(h5sselect-hyperslab fshape :H5S-SELECT-SET offset +NULL+ dimsext
+NULL+)
(h5dwrite dset +H5T-NATIVE-INT+ mshape fshape +H5P-DEFAULT+
dataext)
(h5ex:close-handles (list mshape fshape)))
(h5ex:close-handles (list dset dcpl shape)))
(h5ex:close-handles (list file fapl))))
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILENAME* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASETNAME* +H5P-DEFAULT+))
(fshape (h5dget-space dset))
(rank (h5sget-simple-extent-ndims fshape))
(plist (h5dget-create-plist dset)))
(if (eql :H5D-CHUNKED (h5pget-layout plist))
(h5pget-chunk plist rank chunk-dimsr))
(h5sget-simple-extent-dims fshape dimsr +NULL+)
(let ((mshape (h5screate-simple rank dimsr +NULL+))
(dimsr[0] (cffi:mem-aref dimsr 'hsize-t 0))
(dimsr[1] (cffi:mem-aref dimsr 'hsize-t 1)))
(h5dread dset +H5T-NATIVE-INT+ mshape fshape +H5P-DEFAULT+ rdata)
(format t "~%")
(format t "Dataset: ~%")
(dotimes (i dimsr[0])
(dotimes (j dimsr[1])
(format t "~d " (cffi:mem-aref rdata :int
(h5ex:pos2D dimsr[1] i j))))
(format t "~%"))
(h5sclose mshape))
(h5ex:close-handles (list plist fshape dset)))
(h5ex:close-handles (list file fapl)))))
| 4,110 | Common Lisp | .lisp | 97 | 36.927835 | 84 | 0.638436 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 5374aec17fa819b61ca617946d0c5fb850f7b2d4b1a015673deb47fc8292608b | 1,536 | [
-1
] |
1,537 | h5-crtdat.lisp | ghollisjr_cl-ana/hdf-cffi/examples/basics/h5-crtdat.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example illustrates how to create a dataset that is a 4 x 6 array.
;;; http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/examples/h5_crtdat.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "dset.h5" *load-pathname*)))
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((shape (h5ex:create-simple-dataspace '(4 6)))
(dset (h5dcreate2 file "/dset" +H5T-STD-I32BE+ shape
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5ex:close-handles (list dset shape)))
(h5ex:close-handles (list file fapl))))
| 1,122 | Common Lisp | .lisp | 22 | 48 | 78 | 0.704212 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 2461d97181887965eb0abf7a24933df232a6bcb5930610aa3ddb30d16a4a2761 | 1,537 | [
-1
] |
1,538 | h5-subset.lisp | ghollisjr_cl-ana/hdf-cffi/examples/basics/h5-subset.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example illustrates how to read/write a subset of data (a slab)
;;; from/to a dataset in an HDF5 file.
;;; http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/examples/h5_subset.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "subset.h5" *load-pathname*)))
(defparameter *DATASETNAME* "IntArray")
(defparameter *RANK* 2)
(defparameter *DIM0-SUB* 3)
(defparameter *DIM1-SUB* 4)
(defparameter *DIM0* 8)
(defparameter *DIM1* 10)
(cffi:with-foreign-objects
((data :int (* *DIM0* *DIM1*))
(sdata :int (* *DIM0-SUB* *DIM1-SUB*))
(rdata :int (* *DIM0* *DIM1*))
(count 'hsize-t 2)
(offset 'hsize-t 2)
(stride 'hsize-t 2)
(block 'hsize-t 2))
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((shape (h5ex:create-simple-dataspace `(,*DIM0* ,*DIM1*)))
(dset (h5dcreate2 file *DATASETNAME* +H5T-STD-I32BE+ shape
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+)))
(dotimes (i *DIM0*)
(dotimes (j *DIM1*)
(let ((pos (h5ex:pos2D *DIM1* i j)))
(if (< j (/ *DIM1* 2))
(setf (cffi:mem-aref data :int pos) 1)
(setf (cffi:mem-aref data :int pos) 2)))))
(h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
data)
(format t "~%Data written to file:~%")
(dotimes (i *DIM0*)
(dotimes (j *DIM1*)
(format t " ~d" (cffi:mem-aref data :int
(h5ex:pos2D *DIM1* i j))))
(format t "~%"))
(h5ex:close-handles (list dset shape)))
(h5ex:close-handles (list file fapl))))
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDWR+ fapl))))
(unwind-protect
(progn
;; initialize the hyperslab parameters
(setf (cffi:mem-aref offset 'hsize-t 0) 1
(cffi:mem-aref offset 'hsize-t 1) 2
(cffi:mem-aref count 'hsize-t 0) *DIM0-SUB*
(cffi:mem-aref count 'hsize-t 1) *DIM1-SUB*
(cffi:mem-aref stride 'hsize-t 0) 1
(cffi:mem-aref stride 'hsize-t 1) 1
(cffi:mem-aref block 'hsize-t 0) 1
(cffi:mem-aref block 'hsize-t 1) 1)
(let* ((dset (h5dopen2 file *DATASETNAME* +H5P-DEFAULT+))
(fshape (h5dget-space dset))
(mshape (h5ex:create-simple-dataspace
`(,*DIM0-SUB* ,*DIM1-SUB*))))
;; select the hyperslab to be written
(h5sselect-hyperslab fshape :H5S-SELECT-SET
offset stride count block)
(dotimes (i *DIM0-SUB*)
(dotimes (j *DIM1-SUB*)
(setf (cffi:mem-aref sdata :int (h5ex:pos2D *DIM1-SUB* i j))
5)))
;; write to hyperslab selection
(h5dwrite dset +H5T-NATIVE-INT+ mshape fshape +H5P-DEFAULT+ sdata)
;; read back the entire dataset
(h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
rdata)
(format t "~%Data in file after subset was written:~%")
(dotimes (i *DIM0*)
(dotimes (j *DIM1*)
(format t " ~d" (cffi:mem-aref rdata :int
(h5ex:pos2D *DIM1* i j))))
(format t "~%"))
(h5ex:close-handles (list mshape fshape dset))))
(h5ex:close-handles (list file fapl)))))
| 3,660 | Common Lisp | .lisp | 89 | 36.033708 | 80 | 0.635519 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 37b8f3a8de6f60fec43cf6ceceea6ffc332a1d0a273d646ea4621adc7e8049bb | 1,538 | [
-1
] |
1,539 | h5-cmprss.lisp | ghollisjr_cl-ana/hdf-cffi/examples/basics/h5-cmprss.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example illustrates how to create a compressed dataset.
;;; http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/examples/h5_cmprss.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "cmprss.h5" *load-pathname*)))
(defparameter *RANK* 2)
(defparameter *DIM0* 100)
(defparameter *DIM1* 20)
(defparameter *USE-SZIP* nil)
(cffi:with-foreign-objects
((cdims 'hsize-t 2)
(buf :int (* *DIM0* *DIM1*))
(flags :uint 1)
(info :uint 1)
(nelmts 'size-t 1)
(rbuf :int (* *DIM0* *DIM1*))
(szip-options-mask :uint 1)
(szip-pixels-per-block :uint 1))
(print "Create a file.")
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((shape (h5ex:create-simple-dataspace `(,*DIM0* ,*DIM1*)))
(dcpl (h5pcreate +H5P-DATASET-CREATE+))
(dset (progn
(setf (cffi:mem-aref cdims 'hsize-t 0) 20
(cffi:mem-aref cdims 'hsize-t 1) 20)
(h5pset-chunk dcpl 2 cdims) ; set chunking
(cond ((not *USE-SZIP*) ; use GZIP comression
(h5pset-deflate dcpl 6))
(t ; use SZIP compression
(setf (cffi:mem-aref szip-options-mask :uint 0)
+H5-SZIP-NN-OPTION-MASK+
(cffi:mem-aref szip-pixels-per-block
:uint 0)
16)
(h5pset-szip dcpl
(cffi:mem-ref szip-options-mask
:uint 0)
(cffi:mem-ref szip-pixels-per-block
:uint 0))))
(h5dcreate2 file "Compressed_Data" +H5T-STD-I32BE+
shape +H5P-DEFAULT+ dcpl +H5P-DEFAULT+))))
(dotimes (i *DIM0*)
(dotimes (j *DIM1*)
(setf (cffi:mem-aref buf :int (h5ex:pos2D *DIM1* i j)) (+ i j))))
(h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
buf)
(h5ex:close-handles (list dset dcpl shape)))
(h5ex:close-handles (list file fapl))))
(print "Now reopen the file and dataset in the file.")
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(print "Retrieve filter information.")
(unwind-protect
(let* ((dset (h5dopen2 file "Compressed_Data" +H5P-DEFAULT+))
(plist (h5dget-create-plist dset))
(numfilt (H5Pget-nfilters plist)))
(format t "Number of filters associated with dataset: ~a~%" numfilt)
(dotimes (i numfilt)
(setf (cffi:mem-aref nelmts 'size-t 0) 0)
;; check the filter type(s)
(print "Filter Type: ")
(let ((filter-type (h5pget-filter2 plist i
(cffi:mem-aptr flags :uint 0)
(cffi:mem-aptr nelmts 'size-t 0)
(cffi:null-pointer) 0
(cffi:null-pointer)
(cffi:mem-aptr info :uint 0))))
(format t "~S~%"
(cond ((eql filter-type +H5Z-FILTER-DEFLATE+)
'H5Z_FILTER_DEFLATE)
((eql filter-type +H5Z-FILTER-SZIP+)
'H5Z_FILTER_SZIP)
(t 'OTHER)))))
;; read the data back
(h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
rbuf)
(h5ex:close-handles (list plist dset)))
(h5ex:close-handles (list file fapl)))))
| 3,647 | Common Lisp | .lisp | 90 | 34.755556 | 80 | 0.629337 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | c835fac5109fc51126c8f4c61bec3d53a22c688d7325372d5504859a3fea738f | 1,539 | [
-1
] |
1,540 | h5-crtatt.lisp | ghollisjr_cl-ana/hdf-cffi/examples/basics/h5-crtatt.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example illustrates how to create an attribute attached to a
;;; dataset. It depends on the HDF5 file created by h5-crtdat.lisp.
;;; http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/examples/h5_crtatt.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "dset.h5" *load-pathname*)))
(cffi:with-foreign-object (attr-data :int 2)
;; initialize the attribute data
(setf (cffi:mem-aref attr-data :int 0) 100
(cffi:mem-aref attr-data :int 1) 200)
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2
(h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDWR+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file "/dset" +H5P-DEFAULT+))
(shape (h5ex:create-simple-dataspace '(2)))
(att (h5acreate2 dset "Units" +H5T-STD-I32BE+ shape
+H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5awrite att +H5T-NATIVE-INT+ attr-data)
(h5ex:close-handles (list att shape dset)))
(h5ex:close-handles (list file fapl)))))
| 1,416 | Common Lisp | .lisp | 30 | 44.233333 | 78 | 0.707636 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 2def9e7b5c4cd412df5a5084ba8f61e55629970832a5489a021ab38480e9b635 | 1,540 | [
-1
] |
1,541 | h5ex-t-cpxcmpd.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-cpxcmpd.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write a complex
;;; compound datatype to a dataset. The program first writes
;;; complex compound structures to a dataset with a dataspace
;;; of DIM0, then closes the file. Next, it reopens the file,
;;; reads back selected fields in the structure, and outputs
;;; them to the screen.
;;; Unlike the other datatype examples, in this example we
;;; save to the file using native datatypes to simplify the
;;; type definitions here. To save using standard types you
;;; must manually calculate the sizes and offsets of compound
;;; types as shown in h5ex_t_cmpd.c, and convert enumerated
;;; values as shown in h5ex_t_enum.c.
;;; The datatype defined here consists of a compound
;;; containing a variable-length list of compound types, as
;;; well as a variable-length string, enumeration, double
;;; array, object reference and region reference. The nested
;;; compound type contains an int, variable-length string and
;;; two doubles.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_cpxcmpd.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_t_cpxcmpd.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *DIM0* 2)
(defparameter *LENA* 4)
(defparameter *LENB* 1)
(cffi:defcstruct sensor-t
(serial-no :int)
(location :string)
(temperature :double)
(pressure :double))
(defun create-sensorstype()
(flet ((create-sensortype ()
(let ((result (h5tcreate :H5T-COMPOUND
(cffi:foreign-type-size
'(:struct sensor-t))))
(strtype (h5ex:create-c-string-type)))
(h5tinsert result "Serial number"
(cffi:foreign-slot-offset '(:struct sensor-t)
'serial-no)
+H5T-NATIVE-INT+)
(h5tinsert result "Location"
(cffi:foreign-slot-offset '(:struct sensor-t) 'location)
strtype)
(h5tinsert result "Temperature (F)"
(cffi:foreign-slot-offset '(:struct sensor-t)
'temperature)
+H5T-NATIVE-DOUBLE+)
(h5tinsert result "Pressure (inHg)"
(cffi:foreign-slot-offset '(:struct sensor-t) 'pressure)
+H5T-NATIVE-DOUBLE+)
(h5tclose strtype)
result)))
(let* ((sensortype (create-sensortype))
(result (h5tvlen-create sensortype)))
(h5tclose sensortype)
result)))
(cffi:defcenum color-t
:RED
:GREEN
:BLUE)
(defun create-colortype ()
(cffi:with-foreign-object (val 'color-t)
(let ((result (h5tenum-create +H5T-NATIVE-INT+)))
(setf (cffi:mem-ref val 'color-t) :RED)
(h5tenum-insert result "Red" val)
(setf (cffi:mem-ref val 'color-t) :GREEN)
(h5tenum-insert result "Green" val)
(setf (cffi:mem-ref val 'color-t) :BLUE)
(h5tenum-insert result "Blue" val)
result)))
(cffi:defcstruct vehicle-t
(sensors (:struct hvl-t))
(name :string)
(color color-t)
(location :double :count 3)
(group hobj-ref-t)
(surveyed-areas (:struct hdset-reg-ref-t)))
;;; Create the main compound datatype.
(defun create-vehicletype ()
(let ((result (h5tcreate :H5T-COMPOUND
(cffi:foreign-type-size '(:struct vehicle-t))))
(sensorstype (create-sensorstype))
(strtype (h5ex:create-c-string-type))
(colortype (create-colortype))
(loctype (cffi:with-foreign-object (adims 'hsize-t 3)
(setf (cffi:mem-aref adims 'hsize-t 0) 3)
(h5tarray-create2 +H5T-NATIVE-DOUBLE+ 1 adims))))
(h5tinsert result "Sensors"
(cffi:foreign-slot-offset '(:struct vehicle-t) 'sensors)
sensorstype)
(h5tinsert result "Name"
(cffi:foreign-slot-offset '(:struct vehicle-t) 'name)
strtype)
(h5tinsert result "Color"
(cffi:foreign-slot-offset '(:struct vehicle-t) 'color)
colortype)
(h5tinsert result "Location"
(cffi:foreign-slot-offset '(:struct vehicle-t) 'location)
loctype)
(h5tinsert result "Group"
(cffi:foreign-slot-offset '(:struct vehicle-t) 'group)
+H5T-STD-REF-OBJ+)
(h5tinsert result "Surveyed areas"
(cffi:foreign-slot-offset '(:struct vehicle-t) 'surveyed-areas)
+H5T-STD-REF-DSETREG+)
(h5ex:close-handles (list loctype colortype strtype sensorstype))
result))
(defun create-rsensorstype ()
(flet ((create-rsensortype ()
(let ((result (h5tcreate :H5T-COMPOUND
(cffi:foreign-type-size '(:pointer :char))))
(strtype (h5ex:create-c-string-type)))
(h5tinsert result "Location" 0 strtype)
(h5tclose strtype)
result)))
(let* ((rsensortype (create-rsensortype))
(result (h5tvlen-create rsensortype)))
(h5tclose rsensortype)
result)))
(cffi:defcstruct rvehicle-t
(sensors (:struct hvl-t))
(name :string))
;;; Create the nested compound datatype for reading. Even though it
;;; has only one field, it must still be defined as a compound type
;;; so the library can match the correct field in the file type.
;;; This matching is done by name. However, we do not need to
;;; define a structure for the read buffer as we can simply treat it
;;; as a char *.
(defun create-rvehicletype ()
(let ((result (h5tcreate :H5T-COMPOUND
(cffi:foreign-type-size '(:struct rvehicle-t))))
(strtype (h5ex:create-c-string-type))
(rsensorstype (create-rsensorstype)))
(h5tinsert result "Sensors"
(cffi:foreign-slot-offset '(:struct rvehicle-t) 'sensors)
rsensorstype)
(h5tinsert result "Name"
(cffi:foreign-slot-offset '(:struct rvehicle-t) 'name)
strtype)
(h5ex:close-handles (list rsensorstype strtype))
result))
(cffi:with-foreign-objects
((adims2 'hsize-t 2)
(start 'hsize-t 2)
(count 'hsize-t 2)
(coords 'hsize-t (* 3 2))
(wdata '(:struct vehicle-t) 2)
(wdata2 :double (* 32 32)))
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl)))
(ptrA (cffi:foreign-alloc '(:struct sensor-t) :count *LENA*))
(ptrB (cffi:foreign-alloc '(:struct sensor-t) :count *LENB*)))
(unwind-protect
(progn
;; create a dataset to use for region references
(dotimes (i 32)
(dotimes (j 32)
(setf (cffi:mem-aref wdata2 :double (+ (* i 32) j))
(+ 70.0d0
(* 0.1d0 (- i 16.0d0))
(* 0.1d0 (- j 16.0d0))))))
(let* ((shape (prog2 (setf (cffi:mem-aref adims2 'hsize-t 0) 32
(cffi:mem-aref adims2 'hsize-t 1) 32)
(h5screate-simple 2 adims2 +NULL+)))
(dset (h5dcreate2 file "Ambient_Temperature"
+H5T-NATIVE-DOUBLE+ shape
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5dwrite dset +H5T-NATIVE-DOUBLE+ +H5S-ALL+ +H5S-ALL+
+H5P-DEFAULT+ wdata2)
(h5ex:close-handles (list dset shape)))
;; create groups to use for object references
(h5ex:close-handles (list (h5gcreate2 file "Land_Vehicles"
+H5P-DEFAULT+ +H5P-DEFAULT+
+H5P-DEFAULT+)
(h5gcreate2 file "Air_Vehicles"
+H5P-DEFAULT+ +H5P-DEFAULT+
+H5P-DEFAULT+)))
(let ((sensors-ptr
(cffi:foreign-slot-pointer
(cffi:mem-aptr wdata '(:struct vehicle-t) 0)
'(:struct vehicle-t) 'sensors))
(ptr[0] (cffi:mem-aptr ptrA '(:struct sensor-t) 0))
(ptr[1] (cffi:mem-aptr ptrA '(:struct sensor-t) 1))
(ptr[2] (cffi:mem-aptr ptrA '(:struct sensor-t) 2))
(ptr[3] (cffi:mem-aptr ptrA '(:struct sensor-t) 3)))
;; Initialize variable-length compound in the first data element.
(cffi:with-foreign-slots ((len p) sensors-ptr (:struct hvl-t))
(setf len *LENA* p ptrA))
(cffi:with-foreign-slots ((serial-no location temperature pressure)
ptr[0] (:struct sensor-t))
(setf serial-no 1153 location "Exterior (static)"
temperature 53.23d0 pressure 24.57d0))
(cffi:with-foreign-slots ((serial-no location temperature pressure)
ptr[1] (:struct sensor-t))
(setf serial-no 1184 location "Intake"
temperature 55.12d0 pressure 22.95d0))
(cffi:with-foreign-slots ((serial-no location temperature pressure)
ptr[2] (:struct sensor-t))
(setf serial-no 1027 location "Intake manifold"
temperature 103.55d0 pressure 31.23d0))
(cffi:with-foreign-slots ((serial-no location temperature pressure)
ptr[3] (:struct sensor-t))
(setf serial-no 1313 location "Exhaust manifold"
temperature 1252.89d0 pressure 84.11d0)))
;; Initialize other fields in the first data element.
(let ((wdata[0] (cffi:mem-aptr wdata '(:struct vehicle-t) 0))
(shape (prog2 (setf (cffi:mem-aref adims2 'hsize-t 0) 32
(cffi:mem-aref adims2 'hsize-t 1) 32)
(h5screate-simple 2 adims2 +NULL+))))
(cffi:with-foreign-slots ((name color location)
wdata[0] (:struct vehicle-t))
(setf name "Airplane"
color :GREEN
(cffi:mem-aref location :double 0) -103234.21d0
(cffi:mem-aref location :double 1) 422638.78d0
(cffi:mem-aref location :double 2) 5996.43d0))
(h5rcreate (cffi:foreign-slot-pointer
wdata[0] '(:struct vehicle-t) 'group)
file "Air_Vehicles" :H5R-OBJECT -1)
(h5sselect-elements shape :H5S-SELECT-SET 3 coords)
(h5rcreate (cffi:foreign-slot-pointer
wdata[0] '(:struct vehicle-t) 'surveyed-areas)
file "Ambient_Temperature" :H5R-DATASET-REGION shape)
(h5sclose shape))
;; Initialize variable-length compound in the second data element.
(let ((sensors-ptr
(cffi:foreign-slot-pointer
(cffi:mem-aptr wdata '(:struct vehicle-t) 1)
'(:struct vehicle-t) 'sensors))
(ptr[0] (cffi:mem-aptr ptrB '(:struct sensor-t) 0)))
(cffi:with-foreign-slots ((len p) sensors-ptr (:struct hvl-t))
(setf len *LENB* p ptrB))
(cffi:with-foreign-slots ((serial-no location temperature pressure)
ptr[0] (:struct sensor-t))
(setf serial-no 3244 location "Roof"
temperature 83.82d0 pressure 29.92d0)))
;; Initialize other fields in the second data element.
(let ((wdata[1] (cffi:mem-aptr wdata '(:struct vehicle-t) 1))
(shape (prog2 (setf (cffi:mem-aref adims2 'hsize-t 0) 32
(cffi:mem-aref adims2 'hsize-t 1) 32)
(h5screate-simple 2 adims2 +NULL+))))
(cffi:with-foreign-slots ((name color location)
wdata[1] (:struct vehicle-t))
(setf name "Automobile"
color :RED
(cffi:mem-aref location :double 0) 326734.36d0
(cffi:mem-aref location :double 1) 221568.23d0
(cffi:mem-aref location :double 2) 432.36d0))
(h5rcreate (cffi:foreign-slot-pointer
wdata[1] '(:struct vehicle-t) 'group)
file "Land_Vehicles" :H5R-OBJECT -1)
(setf (cffi:mem-aref start 'hsize-t 0) 8
(cffi:mem-aref start 'hsize-t 1) 26
(cffi:mem-aref count 'hsize-t 0) 4
(cffi:mem-aref count 'hsize-t 1) 3)
(h5sselect-hyperslab shape :H5S-SELECT-SET start +NULL+
count +NULL+)
(h5rcreate (cffi:foreign-slot-pointer wdata[1] '(:struct vehicle-t)
'surveyed-areas)
file "Ambient_Temperature" :H5R-DATASET-REGION shape)
(h5sclose shape))
(let* ((vehicletype (create-vehicletype))
;; Create dataspace. Setting maximum size to NULL sets the
;; maximum size to be the current size.
(space (h5ex:create-simple-dataspace `(,*DIM0*)))
;; Create the dataset
(dset (h5dcreate2 file *DATASET* vehicletype space
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+)))
;; Finally, write the compound data to it.
(h5dwrite dset vehicletype +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+ wdata)
(h5ex:close-handles (list dset space vehicletype))))
(cffi:foreign-free ptrB)
(cffi:foreign-free ptrA)
(h5ex:close-handles (list file fapl)))))
(cffi:with-foreign-objects
((ndims 'hsize-t 1)
(dims 'hsize-t 1))
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(rvehicletype (create-rvehicletype))
(space (h5dget-space dset)))
(setf (cffi:mem-ref ndims 'hsize-t 0)
(h5sget-simple-extent-dims space dims +NULL+))
;; Allocate memory for read buffer.
(let ((rdata (cffi:foreign-alloc '(:struct rvehicle-t)
:count (cffi:mem-aref dims
'hsize-t 0))))
;; Read the data.
(h5dread dset rvehicletype +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
rdata)
;; Output the data to the screen.
(dotimes (i *DIM0*)
(let* ((rdata-ptr
(cffi:mem-aptr rdata '(:struct rvehicle-t) i))
(rdata-sensors-ptr
(cffi:foreign-slot-pointer
rdata-ptr '(:struct rvehicle-t) 'sensors)))
(format t "~a[~d]:~%" *DATASET* i)
(format t " Vehicle name :~% ~a~%"
(cffi:foreign-slot-value
rdata-ptr '(:struct rvehicle-t) 'name))
(format t " Sensor locations :~%")
(dotimes (j (cffi:foreign-slot-value
rdata-sensors-ptr '(:struct hvl-t) 'len))
(format t " ~a~%"
(cffi:mem-ref
(cffi:mem-aptr
(cffi:foreign-slot-value
rdata-sensors-ptr '(:struct hvl-t) 'p)
:pointer j)
:string)))))
;; Close and release resources. H5Dvlen_reclaim will
;; automatically traverse the structure and free any vlen
;; data (including strings).
(h5dvlen-reclaim rvehicletype space +H5P-DEFAULT+ rdata)
(cffi:foreign-free rdata))
(h5ex:close-handles (list space rvehicletype dset)))
(h5ex:close-handles (list file fapl)))))
| 14,272 | Common Lisp | .lisp | 331 | 36.637462 | 102 | 0.645623 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 47a612fa12038af79122512ffdf8706af9dd628ac94a773adb4d87cb36563667 | 1,541 | [
-1
] |
1,542 | h5ex-t-cpxcmpdatt.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-cpxcmpdatt.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write a complex
;;; compound datatype to an attribute. The program first
;;; writes complex compound structures to an attribute with a
;;; dataspace of DIM0, then closes the file. Next, it reopens
;;; the file, reads back selected fields in the structure, and
;;; outputs them to the screen.
;;; Unlike the other datatype examples, in this example we
;;; save to the file using native datatypes to simplify the
;;; type definitions here. To save using standard types you
;;; must manually calculate the sizes and offsets of compound
;;; types as shown in h5ex_t_cmpd.c, and convert enumerated
;;; values as shown in h5ex_t_enum.c.
;;; The datatype defined here consists of a compound
;;; containing a variable-length list of compound types, as
;;; well as a variable-length string, enumeration, double
;;; array, object reference and region reference. The nested
;;; compound type contains an int, variable-length string and
;;; two doubles.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_cpxcmpdatt.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_t_cpxcmpdatt.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *ATTRIBUTE* "A1")
(defparameter *DIM0* 2)
(defparameter *LENA* 4)
(defparameter *LENB* 1)
(cffi:defcstruct sensor-t
(serial-no :int)
(location :string)
(temperature :double)
(pressure :double))
(defun create-sensorstype()
(flet ((create-sensortype ()
(let ((result (h5tcreate :H5T-COMPOUND
(cffi:foreign-type-size
'(:struct sensor-t))))
(strtype (h5ex:create-c-string-type)))
(h5tinsert result "Serial number"
(cffi:foreign-slot-offset '(:struct sensor-t)
'serial-no)
+H5T-NATIVE-INT+)
(h5tinsert result "Location"
(cffi:foreign-slot-offset '(:struct sensor-t) 'location)
strtype)
(h5tinsert result "Temperature (F)"
(cffi:foreign-slot-offset '(:struct sensor-t)
'temperature)
+H5T-NATIVE-DOUBLE+)
(h5tinsert result "Pressure (inHg)"
(cffi:foreign-slot-offset '(:struct sensor-t) 'pressure)
+H5T-NATIVE-DOUBLE+)
(h5tclose strtype)
result)))
(let* ((sensortype (create-sensortype))
(result (h5tvlen-create sensortype)))
(h5tclose sensortype)
result)))
(cffi:defcenum color-t
:RED
:GREEN
:BLUE)
(defun create-colortype ()
(cffi:with-foreign-object (val 'color-t)
(let ((result (h5tenum-create +H5T-NATIVE-INT+)))
(setf (cffi:mem-ref val 'color-t) :RED)
(h5tenum-insert result "Red" val)
(setf (cffi:mem-ref val 'color-t) :GREEN)
(h5tenum-insert result "Green" val)
(setf (cffi:mem-ref val 'color-t) :BLUE)
(h5tenum-insert result "Blue" val)
result)))
(cffi:defcstruct vehicle-t
(sensors (:struct hvl-t))
(name :string)
(color color-t)
(location :double :count 3)
(group hobj-ref-t)
(surveyed-areas (:struct hdset-reg-ref-t)))
;;; Create the main compound datatype.
(defun create-vehicletype ()
(let ((result (h5tcreate :H5T-COMPOUND
(cffi:foreign-type-size '(:struct vehicle-t))))
(sensorstype (create-sensorstype))
(strtype (h5ex:create-c-string-type))
(colortype (create-colortype))
(loctype (cffi:with-foreign-object (adims 'hsize-t 3)
(setf (cffi:mem-aref adims 'hsize-t 0) 3)
(h5tarray-create2 +H5T-NATIVE-DOUBLE+ 1 adims))))
(h5tinsert result "Sensors"
(cffi:foreign-slot-offset '(:struct vehicle-t) 'sensors)
sensorstype)
(h5tinsert result "Name"
(cffi:foreign-slot-offset '(:struct vehicle-t) 'name)
strtype)
(h5tinsert result "Color"
(cffi:foreign-slot-offset '(:struct vehicle-t) 'color)
colortype)
(h5tinsert result "Location"
(cffi:foreign-slot-offset '(:struct vehicle-t) 'location)
loctype)
(h5tinsert result "Group"
(cffi:foreign-slot-offset '(:struct vehicle-t) 'group)
+H5T-STD-REF-OBJ+)
(h5tinsert result "Surveyed areas"
(cffi:foreign-slot-offset '(:struct vehicle-t) 'surveyed-areas)
+H5T-STD-REF-DSETREG+)
(h5ex:close-handles (list loctype colortype strtype sensorstype))
result))
(defun create-rsensorstype ()
(flet ((create-rsensortype ()
(let ((result (h5tcreate :H5T-COMPOUND
(cffi:foreign-type-size '(:pointer :char))))
(strtype (h5ex:create-c-string-type)))
(h5tinsert result "Location" 0 strtype)
(h5tclose strtype)
result)))
(let* ((rsensortype (create-rsensortype))
(result (h5tvlen-create rsensortype)))
(h5tclose rsensortype)
result)))
(cffi:defcstruct rvehicle-t
(sensors (:struct hvl-t))
(name :string))
;;; Create the nested compound datatype for reading. Even though it
;;; has only one field, it must still be defined as a compound type
;;; so the library can match the correct field in the file type.
;;; This matching is done by name. However, we do not need to
;;; define a structure for the read buffer as we can simply treat it
;;; as a char *.
(defun create-rvehicletype ()
(let ((result (h5tcreate :H5T-COMPOUND
(cffi:foreign-type-size '(:struct rvehicle-t))))
(strtype (h5ex:create-c-string-type))
(rsensorstype (create-rsensorstype)))
(h5tinsert result "Sensors"
(cffi:foreign-slot-offset '(:struct rvehicle-t) 'sensors)
rsensorstype)
(h5tinsert result "Name"
(cffi:foreign-slot-offset '(:struct rvehicle-t) 'name)
strtype)
(h5ex:close-handles (list rsensorstype strtype))
result))
(cffi:with-foreign-objects
((adims2 'hsize-t 2)
(start 'hsize-t 2)
(count 'hsize-t 2)
(coords 'hsize-t (* 3 2))
(wdata '(:struct vehicle-t) 2)
(wdata2 :double (* 32 32)))
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl)))
(ptrA (cffi:foreign-alloc '(:struct sensor-t) :count *LENA*))
(ptrB (cffi:foreign-alloc '(:struct sensor-t) :count *LENB*)))
(unwind-protect
(progn
;; create a dataset to use for region references
(dotimes (i 32)
(dotimes (j 32)
(setf (cffi:mem-aref wdata2 :double (+ (* i 32) j))
(+ 70.0d0
(* 0.1d0 (- i 16.0d0))
(* 0.1d0 (- j 16.0d0))))))
(let* ((shape (prog2 (setf (cffi:mem-aref adims2 'hsize-t 0) 32
(cffi:mem-aref adims2 'hsize-t 1) 32)
(h5screate-simple 2 adims2 +NULL+)))
(dset (h5dcreate2 file "Ambient_Temperature"
+H5T-NATIVE-DOUBLE+ shape
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5dwrite dset +H5T-NATIVE-DOUBLE+ +H5S-ALL+ +H5S-ALL+
+H5P-DEFAULT+ wdata2)
(h5ex:close-handles (list dset shape)))
;; create groups to use for object references
(h5ex:close-handles (list (h5gcreate2 file "Land_Vehicles"
+H5P-DEFAULT+ +H5P-DEFAULT+
+H5P-DEFAULT+)
(h5gcreate2 file "Air_Vehicles"
+H5P-DEFAULT+ +H5P-DEFAULT+
+H5P-DEFAULT+)))
(let ((sensors-ptr
(cffi:foreign-slot-pointer
(cffi:mem-aptr wdata '(:struct vehicle-t) 0)
'(:struct vehicle-t) 'sensors))
(ptr[0] (cffi:mem-aptr ptrA '(:struct sensor-t) 0))
(ptr[1] (cffi:mem-aptr ptrA '(:struct sensor-t) 1))
(ptr[2] (cffi:mem-aptr ptrA '(:struct sensor-t) 2))
(ptr[3] (cffi:mem-aptr ptrA '(:struct sensor-t) 3)))
;; Initialize variable-length compound in the first data element.
(cffi:with-foreign-slots ((len p) sensors-ptr (:struct hvl-t))
(setf len *LENA* p ptrA))
(cffi:with-foreign-slots ((serial-no location temperature pressure)
ptr[0] (:struct sensor-t))
(setf serial-no 1153 location "Exterior (static)"
temperature 53.23d0 pressure 24.57d0))
(cffi:with-foreign-slots ((serial-no location temperature pressure)
ptr[1] (:struct sensor-t))
(setf serial-no 1184 location "Intake"
temperature 55.12d0 pressure 22.95d0))
(cffi:with-foreign-slots ((serial-no location temperature pressure)
ptr[2] (:struct sensor-t))
(setf serial-no 1027 location "Intake manifold"
temperature 103.55d0 pressure 31.23d0))
(cffi:with-foreign-slots ((serial-no location temperature pressure)
ptr[3] (:struct sensor-t))
(setf serial-no 1313 location "Exhaust manifold"
temperature 1252.89d0 pressure 84.11d0)))
;; Initialize other fields in the first data element.
(let ((wdata[0] (cffi:mem-aptr wdata '(:struct vehicle-t) 0))
(shape (prog2 (setf (cffi:mem-aref adims2 'hsize-t 0) 32
(cffi:mem-aref adims2 'hsize-t 1) 32)
(h5screate-simple 2 adims2 +NULL+))))
(cffi:with-foreign-slots ((name color location)
wdata[0] (:struct vehicle-t))
(setf name "Airplane"
color :GREEN
(cffi:mem-aref location :double 0) -103234.21d0
(cffi:mem-aref location :double 1) 422638.78d0
(cffi:mem-aref location :double 2) 5996.43d0))
(h5rcreate (cffi:foreign-slot-pointer
wdata[0] '(:struct vehicle-t) 'group)
file "Air_Vehicles" :H5R-OBJECT -1)
(h5sselect-elements shape :H5S-SELECT-SET 3 coords)
(h5rcreate (cffi:foreign-slot-pointer
wdata[0] '(:struct vehicle-t) 'surveyed-areas)
file "Ambient_Temperature" :H5R-DATASET-REGION shape)
(h5sclose shape))
;; Initialize variable-length compound in the second data element.
(let ((sensors-ptr
(cffi:foreign-slot-pointer
(cffi:mem-aptr wdata '(:struct vehicle-t) 1)
'(:struct vehicle-t) 'sensors))
(ptr[0] (cffi:mem-aptr ptrB '(:struct sensor-t) 0)))
(cffi:with-foreign-slots ((len p) sensors-ptr (:struct hvl-t))
(setf len *LENB* p ptrB))
(cffi:with-foreign-slots ((serial-no location temperature pressure)
ptr[0] (:struct sensor-t))
(setf serial-no 3244 location "Roof"
temperature 83.82d0 pressure 29.92d0)))
;; Initialize other fields in the second data element.
(let ((wdata[1] (cffi:mem-aptr wdata '(:struct vehicle-t) 1))
(shape (prog2 (setf (cffi:mem-aref adims2 'hsize-t 0) 32
(cffi:mem-aref adims2 'hsize-t 1) 32)
(h5screate-simple 2 adims2 +NULL+))))
(cffi:with-foreign-slots ((name color location)
wdata[1] (:struct vehicle-t))
(setf name "Automobile"
color :RED
(cffi:mem-aref location :double 0) 326734.36d0
(cffi:mem-aref location :double 1) 221568.23d0
(cffi:mem-aref location :double 2) 432.36d0))
(h5rcreate (cffi:foreign-slot-pointer
wdata[1] '(:struct vehicle-t) 'group)
file "Land_Vehicles" :H5R-OBJECT -1)
(setf (cffi:mem-aref start 'hsize-t 0) 8
(cffi:mem-aref start 'hsize-t 1) 26
(cffi:mem-aref count 'hsize-t 0) 4
(cffi:mem-aref count 'hsize-t 1) 3)
(h5sselect-hyperslab shape :H5S-SELECT-SET start +NULL+
count +NULL+)
(h5rcreate (cffi:foreign-slot-pointer wdata[1] '(:struct vehicle-t)
'surveyed-areas)
file "Ambient_Temperature" :H5R-DATASET-REGION shape)
(h5sclose shape))
(let* ((vehicletype (create-vehicletype))
;; Create dataset with a null dataspace. to serve as the
;; parent for the attribute.
(dspace (h5ex:create-null-dataspace))
(dset (h5dcreate2 file *DATASET* +H5T-STD-I32LE+ dspace
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+))
(aspace (h5ex:create-simple-dataspace `(,*DIM0*)))
;; Create the attribute and write the compound data to it.
(attr (h5acreate2 dset *ATTRIBUTE* vehicletype aspace
+H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5awrite attr vehicletype wdata)
(h5ex:close-handles (list attr aspace dset dspace vehicletype))))
(cffi:foreign-free ptrB)
(cffi:foreign-free ptrA)
(h5ex:close-handles (list file fapl)))))
(cffi:with-foreign-objects
((ndims 'hsize-t 1)
(dims 'hsize-t 1))
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(attr (h5aopen dset *ATTRIBUTE* +H5P-DEFAULT+))
(rvehicletype (create-rvehicletype))
(space (h5aget-space attr)))
(setf (cffi:mem-ref ndims 'hsize-t 0)
(h5sget-simple-extent-dims space dims +NULL+))
;; Allocate memory for read buffer.
(let ((rdata (cffi:foreign-alloc '(:struct rvehicle-t)
:count (cffi:mem-aref dims
'hsize-t 0))))
;; Read the data.
(h5aread attr rvehicletype rdata)
;; Output the data to the screen.
(dotimes (i *DIM0*)
(let* ((rdata-ptr
(cffi:mem-aptr rdata '(:struct rvehicle-t) i))
(rdata-sensors-ptr
(cffi:foreign-slot-pointer
rdata-ptr '(:struct rvehicle-t) 'sensors)))
(format t "~a[~d]:~%" *ATTRIBUTE* i)
(format t " Vehicle name :~% ~a~%"
(cffi:foreign-slot-value
rdata-ptr '(:struct rvehicle-t) 'name))
(format t " Sensor locations :~%")
(dotimes (j (cffi:foreign-slot-value
rdata-sensors-ptr '(:struct hvl-t) 'len))
(format t " ~a~%"
(cffi:mem-ref
(cffi:mem-aptr
(cffi:foreign-slot-value
rdata-sensors-ptr '(:struct hvl-t) 'p)
:pointer j)
:string)))))
;; Close and release resources. H5Dvlen_reclaim will
;; automatically traverse the structure and free any vlen
;; data (including strings).
(h5dvlen-reclaim rvehicletype space +H5P-DEFAULT+ rdata)
(cffi:foreign-free rdata))
(h5ex:close-handles (list space rvehicletype attr dset)))
(h5ex:close-handles (list file fapl)))))
| 14,563 | Common Lisp | .lisp | 334 | 36.757485 | 105 | 0.64121 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | c6503de34c113542823820d20efe693dd0127817917e7db02c14d4647f26dd6f | 1,542 | [
-1
] |
1,543 | h5ex-t-convert.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-convert.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to convert between different
;;; datatypes in memory. The program converts DIM0 elements
;;; of compound type sourcetype to desttype, then outputs the
;;; converted data to the screen. A background buffer is used
;;; to fill in the elements of desttype that are not in
;;; sourcetype.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_convert.c
(in-package :hdf5)
(defparameter *DIM0* 4)
(cffi:defcstruct reading-t
(temperature :double)
(pressure :double))
(cffi:defcstruct sensor-t
(serial-no :int)
(location :string)
(temperature :double)
(pressure :double))
(defun create-reading-memtype ()
(let ((result (h5tcreate :H5T-COMPOUND
(cffi:foreign-type-size '(:struct reading-t)))))
(h5tinsert result "Temperature (F)"
(cffi:foreign-slot-offset '(:struct reading-t) 'temperature)
+H5T-NATIVE-DOUBLE+)
(h5tinsert result "Pressure (inHg)"
(cffi:foreign-slot-offset '(:struct reading-t) 'pressure)
+H5T-NATIVE-DOUBLE+)
result))
(defun create-sensor-memtype ()
(let ((strtype (h5ex:create-c-string-type))
(result (h5tcreate :H5T-COMPOUND
(cffi:foreign-type-size '(:struct sensor-t)))))
(h5tinsert result "Serial number"
(cffi:foreign-slot-offset '(:struct sensor-t) 'serial-no)
+H5T-NATIVE-INT+)
(h5tinsert result "Location"
(cffi:foreign-slot-offset '(:struct sensor-t) 'location)
strtype)
(h5tinsert result "Temperature (F)"
(cffi:foreign-slot-offset '(:struct sensor-t) 'temperature)
+H5T-NATIVE-DOUBLE+)
(h5tinsert result "Pressure (inHg)"
(cffi:foreign-slot-offset '(:struct sensor-t) 'pressure)
+H5T-NATIVE-DOUBLE+)
(h5tclose strtype)
result))
(cffi:with-foreign-objects ((reading '(:struct sensor-t) *DIM0*)
(bkgrd '(:struct sensor-t) *DIM0*))
;; Initialize data.
(let ((bkgrd[0] (cffi:mem-aptr bkgrd '(:struct sensor-t) 0))
(bkgrd[1] (cffi:mem-aptr bkgrd '(:struct sensor-t) 1))
(bkgrd[2] (cffi:mem-aptr bkgrd '(:struct sensor-t) 2))
(bkgrd[3] (cffi:mem-aptr bkgrd '(:struct sensor-t) 3))
(reading[0] (cffi:mem-aptr reading '(:struct reading-t) 0))
(reading[1] (cffi:mem-aptr reading '(:struct reading-t) 1))
(reading[2] (cffi:mem-aptr reading '(:struct reading-t) 2))
(reading[3] (cffi:mem-aptr reading '(:struct reading-t) 3)))
(cffi:with-foreign-slots ((serial-no location temperature pressure)
bkgrd[0] (:struct sensor-t))
(setf serial-no 1153 location "Exterior (static)"
temperature 53.23d0 pressure 24.57d0))
(cffi:with-foreign-slots ((serial-no location temperature pressure)
bkgrd[1] (:struct sensor-t))
(setf serial-no 1184 location "Intake"
temperature 55.12d0 pressure 22.95d0))
(cffi:with-foreign-slots ((serial-no location temperature pressure)
bkgrd[2] (:struct sensor-t))
(setf serial-no 1027 location "Intake manifold"
temperature 103.55d0 pressure 31.23d0))
(cffi:with-foreign-slots ((serial-no location temperature pressure)
bkgrd[3] (:struct sensor-t))
(setf serial-no 1313 location "Exhaust manifold"
temperature 1252.89d0 pressure 84.11d0))
(cffi:with-foreign-slots ((temperature pressure)
reading[0] (:struct reading-t))
(setf temperature 54.84d0 pressure 24.76d0))
(cffi:with-foreign-slots ((temperature pressure)
reading[1] (:struct reading-t))
(setf temperature 56.63d0 pressure 23.10d0))
(cffi:with-foreign-slots ((temperature pressure)
reading[2] (:struct reading-t))
(setf temperature 102.69d0 pressure 30.97d0))
(cffi:with-foreign-slots ((temperature pressure)
reading[3] (:struct reading-t))
(setf temperature 1238.27d0 pressure 82.15d0)))
(let ((sourcetype (create-reading-memtype))
(desttype (create-sensor-memtype)))
;; Convert the buffer in reading from sourcetype to desttype.
;; After this conversion we will use sensor to access the buffer,
;; as the buffer now matches its type.
(h5tconvert sourcetype desttype *DIM0* reading bkgrd +H5P-DEFAULT+)
;; Output the data to the screen.
(dotimes (i *DIM0*)
(format t "sensor[~d]:~%" i)
(let ((sensor[i] (cffi:mem-aptr reading '(:struct sensor-t) i)))
(cffi:with-foreign-slots ((serial-no location temperature pressure)
sensor[i] (:struct sensor-t))
(format t "Serial number : ~d~%" serial-no)
(format t "Location : ~a~%" location)
(format t "Temperature (F) : ~6$~%" temperature)
(format t "Pressure (inHg) : ~6$~%~%" pressure))))
(h5ex:close-handles (list desttype sourcetype))))
| 5,289 | Common Lisp | .lisp | 110 | 41.518182 | 102 | 0.660968 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 08c739ae9d9223d78a47d0f3377c054a44f9333f3cf88bdd631e16181a480dda | 1,543 | [
-1
] |
1,544 | h5ex-t-bitatt.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-bitatt.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write bitfield
;;; datatypes to an attribute. The program first writes bit
;;; fields to an attribute with a dataspace of DIM0xDIM1, then
;;; closes the file. Next, it reopens the file, reads back
;;; the data, and outputs it to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_bitatt.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_t_bitatt.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *ATTRIBUTE* "A1")
(defparameter *DIM0* 4)
(defparameter *DIM1* 7)
(defun pos (cols i j)
"2D array position"
(+ (* i cols) j))
(cffi:with-foreign-objects
((dims 'hsize-t 2)
(wdata :unsigned-char (* *DIM0* *DIM1*)))
(setf (cffi:mem-aref dims 'hsize-t 0) *DIM0*
(cffi:mem-aref dims 'hsize-t 1) *DIM1*)
;; Initialize data. We will manually pack 4 2-bit integers into
;; each unsigned char data element.
(flet ((ABCD (i j)
(logior
(logior
(logior
(logior 0 (logand (- (* i j) j) #x03)) ; field "A"
(ash (logand i #x03) 2)) ; field "B"
(ash (logand j #x03) 4)) ; field "C"
(ash (logand (+ i j) #x03) 6)))) ; field "D"
(dotimes (i *DIM0*)
(dotimes (j *DIM1*)
(setf (cffi:mem-aref wdata :unsigned-char (pos *DIM1* i j))
(ABCD i j)))))
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
;; Create dataset with null dataspace.
(let* ((dspace (h5ex:create-null-dataspace))
(dset (h5dcreate2 file *DATASET* +H5T-STD-I32LE+ dspace
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+))
(aspace (h5ex:create-simple-dataspace `(,*DIM0* ,*DIM1*)))
;; Create the attribute and write the bitfield data to it.
(attr (h5acreate2 dset *ATTRIBUTE* +H5T-STD-B8BE+ aspace
+H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5awrite attr +H5T-NATIVE-B8+ wdata)
;; Close and release resources.
(h5ex:close-handles (list attr aspace dset dspace)))
(h5ex:close-handles (list file fapl))))
;; Now we begin the read section of this example. Here we assume
;; the dataset and array have the same name and rank, but can
;; have any size. Therefore we must allocate a new array to read
;; in data dynamically.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(attr (h5aopen dset *ATTRIBUTE* +H5P-DEFAULT+))
(space (h5aget-space attr)))
;; Get dataspace and allocate memory for read buffer.
(h5sget-simple-extent-dims space dims +NULL+)
(let ((dims[0] (cffi:mem-aref dims 'hsize-t 0))
(dims[1] (cffi:mem-aref dims 'hsize-t 1)))
(cffi:with-foreign-object (rdata :unsigned-char
(* dims[0] dims[1]))
;; Read the data.
(h5aread attr +H5T-NATIVE-B8+ rdata)
;; Output the data to the screen.
(flet ((ABCD (x)
(values (logand x #x03)
(logand (ash x -2) #x03)
(logand (ash x -4) #x03)
(logand (ash x -6) #x03))))
(format t "~a:~%" *ATTRIBUTE*)
(dotimes (i *DIM0*)
(format t " [")
(dotimes (j *DIM1*)
(multiple-value-bind (A B C D)
(ABCD (cffi:mem-aref rdata :unsigned-char
(pos *DIM1* i j)))
(format t " {~a, ~a, ~a, ~a}" A B C D)))
(format t " ]~%")))))
;; Close and release resources.
(h5ex:close-handles (list space attr dset)))
(h5ex:close-handles (list file fapl)))))
| 4,301 | Common Lisp | .lisp | 97 | 38.556701 | 101 | 0.623653 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 9ed6d85d9709d4ca199ef78465139eae08dd4da6df212ab4115f0f286d23a401 | 1,544 | [
-1
] |
1,545 | h5ex-t-string.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-string.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write string datatypes
;;; to a dataset. The program first writes strings to a
;;; dataset with a dataspace of DIM0, then closes the file.
;;; Next, it reopens the file, reads back the data, and
;;; outputs it to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_string.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_t_string.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *DIM0* 4)
(defparameter *SDIM* 8)
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((wdata (cffi:foreign-string-alloc
"Parting is such sweet sorrow. "))
(space (h5ex:create-simple-dataspace `(,*DIM0*)))
;; Create file and memory datatypes. For this example we will save
;; the strings as FORTRAN strings, therefore they do not need
;; space for the null terminator in the file.
(filetype (h5ex:create-f-string-type (1- *SDIM*)))
(memtype (h5ex:create-c-string-type *SDIM*))
;; Create the dataset and write the array data to it.
(dset (h5dcreate2 file *DATASET* filetype space
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5dwrite dset memtype +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+ wdata)
;; Close and release resources.
(h5ex:close-handles (list memtype filetype dset space))
(cffi:foreign-string-free wdata))
(h5ex:close-handles (list file fapl))))
;; Now we begin the read section of this example. Here we assume
;; the dataset has the same name and rank, but can have any size.
;; Therefore we must allocate a new array to read in data dynamically.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
;; Get the datatype and its size.
(filetype (h5dget-type dset))
(sdim (1+ (h5tget-size filetype)))
(memtype (h5ex:create-c-string-type sdim))
(space (h5dget-space dset)))
(cffi:with-foreign-object (dims 'hsize-t 1)
(h5sget-simple-extent-dims space dims +NULL+)
(let ((dims[0] (cffi:mem-aref dims 'hsize-t 0)))
;; Allocate space for character data.
(cffi:with-foreign-object (rdata :char (* dims[0] sdim))
;; Read the data.
(h5dread dset memtype +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+ rdata)
;; Output the data to the screen.
(dotimes (i dims[0])
(format t "~a[~d]: ~a~%" *DATASET* i
(cffi:foreign-string-to-lisp
(cffi:mem-aptr rdata :char (* i sdim))))))))
;; Close and release resources.
(h5ex:close-handles (list space memtype filetype dset)))
(h5ex:close-handles (list file fapl))))
| 3,737 | Common Lisp | .lisp | 69 | 44.971014 | 101 | 0.620897 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 4ef42b9b4c1e4bae054483944d3cc98c622571e6d9382a3ce2d6a552059e1aa7 | 1,545 | [
-1
] |
1,546 | h5ex-t-array.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-array.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write array datatypes
;;; to a dataset. The program first writes integers arrays of
;;; dimension ADIM0xADIM1 to a dataset with a dataspace of
;;; DIM0, then closes the file. Next, it reopens the file,
;;; reads back the data, and outputs it to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_array.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_t_array.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *DIM0* 4)
(defparameter *ADIM0* 3)
(defparameter *ADIM1* 5)
(defun pos (rows cols i j k)
"3D array position"
(+ (* (+ (* i rows) j) cols) k))
(cffi:with-foreign-objects
((dims 'hsize-t 1)
(adims 'hsize-t 2)
(wdata :int (* *DIM0* *ADIM0* *ADIM1*)))
(setf (cffi:mem-aref dims 'hsize-t 0) *DIM0*
(cffi:mem-aref adims 'hsize-t 0) *ADIM0*
(cffi:mem-aref adims 'hsize-t 1) *ADIM1*)
;; Initialize data. i is the element in the dataspace, j and k the
;; elements within the array datatype.
(dotimes (i *DIM0*)
(dotimes (j *ADIM0*)
(dotimes (k *ADIM1*)
(setf (cffi:mem-aref wdata :int (pos *ADIM0* *ADIM1* i j k))
(+ (* i j) (- (* j k)) (* i k))))))
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
;; Create array datatypes for file and memory.
(let* ((filetype (h5tarray-create2 +H5T-STD-I64LE+ 2 adims))
(memtype (h5tarray-create2 +H5T-NATIVE-INT+ 2 adims))
;; Create dataspace. Setting maximum size to NULL sets the
;; maximum size to be the current size.
(space (h5ex:create-simple-dataspace `(,*DIM0*)))
;; Create the dataset and write the array data to it.
(dset (h5dcreate2 file *DATASET* filetype space +H5P-DEFAULT+
+H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5dwrite dset memtype +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+ wdata)
;; Close and release resources.
(h5ex:close-handles (list dset space memtype filetype)))
(h5ex:close-handles (list file fapl))))
;; Now we begin the read section of this example. Here we assume
;; the dataset and array have the same name and rank, but can
;; have any size. Therefore we must allocate a new array to read
;; in data dynamically.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(filetype (h5dget-type dset))
(space (h5dget-space dset)))
;; Get the array datatype dimensions.
(h5tget-array-dims2 filetype adims)
;; Get dataspace and allocate memory for read buffer.
(h5sget-simple-extent-dims space dims +NULL+)
;; Allocate space for integer data.
(let ((dims[0] (cffi:mem-aref dims 'hsize-t 0))
(adims[0] (cffi:mem-aref adims 'hsize-t 0))
(adims[1] (cffi:mem-aref adims 'hsize-t 1))
;; Create the memory datatype.
(memtype (h5tarray-create2 +H5T-NATIVE-INT+ 2 adims)))
(cffi:with-foreign-object (rdata :int (* dims[0] adims[0]
adims[1]))
;; Read the data.
(h5dread dset memtype +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+ rdata)
;; Output the data to the screen.
(dotimes (i *DIM0*)
(format t "~a[~a]:~%" *DATASET* i)
(dotimes (j *ADIM0*)
(format t " [")
(dotimes (k *ADIM1*)
(format t " ~3d" (cffi:mem-aref rdata :int
(pos *ADIM0* *ADIM1*
i j k))))
(format t "]~%"))
(format t "~%"))
(h5tclose memtype)))
;; Close and release resources.
(h5ex:close-handles (list space filetype dset)))
(h5ex:close-handles (list file fapl)))))
| 4,321 | Common Lisp | .lisp | 96 | 40.291667 | 100 | 0.657463 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | def406b764079a1f8b9b809005718139758693889ffaa27f28b811bed4ade7a4 | 1,546 | [
-1
] |
1,547 | h5ex-t-arrayatt.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-arrayatt.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write array datatypes
;;; to an attribute. The program first writes integers arrays
;;; of dimension ADIM0xADIM1 to an attribute with a dataspace
;;; of DIM0, then closes the file. Next, it reopens the
;;; file, reads back the data, and outputs it to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_arrayatt.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_t_arrayatt.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *ATTRIBUTE* "A1")
(defparameter *DIM0* 4)
(defparameter *ADIM0* 3)
(defparameter *ADIM1* 5)
(defun pos (rows cols i j k)
"3D array position"
(+ (* (+ (* i rows) j) cols) k))
(cffi:with-foreign-objects
((dims 'hsize-t 1)
(adims 'hsize-t 2)
(wdata :int (* *DIM0* *ADIM0* *ADIM1*)))
(setf (cffi:mem-aref adims 'hsize-t 0) *ADIM0*
(cffi:mem-aref adims 'hsize-t 1) *ADIM1*
(cffi:mem-aref dims 'hsize-t 0) *DIM0*)
;; Initialize data. i is the element in the dataspace, j and k the
;; elements within the array datatype.
(dotimes (i *DIM0*)
(dotimes (j *ADIM0*)
(dotimes (k *ADIM1*)
(setf (cffi:mem-aref wdata :int (pos *ADIM0* *ADIM1* i j k))
(+ (* i j) (- (* j k)) (* i k))))))
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
;; Create array datatypes for file and memory.
(let* ((filetype (h5tarray-create2 +H5T-STD-I64LE+ 2 adims))
(memtype (h5tarray-create2 +H5T-NATIVE-INT+ 2 adims))
;; Create dataset with a null dataspace.
(dspace (h5ex:create-null-dataspace))
(dset (h5dcreate2 file *DATASET* +H5T-STD-I32LE+ dspace
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+))
(aspace (h5ex:create-simple-dataspace `(,*DIM0*)))
;; Create the attribute and write the array data to it.
(attr (h5acreate2 dset *ATTRIBUTE* filetype aspace
+H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5awrite attr memtype wdata)
(h5ex:close-handles (list attr aspace dset dspace memtype filetype)))
(h5ex:close-handles (list file fapl))))
;; Now we begin the read section of this example. Here we assume
;; the attribute and array have the same name and rank, but can
;; have any size. Therefore we must allocate a new array to read
;; in data dynamically.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(attr (h5aopen dset *ATTRIBUTE* +H5P-DEFAULT+))
(filetype (h5aget-type attr))
(space (h5aget-space attr)))
;; Get dataspace and allocate memory for read buffer.
(h5tget-array-dims2 filetype adims)
(h5sget-simple-extent-dims space dims +NULL+)
;; Allocate space for integer data.
(let ((dims[0] (cffi:mem-aref dims 'hsize-t 0))
(adims[0] (cffi:mem-aref adims 'hsize-t 0))
(adims[1] (cffi:mem-aref adims 'hsize-t 1))
;; Create the memory datatype.
(memtype (h5tarray-create2 +H5T-NATIVE-INT+ 2 adims)))
(cffi:with-foreign-object (rdata :int (* dims[0] adims[0]
adims[1]))
;; Read the data.
(h5aread attr memtype rdata)
;; Output the data to the screen.
(dotimes (i *DIM0*)
(format t "~a[~a]:~%" *ATTRIBUTE* i)
(dotimes (j *ADIM0*)
(format t " [")
(dotimes (k *ADIM1*)
(format t " ~3d" (cffi:mem-aref rdata :int
(pos *ADIM0* *ADIM1*
i j k))))
(format t "]~%"))
(format t "~%"))
(h5tclose memtype)))
;; Close and release resources.
(h5ex:close-handles (list space filetype attr dset)))
(h5ex:close-handles (list file fapl)))))
| 4,472 | Common Lisp | .lisp | 98 | 39.938776 | 103 | 0.644909 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 31f91c06b71e1ca61fbcefbe529705887e55e14f30d4a7c93e50ce5a92640bac | 1,547 | [
-1
] |
1,548 | h5ex-t-vlstringatt.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-vlstringatt.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; help @hdfgroup.org.
;;; This example shows how to read and write variable-length
;;; string datatypes to a dataset. The program first writes
;;; variable-length strings to a dataset with a dataspace of
;;; DIM0, then closes the file. Next, it reopens the file,
;;; reads back the data, and outputs it to the screen.
;;; See h5ex_t_vlstring.c at http://www.hdfgroup.org/HDF5/examples/api18-c.html
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_t_vlstring.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *ATTRIBUTE* "A1")
(defparameter *DIM0* 4)
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((wdata (cffi:foreign-alloc
:string :initial-contents
'("Parting" "is such" "sweet" "sorrow")))
(filetype (h5ex:create-f-string-type))
(memtype (h5ex:create-c-string-type))
(dshape (h5ex:create-null-dataspace))
(ashape (h5ex:create-simple-dataspace `(,*DIM0*)))
;; Create dataset with a null dataspace.
(dset (h5dcreate2 file *DATASET* +H5T-STD-I32LE+ dshape
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+))
;; Create the attribute and write the variable-length string data
;; to it.
(attr (h5acreate2 dset *ATTRIBUTE* filetype ashape +H5P-DEFAULT+
+H5P-DEFAULT+)))
(h5awrite attr memtype wdata)
;; Close and release resources.
(h5ex:close-handles (list attr dset ashape dshape memtype filetype))
(cffi:foreign-free wdata))
(h5ex:close-handles (list file fapl))))
;; Now we begin the read section of this example. Here we assume
;; the attribute has the same name and rank, but can have any size.
;; Therefore we must allocate a new array to read in data dynamically.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(attr (h5aopen dset *ATTRIBUTE* +H5P-DEFAULT+))
(shape (h5aget-space attr))
(memtype (h5ex:create-c-string-type)))
(cffi:with-foreign-object (dims 'hsize-t 1)
(h5sget-simple-extent-dims shape dims +NULL+)
(let ((dims[0] (cffi:mem-aref dims 'hsize-t 0)))
(cffi:with-foreign-object (rdata '(:pointer :char) dims[0])
;; Read the data.
(h5aread attr memtype rdata)
;; Output the data to the screen.
(dotimes (i dims[0])
(format t "~a[~s]: ~a~%" *ATTRIBUTE* i
(cffi:foreign-string-to-lisp
(cffi:mem-aref rdata '(:pointer :char) i))))
;; Close and release resources. Note that H5Dvlen_reclaim works
;; for variable-length strings as well as variable-length arrays.
;; H5Tvlen_reclaim only frees the data these point to.
(h5dvlen-reclaim memtype shape +H5P-DEFAULT+ rdata))))
(h5ex:close-handles (list memtype shape attr dset))
(h5ex:close-handles (list file fapl)))))
| 3,895 | Common Lisp | .lisp | 71 | 44.309859 | 89 | 0.610178 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | e99078ae33b3843543806d6dc41598a09c73b949f81f12cffde58881777c08aa | 1,548 | [
-1
] |
1,549 | h5ex-t-commit.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-commit.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to commit a named datatype to a
;;; file, and read back that datatype. The program first
;;; defines a compound datatype, commits it to a file, then
;;; closes the file. Next, it reopens the file, opens the
;;; datatype, and outputs the names of its fields to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_commit.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_t_commit.h5" *load-pathname*)))
(defparameter *DATATYPE* "Sensor_Type")
(defun create-filetype ()
;; Create the compound datatype. Because the standard types we are
;; using may have different sizes than the corresponding native
;; types, we must manually calculate the offset of each member.
(let ((strtype (h5ex:create-c-string-type))
(result (h5tcreate :H5T-COMPOUND
(+ 8 (cffi:foreign-type-size '(:struct hvl-t)) 8
8))))
(h5tinsert result "Serial number" 0 +H5T-STD-I64BE+)
(h5tinsert result "Location" 8 strtype)
(h5tinsert result "Temperature (F)" (+ 8 (cffi:foreign-type-size
'(:struct hvl-t)))
+H5T-IEEE-F64BE+)
(h5tinsert result "Pressure (inHg)" (+ 8 (cffi:foreign-type-size
'(:struct hvl-t))
8)
+H5T-IEEE-F64BE+)
(h5tclose strtype)
result))
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((filetype (create-filetype)))
(h5tcommit2 file *DATATYPE* filetype +H5P-DEFAULT+ +H5P-DEFAULT+
+H5P-DEFAULT+)
;; Close and release resources.
(h5tclose filetype))
(h5ex:close-handles (list file fapl))))
;; Now we begin the read section of this example.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((filetype (h5topen2 file *DATATYPE* +H5P-DEFAULT+))
(typeclass (h5tget-class filetype)))
;; Output the data to the screen.
(format t "Named datatype ~a:~%" *DATATYPE*)
(if (equal typeclass :H5T-COMPOUND)
(progn
(format t " Class: H5T_COMPOUND~%")
(let ((nmembs (h5tget-nmembers filetype)))
(dotimes (i nmembs)
;; Get the member name and print it. Note that
;; H5Tget_member_name allocates space for the string in
;; name, so we must free() it after use.
(let ((name (h5tget-member-name filetype i)))
(format t " ~a~%" (cffi:foreign-string-to-lisp name))
(cffi:foreign-free name))))))
(h5tclose filetype))
(h5ex:close-handles (list file fapl))))
| 3,466 | Common Lisp | .lisp | 70 | 41.242857 | 101 | 0.626777 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 763ca3bae2adefd605b840c88927bdc6958ae56b87804b41354d4ce097709a03 | 1,549 | [
-1
] |
1,550 | h5ex-t-cmpd.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-cmpd.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write compound
;;; datatypes to a dataset. The program first writes
;;; compound structures to a dataset with a dataspace of DIM0,
;;; then closes the file. Next, it reopens the file, reads
;;; back the data, and outputs it to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_cmpd.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_t_cmpd.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *DIM0* 4)
(cffi:defcstruct sensor-t
(serial-no :int)
(location :string)
(temperature :double)
(pressure :double))
(defun create-memtype ()
(let ((strtype (h5ex:create-c-string-type))
(result (h5tcreate :H5T-COMPOUND
(cffi:foreign-type-size '(:struct sensor-t)))))
(h5tinsert result "Serial number"
(cffi:foreign-slot-offset '(:struct sensor-t) 'serial-no)
+H5T-NATIVE-INT+)
(h5tinsert result "Location"
(cffi:foreign-slot-offset '(:struct sensor-t) 'location)
strtype)
(h5tinsert result "Temperature (F)"
(cffi:foreign-slot-offset '(:struct sensor-t) 'temperature)
+H5T-NATIVE-DOUBLE+)
(h5tinsert result "Pressure (inHg)"
(cffi:foreign-slot-offset '(:struct sensor-t) 'pressure)
+H5T-NATIVE-DOUBLE+)
(h5tclose strtype)
result))
(defun create-filetype ()
;; Create the compound datatype for the file. Because the
;; standard types we are using for the file may have different
;; sizes than the corresponding native types, we must manually
;; calculate the offset of each member.
(let ((strtype (h5ex:create-c-string-type))
(result (h5tcreate :H5T-COMPOUND
(+ 8 (cffi:foreign-type-size '(:struct hvl-t)) 8
8))))
(h5tinsert result "Serial number" 0 +H5T-STD-I64BE+)
(h5tinsert result "Location" 8 strtype)
(h5tinsert result "Temperature (F)" (+ 8 (cffi:foreign-type-size
'(:struct hvl-t)))
+H5T-IEEE-F64BE+)
(h5tinsert result "Pressure (inHg)" (+ 8 (cffi:foreign-type-size
'(:struct hvl-t))
8)
+H5T-IEEE-F64BE+)
(h5tclose strtype)
result))
(cffi:with-foreign-objects ((dims 'hsize-t 1)
(wdata '(:struct sensor-t) *DIM0*))
(setf (cffi:mem-aref dims 'hsize-t 0) *DIM0*)
;; Initialize data.
(let ((wdata[0] (cffi:mem-aptr wdata '(:struct sensor-t) 0))
(wdata[1] (cffi:mem-aptr wdata '(:struct sensor-t) 1))
(wdata[2] (cffi:mem-aptr wdata '(:struct sensor-t) 2))
(wdata[3] (cffi:mem-aptr wdata '(:struct sensor-t) 3)))
(cffi:with-foreign-slots ((serial-no location temperature pressure)
wdata[0] (:struct sensor-t))
(setf serial-no 1153 location "Exterior (static)" temperature 53.23d0
pressure 24.57d0))
(cffi:with-foreign-slots ((serial-no location temperature pressure)
wdata[1] (:struct sensor-t))
(setf serial-no 1184 location "Intake" temperature 55.12d0
pressure 22.95d0))
(cffi:with-foreign-slots ((serial-no location temperature pressure)
wdata[2] (:struct sensor-t))
(setf serial-no 1027 location "Intake manifold" temperature 103.55d0
pressure 31.23d0))
(cffi:with-foreign-slots ((serial-no location temperature pressure)
wdata[3] (:struct sensor-t))
(setf serial-no 1313 location "Exhaust manifold" temperature 1252.89d0
pressure 84.11d0)))
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((memtype (create-memtype))
(filetype (create-filetype))
;; Create dataspace. Setting maximum size to NULL sets the
;; maximum size to be the current size.
(space (h5ex:create-simple-dataspace `(,*DIM0*)))
;; Create the dataset and write the compound data to it.
(dset (h5dcreate2 file *DATASET* filetype space +H5P-DEFAULT+
+H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5dwrite dset memtype +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+ wdata)
;; Close and release resources.
(h5ex:close-handles (list dset space filetype memtype)))
(h5ex:close-handles (list file fapl)))))
;; Now we begin the read section of this example. Here we assume
;; the dataset has the same name and rank, but can have any size.
;; Therefore we must allocate a new array to read in data dynamicaly
(cffi:with-foreign-object (dims 'hsize-t 1)
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(space (h5dget-space dset))
(memtype (create-memtype)))
;; Get dataspace and allocate memory for read buffer.
(h5sget-simple-extent-dims space dims +NULL+)
(let* ((dims[0] (cffi:mem-aref dims 'hsize-t 0))
(rdata (cffi:foreign-alloc '(:struct sensor-t)
:count dims[0])))
(h5dread dset memtype +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+ rdata)
;; Output the data to the screen.
(dotimes (i dims[0])
(format t "~a[~a]:~%" *DATASET* i)
(cffi:with-foreign-slots ((serial-no location temperature
pressure)
(cffi:mem-aptr rdata
'(:struct sensor-t) i)
(:struct sensor-t))
(format t "Serial number : ~d~%" serial-no)
(format t "Location : ~a~%" location)
(format t "Temperature (F) : ~6$~%" temperature)
(format t "Pressure (inHg) : ~6$~%~%" pressure)))
(h5dvlen-reclaim memtype space +H5P-DEFAULT+ rdata)
(cffi:foreign-free rdata))
(h5ex:close-handles (list memtype space dset)))
(h5ex:close-handles (list file fapl)))))
| 6,250 | Common Lisp | .lisp | 136 | 40.647059 | 99 | 0.669845 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | d8d50af80ab6b0f6a8134528c2665533d7287d1c81c97998efd5a2525fc559c4 | 1,550 | [
-1
] |
1,551 | h5ex-t-objrefatt.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-objrefatt.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write object references
;;; to an attribute. The program first creates objects in the
;;; file and writes references to those objects to an
;;; attribute with a dataspace of DIM0, then closes the file.
;;; Next, it reopens the file, dereferences the references,
;;; and outputs the names of their targets to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_objrefatt.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_t_objrefatt.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *ATTRIBUTE* "A1")
(defparameter *DIM0* 2)
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(progn
(let ((space (h5ex:create-null-dataspace)))
(h5ex:close-handles
;; Create a dataset with a null dataspace.
(list (h5dcreate2 file "DS2" +H5T-STD-I32LE+ space
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+)
space
;; Create a goup.
(h5gcreate2 file "G1" +H5P-DEFAULT+ +H5P-DEFAULT+
+H5P-DEFAULT+))))
;; Create references to the previously created objects. Passing -1
;; as space_id causes this parameter to be ignored. Other values
;; besides valid dataspaces result in an error.
(cffi:with-foreign-object (wdata 'hobj-ref-t *DIM0*)
(let ((wdata[0] (cffi:mem-aptr wdata 'hobj-ref-t 0))
(wdata[1] (cffi:mem-aptr wdata 'hobj-ref-t 1)))
(h5rcreate wdata[0] file "G1" :H5R-OBJECT -1)
(h5rcreate wdata[1] file "DS2" :H5R-OBJECT -1))
;; Create dataset with a null dataspace to serve as the parent for
;; the attribute.
(let* ((dspace (h5ex:create-null-dataspace))
(dset (h5dcreate2 file *DATASET* +H5T-STD-I32LE+ dspace
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+))
(aspace (h5ex:create-simple-dataspace `(,*DIM0*)))
(attr (h5acreate2 dset *ATTRIBUTE* +H5T-STD-REF-OBJ+ aspace
+H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5awrite attr +H5T-STD-REF-OBJ+ wdata)
(h5ex:close-handles (list attr aspace dset dspace)))))
(h5ex:close-handles (list file fapl))))
;; Now we begin the read section of this example. Here we assume
;; the attribute has the same name and rank, but can have any size.
;; Therefore we must allocate a new array to read in data dynamically.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(attr (h5aopen dset *ATTRIBUTE* +H5P-DEFAULT+))
(space (h5aget-space attr)))
(cffi:with-foreign-object (dims 'hsize-t 1)
(h5sget-simple-extent-dims space dims +NULL+)
(let ((dims[0] (cffi:mem-aref dims 'hsize-t 0)))
;; Allocate space for integer data.
(cffi:with-foreign-object (rdata 'hobj-ref-t dims[0])
;; Read the data.
(h5aread attr +H5T-STD-REF-OBJ+ rdata)
;; Output the data to the screen.
(dotimes (i dims[0])
(format t "~a[~a]:~% ->" *ATTRIBUTE* i)
(let* ((ptr (cffi:mem-aptr rdata 'hobj-ref-t i))
(obj (if (= +H5-VERS-MINOR+ 8)
(h5rdereference dset :H5R-OBJECT ptr)
(h5rdereference dset +H5P-DEFAULT+ :H5R-OBJECT
ptr))))
(cffi:with-foreign-object (objtype 'h5o-type-t 1)
(h5rget-obj-type2 dset :H5R-OBJECT ptr objtype)
(let ((type (cffi:mem-ref objtype 'h5o-type-t)))
;; Print the object type and close the object.
(cond ((eql type :H5O-TYPE-GROUP) (format t "Group"))
((eql type :H5O-TYPE-DATASET)
(format t "Datatset"))
((eql type :H5O-TYPE-NAMED-DATATYPE)
(format t "Named Datatype")))
;; Get the length of the name, allocate space, then
;; retrieve the name.
(let* ((size (1+ (h5iget-name obj +NULL+ 0)))
(name (cffi:foreign-alloc :char :count size)))
(h5iget-name obj name size)
;; Print the name and deallocate space for the name.
(format t ": ~a~%" (cffi:foreign-string-to-lisp name))
(cffi:foreign-free name))
(h5oclose obj))))))))
;; Close and release resources.
(h5ex:close-handles (list space attr dset)))
(h5ex:close-handles (list file fapl))))
| 5,699 | Common Lisp | .lisp | 101 | 42.910891 | 104 | 0.565233 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 3bd454a8b1ec6466768effea8c5367234aedc36770ab4c75597cda661fd40783 | 1,551 | [
-1
] |
1,552 | h5ex-t-objref.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-objref.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write object references
;;; to a dataset. The program first creates objects in the
;;; file and writes references to those objects to a dataset
;;; with a dataspace of DIM0, then closes the file. Next, it
;;; reopens the file, dereferences the references, and outputs
;;; the names of their targets to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_objref.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_t_objref.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *DIM0* 2)
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let ((space (h5ex:create-null-dataspace)))
(h5ex:close-handles
;; Create a dataset with a null dataspace.
(list (h5dcreate2 file "DS2" +H5T-STD-I32LE+ space
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+)
space
;; Create a goup.
(h5gcreate2 file "G1" +H5P-DEFAULT+ +H5P-DEFAULT+
+H5P-DEFAULT+)))
;; Create references to the previously created objects. Passing -1
;; as space_id causes this parameter to be ignored. Other values
;; besides valid dataspaces result in an error.
(cffi:with-foreign-object (wdata 'hobj-ref-t *DIM0*)
(let ((wdata[0] (cffi:mem-aptr wdata 'hobj-ref-t 0))
(wdata[1] (cffi:mem-aptr wdata 'hobj-ref-t 1)))
(h5rcreate wdata[0] file "G1" :H5R-OBJECT -1)
(h5rcreate wdata[1] file "DS2" :H5R-OBJECT -1))
;; Create the dataset and write the object references to it.
(let* ((space (h5ex:create-simple-dataspace `(,*DIM0*)))
(dset (h5dcreate2 file *DATASET* +H5T-STD-REF-OBJ+ space
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5dwrite dset +H5T-STD-REF-OBJ+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
wdata)
(h5ex:close-handles (list dset space)))))
(h5ex:close-handles (list file fapl))))
;; Now we begin the read section of this example. Here we assume
;; the dataset has the same name and rank, but can have any size.
;; Therefore we must allocate a new array to read in data dynamically.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(space (h5dget-space dset)))
(cffi:with-foreign-object (dims 'hsize-t 1)
(h5sget-simple-extent-dims space dims +NULL+)
(let ((dims[0] (cffi:mem-aref dims 'hsize-t 0)))
;; Allocate space for integer data.
(cffi:with-foreign-object (rdata 'hobj-ref-t dims[0])
;; Read the data.
(h5dread dset +H5T-STD-REF-OBJ+ +H5S-ALL+ +H5S-ALL+
+H5P-DEFAULT+ rdata)
;; Output the data to the screen.
(dotimes (i dims[0])
(format t "~a[~a]:~% ->" *DATASET* i)
(let* ((ptr (cffi:mem-aptr rdata 'hobj-ref-t i))
(obj (if (= +H5-VERS-MINOR+ 8)
(h5rdereference dset :H5R-OBJECT ptr)
(h5rdereference dset +H5P-DEFAULT+ :H5R-OBJECT
ptr))))
(cffi:with-foreign-object (objtype 'h5o-type-t 1)
(h5rget-obj-type2 dset :H5R-OBJECT ptr objtype)
(let ((type (cffi:mem-ref objtype 'h5o-type-t)))
;; Print the object type and close the object.
(cond ((eql type :H5O-TYPE-GROUP) (format t "Group"))
((eql type :H5O-TYPE-DATASET)
(format t "Datatset"))
((eql type :H5O-TYPE-NAMED-DATATYPE)
(format t "Named Datatype")))
;; Get the length of the name, allocate space, then
;; retrieve the name.
(let* ((size (1+ (h5iget-name obj +NULL+ 0)))
(name (cffi:foreign-alloc :char :count size)))
(h5iget-name obj name size)
;; Print the name and deallocate space for the name.
(format t ": ~a~%" (cffi:foreign-string-to-lisp name))
(cffi:foreign-free name))
(h5oclose obj))))))))
;; Close and release resources.
(h5ex:close-handles (list space dset)))
(h5ex:close-handles (list file fapl))))
| 5,463 | Common Lisp | .lisp | 96 | 43.0625 | 101 | 0.559544 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 68a45c3766aed1f7a8cc5c3243583808ee808cfd65ec23b8056ef1f44b79543c | 1,552 | [
-1
] |
1,553 | h5ex-t-float.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-float.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write float datatypes
;;; to a dataset. The program first writes floats to a
;;; dataset with a dataspace of DIM0xDIM1, then closes the
;;; file. Next, it reopens the file, reads back the data, and
;;; outputs it to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_float.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_t_float.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *DIM0* 4)
(defparameter *DIM1* 7)
(defun pos (cols i j)
"2D array position"
(+ (* i cols) j))
(defun create-wdata (rows cols)
(let ((wdata (cffi::foreign-alloc :double :count (* rows cols))))
(dotimes (i rows)
(dotimes (j cols)
(setf (cffi:mem-aref wdata :double (pos cols i j))
(+ (/ i (+ j 0.5d0)) j))))
wdata))
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((wdata (create-wdata *DIM0* *DIM1*))
(space (h5ex:create-simple-dataspace (list *DIM0* *DIM1*)))
;; Create the dataset and write the array data to it.
(dset (h5dcreate2 file *DATASET* +H5T-IEEE-F64LE+ space
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5dwrite dset +H5T-NATIVE-DOUBLE+ +H5S-ALL+ +H5S-ALL+
+H5P-DEFAULT+ wdata)
;; Close and release resources.
(h5ex:close-handles (list dset space))
(cffi:foreign-free wdata))
(h5ex:close-handles (list file fapl))))
;; Now we begin the read section of this example. Here we assume
;; the dataset has the same name and rank, but can have any size.
;; Therefore we must allocate a new array to read in data dynamically.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(space (h5dget-space dset)))
(cffi:with-foreign-object (dims 'hsize-t 2)
(h5sget-simple-extent-dims space dims +NULL+)
;; Allocate space for floating-point data.
(let ((dims[0] (cffi:mem-aref dims 'hsize-t 0))
(dims[1] (cffi:mem-aref dims 'hsize-t 1)))
(cffi:with-foreign-object (rdata :double (* dims[0] dims[1]))
;; Read the data.
(h5dread dset +H5T-NATIVE-DOUBLE+ +H5S-ALL+ +H5S-ALL+
+H5P-DEFAULT+ rdata)
;; Output the data to the screen.
(format t "~a:~%" *DATASET*)
(dotimes (i dims[0])
(format t " [")
(dotimes (j dims[1])
(format t " ~4$"
(cffi:mem-aref rdata :double (pos dims[1] i j))))
(format t "]~%")))))
;; Close and release resources.
(h5ex:close-handles (list space dset)))
(h5ex:close-handles (list file fapl))))
| 3,667 | Common Lisp | .lisp | 75 | 40.373333 | 100 | 0.605669 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 285c5e7b9129cd6b19da52bf95da0c71120106401a225754c01bfde1910e03d0 | 1,553 | [
-1
] |
1,554 | h5ex-t-stringatt.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-stringatt.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write string datatypes
;;; to an attribute. The program first writes strings to an
;;; attribute with a dataspace of DIM0, then closes the file.
;;; Next, it reopens the file, reads back the data, and
;;; outputs it to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_stringatt.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_t_string.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *ATTRIBUTE* "A1")
(defparameter *DIM0* 4)
(defparameter *SDIM* 8)
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((wdata (cffi:foreign-string-alloc
"Parting is such sweet sorrow. "))
;; Create file and memory datatypes. For this example we will save
;; the strings as FORTRAN strings, therefore they do not need space
;; for the null terminator in the file.
(filetype (h5ex:create-f-string-type (1- *SDIM*)))
(memtype (h5ex:create-c-string-type *SDIM*))
;; Create dataset with a null dataspace.
(dspace (h5ex:create-null-dataspace))
(dset (h5dcreate2 file *DATASET* +H5T-STD-I32LE+ dspace
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+))
;; Create the attribute and write the string data to it.
(aspace (h5ex:create-simple-dataspace `(,*DIM0*)))
(attr (h5acreate2 dset *ATTRIBUTE* filetype aspace +H5P-DEFAULT+
+H5P-DEFAULT+)))
(h5awrite attr memtype wdata)
;; Close and release resources.
(h5ex:close-handles (list filetype memtype dspace dset aspace attr))
(cffi:foreign-string-free wdata))
(h5ex:close-handles (list file fapl))))
;; Now we begin the read section of this example. Here we assume
;; the attribute has the same name and rank, but can have any size.
;; Therefore we must allocate a new array to read in data dynamically.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(attr (h5aopen dset *ATTRIBUTE* +H5P-DEFAULT+))
;; Get the datatype and its size.
(filetype (h5aget-type attr))
(sdim (1+ (h5tget-size filetype)))
(memtype (h5ex:create-c-string-type sdim))
(space (h5aget-space attr)))
(cffi:with-foreign-object (dims 'hsize-t 1)
(h5sget-simple-extent-dims space dims +NULL+)
(let ((dims[0] (cffi:mem-aref dims 'hsize-t 0)))
;; Allocate space for character data.
(cffi:with-foreign-object (rdata :char (* dims[0] sdim))
;; Read the data.
(h5aread attr memtype rdata)
;; Output the data to the screen.
(dotimes (i dims[0])
(format t "~a[~d]: ~a~%" *ATTRIBUTE* i
(cffi:foreign-string-to-lisp
(cffi:mem-aptr rdata :char (* i sdim))))))))
;; Close and release resources.
(h5ex:close-handles (list space memtype filetype attr dset)))
(h5ex:close-handles (list file fapl))))
| 4,041 | Common Lisp | .lisp | 75 | 44.173333 | 104 | 0.617097 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 7f53e50d3d17b160548f3ef01fcc04b957491dd134ac0cdd17f299bd5f196e45 | 1,554 | [
-1
] |
1,555 | h5ex-t-vlstring.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-vlstring.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; help @hdfgroup.org.
;;; This example shows how to read and write variable-length
;;; string datatypes to a dataset. The program first writes
;;; variable-length strings to a dataset with a dataspace of
;;; DIM0, then closes the file. Next, it reopens the file,
;;; reads back the data, and outputs it to the screen.
;;; See h5ex_t_vlstring.c at http://www.hdfgroup.org/HDF5/examples/api18-c.html
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_t_vlstring.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *DIM0* 4)
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((wdata (cffi:foreign-alloc
:string :initial-contents
'("Parting" "is such" "sweet" "sorrow")))
(ftype (h5ex:create-f-string-type))
(mtype (h5ex:create-c-string-type))
(shape (h5ex:create-simple-dataspace `(,*DIM0*)))
(dset (h5dcreate2 file *DATASET* ftype shape +H5P-DEFAULT+
+H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5dwrite dset mtype +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+ wdata)
;; Close and release resources.
(h5ex:close-handles (list dset shape mtype ftype))
(cffi:foreign-free wdata))
(h5ex:close-handles (list file fapl))))
;; Now we begin the read section of this example. Here we assume
;; the dataset has the same name and rank, but can have any size.
;; Therefore we must allocate a new array to read dynamically.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(shape (h5dget-space dset))
(mtype (h5ex:create-c-string-type)))
(cffi:with-foreign-object (dims 'hsize-t 1)
(h5sget-simple-extent-dims shape dims +NULL+)
(let ((dims[0] (cffi:mem-aref dims 'hsize-t 0)))
(cffi:with-foreign-object (rdata '(:pointer :char) dims[0])
;; Read the data.
(h5dread dset mtype +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+ rdata)
;; Output the data to the screen.
(dotimes (i dims[0])
(format t "~a[~d]: ~a~%" *DATASET* i
(cffi:foreign-string-to-lisp
(cffi:mem-aref rdata '(:pointer :char) i))))
;; Close and release resources. Note that H5Dvlen_reclaim works
;; for variable-length strings as well as variable-length arrays.
;; H5Tvlen_reclaim only frees the data these point to.
(h5dvlen-reclaim mtype shape +H5P-DEFAULT+ rdata))))
(h5ex:close-handles (list mtype shape dset)))
(h5ex:close-handles (list file fapl))))
| 3,470 | Common Lisp | .lisp | 63 | 45.142857 | 89 | 0.613255 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | c52301c5192cfb25cc5ff994a3957399f2084022c82b8b171f62e3f2b94e3614 | 1,555 | [
-1
] |
1,556 | h5ex-t-enumatt.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-enumatt.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write enumerated
;;; datatypes to an attribute. The program first writes
;;; enumerated values to an attribute with a dataspace of
;;; DIM0xDIM1, then closes the file. Next, it reopens the
;;; file, reads back the data, and outputs it to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_enumatt.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_t_enumatt.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *ATTRIBUTE* "A1")
(defparameter *DIM0* 4)
(defparameter *DIM1* 7)
(defparameter *F-BASET* +H5T-STD-I16BE+)
(defparameter *M-BASET* +H5T-NATIVE-INT+)
(defparameter *NAME-BUF-SIZE* 16)
(cffi:defcenum phase-t
:SOLID
:LIQUID
:GAS
:PLASMA)
(defun create-enumtypes ()
(let ((filetype (h5tenum-create *F-BASET*))
(memtype (h5tenum-create *M-BASET*))
(names (cffi:foreign-alloc :string :initial-contents
'("SOLID" "LIQUID" "GAS" "PLASMA"))))
(cffi:with-foreign-object (val 'phase-t)
(dotimes (i (1+ (cffi:foreign-enum-value 'phase-t :PLASMA)))
(setf (cffi:mem-ref val 'phase-t) i)
;; Insert enumerated value for memtype.
(h5tenum-insert memtype
(cffi::mem-aref names :string i) val)
;; Insert enumerated value for filetype. We must first convert
;; the numerical value val to the base type of the destination.
(h5tconvert *M-BASET* *F-BASET* 1 val +NULL+ +H5P-DEFAULT+)
(h5tenum-insert filetype
(cffi::mem-aref names :string i) val)))
;; return TWO datatype handles
(values filetype memtype)))
(defun pos (cols i j)
"2D array position"
(+ (* i cols) j))
(cffi:with-foreign-object (wdata 'phase-t (* *DIM0* *DIM1*))
;; Initialize data.
(dotimes (i *DIM0*)
(dotimes (j *DIM1*)
(setf (cffi:mem-aref wdata 'phase-t (pos *DIM1* i j))
(rem (- (* (1+ i) j) j)
(1+ (cffi:foreign-enum-value 'phase-t :PLASMA))))))
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(multiple-value-bind (filetype memtype)
(create-enumtypes)
(let* ((dspace (h5ex:create-null-dataspace))
(dset (h5dcreate2 file *DATASET* +H5T-STD-I32LE+ dspace
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+))
(aspace (h5ex:create-simple-dataspace (list *DIM0* *DIM1*)))
(attr (h5acreate2 dset *ATTRIBUTE* filetype aspace
+H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5awrite attr memtype wdata)
;; Close and release resources.
(h5ex:close-handles (list attr aspace dset dspace memtype
filetype))))
(h5ex:close-handles (list file fapl)))))
;; Now we begin the read section of this example. Here we assume
;; the attribute and array have the same name and rank, but can
;; have any size. Therefore we must allocate a new array to read
;; in data dynamically.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(attr (h5aopen dset *ATTRIBUTE* +H5P-DEFAULT+))
(space (h5aget-space attr)))
(cffi:with-foreign-object (dims 'hsize-t 2)
(h5sget-simple-extent-dims space dims +NULL+)
;; Allocate space for integer data.
(let ((dims[0] (cffi:mem-aref dims 'hsize-t 0))
(dims[1] (cffi:mem-aref dims 'hsize-t 1)))
(cffi:with-foreign-objects ((rdata 'phase-t (* dims[0] dims[1]))
(name :char *NAME-BUF-SIZE*))
(multiple-value-bind (filetype memtype)
(create-enumtypes)
;; Read the data.
(h5aread attr memtype rdata)
;; Output the data to the screen.
(format t "~a:~%" *ATTRIBUTE*)
(dotimes (i *DIM0*)
(format t " [")
(dotimes (j *DIM1*)
;; Get the name of the enumeration member.
(h5tenum-nameof memtype
(cffi:mem-aptr rdata 'phase-t
(pos *DIM1* i j))
name *NAME-BUF-SIZE*)
(format t " ~6a" (cffi:foreign-string-to-lisp name)))
(format t "]~%"))
(h5ex:close-handles (list filetype memtype))))))
(h5ex:close-handles (list space attr dset)))
(h5ex:close-handles (list file fapl))))
| 4,952 | Common Lisp | .lisp | 112 | 38.357143 | 102 | 0.647633 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 4952d91d1fbeb71165f2d873b3251eaef40633a19c5a78ad59184fa1f5508194 | 1,556 | [
-1
] |
1,557 | h5ex-t-floatatt.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-floatatt.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write floating point
;;; datatypes to an attribute. The program first writes
;;; floating point numbers to an attribute with a dataspace of
;;; DIM0xDIM1, then closes the file. Next, it reopens the
;;; file, reads back the data, and outputs it to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_floatatt.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_t_floatatt.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *ATTRIBUTE* "A1")
(defparameter *DIM0* 4)
(defparameter *DIM1* 7)
(defun pos (cols i j)
"2D array position"
(+ (* i cols) j))
(defun create-wdata (rows cols)
(let ((wdata (cffi::foreign-alloc :double :count (* rows cols))))
(dotimes (i rows)
(dotimes (j cols)
(setf (cffi:mem-aref wdata :double (pos cols i j))
(+ (/ i (+ j 0.5d0)) j))))
wdata))
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((wdata (create-wdata *DIM0* *DIM1*))
(dspace (h5ex:create-null-dataspace))
(aspace (h5ex:create-simple-dataspace (list *DIM0* *DIM1*)))
;; reate dataset with a null dataspace.
(dset (h5dcreate2 file *DATASET* +H5T-STD-I32LE+ dspace
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+))
;; Create the attribute and write the floating point data to it.
;; In this example we will save the data as 64 bit little endian
;; IEEE floating point numbers, regardless of the native type. The
;; HDF5 library automatically converts between different floating
;; point types.
(attr (h5acreate2 dset *ATTRIBUTE* +H5T-IEEE-F64LE+ aspace
+H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5awrite attr +H5T-NATIVE-DOUBLE+ wdata)
;; Close and release resources.
(h5ex:close-handles (list attr dset aspace dspace))
(cffi:foreign-free wdata))
(h5ex:close-handles (list file fapl))))
;; Now we begin the read section of this example. Here we assume
;; the attribute has the same name and rank, but can have any size.
;; Therefore we must allocate a new array to read in data dynamically.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(attr (h5aopen dset *ATTRIBUTE* +H5P-DEFAULT+))
(space (h5aget-space attr)))
(cffi:with-foreign-object (dims 'hsize-t 2)
(h5sget-simple-extent-dims space dims +NULL+)
;; Allocate space for floating-point data.
(let ((dims[0] (cffi:mem-aref dims 'hsize-t 0))
(dims[1] (cffi:mem-aref dims 'hsize-t 1)))
(cffi:with-foreign-object (rdata :double (* dims[0] dims[1]))
;; Read the data.
(h5aread attr +H5T-NATIVE-DOUBLE+ rdata)
;; Output the data to the screen.
(format t "~a:~%" *ATTRIBUTE*)
(dotimes (i dims[0])
(format t " [")
(dotimes (j dims[1])
(format t " ~4$"
(cffi:mem-aref rdata :double (pos dims[1] i j))))
(format t "]~%")))))
;; Close and release resources.
(h5ex:close-handles (list space attr dset)))
(h5ex:close-handles (list file fapl))))
| 4,229 | Common Lisp | .lisp | 83 | 41.975904 | 103 | 0.612067 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | ff5829a0ecd9e87c97e78abd85e88b571f551b0b7ff0efeb8e4543b848a88a31 | 1,557 | [
-1
] |
1,558 | h5ex-t-regref.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-regref.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write region references
;;; to a dataset. The program first creates a dataset
;;; containing characters and writes references to region of
;;; the dataset to a new dataset with a dataspace of DIM0,
;;; then closes the file. Next, it reopens the file,
;;; dereferences the references, and outputs the referenced
;;; regions to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_regref.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_t_regref.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *DATASET2* "DS2")
(defparameter *DIM0* 2)
(defparameter *DS2DIM0* 3)
(defparameter *DS2DIM1* 16)
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
;; Create a dataset with character data.
(let* ((space (h5ex:create-simple-dataspace (list *DS2DIM0*
*DS2DIM1*)))
(dset2 (h5dcreate2 file *DATASET2* +H5T-STD-I8LE+ space
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+))
(data (concatenate 'string
"The quick brown\0"
"fox jumps over \0"
"the 5 lazy dogs\0"))
(wdata2 (cffi:foreign-string-alloc data
:null-terminated-p nil)))
(h5dwrite dset2 +H5T-NATIVE-CHAR+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
wdata2)
(cffi:with-foreign-object (wdata '(:struct hdset-reg-ref-t) 2)
;; Create reference to a list of elements in dset2.
(let ((coords (cffi:foreign-alloc 'hsize-t :count (* 4 2)
:initial-contents
'(0 1 2 11 1 0 2 4))))
(h5sselect-elements space :H5S-SELECT-SET 4 coords)
(cffi:foreign-free coords))
(h5rcreate (cffi:mem-aptr wdata '(:struct hdset-reg-ref-t) 0)
file *DATASET2* :H5R-DATASET-REGION space)
;; Create reference to a hyperslab in dset2.
(cffi:with-foreign-objects ((start 'hsize-t 2)
(stride 'hsize-t 2)
(count 'hsize-t 2)
(block 'hsize-t 2))
(setf (cffi:mem-aref start 'hsize-t 0) 0
(cffi:mem-aref start 'hsize-t 1) 0
(cffi:mem-aref stride 'hsize-t 0) 2
(cffi:mem-aref stride 'hsize-t 1) 11
(cffi:mem-aref count 'hsize-t 0) 2
(cffi:mem-aref count 'hsize-t 1) 2
(cffi:mem-aref block 'hsize-t 0) 1
(cffi:mem-aref block 'hsize-t 1) 3)
(h5sselect-hyperslab space :H5S-SELECT-SET start stride count
block))
(h5rcreate (cffi:mem-aptr wdata '(:struct hdset-reg-ref-t) 1)
file *DATASET2* :H5R-DATASET-REGION space)
;; Create the dataset and write the region references to it.
(let* ((space (h5ex:create-simple-dataspace `(,*DIM0*)))
(dset (h5dcreate2 file *DATASET* +H5T-STD-REF-DSETREG+
space +H5P-DEFAULT+ +H5P-DEFAULT+
+H5P-DEFAULT+)))
(h5dwrite dset +H5T-STD-REF-DSETREG+ +H5S-ALL+ +H5S-ALL+
+H5P-DEFAULT+ wdata)
(h5ex:close-handles (list dset space)))
;; Close and release resources.
(cffi:foreign-free wdata2)
(h5ex:close-handles (list dset2 space))))
(h5ex:close-handles (list file fapl))))
;;; Now we begin the read section of this example. Here we assume
;;; the dataset has the same name and rank, but can have any size.
;;; Therefore we must allocate a new array to read in data dynamically.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
;; Get dataspace and allocate memory for read buffer.
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(space (h5dget-space dset)))
(cffi:with-foreign-object (dims 'hsize-t 1)
(h5sget-simple-extent-dims space dims +NULL+)
(let* ((dims[0] (cffi:mem-aref dims 'hsize-t 0))
(rdata (cffi:foreign-alloc '(:struct hdset-reg-ref-t)
:count dims[0])))
;; Read the data.
(h5dread dset +H5T-STD-REF-DSETREG+ +H5S-ALL+ +H5S-ALL+
+H5P-DEFAULT+ rdata)
;; Output the data to the screen.
(dotimes (i dims[0])
(format t "~a[~d]:~% ->" *DATASET* i)
;; Open the referenced object, retrieve its region as a
;; dataspace selection.
(let* ((rdata[i] (cffi:mem-aptr rdata
'(:struct hdset-reg-ref-t) i))
(dset2 (if (= +H5-VERS-MINOR+ 8)
(h5rdereference dset :H5R-DATASET-REGION
rdata[i])
(h5rdereference dset +H5P-DEFAULT+
:H5R-DATASET-REGION rdata[i])))
(space (h5rget-region dset :H5R-DATASET-REGION rdata[i]))
;; Get the length of the object's name, allocate space,
;; then retrieve the name.
(size (1+ (h5iget-name dset2 +NULL+ 0)))
(name (cffi:foreign-alloc :char :count size))
;; Allocate space for the read buffer. We will only
;; allocate enough space for the selection, plus a null
;; terminator. The read buffer will be 1-dimensional.
(npoints (h5sget-select-npoints space))
(rdata2 (cffi:foreign-alloc :char :count (1+ npoints))))
(h5iget-name dset2 name size)
;; Read the dataset region, and add a null terminator so we
;; can print it as a string.
(cffi:with-foreign-object (dims 'hsize-t 1)
(setf (cffi:mem-aref dims 'hsize-t 0) npoints)
(let ((memspace (h5screate-simple 1 dims +NULL+)))
(h5dread dset2 +H5T-NATIVE-CHAR+ memspace space
+H5P-DEFAULT+ rdata2)
(setf (cffi:mem-aref rdata2 :char npoints) 0)
;; Print the name and region data, close and release
;; resources.
(format t "~a: ~a~%"
(cffi:foreign-string-to-lisp name)
(cffi:foreign-string-to-lisp rdata2))
(h5sclose memspace)))
;; Close and release resources.
(cffi:foreign-free rdata2)
(cffi:foreign-free name)
(h5ex:close-handles (list space dset2))))
(cffi:foreign-free rdata))
(h5ex:close-handles (list space dset))))
(h5ex:close-handles (list file fapl))))
| 8,077 | Common Lisp | .lisp | 142 | 39.922535 | 101 | 0.526169 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 7334b022e38e50ae1cb2c046205bfdecb51da2bc7159b2f293e12822a84f59f4 | 1,558 | [
-1
] |
1,559 | h5ex-t-int.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-int.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write integer datatypes
;;; to a dataset. The program first writes integers to a
;;; dataset with a dataspace of DIM0xDIM1, then closes the
;;; file. Next, it reopens the file, reads back the data, and
;;; outputs it to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_int.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_t_int.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *DIM0* 4)
(defparameter *DIM1* 7)
(defun pos (cols i j)
"2D array position"
(+ (* i cols) j))
(defun create-wdata (rows cols)
(let ((wdata (cffi::foreign-alloc :int :count (* rows cols))))
(dotimes (i rows)
(dotimes (j cols)
(setf (cffi:mem-aref wdata :int (pos cols i j))
(- (* i j) j))))
wdata))
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((wdata (create-wdata *DIM0* *DIM1*))
(space (h5ex:create-simple-dataspace (list *DIM0* *DIM1*)))
;; Create the dataset and write the array data to it.
(dset (h5dcreate2 file *DATASET* +H5T-STD-I64BE+ space
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
wdata)
;; Close and release resources.
(h5ex:close-handles (list dset space))
(cffi:foreign-free wdata))
(h5ex:close-handles (list file fapl))))
;; Now we begin the read section of this example. Here we assume
;; the dataset has the same name and rank, but can have any size.
;; Therefore we must allocate a new array to read in data dynamically.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(space (h5dget-space dset)))
(cffi:with-foreign-object (dims 'hsize-t 2)
(h5sget-simple-extent-dims space dims +NULL+)
(let ((dims[0] (cffi:mem-aref dims 'hsize-t 0))
(dims[1] (cffi:mem-aref dims 'hsize-t 1)))
;; Allocate space for integer data.
(cffi:with-foreign-object (rdata :int (* dims[0] dims[1]))
;; Read the data.
(h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+
+H5P-DEFAULT+ rdata)
;; Output the data to the screen.
(format t "~a:~%" *DATASET*)
(dotimes (i dims[0])
(format t " [")
(dotimes (j dims[1])
(format t " ~3d"
(cffi:mem-aref rdata :int (pos dims[1] i j))))
(format t "]~%")))))
;; Close and release resources.
(h5ex:close-handles (list space dset)))
(h5ex:close-handles (list file fapl))))
| 3,623 | Common Lisp | .lisp | 75 | 39.893333 | 98 | 0.60357 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 1f1c6e41c59b14d8e650e88af11ab4a0bbfaa2ef495604a51b67c8083cacaf2f | 1,559 | [
-1
] |
1,560 | h5ex-t-intatt.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-intatt.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write integer datatypes
;;; to an attribute. The program first writes integers to an
;;; attribute with a dataspace of DIM0xDIM1, then closes the
;;; file. Next, it reopens the file, reads back the data, and
;;; outputs it to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_intatt.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_t_intatt.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *ATTRIBUTE* "A1")
(defparameter *DIM0* 4)
(defparameter *DIM1* 7)
(defun pos (cols i j)
"2D array position"
(+ (* i cols) j))
(defun create-wdata (rows cols)
(let ((wdata (cffi::foreign-alloc :int :count (* rows cols))))
(dotimes (i rows)
(dotimes (j cols)
(setf (cffi:mem-aref wdata :int (pos cols i j))
(- (* i j) j))))
wdata))
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((wdata (create-wdata *DIM0* *DIM1*))
(dspace (h5ex:create-null-dataspace))
(aspace (h5ex:create-simple-dataspace (list *DIM0* *DIM1*)))
;; Create dataset with a null dataspace.
(dset (h5dcreate2 file *DATASET* +H5T-STD-I32LE+ dspace
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+))
(attr (h5acreate2 dset *ATTRIBUTE* +H5T-STD-I64BE+ aspace
+H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5awrite attr +H5T-NATIVE-INT+ wdata)
;; Close and release resources.
(h5ex:close-handles (list attr dset aspace dspace))
(cffi:foreign-free wdata))
(h5ex:close-handles (list file fapl))))
;; Now we begin the read section of this example. Here we assume
;; the attribute has the same name and rank, but can have any size.
;; Therefore we must allocate a new array to read in data dynamically.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(attr (h5aopen dset *ATTRIBUTE* +H5P-DEFAULT+))
(space (h5aget-space attr)))
(cffi:with-foreign-object (dims 'hsize-t 2)
(h5sget-simple-extent-dims space dims +NULL+)
(let ((dims[0] (cffi:mem-aref dims 'hsize-t 0))
(dims[1] (cffi:mem-aref dims 'hsize-t 1)))
;; Allocate space for integer data.
(cffi:with-foreign-object (rdata :int (* dims[0] dims[1]))
;; Read the data.
(h5aread attr +H5T-NATIVE-INT+ rdata)
;; Output the data to the screen.
(format t "~a:~%" *ATTRIBUTE*)
(dotimes (i dims[0])
(format t " [")
(dotimes (j dims[1])
(format t " ~3d"
(cffi:mem-aref rdata :int (pos dims[1] i j))))
(format t "]~%")))))
;; Close and release resources.
(h5ex:close-handles (list space attr dset)))
(h5ex:close-handles (list file fapl))))
| 3,814 | Common Lisp | .lisp | 78 | 40.384615 | 101 | 0.607854 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 26304f0089bb445e5fcc8c3d79eb25d015655c24abfd4932888d9a5e1abcb7c9 | 1,560 | [
-1
] |
1,561 | h5ex-t-enum.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-enum.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write enumerated
;;; datatypes to a dataset. The program first writes
;;; enumerated values to a dataset with a dataspace of
;;; DIM0xDIM1, then closes the file. Next, it reopens the
;;; file, reads back the data, and outputs it to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_enum.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_t_enum.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *DIM0* 4)
(defparameter *DIM1* 7)
(defparameter *F-BASET* +H5T-STD-I16BE+)
(defparameter *M-BASET* +H5T-NATIVE-INT+)
(defparameter *NAME-BUF-SIZE* 16)
(cffi:defcenum phase-t
:SOLID
:LIQUID
:GAS
:PLASMA)
(defun create-enumtypes ()
(let ((filetype (h5tenum-create *F-BASET*))
(memtype (h5tenum-create *M-BASET*))
(names (cffi:foreign-alloc :string :initial-contents
'("SOLID" "LIQUID" "GAS" "PLASMA"))))
(cffi:with-foreign-object (val 'phase-t)
(dotimes (i (1+ (cffi:foreign-enum-value 'phase-t :PLASMA)))
(setf (cffi:mem-ref val 'phase-t) i)
;; Insert enumerated value for memtype.
(h5tenum-insert memtype
(cffi::mem-aref names :string i) val)
;; Insert enumerated value for filetype. We must first convert
;; the numerical value val to the base type of the destination.
(h5tconvert *M-BASET* *F-BASET* 1 val +NULL+ +H5P-DEFAULT+)
(h5tenum-insert filetype
(cffi::mem-aref names :string i) val)))
;; return TWO datatype handles
(values filetype memtype)))
(defun pos (cols i j)
"2D array position"
(+ (* i cols) j))
(cffi:with-foreign-object (wdata 'phase-t (* *DIM0* *DIM1*))
;; Initialize data.
(dotimes (i *DIM0*)
(dotimes (j *DIM1*)
(setf (cffi:mem-aref wdata 'phase-t (pos *DIM1* i j))
(rem (- (* (1+ i) j) j)
(1+ (cffi:foreign-enum-value 'phase-t :PLASMA))))))
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(multiple-value-bind (filetype memtype)
(create-enumtypes)
(let* ((space (h5ex:create-simple-dataspace (list *DIM0* *DIM1*)))
(dset (h5dcreate2 file *DATASET* filetype space
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5dwrite dset memtype +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+ wdata)
;; Close and release resources.
(h5ex:close-handles (list dset space memtype filetype))))
(h5ex:close-handles (list file fapl)))))
;; Now we begin the read section of this example. Here we assume
;; the dataset and array have the same name and rank, but can
;; have any size. Therefore we must allocate a new array to read
;; in data dynamically.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(space (h5dget-space dset)))
(cffi:with-foreign-object (dims 'hsize-t 2)
(h5sget-simple-extent-dims space dims +NULL+)
;; Allocate space for integer data.
(let ((dims[0] (cffi:mem-aref dims 'hsize-t 0))
(dims[1] (cffi:mem-aref dims 'hsize-t 1)))
(cffi:with-foreign-objects ((rdata 'phase-t (* dims[0] dims[1]))
(name :char *NAME-BUF-SIZE*))
(multiple-value-bind (filetype memtype)
(create-enumtypes)
;; Read the data.
(h5dread dset memtype +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+ rdata)
;; Output the data to the screen.
(format t "~a:~%" *DATASET*)
(dotimes (i *DIM0*)
(format t " [")
(dotimes (j *DIM1*)
;; Get the name of the enumeration member.
(h5tenum-nameof memtype
(cffi:mem-aptr rdata 'phase-t
(pos *DIM1* i j))
name *NAME-BUF-SIZE*)
(format t " ~6a" (cffi:foreign-string-to-lisp name)))
(format t "]~%"))
(h5ex:close-handles (list filetype memtype))))))
(h5ex:close-handles (list space dset)))
(h5ex:close-handles (list file fapl))))
| 4,678 | Common Lisp | .lisp | 106 | 38.943396 | 99 | 0.654801 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 03df81018dbd7bd73f2c9853c277620502062a9b0b1cfdd7c28f2fcf07e7873b | 1,561 | [
-1
] |
1,562 | h5ex-t-regrefatt.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-regrefatt.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write region references
;;; to an attribute. The program first creates a dataset
;;; containing characters and writes references to region of
;;; the dataset to a new attribute with a dataspace of DIM0,
;;; then closes the file. Next, it reopens the file,
;;; dereferences the references, and outputs the referenced
;;; regions to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_regrefatt.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_t_regrefatt.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *DATASET2* "DS2")
(defparameter *ATTRIBUTE* "A1")
(defparameter *DIM0* 2)
(defparameter *DS2DIM0* 3)
(defparameter *DS2DIM1* 16)
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
;; Create a dataset with character data.
(let* ((space (h5ex:create-simple-dataspace (list *DS2DIM0*
*DS2DIM1*)))
(dset2 (h5dcreate2 file *DATASET2* +H5T-STD-I8LE+ space
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+))
(data (concatenate 'string
"The quick brown\0"
"fox jumps over \0"
"the 5 lazy dogs\0"))
(wdata2 (cffi:foreign-string-alloc data
:null-terminated-p nil)))
(h5dwrite dset2 +H5T-NATIVE-CHAR+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
wdata2)
(cffi:with-foreign-object (wdata '(:struct hdset-reg-ref-t) 2)
;; Create reference to a list of elements in dset2.
(let ((coords (cffi:foreign-alloc 'hsize-t :count (* 4 2)
:initial-contents
'(0 1 2 11 1 0 2 4))))
(h5sselect-elements space :H5S-SELECT-SET 4 coords)
(cffi:foreign-free coords))
(h5rcreate (cffi:mem-aptr wdata '(:struct hdset-reg-ref-t) 0)
file *DATASET2* :H5R-DATASET-REGION space)
;; Create reference to a hyperslab in dset2.
(cffi:with-foreign-objects ((start 'hsize-t 2)
(stride 'hsize-t 2)
(count 'hsize-t 2)
(block 'hsize-t 2))
(setf (cffi:mem-aref start 'hsize-t 0) 0
(cffi:mem-aref start 'hsize-t 1) 0
(cffi:mem-aref stride 'hsize-t 0) 2
(cffi:mem-aref stride 'hsize-t 1) 11
(cffi:mem-aref count 'hsize-t 0) 2
(cffi:mem-aref count 'hsize-t 1) 2
(cffi:mem-aref block 'hsize-t 0) 1
(cffi:mem-aref block 'hsize-t 1) 3)
(h5sselect-hyperslab space :H5S-SELECT-SET start stride count
block))
(h5rcreate (cffi:mem-aptr wdata '(:struct hdset-reg-ref-t) 1)
file *DATASET2* :H5R-DATASET-REGION space)
;;Create dataset with a null dataspace to serve as the parent for
;; the attribute.
(let* ((dspace (h5ex:create-null-dataspace))
(dset (h5dcreate2 file *DATASET* +H5T-STD-I32LE+
dspace +H5P-DEFAULT+ +H5P-DEFAULT+
+H5P-DEFAULT+))
;; Create the attribute and write the region references to it.
(aspace (h5ex:create-simple-dataspace `(,*DIM0*)))
(attr (h5acreate2 dset *ATTRIBUTE* +H5T-STD-REF-DSETREG+
aspace +H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5awrite attr +H5T-STD-REF-DSETREG+ wdata)
(h5ex:close-handles (list attr aspace dspace dset)))
;; Close and release resources.
(cffi:foreign-free wdata2)
(h5ex:close-handles (list dset2 space))))
(h5ex:close-handles (list file fapl))))
;;; Now we begin the read section of this example. Here we assume
;;; the attribute has the same name and rank, but can have any size.
;;; Therefore we must allocate a new array to read in data dynamically.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
;; Get dataspace and allocate memory for read buffer.
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(attr (h5aopen dset *ATTRIBUTE* +H5P-DEFAULT+))
(space (h5aget-space attr)))
(cffi:with-foreign-object (dims 'hsize-t 1)
(h5sget-simple-extent-dims space dims +NULL+)
(let* ((dims[0] (cffi:mem-aref dims 'hsize-t 0))
(rdata (cffi:foreign-alloc '(:struct hdset-reg-ref-t)
:count dims[0])))
;; Read the data.
(h5aread attr +H5T-STD-REF-DSETREG+ rdata)
;; Output the data to the screen.
(dotimes (i dims[0])
(format t "~a[~d]:~% ->" *ATTRIBUTE* i)
;; Open the referenced object, retrieve its region as a
;; dataspace selection.
(let* ((rdata[i] (cffi:mem-aptr rdata
'(:struct hdset-reg-ref-t) i))
(dset2 (if (= +H5-VERS-MINOR+ 8)
(h5rdereference dset :H5R-DATASET-REGION
rdata[i])
(h5rdereference dset +H5P-DEFAULT+
:H5R-DATASET-REGION rdata[i])))
(space (h5rget-region dset :H5R-DATASET-REGION rdata[i]))
;; Get the length of the object's name, allocate space,
;; then retrieve the name.
(size (1+ (h5iget-name dset2 +NULL+ 0)))
(name (cffi:foreign-alloc :char :count size))
;; Allocate space for the read buffer. We will only
;; allocate enough space for the selection, plus a null
;; terminator. The read buffer will be 1-dimensional.
(npoints (h5sget-select-npoints space))
(rdata2 (cffi:foreign-alloc :char :count (1+ npoints))))
(h5iget-name dset2 name size)
;; Read the dataset region, and add a null terminator so we
;; can print it as a string.
(cffi:with-foreign-object (dims 'hsize-t 1)
(setf (cffi:mem-aref dims 'hsize-t 0) npoints)
(let ((memspace (h5screate-simple 1 dims +NULL+)))
(h5dread dset2 +H5T-NATIVE-CHAR+ memspace space
+H5P-DEFAULT+ rdata2)
(setf (cffi:mem-aref rdata2 :char npoints) 0)
;; Print the name and region data, close and release
;; resources.
(format t "~a: ~a~%"
(cffi:foreign-string-to-lisp name)
(cffi:foreign-string-to-lisp rdata2))
(h5sclose memspace)))
;; Close and release resources.
(cffi:foreign-free rdata2)
(cffi:foreign-free name)
(h5ex:close-handles (list space dset2))))
(cffi:foreign-free rdata))
(h5ex:close-handles (list space attr dset))))
(h5ex:close-handles (list file fapl))))
| 8,405 | Common Lisp | .lisp | 147 | 40.292517 | 104 | 0.53024 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 443b6604816a8e4e2c9963ec0dca2ceb44d71b1987bc8ab84076b1f0f0d6a47c | 1,562 | [
-1
] |
1,563 | h5ex-t-vlenatt.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-vlenatt.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write variable-length
;;; datatypes to an attribute. The program first writes two
;;; variable-length integer arrays to the attribute then
;;; closes the file. Next, it reopens the file, reads back
;;; the data, and outputs it to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_vlenatt.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_t_vlen.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *ATTRIBUTE* "A1")
(defparameter *LEN0* 3)
(defparameter *LEN1* 12)
(defun create-wdata ()
(let* ((wdata (cffi::foreign-alloc '(:struct hvl-t) :count 2))
(wdata[0] (cffi:mem-aptr wdata '(:struct hvl-t) 0))
(wdata[1] (cffi:mem-aptr wdata '(:struct hvl-t) 1)))
;; Initialize variable-length data. wdata[0] is a countdown of
;; length LEN0, wdata[1] is a Fibonacci sequence of length LEN1.
(cffi:with-foreign-slots ((len p) wdata[0] (:struct hvl-t))
(setf len *LEN0*
p (cffi:foreign-alloc :int :count *LEN0*
:initial-contents (loop for i from 0
to (1- *LEN0*)
collect (- *LEN0* i)))))
(cffi:with-foreign-slots ((len p) wdata[1] (:struct hvl-t))
(labels ((fib (n)
(cond ((< n 0) nil)
((or (= n 0) (= n 1)) 1)
(t (+ (fib (1- n)) (fib (- n 2)))))))
(setf len *LEN1*
p (cffi:foreign-alloc :int :count *LEN1*
:initial-contents (loop for i from 0
to (1- *LEN1*)
collect (fib i))))))
wdata))
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((wdata (create-wdata))
(filetype (h5tvlen-create +H5T-STD-I32LE+))
(memtype (h5tvlen-create +H5T-NATIVE-INT+))
(dspace (h5ex:create-null-dataspace))
(aspace (h5ex:create-simple-dataspace '(2)))
;; Create dataset with a null dataspace.
(dset (h5dcreate2 file *DATASET* +H5T-STD-I32LE+ dspace
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+))
;; Create the attribute and write the variable-length data to it
(attr (h5acreate2 dset *ATTRIBUTE* filetype aspace
+H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5awrite attr memtype wdata)
;; Close and release resources. Note the use of H5Dvlen_reclaim
;; removes the need to manually free() the previously malloc'ed
;; data.
(h5dvlen-reclaim memtype aspace +H5P-DEFAULT+ wdata)
(h5ex:close-handles (list attr dset dspace aspace memtype filetype))
(cffi:foreign-free wdata))
(h5ex:close-handles (list file fapl))))
;; Now we begin the read section of this example. Here we assume
;; the attribute has the same name and rank, but can have any size.
;; Therefore we must allocate a new array to read in data dynamically.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
;; Get dataspace and allocate memory for array of vlen structures.
;; This does not actually allocate memory for the vlen data, that
;; will be done by the library.
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(attr (h5aopen dset *ATTRIBUTE* +H5P-DEFAULT+))
(space (h5aget-space attr)))
(cffi:with-foreign-object (dims 'hsize-t 1)
(h5sget-simple-extent-dims space dims +NULL+)
(let ((dims[0] (cffi:mem-aref dims 'hsize-t 0))
(memtype (h5tvlen-create +H5T-NATIVE-INT+)))
(cffi:with-foreign-object (rdata '(:struct hvl-t) dims[0])
;; Read the data.
(h5aread attr memtype rdata)
;; Output the variable-length data to the screen.
(dotimes (i dims[0])
(format t "~a[~d]:~% {" *ATTRIBUTE* i)
(let ((rdata[i] (cffi:mem-aptr rdata '(:struct hvl-t) i)))
(cffi:with-foreign-slots ((len p) rdata[i] (:struct hvl-t))
(dotimes (j len)
(format t " ~d" (cffi:mem-aref p :int j))
(when (< (1+ j) len) (format t ",")))
(format t " }~%"))))
;; Close and release resources. Note we must still free the
;; top-level pointer "rdata", as H5Dvlen_reclaim only frees the
;; actual variable-length data, and not the structures
;; themselves.
(h5dvlen-reclaim memtype space +H5P-DEFAULT+ rdata))
(h5tclose memtype)))
(h5ex:close-handles (list space attr dset)))
(h5ex:close-handles (list file fapl))))
| 5,745 | Common Lisp | .lisp | 105 | 42.47619 | 102 | 0.569904 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 3b244e47a0255c058bebde86a1786731800445f3828d1721660d82de60fc7b5e | 1,563 | [
-1
] |
1,564 | h5ex-t-bit.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-bit.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write bitfield
;;; datatypes to a dataset. The program first writes bit
;;; fields to a dataset with a dataspace of DIM0xDIM1, then
;;; closes the file. Next, it reopens the file, reads back
;;; the data, and outputs it to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_bit.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_t_bit.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *DIM0* 4)
(defparameter *DIM1* 7)
(defun pos (cols i j)
"2D array position"
(+ (* i cols) j))
(cffi:with-foreign-objects
((dims 'hsize-t 2)
(wdata :unsigned-char (* *DIM0* *DIM1*)))
;; Initialize data. We will manually pack 4 2-bit integers into
;; each unsigned char data element.
(flet ((ABCD (i j)
(logior
(logior
(logior
(logior 0 (logand (- (* i j) j) #x03)) ; field "A"
(ash (logand i #x03) 2)) ; field "B"
(ash (logand j #x03) 4)) ; field "C"
(ash (logand (+ i j) #x03) 6)))) ; field "D"
(dotimes (i *DIM0*)
(dotimes (j *DIM1*)
(setf (cffi:mem-aref wdata :unsigned-char (pos *DIM1* i j))
(ABCD i j)))))
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((space (h5ex:create-simple-dataspace `(,*DIM0* ,*DIM1*)))
;; Create the dataset and write the bitfield data to it.
(dset (h5dcreate2 file *DATASET* +H5T-STD-B8BE+ space
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5dwrite dset +H5T-NATIVE-B8+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
wdata)
;; Close and release resources.
(h5ex:close-handles (list dset space)))
(h5ex:close-handles (list file fapl))))
;; Now we begin the read section of this example. Here we assume
;; the dataset and array have the same name and rank, but can
;; have any size. Therefore we must allocate a new array to read
;; in data dynamically.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(space (h5dget-space dset)))
;; Get dataspace and allocate memory for read buffer.
(h5sget-simple-extent-dims space dims +NULL+)
(let ((dims[0] (cffi:mem-aref dims 'hsize-t 0))
(dims[1] (cffi:mem-aref dims 'hsize-t 1)))
(cffi:with-foreign-object (rdata :unsigned-char
(* dims[0] dims[1]))
;; Read the data.
(h5dread dset +H5T-NATIVE-B8+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+
rdata)
;; Output the data to the screen.
(flet ((ABCD (x)
(values (logand x #x03)
(logand (ash x -2) #x03)
(logand (ash x -4) #x03)
(logand (ash x -6) #x03))))
(format t "~a:~%" *DATASET*)
(dotimes (i *DIM0*)
(format t " [")
(dotimes (j *DIM1*)
(multiple-value-bind (A B C D)
(ABCD (cffi:mem-aref rdata :unsigned-char
(pos *DIM1* i j)))
(format t " {~a, ~a, ~a, ~a}" A B C D)))
(format t " ]~%")))))
;; Close and release resources.
(h5ex:close-handles (list space dset)))
(h5ex:close-handles (list file fapl)))))
| 3,912 | Common Lisp | .lisp | 91 | 37.89011 | 98 | 0.627306 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | efd0a301ba8a4e9a248bfeb159fd312638aa22d02681fbba62b617ce01da1d0d | 1,564 | [
-1
] |
1,565 | h5ex-t-vlen.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-vlen.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write variable-length
;;; datatypes to a dataset. The program first writes two
;;; variable-length integer arrays to a dataset then closes
;;; the file. Next, it reopens the file, reads back the data,
;;; and outputs it to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_vlen.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_t_vlen.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *LEN0* 3)
(defparameter *LEN1* 12)
(defun create-wdata ()
(let* ((wdata (cffi::foreign-alloc '(:struct hvl-t) :count 2))
(wdata[0] (cffi:mem-aptr wdata '(:struct hvl-t) 0))
(wdata[1] (cffi:mem-aptr wdata '(:struct hvl-t) 1)))
;; Initialize variable-length data. wdata[0] is a countdown of
;; length LEN0, wdata[1] is a Fibonacci sequence of length LEN1.
(cffi:with-foreign-slots ((len p) wdata[0] (:struct hvl-t))
(setf len *LEN0*
p (cffi:foreign-alloc :int :count *LEN0*
:initial-contents (loop for i from 0
to (1- *LEN0*)
collect (- *LEN0* i)))))
(cffi:with-foreign-slots ((len p) wdata[1] (:struct hvl-t))
(labels ((fib (n)
(cond ((< n 0) nil)
((or (= n 0) (= n 1)) 1)
(t (+ (fib (1- n)) (fib (- n 2)))))))
(setf len *LEN1*
p (cffi:foreign-alloc :int :count *LEN1*
:initial-contents (loop for i from 0
to (1- *LEN1*)
collect (fib i))))))
wdata))
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((wdata (create-wdata))
(filetype (h5tvlen-create +H5T-STD-I32LE+))
(memtype (h5tvlen-create +H5T-NATIVE-INT+))
(space (h5ex:create-simple-dataspace '(2)))
;; Create the dataset and write the variable-length data to it.
(dset (h5dcreate2 file *DATASET* filetype space
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5dwrite dset memtype +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+ wdata)
;; Close and release resources. Note the use of H5Dvlen_reclaim
;; removes the need to manually free() the previously malloc'ed
;; data.
(h5dvlen-reclaim memtype space +H5P-DEFAULT+ wdata)
(h5ex:close-handles (list dset space memtype filetype))
(cffi:foreign-free wdata))
(h5ex:close-handles (list file fapl))))
;; Now we begin the read section of this example. Here we assume
;; the dataset has the same name and rank, but can have any size.
;; Therefore we must allocate a new array to read in data dynamically.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
;; Get dataspace and allocate memory for array of vlen structures.
;; This does not actually allocate memory for the vlen data, that
;; will be done by the library.
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(space (h5dget-space dset)))
(cffi:with-foreign-object (dims 'hsize-t 1)
(h5sget-simple-extent-dims space dims +NULL+)
(let ((dims[0] (cffi:mem-aref dims 'hsize-t 0))
(memtype (h5tvlen-create +H5T-NATIVE-INT+)))
(cffi:with-foreign-object (rdata '(:struct hvl-t) dims[0])
;; Read the data.
(h5dread dset memtype +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+ rdata)
;; Output the variable-length data to the screen.
(dotimes (i dims[0])
(format t "~a[~d]:~% {" *DATASET* i)
(let ((rdata[i] (cffi:mem-aptr rdata '(:struct hvl-t) i)))
(cffi:with-foreign-slots ((len p) rdata[i] (:struct hvl-t))
(dotimes (j len)
(format t " ~d" (cffi:mem-aref p :int j))
(when (< (1+ j) len) (format t ",")))
(format t " }~%"))))
;; Close and release resources. Note we must still free the
;; top-level pointer "rdata", as H5Dvlen_reclaim only frees the
;; actual variable-length data, and not the structures
;; themselves.
(h5dvlen-reclaim memtype space +H5P-DEFAULT+ rdata))
(h5tclose memtype)))
(h5ex:close-handles (list space dset)))
(h5ex:close-handles (list file fapl))))
| 5,441 | Common Lisp | .lisp | 99 | 42.929293 | 99 | 0.569684 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | b25cec54649ff356e0e8b71a9942911a6e0b050a345d3016acb6ae14aeb153cc | 1,565 | [
-1
] |
1,566 | h5ex-t-cmpdatt.lisp | ghollisjr_cl-ana/hdf-cffi/examples/datatypes/h5ex-t-cmpdatt.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to read and write compound
;;; datatypes to an attribute. The program first writes
;;; compound structures to an attribute with a dataspace of
;;; DIM0, then closes the file. Next, it reopens the file,
;;; reads back the data, and outputs it to the screen.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_cmpdatt.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_t_cmpdatt.h5" *load-pathname*)))
(defparameter *DATASET* "DS1")
(defparameter *ATTRIBUTE* "A1")
(defparameter *DIM0* 4)
(cffi:defcstruct sensor-t
(serial-no :int)
(location :string)
(temperature :double)
(pressure :double))
(defun create-memtype ()
(let ((strtype (h5ex:create-c-string-type))
(result (h5tcreate :H5T-COMPOUND
(cffi:foreign-type-size '(:struct sensor-t)))))
(h5tinsert result "Serial number"
(cffi:foreign-slot-offset '(:struct sensor-t) 'serial-no)
+H5T-NATIVE-INT+)
(h5tinsert result "Location"
(cffi:foreign-slot-offset '(:struct sensor-t) 'location)
strtype)
(h5tinsert result "Temperature (F)"
(cffi:foreign-slot-offset '(:struct sensor-t) 'temperature)
+H5T-NATIVE-DOUBLE+)
(h5tinsert result "Pressure (inHg)"
(cffi:foreign-slot-offset '(:struct sensor-t) 'pressure)
+H5T-NATIVE-DOUBLE+)
(h5tclose strtype)
result))
(defun create-filetype ()
;; Create the compound datatype for the file. Because the
;; standard types we are using for the file may have different
;; sizes than the corresponding native types, we must manually
;; calculate the offset of each member.
(let ((strtype (h5ex:create-c-string-type))
(result (h5tcreate :H5T-COMPOUND
(+ 8 (cffi:foreign-type-size '(:struct hvl-t)) 8
8))))
(h5tinsert result "Serial number" 0 +H5T-STD-I64BE+)
(h5tinsert result "Location" 8 strtype)
(h5tinsert result "Temperature (F)" (+ 8 (cffi:foreign-type-size
'(:struct hvl-t)))
+H5T-IEEE-F64BE+)
(h5tinsert result "Pressure (inHg)" (+ 8 (cffi:foreign-type-size
'(:struct hvl-t))
8)
+H5T-IEEE-F64BE+)
(h5tclose strtype)
result))
(cffi:with-foreign-object (wdata '(:struct sensor-t) *DIM0*)
;; Initialize data.
(let ((wdata[0] (cffi:mem-aptr wdata '(:struct sensor-t) 0))
(wdata[1] (cffi:mem-aptr wdata '(:struct sensor-t) 1))
(wdata[2] (cffi:mem-aptr wdata '(:struct sensor-t) 2))
(wdata[3] (cffi:mem-aptr wdata '(:struct sensor-t) 3)))
(cffi:with-foreign-slots ((serial-no location temperature pressure)
wdata[0] (:struct sensor-t))
(setf serial-no 1153 location "Exterior (static)" temperature 53.23d0
pressure 24.57d0))
(cffi:with-foreign-slots ((serial-no location temperature pressure)
wdata[1] (:struct sensor-t))
(setf serial-no 1184 location "Intake" temperature 55.12d0
pressure 22.95d0))
(cffi:with-foreign-slots ((serial-no location temperature pressure)
wdata[2] (:struct sensor-t))
(setf serial-no 1027 location "Intake manifold" temperature 103.55d0
pressure 31.23d0))
(cffi:with-foreign-slots ((serial-no location temperature pressure)
wdata[3] (:struct sensor-t))
(setf serial-no 1313 location "Exhaust manifold" temperature 1252.89d0
pressure 84.11d0)))
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((dspace (h5ex:create-null-dataspace))
(dset (h5dcreate2 file *DATASET* +H5T-STD-I32LE+ dspace
+H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+))
(filetype (create-filetype))
(aspace (h5ex:create-simple-dataspace `(,*DIM0*)))
(attr (h5acreate2 dset *ATTRIBUTE* filetype aspace
+H5P-DEFAULT+ +H5P-DEFAULT+))
(memtype (create-memtype)))
(h5awrite attr memtype wdata)
;; Close and release resources.
(h5ex:close-handles (list memtype attr aspace filetype dset dspace)))
(h5ex:close-handles (list file fapl)))))
;; Now we begin the read section of this example. Here we assume
;; the attribute has the same name and rank, but can have any size.
;; Therefore we must allocate a new array to read in data dynamicaly
(cffi:with-foreign-object (dims 'hsize-t 1)
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+))
(attr (h5aopen dset *ATTRIBUTE* +H5P-DEFAULT+))
(space (h5aget-space attr))
(memtype (create-memtype)))
;; Get dataspace and allocate memory for read buffer.
(h5sget-simple-extent-dims space dims +NULL+)
(let* ((dims[0] (cffi:mem-aref dims 'hsize-t 0))
(rdata (cffi:foreign-alloc '(:struct sensor-t)
:count dims[0])))
(h5aread attr memtype rdata)
;; Output the data to the screen.
(dotimes (i dims[0])
(format t "~a[~a]:~%" *ATTRIBUTE* i)
(cffi:with-foreign-slots ((serial-no location temperature
pressure)
(cffi:mem-aptr rdata
'(:struct sensor-t) i)
(:struct sensor-t))
(format t "Serial number : ~d~%" serial-no)
(format t "Location : ~a~%" location)
(format t "Temperature (F) : ~6$~%" temperature)
(format t "Pressure (inHg) : ~6$~%~%" pressure)))
(h5dvlen-reclaim memtype space +H5P-DEFAULT+ rdata)
(cffi:foreign-free rdata))
(h5ex:close-handles (list memtype space attr dset)))
(h5ex:close-handles (list file fapl)))))
| 6,239 | Common Lisp | .lisp | 136 | 40.279412 | 102 | 0.6676 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 75e834facdac7271dd43f535ebf92994bd51818d5059de1aaba5b1bd056b6c4d | 1,566 | [
-1
] |
1,567 | h5ex-g-intermediate.lisp | ghollisjr_cl-ana/hdf-cffi/examples/groups/h5ex-g-intermediate.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to create intermediate groups with
;;; a single call to H5Gcreate.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5G/h5ex_g_intermediate.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_g_intermediate.h5" *load-pathname*)))
;;; the callback function for H5Ovisit
(cffi:defcallback op-func herr-t
((loc-id hid-t)
(name :string)
(info (:pointer (:struct h5o-info-t)))
(operator-data :pointer))
(declare (ignore loc-id operator-data))
(cffi:with-foreign-slots ((type) info (:struct h5o-info-t))
(format t "/")
(if (equal name ".")
(format t " (Group)~%")
(cond
((eql type :H5O-TYPE-GROUP)
(format t "~a (Group)~%" name))
((eql type :H5O-TYPE-DATASET)
(format t "~a (Dataset)~%" name))
((eql type :H5O-TYPE-NAMED-DATATYPE)
(format t "~a (Datatype)~%" name))
(t (format t "~a (Unknown)~%" name))))
0))
;;; Showtime
(let*
((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let* ((gcpl (h5pcreate +H5P-LINK-CREATE+))
(group (prog2
(h5pset-create-intermediate-group gcpl 1)
;; Create the group /G1/G2/G3. Note that /G1 and
;; /G1/G2 do not exist yet. This call would cause
;; an error if we did not use the previously created
;; property list.
(h5gcreate2 file "/G1/G2/G3" gcpl
+H5P-DEFAULT+ +H5P-DEFAULT+))))
(format t "Objects in the file:~%")
(h5ovisit file :H5-INDEX-NAME :H5-ITER-NATIVE
(cffi:callback op-func) +NULL+)
(h5ex:close-handles (list group gcpl)))
(h5ex:close-handles (list file fapl))))
| 2,467 | Common Lisp | .lisp | 54 | 37.055556 | 107 | 0.587255 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | c07382fc184aee270f1cad0e8e2cc322abd72ae0ffa6129081e3259b17c5ac37 | 1,567 | [
-1
] |
1,568 | h5ex-g-iterate.lisp | ghollisjr_cl-ana/hdf-cffi/examples/groups/h5ex-g-iterate.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to iterate over group members using H5Literate.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5G/h5ex_g_iterate.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_g_iterate.h5" *load-pathname*)))
;;; the callback function
(cffi:defcallback op-func herr-t
((loc-id hid-t)
(name :string)
(info (:pointer (:struct h5l-info-t)))
(operator-data :pointer))
(declare (ignore info operator-data))
(cffi:with-foreign-object (infobuf '(:struct h5o-info-t) 1)
(h5oget-info-by-name loc-id name
(cffi:mem-aptr infobuf '(:struct h5o-info-t) 0)
+H5P-DEFAULT+)
;; retrieve the object type and display the link name
(cffi:with-foreign-slots ((type) infobuf (:struct h5o-info-t))
(cond
((eql type :H5O-TYPE-GROUP)
(format t " Group: ~a~%" name))
((eql type :H5O-TYPE-DATASET)
(format t " Dataset: ~a~%" name))
((eql type :H5O-TYPE-NAMED-DATATYPE)
(format t " Datatype: ~a~%" name))
(t (format t " Unknown: ~a~%" name))))
0))
;;; Showtime
(let*
((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(progn
;; iterate over the links and invoke the callback
(format t "Objects in root group:~%")
(h5literate file :H5-INDEX-NAME :H5-ITER-NATIVE
+NULL+ (cffi:callback op-func) +NULL+))
(h5ex:close-handles (list file fapl))))
| 2,085 | Common Lisp | .lisp | 47 | 38.170213 | 102 | 0.630617 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 966c0ff313cef2e2e2e49e905aac0009d3bee8981901d0c4cacda711c24d4c13 | 1,568 | [
-1
] |
1,569 | h5ex-g-corder.lisp | ghollisjr_cl-ana/hdf-cffi/examples/groups/h5ex-g-corder.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to track links in a group by
;;; creation order. The program creates a series of groups,
;;; then reads back their names: first in alphabetical order,
;;; then in creation order.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5G/h5ex_g_corder.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_g_corder.h5" *load-pathname*)))
(cffi:with-foreign-object (ginfo '(:struct h5g-info-t) 1)
;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
;; Create group creation property list and enable link creation
;; order tracking. Attempting to track by creation order in a
;; group that does not have this property set will result in an
;; error.
(let* ((gcpl (h5pcreate +H5P-GROUP-CREATE+))
(group (prog2 (h5pset-link-creation-order
gcpl (logior +H5P-CRT-ORDER-TRACKED+
+H5P-CRT-ORDER-INDEXED+))
(h5gcreate2 file "index_group" +H5P-DEFAULT+
gcpl +H5P-DEFAULT+))))
;; Create subgroups in the primary group. These will be tracked
;; by creation order. Note that these groups do not have to have
;; the creation order tracking property set.
(h5ex:close-handles (list (h5gcreate2 group "H" +H5P-DEFAULT+
+H5P-DEFAULT+ +H5P-DEFAULT+)
(h5gcreate2 group "D" +H5P-DEFAULT+
+H5P-DEFAULT+ +H5P-DEFAULT+)
(h5gcreate2 group "F" +H5P-DEFAULT+
+H5P-DEFAULT+ +H5P-DEFAULT+)
(h5gcreate2 group "5" +H5P-DEFAULT+
+H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5gget-info group ginfo)
;; Traverse links in the primary group using alphabetical indices
;; (H5_INDEX_NAME).
(format t "Traversing group using alphabetical indices:~%~%")
(cffi:with-foreign-slots ((nlinks) ginfo (:struct h5g-info-t))
(dotimes (i nlinks)
;; Get size of name, add 1 for null terminator.
;; Allocate storage for name.
(let* ((size (1+ (h5lget-name-by-idx group "."
:H5-INDEX-NAME
:H5-ITER-INC i +NULL+ 0
+H5P-DEFAULT+)))
(name (cffi:foreign-alloc :char :count size)))
;; Retrieve name, print it, and free the previously
;; allocated space.
(h5lget-name-by-idx group "." :H5-INDEX-NAME
:H5-ITER-INC i name size +H5P-DEFAULT+)
(format t "Index ~a: ~a~%" i
(cffi:foreign-string-to-lisp name))
(cffi:foreign-free name)))
;; Traverse links in the primary group by creation order
;; (H5_INDEX_CRT_ORDER).
(format t "~%Traversing group using creation order indices:~%~%")
(dotimes (i nlinks)
;; Get size of name, add 1 for null terminator.
;; Allocate storage for name.
(let* ((size (1+ (h5lget-name-by-idx group "."
:H5-INDEX-CRT-ORDER
:H5-ITER-INC i +NULL+ 0
+H5P-DEFAULT+)))
(name (cffi:foreign-alloc :char :count size)))
;; Retrieve name, print it, and free the previously
;; allocated space.
(h5lget-name-by-idx group "." :H5-INDEX-CRT-ORDER
:H5-ITER-INC i name size +H5P-DEFAULT+)
(format t "Index ~a: ~a~%" i
(cffi:foreign-string-to-lisp name))
(cffi:foreign-free name))))
(h5ex:close-handles (list group gcpl)))
(h5ex:close-handles (list file fapl)))))
| 3,868 | Common Lisp | .lisp | 83 | 40.843373 | 101 | 0.660202 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 1ec48285e24e6fc488b9c950ea7f337e8fb8e845ea9a846d087ae1816b1cad24 | 1,569 | [
-1
] |
1,570 | h5ex-g-create.lisp | ghollisjr_cl-ana/hdf-cffi/examples/groups/h5ex-g-create.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to create, open, and close a group.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5G/h5ex_g_create.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_g_create.h5" *load-pathname*)))
;;; Create a new file using the default properties.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(progn
;; Create a group named "G1" in the file.
(h5gclose (h5gcreate2 file "/G1" +H5P-DEFAULT+
+H5P-DEFAULT+ +H5P-DEFAULT+))
;; Re-open the group, obtaining a new handle.
(let ((group (h5gopen2 file "/G1" +H5P-DEFAULT+)))
(h5gclose group)))
(h5ex:close-handles (list file fapl))))
| 1,255 | Common Lisp | .lisp | 26 | 45.153846 | 101 | 0.699754 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 7002276bfc95a23e6e0f1415465b03472881868e1c483e554f2c5a209591b5d8 | 1,570 | [
-1
] |
1,571 | h5ex-g-visit.lisp | ghollisjr_cl-ana/hdf-cffi/examples/groups/h5ex-g-visit.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; help @hdfgroup.org.
;;; This example shows how to recursively traverse a file
;;; using H5Ovisit and H5Lvisit. The program prints all of
;;; the objects in the file specified in FILE, then prints all
;;; of the links in that file.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5G/h5ex_g_visit.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_g_visit.h5" *load-pathname*)))
;;; I'm not sure how to invoke a CFFI callback as a LISP function.
;;; This is a workaround...
(defun print-info-et-name (info name)
(format t "/")
(let ((type (cffi:foreign-slot-value info '(:struct h5o-info-t) 'type)))
(if (equal name ".")
(format t " (Group)~%")
(cond
((eql type :H5O-TYPE-GROUP)
(format t "~a (Group)~%" name))
((eql type :H5O-TYPE-DATASET)
(format t "~a (Dataset)~%" name))
((eql type :H5O-TYPE-NAMED-DATATYPE)
(format t "~a (Datatype)~%" name))
(t (format t "~a (Unknown)~%" name))))))
;;; the callback function for H5Ovisit
(cffi:defcallback op-func herr-t
((loc-id hid-t)
(name :string)
(info (:pointer (:struct h5o-info-t)))
(operator-data :pointer))
(declare (ignore loc-id operator-data))
(print-info-et-name info name)
0)
;;; the callback function for H5Lvisit
(cffi:defcallback op-func-l herr-t
((loc-id hid-t)
(name :string)
(info (:pointer (:struct h5l-info-t)))
(operator-data :pointer))
(declare (ignore info operator-data))
(cffi:with-foreign-object (infobuf '(:struct h5o-info-t) 1)
(h5oget-info-by-name loc-id name infobuf +H5P-DEFAULT+)
(print-info-et-name infobuf name))
0)
;;; Showtime
(let*
((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(progn
(format t "Objects in the file:~%")
(h5ovisit file :H5-INDEX-NAME :H5-ITER-NATIVE
(cffi:callback op-func) +NULL+)
(format t "~%Links in the file:~%")
(h5lvisit file :H5-INDEX-NAME :H5-ITER-NATIVE
(cffi:callback op-func-l) +NULL+)))
(h5ex:close-handles (list file fapl)))
| 2,718 | Common Lisp | .lisp | 65 | 36.815385 | 100 | 0.633472 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 85940463e03c7c52baa9a7ea065aa8ed83aac5f3ca5dfa8e742a8ad6b82d72c5 | 1,571 | [
-1
] |
1,572 | h5ex-g-compact.lisp | ghollisjr_cl-ana/hdf-cffi/examples/groups/h5ex-g-compact.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to create "compact-or-indexed"
;;; format groups, new to 1.8. This example also illustrates
;;; the space savings of compact groups by creating 2 files
;;; which are identical except for the group format, and
;;; displaying the file size of each. Both files have one
;;; empty group in the root group.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5G/h5ex_g_compact.c
(in-package :hdf5)
(defparameter *FILE1* (namestring (merge-pathnames "h5ex_g_compact1.h5" *load-pathname*)))
(defparameter *FILE2* (namestring (merge-pathnames "h5ex_g_compact2.h5" *load-pathname*)))
(defparameter *GROUP* "G1")
(defun print-storage-type (type)
(cond
((eql type :H5G-STORAGE-TYPE-SYMBOL-TABLE)
(format t "~a~%" "H5G_STORAGE_TYPE_SYMBOL_TABLE"))
((eql type :H5G-STORAGE-TYPE-COMPACT)
(format t "~a~%" "H5G_STORAGE_TYPE_COMPACT"))
((eql type :H5G-STORAGE-TYPE-DENSE)
(format t "~a~%" "H5G_STORAGE_TYPE_DENSE"))
(t (format t "~a~%" "H5G_STORAGE_TYPE_UNKNOWN"))))
(cffi:with-foreign-objects ((ginfo '(:struct h5g-info-t) 1)
(size 'hsize-t 1))
;; Create file 1. This file will use original format groups.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fcreate *FILE1* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
;; Obtain the group info and print the group storage type.
(let ((group (h5gcreate2 file *GROUP* +H5P-DEFAULT+
+H5P-DEFAULT+ +H5P-DEFAULT+)))
(h5gget-info group ginfo)
(format t "Group storage type for ~a is: " *FILE1*)
(cffi:with-foreign-slots ((storage-type)
ginfo (:struct h5g-info-t))
(print-storage-type storage-type))
(h5gclose group))
;; Close and re-open file. Needed to get the correct file size.
(h5ex:close-handles (list file fapl)))
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE1* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(h5fget-filesize file size)
(format t "File size for ~a is: ~a bytes~%~%" *FILE1*
(cffi:mem-aref size 'hsize-t 0))
(h5ex:close-handles (list file fapl))))
;; Set file access property list to allow the latest file format.
;; This will allow the library to create new compact format groups.
;; Set file access property list to allow the latest file format.
;; This will allow the library to create new compact format groups.
;;
;; Create file 2 using the new file access property list.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (progn
(h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5pset-libver-bounds fapl :H5F-LIBVER-LATEST
:H5F-LIBVER-LATEST)
(h5fcreate *FILE2* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
(let ((group (h5gcreate2 file *GROUP* +H5P-DEFAULT+ +H5P-DEFAULT+
+H5P-DEFAULT+)))
;; Obtain the group info and print the group storage type.
(h5gget-info group ginfo)
(format t "Group storage type for ~a is: " *FILE2*)
(cffi:with-foreign-slots ((storage-type)
ginfo (:struct h5g-info-t))
(print-storage-type storage-type))
(h5gclose group))
;; Close and re-open file. Needed to get the correct file size.
(h5ex:close-handles (list file fapl))))
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE2* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(progn
(h5fget-filesize file size)
(format t "File size for ~a is: ~a bytes~%~%" *FILE2*
(cffi:mem-aref size 'hsize-t 0)))
(h5ex:close-handles (list file fapl))))))
| 4,178 | Common Lisp | .lisp | 88 | 42.795455 | 102 | 0.678133 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 8dba3c39bbed70b961327b8bb7f1095697ad37f029fc326047943f5c2b58b22c | 1,572 | [
-1
] |
1,573 | h5ex-g-traverse.lisp | ghollisjr_cl-ana/hdf-cffi/examples/groups/h5ex-g-traverse.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows a way to recursively traverse the file
;;; using H5Literate. The method shown here guarantees that
;;; the recursion will not enter an infinite loop, but does
;;; not prevent objects from being visited more than once.
;;; The program prints the directory structure of the file
;;; specified in FILE.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5G/h5ex_g_traverse.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_g_traverse.h5" *load-pathname*)))
;;; Define operator data structure type for H5Literate callback.
;;; During recursive iteration, these structures will form a
;;; linked list that can be searched for duplicate groups,
;;; preventing infinite recursion.
(cffi:defcstruct opdata
(recurs :unsigned-int) ; Recursion level. 0=root
(prev :pointer) ; Pointer to previous opdata
(addr haddr-t)) ; Group address
;;; Function to check for duplicate groups in a path.
;;;
;;; This function recursively searches the linked list of
;;; opdata structures for one whose address matches
;;; target_addr. Returns T if a match is found, and NIL
;;; otherwise.
(defun group-check (opdata target-addr)
(cffi:with-foreign-slots ((addr recurs prev) opdata (:struct opdata))
(cond ((eql addr target-addr) t) ; Addresses match
((eql 0 recurs) nil) ; Root group reached with no matches
(t (group-check prev target-addr))))) ; examine the next node
;;; Operator function. This function prints the name and type
;;; of the object passed to it. If the object is a group, it
;;; is first checked against other groups in its path using
;;; the group_check function, then if it is not a duplicate,
;;; H5Literate is called for that group. This guarantees that
;;; the program will not enter infinite recursion due to a
;;; circular path in the file.
(cffi:defcallback op-func herr-t
((loc-id hid-t)
(name (:pointer :char))
(info (:pointer (:struct h5l-info-t)))
(operator-data :pointer))
(declare (ignore info))
(cffi:with-foreign-objects ((infobuf '(:struct h5o-info-t) 1)
(nextod '(:struct opdata) 1))
(let* ((return-val 0)
(od.recurs (cffi:foreign-slot-value
operator-data '(:struct opdata) 'recurs))
;; Number of whitespaces to prepend to output
(spaces (* 2 (1+ od.recurs)))
(name-string (cffi:foreign-string-to-lisp name)))
;; Get type of the object and display its name and type.
;; The name of the object is passed to this function by
;; the Library.
(h5oget-info-by-name loc-id name infobuf +H5P-DEFAULT+)
(format t "~VA" spaces #\Space)
(cffi:with-foreign-slots ((type addr) infobuf (:struct h5o-info-t))
(let ((infobuf.type type)
(infobuf.addr addr))
(cond
((eql infobuf.type :H5O-TYPE-GROUP)
(format t "Group: ~a {~%" name-string)
(cond ((group-check operator-data infobuf.addr)
(format t "~VA Warning: Loop detected!~%"
spaces #\Space))
(t (cffi:with-foreign-slots ((recurs prev addr)
nextod (:struct opdata))
(setf recurs (1+ od.recurs)
prev operator-data
addr infobuf.addr))
(setq return-val (h5literate-by-name
loc-id name :H5-INDEX-NAME
:H5-ITER-NATIVE +NULL+
(cffi:callback op-func)
nextod +H5P-DEFAULT+))))
(format t "~VA}~%" spaces #\Space))
((eql infobuf.type :H5O-TYPE-DATASET)
(format t "Dataset: ~a~%" name-string))
((eql infobuf.type :H5O-TYPE-NAMED-DATATYPE)
(format t "Datatype: ~a~%" name-string))
(t (format t "Unknown: ~a~%" name-string)))))
return-val)))
(cffi:with-foreign-objects ((infobuf '(:struct h5o-info-t) 1)
(od '(:struct opdata) 1))
;; Open file and initialize the operator data structure.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5fopen *FILE* +H5F-ACC-RDONLY+ fapl))))
(unwind-protect
(progn
(h5oget-info file infobuf)
(cffi:with-foreign-slots ((recurs prev addr) od (:struct opdata))
(setf recurs 0
prev +NULL+
addr (cffi:foreign-slot-value
infobuf '(:struct h5o-info-t) 'addr)))
(format t "/ {~%")
(h5literate file :H5-INDEX-NAME :H5-ITER-NATIVE
+NULL+ (cffi:callback op-func) od)
(format t "}~%"))
(h5ex:close-handles (list file fapl)))))
| 5,462 | Common Lisp | .lisp | 108 | 40.583333 | 103 | 0.598425 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | c21e0211aeb101f3b7eb6f656fc22cb4ea12678e7cdc1b8bb7723b89060e9103 | 1,573 | [
-1
] |
1,574 | h5ex-g-phase.lisp | ghollisjr_cl-ana/hdf-cffi/examples/groups/h5ex-g-phase.lisp | ;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; This example shows how to set the conditions for
;;; conversion between compact and dense (indexed) groups.
;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5G/h5ex_g_phase.c
(in-package :hdf5)
(defparameter *FILE* (namestring (merge-pathnames "h5ex_g_phase.h5" *load-pathname*)))
(defparameter *MAX-GROUPS* 7)
(defparameter *MAX-COMPACT* 5)
(defparameter *MIN-DENSE* 3)
(defun print-groups-storage-type (nlinks type)
(format t "~a Group~a: Storage type is " nlinks
(if (eql nlinks 1) " " "s"))
(cond ((eql type :H5G-STORAGE-TYPE-COMPACT) ; New compact format
(format t "~a~%" "H5G_STORAGE_TYPE_COMPACT"))
((eql type :H5G-STORAGE-TYPE-DENSE) ; New dense (indexed) format
(format t "~a~%" "H5G_STORAGE_TYPE_DENSE"))
((eql type :H5G-STORAGE-TYPE-SYMBOL-TABLE) ; Original format
(format t "~a~%" "H5G_STORAGE_TYPE_SYMBOL_TABLE"))
(t (format t "~a~%" "H5G_STORAGE_TYPE_UNKNOWN"))))
(cffi:with-foreign-objects ((ginfo '(:struct h5g-info-t) 1))
;; Set file access property list to allow the latest file format.
;; This will allow the library to create new format groups.
(let* ((fapl (h5pcreate +H5P-FILE-ACCESS+))
(file (progn
(h5pset-fclose-degree fapl :H5F-CLOSE-STRONG)
(h5pset-libver-bounds fapl :H5F-LIBVER-LATEST
:H5F-LIBVER-LATEST)
(h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl))))
(unwind-protect
;; Create group access property list and set the phase change
;; conditions. In this example we lowered the conversion
;; threshold to simplify the output, though this may not be
;; optimal.
(let* ((gcpl (h5pcreate +H5P-GROUP-CREATE+))
(group (prog2 (h5pset-link-phase-change
gcpl *MAX-COMPACT* *MIN-DENSE*)
(h5gcreate2 file "G0" +H5P-DEFAULT+ gcpl
+H5P-DEFAULT+))))
;; Add subgroups to "group" one at a time, print the storage
;; type for "group" after each subgroup is created.
(dotimes (i *MAX-GROUPS*)
;; Define the subgroup name and create the subgroup.
(cffi:with-foreign-string (name (format nil "G~a" (1+ i)))
(h5gclose (h5gcreate2 group name +H5P-DEFAULT+
+H5P-DEFAULT+ +H5P-DEFAULT+)))
;; Obtain the group info and print the group storage type
(h5gget-info group ginfo)
(cffi:with-foreign-slots ((nlinks storage-type)
ginfo (:struct h5g-info-t))
(print-groups-storage-type nlinks storage-type)))
(format t "~%")
;; Delete subgroups one at a time, print the storage type for
;; "group" after each subgroup is deleted.
(dotimes (i *MAX-GROUPS*)
;; Define the subgroup name and delete the subgroup.
(cffi:with-foreign-string (name (format nil "G~a"
(- *MAX-GROUPS* i)))
(h5ldelete group name +H5P-DEFAULT+))
;; Obtain the group info and print the group storage type
(h5gget-info group ginfo)
(cffi:with-foreign-slots ((nlinks storage-type)
ginfo (:struct h5g-info-t))
(print-groups-storage-type nlinks storage-type)))
(h5ex:close-handles (list group gcpl)))
(h5ex:close-handles (list file fapl)))))
| 3,556 | Common Lisp | .lisp | 73 | 43.794521 | 100 | 0.682292 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | ca483257ff9a56f1d7ac91646a99135470259d6ab8aab2e3196f36f479e3a780 | 1,574 | [
-1
] |
1,575 | h5r-grovel.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5r-grovel.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(pkg-config-cflags "hdf5" :optional t)
(define "_H5private_H") ; See GROVELLER-HACKING-NOTE.md for explanation
(include "hdf5.h")
(in-package #:hdf5)
(cenum h5r-type-t
((:H5R-BADTYPE "H5R_BADTYPE"))
((:H5R-OBJECT "H5R_OBJECT"))
((:H5R-DATASET-REGION "H5R_DATASET_REGION"))
((:H5R-MAXTYPE "H5R_MAXTYPE")))
(constant (+H5R-OBJ-REF-BUF-SIZE+ "H5R_OBJ_REF_BUF_SIZE"))
(ctype hobj-ref-t "hobj_ref_t")
(constant (+H5R-DSET-REG-REF-BUF-SIZE+ "H5R_DSET_REG_REF_BUF_SIZE"))
(cstruct hdset-reg-ref-t "hdset_reg_ref_t")
| 1,041 | Common Lisp | .lisp | 24 | 40.916667 | 77 | 0.666337 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | dcc5a3e859593d5efe9b729bcd89cf322e14641ffd8903ebca2dca19963c7e10 | 1,575 | [
-1
] |
1,576 | h5d.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5d.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; See H5Dpublih.h .
(in-package #:hdf5)
(defcfun "H5Dclose" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-Close"
(dataset-id hid-t))
(defcfun "H5Dcreate1" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-Create1"
(loc-id hid-t)
(name :string)
(type-id hid-t)
(space-id hid-t)
(dcpl-id hid-t))
(defcfun "H5Dcreate2" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-Create2"
(loc-id hid-t)
(name :string)
(dtype-id hid-t)
(space-id hid-t)
(lcpl-id hid-t)
(dcpl-id hid-t)
(dapl hid-t))
(defcfun "H5Dcreate_anon" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-CreateAnon"
(loc-id hid-t)
(type-id hid-t)
(space-id hid-t)
(dcpl-id hid-t)
(dapl hid-t))
(defcfun "H5Dfill" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-Fill"
(fill :pointer)
(fill-type-id hid-t)
(buf :pointer)
(buf-type-id hid-t)
(space-id hid-t))
(defcfun "H5Dgather" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-Gather"
(src-space-id hid-t)
(src-buf :pointer)
(type-id hid-t)
(dst-buf-size size-t)
(dst-buf :pointer)
(op :pointer)
(op-data :pointer))
(defcfun "H5Dget_access_plist" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-GetAccessPlist"
(dataset-id hid-t))
(defcfun "H5Dget_create_plist" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-GetCreatePlist"
(dataset-id hid-t))
(defcfun "H5Dget_offset" haddr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-GetOffset"
(dataset-id hid-t))
(defcfun "H5Dget_space" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-GetSpace"
(dataset-id hid-t))
(defcfun "H5Dget_space_status" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-GetSpaceStatus"
(dataset-id hid-t)
(status (:pointer h5d-space-status-t)))
(defcfun "H5Dget_storage_size" hsize-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-GetStorageSize"
(dataset-id hid-t))
(defcfun "H5Dget_type" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-GetType"
(dataset-id hid-t))
(defcfun "H5Diterate" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-Iterate"
(buf :pointer)
(type-id hid-t)
(space-id hid-t)
(operator :pointer)
(operator-data :pointer))
(defcfun "H5Dopen2" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-Open2"
(loc-id hid-t)
(name :string)
(dapl-id hid-t))
(defcfun "H5Dread" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-Read"
(dataset-id hid-t)
(mem-type-id hid-t)
(mem-dataspace-id hid-t)
(file-dataspace-id hid-t)
(xfer-plist-id hid-t)
(buffer :pointer))
(defcfun "H5Dscatter" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-Scatter"
(op :pointer)
(op-data :pointer)
(type-id hid-t)
(dst-space-id hid-t)
(dst-buf :pointer))
(defcfun "H5Dset_extent" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-SetExtent"
(dset-id hid-t)
(size (:pointer hsize-t)))
(defcfun "H5Dvlen_get_buf_size" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-VLGetBuf"
(dataset-id hid-t)
(type-id hid-t)
(space-id hid-t)
(size (:pointer hsize-t)))
(defcfun "H5Dvlen_reclaim" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-VLReclaim"
(type-id hid-t)
(space_id hid-t)
(plist-id hid-t)
(buf :pointer))
(defcfun "H5Dwrite" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-Write"
(datset-id hid-t)
(mem-type-id hid-t)
(mem-space-id hid-t)
(file-space-id hid-t)
(xfer-plist-id hid-t)
(buf :pointer))
| 4,351 | Common Lisp | .lisp | 128 | 31.34375 | 77 | 0.667143 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 6b8dd3aef81d9e05e194b30397633a0544e51524bd343566fbf2e7a948ba0635 | 1,576 | [
-1
] |
1,577 | package.lisp | ghollisjr_cl-ana/hdf-cffi/src/package.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(defpackage #:hdf5
(:documentation "hdf5-cffi library: Common LISP binding for the HDF5 library")
(:use #:cl #:cffi)
(:shadow "OFF-T" "SIZE-T")
(:export #:load-hdf5-foreign-libraries
#:+NULL+
#:size-t
#:time-t
#:off-t
;; == h5 ===========================================================
#:+H5-VERS-MAJOR+
#:+H5-VERS-MINOR+
#:+H5-VERS-RELEASE+
#:herr-t
#:hbool-t
#:htri-t
#:ssize-t
#:hsize-t
#:hssize-t
#:haddr-t
#:+HADDR-UNDEF+
#:+HADDR-MAX+
#:h5-iter-order-t
#:+H5-ITER-ERROR+
#:+H5-ITER-CONT+
#:+H5-ITER-STOP+
#:h5-index-t
#:h5-ih-info-t
#:h5allocate-memory
#:h5check-version
#:h5close
#:h5dont-atexit
#:h5free-memory
#:h5garbage-collect
#:h5get-libversion
#:h5is-library-threadsafe
#:h5open
#:h5resize-memory
#:h5set-free-list-limits
;; == h5i ==========================================================
#:h5i-type-t
#:hid-t
#:+H5-SIZEOF-HID-T+
#:+H5I-INVALID-HID+
#:h5iclear-type
#:h5idec-ref
#:h5idec-type-ref
#:h5idestroy-type
#:h5iget-file-id
#:h5iget-name
#:h5iget-ref
#:h5iget-type
#:h5iget-type-ref
#:h5iinc-ref
#:h5inc-type-ref
#:h5iis-valid
#:h5inmembers
#:h5iobject-verify
#:h5iregister
#:h5iregister-type
#:h5iremove-verify
#:h5isearch
#:h5itype-exists
;; == h5f ==========================================================
#:+H5F-ACC-RDONLY+
#:+H5F-ACC-RDWR+
#:+H5F-ACC-TRUNC+
#:+H5F-ACC-EXCL+
#:+H5F-ACC-DEBUG+
#:+H5F-ACC-CREAT+
#:+H5F-ACC-DEFAULT+
#:+H5F-OBJ-FILE+
#:+H5F-OBJ-DATASET+
#:+H5F-OBJ-GROUP+
#:+H5F-OBJ-DATATYPE+
#:+H5F-OBJ-ATTR+
#:+H5F-OBJ-ALL+
#:+H5F-OBJ-LOCAL+
#:h5f-scope-t
#:+H5F-UNLIMITED+
#:h5f-close-degree-t
#:h5f-info-t
#:h5f-libver-t
#:h5fclear-elink-file-cache
#:h5fclose
#:h5fcreate
#:h5fflush
#:h5fget-access-plist
#:h5fget-create-plist
#:h5fget-file-image
#:h5fget-filesize
#:h5fget-freespace
#:h5fget-info
#:h5fget-intent
#:h5fget-name
#:h5fget-obj-count
#:h5fget-obj-ids
#:h5fis-hdf5
#:h5fmount
#:h5fopen
#:h5freopen
#:h5funmount
;; == h5t ==========================================================
#:h5t-class-t
#:h5t-order-t
#:h5t-sign-t
#:h5t-norm-t
#:h5t-cset-t
#:+H5T-NCSET+
#:h5t-str-t
#:+H5T-NSTR+
#:h5t-pad-t
#:h5t-cmd-t
#:h5t-bkg-t
#:h5t-cdata-t
#:h5t-pers-t
#:h5t-dir-t
#:h5t-conv-except-t
#:h5t-conv-ret-t
#:hvl-t
#:+H5T-VARIABLE+
#:+H5T-OPAQUE-TAG-MAX+
#:+H5T-IEEE-F32BE+
#:+H5T-IEEE-F32LE+
#:+H5T-IEEE-F64BE+
#:+H5T-IEEE-F64LE+
#:+H5T-STD-I8BE+
#:+H5T-STD-I8LE+
#:+H5T-STD-I16BE+
#:+H5T-STD-I16LE+
#:+H5T-STD-I32BE+
#:+H5T-STD-I32LE+
#:+H5T-STD-I64BE+
#:+H5T-STD-I64LE+
#:+H5T-STD-U8BE+
#:+H5T-STD-U8LE+
#:+H5T-STD-U16BE+
#:+H5T-STD-U16LE+
#:+H5T-STD-U32BE+
#:+H5T-STD-U32LE+
#:+H5T-STD-U64BE+
#:+H5T-STD-U64LE+
#:+H5T-STD-B8BE+
#:+H5T-STD-B8LE+
#:+H5T-STD-B16BE+
#:+H5T-STD-B16LE+
#:+H5T-STD-B32BE+
#:+H5T-STD-B32LE+
#:+H5T-STD-B64BE+
#:+H5T-STD-B64LE+
#:+H5T-STD-REF-OBJ+
#:+H5T-STD-REF-DSETREG+
#:+H5T-UNIX-D32BE+
#:+H5T-UNIX-D32LE+
#:+H5T-UNIX-D64BE+
#:+H5T-UNIX-D64LE+
#:+H5T-C-S1+
#:+H5T-FORTRAN-S1+
#:+H5T-NATIVE-CHAR+
#:+H5T-NATIVE-SCHAR+
#:+H5T-NATIVE-UCHAR+
#:+H5T-NATIVE-SHORT+
#:+H5T-NATIVE-USHORT+
#:+H5T-NATIVE-INT+
#:+H5T-NATIVE-UINT+
#:+H5T-NATIVE-LONG+
#:+H5T-NATIVE-ULONG+
#:+H5T-NATIVE-LLONG+
#:+H5T-NATIVE-ULLONG+
#:+H5T-NATIVE-FLOAT+
#:+H5T-NATIVE-DOUBLE+
#:+H5T-NATIVE-B8+
#:+H5T-NATIVE-B16+
#:+H5T-NATIVE-B32+
#:+H5T-NATIVE-B64+
#:+H5T-NATIVE-OPAQUE+
#:+H5T-NATIVE-HADDR+
#:+H5T-NATIVE-HSIZE+
#:+H5T-NATIVE-HSSIZE+
#:+H5T-NATIVE-HERR+
#:+H5T-NATIVE-HBOOL+
#:h5tarray-create2
#:h5tclose
#:h5tcommit2
#:h5tcommit-anon
#:h5tcommitted
#:h5tcompiler-conv
#:h5tconvert
#:h5tcopy
#:h5tcreate
#:h5tdecode
#:h5tdetect-class
#:h5tencode
#:h5tenum-create
#:h5tenum-insert
#:h5tenum-nameof
#:h5tenum-valueof
#:h5tequal
#:h5tfind
#:h5tget-array-dims2
#:h5tget-array-ndims
#:h5tget-class
#:h5tget-create-plist
#:h5tget-cset
#:h5tget-ebias
#:h5tget-fields
#:h5tget-inpad
#:h5tget-member-class
#:h5tget-member-index
#:h5tget-member-name
#:h5tget-member-offset
#:h5tget-member-type
#:h5tget-member-value
#:h5tget-native-type
#:h5tget-nmembers
#:h5tget-norm
#:h5tget-offset
#:h5tget-order
#:h5tget-pad
#:h5tget-precision
#:h5tget-sign
#:h5tget-size
#:h5tget-strpad
#:h5tget-super
#:h5tget-tag
#:h5tinsert
#:h5tis-variable-string
#:h5tlock
#:h5topen2
#:h5tpack
#:h5tregister
#:h5tset-cset
#:h5tset-ebias
#:h5tset-fields
#:h5tset-inpad
#:h5tset-norm
#:h5tset-offset
#:h5tset-order
#:h5tset-pad
#:h5tset-precision
#:h5tset-sign
#:h5tset-size
#:h5tset-strpad
#:h5tset-tag
#:h5tunregister
#:h5tvlen-create
;; == h5l ==========================================================
#:+H5L-MAX-LINK-NAME-LEN+
#:+H5L-SAME-LOC+
#:+H5L-LINK-CLASS-T-VERS+
#:h5l-type-t
#:+H5L-TYPE-BUILTIN-MAX+
#:+H5L-TYPE-UD-MIN+
#:h5l-info-t
#:h5lcopy
#:h5lcreate-external
#:h5lcreate-hard
#:h5lcreate-soft
#:h5lcreate-ud
#:h5ldelete
#:h5ldelete_by-idx
#:h5lexists
#:h5lget-info
#:h5lget-info-by-idx
#:h5lget-name-by-idx
#:h5lget-val
#:h5lget-val-by-index
#:h5lis-registered
#:h5literate
#:h5literate-by-name
#:h5lmove
#:h5lregister
#:h5lunpack-elink-val
#:h5lunregister
#:h5lvisit
#:h5lvisit-by-name
;; == h5o ==========================================================
#:+H5O-COPY-SHALLOW-HIERARCHY-FLAG+
#:+H5O-COPY-EXPAND-SOFT-LINK-FLAG+
#:+H5O-COPY-EXPAND-EXT-LINK-FLAG+
#:+H5O-COPY-EXPAND-REFERENCE-FLAG+
#:+H5O-COPY-WITHOUT-ATTR-FLAG+
#:+H5O-COPY-PRESERVE-NULL-FLAG+
#:+H5O-COPY-MERGE-COMMITTED-DTYPE-FLAG+
#:+H5O-COPY-ALL+
#:+H5O-SHMESG-NONE-FLAG+
#:+H5O-SHMESG-SDSPACE-FLAG+
#:+H5O-SHMESG-DTYPE-FLAG+
#:+H5O-SHMESG-FILL-FLAG+
#:+H5O-SHMESG-PLINE-FLAG+
#:+H5O-SHMESG-ATTR-FLAG+
#:+H5O-SHMESG-ALL-FLAG+
#:+H5O-SHMESG-MAX-NINDEXES+
#:+H5O-SHMESG-MAX-LIST-SIZE+
#:+H5O-HDR-CHUNK0-SIZE+
#:+H5O-HDR-ATTR-CRT-ORDER_TRACKED+
#:+H5O-HDR-ATTR-CRT-ORDER_INDEXED+
#:+H5O-HDR-ATTR-STORE-PHASE-CHANGE+
#:+H5O-HDR-STORE-TIMES+
#:+H5O-HDR-ALL-FLAGS+
#:h5o-type-t
#:h5o-msg-crt-idx-t
#:h5o-hdr-info-t
#:h5o-info-t
#:h5oclose
#:h5ocopy
#:h5odecr-refcount
#:h5oexists-by-name
#:h5oget-comment
#:h5oget-comment-by-name
#:h5oget-info
#:h5oget-info-by-idx
#:h5oget-info-by-name
#:h5oincr-refcount
#:h5olink
#:h5oopen
#:h5oopen_by_addr
#:h5oopen_by_idx
#:h5ovisit
#:h5ovisit-by-name
;; ==#:h5s ==========================================================
#:+H5S-ALL+
#:+H5S-MAX-RANK+
#:+H5S-UNLIMITED+
#:h5s-class-t
#:h5s-sel-type
#:h5s-seloper-t
#:h5sclose
#:h5scopy
#:h5screate
#:h5screate-simple
#:h5sdecode
#:h5sencode
#:h5sextent-copy
#:h5sextent-equal
#:h5sget-select-bounds
#:h5sget-select-elem-npoints
#:h5sget-select-elem-pointlist
#:h5sget-select-hyper-blocklist
#:h5sget-select-hyper-nblocks
#:h5sget-select-npoints
#:h5sget-select-type
#:h5sget-simple-extent-dims
#:h5sget-simple-extent-ndims
#:h5sget-simple-extent-npoints
#:h5sget-simple-extent-type
#:h5sis-simple
#:h5soffest-simple
#:h5sselect-all
#:h5sselect-elements
#:h5sselect-hyperslab
#:h5sselect-none
#:h5sselect-valid
#:h5sset-extent-none
#:h5sset-extent-simple
;; ==#:h5d ==========================================================
#:h5d-alloc-time-t
#:h5d-fill-time-t
#:h5d-fill-value-t
#:h5d-layout-t
#:h5d-space-status-t
#:h5dclose
#:h5dcreate1
#:h5dcreate2
#:h5dcreate-anon
#:h5dfill
#:h5dgather
#:h5dget-access-plist
#:h5dget-create-plist
#:h5dget-offset
#:h5dget-space
#:h5dget-space-status
#:h5dget-storage-size
#:h5dget-type
#:h5diterate
#:h5dopen2
#:h5dread
#:h5dscatter
#:h5dset-extent
#:h5dvlen-get-buf-size
#:h5dvlen-reclaim
#:h5dwrite
;; ==#:h5g ==========================================================
#:h5g-storage-type-t
#:h5g-info-type-t
#:h5gclose
#:h5gcreate1
#:h5gcreate2
#:h5gcreate-anon
#:h5gcreate-plist
#:h5gget-info
#:h5gget-info-by-idx
#:h5gget-info-by-name
#:h5gopen1
#:h5gopen2
;; ==#:h5a ==========================================================
#:h5a-info-t
#:h5aclose
#:h5acreate1
#:h5acreate2
#:h5acreate-by-name
#:h5adelete
#:h5adelete-by-idx
#:h5adelete-by-name
#:h5aexists
#:h5aexists-by-name
#:h5aget-create-plist
#:h5aget-info
#:h5aget-info-by-idx
#:h5aget-info-by-name
#:h5aget-name
#:h5aget-name-by-idx
#:h5aget-space
#:h5aget-storage-size
#:h5aget-type
#:h5aiterate2
#:h5aiterate-by-name
#:h5aopen
#:h5aopen-by-idx
#:h5aopen-by-name
#:h5aread
#:h5arename
#:h5arename-by-name
#:h5awrite
;; ==#:h5r ==========================================================
#:h5r-type-t
#:+H5R-OBJ-REF-BUF-SIZE+
#:hobj-ref-t
#:+H5R-DSET-REG-REF-BUF-SIZE+
#:hdset-reg-ref-t
#:h5rcreate
#:h5rdereference
#:h5rget-name
#:h5rget-obj-type2
#:h5rget-region
;; ==#:h5z ==========================================================
#:h5z-edc-t
#:h5z-filter-t
#:h5z-so-scale-type-t
#:+H5Z-FILTER-ERROR+
#:+H5Z-FILTER-NONE+
#:+H5Z-FILTER-DEFLAT+
#:+H5Z-FILTER-SHUFFLE+
#:+H5Z-FILTER-FLETCHER32+
#:+H5Z-FILTER-SZIP+
#:+H5Z-FILTER-NBIT+
#:+H5Z-FILTER-SCALEOFFSET+
#:+H5Z-FILTER-RESERVED+
#:+H5Z-FILTER-MAX+
#:+H5Z-FILTER-ALL+
#:+H5Z-MAX-NFILTERS+
#:+H5-SZIP-ALLOW-K13-OPTION-MASK+
#:+H5-SZIP-CHIP-OPTION-MASK+
#:+H5-SZIP-EC-OPTION-MASK+
#:+H5-SZIP-NN-OPTION-MASK+
#:+H5-SZIP-MAX-PIXELS-PER-BLOCK+
#:+H5Z-SHUFFLE-USER-NPARMS+
#:+H5Z-SHUFFLE-TOTAL-NPARMS+
#:+H5Z-SZIP-USER-NPARMS+
#:+H5Z-SZIP-TOTAL-NPARMS+
#:+H5Z-SZIP-PARM-MASK+
#:+H5Z-SZIP-PARM-PPB+
#:+H5Z-SZIP-PARM-BPP+
#:+H5Z-SZIP-PARM-PPS+
#:+H5Z-NBIT-USER-NPARMS+
#:+H5Z-SCALEOFFSET-USER-NPARMS+
#:+H5Z-SO-INT-MINBITS-DEFAULT+
#:+H5Z-CLASS-T-VERS+
#:+H5Z-FILTER-CONFIG-ENCODE-ENABLED+
#:+H5Z-FILTER-CONFIG-DECODE-ENABLED+
#:h5zfilter-avail
#:h5zget-filter-info
;; ==#:h5p ==========================================================
#:+H5P-DEFAULT+
#:+H5P-ROOT+
#:+H5P-OBJECT-CREATE+
#:+H5P-FILE-CREATE+
#:+H5P-FILE-ACCESS+
#:+H5P-DATASET-CREATE+
#:+H5P-DATASET-ACCESS+
#:+H5P-DATASET-XFER+
#:+H5P-FILE-MOUNT+
#:+H5P-GROUP-CREATE+
#:+H5P-GROUP-ACCESS+
#:+H5P-DATATYPE-CREATE+
#:+H5P-DATATYPE-ACCESS+
#:+H5P-STRING-CREATE+
#:+H5P-ATTRIBUTE-CREATE+
#:+H5P-OBJECT-COPY+
#:+H5P-LINK-CREATE+
#:+H5P-LINK-ACCESS+
#:+H5P-FILE-CREATE-DEFAULT+
#:+H5P-FILE-ACCESS-DEFAULT+
#:+H5P-DATASET-CREATE-DEFAULT+
#:+H5P-DATASET-ACCESS-DEFAULT+
#:+H5P-DATASET-XFER-DEFAULT+
#:+H5P-FILE-MOUNT-DEFAULT+
#:+H5P-GROUP-CREATE-DEFAULT+
#:+H5P-GROUP-ACCESS-DEFAULT+
#:+H5P-DATATYPE-CREATE-DEFAULT+
#:+H5P-DATATYPE-ACCESS-DEFAULT+
#:+H5P-ATTRIBUTE-CREATE-DEFAULT+
#:+H5P-OBJECT-COPY-DEFAULT+
#:+H5P-LINK-CREATE-DEFAULT+
#:+H5P-LINK-ACCESS-DEFAULT+
#:h5pclose
#:h5pcreate
#:h5pcopy
#:h5pget-char-encoding
#:h5pget-chunk
#:h5pget-class
#:h5pget-core-write-tracking
#:h5pget-create-intermediate-group
#:h5pget-external
#:h5pget-external-count
#:h5pget-fapl-core
#:h5pget-fclose-degree
#:h5pget-file-image
#:h5pget-fill-value
#:h5pget-filter2
#:h5pget-layout
#:h5pget-libver-bounds
#:h5pget-nfilters
#:h5pget-sizes
#:h5pget-userblock
#:h5pget-version
#:h5pset-alloc-time
#:h5pset-char-encoding
#:h5pset-chunk
#:h5pset-core-write-tracking
#:h5pset-create-intermediate-group
#:h5pset-data-transform
#:h5pset-deflate
#:h5pset-external
#:h5pset-fapl-core
#:h5pset-fclose-degree
#:h5pset-file-image
#:h5pset-fill-value
#:h5pset-fletcher32
#:h5pset-layout
#:h5pset-link-creation-order
#:h5pset-link-phase-change
#:h5pset-libver-bounds
#:h5pset-nbit
#:h5pset-scaleoffset
#:h5pset-shuffle
#:h5pset-szip
#:h5pset-userblock
;; ==#:h5pl =========================================================
#:h5plget-loading-state
#:h5plset-loading-state))
| 17,611 | Common Lisp | .lisp | 562 | 19.498221 | 80 | 0.442376 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 3fdb43eeefe2b180f0d0a2ce5cc4a0e3e1d888f056932d5d92721dd0eda20521 | 1,577 | [
-1
] |
1,578 | h5i.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5i.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(in-package #:hdf5)
(defcfun "H5Iclear_type" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5I.html#Identify-ClearType"
(type h5i-type-t)
(force hbool-t))
(defcfun "H5Idec_ref" :int
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5I.html#Identify-DecRef"
(obj-id hid-t))
(defcfun "H5Idec_type_ref" :int
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5I.html#Identify-DecTypeRef"
(type h5i-type-t))
(defcfun "H5Idestroy_type" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5I.html#Identify-DestroyType"
(type h5i-type-t))
(defcfun "H5Iget_file_id" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5I.html#Identify-GetFileId"
(obj-id hid-t))
(defcfun "H5Iget_name" ssize-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5I.html#Identify-GetType"
(obj-id hid-t)
(name (:pointer :char))
(size size-t))
(defcfun "H5Iget_ref" :int
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5I.html#Identify-GetRef"
(obj-id hid-t))
(defcfun "H5Iget_type" h5i-type-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5I.html#Identify-GetType"
(obj-id hid-t))
(defcfun "H5Iget_type_ref" :int
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5I.html#Identify-GetTypeRef"
(type h5i-type-t))
(defcfun "H5Iinc_ref" :int
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5I.html#Identify-IncRef"
(obj-id hid-t))
(defcfun "H5Iinc_type_ref" :int
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5I.html#Identify-IncTypeRef"
(type h5i-type-t))
(defcfun "H5Iis_valid" htri-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5I.html#Identify-IsValid"
(obj-id hid-t))
(defcfun "H5Inmembers" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5I.html#Identify-NMembers"
(type h5i-type-t)
(num-members (:pointer hsize-t)))
(defcfun "H5Iobject_verify" :pointer
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5I.html#Identify-ObjectVerify"
(id hid-t)
(id-type h5i-type-t))
(defcfun "H5Iregister" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5I.html#Identify-Register"
(type h5i-type-t)
(object :pointer))
(defcfun "H5Iregister_type" h5i-type-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5I.html#Identify-RegisterType"
(hash-size size-t)
(reserved :unsigned-int)
(free-func :pointer))
(defcfun "H5Iremove_verify" :pointer
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5I.html#Identify-RemoveVerify"
(id hid-t)
(id-type h5i-type-t))
(defcfun "H5Isearch" :pointer
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5I.html#Identify-Search"
(type h5i-type-t)
(func :pointer)
(key :pointer))
(defcfun "H5Itype_exists" htri-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5I.html#Identify-TypeExists"
(type h5i-type-t))
| 3,081 | Common Lisp | .lisp | 80 | 36.0375 | 77 | 0.716874 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | c1d39c83770f30edcae0f00fe12560508bce77193d2ae58d0e28d8e0e4038eb2 | 1,578 | [
-1
] |
1,579 | h5z-grovel.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5z-grovel.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(pkg-config-cflags "hdf5" :optional t)
(define "_H5private_H") ; See GROVELLER-HACKING-NOTE.md for explanation
(include "hdf5.h")
(in-package #:hdf5)
(ctype h5z-filter-t "H5Z_filter_t")
(constant (+H5Z-FILTER-ERROR+ "H5Z_FILTER_ERROR"))
(constant (+H5Z-FILTER-NONE+ "H5Z_FILTER_NONE"))
(constant (+H5Z-FILTER-DEFLATE+ "H5Z_FILTER_DEFLATE"))
(constant (+H5Z-FILTER-SHUFFLE+ "H5Z_FILTER_SHUFFLE"))
(constant (+H5Z-FILTER-FLETCHER32+ "H5Z_FILTER_FLETCHER32"))
(constant (+H5Z-FILTER-SZIP+ "H5Z_FILTER_SZIP"))
(constant (+H5Z-FILTER-NBIT+ "H5Z_FILTER_NBIT"))
(constant (+H5Z-FILTER-SCALEOFFSET+ "H5Z_FILTER_SCALEOFFSET"))
(constant (+H5Z-FILTER-RESERVED+ "H5Z_FILTER_RESERVED"))
(constant (+H5Z-FILTER-MAX+ "H5Z_FILTER_MAX"))
(constant (+H5Z-FILTER-ALL+ "H5Z_FILTER_ALL"))
(constant (+H5Z-MAX-NFILTERS+ "H5Z_MAX_NFILTERS"))
(constant (+H5Z-FLAG-DEFMASK+ "H5Z_FLAG_DEFMASK"))
(constant (+H5Z-FLAG-MANDATORY+ "H5Z_FLAG_MANDATORY"))
(constant (+H5Z-FLAG-OPTIONAL+ "H5Z_FLAG_OPTIONAL"))
(constant (+H5Z-FLAG-INVMASK+ "H5Z_FLAG_INVMASK"))
(constant (+H5Z-FLAG-REVERSE+ "H5Z_FLAG_REVERSE"))
(constant (+H5Z-FLAG-SKIP-EDC+ "H5Z_FLAG_SKIP_EDC"))
(constant (+H5-SZIP-ALLOW-K13-OPTION-MASK+ "H5_SZIP_ALLOW_K13_OPTION_MASK"))
(constant (+H5-SZIP-CHIP-OPTION-MASK+ "H5_SZIP_CHIP_OPTION_MASK"))
(constant (+H5-SZIP-EC-OPTION-MASK+ "H5_SZIP_EC_OPTION_MASK"))
(constant (+H5-SZIP-NN-OPTION-MASK+ "H5_SZIP_NN_OPTION_MASK"))
(constant (+H5-SZIP-MAX-PIXELS-PER-BLOCK+ "H5_SZIP_MAX_PIXELS_PER_BLOCK"))
(constant (+H5Z-SHUFFLE-USER-NPARMS+ "H5Z_SHUFFLE_USER_NPARMS"))
(constant (+H5Z-SHUFFLE-TOTAL-NPARMS+ "H5Z_SHUFFLE_TOTAL_NPARMS"))
(constant (+H5Z-SZIP-USER-NPARMS+ "H5Z_SZIP_USER_NPARMS"))
(constant (+H5Z-SZIP-TOTAL-NPARMS+ "H5Z_SZIP_TOTAL_NPARMS"))
(constant (+H5Z-SZIP-PARM-MASK+ "H5Z_SZIP_PARM_MASK"))
(constant (+H5Z-SZIP-PARM-PPB+ "H5Z_SZIP_PARM_PPB"))
(constant (+H5Z-SZIP-PARM-BPP+ "H5Z_SZIP_PARM_BPP"))
(constant (+H5Z-SZIP-PARM-PPS+ "H5Z_SZIP_PARM_PPS"))
(constant (+H5Z-NBIT-USER-NPARMS+ "H5Z_NBIT_USER_NPARMS"))
(constant (+H5Z-SCALEOFFSET-USER-NPARMS+ "H5Z_SCALEOFFSET_USER_NPARMS"))
(constant (+H5Z-SO-INT-MINBITS-DEFAULT+ "H5Z_SO_INT_MINBITS_DEFAULT"))
(cenum h5z-so-scale-type-t
((:H5Z-SO-FLOAT-DSCALE "H5Z_SO_FLOAT_DSCALE"))
((:H5Z-SO-FLOAT-ESCALE "H5Z_SO_FLOAT_ESCALE"))
((:H5Z-SO-INT "H5Z_SO_INT")))
(constant (+H5Z-CLASS-T-VERS+ "H5Z_CLASS_T_VERS"))
(cenum h5z-edc-t
((:H5Z-ERROR-EDC "H5Z_ERROR_EDC"))
((:H5Z-DISABLE-EDC "H5Z_DISABLE_EDC"))
((:H5Z-ENABLE-EDC "H5Z_ENABLE_EDC"))
((:H5Z-NO-EDC "H5Z_NO_EDC")))
(constant (+H5Z-FILTER-CONFIG-ENCODE-ENABLED+ "H5Z_FILTER_CONFIG_ENCODE_ENABLED"))
(constant (+H5Z-FILTER-CONFIG-DECODE-ENABLED+ "H5Z_FILTER_CONFIG_DECODE_ENABLED"))
| 3,314 | Common Lisp | .lisp | 62 | 51.370968 | 82 | 0.686147 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 2074b890e2d1276f1ee7d997160b9e9e8f87ec5c76286d00ccf0f120f37ccede | 1,579 | [
-1
] |
1,580 | h5a-grovel.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5a-grovel.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(pkg-config-cflags "hdf5" :optional t)
(define "_H5private_H") ; See GROVELLER-HACKING-NOTE.md for explanation
(include "hdf5.h")
(in-package #:hdf5)
(cstruct h5a-info-t "H5A_info_t"
(corder-valid "corder_valid" :type hbool-t)
(corder "corder" :type h5o-msg-crt-idx-t)
(cset "cset" :type h5t-cset-t)
(data-size "data_size" :type hsize-t))
| 885 | Common Lisp | .lisp | 20 | 41.3 | 77 | 0.649652 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 3dbb2ed6cff1dcccb095b5b7f6e47dfcbef7f11e58b8cca8890a0cd25131f9cf | 1,580 | [
-1
] |
1,581 | h5o.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5o.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(in-package #:hdf5)
(defcstruct _space-t
(total hsize-t)
(meta hsize-t)
(mesg hsize-t)
(free hsize-t))
(defcstruct _mesg-t
(present :uint64)
(shared :uint64))
(defcstruct h5o-hdr-info-t
(version :unsigned-int)
(nmesgs :unsigned-int)
(nchunks :unsigned-int)
(flags :unsigned-int)
(space (:struct _space-t))
(mesg (:struct _mesg-t)))
(defcstruct _meta-t
(obj (:struct h5-ih-info-t))
(attr (:struct h5-ih-info-t)))
(defcstruct h5o-info-t
(fileno :unsigned-long)
(addr haddr-t)
(type h5o-type-t)
(rc :unsigned-int)
(atime time-t)
(mtime time-t)
(ctime time-t)
(btime time-t)
(num-attrs hsize-t)
(hdr (:struct h5o-hdr-info-t))
(meta-size (:struct _meta-t)))
(defcfun "H5Oclose" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-Close"
(object-id hid-t))
(defcfun "H5Ocopy" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-Copy"
(src-loc-id hid-t)
(src-name :string)
(dst-loc-id hid-t)
(dst-name :string)
(ocpypl-id hid-t)
(lcpl-id hid-t))
(defcfun "H5Odecr_refcount" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-DecrRefCount"
(object-id hid-t))
(defcfun "H5Oexists_by_name" htri-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-ExistsByName"
(loc-id hid-t)
(name :string)
(lapl-id hid-t))
(defcfun "H5Oget_comment" ssize-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetComment"
(object-id hid-t)
(comment (:pointer :char))
(bufsize size-t))
(defcfun "H5Oget_comment_by_name" ssize-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetCommentByName"
(loc-id hid-t)
(name :string)
(comment (:pointer :char))
(bufsize size-t)
(lapl-id hid-t))
(defcfun "H5Oget_info" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfo"
(object-id hid-t)
(object-info (:pointer (:struct H5O-info-t))))
(defcfun "H5Oget_info_by_idx" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfo"
(loc-id hid-t)
(group-name :string)
(index-field h5-index-t)
(order h5-iter-order-t)
(n hsize-t)
(object-info (:pointer (:struct H5O-info-t)))
(lapl-id hid-t))
(defcfun "H5Oget_info_by_name" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfoByName"
(loc-id hid-t)
(object-name :string)
(object-info (:pointer (:struct H5O-info-t)))
(lapl-id hid-t))
(defcfun "H5Oincr_refcount" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-IncrRefCount"
(object-id hid-t))
(defcfun "H5Olink" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-Link"
(object-id hid-t)
(new-loc-id hid-t)
(new-link-name :string)
(lcpl hid-t)
(lapl hid-t))
(defcfun "H5Oopen" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-Open"
(loc-id hid-t)
(name :string)
(lapl-id hid-t))
(defcfun "H5Oopen_by_addr" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-OpenByAddr"
(loc-id hid-t)
(addr haddr-t))
(defcfun "H5Oopen_by_idx" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-OpenByIdx"
(loc-id hid-t)
(group-name :string)
(index-field h5-index-t)
(order h5-iter-order-t)
(n hsize-t)
(lapl-id hid-t))
(defcfun "H5Ovisit" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-Visit"
(object-id hid-t)
(index-type h5-index-t)
(order h5-iter-order-t)
(op :pointer)
(op-data :pointer))
(defcfun "H5Ovisit_by_name" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-VisitByName"
(loc-id hid-t)
(object-name :string)
(index-type h5-index-t)
(order h5-iter-order-t)
(op :pointer)
(op-data :pointer)
(lapl-d hid-t))
| 4,376 | Common Lisp | .lisp | 135 | 29.666667 | 77 | 0.65442 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | dfa452f21813ff8f675581735cdf8bb37e90dd440021af611c55147da39c6b6e | 1,581 | [
-1
] |
1,582 | h5g.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5g.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
;;; See H5Gpublic.h .
(in-package #:hdf5)
(defcfun "H5Gclose" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5G.html#Group-Close"
(group-id hid-t))
(defcfun "H5Gcreate1" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5G.html#Group-Create1"
(loc-id hid-t)
(name :string)
(size-hint size-t))
(defcfun "H5Gcreate2" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5G.html#Group-Create2"
(loc-id hid-t)
(name :string)
(lcpl-id hid-t)
(gcpl-id hid-t)
(gapl-id hid-t))
(defcfun "H5Gcreate_anon" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5G.html#Group-CreateAnon"
(loc-id hid-t)
(gcpl-id hid-t)
(gapl-id hid-t))
(defcfun "H5Gget_create_plist" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5G.html#Group-GetCreatePlist"
(group-id hid-t))
(defcfun "H5Gget_info" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5G.html#Group-GetInfo"
(group-id hid-t)
(group-info (:pointer (:struct h5g-info-t))))
(defcfun "H5Gget_info_by_idx" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5G.html#Group-GetInfoByIdx"
(loc-id hid-t)
(group-name :string)
(index-type h5-index-t)
(order h5-iter-order-t)
(n hsize-t)
(group-info (:pointer (:struct h5g-info-t)))
(lapl-id hid-t))
(defcfun "H5Gget_info_by_name" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5G.html#Group-GetInfoByName"
(loc-id hid-t)
(group-name :string)
(group-info (:pointer (:struct h5g-info-t)))
(lapl-id hid-t))
(defcfun "H5Gopen1" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5G.html#Group-Open1"
(loc-id hid-t)
(name :string))
(defcfun "H5Gopen2" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5G.html#Group-Open2"
(loc-id hid-t)
(name :string)
(gapl hid-t))
| 2,226 | Common Lisp | .lisp | 64 | 32.3125 | 77 | 0.67907 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 4c087fe560fff5ad092955ec60e73ae4635e0ce269c60e6aa97dea7a463b100c | 1,582 | [
-1
] |
1,583 | h5o-grovel.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5o-grovel.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(pkg-config-cflags "hdf5" :optional t)
(define "_H5private_H") ; See GROVELLER-HACKING-NOTE.md for explanation
(include "hdf5.h")
(in-package #:hdf5)
(constant (+H5O-COPY-SHALLOW-HIERARCHY-FLAG+ "H5O_COPY_SHALLOW_HIERARCHY_FLAG"))
(constant (+H5O-COPY-EXPAND-SOFT-LINK-FLAG+ "H5O_COPY_EXPAND_SOFT_LINK_FLAG"))
(constant (+H5O-COPY-EXPAND-EXT-LINK-FLAG+ "H5O_COPY_EXPAND_EXT_LINK_FLAG"))
(constant (+H5O-COPY-EXPAND-REFERENCE-FLAG+ "H5O_COPY_EXPAND_REFERENCE_FLAG"))
(constant (+H5O-COPY-WITHOUT-ATTR-FLAG+ "H5O_COPY_WITHOUT_ATTR_FLAG"))
(constant (+H5O-COPY-PRESERVE-NULL-FLAG+ "H5O_COPY_PRESERVE_NULL_FLAG"))
(constant (+H5O-COPY-MERGE-COMMITTED-DTYPE-FLAG+ "H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG"))
(constant (+H5O-COPY-ALL+ "H5O_COPY_ALL"))
(constant (+H5O-SHMESG-NONE-FLAG+ "H5O_SHMESG_NONE_FLAG"))
(constant (+H5O-SHMESG-SDSPACE-FLAG+ "H5O_SHMESG_SDSPACE_FLAG"))
(constant (+H5O-SHMESG-DTYPE-FLAG+ "H5O_SHMESG_DTYPE_FLAG"))
(constant (+H5O-SHMESG-FILL-FLAG+ "H5O_SHMESG_FILL_FLAG"))
(constant (+H5O-SHMESG-PLINE-FLAG+ "H5O_SHMESG_PLINE_FLAG"))
(constant (+H5O-SHMESG-ATTR-FLAG+ "H5O_SHMESG_ATTR_FLAG"))
(constant (+H5O-SHMESG-ALL-FLAG+ "H5O_SHMESG_ALL_FLAG"))
(constant (+H5O-SHMESG-MAX-NINDEXES+ "H5O_SHMESG_MAX_NINDEXES"))
(constant (+H5O-SHMESG-MAX-LIST-SIZE+ "H5O_SHMESG_MAX_LIST_SIZE"))
(constant (+H5O-HDR-CHUNK0-SIZE+ "H5O_HDR_CHUNK0_SIZE"))
(constant (+H5O-HDR-ATTR-CRT-ORDER_TRACKED+ "H5O_HDR_ATTR_CRT_ORDER_TRACKED"))
(constant (+H5O-HDR-ATTR-CRT-ORDER_INDEXED+ "H5O_HDR_ATTR_CRT_ORDER_INDEXED"))
(constant (+H5O-HDR-ATTR-STORE-PHASE-CHANGE+ "H5O_HDR_ATTR_STORE_PHASE_CHANGE"))
(constant (+H5O-HDR-STORE-TIMES+ "H5O_HDR_STORE_TIMES"))
(constant (+H5O-HDR-ALL-FLAGS+ "H5O_HDR_ALL_FLAGS"))
(cenum h5o-type-t
((:H5O-TYPE-UNKNOWN "H5O_TYPE_UNKNOWN"))
((:H5O-TYPE-GROUP "H5O_TYPE_GROUP"))
((:H5O-TYPE-DATASET "H5O_TYPE_DATASET"))
((:H5O-TYPE-NAMED-DATATYPE "H5O_TYPE_NAMED_DATATYPE"))
((:H5O-TYPE-NTYPES "H5O_TYPE_NTYPES")))
(ctype h5o-msg-crt-idx-t "H5O_msg_crt_idx_t")
| 2,650 | Common Lisp | .lisp | 45 | 56.955556 | 88 | 0.672825 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | ed4e8a38c5e1b850c07d9395cfc1fd8d30f6e16659b572679f8f375ab5845f81 | 1,583 | [
-1
] |
1,584 | h5t.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5t.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(in-package #:hdf5)
(defcfun "H5Tarray_create2" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-ArrayCreate2"
(base-type-id hid-t)
(rank :uint)
(dims (:pointer hsize-t)))
(defcfun "H5Tclose" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-Close"
(dtype-id hid-t))
(defcfun "H5Tcommit2" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-Commit"
(loc-id hid-t)
(name :string)
(dtype-id hid-t)
(lcpl-id hid-t)
(tcpl-id hid-t)
(tapl-id hid-t))
(defcfun "H5Tcommit_anon" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-CommitAnon"
(loc-id hid-t)
(dtype-id hid-t)
(tcpl-id hid-t)
(tapl-id hid-t))
(defcfun "H5Tcommitted" htri-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-Committed"
(dtype-id hid-t))
(defcfun "H5Tcompiler_conv" htri-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-CompilerConv"
(src-id hid-t)
(dst-id hid-t))
(defcfun "H5Tconvert" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-Convert"
(src-type hid-t)
(dest-type hid-t)
(nelmts size-t)
(buf :pointer)
(background :pointer)
(plist hid-t))
(defcfun "H5Tcopy" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-Copy"
(dtype-id hid-t))
(defcfun "H5Tcreate" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-Create"
(class h5t-class-t)
(size size-t))
(defcfun "H5Tdecode" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-Decode"
(buf (:pointer :unsigned-char)))
(defcfun "H5Tdetect_class" htri-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-DetectClass"
(dtype-id hid-t)
(class h5t-class-t))
(defcfun "H5Tencode" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-Encode"
(obj-id hid-t)
(buf (:pointer :unsigned-char))
(nalloc (:pointer size-t)))
(defcfun "H5Tenum_create" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-EnumCreate"
(dtype-id hid-t))
(defcfun "H5Tenum_insert" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-EnumInsert"
(dtype-id hid-t)
(name :string)
(value :pointer))
(defcfun "H5Tenum_nameof" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-EnumNameOf"
(dtype-id hid-t)
(value :pointer)
(name (:pointer :char))
(size size-t))
(defcfun "H5Tenum_valueof" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-EnumValueOf"
(dtype-id hid-t)
(name (:pointer :char))
(value (:pointer)))
(defcfun "H5Tequal" htri-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-Equal"
(dtype-id1 hid-t)
(dtype-id2 hid-t))
(defcfun "H5Tfind" :pointer
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-Find"
(src-id hid-t)
(dst-id hid-t)
(pcdata (:pointer (:pointer (:struct h5t-cdata-t)))))
(defcfun "H5Tget_array_dims2" :int
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetArrayDims2"
(adtype-id hid-t)
(dims (:pointer hsize-t)))
(defcfun "H5Tget_array_ndims" :int
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetArrayNdims"
(adtype-id hid-t))
(defcfun "H5Tget_class" h5t-class-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetClass"
(dtype-id hid-t))
(defcfun "H5Tget_create_plist" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetCreatePlist"
(dtype-id hid-t))
(defcfun "H5Tget_cset" h5t-cset-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetCset"
(dtype-id hid-t))
(defcfun "H5Tget_ebias" size-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetEbias"
(dtype-id hid-t))
(defcfun "H5Tget_fields" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetFields"
(dtype-id hid-t)
(spos (:pointer size-t))
(epos (:pointer size-t))
(esize (:pointer size-t))
(mpos (:pointer size-t))
(msize (:pointer size-t)))
(defcfun "H5Tget_inpad" h5t-pad-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetFields"
(dtype-id hid-t))
(defcfun "H5Tget_member_class" h5t-class-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetMemberClass"
(cdtype-id hid-t)
(member-no :unsigned-int))
(defcfun "H5Tget_member_index" :int
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetMemberIndex"
(dtype-id hid-t)
(field-name :string))
(defcfun "H5Tget_member_name" (:pointer :char)
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetMemberName"
(dtype-id hid-t)
(field-idx :uint))
(defcfun "H5Tget_member_offset" size-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetMemberOffset"
(dtype-id hid-t)
(memb-no :uint))
(defcfun "H5Tget_member_type" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetMemberType"
(dtype-id hid-t)
(field-idx :uint))
(defcfun "H5Tget_member_value" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetMemberValue"
(dtype-id hid-t)
(memb-no :unsigned-int)
(value :pointer))
(defcfun "H5Tget_native_type" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetNativeType"
(dtype-id hid-t)
(direction h5t-dir-t))
(defcfun "H5Tget_nmembers" :int
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetNmembers"
(dtype-id hid-t))
(defcfun "H5Tget_norm" h5t-norm-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetNorm"
(dtype-id hid-t))
(defcfun "H5Tget_offset" :int
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetOffset"
(dtype-id hid-t))
(defcfun "H5Tget_order" h5t-order-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetOrder"
(dtype-id hid-t))
(defcfun "H5Tget_pad" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetPad"
(dtype-id hid-t)
(lsb (:pointer h5t-pad-t))
(msb (:pointer h5t-pad-t)))
(defcfun "H5Tget_precision" size-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetPrecision"
(dtype-id hid-t))
(defcfun "H5Tget_sign" h5t-sign-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetSign"
(dtype-id hid-t))
(defcfun "H5Tget_size" size-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetSize"
(dtype-id hid-t))
(defcfun "H5Tget_strpad" h5t-str-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetStrpad"
(dtype-id hid-t))
(defcfun "H5Tget_super" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetSuper"
(type hid-t))
(defcfun "H5Tget_tag" (:pointer :char)
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetTag"
(dtype-id hid-t))
(defcfun "H5Tinsert" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-Insert"
(dtype-id hid-t)
(name :string)
(offset size-t)
(field-id hid-t))
(defcfun "H5Tis_variable_str" htri-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-IsVariableString"
(dtype-id hid-t))
(defcfun "H5Tlock" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-Lock"
(dtype-id hid-t))
(defcfun "H5Topen2" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-Open2"
(loc-id hid-t)
(name :string)
(tapl-id hid-t))
(defcfun "H5Tpack" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-Pack"
(dtype-id hid-t))
(defcfun "H5Tregister" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-Register"
(type h5t-pers-t)
(name (:pointer :char))
(src-id hid-t)
(dst-id hid-t)
(func :pointer))
(defcfun "H5Tset_cset" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetCset"
(dtype-id hid-t)
(cset h5t-cset-t))
(defcfun "H5Tset_ebias" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetEbias"
(dtype-id hid-t)
(ebias size-t))
(defcfun "H5Tset_fields" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetFields"
(dtype-id hid-t)
(spos size-t)
(epos size-t)
(esize size-t)
(mpos size-t)
(msize size-t))
(defcfun "H5Tset_inpad" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetInpad"
(dtype-id hid-t)
(inpad h5t-pad-t))
(defcfun "H5Tset_norm" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetNorm"
(dtype-id hid-t)
(norm h5t-norm-t))
(defcfun "H5Tset_offset" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetOffset"
(dtype-id hid-t)
(offset size-t))
(defcfun "H5Tset_order" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetOrder"
(dtype-id hid-t)
(order h5t-order-t))
(defcfun "H5Tset_pad" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetPad"
(dtype-id hid-t)
(lsb h5t-pad-t)
(msb h5t-pad-t))
(defcfun "H5Tset_precision" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetPrecision"
(dtype-id hid-t)
(precision size-t))
(defcfun "H5Tset_sign" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetSign"
(dtype-id hid-t)
(sign h5t-sign-t))
(defcfun "H5Tset_size" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetSize"
(dtype-id hid-t)
(size size-t))
(defcfun "H5Tset_strpad" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetStrpad"
(dtype-id hid-t)
(cset h5t-str-t))
(defcfun "H5Tset_tag" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetTag"
(dtype-id hid-t)
(tag :string))
(defcfun "H5Tunregister" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-Unregister"
(type h5t-pers-t)
(name :string)
(src-id hid-t)
(dst-id hid-t)
(func :pointer))
(defcfun "H5Tvlen_create" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-VLCreate"
(base-type-id hid-t))
;; these are NOT constants; instead, these are alias to the global variables that are set by H5T__init_package() .
;; For example, H5T_IEEE_F32BE is an alias to H5T_IEEE_F32BE_g .
(defmacro pseudo-constant (name)
`(defcvar (,(lispify (subseq name 0 (- (length name) 2)) 'constant) ,name) hid-t))
(pseudo-constant "H5T_IEEE_F32BE_g")
(pseudo-constant "H5T_IEEE_F32LE_g")
(pseudo-constant "H5T_IEEE_F64BE_g")
(pseudo-constant "H5T_IEEE_F64LE_g")
(pseudo-constant "H5T_STD_I8BE_g")
(pseudo-constant "H5T_STD_I8LE_g")
(pseudo-constant "H5T_STD_I16BE_g")
(pseudo-constant "H5T_STD_I16LE_g")
(pseudo-constant "H5T_STD_I32BE_g")
(pseudo-constant "H5T_STD_I32LE_g")
(pseudo-constant "H5T_STD_I64BE_g")
(pseudo-constant "H5T_STD_I64LE_g")
(pseudo-constant "H5T_STD_U8BE_g")
(pseudo-constant "H5T_STD_U8LE_g")
(pseudo-constant "H5T_STD_U16BE_g")
(pseudo-constant "H5T_STD_U16LE_g")
(pseudo-constant "H5T_STD_U32BE_g")
(pseudo-constant "H5T_STD_U32LE_g")
(pseudo-constant "H5T_STD_U64BE_g")
(pseudo-constant "H5T_STD_U64LE_g")
(pseudo-constant "H5T_STD_B8BE_g")
(pseudo-constant "H5T_STD_B8LE_g")
(pseudo-constant "H5T_STD_B16BE_g")
(pseudo-constant "H5T_STD_B16LE_g")
(pseudo-constant "H5T_STD_B32BE_g")
(pseudo-constant "H5T_STD_B32LE_g")
(pseudo-constant "H5T_STD_B64BE_g")
(pseudo-constant "H5T_STD_B64LE_g")
(pseudo-constant "H5T_STD_REF_OBJ_g")
(pseudo-constant "H5T_STD_REF_DSETREG_g")
(pseudo-constant "H5T_UNIX_D32BE_g")
(pseudo-constant "H5T_UNIX_D32LE_g")
(pseudo-constant "H5T_UNIX_D64BE_g")
(pseudo-constant "H5T_UNIX_D64LE_g")
(pseudo-constant "H5T_C_S1_g")
(pseudo-constant "H5T_FORTRAN_S1_g")
;; /*
;; * These types are for Intel CPU's. They are little endian with IEEE
;; * floating point.
;; */
(define-symbol-macro +H5T-INTEL-I8+ +H5T-STD-I8LE+)
(define-symbol-macro +H5T-INTEL-I16+ +H5T-STD-I16LE+)
(define-symbol-macro +H5T-INTEL-I32+ +H5T-STD-I32LE+)
(define-symbol-macro +H5T-INTEL-I64+ +H5T-STD-I64LE+)
(define-symbol-macro +H5T-INTEL-U8+ +H5T-STD-U8LE+)
(define-symbol-macro +H5T-INTEL-U16+ +H5T-STD-U16LE+)
(define-symbol-macro +H5T-INTEL-U32+ +H5T-STD-U32LE+)
(define-symbol-macro +H5T-INTEL-U64+ +H5T-STD-U64LE+)
(define-symbol-macro +H5T-INTEL-B8+ +H5T-STD-B8LE+)
(define-symbol-macro +H5T-INTEL-B16+ +H5T-STD-B16LE+)
(define-symbol-macro +H5T-INTEL-B32+ +H5T-STD-B32LE+)
(define-symbol-macro +H5T-INTEL-B64+ +H5T-STD-B64LE+)
(define-symbol-macro +H5T-INTEL-F32+ +H5T-IEEE-F32LE+)
(define-symbol-macro +H5T-INTEL-F64+ +H5T-IEEE-F64LE+)
;; /*
;; * These types are for DEC Alpha CPU's. They are little endian with IEEE
;; * floating point.
;; */
(define-symbol-macro +H5T-ALPHA-I8+ +H5T-STD-I8LE+)
(define-symbol-macro +H5T-ALPHA-I16+ +H5T-STD-I16LE+)
(define-symbol-macro +H5T-ALPHA-I32+ +H5T-STD-I32LE+)
(define-symbol-macro +H5T-ALPHA-I64+ +H5T-STD-I64LE+)
(define-symbol-macro +H5T-ALPHA-U8+ +H5T-STD-U8LE+)
(define-symbol-macro +H5T-ALPHA-U16+ +H5T-STD-U16LE+)
(define-symbol-macro +H5T-ALPHA-U32+ +H5T-STD-U32LE+)
(define-symbol-macro +H5T-ALPHA-U64+ +H5T-STD-U64LE+)
(define-symbol-macro +H5T-ALPHA-B8+ +H5T-STD-B8LE+)
(define-symbol-macro +H5T-ALPHA-B16+ +H5T-STD-B16LE+)
(define-symbol-macro +H5T-ALPHA-B32+ +H5T-STD-B32LE+)
(define-symbol-macro +H5T-ALPHA-B64+ +H5T-STD-B64LE+)
(define-symbol-macro +H5T-ALPHA-F32+ +H5T-IEEE-F32LE+)
(define-symbol-macro +H5T-ALPHA-F64+ +H5T-IEEE-F64LE+)
;; /*
;; * These types are for MIPS cpu's commonly used in SGI systems. They are big
;; * endian with IEEE floating point.
;; */
(define-symbol-macro +H5T-MIPS-I8+ +H5T-STD-I8BE+)
(define-symbol-macro +H5T-MIPS-I16+ +H5T-STD-I16BE+)
(define-symbol-macro +H5T-MIPS-I32+ +H5T-STD-I32BE+)
(define-symbol-macro +H5T-MIPS-I64+ +H5T-STD-I64BE+)
(define-symbol-macro +H5T-MIPS-U8+ +H5T-STD-U8BE+)
(define-symbol-macro +H5T-MIPS-U16+ +H5T-STD-U16BE+)
(define-symbol-macro +H5T-MIPS-U32+ +H5T-STD-U32BE+)
(define-symbol-macro +H5T-MIPS-U64+ +H5T-STD-U64BE+)
(define-symbol-macro +H5T-MIPS-B8+ +H5T-STD-B8BE+)
(define-symbol-macro +H5T-MIPS-B16+ +H5T-STD-B16BE+)
(define-symbol-macro +H5T-MIPS-B32+ +H5T-STD-B32BE+)
(define-symbol-macro +H5T-MIPS-B64+ +H5T-STD-B64BE+)
(define-symbol-macro +H5T-MIPS-F32+ +H5T-IEEE-F32BE+)
(define-symbol-macro +H5T-MIPS-F64+ +H5T-IEEE-F64BE+)
(pseudo-constant "H5T_VAX_F32_g")
(pseudo-constant "H5T_VAX_F64_g")
(if (not (zerop +char-min+))
(define-symbol-macro +h5t-native-char+ +H5T-NATIVE-SCHAR+)
(define-symbol-macro +h5t-native-char+ +H5T-NATIVE-UCHAR+))
(pseudo-constant "H5T_NATIVE_SCHAR_g")
(pseudo-constant "H5T_NATIVE_UCHAR_g")
(pseudo-constant "H5T_NATIVE_SHORT_g")
(pseudo-constant "H5T_NATIVE_USHORT_g")
(pseudo-constant "H5T_NATIVE_INT_g")
(pseudo-constant "H5T_NATIVE_UINT_g")
(pseudo-constant "H5T_NATIVE_LONG_g")
(pseudo-constant "H5T_NATIVE_ULONG_g")
(pseudo-constant "H5T_NATIVE_LLONG_g")
(pseudo-constant "H5T_NATIVE_ULLONG_g")
(pseudo-constant "H5T_NATIVE_FLOAT_g")
(pseudo-constant "H5T_NATIVE_DOUBLE_g")
;; disabled at the moment --- where is the definition of H5_SIZEOF_LONG_DOUBLE ?
;; (if (not (zerop +H5_SIZEOF_LONG_DOUBLE+))
;; (defcvar (+H5T_NATIVE_LDOUBLE+ "H5T_NATIVE_LDOUBLE_g") hid-t)
(pseudo-constant "H5T_NATIVE_B8_g")
(pseudo-constant "H5T_NATIVE_B16_g")
(pseudo-constant "H5T_NATIVE_B32_g")
(pseudo-constant "H5T_NATIVE_B64_g")
(pseudo-constant "H5T_NATIVE_OPAQUE_g")
(pseudo-constant "H5T_NATIVE_HADDR_g")
(pseudo-constant "H5T_NATIVE_HSIZE_g")
(pseudo-constant "H5T_NATIVE_HSSIZE_g")
(pseudo-constant "H5T_NATIVE_HERR_g")
(pseudo-constant "H5T_NATIVE_HBOOL_g")
(pseudo-constant "H5T_NATIVE_INT8_g")
(pseudo-constant "H5T_NATIVE_UINT8_g")
(pseudo-constant "H5T_NATIVE_INT_LEAST8_g")
(pseudo-constant "H5T_NATIVE_UINT_LEAST8_g")
(pseudo-constant "H5T_NATIVE_INT_FAST8_g")
(pseudo-constant "H5T_NATIVE_UINT_FAST8_g")
(pseudo-constant "H5T_NATIVE_INT16_g")
(pseudo-constant "H5T_NATIVE_UINT16_g")
(pseudo-constant "H5T_NATIVE_INT_LEAST16_g")
(pseudo-constant "H5T_NATIVE_UINT_LEAST16_g")
(pseudo-constant "H5T_NATIVE_INT_FAST16_g")
(pseudo-constant "H5T_NATIVE_UINT_FAST16_g")
(pseudo-constant "H5T_NATIVE_INT32_g")
(pseudo-constant "H5T_NATIVE_UINT32_g")
(pseudo-constant "H5T_NATIVE_INT_LEAST32_g")
(pseudo-constant "H5T_NATIVE_UINT_LEAST32_g")
(pseudo-constant "H5T_NATIVE_INT_FAST32_g")
(pseudo-constant "H5T_NATIVE_UINT_FAST32_g")
(pseudo-constant "H5T_NATIVE_INT64_g")
(pseudo-constant "H5T_NATIVE_UINT64_g")
(pseudo-constant "H5T_NATIVE_INT_LEAST64_g")
(pseudo-constant "H5T_NATIVE_UINT_LEAST64_g")
(pseudo-constant "H5T_NATIVE_INT_FAST64_g")
(pseudo-constant "H5T_NATIVE_UINT_FAST64_g")
| 17,316 | Common Lisp | .lisp | 432 | 37.909722 | 114 | 0.695375 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | aaf48a2e7e356e48fb80822b24becacec360667b2f678d4aefc5f6c88e87cf01 | 1,584 | [
-1
] |
1,585 | h5f-grovel.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5f-grovel.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(pkg-config-cflags "hdf5" :optional t)
(define "_H5private_H") ; See GROVELLER-HACKING-NOTE.md for explanation
(include "hdf5.h")
(in-package #:hdf5)
(constant (+H5F-ACC-RDONLY+ "H5F_ACC_RDONLY"))
(constant (+H5F-ACC-RDWR+ "H5F_ACC_RDWR"))
(constant (+H5F-ACC-TRUNC+ "H5F_ACC_TRUNC"))
(constant (+H5F-ACC-EXCL+ "H5F_ACC_EXCL"))
(constant (+H5F-ACC-CREAT+ "H5F_ACC_CREAT"))
(constant (+H5F-ACC-DEFAULT+ "H5F_ACC_DEFAULT"))
(constant (+H5F-OBJ-FILE+ "H5F_OBJ_FILE"))
(constant (+H5F-OBJ-DATASET+ "H5F_OBJ_DATASET"))
(constant (+H5F-OBJ-GROUP+ "H5F_OBJ_GROUP"))
(constant (+H5F-OBJ-DATATYPE+ "H5F_OBJ_DATATYPE"))
(constant (+H5F-OBJ-ATTR+ "H5F_OBJ_ATTR"))
(constant (+H5F-OBJ-ALL+ "H5F_OBJ_ALL"))
(constant (+H5F-OBJ-LOCAL+ "H5F_OBJ_LOCAL"))
(cenum h5f-scope-t
((:H5F-SCOPE-LOCAL "H5F_SCOPE_LOCAL"))
((:H5F-SCOPE-GLOBAL "H5F_SCOPE_GLOBAL")))
(constant (+H5F-UNLIMITED+ "H5F_UNLIMITED"))
(cenum h5f-close-degree-t
((:H5F-CLOSE-DEFAULT "H5F_CLOSE_DEFAULT"))
((:H5F-CLOSE-WEAK "H5F_CLOSE_WEAK"))
((:H5F-CLOSE-SEMI "H5F_CLOSE_SEMI"))
((:H5F-CLOSE-STRONG "H5F_CLOSE_STRONG")))
(cenum h5f-mem-t
((:H5FD-MEM-NOLIST "H5FD_MEM_NOLIST"))
((:H5FD-MEM-DEFAULT "H5FD_MEM_DEFAULT"))
((:H5FD-MEM-SUPER "H5FD_MEM_SUPER"))
((:H5FD-MEM-BTREE "H5FD_MEM_BTREE"))
((:H5FD-MEM-DRAW "H5FD_MEM_DRAW"))
((:H5FD-MEM-GHEAP "H5FD_MEM_GHEAP"))
((:H5FD-MEM-LHEAP "H5FD_MEM_LHEAP"))
((:H5FD-MEM-OHDR "H5FD_MEM_OHDR"))
((:H5FD-MEM-NTYPES "H5FD_MEM_NTYPES")))
(cenum h5f-libver-t
((:H5F-LIBVER-EARLIEST "H5F_LIBVER_EARLIEST"))
((:H5F-LIBVER-LATEST "H5F_LIBVER_LATEST")))
(constant (+H5F-LIBVER-18+ "H5F_LIBVER_18"))
| 2,239 | Common Lisp | .lisp | 51 | 40.372549 | 77 | 0.638659 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 6bf767e0471fa9606f5cc6dc02f2b49a065bc00f340df46381addce4ba853791 | 1,585 | [
-1
] |
1,586 | h5f.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5f.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(in-package #:hdf5)
(progn
(defmacro h5f-info-t-gen ()
(if (foreign-symbol-pointer "H5Fget_info2")
`(progn
(defcstruct _super-t
(version :unsigned-int)
(super-size hsize-t)
(super-ext-size hsize-t))
(defcstruct _free-t
(version :unsigned-int)
(meta-size hsize-t)
(total-size hsize-t))
(defcstruct _sohm2-t
(version :unsigned-int)
(hdr-size hsize-t)
(msgs-info (:struct H5-ih-info-t)))
(defcstruct h5f-info2-t
(super (:struct _super-t))
(free (:struct _free-t))
(sohm (:struct _sohm2-t))))
`(progn
(defcstruct _sohm1-t
(hdr-size hsize-t)
(msgs-info (:struct H5-ih-info-t)))
(defcstruct h5f-info-t
(super-ext-size hsize-t)
(sohm (:struct _sohm1-t))))))
(h5f-info-t-gen))
(defcfun "H5Fclear_elink_file_cache" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-ClearELinkFileCache"
(file-id hid-t))
(defcfun "H5Fclose" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-Close"
(file-id hid-t))
(defcfun "H5Fcreate" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-Create"
(filename :string)
(flags :unsigned-int)
(fcpl-id hid-t)
(fapl-id hid-t))
(defcfun "H5Fflush" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-Flush"
(object-id hid-t)
(scope h5f-scope-t))
(defcfun "H5Fget_access_plist" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-GetAccessPlist"
(file-id hid-t))
(defcfun "H5Fget_create_plist" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-GetCreatePlist"
(file-id hid-t))
(defcfun "H5Fget_file_image" ssize-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-GetFileImage"
(file-id hid-t)
(buf-ptr :pointer)
(buf-len (:pointer size-t)))
(defcfun "H5Fget_filesize" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-GetFilesize"
(file-id hid-t)
(size (:pointer hsize-t)))
(defcfun "H5Fget_freespace" hssize-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-GetFreespace"
(file-id hid-t))
(progn
(defmacro h5fget-info-gen ()
(let ((rm-url "http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-GetInfo")
(fn-name-v8 "H5Fget_info")
(fn-name-v10 "H5Fget_info2"))
(if (foreign-symbol-pointer fn-name-v10)
`(defcfun (,fn-name-v10 h5fget-info) herr-t
,rm-url
(obj-id hid-t)
(file-info (:pointer (:struct h5f-info2-t))))
`(defcfun (,fn-name-v8 h5fget-info) herr-t
,rm-url
(obj-id hid-t)
(file-info (:pointer (:struct h5f-info-t)))))))
(h5fget-info-gen))
(defcfun "H5Fget_intent" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-GetIntent"
(file-id hid-t)
(intent (:pointer :unsigned-int)))
(defcfun "H5Fget_name" ssize-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-GetName"
(obj-id hid-t)
(name (:pointer :char))
(size size-t))
(defcfun "H5Fget_obj_count" ssize-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-GetObjCount"
(file-id hid-t)
(types :unsigned-int))
(defcfun "H5Fget_obj_ids" ssize-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-GetObjIDs"
(file-id hid-t)
(types :unsigned-int)
(max-objs size-t)
(obj-id-list (:pointer hid-t)))
(defcfun "H5Fis_hdf5" htri-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-IsHDF5"
(name :string))
(defcfun "H5Fmount" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-Mount"
(loc-id hid-t)
(name :string)
(child-id hid-t)
(fmpl-id hid-t))
(defcfun "H5Fopen" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-Open"
(name :string)
(flags :unsigned-int)
(fapl-id hid-t))
(defcfun "H5Freopen" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-Reopen"
(file-id hid-t))
(defcfun "H5Funmount" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-Unmount"
(loc-id hid-t)
(name :string))
| 4,736 | Common Lisp | .lisp | 129 | 31.131783 | 81 | 0.626146 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | a8678586c600533c09b90e0a4c9d32be8696e78bbd2068dfcf57ad016738cdee | 1,586 | [
-1
] |
1,587 | library.lisp | ghollisjr_cl-ana/hdf-cffi/src/library.lisp |
(in-package :hdf5)
(defparameter +NULL+ (cffi:null-pointer))
(define-foreign-library hdf5
(:darwin (:or (:framework "hdf5") "libhdf5.dylib")) ;; ?
(:windows "libhdf5.dll" :convention :stdcall)
(:unix (:or "libhdf5.so"
"libhdf5_serial.so"
"libhdf5_serial.so.100"
"libhdf5_serial.so.100.0.1")))
(use-foreign-library hdf5)
(defun lispify (name &optional flag (package *package*))
(labels ((helper (lst last rest &aux (c (car lst)))
(cond ((null lst)
rest)
((upper-case-p c)
(helper (cdr lst) 'upper
(case last
((lower) (list* c #\- rest))
(t (cons c rest)))))
((lower-case-p c)
(helper (cdr lst) 'lower (cons (char-upcase c) rest)))
((digit-char-p c)
(helper (cdr lst) 'digit (cons c rest)))
((char-equal c #\_)
(helper (cdr lst) '_ (cons #\- rest)))
(t
(error "Invalid character: ~A" c)))))
(let* ((fix (case flag
((constant enumvalue) "+")
(variable "*")
(t "")))
(sym (intern
(concatenate 'string
fix
(nreverse (helper (concatenate 'list name) nil nil))
fix)
package)))
;;(export sym package)
sym)))
| 1,577 | Common Lisp | .lisp | 39 | 24.641026 | 82 | 0.423629 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 59ec2f17c5f8c12ba3673110eb9a27cf03117b39e4b62d0f2a9cafb8910d2ead | 1,587 | [
-1
] |
1,588 | h5l.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5l.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(in-package #:hdf5)
(defcunion _u-t
(address haddr-t)
(val-size size-t))
(defcstruct h5l-info-t "H5L_info_t"
(type h5l-type-t)
(corder-valid hbool-t)
(corder :int64)
(cset h5t-cset-t)
(u (:union _u-t)))
(defcfun "H5Lcopy" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-Copy"
(src-loc-id hid-t)
(src-name :string)
(dest-loc-id hid-t)
(dest-name :string)
(lcpl-id hid-t)
(lapl-id hid-t))
(defcfun "H5Lcreate_external" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-CreateExternal"
(target-file-name :string)
(target-obj-name :string)
(link-loc-id hid-t)
(link-name :string)
(lcpl-id hid-t)
(lapl-id hid-t))
(defcfun "H5Lcreate_hard" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-CreateHard"
(obj-loc-id hid-t)
(obj-name :string)
(link-loc-id hid-t)
(link-name :string)
(lcpl-id hid-t)
(lapl-id hid-t))
(defcfun "H5Lcreate_soft" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-CreateSoft"
(target-path :string)
(link-loc-id hid-t)
(link-name :string)
(lcpl-id hid-t)
(lapl-id hid-t))
(defcfun "H5Lcreate_ud" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-CreateUD"
(link-loc-id hid-t)
(link-name :string)
(link-type h5l-type-t)
(udata :pointer)
(udata-size size-t)
(lcpl-id hid-t)
(lapl-id hid-t))
(defcfun "H5Ldelete" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-Delete"
(loc-id hid-t)
(name :string)
(lapl-id hid-t))
(defcfun "H5Ldelete_by_idx" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-DeleteByIdx"
(loc-id hid-t)
(group-name :string)
(index-filed h5-index-t)
(order h5-iter-order-t)
(n hsize-t)
(lapl-id hid-t))
(defcfun "H5Lexists" htri-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-Exists"
(loc-id hid-t)
(name :string)
(lapl-id hid-t))
(defcfun "H5Lget_info" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-GetInfo"
(link-loc-id hid-t)
(link-name :string)
(link-buff (:pointer (:struct h5l-info-t)))
(lapl-id hid-t))
(defcfun "H5Lget_info_by_idx" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-GetInfo"
(loc-id hid-t)
(group-name :string)
(index-filed h5-index-t)
(order h5-iter-order-t)
(n hsize-t)
(link-val (:pointer (:struct h5l-info-t)))
(lapl-id hid-t))
(defcfun "H5Lget_name_by_idx" ssize-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-GetNameByIdx"
(link-loc-id hid-t)
(group-name :string)
(index-field h5-index-t)
(order h5-iter-order-t)
(n hsize-t)
(name (:pointer :char))
(size size-t)
(lapl-id hid-t))
(defcfun "H5Lget_val" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-GetVal"
(link-loc-id hid-t)
(link-name :string)
(linkval-buff :pointer)
(size size-t)
(lapl-id hid-t))
(defcfun "H5Lget_val_by_idx" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-GetValByIdx"
(loc-id hid-t)
(group-name :string)
(index-field h5-index-t)
(order h5-iter-order-t)
(n hsize-t)
(link-val :pointer)
(size size-t)
(lapl-id hid-t))
(defcfun "H5Lis_registered" htri-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-IsRegistered"
(link-cls-id h5l-type-t))
(defcfun "H5Literate" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-Iterate"
(group-id hid-t)
(index-type h5-index-t)
(order h5-iter-order-t)
(idx (:pointer hsize-t))
(op :pointer)
(op-data :pointer))
(defcfun "H5Literate_by_name" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-IterateByName"
(loc-id hid-t)
(group-name (:pointer :char))
(index-type h5-index-t)
(order h5-iter-order-t)
(idx (:pointer hsize-t))
(op :pointer)
(op-data :pointer)
(lapl-id hid-t))
(defcfun "H5Lmove" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-Move"
(src-loc-id hid-t)
(src-name :string)
(dest-loc-id hid-t)
(dest-name :string)
(lcpl-id hid-t)
(lapl-id hid-t))
(defcfun "H5Lregister" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-Register"
(link-class (:pointer (:struct h5l-class-t))))
(defcfun "H5Lunpack_elink_val" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-UnpackELinkVal"
(ext-link-val (:pointer :char))
(link-size size-t)
(flags (:pointer :unsigned-int))
(filename (:pointer (:pointer :char)))
(obj-path (:pointer (:pointer :char))))
(defcfun "H5Lunregister" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-Unregister"
(link-cls-id h5l-type-t))
(defcfun "H5Lvisit" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-Visit"
(group-id hid-t)
(index-type h5-index-t)
(order h5-iter-order-t)
(op :pointer)
(op-data :pointer))
(defcfun "H5Lvisit_by_name" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-VisitByName"
(loc-id hid-t)
(group-name :string)
(index-type h5-index-t)
(order h5-iter-order-t)
(op :pointer)
(op-data :pointer)
(lapl-id hid-t))
| 5,873 | Common Lisp | .lisp | 179 | 30.061453 | 77 | 0.637502 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 7a32b9b921bc24d8f0832238dd4eff8cd2f513024297a71b11bd61496e6d33b0 | 1,588 | [
-1
] |
1,589 | h5d-grovel.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5d-grovel.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(pkg-config-cflags "hdf5" :optional t)
(define "_H5private_H") ; See GROVELLER-HACKING-NOTE.md for explanation
(include "hdf5.h")
(in-package #:hdf5)
(cenum h5d-layout-t
((:H5D-LAYOUT-ERROR "H5D_LAYOUT_ERROR"))
((:H5D-COMPACT "H5D_COMPACT"))
((:H5D-CONTIGUOUS "H5D_CONTIGUOUS"))
((:H5D-CHUNKED "H5D_CHUNKED"))
((:H5D-NLAYOUTS "H5D_NLAYOUTS")))
(cenum h5d-alloc-time-t
((:H5D-ALLOC-TIME-ERROR "H5D_ALLOC_TIME_ERROR"))
((:H5D-ALLOC-TIME-DEFAULT "H5D_ALLOC_TIME_DEFAULT"))
((:H5D-ALLOC-TIME-EARLY "H5D_ALLOC_TIME_EARLY"))
((:H5D-ALLOC-TIME-LATE "H5D_ALLOC_TIME_LATE"))
((:H5D-ALLOC-TIME-INCR "H5D_ALLOC_TIME_INCR")))
(cenum h5d-space-status-t
((:H5D-SPACE-STATUS-ERROR "H5D_SPACE_STATUS_ERROR"))
((:H5D-SPACE-STATUS-NOT-ALLOCATED "H5D_SPACE_STATUS_NOT_ALLOCATED"))
((:H5D-SPACE-STATUS-PART-ALLOCATED "H5D_SPACE_STATUS_PART_ALLOCATED"))
((:H5D-SPACE-STATUS-ALLOCATED "H5D_SPACE_STATUS_ALLOCATED")))
(cenum h5d-fill-time-t
((:H5D-FILL-TIME-ERROR "H5D_FILL_TIME_ERROR"))
((:H5D-FILL-TIME-ALLOC "H5D_FILL_TIME_ALLOC"))
((:H5D-FILL-TIME-NEVER "H5D_FILL_TIME_NEVER"))
((:H5D-FILL-TIME-IFSET "H5D_FILL_TIME_IFSET")))
(cenum h5d-fill-value-t
((:H5D-FILL-VALUE-ERROR "H5D_FILL_VALUE_ERROR"))
((:H5D-FILL-VALUE-UNDEFINED "H5D_FILL_VALUE_UNDEFINED"))
((:H5D-FILL-VALUE-DEFAULT "H5D_FILL_VALUE_DEFAULT"))
((:H5D-FILL-VALUE-USER-DEFINED "H5D_FILL_VALUE_USER_DEFINED")))
| 2,044 | Common Lisp | .lisp | 42 | 43.833333 | 77 | 0.642607 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 21ab62b1abb8b4d3d5190235a496c8904932e304dc5720738ebef88fbe01be55 | 1,589 | [
-1
] |
1,590 | grovel.lisp | ghollisjr_cl-ana/hdf-cffi/src/grovel.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(in-package #:hdf5)
(include "sys/time.h")
(ctype size-t "size_t")
(ctype time-t "time_t")
(ctype off-t "off_t")
| 591 | Common Lisp | .lisp | 16 | 35.625 | 77 | 0.689474 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 3dcf89fd0bfae9bec0c80902101d60ea54c93d25f73b53583238db473245bea1 | 1,590 | [
-1
] |
1,591 | h5l-grovel.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5l-grovel.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(pkg-config-cflags "hdf5" :optional t)
(define "_H5private_H") ; See GROVELLER-HACKING-NOTE.md for explanation
(include "hdf5.h")
(in-package #:hdf5)
(constant (+H5L-MAX-LINK-NAME-LEN+ "H5L_MAX_LINK_NAME_LEN"))
(constant (+H5L-SAME-LOC+ "H5L_SAME_LOC"))
(constant (+H5L-LINK-CLASS-T-VERS+ "H5L_LINK_CLASS_T_VERS"))
(cenum h5l-type-t
((:H5L-TYPE-ERROR "H5L_TYPE_ERROR"))
((:H5L-TYPE-HARD "H5L_TYPE_HARD"))
((:H5L-TYPE-SOFT "H5L_TYPE_SOFT"))
((:H5L-TYPE-EXTERNAL "H5L_TYPE_EXTERNAL"))
((:H5L-TYPE-MAX "H5L_TYPE_MAX")))
(cstruct h5l-class-t "H5L_class_t"
(version "version" :type :int)
(id "id" :type h5l-type-t)
(comment "comment" :type (:pointer :char))
(create-func "create_func" :type :pointer)
(move-func "move_func" :type :pointer)
(copy-func "copy_func" :type :pointer)
(trav-func "trav_func" :type :pointer)
(del-func "del_func" :type :pointer)
(query-func "query_func" :type :pointer))
(constant (+H5L-TYPE-BUILTIN-MAX+ "H5L_TYPE_BUILTIN_MAX"))
(constant (+H5L-TYPE-UD-MIN+ "H5L_TYPE_UD_MIN"))
| 1,667 | Common Lisp | .lisp | 36 | 41.861111 | 77 | 0.618608 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 3af8d25f169f099a3feaafea80274af89fa51b53109f8daf279cf794ab5f8bfe | 1,591 | [
-1
] |
1,592 | h5z.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5z.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(in-package #:hdf5)
(defcfun "H5Zfilter_avail" htri-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5Z.html#Compression-FilterAvail"
(filter h5z-filter-t))
(defcfun "H5Zget_filter_info" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5Z.html#Compression-GetFilterInfo"
(filter h5z-filter-t)
(filter-config (:pointer :unsigned-int)))
| 811 | Common Lisp | .lisp | 19 | 41 | 77 | 0.721166 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 4bb6c3395fe0b68345ebb9f6392e633c48982e2b25b804d360e94708c7d32e57 | 1,592 | [
-1
] |
1,593 | h5g-grovel.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5g-grovel.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(pkg-config-cflags "hdf5" :optional t)
(define "_H5private_H") ; See GROVELLER-HACKING-NOTE.md for explanation
(include "hdf5.h")
(in-package #:hdf5)
(cenum h5g-storage-type-t
((:H5G-STORAGE-TYPE-UNKNOWN "H5G_STORAGE_TYPE_UNKNOWN"))
((:H5G-STORAGE-TYPE-SYMBOL-TABLE "H5G_STORAGE_TYPE_SYMBOL_TABLE"))
((:H5G-STORAGE-TYPE-COMPACT "H5G_STORAGE_TYPE_COMPACT"))
((:H5G-STORAGE-TYPE-DENSE "H5G_STORAGE_TYPE_DENSE")))
(cstruct h5g-info-t "H5G_info_t"
(storage-type "storage_type" :type h5g-storage-type-t)
(nlinks "nlinks" :type hsize-t)
(max-corder "max_corder" :type :int64)
(mounted "mounted" :type hbool-t))
| 1,189 | Common Lisp | .lisp | 25 | 43.84 | 77 | 0.65431 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | f8cb395025ccdd7593f98fbb0eb29e3449b1afd8e74275755999217ba7dd4ef1 | 1,593 | [
-1
] |
1,594 | h5a.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5a.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(in-package #:hdf5)
(defcfun "H5Aclose" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Close"
(attr-id hid-t))
(defcfun "H5Acreate1" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Create1"
(loc-id hid-t)
(attr-name :string)
(type-id hid-t)
(space-id hid-t)
(acpl-id hid-t))
(defcfun "H5Acreate2" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Create2"
(loc-id hid-t)
(attr-name :string)
(type-id hid-t)
(space-id hid-t)
(acpl-id hid-t)
(aapl-id hid-t))
(defcfun "H5Acreate_by_name" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-CreateByName"
(loc-id hid-t)
(obj-name :string)
(attr-name :string)
(type-id hid-t)
(space-id hid-t)
(acpl-id hid-t)
(aapl-id hid-t)
(lapl-id hid-t))
(defcfun "H5Adelete" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Delete"
(loc-id hid-t)
(attr-name :string))
(defcfun "H5Adelete_by_idx" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-DeleteByIdx"
(loc-id hid-t)
(obj-name :string)
(idx-type h5-index-t)
(order h5-iter-order-t)
(n hsize-t)
(lapl-id hid-t))
(defcfun "H5Adelete_by_name" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-DeleteByName"
(loc-id hid-t)
(obj-name :string)
(attr-name :string)
(lapl-id hid-t))
(defcfun "H5Aexists" htri-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Exists"
(obj-id hid-t)
(attr-name :string))
(defcfun "H5Aexists_by_name" htri-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-ExistsByName"
(obj-id hid-t)
(obj-name :string)
(attr-name :string)
(lapl-id hid-t))
(defcfun "H5Aget_create_plist" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-GetCreatePlist"
(attr-id hid-t))
(defcfun "H5Aget_info" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-GetInfo"
(attr-id hid-t)
(info (:pointer (:struct h5a-info-t))))
(defcfun "H5Aget_info_by_idx" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-GetInfoByIdx"
(loc-id hid-t)
(obj-name :string)
(idx-type h5-index-t)
(order h5-iter-order-t)
(n hsize-t)
(info (:pointer (:struct H5A-info-t)))
(lapl-id hid-t))
(defcfun "H5Aget_info_by_name" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-GetInfoByName"
(loc-id hid-t)
(obj-name :string)
(attr-name :string)
(info (:pointer (:struct h5a-info-t)))
(lapl-id hid-t))
(defcfun "H5Aget_name" ssize-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-GetName"
(attr-id hid-t)
(buf-size size-t)
(buf (:pointer :char)))
(defcfun "H5Aget_name_by_idx" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-GetNameByIdx"
(loc-id hid-t)
(obj-name :string)
(idx-type h5-index-t)
(order h5-iter-order-t)
(n hsize-t)
(name (:pointer :char))
(size size-t)
(lapl-id hid-t))
(defcfun "H5Aget_space" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-GetSpace"
(attr-id hid-t))
(defcfun "H5Aget_storage_size" hsize-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-GetStorageSize"
(attr-id hid-t))
(defcfun "H5Aget_type" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-GetType"
(attr-id hid-t))
(defcfun "H5Aiterate2" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Iterate2"
(obj-id hid-t)
(idx-type h5-index-t)
(order h5-iter-order-t)
(n (:pointer hsize-t))
(op :pointer)
(op-data :pointer))
(defcfun "H5Aiterate_by_name" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-IterateByName"
(loc-id hid-t)
(obj-name :string)
(idx-type h5-index-t)
(order h5-iter-order-t)
(n (:pointer hsize-t))
(op :pointer)
(op_data :pointer)
(lapd-id hid-t))
(defcfun "H5Aopen" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Open"
(obj-id hid-t)
(attr-name :string)
(aapl-id hid-t))
(defcfun "H5Aopen_by_idx" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-OpenByIdx"
(loc-id hid-t)
(obj-name :string)
(idx-type h5-index-t)
(order h5-iter-order-t)
(n hsize-t)
(aapl-id hid-t)
(lapd-id hid-t))
(defcfun "H5Aopen_by_name" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-OpenByName"
(loc-id hid-t)
(obj-name :string)
(attr-name :string)
(aapl-id hid-t)
(lapl-id hid-t))
(defcfun "H5Aread" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Read"
(attr-id hid-t)
(mem-type-id hid-t)
(buf :pointer))
(defcfun "H5Arename" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Rename"
(loc-id hid-t)
(old-attr-name :string)
(new-attr-name :string))
(defcfun "H5Arename_by_name" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-RenameByName"
(loc-id hid-t)
(obj-name :string)
(old-attr-name :string)
(new-attr-name :string)
(lapl-id hid-t))
(defcfun "H5Awrite" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Write"
(attr-id hid-t)
(mem-type-id hid-t)
(buf :pointer))
| 5,723 | Common Lisp | .lisp | 176 | 29.801136 | 77 | 0.660446 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 925a3d380e5087178578382fe773377f0a1813c92ed82a5e7fd6aed2bc614404 | 1,594 | [
-1
] |
1,595 | h5r.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5r.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; help @hdfgroup.org.
(in-package #:hdf5)
(defcfun "H5Rcreate" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5R.html#Reference-Create"
(ref :pointer)
(loc-id hid-t)
(name :string)
(ref-type h5r-type-t)
(space-id hid-t))
(progn
(defmacro h5rdereference-gen ()
(let ((rm-url "http://www.hdfgroup.org/HDF5/doc/RM/RM_H5R.html#Reference-Dereference")
(fn-name-v8 "H5Rdereference")
(fn-name-v10 "H5Rdereference2"))
(if (foreign-symbol-pointer fn-name-v10)
`(defcfun (,fn-name-v10 h5rdereference) hid-t
,rm-url
(dataset hid-t)
(oapl-id hid-t)
(ref-type h5r-type-t)
(ref :pointer))
`(defcfun (,fn-name-v8 h5rdereference) hid-t
,rm-url
(dataset hid-t)
(ref-type h5r-type-t)
(ref :pointer)))))
(h5rdereference-gen))
(defcfun "H5Rget_name" ssize-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5R.html#Reference-GetName"
(loc-id hid-t)
(ref-type h5r-type-t)
(ref :pointer)
(name (:pointer :char))
(size size-t))
(defcfun "H5Rget_obj_type2" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5R.html#Reference-GetObjType2"
(loc-id hid-t)
(ref-type h5r-type-t)
(ref :pointer)
(obj-type (:pointer h5o-type-t)))
(defcfun "H5Rget_region" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5R.html#Reference-GetRegion"
(dataset hid-t)
(ref-type h5r-type-t)
(ref :pointer))
| 1,966 | Common Lisp | .lisp | 55 | 30.763636 | 90 | 0.626247 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 5f0dbb3c1a6a42c652944a3c455ff17c0689e414b273e7271f79dc5500dabfaa | 1,595 | [
-1
] |
1,596 | h5pl.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5pl.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(in-package #:hdf5)
(defcfun "H5PLget_loading_state" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5PL.html#Plugin-GetLoadingState"
(plugin-flags (:pointer :int)))
(defcfun "H5PLset_loading_state" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5PL.html#Plugin-SetLoadingState"
(plugin-type :int))
| 781 | Common Lisp | .lisp | 18 | 41.777778 | 77 | 0.719737 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | af5ac4169bde761f037be79ea25a260fbe30c468e83d8ca73da9989f0fa14ef2 | 1,596 | [
-1
] |
1,597 | h5p.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5p.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(in-package #:hdf5)
(defcfun "H5Pclose" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-Close"
(plist hid-t))
(defcfun "H5Pcreate" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-Create"
(cls-id hid-t))
(defcfun "H5Pcopy" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-Copy"
(plist hid-t))
(defcfun "H5Pget_char_encoding" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetCharEncoding"
(plist-id hid-t)
(encoding (:pointer h5t-cset-t)))
(defcfun "H5Pget_chunk" :int
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetChunk"
(plist hid-t)
(max-ndims :int)
(dims (:pointer hsize-t)))
(defcfun "H5Pget_class" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetClass"
(plist hid-t))
(if (foreign-symbol-pointer "H5Pget_core_write_tracking")
(defcfun "H5Pget_core_write_tracking" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetCoreWriteTracking"
(fapl-id hid-t)
(is-enabled (:pointer hbool-t))
(page-size (:pointer size-t))))
(defcfun "H5Pget_create_intermediate_group" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetCreateIntermediateGroup"
(lcpl-d hid-t)
(crt-intermed-group (:pointer :uint)))
(defcfun "H5Pget_external" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetExternal"
(plist hid-t)
(idx :uint)
(name-size size-t)
(name (:pointer :char))
(offset (:pointer off-t))
(size (:pointer hsize-t)))
(defcfun "H5Pget_external_count" :int
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetExternalCount"
(plist hid-t))
(defcfun "H5Pget_fapl_core" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetFaplCore"
(fapl-id hid-t)
(increment (:pointer size-t))
(backing-store (:pointer hbool-t)))
(defcfun "H5Pget_fclose_degree" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetFcloseDegree"
(fapl-id hid-t)
(fc-degree (:pointer h5f-close-degree-t)))
(defcfun "H5Pget_file_image" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetFileImage"
(fapl-id hid-t)
(buf-ptr-ptr :pointer)
(buf-len (:pointer size-t)))
(defcfun "H5Pget_fill_value" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetFillValue"
(plist-id hid-t)
(type-id hid-t)
(value :pointer))
(defcfun "H5Pget_filter2" h5z-filter-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetFilter2"
(plist-id hid-t)
(idx :unsigned-int)
(flags (:pointer :unsigned-int))
(cd-nelmts (:pointer size-t))
(cd-values (:pointer :unsigned-int))
(namelen size-t)
(name (:pointer :char))
(filter-config (:pointer :unsigned-int)))
(defcfun "H5Pget_layout" h5d-layout-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetLayout"
(plist hid-t))
(defcfun "H5Pget_libver_bounds" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetLibverBounds"
(fapl-id hid-t)
(libver-low (:pointer h5f-libver-t))
(libver-high (:pointer h5f-libver-t)))
(defcfun "H5Pget_nfilters" :int
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetNFilters"
(plist hid-t))
(defcfun "H5Pget_sizes" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetSizes"
(plist hid-t)
(sizeof-addr (:pointer size-t))
(sizeof-size (:pointer size-t)))
(defcfun "H5Pget_userblock" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetUserblock"
(plist hid-t)
(size (:pointer hsize-t)))
(defcfun "H5Pget_version" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetVersion"
(plist hid-t)
(super (:pointer :uint))
(freelist (:pointer :uint))
(stab (:pointer :uint))
(shhdr (:pointer :uint)))
(defcfun "H5Pset_alloc_time" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetAllocTime"
(plist-id hid-t)
(alloc-time h5d-alloc-time-t))
(defcfun "H5Pset_char_encoding" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetCharEncoding"
(plist-id hid-t)
(encoding h5t-cset-t))
(defcfun "H5Pset_chunk" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetChunk"
(plist hid-t)
(ndims :int)
(dim (:pointer hsize-t)))
(if (foreign-symbol-pointer "H5Pset_core_write_tracking")
(defcfun "H5Pset_core_write_tracking" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetCoreWriteTracking"
(fapl-id hid-t)
(is-enabled hbool-t)
(page-size size-t)))
(defcfun "H5Pset_create_intermediate_group" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetCreateIntermediateGroup"
(lcpl-d hid-t)
(crt-intermed-group :uint))
(defcfun "H5Pset_data_transform" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetDataTransform"
(plist-id hid-t)
(expression (:pointer :char)))
(defcfun "H5Pset_deflate" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetDeflate"
(plist-id hid-t)
(level :uint))
(defcfun "H5Pset_external" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetExternal"
(plist hid-t)
(name :string)
(offset off-t)
(size hsize-t))
(defcfun "H5Pset_fapl_core" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFaplCore"
(fapl-id hid-t)
(increment size-t)
(backing-store hbool-t))
(defcfun "H5Pset_fclose_degree" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFcloseDegree"
(fapl-id hid-t)
(fc-degree h5f-close-degree-t))
(defcfun "H5Pset_file_image" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFileImage"
(fapl-id hid-t)
(buf-ptr :pointer)
(buf-len size-t))
(defcfun "H5Pset_fill_value" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFillValue"
(plist-id hid-t)
(type-id hid-t)
(value :pointer))
(defcfun "H5Pset_fletcher32" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFletcher32"
(plist-id hid-t))
(defcfun "H5Pset_layout" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetLayout"
(plist hid-t)
(layout h5d-layout-t))
(defcfun "H5Pset_libver_bounds" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetLibverBounds"
(fapl-id hid-t)
(libver-low h5f-libver-t)
(libver-high h5f-libver-t))
(defcfun "H5Pset_link_creation_order" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetLinkCreationOrder"
(gcpl-id hid-t)
(crt-order-flags :unsigned-int))
(defcfun "H5Pset_link_phase_change" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetLinkPhaseChange"
(gcpl-id hid-t)
(max-compact :unsigned-int)
(min-dense :unsigned-int))
(defcfun "H5Pset_nbit" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetNbit"
(plist-id hid-t))
(defcfun "H5Pset_scaleoffset" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetScaleoffset"
(plist-id hid-t)
(scale-type h5z-so-scale-type-t)
(scale-factor :int))
(defcfun "H5Pset_shuffle" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetShuffle"
(plist-id hid-t))
(if (foreign-symbol-pointer "H5Pset_szip")
(defcfun "H5Pset_szip" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSzip"
(plist hid-t)
(options-mask :unsigned-int)
(pixels-per-block :unsigned-int)))
(defcfun "H5Pset_userblock" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetUserblock"
(plist hid-t)
(size hsize-t))
;;
;; /*
;; * The library's property list classes
;; */
(defcvar (#.(lispify "H5P_ROOT" 'constant) "H5P_CLS_ROOT_ID_g") hid-t)
(defcvar (#.(lispify "H5P_OBJECT_CREATE" 'constant) "H5P_CLS_OBJECT_CREATE_ID_g") hid-t)
(defcvar (#.(lispify "H5P_FILE_CREATE" 'constant) "H5P_CLS_FILE_CREATE_ID_g") hid-t)
(defcvar (#.(lispify "H5P_FILE_ACCESS" 'constant) "H5P_CLS_FILE_ACCESS_ID_g") hid-t)
(defcvar (#.(lispify "H5P_DATASET_CREATE" 'constant) "H5P_CLS_DATASET_CREATE_ID_g") hid-t)
(defcvar (#.(lispify "H5P_DATASET_ACCESS" 'constant) "H5P_CLS_DATASET_ACCESS_ID_g") hid-t)
(defcvar (#.(lispify "H5P_DATASET_XFER" 'constant) "H5P_CLS_DATASET_XFER_ID_g") hid-t)
(defcvar (#.(lispify "H5P_FILE_MOUNT" 'constant) "H5P_CLS_FILE_MOUNT_ID_g") hid-t)
(defcvar (#.(lispify "H5P_GROUP_CREATE" 'constant) "H5P_CLS_GROUP_CREATE_ID_g") hid-t)
(defcvar (#.(lispify "H5P_GROUP_ACCESS" 'constant) "H5P_CLS_GROUP_ACCESS_ID_g") hid-t)
(defcvar (#.(lispify "H5P_DATATYPE_CREATE" 'constant) "H5P_CLS_DATATYPE_CREATE_ID_g") hid-t)
(defcvar (#.(lispify "H5P_DATATYPE_ACCESS" 'constant) "H5P_CLS_DATATYPE_ACCESS_ID_g") hid-t)
(defcvar (#.(lispify "H5P_STRING_CREATE" 'constant) "H5P_CLS_STRING_CREATE_ID_g") hid-t)
(defcvar (#.(lispify "H5P_ATTRIBUTE_CREATE" 'constant) "H5P_CLS_ATTRIBUTE_CREATE_ID_g") hid-t)
(defcvar (#.(lispify "H5P_ATTRIBUTE_ACCESS" 'constant) "H5P_CLS_ATTRIBUTE_ACCESS_ID_g") hid-t)
(defcvar (#.(lispify "H5P_OBJECT_COPY" 'constant) "H5P_CLS_OBJECT_COPY_ID_g") hid-t)
(defcvar (#.(lispify "H5P_LINK_CREATE" 'constant) "H5P_CLS_LINK_CREATE_ID_g") hid-t)
(defcvar (#.(lispify "H5P_LINK_ACCESS" 'constant) "H5P_CLS_LINK_ACCESS_ID_g") hid-t)
;; /*
;; * The library's default property lists
;; */
(defcvar (#.(lispify "H5P_FILE_CREATE_DEFAULT" 'constant) "H5P_LST_FILE_CREATE_ID_g") hid-t)
(defcvar (#.(lispify "H5P_FILE_ACCESS_DEFAULT" 'constant) "H5P_LST_FILE_ACCESS_ID_g") hid-t)
(defcvar (#.(lispify "H5P_DATASET_CREATE_DEFAULT" 'constant) "H5P_LST_DATASET_CREATE_ID_g") hid-t)
(defcvar (#.(lispify "H5P_DATASET_ACCESS_DEFAULT" 'constant) "H5P_LST_DATASET_ACCESS_ID_g") hid-t)
(defcvar (#.(lispify "H5P_DATASET_XFER_DEFAULT" 'constant) "H5P_LST_DATASET_XFER_ID_g") hid-t)
(defcvar (#.(lispify "H5P_FILE_MOUNT_DEFAULT" 'constant) "H5P_LST_FILE_MOUNT_ID_g") hid-t)
(defcvar (#.(lispify "H5P_GROUP_CREATE_DEFAULT" 'constant) "H5P_LST_GROUP_CREATE_ID_g") hid-t)
(defcvar (#.(lispify "H5P_GROUP_ACCESS_DEFAULT" 'constant) "H5P_LST_GROUP_ACCESS_ID_g") hid-t)
(defcvar (#.(lispify "H5P_DATATYPE_CREATE_DEFAULT" 'constant) "H5P_LST_DATATYPE_CREATE_ID_g") hid-t)
(defcvar (#.(lispify "H5P_DATATYPE_ACCESS_DEFAULT" 'constant) "H5P_LST_DATATYPE_ACCESS_ID_g") hid-t)
(defcvar (#.(lispify "H5P_ATTRIBUTE_CREATE_DEFAULT" 'constant) "H5P_LST_ATTRIBUTE_CREATE_ID_g") hid-t)
(defcvar (#.(lispify "H5P_ATTRIBUTE_ACCESS_DEFAULT" 'constant) "H5P_LST_ATTRIBUTE_ACCESS_ID_g") hid-t)
(defcvar (#.(lispify "H5P_OBJECT_COPY_DEFAULT" 'constant) "H5P_LST_OBJECT_COPY_ID_g") hid-t)
(defcvar (#.(lispify "H5P_LINK_CREATE_DEFAULT" 'constant) "H5P_LST_LINK_CREATE_ID_g") hid-t)
(defcvar (#.(lispify "H5P_LINK_ACCESS_DEFAULT" 'constant) "H5P_LST_LINK_ACCESS_ID_g") hid-t)
| 11,652 | Common Lisp | .lisp | 248 | 44.326613 | 102 | 0.686867 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | e3ebcc493a7114e775de6437fb87bd959d980d0a27e7dd83f83e86abeec9c58b | 1,597 | [
-1
] |
1,598 | h5-grovel.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5-grovel.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(pkg-config-cflags "hdf5" :optional t)
(define "_H5private_H") ; See GROVELLER-HACKING-NOTE.md for explanation
(include "hdf5.h")
(in-package #:hdf5)
(constant (+H5-VERS-MAJOR+ "H5_VERS_MAJOR"))
(constant (+H5-VERS-MINOR+ "H5_VERS_MINOR"))
(constant (+H5-VERS-RELEASE+ "H5_VERS_RELEASE"))
(ctype herr-t "herr_t")
(ctype hbool-t "hbool_t")
(ctype htri-t "htri_t")
(ctype ssize-t "ssize_t")
(ctype hsize-t "hsize_t")
(ctype hssize-t "hssize_t")
(ctype haddr-t "haddr_t")
(constant (+HADDR-UNDEF+ "HADDR_UNDEF"))
(constant (+HADDR-MAX+ "HADDR_MAX"))
(cenum h5-iter-order-t
((:H5-ITER-UNKNOWN "H5_ITER_UNKNOWN"))
((:H5-ITER-INC "H5_ITER_INC"))
((:H5-ITER-DEC "H5_ITER_DEC"))
((:H5-ITER-NATIVE "H5_ITER_NATIVE"))
((:H5-ITER-N "H5_ITER_N")))
(constant (+H5-ITER-ERROR+ "H5_ITER_ERROR"))
(constant (+H5-ITER-CONT+ "H5_ITER_CONT"))
(constant (+H5-ITER-STOP+ "H5_ITER_STOP"))
(cenum h5-index-t
((:H5-INDEX-UNKNOWN "H5_INDEX_UNKNOWN"))
((:H5-INDEX-NAME "H5_INDEX_NAME"))
((:H5-INDEX-CRT-ORDER "H5_INDEX_CRT_ORDER"))
((:H5-INDEX-N "H5_INDEX_N")))
(cstruct h5-ih-info-t "H5_ih_info_t"
(index-size "index_size" :type hsize-t)
(heap-size "heap_size" :type hsize-t))
| 1,769 | Common Lisp | .lisp | 44 | 37.022727 | 77 | 0.633918 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 16c13fe385efcf78ec68f0a40ba1fd305b73344c4cb1200a4c53b373d1ffa167 | 1,598 | [
-1
] |
1,599 | h5s-grovel.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5s-grovel.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(pkg-config-cflags "hdf5" :optional t)
(define "_H5private_H") ; See GROVELLER-HACKING-NOTE.md for explanation
(include "hdf5.h")
(in-package #:hdf5)
(constant (+H5S-ALL+ "H5S_ALL"))
(constant (+H5S-UNLIMITED+ "H5S_UNLIMITED"))
(constant (+H5S-MAX-RANK+ "H5S_MAX_RANK"))
(cenum h5s-class-t
((:H5S-NO-CLASS "H5S_NO_CLASS"))
((:H5S-SCALAR "H5S_SCALAR"))
((:H5S-SIMPLE "H5S_SIMPLE"))
((:H5S-NULL "H5S_NULL")))
(cenum h5s-seloper-t
((:H5S-SELECT-NOOP "H5S_SELECT_NOOP"))
((:H5S-SELECT-SET "H5S_SELECT_SET"))
((:H5S-SELECT-OR "H5S_SELECT_OR"))
((:H5S-SELECT-AND "H5S_SELECT_AND"))
((:H5S-SELECT-XOR "H5S_SELECT_XOR"))
((:H5S-SELECT-NOTB "H5S_SELECT_NOTB"))
((:H5S-SELECT-NOTA "H5S_SELECT_NOTA"))
((:H5S-SELECT-APPEND "H5S_SELECT_APPEND"))
((:H5S-SELECT-PREPEND "H5S_SELECT_PREPEND"))
((:H5S-SELECT-INVALID "H5S_SELECT_INVALID")))
(cenum h5s-sel-type
((:H5S-SEL-ERROR "H5S_SEL_ERROR"))
((:H5S-SEL-NONE "H5S_SEL_NONE"))
((:H5S-SEL-POINTS "H5S_SEL_POINTS"))
((:H5S-SEL-HYPERSLABS "H5S_SEL_HYPERSLABS"))
((:H5S-SEL-ALL "H5S_SEL_ALL"))
((:H5S-SEL-N "H5S_SEL_N")))
| 1,740 | Common Lisp | .lisp | 41 | 37.853659 | 77 | 0.603428 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | b7d8026f7f31f95e857375d1a5eba936693828abeb90ccbc6b9e32d907942294 | 1,599 | [
-1
] |
1,600 | h5p-grovel.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5p-grovel.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(pkg-config-cflags "hdf5" :optional t)
(define "_H5private_H") ; See GROVELLER-HACKING-NOTE.md for explanation
(include "hdf5.h")
(in-package #:hdf5)
(constant (+H5P-DEFAULT+ "H5P_DEFAULT"))
(constant (+H5P-CRT-ORDER-TRACKED+ "H5P_CRT_ORDER_TRACKED"))
(constant (+H5P-CRT-ORDER-INDEXED+ "H5P_CRT_ORDER_INDEXED"))
| 790 | Common Lisp | .lisp | 18 | 42.666667 | 77 | 0.710938 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 16c172f60a316cc36ca7bf203bc7aebdab21923d3c5ef38225eccf85a0cc7bab | 1,600 | [
-1
] |
1,601 | h5t-grovel.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5t-grovel.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(pkg-config-cflags "hdf5" :optional t)
(define "_H5private_H") ; See GROVELLER-HACKING-NOTE.md for explanation
(include "hdf5.h")
(in-package #:hdf5)
(cenum h5t-class-t
((:H5T-NO-CLASS "H5T_NO_CLASS"))
((:H5T-INTEGER "H5T_INTEGER"))
((:H5T-FLOAT "H5T_FLOAT"))
((:H5T-TIME "H5T_TIME"))
((:H5T-STRING "H5T_STRING"))
((:H5T-BITFIELD "H5T_BITFIELD"))
((:H5T-OPAQUE "H5T_OPAQUE"))
((:H5T-COMPOUND "H5T_COMPOUND"))
((:H5T-REFERENCE "H5T_REFERENCE"))
((:H5T-ENUM "H5T_ENUM"))
((:H5T-VLEN "H5T_VLEN"))
((:H5T-ARRAY "H5T_ARRAY"))
((:H5T-NCLASSES "H5T_NCLASSES")))
(cenum h5t-order-t
((:H5T-ORDER-ERROR "H5T_ORDER_ERROR"))
((:H5T-ORDER-LE "H5T_ORDER_LE"))
((:H5T-ORDER-BE "H5T_ORDER_BE"))
((:H5T-ORDER-VAX "H5T_ORDER_VAX"))
((:H5T-ORDER-MIXED "H5T_ORDER_MIXED"))
((:H5T-ORDER-NONE "H5T_ORDER_NONE")))
(cenum h5t-sign-t
((:H5T-SGN-ERROR "H5T_SGN_ERROR"))
((:H5T-SGN-NONE "H5T_SGN_NONE"))
((:H5T-SGN-2 "H5T_SGN_2"))
((:H5T-NSGN "H5T_NSGN")))
(cenum h5t-norm-t
((:H5T-NORM-ERROR "H5T_NORM_ERROR"))
((:H5T-NORM-IMPLIED "H5T_NORM_IMPLIED"))
((:H5T-NORM-MSBSET "H5T_NORM_MSBSET"))
((:H5T-NORM-NONE "H5T_NORM_NONE")))
(cenum h5t-cset-t
((:H5T-CSET-ERROR "H5T_CSET_ERROR"))
((:H5T-CSET-ASCII "H5T_CSET_ASCII"))
((:H5T-CSET-UTF8 "H5T_CSET_UTF8"))
((:H5T-CSET-RESERVED-2 "H5T_CSET_RESERVED_2"))
((:H5T-CSET-RESERVED-3 "H5T_CSET_RESERVED_3"))
((:H5T-CSET-RESERVED-4 "H5T_CSET_RESERVED_4"))
((:H5T-CSET-RESERVED-5 "H5T_CSET_RESERVED_5"))
((:H5T-CSET-RESERVED-6 "H5T_CSET_RESERVED_6"))
((:H5T-CSET-RESERVED-7 "H5T_CSET_RESERVED_7"))
((:H5T-CSET-RESERVED-8 "H5T_CSET_RESERVED_8"))
((:H5T-CSET-RESERVED-9 "H5T_CSET_RESERVED_9"))
((:H5T-CSET-RESERVED-10 "H5T_CSET_RESERVED_10"))
((:H5T-CSET-RESERVED-11 "H5T_CSET_RESERVED_11"))
((:H5T-CSET-RESERVED-12 "H5T_CSET_RESERVED_12"))
((:H5T-CSET-RESERVED-13 "H5T_CSET_RESERVED_13"))
((:H5T-CSET-RESERVED-14 "H5T_CSET_RESERVED_14"))
((:H5T-CSET-RESERVED-15 "H5T_CSET_RESERVED_15")))
(constant (+H5T-NCSET+ "H5T_NCSET"))
(cenum h5t-str-t
((:H5T-STR-ERROR "H5T_STR_ERROR"))
((:H5T-STR-NULLTERM "H5T_STR_NULLTERM"))
((:H5T-STR-NULLPAD "H5T_STR_NULLPAD"))
((:H5T-STR-SPACEPAD "H5T_STR_SPACEPAD"))
((:H5T-STR-RESERVED-3 "H5T_STR_RESERVED_3"))
((:H5T-STR-RESERVED-4 "H5T_STR_RESERVED_4"))
((:H5T-STR-RESERVED-5 "H5T_STR_RESERVED_5"))
((:H5T-STR-RESERVED-6 "H5T_STR_RESERVED_6"))
((:H5T-STR-RESERVED-7 "H5T_STR_RESERVED_7"))
((:H5T-STR-RESERVED-8 "H5T_STR_RESERVED_8"))
((:H5T-STR-RESERVED-9 "H5T_STR_RESERVED_9"))
((:H5T-STR-RESERVED-10 "H5T_STR_RESERVED_10"))
((:H5T-STR-RESERVED-11 "H5T_STR_RESERVED_11"))
((:H5T-STR-RESERVED-12 "H5T_STR_RESERVED_12"))
((:H5T-STR-RESERVED-13 "H5T_STR_RESERVED_13"))
((:H5T-STR-RESERVED-14 "H5T_STR_RESERVED_14"))
((:H5T-STR-RESERVED-15 "H5T_STR_RESERVED_15")))
(constant (+H5T-NSTR+ "H5T_NSTR"))
(cenum h5t-pad-t
((:H5T-PAD-ERROR "H5T_PAD_ERROR"))
((:H5T-PAD-ZERO "H5T_PAD_ZERO"))
((:H5T-PAD-ONE "H5T_PAD_ONE"))
((:H5T-PAD-BACKGROUND "H5T_PAD_BACKGROUND"))
((:H5T-NPAD "H5T_NPAD")))
(cenum h5t-cmd-t
((:H5T-CONV-INIT "H5T_CONV_INIT"))
((:H5T-CONV-CONV "H5T_CONV_CONV"))
((:H5T-CONV-FREE "H5T_CONV_FREE")))
(cenum h5t-bkg-t
((:H5T-BKG-NO "H5T_BKG_NO"))
((:H5T-BKG-TEMP "H5T_BKG_TEMP"))
((:H5T-BKG-YES "H5T_BKG_YES")))
(cstruct h5t-cdata-t "H5T_cdata_t"
(command "command" :type H5T-cmd-t)
(need-bkg "need_bkg" :type H5T-bkg-t)
(recalc "recalc" :type hbool-t)
(priv "priv" :type :pointer))
(cenum h5t-pers-t
((:H5T-PERS-DONTCARE "H5T_PERS_DONTCARE"))
((:H5T-PERS-HARD "H5T_PERS_HARD"))
((:H5T-PERS-SOFT "H5T_PERS_SOFT")))
(cenum h5t-dir-t
((:H5T-DIR-DEFAULT "H5T_DIR_DEFAULT"))
((:H5T-DIR-ASCEND "H5T_DIR_ASCEND"))
((:H5T-DIR-DESCEND "H5T_DIR_DESCEND")))
(cenum h5t-conv-except-t
((:H5T-CONV-EXCEPT-RANGE-HI "H5T_CONV_EXCEPT_RANGE_HI"))
((:H5T-CONV-EXCEPT-RANGE-LOW "H5T_CONV_EXCEPT_RANGE_LOW"))
((:H5T-CONV-EXCEPT-PRECISION "H5T_CONV_EXCEPT_PRECISION"))
((:H5T-CONV-EXCEPT-TRUNCATE "H5T_CONV_EXCEPT_TRUNCATE"))
((:H5T-CONV-EXCEPT-PINF "H5T_CONV_EXCEPT_PINF"))
((:H5T-CONV-EXCEPT-NINF "H5T_CONV_EXCEPT_NINF"))
((:H5T-CONV-EXCEPT-NAN "H5T_CONV_EXCEPT_NAN")))
(cenum h5t-conv-ret-t
((:H5T-CONV-ABORT "H5T_CONV_ABORT"))
((:H5T-CONV-UNHANDLED "H5T_CONV_UNHANDLED"))
((:H5T-CONV-HANDLED "H5T_CONV_HANDLED")))
(cstruct hvl-t "hvl_t"
(len "len" :type size-t)
(p "p" :type :pointer))
(constant (+H5T-VARIABLE+ "H5T_VARIABLE"))
(constant (+H5T-OPAQUE-TAG-MAX+ "H5T_OPAQUE_TAG_MAX"))
(constant (+CHAR-MIN+ "CHAR_MIN"))
| 5,710 | Common Lisp | .lisp | 129 | 37.899225 | 77 | 0.577802 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 661a21967a56b52e6007a0bf29f4dc6a32211ebe2d4ddb83ea1e40d45ae4f593 | 1,601 | [
-1
] |
1,602 | h5pl-grovel.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5pl-grovel.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(pkg-config-cflags "hdf5" :optional t)
(define "_H5private_H") ; See GROVELLER-HACKING-NOTE.md for explanation
(include "hdf5.h")
(in-package #:hdf5)
(cenum h5pl-type-t
((:H5PL-TYPE-ERROR "H5PL_TYPE_ERROR"))
((:H5PL-TYPE-FILTER "H5PL_TYPE_FILTER"))
((:H5PL-TYPE-NONE "H5PL_TYPE_NONE")))
(constant (+H5PL-FILTER-PLUGIN+ "H5PL_FILTER_PLUGIN"))
(constant (+H5PL-ALL-PLUGIN+ "H5PL_ALL_PLUGIN"))
| 880 | Common Lisp | .lisp | 21 | 40.428571 | 77 | 0.697076 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | c41ad9ab380c06d29398ec6b56306424becd0fc0685f5e35a061aecb463de2ea | 1,602 | [
-1
] |
1,603 | h5i-grovel.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5i-grovel.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(pkg-config-cflags "hdf5" :optional t)
(define "_H5private_H") ; See GROVELLER-HACKING-NOTE.md for explanation
(include "hdf5.h")
(in-package #:hdf5)
(cenum h5i-type-t
((:H5I-UNINIT "H5I_UNINIT"))
((:H5I-BADID "H5I_BADID"))
((:H5I-FILE "H5I_FILE"))
((:H5I-GROUP "H5I_GROUP"))
((:H5I-DATATYPE "H5I_DATATYPE"))
((:H5I-DATASPACE "H5I_DATASPACE"))
((:H5I-DATASET "H5I_DATASET"))
((:H5I-ATTR "H5I_ATTR"))
;; ((:H5I-REFERENCE "H5I_REFERENCE"))
((:H5I-VFL "H5I_VFL"))
((:H5I-GENPROP-CLS "H5I_GENPROP_CLS"))
((:H5I-GENPROP-LST "H5I_GENPROP_LST"))
((:H5I-ERROR-CLASS "H5I_ERROR_CLASS"))
((:H5I-ERROR-MSG "H5I_ERROR_MSG"))
((:H5I-ERROR-STACK "H5I_ERROR_STACK"))
((:H5I-NTYPES "H5I_NTYPES")))
(ctype hid-t "hid_t")
(constant (+H5-SIZEOF-HID-T+ "H5_SIZEOF_HID_T"))
(constant (+H5I-INVALID-HID+ "H5I_INVALID_HID"))
| 1,450 | Common Lisp | .lisp | 35 | 37.057143 | 77 | 0.600426 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 4eb49d633e0fcd662c86fe7ce07f49ca63eba1c8c7a162ba1a25ce9a86dc5d89 | 1,603 | [
-1
] |
1,604 | h5.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(in-package #:hdf5)
(if (foreign-symbol-pointer "H5allocate_memory")
(defcfun "H5allocate_memory" :pointer
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5.html#Library-AllocateMemory"
(size size-t)
(clear hbool-t)))
#|
(defcfun "H5check_version" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5.html#Library-VersCheck"
(majnum :unsigned-int)
(minnum :unsigned-int)
(relnum :unsigned-int))
|#
(defcfun "H5close" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5.html#Library-Close")
(defcfun "H5dont_atexit" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5.html#Library-DontAtExit")
(if (foreign-symbol-pointer "H5free_memory")
(defcfun "H5free_memory" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5.html#Library-FreeMemory"
(buf :pointer)))
(defcfun "H5garbage_collect" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5.html#Library-GarbageCollect")
(defcfun "H5get_libversion" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5.html#Library-Version"
(majnum (:pointer :unsigned-int))
(minnum (:pointer :unsigned-int))
(relnum (:pointer :unsigned-int)))
(if (foreign-symbol-pointer "H5is_library_threadsafe")
(defcfun "H5is_library_threadsafe" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5.html#Library-IsLibraryThreadsafe"
(buf (:pointer hbool-t))))
(defcfun "H5open" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5.html#Library-Open")
(h5open) ;; ensure that this library is initialized.
(if (foreign-symbol-pointer "H5resize_memory")
(defcfun "H5resize_memory" :pointer
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5.html#Library-AllocateMemory"
(mem :pointer)
(size size-t)))
(defcfun "H5set_free_list_limits" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5.html#Library-SetFreeListLimits"
(reg-global-lim :int)
(reg-list-lim :int)
(arr-global-lim :int)
(arr-list-lim :int)
(blk-global-lim :int)
(blk-list-lim :int))
| 2,462 | Common Lisp | .lisp | 59 | 38.576271 | 83 | 0.699163 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 72abc9a31a4580d60365b6a68f40dfafed2fd25c3fec93898a73e5cc9065abc4 | 1,604 | [
-1
] |
1,605 | h5s.lisp | ghollisjr_cl-ana/hdf-cffi/src/h5s.lisp | ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; Copyright by The HDF Group.
;;;; All rights reserved.
;;;;
;;;; This file is part of hdf5-cffi.
;;;; The full hdf5-cffi copyright notice, including terms governing
;;;; use, modification, and redistribution, is contained in the file COPYING,
;;;; which can be found at the root of the source code distribution tree.
;;;; If you do not have access to this file, you may request a copy from
;;;; [email protected].
(in-package #:hdf5)
(defcfun "H5Sclose" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-Close"
(space-id hid-t))
(defcfun "H5Scopy" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-Copy"
(space-id hid-t))
(defcfun "H5Screate" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-Create"
(types h5s-class-t))
(defcfun "H5Screate_simple" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-CreateSimple"
(rank :int)
(current-dims (:pointer hsize-t))
(maximum-dims (:pointer hsize-t)))
(defcfun "H5Sdecode" hid-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-Decode"
(buf (:pointer :unsigned-char)))
(defcfun "H5Sencode" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-Encode"
(obj-id hid-t)
(buf (:pointer :unsigned-char))
(nalloc (:pointer size-t)))
(defcfun "H5Sextent_copy" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-ExtentCopy"
(dest-space-id hid-t)
(source-space-id hid-t))
(defcfun "H5Sextent_equal" htri-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-ExtentEqual"
(space1-id hid-t)
(space2-id hid-t))
(defcfun "H5Sget_select_bounds" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectBounds"
(space-id hid-t)
(start (:pointer hsize-t))
(end (:pointer hsize-t)))
(defcfun "H5Sget_select_elem_npoints" hssize-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectElemNPoints"
(space-id hid-t))
(defcfun "H5Sget_select_elem_pointlist" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectElemPointList"
(space-id hid-t)
(startpoint hsize-t)
(numpoints hsize-t)
(buf (:pointer hsize-t)))
(defcfun "H5Sget_select_hyper_blocklist" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectHyperBlockList"
(space-id hid-t)
(startblock hsize-t)
(numblocks hsize-t)
(buf (:pointer hsize-t)))
(defcfun "H5Sget_select_hyper_nblocks" hssize-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectHyperNBlocks"
(space-id hid-t))
(defcfun "H5Sget_select_npoints" hssize-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectNpoints"
(space-id hid-t))
(defcfun "H5Sget_select_type" h5s-sel-type
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-GetSelectType"
(space-id hid-t))
(defcfun "H5Sget_simple_extent_dims" :int
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-ExtentDims"
(space-id hid-t)
(dims (:pointer hsize-t))
(maxdims (:pointer hsize-t)))
(defcfun "H5Sget_simple_extent_ndims" :int
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-ExtentNdims"
(space-id hid-t))
(defcfun "H5Sget_simple_extent_npoints" hssize-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-ExtentNpoints"
(space-id hid-t))
(defcfun "H5Sget_simple_extent_type" H5S-class-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-ExtentType"
(space-id hid-t))
(defcfun "H5Sis_simple" htri-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-IsSimple"
(space-id hid-t))
(defcfun "H5Soffset_simple" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-OffsetSimple"
(space-id hid-t)
(offset (:pointer hssize-t)))
(defcfun "H5Sselect_all" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectAll"
(dspace-id hid-t))
(defcfun "H5Sselect_elements" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectElements"
(space-id hid-t)
(select-operation h5s-seloper-t)
(num-elements size-t)
(coord (:pointer hsize-t)))
(defcfun "H5Sselect_hyperslab" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectHyperslab"
(space-id hid-t)
(select-operation h5s-seloper-t)
(start (:pointer hsize-t))
(stride (:pointer hsize-t))
(count (:pointer hsize-t))
(block (:pointer hsize-t)))
(defcfun "H5Sselect_none" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectNone"
(space-id hid-t))
(defcfun "H5Sselect_valid" htri-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectValid"
(space-id hid-t))
(defcfun "H5Sset_extent_none" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SetExtentNone"
(space-id hid-t))
(defcfun "H5Sset_extent_simple" herr-t
"http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SetExtentSimple"
(space-id hid-t)
(rank :int)
(current-size (:pointer hsize-t))
(maximum-size (:pointer hsize-t)))
| 5,171 | Common Lisp | .lisp | 124 | 39.112903 | 82 | 0.709845 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 199688aaaab3bcb50114500bfe89d68e0eef6379c0ae3fcf8335c0bd69a30b97 | 1,605 | [
-1
] |
1,606 | test.lisp | ghollisjr_cl-ana/hdf-cffi/t/test.lisp |
(defpackage #:hdf5-test
(:use :cl :fiveam :hdf5))
(in-package #:hdf5-test)
(def-suite :hdf5-cffi)
(in-suite :hdf5-cffi)
(defun load* (name)
(handler-case
(progn (load (asdf:system-relative-pathname :hdf5-cffi name))
(pass))
(error (c)
(fail "While running test ~a:~% ~a" name c)))
(finish-output)
(finish-output *error-output*))
(test basics
(load* "examples/basics/h5-cmprss.lisp")
(load* "examples/basics/h5-crtdat.lisp")
(load* "examples/basics/h5-crtatt.lisp")
(load* "examples/basics/h5-crtgrp.lisp")
(load* "examples/basics/h5-crtgrpar.lisp")
(load* "examples/basics/h5-crtgrpd.lisp")
(load* "examples/basics/h5-extend.lisp")
(load* "examples/basics/h5-rdwt.lisp")
(load* "examples/basics/h5-subset.lisp"))
(test datasets
(load* "examples/datasets/h5ex-d-alloc.lisp")
(load* "examples/datasets/h5ex-d-checksum.lisp")
(load* "examples/datasets/h5ex-d-chunk.lisp")
(load* "examples/datasets/h5ex-d-compact.lisp")
(load* "examples/datasets/h5ex-d-extern.lisp")
(load* "examples/datasets/h5ex-d-fillval.lisp")
(load* "examples/datasets/h5ex-d-gzip.lisp")
(load* "examples/datasets/h5ex-d-hyper.lisp")
(load* "examples/datasets/h5ex-d-nbit.lisp")
(load* "examples/datasets/h5ex-d-rdwr.lisp")
(load* "examples/datasets/h5ex-d-shuffle.lisp")
(load* "examples/datasets/h5ex-d-sofloat.lisp")
(load* "examples/datasets/h5ex-d-soint.lisp")
(load* "examples/datasets/h5ex-d-szip.lisp")
(load* "examples/datasets/h5ex-d-transform.lisp")
(load* "examples/datasets/h5ex-d-unlimadd.lisp")
(load* "examples/datasets/h5ex-d-unlimgzip.lisp")
(load* "examples/datasets/h5ex-d-unlimmod.lisp"))
(test datatypes
(load* "examples/datatypes/h5ex-t-array.lisp")
(load* "examples/datatypes/h5ex-t-arrayatt.lisp")
(load* "examples/datatypes/h5ex-t-bit.lisp")
(load* "examples/datatypes/h5ex-t-bitatt.lisp")
(load* "examples/datatypes/h5ex-t-cmpd.lisp")
(load* "examples/datatypes/h5ex-t-cmpdatt.lisp")
(load* "examples/datatypes/h5ex-t-commit.lisp")
(load* "examples/datatypes/h5ex-t-convert.lisp")
(load* "examples/datatypes/h5ex-t-cpxcmpd.lisp")
(load* "examples/datatypes/h5ex-t-cpxcmpdatt.lisp")
(load* "examples/datatypes/h5ex-t-enum.lisp")
(load* "examples/datatypes/h5ex-t-enumatt.lisp")
(load* "examples/datatypes/h5ex-t-float.lisp")
(load* "examples/datatypes/h5ex-t-floatatt.lisp")
(load* "examples/datatypes/h5ex-t-int.lisp")
(load* "examples/datatypes/h5ex-t-intatt.lisp")
(load* "examples/datatypes/h5ex-t-objref.lisp")
(load* "examples/datatypes/h5ex-t-objrefatt.lisp")
(load* "examples/datatypes/h5ex-t-opaque.lisp")
(load* "examples/datatypes/h5ex-t-opaqueatt.lisp")
(load* "examples/datatypes/h5ex-t-regref.lisp")
(load* "examples/datatypes/h5ex-t-regrefatt.lisp")
(load* "examples/datatypes/h5ex-t-string.lisp")
(load* "examples/datatypes/h5ex-t-stringatt.lisp")
(load* "examples/datatypes/h5ex-t-vlen.lisp")
(load* "examples/datatypes/h5ex-t-vlenatt.lisp")
(load* "examples/datatypes/h5ex-t-vlstring.lisp")
(load* "examples/datatypes/h5ex-t-vlstringatt.lisp"))
(test groups
(load* "examples/groups/h5ex-g-compact.lisp")
(load* "examples/groups/h5ex-g-corder.lisp")
(load* "examples/groups/h5ex-g-create.lisp")
(load* "examples/groups/h5ex-g-intermediate.lisp")
(load* "examples/groups/h5ex-g-iterate.lisp")
(load* "examples/groups/h5ex-g-phase.lisp")
(load* "examples/groups/h5ex-g-traverse.lisp")
(load* "examples/groups/h5ex-g-visit.lisp"))
| 3,511 | Common Lisp | .lisp | 80 | 40.7625 | 67 | 0.721963 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 37bb5bd292af6d343470c93ab23eaa1e2365ad6a4b1af4401c0ecd2e04b8a59e | 1,606 | [
-1
] |
1,607 | package.lisp | ghollisjr_cl-ana/macro-utils/package.lisp | ;;;; cl-ana is a Common Lisp data analysis library.
;;;; Copyright 2013, 2014 Gary Hollis
;;;;
;;;; This file is part of cl-ana.
;;;;
;;;; cl-ana is free software: you can redistribute it and/or modify it
;;;; under the terms of the GNU General Public License as published by
;;;; the Free Software Foundation, either version 3 of the License, or
;;;; (at your option) any later version.
;;;;
;;;; cl-ana is distributed in the hope that it will be useful, but
;;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>.
;;;;
;;;; You may contact Gary Hollis (me!) via email at
;;;; [email protected]
(defpackage #:cl-ana.macro-utils
(:use #:cl
#:split-sequence
#:alexandria
#:cl-ana.list-utils
#:cl-ana.string-utils
#:cl-ana.symbol-utils)
(:export :defplural
:inrange
:case-equal
:cond-setf
:print-eval
:with-default-args
:when-keywords
:defun-with-setf
:abbrev
:abbrevs
:funcall-bind
:map-bind
:symb
:dbind
:mvbind
:mvsetq
:fvbind
;; Looping construct for polling:
:poll
;; anaphoric macros:
:it
:self
:alambda
:aif
:awhen
;; macro for timing processes (returning time)
:time-proc
;; handling lambda lists:
:lambda-list-call-form
;; Suppress output:
:suppress-output
;; lambda especially for keywords
:klambda
;; once-only let macro
:olet
;; dlambda (dispatching lambda) from let over lambda
:dlambda
;; Looping over Cartesian product
:for-cartesian
;; Looping over array indices
:for-array
))
| 2,150 | Common Lisp | .lisp | 69 | 23.101449 | 70 | 0.575481 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 8a9ba7922593fce5bba3e38d442b9c4836de95a74a38c6175e6bbc25b88d7965 | 1,607 | [
-1
] |
1,608 | macro-utils.lisp | ghollisjr_cl-ana/macro-utils/macro-utils.lisp | ;;;; cl-ana is a Common Lisp data analysis library.
;;;; Copyright 2013, 2014 Gary Hollis
;;;;
;;;; This file is part of cl-ana.
;;;;
;;;; cl-ana is free software: you can redistribute it and/or modify it
;;;; under the terms of the GNU General Public License as published by
;;;; the Free Software Foundation, either version 3 of the License, or
;;;; (at your option) any later version.
;;;;
;;;; cl-ana is distributed in the hope that it will be useful, but
;;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>.
;;;;
;;;; You may contact Gary Hollis (me!) via email at
;;;; [email protected]
(in-package :cl-ana.macro-utils)
;; Macro for defining pluralized versions of functions, e.g. a
;; function which would map car across a list could be called cars.
(defmacro defplural (fname)
"Defines a function which maps the function with symbol fname across
a list. The defined function has as its symbol fname with a trailing
s character appended."
(let* ((fname-str (string fname))
(fnames-str (string-append fname-str "S"))
(fnames (intern fnames-str)))
`(defun ,fnames (list)
(mapcar #',fname list))))
;; Macro for evaluating multiple functions on a single object,
;; creating bindings for the return values:
(defmacro function-value-bind (function-symbols object &body body)
"Evaluates each function in the list of function symbols on object
in the order as they occur in function-symbols. Binds each return
value to the corresponding function-symbol and executes body inside of
this lexical scope."
(with-gensyms (obj)
`(let* ((,obj ,object)
,@(loop
for fs in function-symbols
collect `(,fs (,fs ,obj))))
,@body)))
(defmacro map-bind (fn symbols &body body)
"Binds each symbol in symbols to the value of (funcall fn symbol) and
executes body inside of this lexical scope."
(with-gensyms (func)
`(let* ((,func ,fn)
,@(loop
for sym in symbols
collecting `(,sym (funcall ,func ,sym))))
,@body)))
;; A little help from On Lisp
(defmacro abbrev (short long)
"Defines abbreviated operator with name short expanding to a call to
long."
`(defmacro ,short (&rest args)
`(,',long ,@args)))
(defmacro abbrevs (&rest names)
"Defines multiple abbreviations simultaneously. Arguments are interpreted as:
(abbrevs short1 long1
short2 long2
...)"
`(progn
,@(mapcar #'(lambda (pair)
`(abbrev ,@pair))
(group names 2))))
(abbrevs dbind destructuring-bind
mvbind multiple-value-bind
mvsetq multiple-value-setq
fvbind function-value-bind
mbind map-bind)
;; Polling macro: Polling is fairly common in asynchronous programs,
;; and due to this having a premade macro comes in handy
(defmacro poll (test wait &body body)
"Repeatedly executes test form; if test returns true, executes body;
otherwise waits for wait seconds and tries again. Returns last form
in body."
(alexandria:with-gensyms (tst)
`(do ()
(,test (progn ,@body))
(sleep ,wait))))
(defmacro inrange (xlo op1 x op2 xhi &key (prec 0))
`(and (if ,xlo
(,op1 (- ,xlo ,prec) ,x)
t)
(if ,xhi
(,op2 ,x (+ ,xhi ,prec))
t)))
;; Macro for limited case using equal for comparison:
(defmacro case-equal (form &body cases)
(with-gensyms (ev-form)
(let* ((otherwise nil)
(tests
(loop for c in cases
when (or (eq (car c) 'otherwise)
(eq (car c) 't))
do (setf otherwise (cdr c))
else
collecting `(equal ,ev-form ,(car c))))
(bodies (mapcar #'cdr cases)))
`(let ((,ev-form ,form))
(cond
,@(nconc (zip tests bodies)
(when otherwise
`((t ,@otherwise)))))))))
(defmacro cond-setf (place value &optional (condition t))
"Only sets the place when the condition is met.
condition may be one of three values: :place, :value, or :both.
:place specifies that the place must evaluate to a non-nil value,
:value specifies that the value must evaluate to a non-nil value, and
:both specifies that both place and value must evaluate to non-nil
values."
(let ((test
(case condition
(:place
place)
(:value
value)
(:both
`(and ,place ,value))
(:otherwise
t))))
`(when ,test
(setf ,place ,value))))
(defmacro print-eval (arg)
(with-gensyms (varname)
`(let ((,varname ,arg))
(prin1 ',arg)
(format t ": ")
(prin1 ,varname)
(format t "~%")
,varname)))
;; Calls a function with default argument values
(defmacro with-default-args (fn (&rest argbindings) &body body)
"Executes body with default argument values supplied to fn in a convenient way.
fn is either the name of a function or a list (function local-name);
fn is defined via flet and takes no arguments, but refers to the
arguments in argbindings.
argbindings are used analogously to let.
Example: (with-default-args (list fn) ((x 3)) (fn)) yields (3). More
useful examples would involve conditionally setting argument values in
the body."
`(let (,@argbindings)
(flet ((,(if (listp fn)
(second fn)
fn)
()
(funcall (symbol-function ',(if (listp fn)
(first fn)
fn))
,@(mapcar #'car argbindings))))
,@body)))
;; Very useful macro for combining keyword arguments only when
;; appropriate
(defmacro when-keywords (&body keyword-arg-specs)
"Creates a plist containing the keyword arguments only when the
values are non-nil; if a keyword-arg-spec is a list, then the first
element is taken to be the field symbol and the second element the
expression to be passed as the value."
(let* ((specs
(loop
for kas in keyword-arg-specs
collecting
(if (consp kas)
kas
(list (keywordify kas)
kas))))
(when-statements
(loop
for (field-name val) in specs
collecting
`(when ,val
(list ,field-name ,val)))))
`(append ,@when-statements)))
;; Reader macro for when-keywords:
;; Use #k(fn arg1 ... &when-keys key1 ...) as a shorthand form for
;; (apply #'fn arg 1 ... (when-keywords key1 ...))
;;(eval-when (:compile-toplevel :load-toplevel :execute)
(defun when-keywords-transformer-reader-macro (stream subchar arg)
(let ((expr (read stream t)))
(multiple-value-bind (normal-terms when-keys)
(loop
for x in expr
for lst on expr
until (and (symbolp x) (equal (keywordify x) :&when-keys))
collecting x into normal-terms
finally (return (values normal-terms (rest lst))))
(let ((fn (first normal-terms))
(normal-args (rest normal-terms)))
(append `(apply (function ,fn))
normal-args
(when when-keys
`((when-keywords ,@when-keys))))))))
(set-dispatch-macro-character
#\# #\k #'when-keywords-transformer-reader-macro)
;;)
;; Sometimes this is useful:
(defmacro defun-with-setf (fname (&rest lambda-list) &body body)
"Defines function along with setfable version when body is a single
expression; throws error otherwise. This is limited to cases where
the expression is already understandable to setf."
(if (length-equal body 1)
(alexandria:with-gensyms (value)
`(progn
(defun ,fname ,lambda-list
,@body)
(defun (setf ,fname) (,value ,@lambda-list)
(setf ,@body
,value))))
(error "Cannot define-with-setf for more than one body expression")))
;;;; From let-over-lambda: (this should probably be somewhere else)
(defun symb (&rest args)
(values (intern (apply #'mkstr args))))
;;;; Anaphoric macros from On Lisp:
(defmacro alambda (parms &body body)
`(labels ((self ,parms ,@body))
#'self))
(defmacro aif (test then &optional else)
`(let ((it ,test))
(if it ,then ,else)))
(defmacro awhen (test &body body)
`(let ((it ,test))
(when it
,@body)))
;; A more convenient version of the time function:
(defmacro time-proc (&body body)
"Times the execution of body and returns multiple values: 1. Real
time in seconds, 2. Run time in seconds, and the rest being the return
values of body."
(with-gensyms (ups
real-start-time
real-end-time
run-start-time
run-end-time
values)
`(let ((,ups internal-time-units-per-second)
(,real-start-time
(get-internal-real-time))
(,run-start-time (get-internal-run-time))
(,values
(multiple-value-list
(progn ,@body)))
(,run-end-time (get-internal-run-time))
(,real-end-time (get-internal-real-time)))
(apply #'values
(/ (float (- ,real-end-time ,real-start-time) 0d0)
(float ,ups 0d0))
(/ (float (- ,run-end-time ,run-start-time) 0d0)
(float ,ups 0d0))
,values))))
;;;; This is actually fully implemented by both loop and the iterate
;;;; library
;;;; Useful for simple while loops:
;; (defmacro while (boolean &body body)
;; "Executes boolean at the start of each iteration; if boolean is
;; non-nil then body is executed, else while exits. At the moment the
;; return value is not specified.n"
;; (with-gensyms (test)
;; `(do ((,test ,boolean ,boolean))
;; ((not ,test))
;; ,@body)))
;;;; lambda-list functions:
(defun ll-type (lambda-list)
"Returns the type of lambda-list for a function which lambda-list
corresponds to."
(cond
((member '&key lambda-list)
:key)
((member '&rest lambda-list)
:rest)
((member '&optional lambda-list)
:optional)
(t t)))
(defun args->keyword-args (args)
(mapcan (lambda (x)
(macrolet ((key (x)
`(keywordify (lispify ,x))))
(if (listp x)
(destructuring-bind (arg arg-def)
x
(list (key arg)
arg))
(list (key x)
x))))
args))
(defun lambda-list-call-form (fname lambda-list)
"Returns the appropriate lambda-list call form for a function named
fname and a lambda-list given by lambda-list. Macros are more
difficult since lambda lists can have nested structure, so I'm only
considering function lambda lists for now. This still works for
macros which have this limited sort of lambda list however.
One issue that is not currently resolved is supplying arguments which
have a -supplied-p argument. Functions can be handled, but not in the
same way as macros (since apply does not work).
Also: &rest is handled only for functions becuause, again, there is no
practical way to use this method for macros."
(case (ll-type lambda-list)
(:key
(destructuring-bind (xs key-xs)
(split-sequence '&key lambda-list)
`(,fname ,@xs ,@(args->keyword-args key-xs))))
(:optional
(destructuring-bind (xs optional-xs)
(split-sequence '&optional lambda-list)
`(,fname ,@xs ,@(mapcar (compose #'car #'mklist) optional-xs))))
(:rest
(destructuring-bind (xs rest-xs)
(split-sequence '&rest lambda-list)
`(apply #',fname ,@xs ,(car rest-xs))))
(t
`(,fname ,@lambda-list))))
;; Macro for suppressing output:
(defmacro suppress-output (&body body)
"suppress-output redirects all output to /dev/null, thus silencing
any messages printed to *standard-output*."
`(let ((*standard-output* (make-broadcast-stream)))
(let ((*error-output* *standard-output*))
,@body)))
(defmacro suppress-output-old (&body body)
"suppress-output redirects all output to /dev/null, thus silencing
any messages printed to *standard-output*."
`(with-open-file (*standard-output* "/dev/null"
:direction :output
:if-exists :supersede
:if-does-not-exist :error)
(let ((*error-output* *standard-output*))
,@body)))
;; Modified lambda for keyword args
(defmacro klambda ((&rest key-args) &body body)
"Modified lambda which returns a keyword arg-accepting function with
&allow-other-keys"
`(lambda (&key ,@key-args &allow-other-keys)
,@body))
;; Only-when-present let macro
(defmacro olet ((&rest bindings) &body body)
"olet (at the moment) functions much like let*, except that each
binding is only evaluated once at most, and not at all if the lexical
binding is never used in the body. This can result in a tremendous
speedup when used in creating context, e.g. looping over a table but
only needing a few fields from the table. In test cases the compiler
appeared to remove unused bindings entirely thanks to the
symbol-macrolet."
(let* ((gsyms (mapcar (lambda (x) (gensym)) bindings))
(gsets (mapcar (lambda (x) (gensym)) bindings))
(sym-macros
(mapcar (lambda (b gsym gset)
(destructuring-bind (sym val) b
`(,sym
(if ,gset
,gsym
(progn
(setf ,gset t)
(setf ,gsym ,val))))))
bindings
gsyms
gsets)))
`(let (,@gsyms
,@gsets)
(symbol-macrolet ,sym-macros
,@body))))
;; dlambda from let over lambda
(defmacro dlambda (&rest ds)
(alexandria:with-gensyms (args)
`(lambda (&rest ,args)
(case (car ,args)
,@(mapcar
(lambda (d)
`(,(if (eq t (car d))
t
(list (car d)))
(apply (lambda ,@(cdr d))
,(if (eq t (car d))
args
`(cdr ,args)))))
ds)))))
;; Looping over Cartesian product
(defmacro for-cartesian (binding xss &body body)
"Effectively iterates over every element of the Cartesian product of
xss, which is a sequence of (xs ys ...) to be Cartesian-multiplied.
If binding is an atom, then the Cartesian product element will be set
to that variable as a list. If it is a list of symbols, then each
symbol will be bound to its corresponding element from the Cartesian
product element."
(alexandria:with-gensyms (sets setdims nsets
index
continue
incr dim)
`(let* ((,sets ,xss)
(,nsets (length ,sets))
(,setdims (map 'vector #'length ,sets))
(,index (make-array ,nsets :initial-element 0))
(,continue t))
(loop
while ,continue
do
;; execute body
,(if (atom binding)
`(let ((,binding (map 'list #'elt
,sets
,index)))
,@body)
`(destructuring-bind ,binding
(map 'list #'elt
,sets
,index)
,@body))
;; iterate
(let* ((,incr t)
(,dim 0))
(loop
while ,incr
do
(if (>= ,dim ,nsets)
(progn
(setf ,incr nil)
(setf ,continue nil))
(progn
(incf (aref ,index ,dim))
(if (>= (aref ,index ,dim)
(aref ,setdims ,dim))
(progn
(setf (aref ,index ,dim) 0)
(incf ,dim))
(setf ,incr nil))))))))))
| 16,599 | Common Lisp | .lisp | 427 | 29.95082 | 81 | 0.584248 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 1333d8a4bd2919f5ae86b2de6c3075067bcc64c1463b6ff54d9281aef1885813 | 1,608 | [
-1
] |
1,609 | package.lisp | ghollisjr_cl-ana/clos-utils/package.lisp | ;;;; cl-ana is a Common Lisp data analysis library.
;;;; Copyright 2013, 2014 Gary Hollis
;;;;
;;;; This file is part of cl-ana.
;;;;
;;;; cl-ana is free software: you can redistribute it and/or modify it
;;;; under the terms of the GNU General Public License as published by
;;;; the Free Software Foundation, either version 3 of the License, or
;;;; (at your option) any later version.
;;;;
;;;; cl-ana is distributed in the hope that it will be useful, but
;;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>.
;;;;
;;;; You may contact Gary Hollis (me!) via email at
;;;; [email protected]
(defpackage #:cl-ana.clos-utils
(:use :cl
:cl-ana.tensor
:cl-ana.list-utils
:cl-ana.symbol-utils)
(:export :slot-names
:slot-keyword-names
:slot-values
:clist-type
:clist-field-symbols
:clist-field-values
:object->clist
:object->plist
:clist->object
:type-constructor))
| 1,270 | Common Lisp | .lisp | 35 | 31.514286 | 70 | 0.65316 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 7e860df0561cb209202e72f99abb37e749dd99b09db6336353fe433c32b50fd5 | 1,609 | [
-1
] |
1,610 | clos-utils.lisp | ghollisjr_cl-ana/clos-utils/clos-utils.lisp | ;;;; cl-ana is a Common Lisp data analysis library.
;;;; Copyright 2013, 2014 Gary Hollis
;;;;
;;;; This file is part of cl-ana.
;;;;
;;;; cl-ana is free software: you can redistribute it and/or modify it
;;;; under the terms of the GNU General Public License as published by
;;;; the Free Software Foundation, either version 3 of the License, or
;;;; (at your option) any later version.
;;;;
;;;; cl-ana is distributed in the hope that it will be useful, but
;;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>.
;;;;
;;;; You may contact Gary Hollis (me!) via email at
;;;; [email protected]
(in-package :cl-ana.clos-utils)
(defun slot-names (obj)
"Returns the list of slot symbols for a structure/CLOS class
instance."
(mapcar #'c2mop:slot-definition-name
(c2mop:class-slots (class-of obj))))
(defun slot-keyword-names (obj)
(mapcar #'keywordify (slot-names obj)))
(defun slot-values (obj)
"Returns a list of the slot values in a structure/CLOS class
instance."
(let ((slot-names (slot-names obj)))
(mapcar (lambda (sym)
(slot-value obj sym))
slot-names)))
;;;; A clist is a list directly representing a CLOS class instance.
;;;; The first element is the class name of the object; the rest of
;;;; the list is a plist where each field symbol is the slot name and
;;;; each field value is the value of the slot. clists are convenient
;;;; for providing text-file storage of data.
(defun clist-type (clist)
"Returns the type symbol for the type of the object the clist
represents."
(first clist))
(defun clist-field-symbols (clist)
"Returns the field symbols for the object the clist represents."
(every-nth clist 2 1))
(defun clist-field-values (clist)
(every-nth clist 2 2))
(defun object->clist (obj)
"Returns a clist for the object obj. Supports structures/CLOS
classes, arbitrary cons structures, nested sequences of any structure;
all other objects are returned as-is."
(cond
((slot-names obj)
(cons (class-name (class-of obj))
(mapcan #'list
(slot-keyword-names obj)
(mapcar #'object->clist (slot-values obj)))))
((null obj)
nil)
((stringp obj)
obj)
((consp obj)
(cons (object->clist (car obj))
(object->clist (cdr obj))))
((sequencep obj)
(tensor-map #'object->clist obj))
(t obj)))
(defun object->plist (obj)
"Returns a plist for the object obj."
(rest (object->clist obj)))
(defun clist->object (clist)
"Currently only works for one-level-deep clists; needs to be fixed
to allow arbitrary depth."
(apply #'make-instance
(clist-type clist)
(mapcan #'list
(clist-field-symbols clist)
(clist-field-values clist))))
(defgeneric type-constructor (object)
(:documentation "Returns the function responsible for constructing
objects of the same type as the object. Default value is nil unless
a method is defined for an object/type.")
(:method (obj)
nil))
| 3,297 | Common Lisp | .lisp | 86 | 34.302326 | 70 | 0.686777 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 12fcdf1311b4a543a496c0202d26e9dfeabeb0fdf2c0e442750f27236b6846a3 | 1,610 | [
-1
] |
1,611 | package.lisp | ghollisjr_cl-ana/hash-table-utils/package.lisp | ;;;; cl-ana is a Common Lisp data analysis library.
;;;; Copyright 2013, 2014 Gary Hollis
;;;;
;;;; This file is part of cl-ana.
;;;;
;;;; cl-ana is free software: you can redistribute it and/or modify it
;;;; under the terms of the GNU General Public License as published by
;;;; the Free Software Foundation, either version 3 of the License, or
;;;; (at your option) any later version.
;;;;
;;;; cl-ana is distributed in the hope that it will be useful, but
;;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>.
;;;;
;;;; You may contact Gary Hollis (me!) via email at
;;;; [email protected]
(defpackage #:cl-ana.hash-table-utils
(:use :cl)
(:export :hash-table->alist
:hash-keys
:hash-values
:hmap
:alist->hash-table))
| 1,049 | Common Lisp | .lisp | 27 | 35.888889 | 70 | 0.680705 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 77d23e84231ecc209aa7fb3c72a24cbbfc73c90e2beda0c6b6804ff0adaf9edd | 1,611 | [
-1
] |
1,612 | hash-table-utils.lisp | ghollisjr_cl-ana/hash-table-utils/hash-table-utils.lisp | ;;;; cl-ana is a Common Lisp data analysis library.
;;;; Copyright 2013, 2014 Gary Hollis
;;;;
;;;; This file is part of cl-ana.
;;;;
;;;; cl-ana is free software: you can redistribute it and/or modify it
;;;; under the terms of the GNU General Public License as published by
;;;; the Free Software Foundation, either version 3 of the License, or
;;;; (at your option) any later version.
;;;;
;;;; cl-ana is distributed in the hope that it will be useful, but
;;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>.
;;;;
;;;; You may contact Gary Hollis (me!) via email at
;;;; [email protected]
(in-package :cl-ana.hash-table-utils)
(defun hash-table->alist (hash-table)
(loop
for k being the hash-keys of hash-table
for v being the hash-values of hash-table
collect (cons k v)))
(defun hash-keys (hash-table)
(mapcar #'car (hash-table->alist hash-table)))
(defun hash-values (hash-table)
(mapcar #'cdr (hash-table->alist hash-table)))
(defun hmap (fn hash-table)
"hmap is a more functional version of maphash; instead of returning
nil and relying on mutable state, hmap returns a new hash table with
the same keys but mapped values in the resulting hash table.
fn is a function which takes a key and value from hash-table and
returns an updated value for the resulting hash table."
(let ((result (make-hash-table
:test (hash-table-test hash-table))))
(maphash (lambda (k v)
(setf (gethash k result)
(funcall fn k v)))
hash-table)
result))
(defun alist->hash-table (alist &optional (test 'eql))
(let ((result (apply #'make-hash-table
(when test
(list :test test)))))
(loop
for (k . v) in alist
do (setf (gethash k result)
v))
result))
;; not sure if this is the same as the one alexandria provides
(defun copy-hash-table (ht)
"Returns a new copy of ht"
(let ((result (make-hash-table :test (hash-table-test ht))))
(maphash (lambda (k v)
(setf (gethash k result)
v))
ht)
result))
| 2,412 | Common Lisp | .lisp | 61 | 34.278689 | 70 | 0.654289 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | b2eeb54fb90330db1216bc2e334bb140964417d8c441c96ab8c9c0a0775d4bbc | 1,612 | [
-1
] |
1,613 | package.lisp | ghollisjr_cl-ana/table-utils/package.lisp | ;;;; cl-ana is a Common Lisp data analysis library.
;;;; Copyright 2013, 2014 Gary Hollis
;;;; Copyright 2019 Katherine Cox-Buday
;;;;
;;;; This file is part of cl-ana.
;;;;
;;;; cl-ana is free software: you can redistribute it and/or modify it
;;;; under the terms of the GNU General Public License as published by
;;;; the Free Software Foundation, either version 3 of the License, or
;;;; (at your option) any later version.
;;;;
;;;; cl-ana is distributed in the hope that it will be useful, but
;;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>.
;;;;
;;;; You may contact Gary Hollis (me!) via email at
;;;; [email protected]
(defpackage #:cl-ana.table-utils
(:use :cl
:cl-ana.symbol-utils
:cl-ana.string-utils
:cl-ana.table
:cl-ana.statistics
;; :cl-ana.generic-math
:cl-ana.symbol-utils
:cl-ana.string-utils
:cl-ana.hash-table-utils)
(:export :table->plists
:table-row->plist
:table-copy
:table-field-values
:table-summarize
:table-value-counts
:table-correlation-matrix
:table-subset))
(cl-ana.gmath:use-gmath :cl-ana.table-utils)
| 1,467 | Common Lisp | .lisp | 40 | 31.9 | 70 | 0.659649 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 9f89b5fa90a7e08ebccb5c31a08cc90cc630a55e788adf27214123e8da01c2a9 | 1,613 | [
-1
] |
1,614 | table-utils.lisp | ghollisjr_cl-ana/table-utils/table-utils.lisp | ;;;; cl-ana is a Common Lisp data analysis library.
;;;; Copyright 2013, 2014 Gary Hollis
;;;; Copyright 2019 Katherine Cox-Buday
;;;;
;;;; This file is part of cl-ana.
;;;;
;;;; cl-ana is free software: you can redistribute it and/or modify it
;;;; under the terms of the GNU General Public License as published by
;;;; the Free Software Foundation, either version 3 of the License, or
;;;; (at your option) any later version.
;;;;
;;;; cl-ana is distributed in the hope that it will be useful, but
;;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>.
;;;;
;;;; You may contact Gary Hollis (me!) via email at
;;;; [email protected]
(in-package :cl-ana.table-utils)
(defun table->plists (table &key
field-names
(reverse-p t))
"Returns a list of plists containing the field values you specify.
Only do this for tables that will reasonably fit into memory. If no
field-names are specified, then all fields will be present in the
result.
Note that the resulting plists will occur in the reverse order as they
occur in the table if reverse-p is NIL; this is not the default option
but is more efficient."
(when (not field-names)
(setf field-names
(table-field-names table)))
(let ((result
(table-reduce table field-names
(lambda (state &rest fields)
(push (loop
for fn in field-names
for f in fields
appending (list (keywordify (lispify fn))
f))
state))
:initial-value ())))
(if reverse-p
(nreverse result)
result)))
(defun table-row->plist (table field-names)
"Reads the current row from table and generates a plist containing
the field values of each field-name in the row."
(loop
for fn in field-names
appending (list (keywordify (lispify fn))
(table-get-field table fn))))
(defun table-copy (from to &optional fields)
"Reads all entries from from and writes them to to. If fields are
specified, only selected fields are used, otherwise all fields are
copied."
(let* ((field-names
(if fields
fields
(table-field-names from)))
(field-keysyms
(mapcar (lambda (x)
(keywordify
(lispify x)))
field-names)))
(do ((load-state (table-load-next-row from)
(table-load-next-row from)))
((null load-state) nil)
(loop
for k in field-keysyms
do (table-set-field to
k
(table-get-field from k)))
(table-commit-row to))))
(defgeneric table-field-values (table field)
(:documentation "Collects field values across all rows.")
(:method (table field)
(check-type table table)
(check-type field symbol)
(let ((field-vals (make-array 100 :adjustable t :fill-pointer 0)))
(do-table (rowidx table) ()
(vector-push-extend
(table-get-field table field)
field-vals 100))
(adjust-array field-vals (length field-vals)))))
(defun table-summarize (table)
"Summarizes information about a table."
(check-type table table)
(let* ((fields (table-field-names table))
(field-symbols (table-field-symbols table))
(max-col-len (reduce #'max (mapcar #'length fields))))
(with-output-to-string (summary)
(let ((non-null-from-field (make-hash-table :test #'equalp))
(row-count 0))
(do-table (row-index table) ()
(incf row-count)
(loop for field in fields
for field-sym in field-symbols
do (let* ((field-info (gethash field non-null-from-field (list)))
(field-val (table-get-field table field-sym))
(field-type (type-of field-val))
(field-type-friendly (cond
((stringp field-val)
'string)
((eq field-type 'null) nil)
(t field-type)))
(field-info-types (getf field-info :type)))
(when field-val (incf (getf field-info :populated-count 0)))
(when field-type-friendly
(setf (getf field-info :type)
(adjoin field-type-friendly field-info-types :test #'equalp)))
(setf (gethash field non-null-from-field) field-info))))
(format summary "RangeIndex: ~a entries, ~a to ~a~%" row-count -1 -1)
(format summary "Data columns (total ~a columns):~%" (length fields))
(let ((field-types (list)))
(loop for field in fields
for field-info = (gethash field non-null-from-field)
for field-info-types = (alexandria:flatten (getf field-info :type))
do (dolist (type field-info-types) (setf field-types (adjoin type field-types)))
(format summary (format nil "~~~aa ~~a populated ~~a~~%" max-col-len)
field (getf field-info :populated-count) (getf field-info :type)))
(format summary "types: ~a" field-types))))))
(defmacro table-value-counts (table field)
"Counts the number of values present in a table's field."
`(let ((count-from-val (make-hash-table :test #'equalp)))
(table-reduce
,table (list ,field)
(lambda (state field)
(incf (gethash field count-from-val 0))))
(hash-table->alist count-from-val)))
(defgeneric table-correlation-matrix (table)
(:documentation
"Builds a matrix of correlation coefficients between all fields.")
(:method (table)
(let* ((fields (table-field-symbols table))
;; Memoize calculations
(mean-from-field (make-hash-table :size (length fields)))
;; col -> col -> correlation coefficient
(correlation-matrix (list)))
(loop
for field-index from 0
for x-name in fields
for x-correlations = (assoc x-name correlation-matrix)
;; x without numerics
for x = (table-field-values table x-name)
do (when (every #'numberp x)
(loop
with x-hat = (or (gethash x-name mean-from-field)
(setf (gethash x-name mean-from-field)
(mean x)))
for field-index* from field-index
for y-name in fields
;; y without numerics
for y = (table-field-values table y-name)
do
(when (every #'numberp y)
(let* ((y-hat (or (gethash y-name mean-from-field)
(setf (gethash y-name mean-from-field)
(mean y))))
(correlation-coefficient
(or
(cdr (assoc x-name (cdr (assoc y-name correlation-matrix))))
(/ (- (sum (* x y))
(* (length x) x-hat y-hat))
(* (sqrt (- (sum (expt x 2))
(* (length x) (expt x-hat 2))))
(sqrt (- (sum (expt y 2))
(* (length y) (expt y-hat 2)))))))))
(setf x-correlations
(acons y-name correlation-coefficient x-correlations)))))
(setf correlation-matrix (acons x-name x-correlations correlation-matrix))))
correlation-matrix)))
(defun table-subset (table indexes)
"Returns a subset of a table as a plist."
(let ((field-symbols (table-field-symbols table))
(rows (list)))
(do-table (rowidx table) ()
(when (member rowidx indexes)
(setf
rows
(append
rows
(list
(loop
for field in field-symbols
nconc (list (keywordify (lispify field))
(table-get-field table field))))))
;; Only continue iterating over the table if there are more
;; indexes to pluck.
(when (>= (length rows) (length indexes))
(return-from table-subset rows))))
(error "didn't produce the expected number of rows: ~a not ~a"
(length rows) (length indexes))))
| 9,014 | Common Lisp | .lisp | 196 | 32.938776 | 96 | 0.542575 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 5a3649eefcdfbf1eb0878df5e2c19372a0f99b6bfcec1438600e70d6624b6bf0 | 1,614 | [
-1
] |
1,615 | package.lisp | ghollisjr_cl-ana/pathname-utils/package.lisp | (defpackage #:cl-ana.pathname-utils
(:use :cl)
(:export :pathname-absolute-p
:pathname-relative-p
:->absolute-pathname
:directory-pathname-p
:basename
:dirname
:mkdirpath
:subpath))
| 263 | Common Lisp | .lisp | 10 | 17.2 | 35 | 0.545455 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 0c59ca9c7df92167aa52dab38e2b3061dc1859936516df7f78c42e22ac1671bd | 1,615 | [
-1
] |
1,616 | pathname-utils.lisp | ghollisjr_cl-ana/pathname-utils/pathname-utils.lisp | ;;;; cl-ana is a Common Lisp data analysis library.
;;;; Copyright 2013, 2014 Gary Hollis
;;;;
;;;; This file is part of cl-ana.
;;;;
;;;; cl-ana is free software: you can redistribute it and/or modify it
;;;; under the terms of the GNU General Public License as published by
;;;; the Free Software Foundation, either version 3 of the License, or
;;;; (at your option) any later version.
;;;;
;;;; cl-ana is distributed in the hope that it will be useful, but
;;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>.
;;;;
;;;; You may contact Gary Hollis (me!) via email at
;;;; [email protected]
(in-package :cl-ana.pathname-utils)
(defun pathname-absolute-p (pathname-or-string)
(let* ((pathname (pathname pathname-or-string))
(directory (pathname-directory pathname)))
(when directory
(equal (first directory)
:absolute))))
(defun pathname-relative-p (pathname-or-string)
(not (pathname-absolute-p pathname-or-string)))
(defun ->absolute-pathname (pathname-or-string)
(let ((pathname (pathname pathname-or-string)))
(if (pathname-relative-p pathname)
;; handle relative
(merge-pathnames pathname)
pathname)))
(defun directory-pathname-p (pathname-or-string)
"Returns t iff pathname-or-string refers to a directory"
(string= (file-namestring (pathname pathname-or-string))
""))
(defun mkdirpath (pathname-or-string)
"Returns a path which always refers to a directory (platform
independent)"
(let ((pn (merge-pathnames pathname-or-string)))
(if (directory-pathname-p pn)
pn
(let ((dirname (directory-namestring pn))
(filename (file-namestring pn)))
(make-pathname :directory
(list :absolute
dirname
filename))))))
(defun basename (pathname)
"Returns basename of pathname; pathname-name strips the extension
while this utility function preserves it."
(let ((pathname (namestring pathname)))
(enough-namestring
pathname
(make-pathname :directory
(pathname-directory pathname)))))
(defun dirname (pathname)
"Returns directory name of pathname."
(namestring
(make-pathname
:directory (pathname-directory (pathname x)))))
(defun subpath (directory path-or-format-recipe &rest args)
"Returns namestring for a path under directory.
path-or-format-recipe can be a pathname directly, in which case the
rest of the arguments are unused. Or, it can be a format string which
when format is supplied with both the recipe and the rest of the
arguments should return a namestring for a valid pathname. In either
case, ensure-directories-exist will be called to ensure that the path
is ready for use.
If for whatever reason subpath is given an absolute pathname, it will
be returned as-is. If the result of a format processing a format
string and the rest of the arguments is an absolute pathname, this
will be returned."
(let ((*print-pretty* nil))
(let ((namestring
(namestring
(cond
((stringp path-or-format-recipe)
(subpath
directory
(pathname (apply #'format nil path-or-format-recipe args))))
((pathnamep path-or-format-recipe)
(if (pathname-absolute-p path-or-format-recipe)
path-or-format-recipe
(merge-pathnames path-or-format-recipe
(mkdirpath directory))))
(t (error "work-path accepts strings or pathnames only for first argument"))))))
(ensure-directories-exist namestring)
namestring)))
| 3,961 | Common Lisp | .lisp | 92 | 36.608696 | 94 | 0.674786 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 4137b7eed018dddc6cea04591bf6049237a8d56040f9bc1c616727f2388c5554 | 1,616 | [
-1
] |
1,617 | package.lisp | ghollisjr_cl-ana/plotting/package.lisp | ;;;; cl-ana is a Common Lisp data analysis library.
;;;; Copyright 2013, 2014 Gary Hollis
;;;;
;;;; This file is part of cl-ana.
;;;;
;;;; cl-ana is free software: you can redistribute it and/or modify it
;;;; under the terms of the GNU General Public License as published by
;;;; the Free Software Foundation, either version 3 of the License, or
;;;; (at your option) any later version.
;;;;
;;;; cl-ana is distributed in the hope that it will be useful, but
;;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>.
;;;;
;;;; You may contact Gary Hollis (me!) via email at
;;;; [email protected]
;;;; package.lisp
(defpackage #:cl-ana.plotting
(:use :cl
:cl-ana.pathname-utils
:cl-ana.math-functions
:cl-ana.functional-utils
:cl-ana.error-propogation
:cl-ana.gnuplot-interface
:cl-ana.map
:cl-ana.string-utils
:cl-ana.list-utils
:cl-ana.macro-utils
:cl-ana.histogram
:cl-ana.tensor)
(:export :*gnuplot-sessions*
:*gnuplot-single-session*
:*gnuplot-file-io*
:restart-gnuplot-sessions
:titled
:title
:page
:plot
:plot2d
:plot3d
:label
:line
:data-line
:analytic-line
:legend
:grid
:generate-cmd
;; page functions
:draw
:draw-pdf
:page-next-id
:page-id
:page-gnuplot-session
:page-shown-title
:page-default-dimensions
:page-dimensions
:page-scale
:page-plots
:page-layout
:page-type
:page-terminal
:page-output
:page-add-plot
;; plot functions
:plot-lines
:plot-legend
:plot-grid
:plot-add-line
:plot2d-x-range
:plot2d-y-range
:tics
:merge-tics
;; 3d plot functions
:pm3d
;; line functions
:line-style
:line-line-style
:line-point-type
:line-line-type
:line-line-width
:line-fill-style
:line-fill-density
:line-color
:line-plot-arg
:line-options
;; data-line functions
:data-line-data
;; analytic-line functions
:analytic-line-fn-string
;; legend functions
:legend-contents
:legend-update-strategy
:legend-update
;; utilities:
:sample-function
;; plot merging:
:plotjoin!
:pagemerge!
:pagejoin!
;; terminal settings:
:wxt-term
:png-term
:pngcairo-term
:jpeg-term
:ps-term
:eps-term
:pdf-term
:epslatex-term
:qt-term
:canvas-term))
(cl-ana.gmath:use-gmath :cl-ana.plotting)
| 3,270 | Common Lisp | .lisp | 115 | 19.365217 | 70 | 0.542658 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | c7c06e36ee616354c3e262d861831398b544af520b188471d20204a1f9548546 | 1,617 | [
-1
] |
1,618 | test.lisp | ghollisjr_cl-ana/plotting/test.lisp | ;;;; cl-ana is a Common Lisp data analysis library.
;;;; Copyright 2013, 2014 Gary Hollis
;;;;
;;;; This file is part of cl-ana.
;;;;
;;;; cl-ana is free software: you can redistribute it and/or modify it
;;;; under the terms of the GNU General Public License as published by
;;;; the Free Software Foundation, either version 3 of the License, or
;;;; (at your option) any later version.
;;;;
;;;; cl-ana is distributed in the hope that it will be useful, but
;;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>.
;;;;
;;;; You may contact Gary Hollis (me!) via email at
;;;; [email protected]
(require 'cl-ana.plotting)
(require 'cl-ana.fitting)
(require 'alexandria)
(in-package :cl-ana.plotting)
(use-package :cl-ana.fitting)
;; Long example of how to use raw types for structure:
(defparameter *page*
(make-instance
'page
:title "Just a couple plots"
:layout (cons 1 2)
:dimensions (cons 1300 600)
:scale (cons 1 1)
:plots
(list (make-instance
'plot2d
:title "Plot 1"
:x-range (cons -1 1)
:y-range (cons -2 2)
:lines
(list (make-instance
'analytic-line
:title "Sine function"
:fn-string "sin(x)"
:color "blue")
(make-instance
'analytic-line
:title "Cosine function"
:fn-string "cos(x)")))
(make-instance
'plot2d
:title "Plot 2"
:lines
(list (make-instance
'data-line
:title "Some data"
:style "points"
:data (list (cons 1 1)
(cons 2 2)
(cons 3 3)
(cons 4 4))))))))
(draw *page*)
;; Quick example of how to draw a single plot with a function and some
;; data:
(defparameter *quick-page*
(draw (list (line (zip (list 1 1.5 2 2.5 3)
(list 0.9 1.2 1 0.3 0.1))
:title "test data"
:point-type 3)
(line "sin(x)" :title "sine"))
:page-args '(:title "Test plot")
:plot-args '(:title "Test plot")))
(defparameter *hist2d*
(make-chist
(list (list :name "x" :nbins 100 :low -3d0 :high 3d0)
(list :name "y" :nbins 100 :low -3d0 :high 3d0))))
(defun gaus ()
(alexandria:gaussian-random -3d0 3d0))
(loop
for i below 100000
do (hist-insert *hist2d*
(list (gaus) (gaus))))
(draw *hist2d*)
(defparameter *hist1d*
(hist-project *hist2d* "x"))
(defparameter *fit-results*
(multiple-value-list
(fit *hist1d*
#'gaussian
(list 1500d0 1d0 1d0)
:max-iterations 25
:prec 1e-8
:derivative-delta 1e-12)))
(defparameter *fitfunc* (first *fit-results*))
(draw
(list (list *hist1d*
:title "Data Histogram"
:fill-style "empty"
;;:fill-density 0.1
:color "black")
(list *fitfunc*
:title "Fitted Gaussian"
:color "red"))
:plot-args '(:x-title "x"
:y-title "N"))
(defun pm3d-test ()
(draw
(page (list
(plot3d (list
(line (sample-function (lambda (xs)
(sin (sum xs)))
(list 0 0)
(list pi pi)
(list 100 100))
:style "pm3d"
:pm3d-ncols 100))
:colorbox-p t
:pm3d (pm3d :interpolate (cons 0 0))
:view :map
:x-range (cons 0 pi)
:y-range (cons 0 pi)
:legend (legend :front-p t))))))
(defun vhist-1d-test ()
(let ((hist (make-vhist '(("x" -0.5d0 0d0 1d0 1.5d0 2d0)))))
(loop
for i below 1000
do
(hins hist (list (alexandria:gaussian-random -3d0 3d0))))
(draw
(page (list
(plot2d (list
(line hist
:style "points"
:point-size 2))))))))
(defun vhist-2d-test ()
(let ((hist (make-vhist '(("x" -0.5d0 0d0 1d0 1.5d0 2d0)
("y" -0.5d0 0d0 0.5d0 1d0 1.5d0 2d0)))))
(loop
for i below 1000
do
(hins hist (list (alexandria:gaussian-random -3d0 3d0)
(alexandria:gaussian-random -3d0 3d0))))
(draw
(page (list
(plot3d (list
(line hist
:style "points"
:point-size 2))
:view "map"))))))
(defun vhist-pm3d-test ()
(let ((hist (make-vhist '(("x" -0.5d0 0d0 1d0 1.5d0 2d0)
("y" -0.5d0 0d0 0.5d0 1d0 1.5d0 2d0)
))))
(loop
for i below 1000
do
(hins hist (list (alexandria:gaussian-random -3d0 3d0)
(alexandria:gaussian-random -3d0 3d0))))
(draw
(page (list
(plot3d (list
(line hist))
:pm3d (pm3d :interpolate (cons 1 1)
:corners2color :c1)
:colorbox-p t
:view :map))))))
| 5,630 | Common Lisp | .lisp | 166 | 23.006024 | 70 | 0.494489 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 06455a1c7cdb215bd7fcc2f6a92d0ac365e5b0aa739068895baf43fdd989856c | 1,618 | [
-1
] |
1,619 | symbol-utils.lisp | ghollisjr_cl-ana/symbol-utils/symbol-utils.lisp | ;;;; cl-ana is a Common Lisp data analysis library.
;;;; Copyright 2013, 2014 Gary Hollis
;;;;
;;;; This file is part of cl-ana.
;;;;
;;;; cl-ana is free software: you can redistribute it and/or modify it
;;;; under the terms of the GNU General Public License as published by
;;;; the Free Software Foundation, either version 3 of the License, or
;;;; (at your option) any later version.
;;;;
;;;; cl-ana is distributed in the hope that it will be useful, but
;;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>.
;;;;
;;;; You may contact Gary Hollis (me!) via email at
;;;; [email protected]
(in-package :cl-ana.symbol-utils)
(defun keywordify (symbol-or-string)
"Returns the keyword version of a symbol or string."
(intern
(string symbol-or-string)
(package-name :keyword)))
(defun keysymb (args)
"Returns a keyword symbol formed by symbol versions of each element
in args interspersed with hyphens (-)."
(intern
(apply #'concatenate 'string
(intersperse "-"
(mapcar #'string args)))
:keyword))
(defmacro keysymbq (&rest args)
"Convenient macro for using keysymb; quotes the list of args and
passes it to keysymb."
`(keysymb (quote ,args)))
| 1,483 | Common Lisp | .lisp | 38 | 36.315789 | 70 | 0.705066 | ghollisjr/cl-ana | 196 | 18 | 8 | GPL-3.0 | 9/19/2024, 11:25:22 AM (Europe/Amsterdam) | 236e23d37ebade5cedcf32042a6a2beb822efc1a28f31f994fd080b288f0fbef | 1,619 | [
-1
] |