[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs 26.1 release branch created
From: |
Mark Oteiza |
Subject: |
Re: Emacs 26.1 release branch created |
Date: |
Fri, 22 Sep 2017 12:59:41 -0400 |
User-agent: |
NeoMutt/20170912-13-728bb5 |
On 16/09/17 at 02:58pm, Eli Zaretskii wrote:
> > Date: Sat, 16 Sep 2017 10:51:12 -0400
> > From: Mark Oteiza <address@hidden>
> > Cc: address@hidden
> >
> > 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
-}
-
/* 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);
- Emacs 26.1 release branch created, Eli Zaretskii, 2017/09/16
- Re: Emacs 26.1 release branch created, Eli Zaretskii, 2017/09/16
- Re: Emacs 26.1 release branch created, Mark Oteiza, 2017/09/16
- Re: Emacs 26.1 release branch created, Eli Zaretskii, 2017/09/16
- Re: Emacs 26.1 release branch created, Mark Oteiza, 2017/09/16
- Re: Emacs 26.1 release branch created, Eli Zaretskii, 2017/09/16
- Re: Emacs 26.1 release branch created,
Mark Oteiza <=
- Re: Emacs 26.1 release branch created, Eli Zaretskii, 2017/09/22
- Re: Emacs 26.1 release branch created, Mark Oteiza, 2017/09/22
- Re: Emacs 26.1 release branch created, Eli Zaretskii, 2017/09/22
- Re: Emacs 26.1 release branch created, Mark Oteiza, 2017/09/22
- [PATCH] lcms2 (was Re: Emacs 26.1 release branch created), Mark Oteiza, 2017/09/29
- Re: [PATCH] lcms2 (was Re: Emacs 26.1 release branch created), Eli Zaretskii, 2017/09/30
Re: Emacs 26.1 release branch created, Alan Mackenzie, 2017/09/16
Re: Emacs 26.1 release branch created, Rasmus, 2017/09/16