From 7ed04b079df07d77ab22a46e2cb9e505402fe59c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20N=C3=A1jera?= Date: Mon, 28 Nov 2022 17:50:11 +0100 Subject: Update notmuch guile bindings Use a makefile to remember how to do it --- lib/guile/ffi/notmuch.ffi | 5 +- lib/guile/ffi/notmuch.scm | 661 ++++++++++++++++++++++++++++++++++++++++++---- lib/guile/makefile | 16 ++ 3 files changed, 623 insertions(+), 59 deletions(-) create mode 100644 lib/guile/makefile (limited to 'lib/guile') diff --git a/lib/guile/ffi/notmuch.ffi b/lib/guile/ffi/notmuch.ffi index 1f8bfce..e404510 100644 --- a/lib/guile/ffi/notmuch.ffi +++ b/lib/guile/ffi/notmuch.ffi @@ -1,4 +1,5 @@ +;; -*- mode: scheme; -*- (define-ffi-module (ffi notmuch) - ; #:pkg-config "notmuch" - #:library '("libnotmuch") + ;; #:pkg-config "notmuch" + #:library '("libnotmuch") #:include '("notmuch.h")) diff --git a/lib/guile/ffi/notmuch.scm b/lib/guile/ffi/notmuch.scm index 42c3ab3..4c02592 100644 --- a/lib/guile/ffi/notmuch.scm +++ b/lib/guile/ffi/notmuch.scm @@ -8,17 +8,11 @@ (define ffi-notmuch-llibs (delay (list (dynamic-link "libnotmuch")))) -(cond-expand - (guile-2.2) - (guile-2 - (define intptr_t long) - (define uintptr_t unsigned-long))) - ;; typedef int notmuch_bool_t; (define-public notmuch_bool_t-desc int) -;; typedef enum _notmuch_status { +;; typedef enum { ;; NOTMUCH_STATUS_SUCCESS = 0, ;; NOTMUCH_STATUS_OUT_OF_MEMORY, ;; NOTMUCH_STATUS_READ_ONLY_DATABASE, @@ -38,6 +32,12 @@ ;; NOTMUCH_STATUS_MALFORMED_CRYPTO_PROTOCOL, ;; NOTMUCH_STATUS_FAILED_CRYPTO_CONTEXT_CREATION, ;; NOTMUCH_STATUS_UNKNOWN_CRYPTO_PROTOCOL, +;; NOTMUCH_STATUS_NO_CONFIG, +;; NOTMUCH_STATUS_NO_DATABASE, +;; NOTMUCH_STATUS_DATABASE_EXISTS, +;; NOTMUCH_STATUS_BAD_QUERY_SYNTAX, +;; NOTMUCH_STATUS_NO_MAIL_ROOT, +;; NOTMUCH_STATUS_CLOSED_DATABASE, ;; NOTMUCH_STATUS_LAST_STATUS, ;; } notmuch_status_t; (define notmuch_status_t-enum-nvl @@ -62,7 +62,13 @@ . 17) (NOTMUCH_STATUS_UNKNOWN_CRYPTO_PROTOCOL . 18) - (NOTMUCH_STATUS_LAST_STATUS . 19)) + (NOTMUCH_STATUS_NO_CONFIG . 19) + (NOTMUCH_STATUS_NO_DATABASE . 20) + (NOTMUCH_STATUS_DATABASE_EXISTS . 21) + (NOTMUCH_STATUS_BAD_QUERY_SYNTAX . 22) + (NOTMUCH_STATUS_NO_MAIL_ROOT . 23) + (NOTMUCH_STATUS_CLOSED_DATABASE . 24) + (NOTMUCH_STATUS_LAST_STATUS . 25)) ) (define notmuch_status_t-enum-vnl (map (lambda (pair) (cons (cdr pair) (car pair))) @@ -75,31 +81,6 @@ (else (error "bad arg")))) (define-public (wrap-notmuch_status_t v) (assq-ref notmuch_status_t-enum-vnl v)) -(define-public unwrap-enum-_notmuch_status unwrap-notmuch_status_t) -(define-public wrap-enum-_notmuch_status wrap-notmuch_status_t) - -;; enum _notmuch_status { -;; NOTMUCH_STATUS_SUCCESS = 0, -;; NOTMUCH_STATUS_OUT_OF_MEMORY, -;; NOTMUCH_STATUS_READ_ONLY_DATABASE, -;; NOTMUCH_STATUS_XAPIAN_EXCEPTION, -;; NOTMUCH_STATUS_FILE_ERROR, -;; NOTMUCH_STATUS_FILE_NOT_EMAIL, -;; NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID, -;; NOTMUCH_STATUS_NULL_POINTER, -;; NOTMUCH_STATUS_TAG_TOO_LONG, -;; NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW, -;; NOTMUCH_STATUS_UNBALANCED_ATOMIC, -;; NOTMUCH_STATUS_UNSUPPORTED_OPERATION, -;; NOTMUCH_STATUS_UPGRADE_REQUIRED, -;; NOTMUCH_STATUS_PATH_ERROR, -;; NOTMUCH_STATUS_IGNORED, -;; NOTMUCH_STATUS_ILLEGAL_ARGUMENT, -;; NOTMUCH_STATUS_MALFORMED_CRYPTO_PROTOCOL, -;; NOTMUCH_STATUS_FAILED_CRYPTO_CONTEXT_CREATION, -;; NOTMUCH_STATUS_UNKNOWN_CRYPTO_PROTOCOL, -;; NOTMUCH_STATUS_LAST_STATUS, -;; }; ;; const char *notmuch_status_to_string(notmuch_status_t status); (define notmuch_status_to_string @@ -215,6 +196,28 @@ (export notmuch_config_list_t* notmuch_config_list_t*? make-notmuch_config_list_t*) +;; typedef struct _notmuch_config_values notmuch_config_values_t; +(define-public notmuch_config_values_t-desc 'void) +(define-fh-type-alias notmuch_config_values_t fh-void) +(define-public notmuch_config_values_t? fh-void?) +(define-public make-notmuch_config_values_t make-fh-void) +(define-public notmuch_config_values_t*-desc (fh:pointer notmuch_config_values_t-desc)) +(define-fh-pointer-type notmuch_config_values_t* notmuch_config_values_t*-desc + notmuch_config_values_t*? make-notmuch_config_values_t*) +(export notmuch_config_values_t* notmuch_config_values_t*? + make-notmuch_config_values_t*) + +;; typedef struct _notmuch_config_pairs notmuch_config_pairs_t; +(define-public notmuch_config_pairs_t-desc 'void) +(define-fh-type-alias notmuch_config_pairs_t fh-void) +(define-public notmuch_config_pairs_t? fh-void?) +(define-public make-notmuch_config_pairs_t make-fh-void) +(define-public notmuch_config_pairs_t*-desc (fh:pointer notmuch_config_pairs_t-desc)) +(define-fh-pointer-type notmuch_config_pairs_t* notmuch_config_pairs_t*-desc + notmuch_config_pairs_t*? make-notmuch_config_pairs_t*) +(export notmuch_config_pairs_t* notmuch_config_pairs_t*? + make-notmuch_config_pairs_t*) + ;; typedef struct _notmuch_indexopts notmuch_indexopts_t; (define-public notmuch_indexopts_t-desc 'void) (define-fh-type-alias notmuch_indexopts_t fh-void) @@ -326,6 +329,109 @@ ~error_message)))))) (export notmuch_database_open_verbose) +;; notmuch_status_t notmuch_database_open_with_config(const char *database_path +;; , notmuch_database_mode_t mode, const char *config_path, const char * +;; profile, notmuch_database_t **database, char **error_message); +(define notmuch_database_open_with_config + (let ((~notmuch_database_open_with_config + (delay (fh-link-proc + ffi:int + "notmuch_database_open_with_config" + (list ffi-void* + ffi:int + ffi-void* + ffi-void* + ffi-void* + ffi-void*) + (force ffi-notmuch-llibs))))) + (lambda (database_path + mode + config_path + profile + database + error_message) + (let ((~database_path (unwrap~pointer database_path)) + (~mode (unwrap-notmuch_database_mode_t mode)) + (~config_path (unwrap~pointer config_path)) + (~profile (unwrap~pointer profile)) + (~database (unwrap~pointer database)) + (~error_message (unwrap~pointer error_message))) + (wrap-notmuch_status_t + ((force ~notmuch_database_open_with_config) + ~database_path + ~mode + ~config_path + ~profile + ~database + ~error_message)))))) +(export notmuch_database_open_with_config) + +;; notmuch_status_t notmuch_database_load_config(const char *database_path, +;; const char *config_path, const char *profile, notmuch_database_t ** +;; database, char **error_message); +(define notmuch_database_load_config + (let ((~notmuch_database_load_config + (delay (fh-link-proc + ffi:int + "notmuch_database_load_config" + (list ffi-void* + ffi-void* + ffi-void* + ffi-void* + ffi-void*) + (force ffi-notmuch-llibs))))) + (lambda (database_path + config_path + profile + database + error_message) + (let ((~database_path (unwrap~pointer database_path)) + (~config_path (unwrap~pointer config_path)) + (~profile (unwrap~pointer profile)) + (~database (unwrap~pointer database)) + (~error_message (unwrap~pointer error_message))) + (wrap-notmuch_status_t + ((force ~notmuch_database_load_config) + ~database_path + ~config_path + ~profile + ~database + ~error_message)))))) +(export notmuch_database_load_config) + +;; notmuch_status_t notmuch_database_create_with_config(const char * +;; database_path, const char *config_path, const char *profile, +;; notmuch_database_t **database, char **error_message); +(define notmuch_database_create_with_config + (let ((~notmuch_database_create_with_config + (delay (fh-link-proc + ffi:int + "notmuch_database_create_with_config" + (list ffi-void* + ffi-void* + ffi-void* + ffi-void* + ffi-void*) + (force ffi-notmuch-llibs))))) + (lambda (database_path + config_path + profile + database + error_message) + (let ((~database_path (unwrap~pointer database_path)) + (~config_path (unwrap~pointer config_path)) + (~profile (unwrap~pointer profile)) + (~database (unwrap~pointer database)) + (~error_message (unwrap~pointer error_message))) + (wrap-notmuch_status_t + ((force ~notmuch_database_create_with_config) + ~database_path + ~config_path + ~profile + ~database + ~error_message)))))) +(export notmuch_database_create_with_config) + ;; const char *notmuch_database_status_string(const notmuch_database_t *notmuch ;; ); (define notmuch_database_status_string @@ -397,6 +503,32 @@ ~closure)))))) (export notmuch_database_compact) +;; notmuch_status_t notmuch_database_compact_db(notmuch_database_t *database, +;; const char *backup_path, notmuch_compact_status_cb_t status_cb, void * +;; closure); +(define notmuch_database_compact_db + (let ((~notmuch_database_compact_db + (delay (fh-link-proc + ffi:int + "notmuch_database_compact_db" + (list ffi-void* ffi-void* ffi-void* ffi-void*) + (force ffi-notmuch-llibs))))) + (lambda (database backup_path status_cb closure) + (let ((~database + ((fht-unwrap notmuch_database_t*) database)) + (~backup_path (unwrap~pointer backup_path)) + (~status_cb + ((fht-unwrap notmuch_compact_status_cb_t) + status_cb)) + (~closure (unwrap~pointer closure))) + (wrap-notmuch_status_t + ((force ~notmuch_database_compact_db) + ~database + ~backup_path + ~status_cb + ~closure)))))) +(export notmuch_database_compact_db) + ;; notmuch_status_t notmuch_database_destroy(notmuch_database_t *database); (define notmuch_database_destroy (let ((~notmuch_database_destroy @@ -673,6 +805,22 @@ ((force ~notmuch_database_get_all_tags) ~db)))))) (export notmuch_database_get_all_tags) +;; notmuch_status_t notmuch_database_reopen(notmuch_database_t *db, +;; notmuch_database_mode_t mode); +(define notmuch_database_reopen + (let ((~notmuch_database_reopen + (delay (fh-link-proc + ffi:int + "notmuch_database_reopen" + (list ffi-void* ffi:int) + (force ffi-notmuch-llibs))))) + (lambda (db mode) + (let ((~db ((fht-unwrap notmuch_database_t*) db)) + (~mode (unwrap-notmuch_database_mode_t mode))) + (wrap-notmuch_status_t + ((force ~notmuch_database_reopen) ~db ~mode)))))) +(export notmuch_database_reopen) + ;; notmuch_query_t *notmuch_query_create(notmuch_database_t *database, const ;; char *query_string); (define notmuch_query_create @@ -692,6 +840,50 @@ ~query_string)))))) (export notmuch_query_create) +;; typedef enum { +;; NOTMUCH_QUERY_SYNTAX_XAPIAN, +;; NOTMUCH_QUERY_SYNTAX_SEXP, +;; } notmuch_query_syntax_t; +(define notmuch_query_syntax_t-enum-nvl + '((NOTMUCH_QUERY_SYNTAX_XAPIAN . 0) + (NOTMUCH_QUERY_SYNTAX_SEXP . 1)) + ) +(define notmuch_query_syntax_t-enum-vnl + (map (lambda (pair) (cons (cdr pair) (car pair))) + notmuch_query_syntax_t-enum-nvl)) +(define-public (unwrap-notmuch_query_syntax_t n) + (cond + ((symbol? n) + (or (assq-ref notmuch_query_syntax_t-enum-nvl n) (error "bad arg"))) + ((integer? n) n) + (else (error "bad arg")))) +(define-public (wrap-notmuch_query_syntax_t v) + (assq-ref notmuch_query_syntax_t-enum-vnl v)) + +;; notmuch_status_t notmuch_query_create_with_syntax(notmuch_database_t * +;; database, const char *query_string, notmuch_query_syntax_t syntax, +;; notmuch_query_t **output); +(define notmuch_query_create_with_syntax + (let ((~notmuch_query_create_with_syntax + (delay (fh-link-proc + ffi:int + "notmuch_query_create_with_syntax" + (list ffi-void* ffi-void* ffi:int ffi-void*) + (force ffi-notmuch-llibs))))) + (lambda (database query_string syntax output) + (let ((~database + ((fht-unwrap notmuch_database_t*) database)) + (~query_string (unwrap~pointer query_string)) + (~syntax (unwrap-notmuch_query_syntax_t syntax)) + (~output (unwrap~pointer output))) + (wrap-notmuch_status_t + ((force ~notmuch_query_create_with_syntax) + ~database + ~query_string + ~syntax + ~output)))))) +(export notmuch_query_create_with_syntax) + ;; typedef enum { ;; NOTMUCH_SORT_OLDEST_FIRST, ;; NOTMUCH_SORT_NEWEST_FIRST, @@ -1409,7 +1601,7 @@ ~indexopts)))))) (export notmuch_message_reindex) -;; typedef enum _notmuch_message_flag { +;; typedef enum { ;; NOTMUCH_MESSAGE_FLAG_MATCH, ;; NOTMUCH_MESSAGE_FLAG_EXCLUDED, ;; NOTMUCH_MESSAGE_FLAG_GHOST, @@ -1430,14 +1622,6 @@ (else (error "bad arg")))) (define-public (wrap-notmuch_message_flag_t v) (assq-ref notmuch_message_flag_t-enum-vnl v)) -(define-public unwrap-enum-_notmuch_message_flag unwrap-notmuch_message_flag_t) -(define-public wrap-enum-_notmuch_message_flag wrap-notmuch_message_flag_t) - -;; enum _notmuch_message_flag { -;; NOTMUCH_MESSAGE_FLAG_MATCH, -;; NOTMUCH_MESSAGE_FLAG_EXCLUDED, -;; NOTMUCH_MESSAGE_FLAG_GHOST, -;; }; ;; notmuch_bool_t notmuch_message_get_flag(notmuch_message_t *message, ;; notmuch_message_flag_t flag); @@ -2293,6 +2477,321 @@ ~config_list))))) (export notmuch_config_list_destroy) +;; typedef enum { +;; NOTMUCH_CONFIG_FIRST, +;; NOTMUCH_CONFIG_DATABASE_PATH = NOTMUCH_CONFIG_FIRST, +;; NOTMUCH_CONFIG_MAIL_ROOT, +;; NOTMUCH_CONFIG_HOOK_DIR, +;; NOTMUCH_CONFIG_BACKUP_DIR, +;; NOTMUCH_CONFIG_EXCLUDE_TAGS, +;; NOTMUCH_CONFIG_NEW_TAGS, +;; NOTMUCH_CONFIG_NEW_IGNORE, +;; NOTMUCH_CONFIG_SYNC_MAILDIR_FLAGS, +;; NOTMUCH_CONFIG_PRIMARY_EMAIL, +;; NOTMUCH_CONFIG_OTHER_EMAIL, +;; NOTMUCH_CONFIG_USER_NAME, +;; NOTMUCH_CONFIG_AUTOCOMMIT, +;; NOTMUCH_CONFIG_EXTRA_HEADERS, +;; NOTMUCH_CONFIG_LAST, +;; } notmuch_config_key_t; +(define notmuch_config_key_t-enum-nvl + '((NOTMUCH_CONFIG_FIRST . 0) + (NOTMUCH_CONFIG_DATABASE_PATH . 0) + (NOTMUCH_CONFIG_MAIL_ROOT . 1) + (NOTMUCH_CONFIG_HOOK_DIR . 2) + (NOTMUCH_CONFIG_BACKUP_DIR . 3) + (NOTMUCH_CONFIG_EXCLUDE_TAGS . 4) + (NOTMUCH_CONFIG_NEW_TAGS . 5) + (NOTMUCH_CONFIG_NEW_IGNORE . 6) + (NOTMUCH_CONFIG_SYNC_MAILDIR_FLAGS . 7) + (NOTMUCH_CONFIG_PRIMARY_EMAIL . 8) + (NOTMUCH_CONFIG_OTHER_EMAIL . 9) + (NOTMUCH_CONFIG_USER_NAME . 10) + (NOTMUCH_CONFIG_AUTOCOMMIT . 11) + (NOTMUCH_CONFIG_EXTRA_HEADERS . 12) + (NOTMUCH_CONFIG_LAST . 13)) + ) +(define notmuch_config_key_t-enum-vnl + (map (lambda (pair) (cons (cdr pair) (car pair))) + notmuch_config_key_t-enum-nvl)) +(define-public (unwrap-notmuch_config_key_t n) + (cond + ((symbol? n) + (or (assq-ref notmuch_config_key_t-enum-nvl n) (error "bad arg"))) + ((integer? n) n) + (else (error "bad arg")))) +(define-public (wrap-notmuch_config_key_t v) + (assq-ref notmuch_config_key_t-enum-vnl v)) + +;; const char *notmuch_config_get(notmuch_database_t *notmuch, +;; notmuch_config_key_t key); +(define notmuch_config_get + (let ((~notmuch_config_get + (delay (fh-link-proc + ffi-void* + "notmuch_config_get" + (list ffi-void* ffi:int) + (force ffi-notmuch-llibs))))) + (lambda (notmuch key) + (let ((~notmuch + ((fht-unwrap notmuch_database_t*) notmuch)) + (~key (unwrap-notmuch_config_key_t key))) + ((force ~notmuch_config_get) ~notmuch ~key))))) +(export notmuch_config_get) + +;; notmuch_status_t notmuch_config_set(notmuch_database_t *notmuch, +;; notmuch_config_key_t key, const char *val); +(define notmuch_config_set + (let ((~notmuch_config_set + (delay (fh-link-proc + ffi:int + "notmuch_config_set" + (list ffi-void* ffi:int ffi-void*) + (force ffi-notmuch-llibs))))) + (lambda (notmuch key val) + (let ((~notmuch + ((fht-unwrap notmuch_database_t*) notmuch)) + (~key (unwrap-notmuch_config_key_t key)) + (~val (unwrap~pointer val))) + (wrap-notmuch_status_t + ((force ~notmuch_config_set) ~notmuch ~key ~val)))))) +(export notmuch_config_set) + +;; notmuch_config_values_t *notmuch_config_get_values(notmuch_database_t * +;; notmuch, notmuch_config_key_t key); +(define notmuch_config_get_values + (let ((~notmuch_config_get_values + (delay (fh-link-proc + ffi-void* + "notmuch_config_get_values" + (list ffi-void* ffi:int) + (force ffi-notmuch-llibs))))) + (lambda (notmuch key) + (let ((~notmuch + ((fht-unwrap notmuch_database_t*) notmuch)) + (~key (unwrap-notmuch_config_key_t key))) + ((fht-wrap notmuch_config_values_t*) + ((force ~notmuch_config_get_values) + ~notmuch + ~key)))))) +(export notmuch_config_get_values) + +;; notmuch_config_values_t *notmuch_config_get_values_string(notmuch_database_t +;; *notmuch, const char *key); +(define notmuch_config_get_values_string + (let ((~notmuch_config_get_values_string + (delay (fh-link-proc + ffi-void* + "notmuch_config_get_values_string" + (list ffi-void* ffi-void*) + (force ffi-notmuch-llibs))))) + (lambda (notmuch key) + (let ((~notmuch + ((fht-unwrap notmuch_database_t*) notmuch)) + (~key (unwrap~pointer key))) + ((fht-wrap notmuch_config_values_t*) + ((force ~notmuch_config_get_values_string) + ~notmuch + ~key)))))) +(export notmuch_config_get_values_string) + +;; notmuch_bool_t notmuch_config_values_valid(notmuch_config_values_t *values); +;; +(define notmuch_config_values_valid + (let ((~notmuch_config_values_valid + (delay (fh-link-proc + ffi:int + "notmuch_config_values_valid" + (list ffi-void*) + (force ffi-notmuch-llibs))))) + (lambda (values) + (let ((~values + ((fht-unwrap notmuch_config_values_t*) values))) + ((force ~notmuch_config_values_valid) ~values))))) +(export notmuch_config_values_valid) + +;; const char *notmuch_config_values_get(notmuch_config_values_t *values); +(define notmuch_config_values_get + (let ((~notmuch_config_values_get + (delay (fh-link-proc + ffi-void* + "notmuch_config_values_get" + (list ffi-void*) + (force ffi-notmuch-llibs))))) + (lambda (values) + (let ((~values + ((fht-unwrap notmuch_config_values_t*) values))) + ((force ~notmuch_config_values_get) ~values))))) +(export notmuch_config_values_get) + +;; void notmuch_config_values_move_to_next(notmuch_config_values_t *values); +(define notmuch_config_values_move_to_next + (let ((~notmuch_config_values_move_to_next + (delay (fh-link-proc + ffi:void + "notmuch_config_values_move_to_next" + (list ffi-void*) + (force ffi-notmuch-llibs))))) + (lambda (values) + (let ((~values + ((fht-unwrap notmuch_config_values_t*) values))) + ((force ~notmuch_config_values_move_to_next) + ~values))))) +(export notmuch_config_values_move_to_next) + +;; void notmuch_config_values_start(notmuch_config_values_t *values); +(define notmuch_config_values_start + (let ((~notmuch_config_values_start + (delay (fh-link-proc + ffi:void + "notmuch_config_values_start" + (list ffi-void*) + (force ffi-notmuch-llibs))))) + (lambda (values) + (let ((~values + ((fht-unwrap notmuch_config_values_t*) values))) + ((force ~notmuch_config_values_start) ~values))))) +(export notmuch_config_values_start) + +;; void notmuch_config_values_destroy(notmuch_config_values_t *values); +(define notmuch_config_values_destroy + (let ((~notmuch_config_values_destroy + (delay (fh-link-proc + ffi:void + "notmuch_config_values_destroy" + (list ffi-void*) + (force ffi-notmuch-llibs))))) + (lambda (values) + (let ((~values + ((fht-unwrap notmuch_config_values_t*) values))) + ((force ~notmuch_config_values_destroy) ~values))))) +(export notmuch_config_values_destroy) + +;; notmuch_config_pairs_t *notmuch_config_get_pairs(notmuch_database_t *notmuch +;; , const char *prefix); +(define notmuch_config_get_pairs + (let ((~notmuch_config_get_pairs + (delay (fh-link-proc + ffi-void* + "notmuch_config_get_pairs" + (list ffi-void* ffi-void*) + (force ffi-notmuch-llibs))))) + (lambda (notmuch prefix) + (let ((~notmuch + ((fht-unwrap notmuch_database_t*) notmuch)) + (~prefix (unwrap~pointer prefix))) + ((fht-wrap notmuch_config_pairs_t*) + ((force ~notmuch_config_get_pairs) + ~notmuch + ~prefix)))))) +(export notmuch_config_get_pairs) + +;; notmuch_bool_t notmuch_config_pairs_valid(notmuch_config_pairs_t *pairs); +(define notmuch_config_pairs_valid + (let ((~notmuch_config_pairs_valid + (delay (fh-link-proc + ffi:int + "notmuch_config_pairs_valid" + (list ffi-void*) + (force ffi-notmuch-llibs))))) + (lambda (pairs) + (let ((~pairs + ((fht-unwrap notmuch_config_pairs_t*) pairs))) + ((force ~notmuch_config_pairs_valid) ~pairs))))) +(export notmuch_config_pairs_valid) + +;; void notmuch_config_pairs_move_to_next(notmuch_config_pairs_t *pairs); +(define notmuch_config_pairs_move_to_next + (let ((~notmuch_config_pairs_move_to_next + (delay (fh-link-proc + ffi:void + "notmuch_config_pairs_move_to_next" + (list ffi-void*) + (force ffi-notmuch-llibs))))) + (lambda (pairs) + (let ((~pairs + ((fht-unwrap notmuch_config_pairs_t*) pairs))) + ((force ~notmuch_config_pairs_move_to_next) + ~pairs))))) +(export notmuch_config_pairs_move_to_next) + +;; const char *notmuch_config_pairs_key(notmuch_config_pairs_t *pairs); +(define notmuch_config_pairs_key + (let ((~notmuch_config_pairs_key + (delay (fh-link-proc + ffi-void* + "notmuch_config_pairs_key" + (list ffi-void*) + (force ffi-notmuch-llibs))))) + (lambda (pairs) + (let ((~pairs + ((fht-unwrap notmuch_config_pairs_t*) pairs))) + ((force ~notmuch_config_pairs_key) ~pairs))))) +(export notmuch_config_pairs_key) + +;; const char *notmuch_config_pairs_value(notmuch_config_pairs_t *pairs); +(define notmuch_config_pairs_value + (let ((~notmuch_config_pairs_value + (delay (fh-link-proc + ffi-void* + "notmuch_config_pairs_value" + (list ffi-void*) + (force ffi-notmuch-llibs))))) + (lambda (pairs) + (let ((~pairs + ((fht-unwrap notmuch_config_pairs_t*) pairs))) + ((force ~notmuch_config_pairs_value) ~pairs))))) +(export notmuch_config_pairs_value) + +;; void notmuch_config_pairs_destroy(notmuch_config_pairs_t *pairs); +(define notmuch_config_pairs_destroy + (let ((~notmuch_config_pairs_destroy + (delay (fh-link-proc + ffi:void + "notmuch_config_pairs_destroy" + (list ffi-void*) + (force ffi-notmuch-llibs))))) + (lambda (pairs) + (let ((~pairs + ((fht-unwrap notmuch_config_pairs_t*) pairs))) + ((force ~notmuch_config_pairs_destroy) ~pairs))))) +(export notmuch_config_pairs_destroy) + +;; notmuch_status_t notmuch_config_get_bool(notmuch_database_t *notmuch, +;; notmuch_config_key_t key, notmuch_bool_t *val); +(define notmuch_config_get_bool + (let ((~notmuch_config_get_bool + (delay (fh-link-proc + ffi:int + "notmuch_config_get_bool" + (list ffi-void* ffi:int ffi-void*) + (force ffi-notmuch-llibs))))) + (lambda (notmuch key val) + (let ((~notmuch + ((fht-unwrap notmuch_database_t*) notmuch)) + (~key (unwrap-notmuch_config_key_t key)) + (~val (unwrap~pointer val))) + (wrap-notmuch_status_t + ((force ~notmuch_config_get_bool) + ~notmuch + ~key + ~val)))))) +(export notmuch_config_get_bool) + +;; const char *notmuch_config_path(notmuch_database_t *notmuch); +(define notmuch_config_path + (let ((~notmuch_config_path + (delay (fh-link-proc + ffi-void* + "notmuch_config_path" + (list ffi-void*) + (force ffi-notmuch-llibs))))) + (lambda (notmuch) + (let ((~notmuch + ((fht-unwrap notmuch_database_t*) notmuch))) + ((force ~notmuch_config_path) ~notmuch))))) +(export notmuch_config_path) + ;; notmuch_indexopts_t *notmuch_database_get_default_indexopts( ;; notmuch_database_t *db); (define notmuch_database_get_default_indexopts @@ -2408,6 +2907,36 @@ (NOTMUCH_DECRYPT_AUTO . 2) (NOTMUCH_DECRYPT_TRUE . 1) (NOTMUCH_DECRYPT_FALSE . 0) + (NOTMUCH_CONFIG_LAST . 13) + (NOTMUCH_CONFIG_EXTRA_HEADERS . 12) + (NOTMUCH_CONFIG_AUTOCOMMIT . 11) + (NOTMUCH_CONFIG_USER_NAME . 10) + (NOTMUCH_CONFIG_OTHER_EMAIL . 9) + (NOTMUCH_CONFIG_PRIMARY_EMAIL . 8) + (NOTMUCH_CONFIG_SYNC_MAILDIR_FLAGS . 7) + (NOTMUCH_CONFIG_NEW_IGNORE . 6) + (NOTMUCH_CONFIG_NEW_TAGS . 5) + (NOTMUCH_CONFIG_EXCLUDE_TAGS . 4) + (NOTMUCH_CONFIG_BACKUP_DIR . 3) + (NOTMUCH_CONFIG_HOOK_DIR . 2) + (NOTMUCH_CONFIG_MAIL_ROOT . 1) + (NOTMUCH_CONFIG_DATABASE_PATH . 0) + (NOTMUCH_CONFIG_FIRST . 0) + (NOTMUCH_CONFIG_LAST . 13) + (NOTMUCH_CONFIG_EXTRA_HEADERS . 12) + (NOTMUCH_CONFIG_AUTOCOMMIT . 11) + (NOTMUCH_CONFIG_USER_NAME . 10) + (NOTMUCH_CONFIG_OTHER_EMAIL . 9) + (NOTMUCH_CONFIG_PRIMARY_EMAIL . 8) + (NOTMUCH_CONFIG_SYNC_MAILDIR_FLAGS . 7) + (NOTMUCH_CONFIG_NEW_IGNORE . 6) + (NOTMUCH_CONFIG_NEW_TAGS . 5) + (NOTMUCH_CONFIG_EXCLUDE_TAGS . 4) + (NOTMUCH_CONFIG_BACKUP_DIR . 3) + (NOTMUCH_CONFIG_HOOK_DIR . 2) + (NOTMUCH_CONFIG_MAIL_ROOT . 1) + (NOTMUCH_CONFIG_DATABASE_PATH . 0) + (NOTMUCH_CONFIG_FIRST . 0) (NOTMUCH_MESSAGE_FLAG_GHOST . 2) (NOTMUCH_MESSAGE_FLAG_EXCLUDED . 1) (NOTMUCH_MESSAGE_FLAG_MATCH . 0) @@ -2430,15 +2959,23 @@ (NOTMUCH_SORT_MESSAGE_ID . 2) (NOTMUCH_SORT_NEWEST_FIRST . 1) (NOTMUCH_SORT_OLDEST_FIRST . 0) + (NOTMUCH_QUERY_SYNTAX_SEXP . 1) + (NOTMUCH_QUERY_SYNTAX_XAPIAN . 0) + (NOTMUCH_QUERY_SYNTAX_SEXP . 1) + (NOTMUCH_QUERY_SYNTAX_XAPIAN . 0) (NOTMUCH_DATABASE_MODE_READ_WRITE . 1) (NOTMUCH_DATABASE_MODE_READ_ONLY . 0) (NOTMUCH_DATABASE_MODE_READ_WRITE . 1) (NOTMUCH_DATABASE_MODE_READ_ONLY . 0) - (NOTMUCH_STATUS_LAST_STATUS . 19) + (NOTMUCH_STATUS_LAST_STATUS . 25) + (NOTMUCH_STATUS_CLOSED_DATABASE . 24) + (NOTMUCH_STATUS_NO_MAIL_ROOT . 23) + (NOTMUCH_STATUS_BAD_QUERY_SYNTAX . 22) + (NOTMUCH_STATUS_DATABASE_EXISTS . 21) + (NOTMUCH_STATUS_NO_DATABASE . 20) + (NOTMUCH_STATUS_NO_CONFIG . 19) (NOTMUCH_STATUS_UNKNOWN_CRYPTO_PROTOCOL . 18) - (NOTMUCH_STATUS_FAILED_CRYPTO_CONTEXT_CREATION - . - 17) + (NOTMUCH_STATUS_FAILED_CRYPTO_CONTEXT_CREATION . 17) (NOTMUCH_STATUS_MALFORMED_CRYPTO_PROTOCOL . 16) (NOTMUCH_STATUS_ILLEGAL_ARGUMENT . 15) (NOTMUCH_STATUS_IGNORED . 14) @@ -2456,7 +2993,13 @@ (NOTMUCH_STATUS_READ_ONLY_DATABASE . 2) (NOTMUCH_STATUS_OUT_OF_MEMORY . 1) (NOTMUCH_STATUS_SUCCESS . 0) - (NOTMUCH_STATUS_LAST_STATUS . 19) + (NOTMUCH_STATUS_LAST_STATUS . 25) + (NOTMUCH_STATUS_CLOSED_DATABASE . 24) + (NOTMUCH_STATUS_NO_MAIL_ROOT . 23) + (NOTMUCH_STATUS_BAD_QUERY_SYNTAX . 22) + (NOTMUCH_STATUS_DATABASE_EXISTS . 21) + (NOTMUCH_STATUS_NO_DATABASE . 20) + (NOTMUCH_STATUS_NO_CONFIG . 19) (NOTMUCH_STATUS_UNKNOWN_CRYPTO_PROTOCOL . 18) (NOTMUCH_STATUS_FAILED_CRYPTO_CONTEXT_CREATION . @@ -2480,7 +3023,7 @@ (NOTMUCH_STATUS_SUCCESS . 0) (NOTMUCH_TAG_MAX . 200) (LIBNOTMUCH_MICRO_VERSION . 0) - (LIBNOTMUCH_MINOR_VERSION . 3) + (LIBNOTMUCH_MINOR_VERSION . 6) (LIBNOTMUCH_MAJOR_VERSION . 5) (TRUE . 1) (FALSE . 0))) @@ -2497,15 +3040,19 @@ (else (error "type mismatch")))) (define ffi-notmuch-types - '((pointer . "notmuch_database_t") "notmuch_database_t" (pointer . - "notmuch_query_t") "notmuch_query_t" (pointer . "notmuch_threads_t") - "notmuch_threads_t" (pointer . "notmuch_thread_t") "notmuch_thread_t" - (pointer . "notmuch_messages_t") "notmuch_messages_t" (pointer . - "notmuch_message_t") "notmuch_message_t" (pointer . "notmuch_tags_t") - "notmuch_tags_t" (pointer . "notmuch_directory_t") "notmuch_directory_t" - (pointer . "notmuch_filenames_t") "notmuch_filenames_t" (pointer . - "notmuch_config_list_t") "notmuch_config_list_t" (pointer . - "notmuch_indexopts_t") "notmuch_indexopts_t" "notmuch_compact_status_cb_t" + '((pointer . "notmuch_database_t") "notmuch_database_t" + (pointer . "notmuch_query_t") "notmuch_query_t" + (pointer . "notmuch_threads_t") "notmuch_threads_t" + (pointer . "notmuch_thread_t") "notmuch_thread_t" + (pointer . "notmuch_messages_t") "notmuch_messages_t" + (pointer . "notmuch_message_t") "notmuch_message_t" + (pointer . "notmuch_tags_t") "notmuch_tags_t" + (pointer . "notmuch_directory_t") "notmuch_directory_t" + (pointer . "notmuch_filenames_t") "notmuch_filenames_t" + (pointer . "notmuch_config_list_t") "notmuch_config_list_t" + (pointer . "notmuch_config_values_t") "notmuch_config_values_t" + (pointer . "notmuch_config_pairs_t") "notmuch_config_pairs_t" + (pointer . "notmuch_indexopts_t") "notmuch_indexopts_t" "notmuch_compact_status_cb_t" (pointer . "notmuch_message_properties_t") "notmuch_message_properties_t")) (export ffi-notmuch-types) diff --git a/lib/guile/makefile b/lib/guile/makefile new file mode 100644 index 0000000..50b7bbe --- /dev/null +++ b/lib/guile/makefile @@ -0,0 +1,16 @@ +## +# Build my guile libraries +# +# @file +# @version 0.1 + +LD_LIBRARY_PATH=$HOME/.guix-profile/lib + +notmuch: ffi/notmuch.ffi + C_INCLUDE_PATH=$(HOME)/.guix-profile/include/ guild compile-ffi $< + +clean: + rm ffi/notmuch.scm + + +# end -- cgit v1.2.3