unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Mark Oteiza <mvoteiza@udel.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Emacs 26.1 release branch created
Date: Fri, 22 Sep 2017 12:59:41 -0400	[thread overview]
Message-ID: <20170922165941.sirfk6qzfvdfw4i2@logos.localdomain> (raw)
In-Reply-To: <83wp4yk7ve.fsf@gnu.org>

On 16/09/17 at 02:58pm, Eli Zaretskii wrote:
> > Date: Sat, 16 Sep 2017 10:51:12 -0400
> > From: Mark Oteiza <mvoteiza@udel.edu>
> > Cc: emacs-devel@gnu.org
> > 
> > making the Lisp functions:
> > 
> > lcms-xyz->jch
> > lcms-jch->jab
> > lcms-jab->jch
> > lcms-jch->xyz
> > 
> > and adding a Lisp variable `lcms-d65-xyz' as the default whitepoint for
> > all the functions in lcms.c that need one.  That should be two commits
> > if I can get all the Windows build stuff correct.
> 
> That can certainly go to emacs-26.
> 
> > I plan to add more, but I can wait for an emacs-26 -> master merge and
> > continue to work on master.
> 
> If you consider the feature fairly complete for a first release, then
> that's fine.  Otherwise we could consider adding more of your code to
> emacs-26, unless you think the development will take a considerable
> time.  In general, once the first pretest is out (which will be
> probably a week or 2 from now), no new features should be added.

I ended up going back on what I said in d24ec5854 after thinking about what
I wanted to add, how the API should look, and going through some iterations
adding those functions.  I think I'll leave it at those three functions for
emacs-26.

In the interest of reducing the amount of (duplicated) code, especially as more
Lisp functions are added, I propose the following.  I followed from your code
and from how it's done in xml.c, not sure if you have a particular reason for
doing it one way or the other.

 src/lcms.c | 75 ++++++++++++++++++++++----------------------------------------
 1 file changed, 26 insertions(+), 49 deletions(-)

diff --git a/src/lcms.c b/src/lcms.c
index a5e527911e..950ffb5f51 100644
--- a/src/lcms.c
+++ b/src/lcms.c
@@ -76,6 +76,26 @@ init_lcms_functions (void)
 
 #endif	/* WINDOWSNT */
 
+static bool
+lcms2_available_p (void)
+{
+#ifdef WINDOWSNT
+  Lisp_Object found = Fassq (Qlcms2, Vlibrary_cache);
+  if (CONSP (found))
+    return NILP (XCDR (found)) ? false : true;
+  else
+    {
+      Lisp_Object status;
+      lcms_initialized = init_lcms_functions ();
+      status = lcms_initialized;
+      Vlibrary_cache = Fcons (Fcons (Qlcms2, status), Vlibrary_cache);
+      return status;
+    }
+#else  /* !WINDOWSNT */
+  return true;
+#endif
+}
+
 static bool
 parse_lab_list (Lisp_Object lab_list, cmsCIELab *color)
 {
@@ -109,15 +129,8 @@ chroma, and hue, respectively. The parameters each default to 1.  */)
   cmsCIELab Lab1, Lab2;
   cmsFloat64Number Kl, Kc, Kh;
 
-#ifdef WINDOWSNT
-  if (!lcms_initialized)
-    lcms_initialized = init_lcms_functions ();
-  if (!lcms_initialized)
-    {
-      message1 ("lcms2 library not found");
-      return Qnil;
-    }
-#endif
+  if (!(init_lcms_functions ()))
+    return Qnil;
 
   if (!(CONSP (color1) && parse_lab_list (color1, &Lab1)))
     signal_error ("Invalid color", color1);
@@ -244,15 +257,8 @@ The default viewing conditions are (20 100 1 1).  */)
   double Jp1, ap1, bp1, Jp2, ap2, bp2;
   double Mp1, Mp2, FL, k, k4;
 
-#ifdef WINDOWSNT
-  if (!lcms_initialized)
-    lcms_initialized = init_lcms_functions ();
-  if (!lcms_initialized)
-    {
-      message1 ("lcms2 library not found");
-      return Qnil;
-    }
-#endif
+  if (!(init_lcms_functions ()))
+    return Qnil;
 
   if (!(CONSP (color1) && parse_xyz_list (color1, &xyz1)))
     signal_error ("Invalid color", color1);
@@ -313,15 +319,8 @@ Valid range of TEMPERATURE is from 4000K to 25000K.  */)
   cmsCIExyY whitepoint;
   cmsCIEXYZ wp;
 
-#ifdef WINDOWSNT
-  if (!lcms_initialized)
-    lcms_initialized = init_lcms_functions ();
-  if (!lcms_initialized)
-    {
-      message1 ("lcms2 library not found");
-      return Qnil;
-    }
-#endif
+  if (!(init_lcms_functions ()))
+    return Qnil;
 
   CHECK_NUMBER_OR_FLOAT (temperature);
 
@@ -332,27 +331,6 @@ Valid range of TEMPERATURE is from 4000K to 25000K.  */)
   return list3 (make_float (wp.X), make_float (wp.Y), make_float (wp.Z));
 }
 
-DEFUN ("lcms2-available-p", Flcms2_available_p, Slcms2_available_p, 0, 0, 0,
-       doc: /* Return t if lcms2 color calculations are available in this instance of Emacs.  */)
-     (void)
-{
-#ifdef WINDOWSNT
-  Lisp_Object found = Fassq (Qlcms2, Vlibrary_cache);
-  if (CONSP (found))
-    return XCDR (found);
-  else
-    {
-      Lisp_Object status;
-      lcms_initialized = init_lcms_functions ();
-      status = lcms_initialized ? Qt : Qnil;
-      Vlibrary_cache = Fcons (Fcons (Qlcms2, status), Vlibrary_cache);
-      return status;
-    }
-#else  /* !WINDOWSNT */
-  return Qt;
-#endif
-}
-
 \f
 /* Initialization */
 void
@@ -360,7 +338,6 @@ syms_of_lcms2 (void)
 {
   defsubr (&Slcms_cie_de2000);
   defsubr (&Slcms_cam02_ucs);
-  defsubr (&Slcms2_available_p);
   defsubr (&Slcms_temp_to_white_point);
 
   Fprovide (intern_c_string ("lcms2"), Qnil);



  reply	other threads:[~2017-09-22 16:59 UTC|newest]

Thread overview: 127+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-16 12:56 Emacs 26.1 release branch created Eli Zaretskii
2017-09-16 13:01 ` Eli Zaretskii
2017-09-16 13:09 ` Mark Oteiza
2017-09-16 13:39   ` Eli Zaretskii
2017-09-16 14:51     ` Mark Oteiza
2017-09-16 14:58       ` Eli Zaretskii
2017-09-22 16:59         ` Mark Oteiza [this message]
2017-09-22 19:59           ` Eli Zaretskii
2017-09-22 20:05             ` Mark Oteiza
2017-09-22 20:11               ` Eli Zaretskii
2017-09-22 20:13                 ` Mark Oteiza
2017-09-29 20:25         ` [PATCH] lcms2 (was Re: Emacs 26.1 release branch created) Mark Oteiza
2017-09-30  9:22           ` Eli Zaretskii
2017-09-16 14:18 ` Emacs 26.1 release branch created Alan Mackenzie
2017-09-16 17:05 ` Rasmus
2017-09-16 17:34   ` Eli Zaretskii
2017-09-18  9:36     ` Rasmus
2017-09-18  9:47       ` Rasmus
2017-09-20 11:45         ` Kaushal Modi
2017-09-20 11:59           ` Nicolas Petton
2017-09-20 12:01             ` Kaushal Modi
2017-09-20 12:17           ` Rasmus
2017-09-20 12:24             ` Kaushal Modi
2017-09-20 13:03               ` Rasmus
2017-09-16 18:06 ` Nicolas Petton
2017-09-16 19:54 ` Lars Ingebrigtsen
2017-09-17  2:31   ` Eli Zaretskii
2017-09-18 16:22 ` Alan Third
2017-09-18 17:36   ` Eli Zaretskii
2017-09-19 17:35 ` Alan Mackenzie
2017-09-19 17:54   ` Eli Zaretskii
2017-09-19 18:09     ` Alan Mackenzie
2017-09-19 18:34       ` Eli Zaretskii
2017-09-19 18:36         ` Eli Zaretskii
2017-09-19 19:11         ` Paul Eggert
2017-09-19 19:43           ` Alan Mackenzie
2017-09-19 20:54             ` About curly quotes (again) [Was: Emacs 26.1 release branch created] Kaushal Modi
2017-09-19 21:09               ` Alan Mackenzie
2017-09-19 23:33                 ` John Wiegley
2017-09-20  0:00                   ` Paul Eggert
2017-09-20  4:16                   ` Marcin Borkowski
2017-09-20  6:17                     ` Noam Postavsky
2017-09-23 11:18                       ` Marcin Borkowski
2017-09-23 12:14                         ` Eli Zaretskii
2017-09-23 19:40                           ` Marcin Borkowski
2017-09-24  2:46                             ` Eli Zaretskii
2017-09-25 13:40                               ` Marcin Borkowski
2017-09-25 18:57                                 ` Eli Zaretskii
2017-09-26 12:39                                   ` Marcin Borkowski
2017-09-29 12:22                                     ` Eli Zaretskii
2017-09-30  7:58                                       ` Marcin Borkowski
2017-09-30  8:31                                         ` Eli Zaretskii
2017-09-30 20:03                                           ` Marcin Borkowski
2017-09-20 17:44                     ` Drew Adams
2017-09-20  6:41                   ` Eli Zaretskii
2017-09-20 14:45                     ` John Wiegley
2017-09-20 14:48                       ` Eli Zaretskii
2017-09-21 17:30                       ` Filipp Gunbin
2017-09-19 23:14             ` Emacs 26.1 release branch created Paul Eggert
2017-09-20  6:41             ` Eli Zaretskii
2017-09-20 13:01             ` Richard Stallman
2017-09-20 13:10               ` Eli Zaretskii
2017-09-20 20:37                 ` Richard Stallman
2017-09-21 20:36                   ` Paul Eggert
     [not found]             ` <<E1duedQ-0002Bs-O3@fencepost.gnu.org>
2017-09-20 17:50               ` Drew Adams
2017-09-20  6:32           ` Eli Zaretskii
2017-09-19 17:58   ` Paul Eggert
2017-09-20 18:30   ` John Wiegley
2017-09-21 20:54     ` Alan Mackenzie
2017-09-22  5:19       ` Paul Eggert
2017-09-22  5:58         ` John Wiegley
2017-09-22 18:04         ` Alan Mackenzie
2017-09-22 18:47           ` John Wiegley
2017-09-22 20:42           ` Paul Eggert
2017-09-24 14:33             ` Alan Mackenzie
2017-09-24 18:13               ` Paul Eggert
2017-09-24 20:18                 ` Alan Mackenzie
2017-09-22  7:17       ` Eli Zaretskii
2017-09-22 18:41         ` Alan Mackenzie
2017-09-22 19:09           ` Stefan Monnier
2017-09-22 19:28           ` John Wiegley
2017-09-22 19:35             ` Alan Mackenzie
2017-09-22 19:46               ` John Wiegley
2017-09-22 22:07                 ` Alan Mackenzie
2017-09-24 14:39                   ` Alan Mackenzie
2017-09-24 18:26                     ` Paul Eggert
2017-09-24 19:41                       ` Alan Mackenzie
2017-09-24 23:16                         ` John Wiegley
2017-09-25  0:08                           ` Paul Eggert
2017-09-25  4:23                             ` John Wiegley
2017-09-25 19:03                               ` Alan Mackenzie
2017-09-25 19:43                                 ` Drew Adams
2017-09-25 20:24                                   ` John Wiegley
2017-09-25 22:25                                     ` Paul Eggert
2017-09-26  2:52                                       ` Drew Adams
2017-09-26  3:23                                         ` Paul Eggert
2017-09-26 19:28                                         ` Philipp Stephani
2017-09-26 20:26                                           ` Alan Mackenzie
2017-09-27  9:15                                             ` Alexis
2017-09-27 22:13                                               ` Richard Stallman
2017-09-28  1:48                                                 ` Alexis
2017-09-27 23:41                                               ` Óscar Fuentes
2017-09-28  1:25                                                 ` Alexis
2017-09-27 11:54                                             ` Philippe Vaucher
2017-09-27 18:43                                               ` Alan Mackenzie
2017-09-28  7:42                                                 ` Philippe Vaucher
2017-09-26 20:33                                           ` Drew Adams
2017-09-29 10:42                                         ` Eli Zaretskii
2017-09-29  9:34                                   ` Eli Zaretskii
     [not found]                                   ` <<83shf597b0.fsf@gnu.org>
2017-09-30  4:06                                     ` Drew Adams
2017-09-30  4:41                                       ` Paul Eggert
2017-09-30 13:58                                         ` Drew Adams
2017-09-25 23:36                                 ` Paul Eggert
2017-09-30 12:10                                   ` Alan Mackenzie
2017-10-01  0:16                                     ` Paul Eggert
2017-10-01 11:37                                       ` Alan Mackenzie
2017-09-25  5:51                         ` Paul Eggert
2017-09-22 19:35           ` Eli Zaretskii
2017-09-27 18:09 ` João Távora
2017-09-27 19:32   ` John Wiegley
2017-09-28  7:28     ` João Távora
2017-09-28  7:28     ` João Távora
2017-09-28 16:58       ` John Wiegley
2017-09-29 15:44   ` Eli Zaretskii
2017-09-29 17:04     ` João Távora
2017-09-29 18:11       ` Eli Zaretskii
2017-09-29 18:13         ` John Wiegley
     [not found] <<83377mls4d.fsf@gnu.org>
     [not found] <<m28th6ilcn.fsf@newartisans.com>

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170922165941.sirfk6qzfvdfw4i2@logos.localdomain \
    --to=mvoteiza@udel.edu \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).