From 790f89e9687a5e291cf26a5a85bff871a46e675e Mon Sep 17 00:00:00 2001 From: Oscar Najera Date: Fri, 16 May 2025 07:32:47 +0200 Subject: 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. --- lib/guile/mail-tools.scm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lib/guile/mail-tools.scm') 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))) -- cgit v1.2.3