diff options
Diffstat (limited to 'src/xcms')
58 files changed, 840 insertions, 945 deletions
diff --git a/src/xcms/AddDIC.c b/src/xcms/AddDIC.c index aefae0f..02b3194 100644 --- a/src/xcms/AddDIC.c +++ b/src/xcms/AddDIC.c @@ -32,9 +32,11 @@ * * */ +/* $XFree86: xc/lib/X11/AddDIC.c,v 1.2 2003/04/13 19:22:14 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" +#include "Cv.h" /* @@ -44,15 +46,6 @@ (XCMS_UNREG_ID(lastid) ? ++lastid : XCMS_FIRST_UNREG_DI_ID) #define MAX(x,y) ((x) < (y) ? (y) : (x)) - -/* - * EXTERNS - */ -extern XcmsPerDpyInfo *_XcmsFindDpyInfo(); -extern XPointer *_XcmsPushPointerArray(); -extern XcmsColorFormat _XcmsRegFormatOfPrefix(); -extern XcmsColorSpace **_XcmsDIColorSpaces; -extern XcmsColorSpace *_XcmsDIColorSpacesInit[]; /* * NAME diff --git a/src/xcms/AddSF.c b/src/xcms/AddSF.c index 5c2ae54..9fab20f 100644 --- a/src/xcms/AddSF.c +++ b/src/xcms/AddSF.c @@ -32,9 +32,11 @@ * * */ +/* $XFree86: xc/lib/X11/AddSF.c,v 1.2 2003/04/13 19:22:14 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" +#include "Cv.h" /* * DEFINES @@ -43,18 +45,6 @@ (XCMS_UNREG_ID(lastid) ? ++lastid : XCMS_FIRST_UNREG_DD_ID) #define MIN(x,y) ((x) > (y) ? (y) : (x)) - -/* - * EXTERNS - */ -extern XPointer *_XcmsPushPointerArray(); -extern XcmsColorFormat _XcmsRegFormatOfPrefix(); -extern XcmsFunctionSet **_XcmsSCCFuncSets; -extern XcmsFunctionSet **_XcmsSCCFuncSetsInit; -extern XcmsColorSpace **_XcmsDDColorSpaces; -extern XcmsColorSpace **_XcmsDDColorSpacesInit; - - /* * NAME diff --git a/src/xcms/CCC.c b/src/xcms/CCC.c index a9b8272..c4e8282 100644 --- a/src/xcms/CCC.c +++ b/src/xcms/CCC.c @@ -33,7 +33,7 @@ * * */ -/* $XFree86: xc/lib/X11/CCC.c,v 1.4 2001/12/14 19:53:56 dawes Exp $ */ +/* $XFree86: xc/lib/X11/CCC.c,v 1.5 2003/04/13 19:22:14 dawes Exp $ */ /* @@ -66,14 +66,7 @@ from The Open Group. #include <stdio.h> #include "Xlibint.h" #include "Xcmsint.h" - -extern XcmsIntensityMap *_XcmsGetIntensityMap(); - -/* cmsInt.c */ -extern int _XcmsInitDefaultCCCs(); -extern int _XcmsInitScrnInfo(); - - +#include "Cv.h" diff --git a/src/xcms/Cv.h b/src/xcms/Cv.h new file mode 100644 index 0000000..08969e0 --- /dev/null +++ b/src/xcms/Cv.h @@ -0,0 +1,190 @@ +/* $XFree86: xc/lib/X11/Cv.h,v 1.2 2003/04/17 02:06:31 dawes Exp $ */ + +#ifndef _CV_H_ +#define _CV_H_ + +/* variables */ +extern const char _XcmsCIEXYZ_prefix[]; +extern const char _XcmsCIEuvY_prefix[]; +extern const char _XcmsCIExyY_prefix[]; +extern const char _XcmsCIELab_prefix[]; +extern const char _XcmsCIELuv_prefix[]; +extern const char _XcmsTekHVC_prefix[]; +extern const char _XcmsRGBi_prefix[]; +extern const char _XcmsRGB_prefix[]; + +extern XcmsColorSpace XcmsUNDEFINEDColorSpace; +extern XcmsColorSpace XcmsTekHVCColorSpace; +extern XcmsColorSpace XcmsCIEXYZColorSpace; +extern XcmsColorSpace XcmsCIEuvYColorSpace; +extern XcmsColorSpace XcmsCIExyYColorSpace; +extern XcmsColorSpace XcmsCIELabColorSpace; +extern XcmsColorSpace XcmsCIELuvColorSpace; +extern XcmsColorSpace XcmsRGBColorSpace; +extern XcmsColorSpace XcmsRGBiColorSpace; + +extern XcmsColorSpace *_XcmsDIColorSpacesInit[]; +extern XcmsColorSpace **_XcmsDIColorSpaces; + +extern XcmsColorSpace *_XcmsDDColorSpacesInit[]; +extern XcmsColorSpace **_XcmsDDColorSpaces; + +extern XcmsFunctionSet XcmsLinearRGBFunctionSet; + +extern XcmsFunctionSet *_XcmsSCCFuncSetsInit[]; +extern XcmsFunctionSet **_XcmsSCCFuncSets; + +extern XcmsRegColorSpaceEntry _XcmsRegColorSpaces[]; + +/* functions */ +extern XPointer * +_XcmsCopyPointerArray( + XPointer *pap); +extern void +_XcmsFreePointerArray( + XPointer *pap); +extern XPointer * +_XcmsPushPointerArray( + XPointer *pap, + XPointer p, + XPointer *papNoFree); +extern Status +_XcmsCIEXYZ_ValidSpec( + XcmsColor *pColor); +extern Status +_XcmsCIEuvY_ValidSpec( + XcmsColor *pColor); +extern int +_XcmsTekHVC_CheckModify( + XcmsColor *pColor); + +extern Status +_XcmsTekHVCQueryMaxVCRGB( + XcmsCCC ccc, + XcmsFloat hue, + XcmsColor *pColor_return, + XcmsRGBi *pRGB_return); +extern Status +_XcmsCIELabQueryMaxLCRGB( + XcmsCCC ccc, + XcmsFloat hue, /* hue in radians */ + XcmsColor *pColor_return, + XcmsRGBi *pRGB_return); +extern Status +_XcmsConvertColorsWithWhitePt( + XcmsCCC ccc, + XcmsColor *pColors_in_out, + XcmsColor *pWhitePt, + unsigned int nColors, + XcmsColorFormat newFormat, + Bool *pCompressed); + +extern Status +_XcmsDIConvertColors( + XcmsCCC ccc, + XcmsColor *pColors_in_out, + XcmsColor *pWhitePt, + unsigned int nColors, + XcmsColorFormat newFormat); +extern Status +_XcmsDDConvertColors( + XcmsCCC ccc, + XcmsColor *pColors_in_out, + unsigned int nColors, + XcmsColorFormat newFormat, + Bool *pCompressed); +extern XcmsColorFormat +_XcmsRegFormatOfPrefix( + _Xconst char *prefix); +extern void +_XColor_to_XcmsRGB( + XcmsCCC ccc, + XColor *pXColors, + XcmsColor *pColors, + unsigned int nColors); +extern Status +_XcmsSetGetColor( + Status (*xColorProc)( + Display* /* display */, + Colormap /* colormap */, + XColor* /* screen_in_out */), + Display *dpy, + Colormap cmap, + XcmsColor *pColors_in_out, + XcmsColorFormat result_format, + Bool *pCompressed); +extern Status +_XcmsSetGetColors( + Status (*xColorProc)( + Display* /* display */, + Colormap /* colormap */, + XColor* /* screen_in_out */, + int /* nColors */), + Display *dpy, + Colormap cmap, + XcmsColor *pColors_in_out, + int nColors, + XcmsColorFormat result_format, + Bool *pCompressed); +extern Status +_XcmsCIELuvQueryMaxLCRGB( + XcmsCCC ccc, + XcmsFloat hue, /* hue in radians */ + XcmsColor *pColor_return, + XcmsRGBi *pRGB_return); + +extern XcmsIntensityMap * +_XcmsGetIntensityMap( + Display *dpy, + Visual *visual); +extern int +_XcmsInitDefaultCCCs( + Display *dpy); +extern int +_XcmsInitScrnInfo( + register Display *dpy, + int screenNumber); +extern XcmsCmapRec * +_XcmsCopyCmapRecAndFree( + Display *dpy, + Colormap src_cmap, + Colormap copy_cmap); +extern void +_XcmsCopyISOLatin1Lowered( + char *dst, + const char *src); +extern int +_XcmsEqualWhitePts( + XcmsCCC ccc, XcmsColor *pWhitePt1, XcmsColor *pWhitePt2); +extern int +_XcmsLRGB_InitScrnDefault( + Display *dpy, + int screenNumber, + XcmsPerScrnInfo *pPerScrnInfo); +extern void +_XcmsFreeIntensityMaps( + Display *dpy); +extern int +_XcmsGetProperty( + Display *pDpy, + Window w, + Atom property, + int *pFormat, + unsigned long *pNItems, + unsigned long *pNBytes, + char **pValue); +extern unsigned long +_XcmsGetElement( + int format, + char **pValue, + unsigned long *pCount); +extern void +_XcmsUnresolveColor( + XcmsCCC ccc, + XcmsColor *pColor); +extern void +_XcmsResolveColor( + XcmsCCC ccc, + XcmsColor *pXcmsColor); + +#endif /* _CV_H_ */ diff --git a/src/xcms/CvColW.c b/src/xcms/CvColW.c index 34be833..2ba67f0 100644 --- a/src/xcms/CvColW.c +++ b/src/xcms/CvColW.c @@ -33,16 +33,11 @@ * * */ -/* $XFree86: xc/lib/X11/CvColW.c,v 1.3 2001/01/17 19:41:34 dawes Exp $ */ +/* $XFree86: xc/lib/X11/CvColW.c,v 1.4 2003/04/13 19:22:15 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" - -/* EXTERNS */ -/* CvCols.c */ -extern Status _XcmsDDConvertColors(); -extern Status _XcmsDIConvertColors(); - +#include "Cv.h" /************************************************************************ @@ -59,14 +54,13 @@ extern Status _XcmsDIConvertColors(); * SYNOPSIS */ Status -_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePt, nColors, - newFormat, pCompressed) - XcmsCCC ccc; - XcmsColor *pColors_in_out; - XcmsColor *pWhitePt; - unsigned int nColors; - XcmsColorFormat newFormat; - Bool *pCompressed; +_XcmsConvertColorsWithWhitePt( + XcmsCCC ccc, + XcmsColor *pColors_in_out, + XcmsColor *pWhitePt, + unsigned int nColors, + XcmsColorFormat newFormat, + Bool *pCompressed) /* * DESCRIPTION * Convert XcmsColor structures between device-independent diff --git a/src/xcms/CvCols.c b/src/xcms/CvCols.c index 1c16de1..0062da0 100644 --- a/src/xcms/CvCols.c +++ b/src/xcms/CvCols.c @@ -33,20 +33,11 @@ * * */ -/* $XFree86: xc/lib/X11/CvCols.c,v 1.3 2001/01/17 19:41:34 dawes Exp $ */ +/* $XFree86: xc/lib/X11/CvCols.c,v 1.5 2003/11/03 03:46:26 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" - -/* - * EXTERNS - * External declarations required locally to this package - * that are not already declared in any of the included header - * files (external includes or internal includes). - */ -extern XcmsRegColorSpaceEntry _XcmsRegColorSpaces[]; -extern XcmsColorSpace **_XcmsDIColorSpaces; -extern XcmsColorSpace **_XcmsDDColorSpaces; +#include "Cv.h" /* * LOCAL DEFINES @@ -58,13 +49,6 @@ extern XcmsColorSpace **_XcmsDDColorSpaces; # define MAX(x,y) ((x) > (y) ? (x) : (y)) #endif -/* - * FORWARD DECLARATIONS - */ -Status _XcmsDIConvertColors(); -Status _XcmsDDConvertColors(); -int _XcmsEqualWhitePts(); - /************************************************************************ * * @@ -79,8 +63,8 @@ int _XcmsEqualWhitePts(); * SYNOPSIS */ static int -EqualCIEXYZ(p1, p2) - XcmsColor *p1, *p2; +EqualCIEXYZ( + XcmsColor *p1, XcmsColor *p2) /* * DESCRIPTION * Compares two XcmsColor structures that are in XcmsCIEXYZFormat @@ -109,9 +93,9 @@ EqualCIEXYZ(p1, p2) * SYNOPSIS */ static XcmsColorSpace * -ColorSpaceOfID(ccc, id) - XcmsCCC ccc; - XcmsColorFormat id; +ColorSpaceOfID( + XcmsCCC ccc, + XcmsColorFormat id) /* * DESCRIPTION * Returns a pointer to the color space structure @@ -166,8 +150,8 @@ ColorSpaceOfID(ccc, id) * SYNOPSIS */ static int -ValidDIColorSpaceID(id) - XcmsColorFormat id; +ValidDIColorSpaceID( + XcmsColorFormat id) /* * DESCRIPTION * Determines if the specified color space ID is a valid @@ -199,9 +183,9 @@ ValidDIColorSpaceID(id) * SYNOPSIS */ static int -ValidDDColorSpaceID(ccc, id) - XcmsCCC ccc; - XcmsColorFormat id; +ValidDDColorSpaceID( + XcmsCCC ccc, + XcmsColorFormat id) /* * DESCRIPTION * Determines if the specified color space ID is a valid @@ -234,14 +218,13 @@ ValidDDColorSpaceID(ccc, id) * SYNOPSIS */ static Status -ConvertMixedColors(ccc, pColors_in_out, pWhitePt, nColors, - targetFormat, format_flag) - XcmsCCC ccc; - XcmsColor *pColors_in_out; - XcmsColor *pWhitePt; - unsigned int nColors; - XcmsColorFormat targetFormat; - unsigned char format_flag; +ConvertMixedColors( + XcmsCCC ccc, + XcmsColor *pColors_in_out, + XcmsColor *pWhitePt, + unsigned int nColors, + XcmsColorFormat targetFormat, + unsigned char format_flag) /* * DESCRIPTION * This routine will only convert the following types of @@ -376,9 +359,7 @@ ConvertMixedColors(ccc, pColors_in_out, pWhitePt, nColors, * SYNOPSIS */ int -_XcmsEqualWhitePts(ccc, pWhitePt1, pWhitePt2) - XcmsCCC ccc; - XcmsColor *pWhitePt1, *pWhitePt2; +_XcmsEqualWhitePts(XcmsCCC ccc, XcmsColor *pWhitePt1, XcmsColor *pWhitePt2) /* * DESCRIPTION * @@ -417,13 +398,12 @@ _XcmsEqualWhitePts(ccc, pWhitePt1, pWhitePt2) * SYNOPSIS */ Status -_XcmsDIConvertColors(ccc, pColors_in_out, pWhitePt, nColors, - newFormat) - XcmsCCC ccc; - XcmsColor *pColors_in_out; - XcmsColor *pWhitePt; - unsigned int nColors; - XcmsColorFormat newFormat; +_XcmsDIConvertColors( + XcmsCCC ccc, + XcmsColor *pColors_in_out, + XcmsColor *pWhitePt, + unsigned int nColors, + XcmsColorFormat newFormat) /* * DESCRIPTION * Convert XcmsColor structures to another Device-Independent @@ -447,10 +427,10 @@ _XcmsDIConvertColors(ccc, pColors_in_out, pWhitePt, nColors, */ { XcmsColorSpace *pFrom, *pTo; - XcmsConversionProc *src_to_CIEXYZ, *src_from_CIEXYZ; - XcmsConversionProc *dest_to_CIEXYZ, *dest_from_CIEXYZ; - XcmsConversionProc *to_CIEXYZ_stop, *from_CIEXYZ_start; - XcmsConversionProc *tmp; + XcmsDIConversionProc *src_to_CIEXYZ, *src_from_CIEXYZ; + XcmsDIConversionProc *dest_to_CIEXYZ, *dest_from_CIEXYZ; + XcmsDIConversionProc *to_CIEXYZ_stop, *from_CIEXYZ_start; + XcmsDIConversionProc *tmp; /* * Allow pWhitePt to equal NULL. This appropriate when converting @@ -562,13 +542,12 @@ Continue: * SYNOPSIS */ Status -_XcmsDDConvertColors(ccc, pColors_in_out, nColors, newFormat, - pCompressed) - XcmsCCC ccc; - XcmsColor *pColors_in_out; - unsigned int nColors; - XcmsColorFormat newFormat; - Bool *pCompressed; +_XcmsDDConvertColors( + XcmsCCC ccc, + XcmsColor *pColors_in_out, + unsigned int nColors, + XcmsColorFormat newFormat, + Bool *pCompressed) /* * DESCRIPTION * Convert XcmsColor structures: @@ -599,10 +578,10 @@ _XcmsDDConvertColors(ccc, pColors_in_out, nColors, newFormat, */ { XcmsColorSpace *pFrom, *pTo; - XcmsConversionProc *src_to_CIEXYZ, *src_from_CIEXYZ; - XcmsConversionProc *dest_to_CIEXYZ, *dest_from_CIEXYZ; - XcmsConversionProc *from_CIEXYZ_start, *to_CIEXYZ_stop; - XcmsConversionProc *tmp; + XcmsDDConversionProc *src_to_CIEXYZ, *src_from_CIEXYZ; + XcmsDDConversionProc *dest_to_CIEXYZ, *dest_from_CIEXYZ; + XcmsDDConversionProc *from_CIEXYZ_start, *to_CIEXYZ_stop; + XcmsDDConversionProc *tmp; int retval; int hasCompressed = 0; @@ -642,10 +621,10 @@ _XcmsDDConvertColors(ccc, pColors_in_out, nColors, newFormat, return(XcmsFailure); } - src_to_CIEXYZ = pFrom->to_CIEXYZ; - src_from_CIEXYZ = pFrom->from_CIEXYZ; - dest_to_CIEXYZ = pTo->to_CIEXYZ; - dest_from_CIEXYZ = pTo->from_CIEXYZ; + src_to_CIEXYZ = (XcmsDDConversionProc *)pFrom->to_CIEXYZ; + src_from_CIEXYZ = (XcmsDDConversionProc *)pFrom->from_CIEXYZ; + dest_to_CIEXYZ = (XcmsDDConversionProc *)pTo->to_CIEXYZ; + dest_from_CIEXYZ = (XcmsDDConversionProc *)pTo->from_CIEXYZ; if (pTo->inverse_flag && pFrom->inverse_flag) { /* @@ -1026,8 +1005,8 @@ Failure: * SYNOPSIS */ XcmsColorFormat -_XcmsRegFormatOfPrefix(prefix) - char *prefix; +_XcmsRegFormatOfPrefix( + _Xconst char *prefix) /* * DESCRIPTION * Returns a color space ID associated with the specified diff --git a/src/xcms/HVC.c b/src/xcms/HVC.c index 894e8dd..22f7a64 100644 --- a/src/xcms/HVC.c +++ b/src/xcms/HVC.c @@ -47,12 +47,13 @@ * DOCUMENTATION * "TekColor Color Management System, System Implementor's Manual" */ -/* $XFree86: xc/lib/X11/HVC.c,v 1.3 2001/01/17 19:41:37 dawes Exp $ */ +/* $XFree86: xc/lib/X11/HVC.c,v 1.4 2003/04/13 19:22:16 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" #include <X11/Xos.h> #include <math.h> +#include "Cv.h" #include <stdio.h> @@ -93,24 +94,10 @@ #endif /* - * EXTERNS - */ - -extern char _XcmsTekHVC_prefix[]; - -/* CvCols.c */ -extern Status _XcmsDIConvertColors(); - -/* uvY.c */ -extern Status _XcmsCIEuvY_ValidSpec(); - -/* * FORWARD DECLARATIONS */ - -static int TekHVC_ParseString(); -static Status XcmsTekHVC_ValidSpec(); - +static int TekHVC_ParseString(register char *spec, XcmsColor *pColor); +static Status XcmsTekHVC_ValidSpec(XcmsColor *pColor); /* * LOCAL VARIABLES @@ -167,9 +154,9 @@ XcmsColorSpace XcmsTekHVCColorSpace = * SYNOPSIS */ static int -TekHVC_ParseString(spec, pColor) - register char *spec; - XcmsColor *pColor; +TekHVC_ParseString( + register char *spec, + XcmsColor *pColor) /* * DESCRIPTION * This routines takes a string and attempts to convert @@ -225,9 +212,9 @@ TekHVC_ParseString(spec, pColor) * SYNOPSIS */ static int -ThetaOffset(pWhitePt, pThetaOffset) - XcmsColor *pWhitePt; - XcmsFloat *pThetaOffset; +ThetaOffset( + XcmsColor *pWhitePt, + XcmsFloat *pThetaOffset) /* * DESCRIPTION * This routine computes the theta offset of a given @@ -274,8 +261,8 @@ ThetaOffset(pWhitePt, pThetaOffset) * SYNOPSIS */ static int -XcmsTekHVC_ValidSpec(pColor) - XcmsColor *pColor; +XcmsTekHVC_ValidSpec( + XcmsColor *pColor) /* * DESCRIPTION * Checks if values in the color specification are valid. @@ -576,8 +563,8 @@ XcmsCIEuvYToTekHVC(ccc, pHVC_WhitePt, pColors_in_out, nColors) * SYNOPSIS */ int -_XcmsTekHVC_CheckModify(pColor) - XcmsColor *pColor; +_XcmsTekHVC_CheckModify( + XcmsColor *pColor) /* * DESCRIPTION * Checks if values in the color specification are valid. diff --git a/src/xcms/HVCGcC.c b/src/xcms/HVCGcC.c index 9260c39..356bcc1 100644 --- a/src/xcms/HVCGcC.c +++ b/src/xcms/HVCGcC.c @@ -43,19 +43,11 @@ * Source for XcmsTekHVCClipC() gamut compression routine. * */ -/* $XFree86: xc/lib/X11/HVCGcC.c,v 1.3 2001/01/17 19:41:37 dawes Exp $ */ +/* $XFree86: xc/lib/X11/HVCGcC.c,v 1.4 2003/04/13 19:22:16 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" - -/* - * EXTERNS - */ -extern XcmsColorSpace XcmsTekHVCColorSpace; -extern XcmsFunctionSet XcmsLinearRGBFunctionSet; - -/* CvCols.c */ -extern Status _XcmsDIConvertColors(); +#include "Cv.h" /************************************************************************ diff --git a/src/xcms/HVCGcV.c b/src/xcms/HVCGcV.c index eeb6262..5f3a2e8 100644 --- a/src/xcms/HVCGcV.c +++ b/src/xcms/HVCGcV.c @@ -43,26 +43,11 @@ * Source for XcmsTekHVCClipV() gamut compression routine. * */ -/* $XFree86: xc/lib/X11/HVCGcV.c,v 1.3 2001/01/17 19:41:37 dawes Exp $ */ +/* $XFree86: xc/lib/X11/HVCGcV.c,v 1.4 2003/04/13 19:22:16 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" - -/* - * EXTERNS - */ -extern Status _XcmsTekHVC_CheckModify(); -extern XcmsColorSpace XcmsTekHVCColorSpace; -extern XcmsFunctionSet XcmsLinearRGBFunctionSet; - -/* CvCols.c */ -extern Status _XcmsDIConvertColors(); - -/* HVCMxVC.c */ -extern Status _XcmsTekHVCQueryMaxVCRGB(); - - - +#include "Cv.h" /************************************************************************ diff --git a/src/xcms/HVCGcVC.c b/src/xcms/HVCGcVC.c index d1cebc8..905161c 100644 --- a/src/xcms/HVCGcVC.c +++ b/src/xcms/HVCGcVC.c @@ -43,11 +43,12 @@ * Source for XcmsTekHVCClipVC() gamut * compression function. */ -/* $XFree86: xc/lib/X11/HVCGcVC.c,v 1.3 2001/01/17 19:41:37 dawes Exp $ */ +/* $XFree86: xc/lib/X11/HVCGcVC.c,v 1.4 2003/04/13 19:22:16 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" #include <math.h> +#include "Cv.h" /* * INTERNALS @@ -56,20 +57,6 @@ */ #define MAXBISECTCOUNT 100 -/* - * EXTERNS - */ -extern int _XcmsTekHVC_CheckModify(); -extern Status _XcmsTekHVCQueryMaxVCRGB(); -extern XcmsColorSpace XcmsTekHVCColorSpace; -extern XcmsFunctionSet XcmsLinearRGBFunctionSet; - -/* CvCols.c */ -extern Status _XcmsDIConvertColors(); - -/* CvColW.c */ -extern Status _XcmsConvertColorsWithWhitePt(); - /************************************************************************ * * diff --git a/src/xcms/HVCMnV.c b/src/xcms/HVCMnV.c index f66e0e1..055d47b 100644 --- a/src/xcms/HVCMnV.c +++ b/src/xcms/HVCMnV.c @@ -43,22 +43,17 @@ * Source for XcmsTekHVCQueryMinV gamut boundary querying routine. * */ +/* $XFree86: xc/lib/X11/HVCMnV.c,v 1.2 2003/04/13 19:22:16 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" +#include "Cv.h" /* * DEFINES */ #define EPS 0.001 -/* - * EXTERNS - */ -extern Status _XcmsTekHVCQueryMaxVCRGB(); -extern Status _XcmsTekHVC_CheckModify(); -extern XcmsColorSpace XcmsTekHVCColorSpace; - /************************************************************************ * * diff --git a/src/xcms/HVCMxC.c b/src/xcms/HVCMxC.c index 20aa9ef..daa9bf6 100644 --- a/src/xcms/HVCMxC.c +++ b/src/xcms/HVCMxC.c @@ -44,11 +44,12 @@ * querying routine. * */ -/* $XFree86: xc/lib/X11/HVCMxC.c,v 1.3 2001/01/17 19:41:37 dawes Exp $ */ +/* $XFree86: xc/lib/X11/HVCMxC.c,v 1.5 2003/07/16 01:38:26 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" #include <math.h> +#include "Cv.h" /* * DEFINES @@ -56,17 +57,6 @@ #define MAXBISECTCOUNT 100 #define EPS 0.001 -/* - * EXTERNS - */ -extern Status _XcmsTekHVCQueryMaxVCRGB(); -extern int _XcmsTekHVC_CheckModify(); -extern XcmsColorSpace XcmsTekHVCColorSpace; - -/* CvColW.c */ -extern Status _XcmsConvertColorsWithWhitePt(); - - /************************************************************************ * * @@ -167,6 +157,7 @@ XcmsTekHVCQueryMaxC(ccc, hue, value, pColor_return) /* save the structure input so that any elements that */ /* are not touched are recopied later in the routine. */ nValue = savedValue = value; + lastChroma = -1.0; lastValue = -1.0; nMaxCount = MAXBISECTCOUNT; maxDist = 100.0 - max_vc.spec.TekHVC.V; diff --git a/src/xcms/HVCMxV.c b/src/xcms/HVCMxV.c index fec1c3b..1e0d5d3 100644 --- a/src/xcms/HVCMxV.c +++ b/src/xcms/HVCMxV.c @@ -44,11 +44,12 @@ * querying routine. * */ -/* $XFree86: xc/lib/X11/HVCMxV.c,v 1.3 2001/01/17 19:41:37 dawes Exp $ */ +/* $XFree86: xc/lib/X11/HVCMxV.c,v 1.5 2003/07/16 01:38:26 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" #include <math.h> +#include "Cv.h" /* * DEFINES @@ -56,16 +57,6 @@ #define MAXBISECTCOUNT 100 #define EPS 0.001 -/* - * EXTERNS - */ -extern Status _XcmsTekHVCQueryMaxVCRGB(); -extern int _XcmsTekHVC_CheckModify(); -extern XcmsColorSpace XcmsTekHVCColorSpace; - -/* CvColW.c */ -extern Status _XcmsConvertColorsWithWhitePt(); - /************************************************************************ * * @@ -177,6 +168,7 @@ XcmsTekHVCQueryMaxV(ccc, hue, chroma, pColor_return) tmp.spec.TekHVC.C = max_vc.spec.TekHVC.C; tmp.spec.TekHVC.V = max_vc.spec.TekHVC.V; lastChroma = -1.0; + lastValue = -1.0; nMaxCount = MAXBISECTCOUNT; rFactor = 1.0; diff --git a/src/xcms/HVCMxVC.c b/src/xcms/HVCMxVC.c index 7c8ec7d..d00f6d8 100644 --- a/src/xcms/HVCMxVC.c +++ b/src/xcms/HVCMxVC.c @@ -44,9 +44,11 @@ * querying routine. * */ +/* $XFree86: xc/lib/X11/HVCMxVC.c,v 1.2 2003/04/13 19:22:16 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" +#include "Cv.h" /* * DEFINES @@ -58,18 +60,6 @@ #define START_V 40.0 #define START_C 120.0 -/* - * EXTERNS - */ -extern Status _XcmsTekHVC_CheckModify(); -extern Status _XcmsConvertColorsWithWhitePt(); -extern XcmsColorSpace XcmsTekHVCColorSpace; - -/* - * FORWARD DECLARATIONS - */ -Status _XcmsTekHVCQueryMaxVCRGB(); - /************************************************************************ * * @@ -84,11 +74,11 @@ Status _XcmsTekHVCQueryMaxVCRGB(); * SYNOPSIS */ Status -_XcmsTekHVCQueryMaxVCRGB(ccc, hue, pColor_return, pRGB_return) - XcmsCCC ccc; - XcmsFloat hue; - XcmsColor *pColor_return; - XcmsRGBi *pRGB_return; +_XcmsTekHVCQueryMaxVCRGB( + XcmsCCC ccc, + XcmsFloat hue, + XcmsColor *pColor_return, + XcmsRGBi *pRGB_return) /* * DESCRIPTION diff --git a/src/xcms/HVCMxVs.c b/src/xcms/HVCMxVs.c index 6f98d0d..bc21d94 100644 --- a/src/xcms/HVCMxVs.c +++ b/src/xcms/HVCMxVs.c @@ -43,20 +43,11 @@ * Source for the XcmsTekHVCQueryMaxVSamples() gamut boundary * querying routine. */ -/* $XFree86: xc/lib/X11/HVCMxVs.c,v 1.3 2001/01/17 19:41:37 dawes Exp $ */ +/* $XFree86: xc/lib/X11/HVCMxVs.c,v 1.4 2003/04/13 19:22:16 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" - -/* - * EXTERNS - */ -extern Status _XcmsTekHVCQueryMaxVCRGB(); -extern Status _XcmsTekHVC_CheckModify(); -extern XcmsColorSpace XcmsTekHVCColorSpace; - -/* CvColW.c */ -extern Status _XcmsConvertColorsWithWhitePt(); +#include "Cv.h" /************************************************************************ diff --git a/src/xcms/HVCWpAj.c b/src/xcms/HVCWpAj.c index 76e64c0..b1b6f0f 100644 --- a/src/xcms/HVCWpAj.c +++ b/src/xcms/HVCWpAj.c @@ -44,15 +44,11 @@ * adjustment of color specifications in the TekHVC color * space. */ +/* $XFree86: xc/lib/X11/HVCWpAj.c,v 1.2 2003/04/13 19:22:16 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" - -/* - * EXTERNS - */ -extern Status _XcmsConvertColorsWithWhitePt(); -extern XcmsColorSpace XcmsTekHVCColorSpace; +#include "Cv.h" /************************************************************************ diff --git a/src/xcms/IdOfPr.c b/src/xcms/IdOfPr.c index d84986e..b6b4591 100644 --- a/src/xcms/IdOfPr.c +++ b/src/xcms/IdOfPr.c @@ -32,16 +32,11 @@ * * */ +/* $XFree86: xc/lib/X11/IdOfPr.c,v 1.2 2003/04/13 19:22:16 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" - -/* - * EXTERNS - */ -extern XcmsColorSpace **_XcmsDIColorSpaces; -extern XcmsColorSpace **_XcmsDDColorSpaces; -void _XcmsCopyISOLatin1Lowered(); +#include "Cv.h" /* diff --git a/src/xcms/LRGB.c b/src/xcms/LRGB.c index 4113b8a..7c252b6 100644 --- a/src/xcms/LRGB.c +++ b/src/xcms/LRGB.c @@ -35,28 +35,14 @@ * 4. RGB intensity to CIE XYZ * */ -/* $XFree86: xc/lib/X11/LRGB.c,v 3.5 2001/07/25 15:04:44 dawes Exp $ */ +/* $XFree86: xc/lib/X11/LRGB.c,v 3.7 2003/11/03 03:46:26 dawes Exp $ */ #include <stdio.h> #include <X11/Xos.h> #include <X11/Xatom.h> #include "Xlibint.h" #include "Xcmsint.h" - -/* - * EXTERNS - * External declarations required locally to this package - * that are not already declared in any of the included header - * files (external includes or internal includes). - */ -extern char _XcmsRGB_prefix[]; -extern char _XcmsRGBi_prefix[]; -extern unsigned long _XcmsGetElement(); -extern void _XcmsFreeIntensityMaps(); - -/* cmsProp.c */ -extern int _XcmsGetProperty(); - +#include "Cv.h" /* * LOCAL DEFINES @@ -85,12 +71,23 @@ extern int _XcmsGetProperty(); /* * FORWARD DECLARATIONS */ -static void LINEAR_RGB_FreeSCCData(); -static int LINEAR_RGB_InitSCCData(); -static int XcmsLRGB_RGB_ParseString(); -static int XcmsLRGB_RGBi_ParseString(); -Status _XcmsGetTableType0(); -Status _XcmsGetTableType1(); +static void LINEAR_RGB_FreeSCCData(XPointer pScreenDataTemp); +static int LINEAR_RGB_InitSCCData(Display *dpy, + int screenNumber, XcmsPerScrnInfo *pPerScrnInfo); +static int XcmsLRGB_RGB_ParseString(register char *spec, XcmsColor *pColor); +static int XcmsLRGB_RGBi_ParseString(register char *spec, XcmsColor *pColor); +static Status +_XcmsGetTableType0( + IntensityTbl *pTbl, + int format, + char **pChar, + unsigned long *pCount); +static Status +_XcmsGetTableType1( + IntensityTbl *pTbl, + int format, + char **pChar, + unsigned long *pCount); /* * LOCALS VARIABLES @@ -126,8 +123,8 @@ static unsigned short const MASK[17] = { * to XcmsCIEXYZFormat. */ static XcmsConversionProc Fl_RGB_to_CIEXYZ[] = { - XcmsRGBToRGBi, - XcmsRGBiToCIEXYZ, + (XcmsConversionProc)XcmsRGBToRGBi, + (XcmsConversionProc)XcmsRGBiToCIEXYZ, NULL }; @@ -137,8 +134,8 @@ static XcmsConversionProc Fl_RGB_to_CIEXYZ[] = { * to XcmsRGBFormat. */ static XcmsConversionProc Fl_CIEXYZ_to_RGB[] = { - XcmsCIEXYZToRGBi, - XcmsRGBiToRGB, + (XcmsConversionProc)XcmsCIEXYZToRGBi, + (XcmsConversionProc)XcmsRGBiToRGB, NULL }; @@ -148,7 +145,7 @@ static XcmsConversionProc Fl_CIEXYZ_to_RGB[] = { * to XcmsCIEXYZFormat. */ static XcmsConversionProc Fl_RGBi_to_CIEXYZ[] = { - XcmsRGBiToCIEXYZ, + (XcmsConversionProc)XcmsRGBiToCIEXYZ, NULL }; @@ -158,7 +155,7 @@ static XcmsConversionProc Fl_RGBi_to_CIEXYZ[] = { * to XcmsRGBiFormat. */ static XcmsConversionProc Fl_CIEXYZ_to_RGBi[] = { - XcmsCIEXYZToRGBi, + (XcmsConversionProc)XcmsCIEXYZToRGBi, NULL }; @@ -453,10 +450,10 @@ static LINEAR_RGB_SCCData Default_RGB_SCCData = { * SYNOPSIS */ static Status -LINEAR_RGB_InitSCCData(dpy, screenNumber, pPerScrnInfo) - Display *dpy; - int screenNumber; - XcmsPerScrnInfo *pPerScrnInfo; +LINEAR_RGB_InitSCCData( + Display *dpy, + int screenNumber, + XcmsPerScrnInfo *pPerScrnInfo) /* * DESCRIPTION * @@ -835,8 +832,8 @@ FreeSCCData: * SYNOPSIS */ static void -LINEAR_RGB_FreeSCCData(pScreenDataTemp) - XPointer pScreenDataTemp; +LINEAR_RGB_FreeSCCData( + XPointer pScreenDataTemp) /* * DESCRIPTION * @@ -895,12 +892,12 @@ LINEAR_RGB_FreeSCCData(pScreenDataTemp) * * SYNOPSIS */ -Status -_XcmsGetTableType0(pTbl, format, pChar, pCount) - IntensityTbl *pTbl; - int format; - char **pChar; - unsigned long *pCount; +static Status +_XcmsGetTableType0( + IntensityTbl *pTbl, + int format, + char **pChar, + unsigned long *pCount) /* * DESCRIPTION * @@ -956,12 +953,12 @@ _XcmsGetTableType0(pTbl, format, pChar, pCount) * * SYNOPSIS */ -Status -_XcmsGetTableType1(pTbl, format, pChar, pCount) - IntensityTbl *pTbl; - int format; - char **pChar; - unsigned long *pCount; +static Status +_XcmsGetTableType1( + IntensityTbl *pTbl, + int format, + char **pChar, + unsigned long *pCount) /* * DESCRIPTION * @@ -1018,9 +1015,9 @@ _XcmsGetTableType1(pTbl, format, pChar, pCount) * * SYNOPSIS */ -int -_XcmsValueCmp (p1, p2) - IntensityRec *p1, *p2; +static int +_XcmsValueCmp( + IntensityRec *p1, IntensityRec *p2) /* * DESCRIPTION * Compares the value component of two IntensityRec @@ -1043,9 +1040,9 @@ _XcmsValueCmp (p1, p2) * * SYNOPSIS */ -int -_XcmsIntensityCmp (p1, p2) - IntensityRec *p1, *p2; +static int +_XcmsIntensityCmp( + IntensityRec *p1, IntensityRec *p2) /* * DESCRIPTION * Compares the intensity component of two IntensityRec @@ -1074,10 +1071,10 @@ _XcmsIntensityCmp (p1, p2) * SYNOPSIS */ /* ARGSUSED */ -int -_XcmsValueInterpolation (key, lo, hi, answer, bitsPerRGB) - IntensityRec *key, *lo, *hi, *answer; - int bitsPerRGB; +static int +_XcmsValueInterpolation( + IntensityRec *key, IntensityRec *lo, IntensityRec *hi, IntensityRec *answer, + int bitsPerRGB) /* * DESCRIPTION * Based on a given value, performs a linear interpolation @@ -1104,10 +1101,10 @@ _XcmsValueInterpolation (key, lo, hi, answer, bitsPerRGB) * * SYNOPSIS */ -int -_XcmsIntensityInterpolation (key, lo, hi, answer, bitsPerRGB) - IntensityRec *key, *lo, *hi, *answer; - int bitsPerRGB; +static int +_XcmsIntensityInterpolation( + IntensityRec *key, IntensityRec *lo, IntensityRec *hi, IntensityRec *answer, + int bitsPerRGB) /* * DESCRIPTION * Based on a given intensity, performs a linear interpolation @@ -1146,22 +1143,40 @@ _XcmsIntensityInterpolation (key, lo, hi, answer, bitsPerRGB) } + +typedef int (*comparProcp)( + char *p1, + char *p2); +typedef int (*interpolProcp)( + char *key, + char *lo, + char *hi, + char *answer, + int bitsPerRGB); + /* * NAME * _XcmsTableSearch * * SYNOPSIS */ -int -_XcmsTableSearch (key, bitsPerRGB, base, nel, nKeyPtrSize, compar, interpol, answer) - char *key; - int bitsPerRGB; - char *base; - unsigned nel; - unsigned nKeyPtrSize; - int (*compar)(); - int (*interpol)(); - char *answer; +static int +_XcmsTableSearch( + char *key, + int bitsPerRGB, + char *base, + unsigned nel, + unsigned nKeyPtrSize, + int (*compar)( + char *p1, + char *p2), + int (*interpol)( + char *key, + char *lo, + char *hi, + char *answer, + int bitsPerRGB), + char *answer) /* * DESCRIPTION @@ -1219,8 +1234,8 @@ _XcmsTableSearch (key, bitsPerRGB, base, nel, nKeyPtrSize, compar, interpol, ans * * SYNOPSIS */ -void _XcmsMatVec(pMat, pIn, pOut) - XcmsFloat *pMat, *pIn, *pOut; +static void _XcmsMatVec( + XcmsFloat *pMat, XcmsFloat *pIn, XcmsFloat *pOut) /* * DESCRIPTION * Multiply the passed vector by the passed matrix to return a @@ -1254,9 +1269,9 @@ void _XcmsMatVec(pMat, pIn, pOut) * SYNOPSIS */ static int -XcmsLRGB_RGB_ParseString(spec, pColor) - register char *spec; - XcmsColor *pColor; +XcmsLRGB_RGB_ParseString( + register char *spec, + XcmsColor *pColor) /* * DESCRIPTION * This routines takes a string and attempts to convert @@ -1372,9 +1387,9 @@ XcmsLRGB_RGB_ParseString(spec, pColor) * SYNOPSIS */ static int -XcmsLRGB_RGBi_ParseString(spec, pColor) - register char *spec; - XcmsColor *pColor; +XcmsLRGB_RGBi_ParseString( + register char *spec, + XcmsColor *pColor) /* * DESCRIPTION * This routines takes a string and attempts to convert @@ -1652,7 +1667,7 @@ XcmsRGBiToRGB(ccc, pXcmsColors_in_out, nColors, pCompressed) (char *)pScreenData->pRedTbl->pBase, (unsigned)pScreenData->pRedTbl->nEntries, (unsigned)sizeof(IntensityRec), - _XcmsIntensityCmp, _XcmsIntensityInterpolation, (char *)&answerIRec)) { + (comparProcp)_XcmsIntensityCmp, (interpolProcp)_XcmsIntensityInterpolation, (char *)&answerIRec)) { return(XcmsFailure); } tmpRGB.red = answerIRec.value; @@ -1662,7 +1677,7 @@ XcmsRGBiToRGB(ccc, pXcmsColors_in_out, nColors, pCompressed) (char *)pScreenData->pGreenTbl->pBase, (unsigned)pScreenData->pGreenTbl->nEntries, (unsigned)sizeof(IntensityRec), - _XcmsIntensityCmp, _XcmsIntensityInterpolation, (char *)&answerIRec)) { + (comparProcp)_XcmsIntensityCmp, (interpolProcp)_XcmsIntensityInterpolation, (char *)&answerIRec)) { return(XcmsFailure); } tmpRGB.green = answerIRec.value; @@ -1672,7 +1687,7 @@ XcmsRGBiToRGB(ccc, pXcmsColors_in_out, nColors, pCompressed) (char *)pScreenData->pBlueTbl->pBase, (unsigned)pScreenData->pBlueTbl->nEntries, (unsigned)sizeof(IntensityRec), - _XcmsIntensityCmp, _XcmsIntensityInterpolation, (char *)&answerIRec)) { + (comparProcp)_XcmsIntensityCmp, (interpolProcp)_XcmsIntensityInterpolation, (char *)&answerIRec)) { return(XcmsFailure); } tmpRGB.blue = answerIRec.value; @@ -1692,11 +1707,11 @@ XcmsRGBiToRGB(ccc, pXcmsColors_in_out, nColors, pCompressed) */ /* ARGSUSED */ Status -XcmsRGBToRGBi(ccc, pXcmsColors_in_out, nColors, pCompressed) - XcmsCCC ccc; - XcmsColor *pXcmsColors_in_out;/* pointer to XcmsColors to convert */ - unsigned int nColors; /* Number of colors */ - Bool *pCompressed; /* pointer to a bit array */ +XcmsRGBToRGBi( + XcmsCCC ccc, + XcmsColor *pXcmsColors_in_out,/* pointer to XcmsColors to convert */ + unsigned int nColors, /* Number of colors */ + Bool *pCompressed) /* pointer to a bit array */ /* * DESCRIPTION * Converts color specifications in an array of XcmsColor @@ -1733,7 +1748,7 @@ XcmsRGBToRGBi(ccc, pXcmsColors_in_out, nColors, pCompressed) (char *)pScreenData->pRedTbl->pBase, (unsigned)pScreenData->pRedTbl->nEntries, (unsigned)sizeof(IntensityRec), - _XcmsValueCmp, _XcmsValueInterpolation, (char *)&answerIRec)) { + (comparProcp)_XcmsValueCmp, (interpolProcp)_XcmsValueInterpolation, (char *)&answerIRec)) { return(XcmsFailure); } tmpRGBi.red = answerIRec.intensity; @@ -1743,7 +1758,7 @@ XcmsRGBToRGBi(ccc, pXcmsColors_in_out, nColors, pCompressed) (char *)pScreenData->pGreenTbl->pBase, (unsigned)pScreenData->pGreenTbl->nEntries, (unsigned)sizeof(IntensityRec), - _XcmsValueCmp, _XcmsValueInterpolation, (char *)&answerIRec)) { + (comparProcp)_XcmsValueCmp, (interpolProcp)_XcmsValueInterpolation, (char *)&answerIRec)) { return(XcmsFailure); } tmpRGBi.green = answerIRec.intensity; @@ -1753,7 +1768,7 @@ XcmsRGBToRGBi(ccc, pXcmsColors_in_out, nColors, pCompressed) (char *)pScreenData->pBlueTbl->pBase, (unsigned)pScreenData->pBlueTbl->nEntries, (unsigned)sizeof(IntensityRec), - _XcmsValueCmp, _XcmsValueInterpolation, (char *)&answerIRec)) { + (comparProcp)_XcmsValueCmp, (interpolProcp)_XcmsValueInterpolation, (char *)&answerIRec)) { return(XcmsFailure); } tmpRGBi.blue = answerIRec.intensity; @@ -1772,10 +1787,10 @@ XcmsRGBToRGBi(ccc, pXcmsColors_in_out, nColors, pCompressed) */ /* ARGSUSED */ int -_XcmsLRGB_InitScrnDefault(dpy, screenNumber, pPerScrnInfo) - Display *dpy; - int screenNumber; - XcmsPerScrnInfo *pPerScrnInfo; +_XcmsLRGB_InitScrnDefault( + Display *dpy, + int screenNumber, + XcmsPerScrnInfo *pPerScrnInfo) /* * DESCRIPTION * Given a display and screen number, this routine attempts diff --git a/src/xcms/Lab.c b/src/xcms/Lab.c index b33ba71..6395a92 100644 --- a/src/xcms/Lab.c +++ b/src/xcms/Lab.c @@ -36,13 +36,14 @@ * * Note that the range for L* is 0 to 1. */ -/* $XFree86: xc/lib/X11/Lab.c,v 1.3 2001/01/17 19:41:38 dawes Exp $ */ +/* $XFree86: xc/lib/X11/Lab.c,v 1.4 2003/04/13 19:22:16 dawes Exp $ */ #include <X11/Xos.h> #include <stdio.h> /* sscanf */ #include "Xlibint.h" #include "Xcmsint.h" +#include "Cv.h" /* * DEFINES @@ -57,22 +58,11 @@ #define DIV16BY116 0.137931 /* - * EXTERNS - */ -extern char _XcmsCIELab_prefix[]; - -/* CvCols.c */ -extern Status _XcmsDIConvertColors(); - -/* XYZ.c */ -extern Status _XcmsCIEXYZ_ValidSpec(); - -/* * FORWARD DECLARATIONS */ -static int CIELab_ParseString(); -static Status XcmsCIELab_ValidSpec(); +static int CIELab_ParseString(register char *spec, XcmsColor *pColor); +static Status XcmsCIELab_ValidSpec(XcmsColor *pColor); /* @@ -127,9 +117,9 @@ XcmsColorSpace XcmsCIELabColorSpace = * SYNOPSIS */ static int -CIELab_ParseString(spec, pColor) - register char *spec; - XcmsColor *pColor; +CIELab_ParseString( + register char *spec, + XcmsColor *pColor) /* * DESCRIPTION * This routines takes a string and attempts to convert @@ -192,8 +182,8 @@ CIELab_ParseString(spec, pColor) * SYNOPSIS */ static Status -XcmsCIELab_ValidSpec(pColor) - XcmsColor *pColor; +XcmsCIELab_ValidSpec( + XcmsColor *pColor) /* * DESCRIPTION * Checks if color specification valid for CIE L*a*b*. diff --git a/src/xcms/LabGcC.c b/src/xcms/LabGcC.c index a234967..c13397a 100644 --- a/src/xcms/LabGcC.c +++ b/src/xcms/LabGcC.c @@ -30,12 +30,11 @@ * Source for XcmsCIELabClipuv() gamut compression routine. * */ -/* $XFree86: xc/lib/X11/LabGcC.c,v 1.3 2001/01/17 19:41:38 dawes Exp $ */ +/* $XFree86: xc/lib/X11/LabGcC.c,v 1.4 2003/04/13 19:22:16 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" - -extern Status _XcmsDIConvertColors(); +#include "Cv.h" /************************************************************************ diff --git a/src/xcms/LabGcL.c b/src/xcms/LabGcL.c index 4dc64a9..aac8d23 100644 --- a/src/xcms/LabGcL.c +++ b/src/xcms/LabGcL.c @@ -30,18 +30,11 @@ * Source for XcmsCIELabClipL() gamut compression routine. * */ -/* $XFree86: xc/lib/X11/LabGcL.c,v 1.3 2001/01/17 19:41:38 dawes Exp $ */ +/* $XFree86: xc/lib/X11/LabGcL.c,v 1.4 2003/04/13 19:22:16 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" - -/* - * EXTERNS - */ -extern Status _XcmsCIELabQueryMaxLCRGB(); - -/* CvCols.c */ -extern Status _XcmsDIConvertColors(); +#include "Cv.h" /************************************************************************ diff --git a/src/xcms/LabGcLC.c b/src/xcms/LabGcLC.c index d48972d..cf2cfca 100644 --- a/src/xcms/LabGcLC.c +++ b/src/xcms/LabGcLC.c @@ -30,11 +30,12 @@ * Source for XcmsCIELabClipLab() gamut * compression function. */ -/* $XFree86: xc/lib/X11/LabGcLC.c,v 1.3 2001/01/17 19:41:39 dawes Exp $ */ +/* $XFree86: xc/lib/X11/LabGcLC.c,v 1.4 2003/04/13 19:22:16 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" #include <math.h> +#include "Cv.h" /* * INTERNALS @@ -43,17 +44,6 @@ */ #define MAXBISECTCOUNT 100 -/* - * EXTERNS - */ -extern Status _XcmsCIELabQueryMaxLCRGB(); - -/* CvCols.c */ -extern Status _XcmsDIConvertColors(); - -/* CvColW.c */ -extern Status _XcmsConvertColorsWithWhitePt(); - /************************************************************************ * * diff --git a/src/xcms/LabMnL.c b/src/xcms/LabMnL.c index b616384..6c76ac9 100644 --- a/src/xcms/LabMnL.c +++ b/src/xcms/LabMnL.c @@ -31,11 +31,12 @@ * querying routine. * */ -/* $XFree86: xc/lib/X11/LabMnL.c,v 1.3 2001/01/17 19:41:39 dawes Exp $ */ +/* $XFree86: xc/lib/X11/LabMnL.c,v 1.4 2003/04/13 19:22:16 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" #include <math.h> +#include "Cv.h" /* * DEFINES @@ -44,14 +45,6 @@ #define EPS (XcmsFloat)0.001 #define START_L_STAR (XcmsFloat)40.0 -/* - * EXTERNS - */ -extern Status _XcmsCIELabQueryMaxLCRGB(); - -/* CvColW.c */ -extern Status _XcmsConvertColorsWithWhitePt(); - /************************************************************************ * * diff --git a/src/xcms/LabMxC.c b/src/xcms/LabMxC.c index 53e5c2e..337d5a8 100644 --- a/src/xcms/LabMxC.c +++ b/src/xcms/LabMxC.c @@ -33,11 +33,12 @@ * querying routine. * */ -/* $XFree86: xc/lib/X11/LabMxC.c,v 1.3 2001/01/17 19:41:39 dawes Exp $ */ +/* $XFree86: xc/lib/X11/LabMxC.c,v 1.4 2003/04/13 19:22:16 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" #include <math.h> +#include "Cv.h" /* * DEFINES @@ -47,14 +48,6 @@ #define START_CHROMA (XcmsFloat)3.6 #define TOPL (XcmsFloat)100.0 -/* - * EXTERNS - */ -extern Status _XcmsCIELabQueryMaxLCRGB(); - -/* CvColW.c */ -extern Status _XcmsConvertColorsWithWhitePt(); - /************************************************************************ * * diff --git a/src/xcms/LabMxL.c b/src/xcms/LabMxL.c index 8022a7d..7002a82 100644 --- a/src/xcms/LabMxL.c +++ b/src/xcms/LabMxL.c @@ -31,11 +31,12 @@ * querying routine. * */ -/* $XFree86: xc/lib/X11/LabMxL.c,v 1.3 2001/01/17 19:41:39 dawes Exp $ */ +/* $XFree86: xc/lib/X11/LabMxL.c,v 1.4 2003/04/13 19:22:16 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" #include <math.h> +#include "Cv.h" /* * DEFINES @@ -44,14 +45,6 @@ #define EPS (XcmsFloat)0.001 #define START_L_STAR (XcmsFloat)40 -/* - * EXTERNS - */ -extern Status _XcmsCIELabQueryMaxLCRGB(); - -/* CvColW.c */ -extern Status _XcmsConvertColorsWithWhitePt(); - /************************************************************************ * * diff --git a/src/xcms/LabMxLC.c b/src/xcms/LabMxLC.c index 6fdeeb1..81f2fa2 100644 --- a/src/xcms/LabMxLC.c +++ b/src/xcms/LabMxLC.c @@ -38,9 +38,11 @@ * Fred W. Billmeyer & Max Saltzman, "Principles of Color * Technology", John Wily & Sons, Inc, 1981. */ +/* $XFree86: xc/lib/X11/LabMxLC.c,v 1.2 2003/04/13 19:22:16 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" +#include "Cv.h" /* * DEFINES @@ -52,16 +54,6 @@ #define START_LSTAR (XcmsFloat)40.0 #define START_CHROMA (XcmsFloat)3.6 -/* - * EXTERNS - */ -extern Status _XcmsConvertColorsWithWhitePt(); - -/* - * FORWARD DECLARATIONS - */ -Status _XcmsCIELabQueryMaxLCRGB(); - /************************************************************************ * * @@ -76,12 +68,11 @@ Status _XcmsCIELabQueryMaxLCRGB(); * SYNOPSIS */ Status -_XcmsCIELabQueryMaxLCRGB(ccc, hue, pColor_return, pRGB_return) - XcmsCCC ccc; - XcmsFloat hue; /* hue in radians */ - XcmsColor *pColor_return; - XcmsRGBi *pRGB_return; - +_XcmsCIELabQueryMaxLCRGB( + XcmsCCC ccc, + XcmsFloat hue, /* hue in radians */ + XcmsColor *pColor_return, + XcmsRGBi *pRGB_return) /* * DESCRIPTION * Return the maximum psychometric chroma for a specified diff --git a/src/xcms/LabWpAj.c b/src/xcms/LabWpAj.c index b4fc4a3..89f576a 100644 --- a/src/xcms/LabWpAj.c +++ b/src/xcms/LabWpAj.c @@ -32,16 +32,16 @@ * adjustment of color specifications in the CIE L*a*b* color * space. */ +/* $XFree86: xc/lib/X11/LabWpAj.c,v 1.2 2003/04/13 19:22:16 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" +#include "Cv.h" /* * EXTERNS */ -extern Status _XcmsConvertColorsWithWhitePt(); - /************************************************************************ * * diff --git a/src/xcms/Luv.c b/src/xcms/Luv.c index 9569db0..8d14947 100644 --- a/src/xcms/Luv.c +++ b/src/xcms/Luv.c @@ -38,33 +38,22 @@ * Fred W. Billmeyer & Max Saltzman, "Principles of Color * Technology", John Wily & Sons, Inc, 1981. */ -/* $XFree86: xc/lib/X11/Luv.c,v 1.3 2001/01/17 19:41:39 dawes Exp $ */ +/* $XFree86: xc/lib/X11/Luv.c,v 1.4 2003/04/13 19:22:16 dawes Exp $ */ #include <X11/Xos.h> #include "Xlibint.h" #include "Xcmsint.h" +#include "Cv.h" #include <stdio.h> /* sscanf */ -/* - * EXTERNS - */ - -extern char _XcmsCIELuv_prefix[]; - -/* CvCols.c */ -extern Status _XcmsDIConvertColors(); - -/* uvY.c */ -Status _XcmsCIEuvY_ValidSpec(); - /* * FORWARD DECLARATIONS */ -static int CIELuv_ParseString(); -static Status XcmsCIELuv_ValidSpec(); +static int CIELuv_ParseString(register char *spec, XcmsColor *pColor); +static Status XcmsCIELuv_ValidSpec(XcmsColor *pColor); /* * DEFINES @@ -131,9 +120,9 @@ XcmsColorSpace XcmsCIELuvColorSpace = * SYNOPSIS */ static int -CIELuv_ParseString(spec, pColor) - register char *spec; - XcmsColor *pColor; +CIELuv_ParseString( + register char *spec, + XcmsColor *pColor) /* * DESCRIPTION * This routines takes a string and attempts to convert @@ -194,8 +183,8 @@ CIELuv_ParseString(spec, pColor) * SYNOPSIS */ static Status -XcmsCIELuv_ValidSpec(pColor) - XcmsColor *pColor; +XcmsCIELuv_ValidSpec( + XcmsColor *pColor) /* * DESCRIPTION * Checks if color specification valid for CIE L*u*v*. diff --git a/src/xcms/LuvGcC.c b/src/xcms/LuvGcC.c index 67da68a..fdb5dcd 100644 --- a/src/xcms/LuvGcC.c +++ b/src/xcms/LuvGcC.c @@ -30,15 +30,11 @@ * Source for XcmsCIELuvClipuv() gamut compression routine. * */ -/* $XFree86: xc/lib/X11/LuvGcC.c,v 1.3 2001/01/17 19:41:39 dawes Exp $ */ +/* $XFree86: xc/lib/X11/LuvGcC.c,v 1.4 2003/04/13 19:22:16 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" - -/* EXTERNS */ - -/* CvCols.c */ -extern Status _XcmsDIConvertColors(); +#include "Cv.h" /************************************************************************ diff --git a/src/xcms/LuvGcL.c b/src/xcms/LuvGcL.c index 1ae8513..1c9d4f5 100644 --- a/src/xcms/LuvGcL.c +++ b/src/xcms/LuvGcL.c @@ -30,18 +30,11 @@ * Source for XcmsCIELuvClipL() gamut compression routine. * */ -/* $XFree86: xc/lib/X11/LuvGcL.c,v 1.3 2001/01/17 19:41:39 dawes Exp $ */ +/* $XFree86: xc/lib/X11/LuvGcL.c,v 1.4 2003/04/13 19:22:16 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" - -/* - * EXTERNS - */ -extern Status _XcmsCIELuvQueryMaxLCRGB(); - -/* CvCols.c */ -extern Status _XcmsDIConvertColors(); +#include "Cv.h" /************************************************************************ diff --git a/src/xcms/LuvGcLC.c b/src/xcms/LuvGcLC.c index 7db28f7..157a3de 100644 --- a/src/xcms/LuvGcLC.c +++ b/src/xcms/LuvGcLC.c @@ -30,11 +30,12 @@ * Source for XcmsCIELuvClipLuv() gamut * compression function. */ -/* $XFree86: xc/lib/X11/LuvGcLC.c,v 1.3 2001/01/17 19:41:39 dawes Exp $ */ +/* $XFree86: xc/lib/X11/LuvGcLC.c,v 1.4 2003/04/13 19:22:17 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" #include <math.h> +#include "Cv.h" /* * INTERNALS @@ -43,17 +44,6 @@ */ #define MAXBISECTCOUNT 100 -/* - * EXTERNS - */ -extern Status _XcmsCIELuvQueryMaxLCRGB(); - -/* CvCols.c */ -extern Status _XcmsDIConvertColors(); - -/* CvColW.c */ -extern Status _XcmsConvertColorsWithWhitePt(); - /************************************************************************ * * diff --git a/src/xcms/LuvMnL.c b/src/xcms/LuvMnL.c index c9e27eb..3f82402 100644 --- a/src/xcms/LuvMnL.c +++ b/src/xcms/LuvMnL.c @@ -31,11 +31,12 @@ * querying routine. * */ -/* $XFree86: xc/lib/X11/LuvMnL.c,v 1.3 2001/01/17 19:41:39 dawes Exp $ */ +/* $XFree86: xc/lib/X11/LuvMnL.c,v 1.4 2003/04/13 19:22:17 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" #include <math.h> +#include "Cv.h" /* * DEFINES @@ -44,14 +45,6 @@ #define EPS (XcmsFloat)0.001 #define START_L_STAR (XcmsFloat)40.0 -/* - * EXTERNS - */ -extern Status _XcmsCIELuvQueryMaxLCRGB(); - -/* CvColW.c */ -extern Status _XcmsConvertColorsWithWhitePt(); - /************************************************************************ * * diff --git a/src/xcms/LuvMxC.c b/src/xcms/LuvMxC.c index b3ede84..10088bb 100644 --- a/src/xcms/LuvMxC.c +++ b/src/xcms/LuvMxC.c @@ -33,11 +33,12 @@ * querying routine. * */ -/* $XFree86: xc/lib/X11/LuvMxC.c,v 1.3 2001/01/17 19:41:39 dawes Exp $ */ +/* $XFree86: xc/lib/X11/LuvMxC.c,v 1.4 2003/04/13 19:22:17 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" #include <math.h> +#include "Cv.h" /* * DEFINES @@ -46,13 +47,6 @@ #define EPS (XcmsFloat)0.001 #define START_CHROMA (XcmsFloat)2.2 #define TOPL (XcmsFloat)100.0 -/* - * EXTERNS - */ -extern Status _XcmsCIELuvQueryMaxLCRGB(); - -/* CvColW.c */ -extern Status _XcmsConvertColorsWithWhitePt(); /************************************************************************ diff --git a/src/xcms/LuvMxL.c b/src/xcms/LuvMxL.c index 932bc01..327227d 100644 --- a/src/xcms/LuvMxL.c +++ b/src/xcms/LuvMxL.c @@ -31,11 +31,12 @@ * querying routine. * */ -/* $XFree86: xc/lib/X11/LuvMxL.c,v 1.3 2001/01/17 19:41:40 dawes Exp $ */ +/* $XFree86: xc/lib/X11/LuvMxL.c,v 1.4 2003/04/13 19:22:17 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" #include <math.h> +#include "Cv.h" /* * DEFINES @@ -44,14 +45,6 @@ #define EPS (XcmsFloat)0.001 #define START_L_STAR (XcmsFloat)40.0 -/* - * EXTERNS - */ -extern Status _XcmsCIELuvQueryMaxLCRGB(); - -/* CvColW.c */ -extern Status _XcmsConvertColorsWithWhitePt(); - /************************************************************************ * * diff --git a/src/xcms/LuvMxLC.c b/src/xcms/LuvMxLC.c index 337bbbf..3a241a7 100644 --- a/src/xcms/LuvMxLC.c +++ b/src/xcms/LuvMxLC.c @@ -38,9 +38,11 @@ * Fred W. Billmeyer & Max Saltzman, "Principles of Color * Technology", John Wily & Sons, Inc, 1981. */ +/* $XFree86: xc/lib/X11/LuvMxLC.c,v 1.2 2003/04/13 19:22:17 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" +#include "Cv.h" /* * DEFINES @@ -52,16 +54,6 @@ #define START_LSTAR (XcmsFloat)40.0 #define START_CHROMA (XcmsFloat)2.2 -/* - * EXTERNS - */ -extern Status _XcmsConvertColorsWithWhitePt(); - -/* - * FORWARD DECLARATIONS - */ -Status _XcmsCIELuvQueryMaxLCRGB(); - /************************************************************************ * * @@ -76,12 +68,11 @@ Status _XcmsCIELuvQueryMaxLCRGB(); * SYNOPSIS */ Status -_XcmsCIELuvQueryMaxLCRGB(ccc, hue, pColor_return, pRGB_return) - XcmsCCC ccc; - XcmsFloat hue; /* hue in radians */ - XcmsColor *pColor_return; - XcmsRGBi *pRGB_return; - +_XcmsCIELuvQueryMaxLCRGB( + XcmsCCC ccc, + XcmsFloat hue, /* hue in radians */ + XcmsColor *pColor_return, + XcmsRGBi *pRGB_return) /* * DESCRIPTION * Return the maximum psychometric chroma for a specified diff --git a/src/xcms/LuvWpAj.c b/src/xcms/LuvWpAj.c index 5083ccb..5df6d8b 100644 --- a/src/xcms/LuvWpAj.c +++ b/src/xcms/LuvWpAj.c @@ -32,15 +32,11 @@ * adjustment of color specifications in the CIE CIELuv.color * space. */ +/* $XFree86: xc/lib/X11/LuvWpAj.c,v 1.2 2003/04/13 19:22:17 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" - -/* - * EXTERNS - */ - -extern Status _XcmsConvertColorsWithWhitePt(); +#include "Cv.h" diff --git a/src/xcms/PrOfId.c b/src/xcms/PrOfId.c index 7b301e4..8b5e43a 100644 --- a/src/xcms/PrOfId.c +++ b/src/xcms/PrOfId.c @@ -32,15 +32,11 @@ * * */ +/* $XFree86: xc/lib/X11/PrOfId.c,v 1.2 2003/04/13 19:22:17 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" - -/* - * EXTERNS - */ -extern XcmsColorSpace **_XcmsDIColorSpaces; -extern XcmsColorSpace **_XcmsDDColorSpaces; +#include "Cv.h" /* diff --git a/src/xcms/QuCol.c b/src/xcms/QuCol.c index 0df0e66..3f19a67 100644 --- a/src/xcms/QuCol.c +++ b/src/xcms/QuCol.c @@ -32,15 +32,11 @@ * * */ -/* $XFree86: xc/lib/X11/QuCol.c,v 1.3 2001/01/17 19:41:42 dawes Exp $ */ +/* $XFree86: xc/lib/X11/QuCol.c,v 1.4 2003/04/13 19:22:17 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" - -/* EXTERN */ - -/* SetGetCols.c */ -extern Status _XcmsSetGetColors(); +#include "Cv.h" /************************************************************************ @@ -76,6 +72,6 @@ XcmsQueryColor(dpy, colormap, pXcmsColor_in_out, result_format) * specified pixel. */ { - return(_XcmsSetGetColors (XQueryColor, dpy, colormap, - pXcmsColor_in_out, 1, result_format, (Bool *) NULL)); + return(_XcmsSetGetColor(XQueryColor, dpy, colormap, + pXcmsColor_in_out, result_format, (Bool *) NULL)); } diff --git a/src/xcms/QuCols.c b/src/xcms/QuCols.c index c857e46..f2ca1a2 100644 --- a/src/xcms/QuCols.c +++ b/src/xcms/QuCols.c @@ -32,15 +32,11 @@ * * */ -/* $XFree86: xc/lib/X11/QuCols.c,v 1.3 2001/01/17 19:41:42 dawes Exp $ */ +/* $XFree86: xc/lib/X11/QuCols.c,v 1.4 2003/04/13 19:22:17 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" - -/* EXTERNS */ - -/* SetGetCols.c */ -extern Status _XcmsSetGetColors(); +#include "Cv.h" /************************************************************************ @@ -76,6 +72,6 @@ XcmsQueryColors(dpy, colormap, pXcmsColors_in_out, nColors, result_format) * specified pixels. */ { - return(_XcmsSetGetColors (XQueryColors, dpy, colormap, + return(_XcmsSetGetColors(XQueryColors, dpy, colormap, pXcmsColors_in_out, nColors, result_format, (Bool *) NULL)); } diff --git a/src/xcms/SetCCC.c b/src/xcms/SetCCC.c index d58daf8..34d09ab 100644 --- a/src/xcms/SetCCC.c +++ b/src/xcms/SetCCC.c @@ -33,6 +33,7 @@ * * */ +/* $XFree86: xc/lib/X11/SetCCC.c,v 1.2 2003/11/17 22:20:08 dawes Exp $ */ #include "Xlibint.h" #include "Xcms.h" @@ -86,17 +87,10 @@ XcmsSetWhitePoint(ccc, pColor) */ XcmsCompressionProc -#if NeedFunctionPrototypes XcmsSetCompressionProc( XcmsCCC ccc, XcmsCompressionProc compression_proc, XPointer client_data) -#else -XcmsSetCompressionProc(ccc, compression_proc, client_data) - XcmsCCC ccc; - XcmsCompressionProc compression_proc; - XPointer client_data; -#endif /* * DESCRIPTION * Set the specified CCC's compression function and client data. @@ -122,17 +116,10 @@ XcmsSetCompressionProc(ccc, compression_proc, client_data) */ XcmsWhiteAdjustProc -#if NeedFunctionPrototypes XcmsSetWhiteAdjustProc( XcmsCCC ccc, XcmsWhiteAdjustProc white_adjust_proc, XPointer client_data ) -#else -XcmsSetWhiteAdjustProc(ccc, white_adjust_proc, client_data) - XcmsCCC ccc; - XcmsWhiteAdjustProc white_adjust_proc; - XPointer client_data; -#endif /* * DESCRIPTION * Set the specified CCC's white_adjust function and client data. diff --git a/src/xcms/SetGetCols.c b/src/xcms/SetGetCols.c index 5ee6898..4b425af 100644 --- a/src/xcms/SetGetCols.c +++ b/src/xcms/SetGetCols.c @@ -32,6 +32,7 @@ * * */ +/* $XFree86: xc/lib/X11/SetGetCols.c,v 1.2 2003/04/13 19:22:17 dawes Exp $ */ /* * EXTERNAL INCLUDES @@ -40,15 +41,7 @@ */ #include "Xlibint.h" #include "Xcmsint.h" - - -/* - * EXTERNS - */ - -extern void _XcmsRGB_to_XColor(); -extern void _XColor_to_XcmsRGB(); - +#include "Cv.h" /************************************************************************ @@ -59,27 +52,144 @@ extern void _XColor_to_XcmsRGB(); /* * NAME - * XcmsSetColors - + * XcmsSetColor - * * SYNOPSIS */ Status -_XcmsSetGetColors(xColorProc, dpy, cmap, pColors_in_out, nColors, - result_format, pCompressed) - Status (*xColorProc)(); - Display *dpy; - Colormap cmap; - XcmsColor *pColors_in_out; - unsigned int nColors; - XcmsColorFormat result_format; - Bool *pCompressed; +_XcmsSetGetColor( + Status (*xColorProc)( + Display* /* display */, + Colormap /* colormap */, + XColor* /* screen_in_out */), + Display *dpy, + Colormap cmap, + XcmsColor *pColors_in_out, + XcmsColorFormat result_format, + Bool *pCompressed) /* * DESCRIPTION * Routine containing code common to: * XcmsAllocColor * XcmsQueryColor - * XcmsQueryColors * XcmsStoreColor + * + * RETURNS + * XcmsFailure if failed; + * XcmsSuccess if it succeeded without gamut compression; + * XcmsSuccessWithCompression if it succeeded with gamut + * compression; + */ +{ + XcmsCCC ccc; + XColor XColors_in_out; + Status retval = XcmsSuccess; + + /* + * Argument Checking + * 1. Assume xColorProc is correct + * 2. Insure ccc not NULL + * 3. Assume cmap correct (should be checked by Server) + * 4. Insure pColors_in_out valid + * 5. Assume method_in is valid (should be checked by Server) + */ + + if (dpy == NULL) { + return(XcmsFailure); + } + + if (result_format == XcmsUndefinedFormat) { + return(XcmsFailure); + } + + if ( !((*xColorProc == XAllocColor) || (*xColorProc == XStoreColor) + || (*xColorProc == XQueryColor)) ) { + return(XcmsFailure); + } + + if ((ccc = XcmsCCCOfColormap(dpy, cmap)) == (XcmsCCC)NULL) { + return(XcmsFailure); + } + + if (*xColorProc == XQueryColor) { + goto Query; + } + + /* + * Convert to RGB, adjusting for white point differences if necessary. + */ + if ((retval = XcmsConvertColors(ccc, pColors_in_out, 1, XcmsRGBFormat, + pCompressed)) == XcmsFailure) { + return(XcmsFailure); + } + +Query: + /* + * Convert XcmsColor to XColor structures + */ + _XcmsRGB_to_XColor(pColors_in_out, &XColors_in_out, 1); + + /* + * Now make appropriate X Call + */ + if (*xColorProc == XAllocColor) { + if ((*xColorProc)(ccc->dpy, cmap, &XColors_in_out) == 0) { + return(XcmsFailure); + } + } else if ((*xColorProc == XQueryColor) || (*xColorProc == XStoreColor)) { + /* Note: XQueryColor and XStoreColor do not return any Status */ + (*xColorProc)(ccc->dpy, cmap, &XColors_in_out); + } else { + return(XcmsFailure); + } + + if ((*xColorProc == XStoreColor)) { + return(retval); + } + + /* + * Now, convert the returned XColor (i.e., rgb) to XcmsColor structures + */ + _XColor_to_XcmsRGB(ccc, &XColors_in_out, pColors_in_out, 1); + + /* + * Then, convert XcmsColor structures to the original specification + * format. Note that we must use NULL instead of passing + * pCompressed. + */ + + if (result_format != XcmsRGBFormat) { + if (XcmsConvertColors(ccc, pColors_in_out, 1, result_format, + (Bool *) NULL) == XcmsFailure) { + return(XcmsFailure); + } + } + return(retval); +} + +/* + * NAME + * XcmsSetColors - + * + * SYNOPSIS + */ +Status +_XcmsSetGetColors( + Status (*xColorProc)( + Display* /* display */, + Colormap /* colormap */, + XColor* /* screen_in_out */, + int /* nColors */), + Display *dpy, + Colormap cmap, + XcmsColor *pColors_in_out, + int nColors, + XcmsColorFormat result_format, + Bool *pCompressed) +/* + * DESCRIPTION + * Routine containing code common to: + * XcmsQueryColors * XcmsStoreColors * * RETURNS @@ -115,9 +225,7 @@ _XcmsSetGetColors(xColorProc, dpy, cmap, pColors_in_out, nColors, return(XcmsFailure); } - if (!((*xColorProc == XAllocColor) || (*xColorProc == XStoreColor) - || (*xColorProc == XStoreColors) || (*xColorProc == XQueryColor) - || (*xColorProc == XQueryColors))) { + if ( !((*xColorProc == XStoreColors) || (*xColorProc == XQueryColors)) ) { return(XcmsFailure); } @@ -125,11 +233,6 @@ _XcmsSetGetColors(xColorProc, dpy, cmap, pColors_in_out, nColors, return(XcmsFailure); } - if ((*xColorProc == XAllocColor) || (*xColorProc == XStoreColor) - || (*xColorProc == XQueryColor)) { - nColors = 1; - } - /* * Allocate space for XColors */ @@ -138,14 +241,16 @@ _XcmsSetGetColors(xColorProc, dpy, cmap, pColors_in_out, nColors, return(XcmsFailure); } - if ((*xColorProc == XQueryColor) || (*xColorProc == XQueryColors)) { + if (*xColorProc == XQueryColors) { goto Query; } + /* * Convert to RGB, adjusting for white point differences if necessary. */ if ((retval = XcmsConvertColors(ccc, pColors_in_out, nColors, XcmsRGBFormat, pCompressed)) == XcmsFailure) { + Xfree((char *)pXColors_in_out); return(XcmsFailure); } @@ -158,15 +263,7 @@ Query: /* * Now make appropriate X Call */ - if (*xColorProc == XAllocColor) { - if ((*xColorProc)(ccc->dpy, cmap, pXColors_in_out) == 0) { - Xfree((char *)pXColors_in_out); - return(XcmsFailure); - } - } else if ((*xColorProc == XQueryColor) || (*xColorProc == XStoreColor)) { - /* Note: XQueryColor and XStoreColor do not return any Status */ - (*xColorProc)(ccc->dpy, cmap, pXColors_in_out); - } else if ((*xColorProc == XQueryColors) || (*xColorProc == XStoreColors)){ + if ((*xColorProc == XQueryColors) || (*xColorProc == XStoreColors)){ /* Note: XQueryColors and XStoreColors do not return any Status */ (*xColorProc)(ccc->dpy, cmap, pXColors_in_out, nColors); } else { @@ -174,13 +271,13 @@ Query: return(XcmsFailure); } - if ((*xColorProc == XStoreColor) || (*xColorProc == XStoreColors)) { + if (*xColorProc == XStoreColors) { Xfree((char *)pXColors_in_out); return(retval); } /* - * Now, convert returned XColor(i.e., rgb) to XcmsColor structures + * Now, convert the returned XColor (i.e., rgb) to XcmsColor structures */ _XColor_to_XcmsRGB(ccc, pXColors_in_out, pColors_in_out, nColors); Xfree((char *)pXColors_in_out); @@ -190,12 +287,14 @@ Query: * format. Note that we must use NULL instead of passing * pCompressed. */ - if (result_format != XcmsRGBFormat) { if (XcmsConvertColors(ccc, pColors_in_out, nColors, result_format, (Bool *) NULL) == XcmsFailure) { return(XcmsFailure); } } + return(retval); } + +/* ### EOF ### */ diff --git a/src/xcms/StCol.c b/src/xcms/StCol.c index 5467686..0d845b9 100644 --- a/src/xcms/StCol.c +++ b/src/xcms/StCol.c @@ -32,15 +32,11 @@ * * */ -/* $XFree86: xc/lib/X11/StCol.c,v 1.3 2001/01/17 19:41:44 dawes Exp $ */ +/* $XFree86: xc/lib/X11/StCol.c,v 1.4 2003/04/13 19:22:17 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" - -/* EXTERN */ - -/* SetGetCols.c */ -extern Status _XcmsSetGetColors(); +#include "Cv.h" /************************************************************************ @@ -80,6 +76,6 @@ XcmsStoreColor(dpy, colormap, pColor_in) XcmsColor tmpColor; tmpColor = *pColor_in; - return(_XcmsSetGetColors (XStoreColor, dpy, colormap, - &tmpColor, 1, XcmsRGBFormat, (Bool *) NULL)); + return(_XcmsSetGetColor(XStoreColor, dpy, colormap, + &tmpColor, XcmsRGBFormat, (Bool *) NULL)); } diff --git a/src/xcms/StCols.c b/src/xcms/StCols.c index d35bd33..3d6b900 100644 --- a/src/xcms/StCols.c +++ b/src/xcms/StCols.c @@ -32,15 +32,11 @@ * * */ -/* $XFree86: xc/lib/X11/StCols.c,v 1.3 2001/01/17 19:41:44 dawes Exp $ */ +/* $XFree86: xc/lib/X11/StCols.c,v 1.4 2003/04/13 19:22:18 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" - -/* EXTERN */ - -/* SetGetCols.c */ -extern Status _XcmsSetGetColors(); +#include "Cv.h" /************************************************************************ diff --git a/src/xcms/UNDEFINED.c b/src/xcms/UNDEFINED.c index a4e0555..6c0656a 100644 --- a/src/xcms/UNDEFINED.c +++ b/src/xcms/UNDEFINED.c @@ -33,6 +33,7 @@ * * */ +/* $XFree86: xc/lib/X11/UNDEFINED.c,v 1.2 2003/04/13 19:22:18 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" @@ -40,21 +41,33 @@ /* * FORWARD DECLARATIONS */ -static int ReturnZero(); +static int DummyParseStringProc( + char* /* color_string */, + XcmsColor* /* color_return */ + ); +static Status ReturnZero( + XcmsCCC /* ccc */, + XcmsColor* /* white_point */, + XcmsColor* /* colors */, + unsigned int /* ncolors */ + ); /* * LOCALS VARIABLES */ -static Status (*(Fl_ReturnZero[]))() = { +static Status (*(Fl_ReturnZero[]))( + XcmsCCC /* ccc */, + XcmsColor* /* white_point */, + XcmsColor* /* colors */, + unsigned int /* ncolors */ + ) = { ReturnZero, NULL }; - - /* * GLOBALS * Variables declared in this package that are allowed @@ -67,7 +80,7 @@ XcmsColorSpace XcmsUNDEFINEDColorSpace = { "undefined", /* prefix */ XcmsUndefinedFormat, /* id */ - ReturnZero, /* parseString */ + &DummyParseStringProc, /* parseString */ Fl_ReturnZero, /* to_CIEXYZ */ Fl_ReturnZero /* from_CIEXYZ */ }; @@ -87,8 +100,13 @@ XcmsColorSpace XcmsUNDEFINEDColorSpace = * SYNOPSIS */ /* ARGSUSED */ -static int -ReturnZero() +static Status +ReturnZero( + XcmsCCC ccc /* ccc */, + XcmsColor* white /* white_point */, + XcmsColor* colors /* colors */, + unsigned int ncolors /* ncolors */ + ) /* * DESCRIPTION * Does nothing. @@ -100,3 +118,13 @@ ReturnZero() { return(0); } + +static int DummyParseStringProc( + char* color_string /* color_string */, + XcmsColor* color_return /* color_return */ + ) +{ + return(0); +} + +/* ### EOF ### */ diff --git a/src/xcms/XRGB.c b/src/xcms/XRGB.c index c4985a3..26d0ef9 100644 --- a/src/xcms/XRGB.c +++ b/src/xcms/XRGB.c @@ -33,10 +33,11 @@ * * */ -/* $XFree86: xc/lib/X11/XRGB.c,v 3.3 2001/07/29 05:01:11 tsi Exp $ */ +/* $XFree86: xc/lib/X11/XRGB.c,v 3.4 2003/04/13 19:22:19 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" +#include "Cv.h" /* * LOCAL VARIABLES @@ -77,10 +78,10 @@ static unsigned short const MASK[17] = { * SYNOPSIS */ void -_XcmsRGB_to_XColor(pColors, pXColors, nColors) - XcmsColor *pColors; - XColor *pXColors; - unsigned int nColors; +_XcmsRGB_to_XColor( + XcmsColor *pColors, + XColor *pXColors, + unsigned int nColors) /* * DESCRIPTION * Translates a color specification in XcmsRGBFormat in a XcmsColor @@ -107,11 +108,11 @@ _XcmsRGB_to_XColor(pColors, pXColors, nColors) * SYNOPSIS */ void -_XColor_to_XcmsRGB(ccc, pXColors, pColors, nColors) - XcmsCCC ccc; - XColor *pXColors; - XcmsColor *pColors; - unsigned int nColors; +_XColor_to_XcmsRGB( + XcmsCCC ccc, + XColor *pXColors, + XcmsColor *pColors, + unsigned int nColors) /* * DESCRIPTION * Translates an RGB color specification in an XColor @@ -145,9 +146,9 @@ _XColor_to_XcmsRGB(ccc, pXColors, pColors, nColors) * SYNOPSIS */ void -_XcmsResolveColor(ccc, pXcmsColor) - XcmsCCC ccc; - XcmsColor *pXcmsColor; +_XcmsResolveColor( + XcmsCCC ccc, + XcmsColor *pXcmsColor) /* * DESCRIPTION * Uses the X Server ResolveColor() algorithm to @@ -191,9 +192,9 @@ _XcmsResolveColor(ccc, pXcmsColor) * SYNOPSIS */ void -_XcmsUnresolveColor(ccc, pColor) - XcmsCCC ccc; - XcmsColor *pColor; +_XcmsUnresolveColor( + XcmsCCC ccc, + XcmsColor *pColor) /* * DESCRIPTION * Masks out insignificant bits. @@ -220,9 +221,9 @@ _XcmsUnresolveColor(ccc, pColor) * SYNOPSIS */ void -_XUnresolveColor(ccc, pXColor) - XcmsCCC ccc; - XColor *pXColor; +_XUnresolveColor( + XcmsCCC ccc, + XColor *pXColor) /* * DESCRIPTION * Masks out insignificant bits. diff --git a/src/xcms/XYZ.c b/src/xcms/XYZ.c index 55040cb..7a9c98e 100644 --- a/src/xcms/XYZ.c +++ b/src/xcms/XYZ.c @@ -33,23 +33,15 @@ * * */ -/* $XFree86: xc/lib/X11/XYZ.c,v 1.3 2001/01/17 19:41:49 dawes Exp $ */ +/* $XFree86: xc/lib/X11/XYZ.c,v 1.4 2003/04/13 19:22:19 dawes Exp $ */ #include <X11/Xos.h> #include "Xlibint.h" #include "Xcmsint.h" +#include "Cv.h" #include <stdio.h> /* sscanf */ - -/* - * EXTERNS - * External declarations required locally to this package - * that are not already declared in any of the included header - * files (external includes or internal includes). - */ -extern char _XcmsCIEXYZ_prefix[]; - /* * DEFINES * Internal definitions that need NOT be exported to any package @@ -64,9 +56,7 @@ extern char _XcmsCIEXYZ_prefix[]; /* * FORWARD DECLARATIONS */ -static int CIEXYZ_ParseString(); -Status _XcmsCIEXYZ_ValidSpec(); - +static int CIEXYZ_ParseString(register char *spec, XcmsColor *pColor); /* * LOCALS VARIABLES @@ -110,9 +100,9 @@ XcmsColorSpace XcmsCIEXYZColorSpace = * SYNOPSIS */ static int -CIEXYZ_ParseString(spec, pColor) - register char *spec; - XcmsColor *pColor; +CIEXYZ_ParseString( + register char *spec, + XcmsColor *pColor) /* * DESCRIPTION * This routines takes a string and attempts to convert @@ -172,8 +162,8 @@ CIEXYZ_ParseString(spec, pColor) * SYNOPSIS */ Status -_XcmsCIEXYZ_ValidSpec(pColor) - XcmsColor *pColor; +_XcmsCIEXYZ_ValidSpec( + XcmsColor *pColor) /* * DESCRIPTION * Checks if color specification valid for CIE XYZ diff --git a/src/xcms/Xcmsint.h b/src/xcms/Xcmsint.h index 5e14195..ca8e057 100644 --- a/src/xcms/Xcmsint.h +++ b/src/xcms/Xcmsint.h @@ -29,7 +29,7 @@ * (i.e., for API internal use only) * */ -/* $XFree86: xc/lib/X11/Xcmsint.h,v 3.3 2001/07/25 15:04:44 dawes Exp $ */ +/* $XFree86: xc/lib/X11/Xcmsint.h,v 3.4 2003/04/13 19:22:19 dawes Exp $ */ #ifndef _XCMSINT_H_ #define _XCMSINT_H_ @@ -109,7 +109,7 @@ typedef struct _XcmsIntensityMap { VisualID visualID; XPointer screenData; /* pointer to corresponding Screen Color*/ /* Characterization Data */ - void (*pFreeScreenData)(); /* Function that frees a Screen */ + void (*pFreeScreenData)(XPointer pScreenDataTemp); /* Function that frees a Screen */ /* structure. */ struct _XcmsIntensityMap *pNext; } XcmsIntensityMap; @@ -176,6 +176,28 @@ typedef struct { IntensityTbl *pBlueTbl; } LINEAR_RGB_SCCData; +/* function prototypes */ +extern XcmsCmapRec * +_XcmsAddCmapRec( + Display *dpy, + Colormap cmap, + Window windowID, + Visual *visual); +extern void +_XcmsRGB_to_XColor( + XcmsColor *pColors, + XColor *pXColors, + unsigned int nColors); +extern Status +_XcmsResolveColorString ( + XcmsCCC ccc, + const char **color_string, + XcmsColor *pColor_exact_return, + XcmsColorFormat result_format); +extern void +_XUnresolveColor( + XcmsCCC ccc, + XColor *pXColor); /* * DESCRIPTION * Include file for defining the math macros used in the diff --git a/src/xcms/cmsAllCol.c b/src/xcms/cmsAllCol.c index 3cfce49..0bdeeeb 100644 --- a/src/xcms/cmsAllCol.c +++ b/src/xcms/cmsAllCol.c @@ -32,15 +32,11 @@ * * */ -/* $XFree86: xc/lib/X11/cmsAllCol.c,v 1.3 2001/01/17 19:41:50 dawes Exp $ */ +/* $XFree86: xc/lib/X11/cmsAllCol.c,v 1.4 2003/04/13 19:22:20 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" - -/* EXTERNS */ - -/* SetGetCols.c */ -extern Status _XcmsSetGetColors(); +#include "Cv.h" /* @@ -72,6 +68,6 @@ XcmsAllocColor(dpy, colormap, pXcmsColor_in_out, result_format) * */ { - return(_XcmsSetGetColors (XAllocColor, dpy, colormap, pXcmsColor_in_out, 1, + return(_XcmsSetGetColor(XAllocColor, dpy, colormap, pXcmsColor_in_out, result_format, (Bool *)NULL)); } diff --git a/src/xcms/cmsAllNCol.c b/src/xcms/cmsAllNCol.c index 2d5e46e..ffcb9df 100644 --- a/src/xcms/cmsAllNCol.c +++ b/src/xcms/cmsAllNCol.c @@ -32,21 +32,13 @@ * * */ -/* $XFree86: xc/lib/X11/cmsAllNCol.c,v 1.3 2001/01/17 19:41:50 dawes Exp $ */ +/* $XFree86: xc/lib/X11/cmsAllNCol.c,v 1.5 2003/11/17 22:20:11 dawes Exp $ */ #define NEED_REPLIES #include <stdio.h> #include "Xlibint.h" #include "Xcmsint.h" - -/* - * EXTERNS - */ -extern void _XColor_to_XcmsRGB(); -extern void _XcmsRGB_to_XColor(); - -/* cmsColNm.c */ -extern Status _XcmsResolveColorString(); +#include "Cv.h" /* @@ -55,7 +47,6 @@ extern Status _XcmsResolveColorString(); * * SYNOPSIS */ -#if NeedFunctionPrototypes Status XcmsAllocNamedColor ( Display *dpy, @@ -64,17 +55,6 @@ XcmsAllocNamedColor ( XcmsColor *pColor_scrn_return, XcmsColor *pColor_exact_return, XcmsColorFormat result_format) -#else -Status -XcmsAllocNamedColor(dpy, cmap, colorname, pColor_scrn_return, - pColor_exact_return, result_format) - Display *dpy; - Colormap cmap; - char *colorname; - XcmsColor *pColor_scrn_return; - XcmsColor *pColor_exact_return; - XcmsColorFormat result_format; -#endif /* * DESCRIPTION * Finds the color specification associated with the color diff --git a/src/xcms/cmsCmap.c b/src/xcms/cmsCmap.c index 84d60a4..0713497 100644 --- a/src/xcms/cmsCmap.c +++ b/src/xcms/cmsCmap.c @@ -33,18 +33,20 @@ * * */ +/* $XFree86: xc/lib/X11/cmsCmap.c,v 3.2 2003/04/13 19:22:20 dawes Exp $ */ #define NEED_EVENTS #define NEED_REPLIES #include "Xlibint.h" #include "Xcmsint.h" #include "Xutil.h" +#include "Cmap.h" +#include "Cv.h" /* * FORWARD DECLARATIONS */ -XcmsCmapRec *_XcmsAddCmapRec(); -static void _XcmsFreeClientCmaps(); +static void _XcmsFreeClientCmaps(Display *dpy); /************************************************************************ @@ -60,9 +62,9 @@ static void _XcmsFreeClientCmaps(); * SYNOPSIS */ static XcmsCmapRec * -CmapRecForColormap(dpy, cmap) - Display *dpy; - Colormap cmap; +CmapRecForColormap( + Display *dpy, + Colormap cmap) /* * DESCRIPTION * Find the corresponding XcmsCmapRec for cmap. In not found @@ -278,10 +280,10 @@ _XcmsAddCmapRec(dpy, cmap, windowID, visual) * SYNOPSIS */ XcmsCmapRec * -_XcmsCopyCmapRecAndFree(dpy, src_cmap, copy_cmap) - Display *dpy; - Colormap src_cmap; - Colormap copy_cmap; +_XcmsCopyCmapRecAndFree( + Display *dpy, + Colormap src_cmap, + Colormap copy_cmap) /* * DESCRIPTION * Augments Xlib's XCopyColormapAndFree() to copy @@ -317,9 +319,9 @@ _XcmsCopyCmapRecAndFree(dpy, src_cmap, copy_cmap) * SYNOPSIS */ void -_XcmsDeleteCmapRec(dpy, cmap) - Display *dpy; - Colormap cmap; +_XcmsDeleteCmapRec( + Display *dpy, + Colormap cmap) /* * DESCRIPTION * Removes and frees the specified XcmsCmapRec structure @@ -364,8 +366,8 @@ _XcmsDeleteCmapRec(dpy, cmap) * SYNOPSIS */ static void -_XcmsFreeClientCmaps(dpy) - Display *dpy; +_XcmsFreeClientCmaps( + Display *dpy) /* * DESCRIPTION * Frees all XcmsCmapRec structures in the linked list diff --git a/src/xcms/cmsColNm.c b/src/xcms/cmsColNm.c index e65faf9..67594c9 100644 --- a/src/xcms/cmsColNm.c +++ b/src/xcms/cmsColNm.c @@ -31,7 +31,7 @@ * * */ -/* $XFree86: xc/lib/X11/cmsColNm.c,v 3.10 2002/05/31 18:45:42 dawes Exp $ */ +/* $XFree86: xc/lib/X11/cmsColNm.c,v 3.12 2003/11/17 22:20:11 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" @@ -41,24 +41,10 @@ #include <ctype.h> #define XK_LATIN1 #include <X11/keysymdef.h> +#include "Cv.h" - -/* - * EXTERNS - * External declarations required locally to this package - * that are not already declared in any of the included header - * files (external includes or internal includes). - */ -extern XcmsColorSpace **_XcmsDIColorSpaces; - -/* CvCols.c */ -extern Status _XcmsDDConvertColors(); -extern int _XcmsEqualWhitePts(); -extern Status _XcmsDIConvertColors(); - - -static Status LoadColornameDB(); -void _XcmsCopyISOLatin1Lowered(); +/* forwards/locals */ +static Status LoadColornameDB(void); /* @@ -121,9 +107,9 @@ static const char whitePtStr[] = "WhitePoint"; * SYNOPSIS */ static XcmsColorSpace * -_XcmsColorSpaceOfString(ccc, color_string) - XcmsCCC ccc; - const char *color_string; +_XcmsColorSpaceOfString( + XcmsCCC ccc, + const char *color_string) /* * DESCRIPTION * Returns a pointer to the color space structure @@ -189,10 +175,10 @@ _XcmsColorSpaceOfString(ccc, color_string) * SYNOPSIS */ static int -_XcmsParseColorString(ccc, color_string, pColor) - XcmsCCC ccc; - const char *color_string; - XcmsColor *pColor; +_XcmsParseColorString( + XcmsCCC ccc, + const char *color_string, + XcmsColor *pColor) /* * DESCRIPTION * Assuming color_string contains a numerical string color @@ -254,8 +240,7 @@ _XcmsParseColorString(ccc, color_string, pColor) * SYNOPSIS */ static int -FirstCmp(p1, p2) - const void *p1, *p2; +FirstCmp(const void *p1, const void *p2) /* * DESCRIPTION * Compares the color names of XcmsColorTuples. @@ -280,7 +265,7 @@ FirstCmp(p1, p2) * SYNOPSIS */ static void -SetNoVisit() +SetNoVisit(void) /* * DESCRIPTION * @@ -309,11 +294,11 @@ SetNoVisit() * SYNOPSIS */ static int -field2(pBuf, delim, p1, p2) - char *pBuf; - char delim; /* in: field delimiter */ - char **p1; /* in/out: pointer to pointer to field 1 */ - char **p2; /* in/out: pointer to pointer to field 2 */ +field2( + char *pBuf, + char delim, /* in: field delimiter */ + char **p1, /* in/out: pointer to pointer to field 1 */ + char **p2) /* in/out: pointer to pointer to field 2 */ /* * DESCRIPTION * Extracts two fields from a "record". @@ -379,10 +364,10 @@ field2(pBuf, delim, p1, p2) * SYNOPSIS */ static Status -_XcmsLookupColorName(ccc, name, pColor) - XcmsCCC ccc; - const char **name; - XcmsColor *pColor; +_XcmsLookupColorName( + XcmsCCC ccc, + const char **name, + XcmsColor *pColor) /* * DESCRIPTION * Searches for an entry in the Device-Independent Color Name @@ -502,8 +487,8 @@ Retry: * SYNOPSIS */ static int -RemoveSpaces(pString) - char *pString; +RemoveSpaces( + char *pString) /* * DESCRIPTION * Removes spaces from string. @@ -536,10 +521,10 @@ RemoveSpaces(pString) * SYNOPSIS */ static int -stringSectionSize(stream, pNumEntries, pSectionSize) - FILE *stream; - int *pNumEntries; - int *pSectionSize; +stringSectionSize( + FILE *stream, + int *pNumEntries, + int *pSectionSize) /* * DESCRIPTION * Determines the amount of memory required to store the @@ -621,10 +606,10 @@ stringSectionSize(stream, pNumEntries, pSectionSize) * SYNOPSIS */ static Status -ReadColornameDB(stream, pRec, pString) - FILE *stream; - XcmsPair *pRec; - char *pString; +ReadColornameDB( + FILE *stream, + XcmsPair *pRec, + char *pString) /* * DESCRIPTION * Loads the Color Name Database from a text file. @@ -708,7 +693,7 @@ ReadColornameDB(stream, pRec, pString) * SYNOPSIS */ static Status -LoadColornameDB() +LoadColornameDB(void) /* * DESCRIPTION * Loads the Color Name Database from a text file. @@ -781,9 +766,9 @@ LoadColornameDB() * SYNOPSIS */ void -_XcmsCopyISOLatin1Lowered(dst, src) - char *dst; - const char *src; +_XcmsCopyISOLatin1Lowered( + char *dst, + const char *src) /* * DESCRIPTION * ISO Latin-1 case conversion routine @@ -824,21 +809,12 @@ _XcmsCopyISOLatin1Lowered(dst, src) * * SYNOPSIS */ -#if NeedFunctionPrototypes Status _XcmsResolveColorString ( XcmsCCC ccc, const char **color_string, XcmsColor *pColor_exact_return, XcmsColorFormat result_format) -#else -Status -_XcmsResolveColorString(ccc, color_string, pColor_exact_return, result_format) - XcmsCCC ccc; - const char **color_string; - XcmsColor *pColor_exact_return; - XcmsColorFormat result_format; -#endif /* * DESCRIPTION * The XcmsLookupColor function finds the color specification diff --git a/src/xcms/cmsGlobls.c b/src/xcms/cmsGlobls.c index accb6d8..ad4e45f 100644 --- a/src/xcms/cmsGlobls.c +++ b/src/xcms/cmsGlobls.c @@ -32,47 +32,11 @@ * * */ -/* $XFree86: xc/lib/X11/cmsGlobls.c,v 1.4 2001/01/17 19:41:51 dawes Exp $ */ +/* $XFree86: xc/lib/X11/cmsGlobls.c,v 1.5 2003/04/13 19:22:20 dawes Exp $ */ #include "Xlibint.h" #include "Xcmsint.h" - -/* - * EXTERNS - * External declarations required locally to this package - * that are not already declared in any of the included header - * files (external includes or internal includes). - */ -extern XcmsFunctionSet XcmsLinearRGBFunctionSet; -#ifdef GRAY -extern XcmsFunctionSet XcmsGrayFunctionSet; -#endif /* GRAY */ - -/* UNDEFINED Color Space */ -extern XcmsColorSpace XcmsUNDEFINEDColorSpace; - -/* CIE XYZ Color Space */ -extern XcmsColorSpace XcmsCIEXYZColorSpace; - -/* CIE uvY Color Space */ -extern XcmsColorSpace XcmsCIEuvYColorSpace; - -/* CIE xyY Color Space */ -extern XcmsColorSpace XcmsCIExyYColorSpace; - -/* CIE Lab Color Space */ -extern XcmsColorSpace XcmsCIELabColorSpace; - -/* CIE Luv Color Space */ -extern XcmsColorSpace XcmsCIELuvColorSpace; - -/* TekHVC Color Space */ -extern XcmsColorSpace XcmsTekHVCColorSpace; - -/* Device Dependent Color Space Structures */ -extern XcmsColorSpace XcmsRGBiColorSpace; -extern XcmsColorSpace XcmsRGBColorSpace; - +#include "Cv.h" /* * GLOBALS diff --git a/src/xcms/cmsInt.c b/src/xcms/cmsInt.c index cf492a5..4881a69 100644 --- a/src/xcms/cmsInt.c +++ b/src/xcms/cmsInt.c @@ -34,32 +34,20 @@ * * */ -/* $XFree86: xc/lib/X11/cmsInt.c,v 1.3 2001/01/17 19:41:51 dawes Exp $ */ +/* $XFree86: xc/lib/X11/cmsInt.c,v 1.5 2003/04/17 02:06:31 dawes Exp $ */ /* #define NEED_EVENTS */ #include <stdio.h> #include "Xlibint.h" #include "Xcmsint.h" +#include "Cv.h" #ifndef XCMSCOMPPROC # define XCMSCOMPPROC XcmsTekHVCClipC #endif -/* - * EXTERNS - */ -extern XcmsColorSpace **_XcmsDIColorSpaces; -extern XcmsFunctionSet **_XcmsSCCFuncSets; - -/* LRGB.c */ -extern int _XcmsLRGB_InitScrnDefault(); - -static void _XcmsFreeDefaultCCCs(); - -/* - * GLOBALS - */ - +/* forward/static */ +static void _XcmsFreeDefaultCCCs(Display *dpy); /************************************************************************ @@ -75,8 +63,8 @@ static void _XcmsFreeDefaultCCCs(); * SYNOPSIS */ XPointer * -_XcmsCopyPointerArray(pap) - XPointer *pap; +_XcmsCopyPointerArray( + XPointer *pap) /* * DESCRIPTION * Copies an array of NULL terminated pointers. @@ -108,8 +96,8 @@ _XcmsCopyPointerArray(pap) * SYNOPSIS */ void -_XcmsFreePointerArray(pap) - XPointer *pap; +_XcmsFreePointerArray( + XPointer *pap) /* * DESCRIPTION * Frees an array of NULL terminated pointers. @@ -129,10 +117,10 @@ _XcmsFreePointerArray(pap) * SYNOPSIS */ XPointer * -_XcmsPushPointerArray(pap, p, papNoFree) - XPointer *pap; - XPointer p; - XPointer *papNoFree; +_XcmsPushPointerArray( + XPointer *pap, + XPointer p, + XPointer *papNoFree) /* * DESCRIPTION * Places the specified pointer at the head of an array of NULL @@ -171,8 +159,8 @@ _XcmsPushPointerArray(pap, p, papNoFree) * SYNOPSIS */ int -_XcmsInitDefaultCCCs(dpy) - Display *dpy; +_XcmsInitDefaultCCCs( + Display *dpy) /* * DESCRIPTION * Initializes the Xcms per Display Info structure @@ -232,8 +220,8 @@ _XcmsInitDefaultCCCs(dpy) * SYNOPSIS */ static void -_XcmsFreeDefaultCCCs(dpy) - Display *dpy; +_XcmsFreeDefaultCCCs( + Display *dpy) /* * DESCRIPTION * This routine frees the default XcmsCCC's associated with @@ -291,9 +279,9 @@ _XcmsFreeDefaultCCCs(dpy) * SYNOPSIS */ int -_XcmsInitScrnInfo(dpy, screenNumber) - register Display *dpy; - int screenNumber; +_XcmsInitScrnInfo( + register Display *dpy, + int screenNumber) /* * DESCRIPTION * Given a display and screen number, this routine attempts @@ -364,8 +352,8 @@ _XcmsInitScrnInfo(dpy, screenNumber) * SYNOPSIS */ void -_XcmsFreeIntensityMaps(dpy) - Display *dpy; +_XcmsFreeIntensityMaps( + Display *dpy) /* * DESCRIPTION * Frees all XcmsIntensityMap structures in the linked list @@ -397,9 +385,9 @@ _XcmsFreeIntensityMaps(dpy) * SYNOPSIS */ XcmsIntensityMap * -_XcmsGetIntensityMap(dpy, visual) - Display *dpy; - Visual *visual; +_XcmsGetIntensityMap( + Display *dpy, + Visual *visual) /* * DESCRIPTION * Attempts to return a per-Visual intensity map. diff --git a/src/xcms/cmsLkCol.c b/src/xcms/cmsLkCol.c index 16704e4..ff5e69e 100644 --- a/src/xcms/cmsLkCol.c +++ b/src/xcms/cmsLkCol.c @@ -32,23 +32,13 @@ * * */ -/* $XFree86: xc/lib/X11/cmsLkCol.c,v 1.4 2001/07/25 15:04:44 dawes Exp $ */ +/* $XFree86: xc/lib/X11/cmsLkCol.c,v 1.6 2003/11/17 22:20:11 dawes Exp $ */ #define NEED_REPLIES #include <stdio.h> #include "Xlibint.h" #include "Xcmsint.h" - -/* - * EXTERNS - */ -extern void _XColor_to_XcmsRGB(); -extern void _XcmsRGB_to_XColor(); -extern void _XcmsResolveColor(); -extern void _XcmsUnresolveColor(); - -/* cmsColNm.c */ -extern Status _XcmsResolveColorString(); +#include "Cv.h" /* @@ -57,7 +47,6 @@ extern Status _XcmsResolveColorString(); * * SYNOPSIS */ -#if NeedFunctionPrototypes Status XcmsLookupColor ( Display *dpy, @@ -66,17 +55,6 @@ XcmsLookupColor ( XcmsColor *pColor_exact_return, XcmsColor *pColor_scrn_return, XcmsColorFormat result_format) -#else -Status -XcmsLookupColor(dpy, cmap, colorname, pColor_exact_return, pColor_scrn_return, - result_format) - Display *dpy; - Colormap cmap; - char *colorname; - XcmsColor *pColor_exact_return; - XcmsColor *pColor_scrn_return; - XcmsColorFormat result_format; -#endif /* * DESCRIPTION * The XcmsLookupColor function finds the color specification diff --git a/src/xcms/cmsProp.c b/src/xcms/cmsProp.c index 28d7a88..dfa0307 100644 --- a/src/xcms/cmsProp.c +++ b/src/xcms/cmsProp.c @@ -31,10 +31,12 @@ * This utility routines for manipulating properties. * */ +/* $XFree86: xc/lib/X11/cmsProp.c,v 1.2 2003/04/13 19:22:20 dawes Exp $ */ #include <X11/Xatom.h> #include "Xlibint.h" #include "Xcmsint.h" +#include "Cv.h" /************************************************************************ @@ -51,10 +53,10 @@ * SYNOPSIS */ unsigned long -_XcmsGetElement (format, pValue, pCount) - int format; - char **pValue; - unsigned long *pCount; +_XcmsGetElement( + int format, + char **pValue, + unsigned long *pCount) /* * DESCRIPTION * Get the next element from the property and return it. @@ -97,14 +99,14 @@ _XcmsGetElement (format, pValue, pCount) * SYNOPSIS */ int -_XcmsGetProperty (pDpy, w, property, pFormat, pNItems, pNBytes, pValue) - Display *pDpy; - Window w; - Atom property; - int *pFormat; - unsigned long *pNItems; - unsigned long *pNBytes; - char **pValue; +_XcmsGetProperty( + Display *pDpy, + Window w, + Atom property, + int *pFormat, + unsigned long *pNItems, + unsigned long *pNBytes, + char **pValue) /* * DESCRIPTION * diff --git a/src/xcms/cmsTrig.c b/src/xcms/cmsTrig.c index 4db4456..f56c5e7 100644 --- a/src/xcms/cmsTrig.c +++ b/src/xcms/cmsTrig.c @@ -24,7 +24,7 @@ * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/lib/X11/cmsTrig.c,v 3.8 2001/10/28 03:32:34 tsi Exp $ */ +/* $XFree86: xc/lib/X11/cmsTrig.c,v 3.9 2003/04/13 19:22:20 dawes Exp $ */ /* * It should be pointed out that for simplicity's sake, the * environment parameters are defined as floating point constants, @@ -45,25 +45,22 @@ * */ -/* - * EXTERNS - */ -extern double _XcmsSquareRoot(); +#include "Xcmsint.h" -/* - * FORWARD DECLARATIONS - */ -double _XcmsCosine(); -static double _XcmsModulo(); -static double _XcmsModuloF(); -static double _XcmsPolynomial(); -double _XcmsSine(); -double _XcmsArcTangent(); +/* forward/static */ +static double _XcmsModulo(double value, double base); +static double _XcmsPolynomial( + register int order, + double const *coeffs, + double x); +static double +_XcmsModuloF( + double val, + register double *dp); /* * DEFINES */ - #define XCMS_MAXERROR 0.000001 #define XCMS_MAXITER 10000 #define XCMS_PI 3.14159265358979323846264338327950 @@ -228,8 +225,7 @@ static double const sin_qcoeffs[] = { * */ -double _XcmsCosine (x) -double x; +double _XcmsCosine(double x) { auto double y; auto double yt2; @@ -289,9 +285,7 @@ double x; * Fred Fish * */ -static double _XcmsModulo (value, base) -double value; -double base; +static double _XcmsModulo(double value, double base) { auto double intpart; @@ -312,9 +306,9 @@ double base; * defined in "math.h". */ static double -_XcmsModuloF(val, dp) -double val; -register double *dp; +_XcmsModuloF( + double val, + register double *dp) { register double abs; /* @@ -377,10 +371,10 @@ register double *dp; * */ -static double _XcmsPolynomial (order, coeffs, x) -register int order; -double const *coeffs; -double x; +static double _XcmsPolynomial( + register int order, + double const *coeffs, + double x) { auto double rtn_value; diff --git a/src/xcms/uvY.c b/src/xcms/uvY.c index a0509f3..b90ff68 100644 --- a/src/xcms/uvY.c +++ b/src/xcms/uvY.c @@ -35,33 +35,20 @@ * DOCUMENTATION * "TekColor Color Management System, System Implementor's Manual" */ -/* $XFree86: xc/lib/X11/uvY.c,v 1.3 2001/01/17 19:41:57 dawes Exp $ */ +/* $XFree86: xc/lib/X11/uvY.c,v 1.4 2003/04/13 19:22:22 dawes Exp $ */ #include <X11/Xos.h> #include "Xlibint.h" #include "Xcmsint.h" +#include "Cv.h" #include <stdio.h> - -/* - * EXTERNS - */ -extern char _XcmsCIEuvY_prefix[]; - -/* CvCols.c */ -extern Status _XcmsDIConvertColors(); - -/* XYZ.c */ -extern Status _XcmsCIEXYZ_ValidSpec(); - - /* * FORWARD DECLARATIONS */ +static int CIEuvY_ParseString(register char *spec, XcmsColor *pColor); -static int CIEuvY_ParseString(); -Status _XcmsCIEuvY_ValidSpec(); /* * DEFINES * Internal definitions that need NOT be exported to any package @@ -127,9 +114,9 @@ XcmsColorSpace XcmsCIEuvYColorSpace = * SYNOPSIS */ static int -CIEuvY_ParseString(spec, pColor) - register char *spec; - XcmsColor *pColor; +CIEuvY_ParseString( + register char *spec, + XcmsColor *pColor) /* * DESCRIPTION * This routines takes a string and attempts to convert @@ -190,8 +177,8 @@ CIEuvY_ParseString(spec, pColor) * SYNOPSIS */ Status -_XcmsCIEuvY_ValidSpec(pColor) - XcmsColor *pColor; +_XcmsCIEuvY_ValidSpec( + XcmsColor *pColor) /* * DESCRIPTION * Checks if color specification valid for CIE u'v'Y. diff --git a/src/xcms/xyY.c b/src/xcms/xyY.c index 7b1b773..8619c27 100644 --- a/src/xcms/xyY.c +++ b/src/xcms/xyY.c @@ -34,12 +34,13 @@ * DOCUMENTATION * "TekColor Color Management System, System Implementor's Manual" */ -/* $XFree86: xc/lib/X11/xyY.c,v 1.3 2001/01/17 19:41:57 dawes Exp $ */ +/* $XFree86: xc/lib/X11/xyY.c,v 1.4 2003/04/13 19:22:22 dawes Exp $ */ #include <stdio.h> #include <X11/Xos.h> #include "Xlibint.h" #include "Xcmsint.h" +#include "Cv.h" /* * DEFINES @@ -52,23 +53,11 @@ #endif /* - * EXTERNS - */ - -extern char _XcmsCIExyY_prefix[]; - -/* CvCols.c */ -extern Status _XcmsDIConvertColors(); - -/* XYZ.c */ -extern Status _XcmsCIEXYZ_ValidSpec(); - -/* * FORWARD DECLARATIONS */ -static int CIExyY_ParseString(); -static Status XcmsCIExyY_ValidSpec(); +static int CIExyY_ParseString(register char *spec, XcmsColor *pColor); +static Status XcmsCIExyY_ValidSpec(XcmsColor *pColor); /* @@ -124,9 +113,9 @@ XcmsColorSpace XcmsCIExyYColorSpace = * SYNOPSIS */ static int -CIExyY_ParseString(spec, pColor) - register char *spec; - XcmsColor *pColor; +CIExyY_ParseString( + register char *spec, + XcmsColor *pColor) /* * DESCRIPTION * This routines takes a string and attempts to convert @@ -188,8 +177,8 @@ CIExyY_ParseString(spec, pColor) * SYNOPSIS */ static Status -XcmsCIExyY_ValidSpec(pColor) - XcmsColor *pColor; +XcmsCIExyY_ValidSpec( + XcmsColor *pColor) /* * DESCRIPTION * Checks a valid CIExyY color specification. |