summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Pelz <pelzflorian@pelzflorian.de>2017-12-12 09:23:20 +0100
committerFlorian Pelz <pelzflorian@pelzflorian.de>2017-12-12 09:23:20 +0100
commita9267c79427cbebb29a7f8a46d91d1dfbe424629 (patch)
tree5823bd3f726fb8ab1b03fa8045dd87f2e3b213a9
parent5e6463ef94b3862f24106849ae208f6ee1d71109 (diff)
Fix po error handlers.
Implements Matt Wette’s suggestion from the Guile mailing list. Proper output is still TODO.
-rw-r--r--haunt.scm85
1 files changed, 42 insertions, 43 deletions
diff --git a/haunt.scm b/haunt.scm
index 6ecc801..4cc47c1 100644
--- a/haunt.scm
+++ b/haunt.scm
@@ -51,51 +51,50 @@
(list "de"
"en"))
-;; TODO SET XERROR HANDLERS CORRECTLY BELOW:
-;;
-;; (define (xerror-handler severity message filename lineno column multiline-p1 message-text)
-;; (display "xerror occurred!"))
-;; (define ~xerror-handler
-;; (ffi:procedure->pointer
-;; ffi:void
-;; xerror-handler
-;; (list ffi:int
-;; '*
-;; '*
-;; ffi:size_t
-;; ffi:size_t
-;; ffi:int
-;; '*)))
-;;
-;; (define (xerror2-handler severity message
-;; filename1 lineno1 column1 multiline-p1 message-text1
-;; filename2 lineno2 column2 multiline-p2 message-text2)
-;; (display "xerror occurred!"))
-;; (define ~xerror2-handler
-;; (ffi:procedure->pointer
-;; ffi:void
-;; xerror2-handler
-;; (list ffi:int
-;; '*
-;; '*
-;; ffi:size_t
-;; ffi:size_t
-;; ffi:int
-;; '*
-;; '*
-;; '*
-;; ffi:size_t
-;; ffi:size_t
-;; ffi:int
-;; '*)))
+(define (xerror-handler severity message filename lineno column multiline-p1 message-text)
+ (display "xerror occurred!"))
+(define ~xerror-handler
+ (ffi:procedure->pointer
+ ffi:void
+ xerror-handler
+ (list ffi:int
+ '*
+ '*
+ ffi:size_t
+ ffi:size_t
+ ffi:int
+ '*)))
+
+;;; TODO USE SIMPLE-FORMAT AND DISPLAY ERRORS PROPERLY
+
+(define (xerror2-handler severity message
+ filename1 lineno1 column1 multiline-p1 message-text1
+ filename2 lineno2 column2 multiline-p2 message-text2)
+ (display "xerror occurred!"))
+(define ~xerror2-handler
+ (ffi:procedure->pointer
+ ffi:void
+ xerror2-handler
+ (list ffi:int
+ '*
+ '*
+ ffi:size_t
+ ffi:size_t
+ ffi:int
+ '*
+ '*
+ '*
+ ffi:size_t
+ ffi:size_t
+ ffi:int
+ '*)))
(define xerror-handler-struct
- (make-struct-po_xerror_handler)) ; TODO SET HANDLERS:
-;; (let ((new (make-struct-po_xerror_handler)))
-;; (begin
-;; (fh-object-set! new 'xerror ~xerror-handler)
-;; (fh-object-set! new 'xerror2 ~xerror2-handler)
-;; new)))
+ (let ((new (make-struct-po_xerror_handler)))
+ (begin
+ (fh-object-set! new 'xerror (ffi:pointer-address ~xerror-handler))
+ (fh-object-set! new 'xerror2 (ffi:pointer-address ~xerror2-handler))
+ new)))
(define (translations-for-lingua lingua)
"Returns po/<lingua>.po converted to an association list of msgid–msgstr pairs."