From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Matt Wette Newsgroups: gmane.lisp.guile.user Subject: [ANN] nyacc-2.01.3 released Date: Sun, 3 Nov 2024 13:03:44 -0800 Message-ID: <801d55e3-28c1-4eeb-9c91-c1d27ac070d8@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13529"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird To: Guile User Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sun Nov 03 22:04:15 2024 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1t7hlf-0003OF-FS for guile-user@m.gmane-mx.org; Sun, 03 Nov 2024 22:04:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t7hlJ-0003M3-23; Sun, 03 Nov 2024 16:03:53 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t7hlH-0003KV-44 for guile-user@gnu.org; Sun, 03 Nov 2024 16:03:51 -0500 Original-Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t7hlD-0006bK-UF for guile-user@gnu.org; Sun, 03 Nov 2024 16:03:50 -0500 Original-Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-71e7086c231so2978273b3a.0 for ; Sun, 03 Nov 2024 13:03:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730667826; x=1731272626; darn=gnu.org; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=ZZUkxzcr/9X81UMsWyuYmhF7YDVa9chs6rNtIT5sR80=; b=h0g9PU+enZO2Rm9G4XkMGi5zjHRnFMFS3/mYGIMGcQuBrim5wA61D1FVogGtdHz1US EbFW4DgfRojNOf9geSokYaAD2qo2q83LYZMsG2c9lzTGZRpv4HtlopJ5F5ZGnjmTlaCE A1ErI8E1lX/I7mteQzGxriNjEosIHSMsnS9aGErfspHNA/yjFUZUlHu6XUSnNzhzhH/k zp/dBmcozmLH7uxC1zsmCOLTJRMwYiTSMf/3oEzkpHsouDkN2LN7QvfONJS4peXnMHOY XvCeVUzjli33/a8K3WLyqYacw9ceaLJ1CmZgbJ9Mecw53+uyqgLqj1fgRwJEZSEhWQRz tMtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730667826; x=1731272626; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ZZUkxzcr/9X81UMsWyuYmhF7YDVa9chs6rNtIT5sR80=; b=c7itUHAmWIjXg9UpeYmBUF0554pFc1OIZin0ptn+93GKdzbxHlhsnO7qQlRRWY8d3X k5A3znoaghexJGU0XCZjqP86aq2CgQ/0oZR/IGI2I3/HmZxnA49HNqXXGaB9XJEP23P9 qi+HoxUXHNn5rbARQWJEA6Y7Nhz9dI//8YLNEhEHZM5lIMtsXo/yhzaZCNAZkWhFC74c djIZjlcT+eORJ97DQEPaXXXvzy4c2Z4fQX2+GOdAy2w4rttzIij0DqGZEnKQ8qkCZvPC WQrmxIDWr6EgrO/uJOpgFSmsSUmm2n1wlq5lebt1MU6zeoYh4rkIHYxyyHSzaq5KKUcr zwPg== X-Gm-Message-State: AOJu0YxNFRrioL8d0Gserf96nllwE8ARsBB/NG704i2mnVW22U2qOhSY m3QnQXWeNWpJwbH3u88FL3Y8jfasYWw8rfeoqCJ48babDzuhg2KAYWnrew== X-Google-Smtp-Source: AGHT+IFXa7lJF+8OcXeV/qi1gj8EgndcAp8vcRhIogBD/CKuT7O10+c5XDzHMt97XY1T8HlNI0VUGg== X-Received: by 2002:a05:6a20:c6ce:b0:1d8:a3ab:7220 with SMTP id adf61e73a8af0-1d9a81cd19fmr40735356637.0.1730667825523; Sun, 03 Nov 2024 13:03:45 -0800 (PST) Original-Received: from [192.168.2.155] (64-52-138-37.championbroadband.com. [64.52.138.37]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7ee45a0eda2sm5841995a12.86.2024.11.03.13.03.44 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 03 Nov 2024 13:03:45 -0800 (PST) Content-Language: en-US Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=matt.wette@gmail.com; helo=mail-pf1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:19873 Archived-At: This release extends the capability to provide guile procedures directly to functions which take callback arguments.  More explanation below. NYACC, for Not Yet Another Compiler Compiler, is set of guile modules for generating parsers and lexical analyzers.  It also provides sample parsers and pretty-printers using SXML trees as an intermediate representation. It provides a decent C parser and a `FFI Helper' tool to help create Guile Scheme bindings for C-based libraries. It provides (partially implemented) compilers based on above mentioned parsers to allow execution with Guile as extension languages. NEWS * ffi-helper: cover more cases where passing procedure (e.g.,   callback) to functions works; was only function-ptr typedefs * for forward ref structs, unions which are never elaborated,   don't generate a definition * update some documentation for nyacc-fh-ug and cdata A little more detail on the fix.  Consider the following functions with callback argument `cb'.  With nyacc-2.01.2 `f1' would accept a guile procedure directly (i.e., without user translating via procedure->pointer), but `f2' and `f3' would not.  With nyacc-2.01.3, all three work.     (define-ffi-module (ffi dbug)       #:api-code "         typedef void (*t1)(int);         typedef void (t2)(int);         int f1(int, t1 cb);         int f2(int, t2 *cb);         int f3(int, void (*cb)(int));")     Expanded code appears below. NYACC maturity is production/stable level. NYACC is free software; the full source distribution is available through * the tarball repository:     https://download.savannah.gnu.org/releases/nyacc/ * the git repository:     git://git.savannah.nongnu.org/nyacc.git home page, project page and user's guides: * https://www.nongnu.org/nyacc * https://savannah.nongnu.org/projects/nyacc * https://www.nongnu.org/nyacc/nyacc-ug.html * https://www.nongnu.org/nyacc/ffi-help.html Report bugs: * https://savannah.nongnu.org/bugs/?group=nyacc Get support: * https://savannah.nongnu.org/support/?group=nyacc Copyright (C) 2017-2024 Matthew Wette Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.  This file is offered as-is, without any warranty. Copyright (C) 2017-2024 Matthew Wette Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.  This file is offered as-is, without any warranty.     ============================================     nyacc v2.01.2     ;; int f1(int, t1 cb);     (define-public f1       (let ((~proc (delay (ffi:pointer->procedure                             ffi:int                             (foreign-pointer-search "f1")                             (list ffi:int '*)))))         (lambda (arg0 cb)           (let ((arg0 (unwrap-number arg0))                 (cb (unwrap-pointer cb t1)))             ((force ~proc) arg0 cb)))))     ;; int f2(int, t2 *cb);     (define-public f2       (let ((~proc (delay (ffi:pointer->procedure                             ffi:int                             (foreign-pointer-search "f2")                             (list ffi:int '*)))))         (lambda (arg0 cb)           (let ((arg0 (unwrap-number arg0))                 (cb (unwrap-pointer cb)))             ((force ~proc) arg0 cb)))))     ;; int f3(int, void (*cb)(int));     (define-public f3       (let ((~proc (delay (ffi:pointer->procedure                             ffi:int                             (foreign-pointer-search "f3")                             (list ffi:int '*)))))         (lambda (arg0 cb)           (let ((arg0 (unwrap-number arg0))                 (cb (unwrap-pointer cb)))             ((force ~proc) arg0 cb)))))     ============================================     nyacc v2.01.3     ;; int f1(int, t1 cb);     (define-public f1       (let ((~proc (delay (ffi:pointer->procedure                             ffi:int                             (foreign-pointer-search "f1")                             (list ffi:int '*)))))         (lambda (arg0 cb)           (let ((arg0 (unwrap-number arg0))                 (cb (unwrap-pointer cb t1)))             ((force ~proc) arg0 cb)))))     ;; int f2(int, t2 *cb);     (define-public f2       (let ((~proc (delay (ffi:pointer->procedure                             ffi:int                             (foreign-pointer-search "f2")                             (list ffi:int '*)))))         (lambda (arg0 cb)           (let ((arg0 (unwrap-number arg0))                 (cb (unwrap-pointer cb t2*)))             ((force ~proc) arg0 cb)))))     ;; int f3(int, void (*cb)(int));     (define-public f3       (let ((~proc (delay (ffi:pointer->procedure                             ffi:int                             (foreign-pointer-search "f3")                             (list ffi:int '*)))))         (lambda (arg0 cb)           (let ((arg0 (unwrap-number arg0))                 (cb (unwrap-pointer                       cb                       (cpointer                         (cfunction                           (lambda (~proc)                             (ffi:procedure->pointer                               ffi:void                               (lambda (arg0) (~proc arg0))                               (list ffi:int)))                           (lambda (p) 'unused))))))             ((force ~proc) arg0 cb)))))