/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/cards.h,v 3.3 1996/12/23 07:04:44 dawes Exp $ */





/* $XConsortium: cards.h /main/3 1996/02/21 18:12:53 kaleb $ */

#ifndef CARD_DATABASE_FILE
#define CARD_DATABASE_FILE "/usr/X11R6/lib/X11/Cards"
#endif

class Card {
	char *_vendor;		/* card name, broken into vendor and */
	char *_product;		/* product (or chipset, if no product) */
	int _custom;
public:
	char *name;		/* Name of the card. */
	char *_chipset;		/* Chipset (descriptive). */
	char *_usechip;		/* chipset to use in XF86Config (mumble) */
	char *server;		/* Server identifier. */
	char *ramdac;		/* Ramdac identifier. */
	char *clockchip;	/* Clockchip identifier. */
	char *dacspeed;		/* DAC speed rating. */
	int flags;
	char *lines;		/* Additional Device section lines. */

	inline char *chipset() { return _usechip ? _usechip : _chipset; }
	inline char *vendor() { return _vendor; }
	inline char *vendor(char *p) { return _vendor = p; }
	inline char *product() { return _product; }
	inline char *product(char *p) { return _product = p; }
	inline int   custom()	{ return _custom; }

	typedef void (messagefunc)(char*fmt, ...);
	static int Card::parse_database(messagefunc);
	int print(FILE *f);
	int scan(FILE *f);

	inline void Erase()	{   _vendor = 0;
				    _product = 0;
				    _custom = 0;
				    name = 0;
				    _chipset = 0;
				    _usechip = 0;
				    server = 0;
				    ramdac = 0;
				    clockchip = 0;
				    dacspeed = 0;
				    lines = 0; }

	inline Card() { Erase(); }

	inline Card &copy(Card &rhs) {
				    _vendor = rhs._vendor;
				    _product = rhs._product;
				    //_custom = rhs._custom;
				    name = rhs.name;
				    _chipset = rhs._chipset;
				    _usechip = rhs._usechip;
				    server = rhs.server;
				    ramdac = rhs.ramdac;
				    clockchip = rhs.clockchip;
				    dacspeed = rhs.dacspeed;
				    flags = rhs.flags; }

	inline Card &is(Card &rhs) {copy(rhs); rhs.Erase(); }
	int autodetect(int*);
};

/* Flags: */
#define NOCLOCKPROBE	0x1	/* Never probe clocks of the card. */
#define UNSUPPORTED	0x2	/* Card is not supported (only VGA). */
#define RAMPROBE	0x4	/* driver will detect the amount of memory */
#define NEED_CHIPSET	0x08	/* broken XFree86 driver requires chipset */

extern int nrcards;

extern Card *card;
