From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Matt Wette Newsgroups: gmane.lisp.guile.user,gmane.lisp.guile.devel Subject: Re: Website translations with Haunt Date: Sun, 10 Dec 2017 07:22:55 -0800 Message-ID: <337C4CEB-E242-4D3B-B110-E19B485DA0AB@gmail.com> References: <20171209180619.GA10254@floriannotebook.localdomain> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1512919407 30409 195.159.176.226 (10 Dec 2017 15:23:27 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 10 Dec 2017 15:23:27 +0000 (UTC) Cc: Guile User Mailing List , guile-devel To: "pelzflorian (Florian Pelz)" Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sun Dec 10 16:23:24 2017 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eO3Rr-0007ex-GQ for guile-user@m.gmane.org; Sun, 10 Dec 2017 16:23:23 +0100 Original-Received: from localhost ([::1]:45006 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eO3Rw-0000Bm-NM for guile-user@m.gmane.org; Sun, 10 Dec 2017 10:23:28 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33023) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eO3RZ-0000Bf-Bz for guile-user@gnu.org; Sun, 10 Dec 2017 10:23:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eO3RW-0000pp-7V for guile-user@gnu.org; Sun, 10 Dec 2017 10:23:05 -0500 Original-Received: from mail-pl0-x234.google.com ([2607:f8b0:400e:c01::234]:44180) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eO3RW-0000n8-05; Sun, 10 Dec 2017 10:23:02 -0500 Original-Received: by mail-pl0-x234.google.com with SMTP id n13so1769136plp.11; Sun, 10 Dec 2017 07:23:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=VTCRpg90T0oJ3ypxQ9Hwursn3vcFbUGDF3gJmgu5HNQ=; b=YUhEcCzSOlJn/8jwLQCV+zUEOu8w/a8NZ18rC8r+hSTVJvsJdTt7w47xEBNkdMiIXi imqNjTMZ3CefIy02GTekYtw3+7FPh809R5H31pk4NvHH0LN6SKrw5C2oFchzwWsODNpq lfAALHIEmDFx5GxYuI+fKeN+/4ILi+1L42543gSnG8+k72N0gY4ti8m1DB+3GptDGeoE de0mrgey/dTai1YMaKLsbEJy81i3AQxOYHpd6mscNivTuURzvIrS6LNRYx2nGLAHC8My 9lXUwsNi+hfdGhAbIWDoiuL+dYpNiVFRIpuzENenVxxn1+ozviHsNs5aWo02Nk5gFHe2 F0Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=VTCRpg90T0oJ3ypxQ9Hwursn3vcFbUGDF3gJmgu5HNQ=; b=E/lXyohbbbT3JLuAPJRMsEow4xHpTH15LsGpR/INJV8kvFp0HZDm+g4JtUetDSCOz3 sSzNliLIfhzjromHRHTTaDf9lvEpctrkdzswIGMfs3nMzm+7Svkr8TtB+Nu8GxoHVJ5K I+svh+eMRe+1LVMYcrFG9walevj8e0+PzELT3044hQKlA/ayD5aKWYSkLPwznvKgoxF1 udLIu3aiT6neo+9ONJsq00H2gdxmIs/wd490IfAvWqSeqT/rHQnl+axhSlYi8NFr+5wm qP9F7OXTDM46bHWGRpzMLzR43gd2821edp8XbKV63ZMIuZ21HyD6T+pynRKcosjlAE0Y ZPHw== X-Gm-Message-State: AJaThX6MjB5xBIVLDO9FXVR1OLSW8LGmsmMmxy/RtLt2dFmo4N3AbXLD tNnYm/qqm9fAJ0ehpRnXv7A= X-Google-Smtp-Source: AGs4zMY3qf7FUJQhgwxrRtqyx/VTQJWngXOm7qco7YTpIWy0pZ140uFOwruSKmNPLrdTMfEzfnhaXQ== X-Received: by 10.84.128.2 with SMTP id 2mr35585678pla.238.1512919379471; Sun, 10 Dec 2017 07:22:59 -0800 (PST) Original-Received: from nautilus.championbroadband.com (216-165-229-229.championbroadband.com. [216.165.229.229]) by smtp.gmail.com with ESMTPSA id i125sm21300983pfe.151.2017.12.10.07.22.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Dec 2017 07:22:59 -0800 (PST) In-Reply-To: <20171209180619.GA10254@floriannotebook.localdomain> X-Mailer: Apple Mail (2.3273) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::234 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:14333 gmane.lisp.guile.devel:19404 Archived-At: > On Dec 9, 2017, at 10:06 AM, pelzflorian (Florian Pelz) = wrote: > (define xerror-handler-struct > (make-struct-po_xerror_handler)) ; TODO SET HANDLERS: > ;; [=E2=80=A6] >=20 First of all, FFI helper + Guile can't deal with this pattern: using = varargs function=20 members in structs. This would require things like `va_arg' in libffi = and Guile. I=20 have posted a request on the libffi dev site. Your example also brought = up some gaps in the ffi helper. I think I may have a workaround for you, though. = Try to add code like the following to your dot-ffi file. In functions calls that want a = error handler specified use std-po-error-handler. (define-ffi-module (gettext-po) #:include '("gettext-po.h") #:library '("libgettextpo")) (define-public std-po-error-handler (let* ((error (lambda (status errnum format) (simple-format #t "~A\n" (ffi:pointer->string format)))) (error-p (ffi:procedure->pointer ffi:void error (list ffi:int ffi:int = '*))) ;; (error_at_line (lambda (status errnum filename lineno format) (simple-format #t "~A\n" (ffi:pointer->string format)))) (error_at_line-p (ffi:procedure->pointer ffi:void error_at_line (list ffi:int ffi:int '* ffi:int '*))) ;; (multiline_warning (lambda (prefix message) (simple-format #t "~A ~A\n" (ffi:pointer->string prefix) (ffi:pointer->string message)))) (multiline_warning-p (ffi:procedure->pointer ffi:void multiline_warning (list '* = '*))) ;; (multiline_error (lambda (prefix message) (simple-format #t "~A ~A\n" prefix message))) (multiline_error-p (ffi:procedure->pointer ffi:void multiline_error (list '* = '*))) ;; (eh-struct (make-struct-po_error_handler))) =20 (fh-object-set! eh-struct 'error error-p) (fh-object-set! eh-struct 'error_at_line error_at_line-p) (fh-object-set! eh-struct 'multiline_warning multiline_warning-p) (fh-object-set! eh-struct 'multiline_error multiline_error-p) ;; (make-po_error_handler_t (ffi:pointer-address ((fht-unwrap struct-po_error_handler*) (pointer-to eh-struct))))))