From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Taylan Kammer Newsgroups: gmane.lisp.guile.user Subject: bytestructures 2.0.0 Date: Sun, 20 Feb 2022 20:51:50 +0100 Message-ID: <64792906-b02c-75b7-e620-125e03f58021@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9177"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 To: Guile User Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sun Feb 20 20:52:18 2022 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 1nLsFl-0002Fc-Vt for guile-user@m.gmane-mx.org; Sun, 20 Feb 2022 20:52:17 +0100 Original-Received: from localhost ([::1]:47888 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nLsFk-000107-SA for guile-user@m.gmane-mx.org; Sun, 20 Feb 2022 14:52:16 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:34674) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nLsFX-0000zw-TE for guile-user@gnu.org; Sun, 20 Feb 2022 14:52:03 -0500 Original-Received: from [2a00:1450:4864:20::529] (port=34807 helo=mail-ed1-x529.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nLsFN-0002Gx-KH for guile-user@gnu.org; Sun, 20 Feb 2022 14:51:55 -0500 Original-Received: by mail-ed1-x529.google.com with SMTP id z22so25229874edd.1 for ; Sun, 20 Feb 2022 11:51:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:content-language:to:from :subject:content-transfer-encoding; bh=hSBHjK4DZqBER9OIOyIsm4MCH/RyGvcMbLdizbqJwAo=; b=FsjJG751uAm0PLEXyYADc5vDNiajnKa4dtvY5yw1BXJY0lMyJtg/fHMlacisNgg2ph gpg6UQ2ATGhRqRQi8yr+JZ1q4t2r3NLIEh7SVvG1j9bdj54tn0GdO3x15hgzZGzrITIU dS2BNYBDOtAyON/PcvARUxSU0xg27cWVrZDZ0TZStyGPFCDp9SQaGoOa2b6EjHCX0eSh nZLs+90XzRhchvfl48NgbJS5NpvqeaN7PyiclvpUjJvhdyFNiqwoO780Kl+01F1u4w3F X4ZajMQjieIaKWAQpd8U3kGRCOMu0V5D436m4jpicZFbNMOoM3Mi1h0oQTE//wGwR59r o7Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:from:subject:content-transfer-encoding; bh=hSBHjK4DZqBER9OIOyIsm4MCH/RyGvcMbLdizbqJwAo=; b=Z5pUOnzborc7znfCPvI44kSI3vF/GNYP8Rwl5YZxRHy7e6AN9/UAeKypK8T3Ktio3f cxXDe6/lcMMqk5EBlTuANqK3oAEa+XMjUW9V4RRwYwF3KmMqTl6S4ZSax6OS8oQJn66G E/JVHY5zGVTMKGRnbMTKpuYB66zWFQVPPX3vcdqCBDpV5gNreTm9sfeg1fUX1HJCFzxd siuzs2ySe/oYy1/7VM1JdPy/EPH1h6usPnIr/MagDUzlXGlVE7wT7MWTHLTtEGJ5bRQh XrYFwk83Dz9Frwvf0BCZbXcCgaXS3xj0gDyPS8b7SVNNCvHKaroYtf0b0DgRXRt4FBk3 MpEw== X-Gm-Message-State: AOAM531cmj4bvkQ0cjmbfuR/qiQ3BX6YWwDEa71mzvEXtWZRErSAPH1p iOqs8nT+QV4ctLF/OjTfFjwZy87RT9Y= X-Google-Smtp-Source: ABdhPJzHu+jFxCBNrL3016ebRhJ66gK+YDVLn7NsPsnYgMpe81sGnmwao86/0wnWJB4OTudSVyg4ww== X-Received: by 2002:a05:6402:26cb:b0:3fa:3817:1f78 with SMTP id x11-20020a05640226cb00b003fa38171f78mr18048316edd.219.1645386712254; Sun, 20 Feb 2022 11:51:52 -0800 (PST) Original-Received: from [192.168.178.20] (ip-109-090-125-150.um36.pools.vodafone-ip.de. [109.90.125.150]) by smtp.gmail.com with ESMTPSA id h2sm4456964ejo.73.2022.02.20.11.51.51 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 20 Feb 2022 11:51:51 -0800 (PST) Content-Language: en-US X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::529 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::529; envelope-from=taylan.kammer@gmail.com; helo=mail-ed1-x529.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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" Xref: news.gmane.io gmane.lisp.guile.user:18111 Archived-At: I'd like to announce the release of bytestructures 2.0.0 for Scheme and Guile in particular. Don't be fooled by the major version bump, there's nothing radically new in this release. :-) https://github.com/TaylanUB/scheme-bytestructures What's new? ----------- This release bumps the major version number since there is one API-breaking change: The indexing semantics of bs:pointer (Guile-specific) have changed from allowing an arbitrary index to implicitly deref the pointer, to allowing only an integer index (besides the symbol '*') to deref with an offset akin to "pointer + offset" in C. Other news in this release: - There is now support for anonymous unions within struct definitions. - The macro API now allows you to define two additional macros via its macro-defining-macro define-bytestructure-accessors. The new generated macros allow you to provide an initial offset into a bytevector when getting or setting values. See relevant sections of the README for detailed documentation. What's bytestructures anyway? ----------------------------- The library offers a system imitating the type system of the C programming language, to be used on bytevectors. C's type system works on raw memory, and ours works on bytevectors which are an abstraction over raw memory in Scheme. The system is in fact more powerful than the C type system, elevating types to first-class status. A C type corresponds to a "bytestructure descriptor" object in our system. ;; typedef uint8_t uint8_v3_t[3]; (define uint8-v3 (bs:vector 3 uint8)) ;; typedef struct { uint16_t x; uint8_v3_t y; } my_struct_t; (define my-struct (bs:struct `((x ,uint16) (y ,uint8-v3)))) These can then be bundled with a bytevector, yielding a "bytestructure" object on which referencing and assignment work in accordance with the types declared in the descriptor. ;; my_struct_t str; (define str (bytestructure my-struct)) ;; my_struct_t str = { 0, 1 }; (define str (bytestructure my-struct #(0 1))) ;; str.y[2] (bytestructure-ref str 'y 2) ;; str.y[2] = 42; (bytestructure-set! str 'y 2 42) If your Scheme implementation supports syntax-case, then a macro-based API is available as well, for when the procedural API is too slow. Full documentation here: https://github.com/TaylanUB/scheme-bytestructures (Apologies for still using GitHub.) -- Taylan