unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* guile-cairo - patches - new interfaces
@ 2023-03-11  3:10 David Pirotte
  2023-03-21 16:07 ` lloda
  0 siblings, 1 reply; 2+ messages in thread
From: David Pirotte @ 2023-03-11  3:10 UTC (permalink / raw)
  To: guile-user


[-- Attachment #1.1: Type: text/plain, Size: 703 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Updating-m4-guile.m4.patch --]
[-- Type: text/x-patch, Size: 1056 bytes --]

From 3647aff86cde1fb6137a27b4212b2aaaa5f94af1 Mon Sep 17 00:00:00 2001
From: David Pirotte <david@altosw.be>
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
 
-# serial 10
+# serial 11
 
 ## 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" = x; then
+    AC_MSG_ERROR([pkg-config is missing, please install it])
+  fi
   _guile_versions_to_search="m4_default([$1], [3.0 2.2 2.0])"
   if test -n "$GUILE_EFFECTIVE_VERSION"; then
     _guile_tmp=""
-- 
2.39.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.3: 0002-Some-more-files-we-don-t-want-to-track.patch --]
[-- Type: text/x-patch, Size: 826 bytes --]

From d77ef72b737d216593bb6260e8b4740b506da0ac Mon Sep 17 00:00:00 2001
From: David Pirotte <david@altosw.be>
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
-- 
2.39.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.4: 0003-New-context-cairo-pointer-cairo-pointer-context-inte.patch --]
[-- Type: text/x-patch, Size: 4573 bytes --]

From bc42b58608698321969a51640dec45762de269ad Mon Sep 17 00:00:00 2001
From: David Pirotte <david@altosw.be>
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 <wingo at pobox dot com>
- *
+ * Copyright (C) 2023  Daniel Llorens <daniel.llorens@bluewin.ch>
+ * Copyright (C) 2023  Dale Smith <dalepsmith@gmail.com>
+
+ David Pirotte <david@altosw.be>
+
  * 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 version);
 
 #endif /* CAIRO_HAS_SVG_SURFACE */
 
-\f
+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));
+}
 
 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 <wingo@pobox.com>
+# Copyright (C) 2023  David Pirotte <david@altosw.be>
 #
 # 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 @@
 # <http://www.gnu.org/licenses/>.
 
 TESTS= \
-	api-stability.scm \
-	version.scm
+	api-stability.scm	\
+	version.scm		\
+	context-pointer.scm
 
 TESTS_ENVIRONMENT=\
 	API_FILE=$(srcdir)/cairo.api $(top_builddir)/env guile -s
diff --git a/tests/unit-tests/context-pointer.scm b/tests/unit-tests/context-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 <david@altosw.be>
+
+;; 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.
+;;                                                                  
+;; 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.
+;;                                                                  
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(use-modules (unit-test)
+             (oop goops)
+             (cairo))
+
+(define-class <test-context-pointer> (<test-case>))
+
+(define-method (test-context-pointer (self <test-context-pointer>))
+  (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))
-- 
2.39.2


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: guile-cairo - patches - new interfaces
  2023-03-11  3:10 guile-cairo - patches - new interfaces David Pirotte
@ 2023-03-21 16:07 ` lloda
  0 siblings, 0 replies; 2+ messages in thread
From: lloda @ 2023-03-21 16:07 UTC (permalink / raw)
  To: David Pirotte; +Cc: guile-user


Not to leave this thread hanging, just to mention that these patches have been applied to guile-cairo at dc0c2821fa7e1ab8b522ff1c2c8987a91a1595f2 ff.

Thank you!




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-21 16:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-11  3:10 guile-cairo - patches - new interfaces David Pirotte
2023-03-21 16:07 ` lloda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).