--- a/open-src/app/xcolor/sun-src/HSBmap.c Wed May 18 13:42:51 2011 -0700
+++ b/open-src/app/xcolor/sun-src/HSBmap.c Fri May 20 21:05:21 2011 -0700
@@ -1,7 +1,7 @@
/*-
* HSBmap.c - Create an HSB ramp.
*
- * Copyright (c) 1991, 1995, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1991, 2011, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -29,15 +29,17 @@
#include <sys/types.h>
#include <math.h>
+#include "xcolor.h"
-void
-hsb2rgb(H, S, B, r, g, b)
+static void
+hsb2rgb(
double H,
- S,
- B;
+ double S,
+ double B,
u_char *r,
- *g,
- *b;
+ u_char *g,
+ u_char *b)
+
{
register int i;
register double f,
@@ -90,18 +92,18 @@
void
-HSBramp(h1, s1, b1, h2, s2, b2, start, end, red, green, blue)
+HSBramp(
double h1,
- s1,
- b1,
- h2,
- s2,
- b2;
+ double s1,
+ double b1,
+ double h2,
+ double s2,
+ double b2,
int start,
- end;
+ int end,
u_char *red,
- *green,
- *blue;
+ u_char *green,
+ u_char *blue)
{
double dh,
ds,
--- a/open-src/app/xcolor/sun-src/Makefile Wed May 18 13:42:51 2011 -0700
+++ b/open-src/app/xcolor/sun-src/Makefile Fri May 20 21:05:21 2011 -0700
@@ -1,8 +1,8 @@
###############################################################################
#
-# xcolor 1.x Makefile
+# xcolor Makefile
#
-# Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
@@ -28,7 +28,7 @@
OBJS = HSBmap.o XCrDynCmap.o XCrHsbCmap.o xcolor.o
xcolor: $(OBJS)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) -lX11
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) -lX11 -lm
install: xcolor
mkdir -p $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1
--- a/open-src/app/xcolor/sun-src/XCrDynCmap.c Wed May 18 13:42:51 2011 -0700
+++ b/open-src/app/xcolor/sun-src/XCrDynCmap.c Fri May 20 21:05:21 2011 -0700
@@ -1,7 +1,7 @@
/*-
* XCrDynCmap.c - X11 library routine to create dynamic colormaps.
*
- * Copyright (c) 1990, 1995, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1990, 2011, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -31,22 +31,22 @@
#include <X11/Xos.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include "xcolor.h"
Status
-XCreateDynamicColormap(dsp, screen, cmap, visual, colors,
- count, red, green, blue)
- Display *dsp;
- int screen;
- Colormap *cmap; /* return */
- Visual **visual; /* return */
- XColor *colors;
- int count;
+XCreateDynamicColormap(
+ Display *dsp,
+ int screen,
+ Colormap *cmap, /* return */
+ Visual **visual, /* return */
+ XColor *colors,
+ int count,
u_char *red,
- *green,
- *blue;
+ u_char *green,
+ u_char *blue)
{
XVisualInfo vinfo;
- int pixels[256];
+ unsigned long pixels[256];
int i,
ncolors,
planes;
--- a/open-src/app/xcolor/sun-src/XCrHsbCmap.c Wed May 18 13:42:51 2011 -0700
+++ b/open-src/app/xcolor/sun-src/XCrHsbCmap.c Fri May 20 21:05:21 2011 -0700
@@ -1,7 +1,7 @@
/*-
* XCrHsbCmap.c - X11 library routine to create an HSB ramp colormaps.
*
- * Copyright (c) 1991, 1995, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1991, 2011, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -29,23 +29,22 @@
#include <X11/X.h>
#include <X11/Xos.h>
#include <X11/Xlib.h>
-
-extern void HSBmap();
+#include "xcolor.h"
Status
-XCreateHSBColormap(dsp, screen, cmap, count, h1, s1, b1, h2, s2, b2, bw, visual)
- Display *dsp;
- int screen;
- Colormap *cmap; /* colormap return value */
- int count; /* number of entrys to use */
+XCreateHSBColormap(
+ Display *dsp,
+ int screen,
+ Colormap *cmap, /* colormap return value */
+ int count, /* number of entries to use */
double h1, /* starting hue */
- s1, /* starting saturation */
- b1, /* starting brightness */
- h2, /* ending hue */
- s2, /* ending saturation */
- b2; /* ending brightness */
- int bw; /* Boolean: True = save black and white */
- Visual **visual;
+ double s1, /* starting saturation */
+ double b1, /* starting brightness */
+ double h2, /* ending hue */
+ double s2, /* ending saturation */
+ double b2, /* ending brightness */
+ int bw, /* Boolean: True = save black and white */
+ Visual **visual)
{
u_char red[256];
u_char green[256];
--- a/open-src/app/xcolor/sun-src/xcolor.c Wed May 18 13:42:51 2011 -0700
+++ b/open-src/app/xcolor/sun-src/xcolor.c Fri May 20 21:05:21 2011 -0700
@@ -1,7 +1,7 @@
/*-
* xcolor.c - X11 client to display all colors in current colormap.
*
- * Copyright (c) 1989, 1995, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1989, 2011, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -28,12 +28,14 @@
#include <stdio.h>
+#include <stdlib.h>
#include <math.h>
#include <X11/X.h>
#include <X11/Xos.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
+#include "xcolor.h"
#define DEFX 256
#define DEFY 256
@@ -59,16 +61,15 @@
int cmap_size;
-void
-error(s1, s2)
- char *s1,
- *s2;
+static void
+error(const char *s1, const void *s2)
{
fprintf(stderr, s1, pname, s2);
exit(1);
}
-dumpCmap()
+static void
+dumpCmap(void)
{
register int i;
XColor color[256];
@@ -82,8 +83,8 @@
}
}
-redisplay_indexed(window)
- Window window;
+static void
+redisplay_indexed(Window window)
{
int max;
register int i,
@@ -118,9 +119,8 @@
}
}
-
-redisplay_direct(window)
- Window window;
+static void
+redisplay_direct(Window window)
{
register int i,
j, k;
@@ -182,9 +182,8 @@
}
}
-
-redisplay (w)
- Window w;
+static void
+redisplay (Window w)
{
if (visual->class == TrueColor || visual->class == DirectColor)
redisplay_direct(w);
@@ -192,8 +191,8 @@
redisplay_indexed(w);
}
-
-HandleEvents()
+static void
+HandleEvents(void)
{
XEvent event;
XConfigureEvent *xce = (XConfigureEvent *) & event;
@@ -236,10 +235,11 @@
}
}
-
-main(argc, argv)
- int argc;
- char *argv[];
+int
+main(
+ int argc,
+ char *argv[]
+ )
{
XSetWindowAttributes xswa;
XGCValues xgcv;
@@ -283,15 +283,9 @@
\t[-dump] [-nobw] [-half] [-noinst] [-iconwin]\n", NULL);
}
- /* SUNSOFT_BUYBACK
- if (!(dsp = XOpenDisplay(displayName)))
- error("%s: unable to open display, %s.\n", displayName);
- **********/
if (!(dsp = XOpenDisplay(displayName))) {
- if (displayName)
- error("%s: unable to open display, %s.\n", displayName);
- else
- error("unable to open display\n");
+ error("%s: unable to open display, %s.\n",
+ displayName ? displayName : "no display specified");
}
screen = DefaultScreen(dsp);
@@ -310,7 +304,7 @@
0.0, 1.0, 1.0,
1.0, 1.0, 1.0, !nobw, &visual);
if (stat != Success)
- error("%s: unable create colormap (%d).\n", stat);
+ error("%s: unable create colormap (%d).\n", (void *) stat);
}
size_hints.x = DEFX;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xcolor/sun-src/xcolor.h Fri May 20 21:05:21 2011 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _XCOLOR_H
+#define _XCOLOR_H
+
+#include <sys/types.h>
+#include <X11/X.h>
+#include <X11/Xlib.h>
+
+extern void HSBramp(
+ double h1,
+ double s1,
+ double b1,
+ double h2,
+ double s2,
+ double b2,
+ int start,
+ int end,
+ u_char *red,
+ u_char *green,
+ u_char *blue);
+
+extern Status XCreateDynamicColormap(
+ Display *dsp,
+ int screen,
+ Colormap *cmap, /* return */
+ Visual **visual, /* return */
+ XColor *colors,
+ int count,
+ u_char *red,
+ u_char *green,
+ u_char *blue);
+
+extern Status XCreateHSBColormap(
+ Display *dsp,
+ int screen,
+ Colormap *cmap, /* colormap return value */
+ int count, /* number of entries to use */
+ double h1, /* starting hue */
+ double s1, /* starting saturation */
+ double b1, /* starting brightness */
+ double h2, /* ending hue */
+ double s2, /* ending saturation */
+ double b2, /* ending brightness */
+ int bw, /* Boolean: True = save black and white */
+ Visual **visual);
+
+#endif /* _XCOLOR_H */