From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: David Pirotte Newsgroups: gmane.lisp.guile.user Subject: guile-cairo - patches - new interfaces Date: Sat, 11 Mar 2023 00:10:47 -0300 Message-ID: <20230311001047.00eb3c85@aicha> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/hepwBjfT273gXT1/gilPjAO"; protocol="application/pgp-signature"; micalg=pgp-sha512 Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17686"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sat Mar 11 04:11:34 2023 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 1papdt-0004QH-Uj for guile-user@m.gmane-mx.org; Sat, 11 Mar 2023 04:11:34 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1papdS-0006FI-R2; Fri, 10 Mar 2023 22:11:06 -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 1papdQ-0006En-Uv for guile-user@gnu.org; Fri, 10 Mar 2023 22:11:04 -0500 Original-Received: from pop.all2all.org ([79.99.200.14] helo=moses.all2all.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1papdO-0002TB-Gx for guile-user@gnu.org; Fri, 10 Mar 2023 22:11:04 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by moses.all2all.org (Postfix) with ESMTP id 1E26067C007A for ; Sat, 11 Mar 2023 04:10:57 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at moses.all2all.org Original-Received: from moses.all2all.org ([127.0.0.1]) by localhost (moses.all2all.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NpOCAdOboTps for ; Sat, 11 Mar 2023 04:10:56 +0100 (CET) Original-Received: from aicha (unknown [179.210.48.245]) by moses.all2all.org (Postfix) with ESMTPSA id 9C56567C0078 for ; Sat, 11 Mar 2023 04:10:55 +0100 (CET) X-Mailer: Claws Mail 4.1.1 (GTK 3.24.36; x86_64-pc-linux-gnu) Received-SPF: pass client-ip=79.99.200.14; envelope-from=david@altosw.be; helo=moses.all2all.org X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, 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:18929 Archived-At: --Sig_/hepwBjfT273gXT1/gilPjAO Content-Type: multipart/mixed; boundary="MP_/JTvrRrwQ6WZh5Yw/u8JpUBO" --MP_/JTvrRrwQ6WZh5Yw/u8JpUBO Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hello Daniel, Note that I initially asked(proposed) Dale to write a test and prepare the patch, as he fixed/wrote these new procedures, but he appears to have been 'trapped' by other tasks - Please find attached 3 patches, the third being the most important and related to the addition of the context->cairo-pointer and cairo-pointer->context interfaces. Let me know (on irc is fine) once you have double checked and pushed, thanks. Then, I wish we could release, because this patch [the third one] is essential to be able to use guile-cairo in G-Golf, and I'd rather have asap all distros that package guile-cairo updating ... wdyt? Let me know if you need help. Thanks, David --MP_/JTvrRrwQ6WZh5Yw/u8JpUBO Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=0001-Updating-m4-guile.m4.patch =46rom 3647aff86cde1fb6137a27b4212b2aaaa5f94af1 Mon Sep 17 00:00:00 2001 From: David Pirotte Date: Fri, 10 Mar 2023 23:19:51 -0300 Subject: [PATCH 1/3] Updating m4/guile.m4 * m4/guile.m4: Updated to the latest version available in Guile, which fixes a few minor/micro checks related bug(s). --- m4/guile.m4 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/m4/guile.m4 b/m4/guile.m4 index 57a0868..48642f0 100644 --- a/m4/guile.m4 +++ b/m4/guile.m4 @@ -17,7 +17,7 @@ ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301 USA =20 -# serial 10 +# serial 11 =20 ## Index ## ----- @@ -60,7 +60,10 @@ # @code{AC_SUBST}. # AC_DEFUN([GUILE_PKG], - [PKG_PROG_PKG_CONFIG + [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) + if test "x$PKG_CONFIG" =3D x; then + AC_MSG_ERROR([pkg-config is missing, please install it]) + fi _guile_versions_to_search=3D"m4_default([$1], [3.0 2.2 2.0])" if test -n "$GUILE_EFFECTIVE_VERSION"; then _guile_tmp=3D"" --=20 2.39.2 --MP_/JTvrRrwQ6WZh5Yw/u8JpUBO Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=0002-Some-more-files-we-don-t-want-to-track.patch =46rom d77ef72b737d216593bb6260e8b4740b506da0ac Mon Sep 17 00:00:00 2001 From: David Pirotte Date: Fri, 10 Mar 2023 23:20:37 -0300 Subject: [PATCH 2/3] Some more files we don't want to track * .gitignore: Some more files we don't want to track. --- .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitignore b/.gitignore index 128a5a8..2d6984c 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,12 @@ Makefile.in /config.log /config.status /configure +/configure~ +m4/libtool.m4 +m4/ltoptions.m4 +m4/ltsugar.m4 +m4/ltversion.m4 +m4/lt~obsolete.m4 /build-aux/config.sub /build-aux/config.guess /build-aux/depcomp @@ -30,3 +36,4 @@ Makefile.in /libtool /stamp-h1 /config.h.in~ +tests/unit-tests/*.scm~ \ No newline at end of file --=20 2.39.2 --MP_/JTvrRrwQ6WZh5Yw/u8JpUBO Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=0003-New-context-cairo-pointer-cairo-pointer-context-inte.patch =46rom bc42b58608698321969a51640dec45762de269ad Mon Sep 17 00:00:00 2001 From: David Pirotte Date: Fri, 10 Mar 2023 23:33:35 -0300 Subject: [PATCH 3/3] New context->cairo-pointer cairo-pointer->context interfaces Note: cairo-pointer->context was first written by Daniel Llorens, then fixed by Dale Smith who also wrote context->cairo-pointer. I merely prepared and sent the patch, I wrote the test. Special thanks to both, as cairo-pointer->context is added on my demand, to make guile-cairo usable with G-Golf. * guile-cairo/guile-cairo.c (context->cairo-pointer, cairo-pointer->context): New procedures. * tests/unit-tests/context-pointer.scm: New file, testing the new procedures. * tests/unit-tests/Makefile.am: Updated for the above. --- guile-cairo/guile-cairo.c | 20 +++++++++++++++++-- tests/unit-tests/Makefile.am | 6 ++++-- tests/unit-tests/context-pointer.scm | 29 ++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 tests/unit-tests/context-pointer.scm diff --git a/guile-cairo/guile-cairo.c b/guile-cairo/guile-cairo.c index b298fc8..8d8c0b7 100644 --- a/guile-cairo/guile-cairo.c +++ b/guile-cairo/guile-cairo.c @@ -1,6 +1,10 @@ /* guile-cairo * Copyright (C) 2007, 2011, 2012, 2014, 2018, 2020 Andy Wingo - * + * Copyright (C) 2023 Daniel Llorens + * Copyright (C) 2023 Dale Smith + + David Pirotte + * guile-cairo.c: Cairo for Guile * * This library is free software; you can redistribute it and/or modify @@ -3522,7 +3526,19 @@ cairo_svg_version_to_string (cairo_svg_version_t ver= sion); =20 #endif /* CAIRO_HAS_SVG_SURFACE */ =20 -=0C +SCM_DEFINE_PUBLIC (scm_context2cairo_pointer, "context->cairo-pointer", 1,= 0, 0, + (SCM scr), + "") +{ + return scm_from_pointer (scm_to_cairo (scr), NULL); +} + +SCM_DEFINE_PUBLIC (scm_cairo_pointer2context, "cairo-pointer->context", 1,= 0, 0, + (SCM scr), + "") +{ + return scm_from_cairo ((cairo_t *) scm_to_pointer (scr)); +} =20 void scm_init_cairo (void) diff --git a/tests/unit-tests/Makefile.am b/tests/unit-tests/Makefile.am index c13443d..9bf2316 100644 --- a/tests/unit-tests/Makefile.am +++ b/tests/unit-tests/Makefile.am @@ -1,5 +1,6 @@ # guile-cairo # Copyright (C) 2007,2011 Andy Wingo +# Copyright (C) 2023 David Pirotte # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as @@ -16,8 +17,9 @@ # . =20 TESTS=3D \ - api-stability.scm \ - version.scm + api-stability.scm \ + version.scm \ + context-pointer.scm =20 TESTS_ENVIRONMENT=3D\ API_FILE=3D$(srcdir)/cairo.api $(top_builddir)/env guile -s diff --git a/tests/unit-tests/context-pointer.scm b/tests/unit-tests/contex= t-pointer.scm new file mode 100644 index 0000000..c746e58 --- /dev/null +++ b/tests/unit-tests/context-pointer.scm @@ -0,0 +1,29 @@ +;; guile-cairo unit test +;; Copyright (C) 2023 David Pirotte + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3 of the License, or (at +;; your option) any later version. +;; =20 +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. +;; =20 +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, see . + +(use-modules (unit-test) + (oop goops) + (cairo)) + +(define-class ()) + +(define-method (test-context-pointer (self )) + (let* ((cs (cairo-image-surface-create 'argb32 140 100)) + (cr (cairo-create cs))) + (assert (context->cairo-pointer cr)) + (assert (cairo-pointer->context (context->cairo-pointer cr))))) + +(exit-with-summary (run-all-defined-test-cases)) --=20 2.39.2 --MP_/JTvrRrwQ6WZh5Yw/u8JpUBO-- --Sig_/hepwBjfT273gXT1/gilPjAO Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEhCJlRZtBM3furJHe83T9k6MFetcFAmQL8TcACgkQ83T9k6MF eteG6wgA0RQE2cqH3ZxIe8W04iIH+5kvtznbGcnFf1N8+wAsBIqNtzZkNueUtIx1 Vdj+fhLg3jpZUH0eALGUSygjvfzubMlKWIkiW42+Q8REQONT+6rEjZcsEsV1oWiu 7rSCX4LnPrFaaP0EBG+bS8psPCQ9yNyi0KXhS7amogb/Rq2u9VzYFDeY53TaeZVL ANE9weuUiAwp4Ufli6wxWE+ImmP/v9jpo7rgFCcU1tG74CLqVgXKLca6yVtg+rOm Q2uE7HqNzkSOC94kjZvYh/bT4gk2JgCzrdGy2j4vrwiZdc9Ssx3qDVe8odUFR5CJ q5aHDu8FyE+NHFMKM1vGpj878rCLwA== =C8Ab -----END PGP SIGNATURE----- --Sig_/hepwBjfT273gXT1/gilPjAO--