/* $XConsortium: xpmP.h /main/cde1_maint/3 1995/09/06 02:20:59 lehors $ */
/*
 * (c) Copyright 1993, 1994 Hewlett-Packard Company                     *
 * (c) Copyright 1993, 1994 International Business Machines Corp.       *
 * (c) Copyright 1993, 1994 Sun Microsystems, Inc.                      *
 * (c) Copyright 1993, 1994 Novell, Inc.                                *
 */
/* Copyright 1990-92 GROUPE BULL -- See license conditions in file COPYRIGHT */
/*****************************************************************************\
* xpmP.h:                                                                     *
*                                                                             *
*  XPM library                                                                *
*  Private Include file                                                       *
*                                                                             *
*  Developed by Arnaud Le Hors                                                *
\*****************************************************************************/

#ifndef XPMP_h
#define XPMP_h

#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#include <X11/Xutil.h>
#include <stdio.h>

#include <Xm/XpmI.h>
#include "xpm.h"

#if defined(SYSV) || defined(SVR4)
#define bcopy(source, dest, count) memcpy(dest, source, count)
#endif

typedef unsigned char byte;

/*
 * Change these to #defines to permit late-binding with Xm symbols
 * extern xpmDataType _DtxpmDataTypes[];
 * extern char **_DtxpmColorKeys;
*/
#define _DtxpmColorKeys _XmxpmColorKeys
#define _DtxpmDataTypes _XmxpmDataTypes

/*
 * key numbers for visual type, they must fit along with the number key of
 * each corresponding element in _DtxpmColorKeys[] defined in xpm.h
 */
#define MONO	2
#define GRAY4	3
#define GRAY 	4
#define COLOR	5

/* XPM private routines */

FUNC(_DtxpmWriteData, int, (xpmData * mdata,
		    xpmInternAttrib * attrib, XpmAttributes * attributes));

FUNC(_DtxpmCreateData, int, (char ***data_return,
		    xpmInternAttrib * attrib, XpmAttributes * attributes));

FUNC(_DtxpmParseDataAndCreateImage, int, (xpmData * data,
				       Display * display,
				       XImage ** image_return,
				       XImage ** shapeimage_return,
				       xpmInternAttrib * attrib_return,
				       XpmAttributes * attributes));

FUNC(_DtxpmCreateImage, int, (Display * display,
			   xpmInternAttrib * attrib,
			   XImage ** image_return,
			   XImage ** shapeimage_return,
			   XpmAttributes * attributes));

FUNC(_DtxpmParseData, int, (xpmData * data,
			 xpmInternAttrib * attrib_return,
			 XpmAttributes * attributes));

FUNC(_DtxpmScanImage, int, (Display * display,
			 XImage * image,
			 XImage * shapeimage,
			 XpmAttributes * attributes,
			 xpmInternAttrib * attrib));

FUNC(_DtxpmFreeColorTable, int, (char ***colorTable, int ncolors));

FUNC(_DtxpmInitInternAttrib, int, (xpmInternAttrib * dtdata));

FUNC(_DtxpmFreeInternAttrib, int, (xpmInternAttrib * dtdata));

FUNC(_DtxpmSetAttributes, int, (xpmInternAttrib * attrib,
			     XpmAttributes * attributes));

FUNC(xpmGetAttributes, int, (XpmAttributes * attributes,
			     xpmInternAttrib * attrib));

/* I/O utility */

FUNC(_DtxpmNextString, int, (xpmData * mdata));
FUNC(_DtxpmNextUI, int, (xpmData * mdata, unsigned int *ui_return));

FUNC(_DtxpmNextWord, unsigned int, (xpmData * mdata, char *buf,
				    unsigned int buflen));
FUNC(_DtxpmGetCmt, int, (xpmData * mdata, char **cmt));
FUNC(_DtxpmReadFile, int, (char *filename, xpmData * mdata));
FUNC(_DtxpmWriteFile, int, (char *filename, xpmData * mdata));
FUNC(_DtxpmOpenArray, void, (char **data, xpmData * mdata));
FUNC(_DtXpmDataClose, int, (xpmData * mdata));

/* RGB utility */

FUNC(_DtxpmReadRgbNames, int, (char *rgb_fname, xpmRgbName * rgbn));
FUNC(_DtxpmGetRgbName, char *, (xpmRgbName * rgbn, int rgbn_max,
			     int red, int green, int blue));
FUNC(_DtxpmFreeRgbNames, void, (xpmRgbName * rgbn, int rgbn_max));

FUNC(_Dtxpm_xynormalizeimagebits, void, (register unsigned char *bp,
				      register XImage * img));
FUNC(_Dtxpm_znormalizeimagebits, void, (register unsigned char *bp,
				     register XImage * img));

FUNC(_DtxpmHashTableInit, int, (xpmHashTable *table));
FUNC(_DtxpmHashTableFree, void, (xpmHashTable *table));
FUNC(_DtxpmHashSlot, xpmHashAtom *, (xpmHashTable *table, char *s));
FUNC(_DtxpmHashIntern, int, (xpmHashTable *table, char *tag, void *data));

#endif
