1.1--- a/lisp/lib/rdb/macs.lisp Sun Mar 10 21:34:47 2024 -0400
1.2+++ b/lisp/lib/rdb/macs.lisp Wed Mar 13 22:48:42 2024 -0400
1.3@@ -1,5 +1,27 @@
1.4+;;; rdb/macs.lisp --- macros
1.5+
1.6+;;; Code:
1.7 (in-package :rdb)
1.8
1.9+(defmacro with-errptr ((e &optional errtyp params) &body body)
1.10+ `(with-alien ((,e rocksdb-errptr nil))
1.11+ (unwind-protect
1.12+ (handler-bind ((sb-sys:memory-fault-error
1.13+ (lambda (condition)
1.14+ (error 'rdb-error
1.15+ :message
1.16+ (format nil
1.17+ "~a" condition))))
1.18+ (error
1.19+ (lambda (condition)
1.20+ (error 'rdb-error
1.21+ :message
1.22+ (format nil
1.23+ "unhandled exception in body of WITH-ERRPTR: ~a"
1.24+ condition)))))
1.25+ (progn ,@body))
1.26+ (handle-errptr ,e ,errtyp ,params))))
1.27+
1.28 (defmacro with-db ((db-var db) &body body)
1.29 `(let ((,db-var ,db))
1.30 (handler-bind ((error (lambda (condition)
1.31@@ -10,4 +32,4 @@
1.32
1.33 (defmacro with-cf ((cf-var cf) &body body)
1.34 `(let ((,cf-var ,cf))
1.35- ,@body))
1.36+ ,@body))