Coverage report: /development/source/library/com/dydra/gitlab/dydra-cgi/ffi/lisp/rdfcache/library.lisp
| Kind | Covered | All | % |
| expression | 30 | 85 | 35.3 |
| branch | 2 | 10 | 20.0 |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
5
(defvar *encoding* :utf-8
6
"Triple term encoding.")
8
(defvar *wildcard-term-pointer* (null-pointer)
11
(defvar *wildcard-term-number* 0
12
"The term number designating a wildcard term.")
16
(defvar *default-context-pointer* t
17
"The default context.")
18
(defvar *default-context-id* nil
19
"The default context identifier.")
24
(setf *default-context-pointer* %default-context-pointer)
25
(setf *default-context-id* %default-context-id)
28
(defvar *all-context-number* 0
29
"The term number designating the context which comprises all graphs,
32
(defvar *default-context-number* -1
33
"The term number designating the default context.")
35
(defvar *named-context-number* -2
36
"The term number designating the context which comprises all named graphs.")
38
(defvar *default-timeout* -1 ;; milliseconds, or -1 for blocking
39
"The default operation timeout.")
43
(with-checked-pointer (ptr) ptr)
44
(cl:error "~A is not a pointer." ptr)))
48
(defun getenv (variable-name &optional default-value)
49
(or #+sbcl (sb-unix::posix-getenv variable-name)
50
#+lispworks (lispworks:environment-variable variable-name)
51
#+ecl (si:getenv variable-name)
54
(defun getenvp (variable-name &optional (default-value ""))
55
(not (zerop (length (getenv variable-name default-value)))))
57
(defun load-library (&key path version debug features)
58
"Loads the libspocq native library. Must be called before invoking any
59
foreign functions in the library."
60
(declare (type boolean debug)
62
;; Load the SPOCQ FFI shared library:
63
(spocq-ffi:load-library :path path)
64
;; Load the Dydra NDK shared library:
65
(dydra-ndk:load-library :path path)
66
;; Ensure all structure sizes match in the libspocq ABI:
67
(dolist (type '(term triple quad transaction cursor))
68
(let ((ffi-size (foreign-type-size (list :struct type)))
69
(lib-size (%%sizeof (intern (string type) :keyword))))
70
(unless (eql ffi-size lib-size)
71
(incompatible-abi-structure type ffi-size lib-size))))
72
;; Optionally, ensure that the libspocq version string matches:
74
; (let ((ffi-version (string version))
75
; (lib-version (version)))
76
; (when (not (equal lib-version ffi-version))
77
; (mismatched-version ffi-version lib-version))))
78
;; Optionally, ensure that the libspocq feature set matches:
80
(dolist (feature features)
81
(unless (%%has-feature (if (keywordp feature)
82
(keyword->string feature)
84
(missing-feature feature))))
85
(values)) ;; no meaningful return value
87
(defun unload-library ()
88
"Unloads the libspocq native library."
89
;; Unload the Dydra NDK shared library:
90
(dydra-ndk:unload-library)
91
;; Unload the SPOCQ FFI shared library:
92
(spocq-ffi:unload-library)
93
(values)) ;; no meaningful return value
98
"Returns the list of available RDFcache features."
99
(let* ((features (list))
100
(*current-callback* (lambda (s) (push (string->keyword s) features) t)))
101
(declare (special *current-callback*))
102
(%%each-feature (callback string-callback))
106
"Returns the list of available RDFcache modules. See RDFCACHE:TRACE-MODULE."
107
(let* ((modules (list))
108
(*current-callback* (lambda (s) (push (string->keyword s) modules) t)))
109
(declare (special *current-callback*))
110
(%%each-module (callback string-callback))