diff options
Diffstat (limited to 'xlib/xcolors.c')
-rw-r--r-- | xlib/xcolors.c | 81 |
1 files changed, 43 insertions, 38 deletions
diff --git a/xlib/xcolors.c b/xlib/xcolors.c index 7e88b2a..b1d1f27 100644 --- a/xlib/xcolors.c +++ b/xlib/xcolors.c @@ -1,28 +1,39 @@ -/* +/* * xcolors.c -- * - * This file contains the routines used to map from X color - * names to RGB and pixel values. + * This file contains the routines used to map from X color names to RGB + * and pixel values. * * Copyright (c) 1996 by Sun Microsystems, Inc. * - * See the file "license.terms" for information on usage and redistribution - * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include <tkInt.h> /* + * This value will be set to the number of colors in the color table + * the first time it is needed. + */ + +static int numXColors = 0; + +/* + * Forward declarations for functions used only in this file. + */ + +static int FindColor(const char *name, XColor *colorPtr); + +/* * Define an array that defines the mapping from color names to RGB values. - * Note that this array must be kept sorted alphabetically so that the - * binary search used in XParseColor will succeed. + * Note that this array must be kept sorted alphabetically so that the binary + * search used in XParseColor will succeed. */ typedef struct { char *name; - unsigned char red; - unsigned char green; - unsigned char blue; + unsigned char red, green, blue; } XColorEntry; static XColorEntry xColors[] = { @@ -780,32 +791,18 @@ static XColorEntry xColors[] = { { "YellowGreen", 154, 205, 50 }, { NULL, 0, 0, 0 } }; - - -/* - * This value will be set to the number of colors in the color table - * the first time it is needed. - */ - -static int numXColors = 0; - -/* - * Forward declarations for functions used only in this file. - */ - -static int FindColor _ANSI_ARGS_((const char *name, XColor *colorPtr)); /* *---------------------------------------------------------------------- * * FindColor -- * - * This routine finds the color entry that corresponds to the - * specified color. + * This routine finds the color entry that corresponds to the specified + * color. * * Results: - * Returns non-zero on success. The RGB values of the XColor - * will be initialized to the proper values on success. + * Returns non-zero on success. The RGB values of the XColor will be + * initialized to the proper values on success. * * Side effects: * None. @@ -814,15 +811,15 @@ static int FindColor _ANSI_ARGS_((const char *name, XColor *colorPtr)); */ static int -FindColor(name, colorPtr) - const char *name; - XColor *colorPtr; +FindColor( + const char *name, + XColor *colorPtr) { int l, u, r, i = 0; /* - * Count the number of elements in the color array if we haven't - * done so yet. + * Count the number of elements in the color array if we haven't done so + * yet. */ if (numXColors == 0) { @@ -875,11 +872,11 @@ FindColor(name, colorPtr) */ Status -XParseColor(display, map, spec, colorPtr) - Display *display; - Colormap map; - const char* spec; - XColor *colorPtr; +XParseColor( + Display *display, + Colormap map, + const char *spec, + XColor *colorPtr) { if (spec[0] == '#') { char *p; @@ -919,3 +916,11 @@ XParseColor(display, map, spec, colorPtr) colorPtr->pad = 0; return 1; } + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ |