diff options
author | Oscar Najera <hi@oscarnajera.com> | 2025-05-16 07:32:47 +0200 |
---|---|---|
committer | Oscar Najera <hi@oscarnajera.com> | 2025-05-16 07:32:47 +0200 |
commit | 790f89e9687a5e291cf26a5a85bff871a46e675e (patch) | |
tree | 4c4b98410056bd56d46dea2f7655766a39396f7f /lib/guile/mail-tools.scm | |
parent | cb3ab9a4b8b59226bc36d1240de77ee20f1e0760 (diff) | |
download | dotfiles-790f89e9687a5e291cf26a5a85bff871a46e675e.tar.gz dotfiles-790f89e9687a5e291cf26a5a85bff871a46e675e.tar.bz2 dotfiles-790f89e9687a5e291cf26a5a85bff871a46e675e.zip |
Update guile notmuch to nyacc 2
Now using cdata and discarding bytestructures and ffi-help-rt.
New constructor for types and how to access pointers or create more.
Not so clearly from documentation, but trying and scanning nyacc
examples kind of worked.
Diffstat (limited to 'lib/guile/mail-tools.scm')
-rw-r--r-- | lib/guile/mail-tools.scm | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/guile/mail-tools.scm b/lib/guile/mail-tools.scm index 1186306..37c9ecf 100644 --- a/lib/guile/mail-tools.scm +++ b/lib/guile/mail-tools.scm @@ -3,8 +3,8 @@ #:use-module (ice-9 rdelim) #:use-module (ice-9 regex) #:use-module (srfi srfi-1) - #:use-module (system ffi-help-rt) #:use-module (system foreign) + #:use-module (nyacc foreign cdata) #:export (rename-higher get-uidvalidity get-folder-uidvalidity @@ -51,8 +51,8 @@ ;; NOTMUCH interface (define (nm-open-database path mode) - (let ((ffi-db (make-notmuch_database_t*))) - (notmuch_database_open (string->pointer path) mode (pointer-to ffi-db)) + (let ((ffi-db (make-cdata notmuch_database_t*))) + (notmuch_database_open (string->pointer path) mode (cdata& ffi-db)) ffi-db)) (define (nm-query-db db str) @@ -63,17 +63,17 @@ query)) (define (nm-result-messages query) - (let ((messages (make-notmuch_messages_t*))) - (notmuch_query_search_messages query (pointer-to messages)) + (let ((messages (make-cdata notmuch_messages_t*))) + (notmuch_query_search_messages query (cdata& messages)) messages)) (define (nm-header message label) (pointer->string (notmuch_message_get_header message (string->pointer label)))) (define (nm-count-messages query) - (let ((counter (make-int32))) - (notmuch_query_count_messages query (pointer-to counter)) - (fh-object-ref counter))) + (let ((counter (make-cdata (cbase 'unsigned-int)))) + (notmuch_query_count_messages query (cdata& counter)) + (cdata-ref counter))) (eval-when (expand load eval) (define (stx->str stx) (symbol->string (syntax->datum stx))) |