From d450d0b0e228e5b16c04b2a1acb9ea549aa690f2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 12 Dec 2003 16:38:57 +0000 Subject: applied Felix's patch for configuration system --- src/mesa/drivers/dri/common/xmlconfig.c | 19 ++++++++++--------- src/mesa/drivers/dri/common/xmlconfig.h | 23 +++++++++++------------ 2 files changed, 21 insertions(+), 21 deletions(-) (limited to 'src/mesa/drivers/dri/common') diff --git a/src/mesa/drivers/dri/common/xmlconfig.c b/src/mesa/drivers/dri/common/xmlconfig.c index a6d4c8ab94..887f720f0d 100644 --- a/src/mesa/drivers/dri/common/xmlconfig.c +++ b/src/mesa/drivers/dri/common/xmlconfig.c @@ -504,16 +504,17 @@ static void optInfoEndElem (void *userData, const XML_Char *name) { } } -void driParseOptionInfo (driOptionCache *info) { +void driParseOptionInfo (driOptionCache *info, + const char *configOptions, GLuint nConfigOptions) { XML_Parser p; int status; struct OptInfoData userData; struct OptInfoData *data = &userData; - GLuint nOptions; + GLuint realNoptions; /* determine hash table size and allocate memory */ GLuint size, log2size; - for (size = 1, log2size = 0; size < __driNConfigOptions*3/2; + for (size = 1, log2size = 0; size < nConfigOptions*3/2; size <<= 1, ++log2size); info->tableSize = log2size; info->info = CALLOC (size * sizeof (driOptionInfo)); @@ -537,21 +538,21 @@ void driParseOptionInfo (driOptionCache *info) { userData.inEnum = GL_FALSE; userData.curOption = -1; - status = XML_Parse (p, __driConfigOptions, strlen (__driConfigOptions), 1); + status = XML_Parse (p, configOptions, strlen (configOptions), 1); if (!status) XML_FATAL ("%s.", XML_ErrorString(XML_GetErrorCode(p))); XML_ParserFree (p); - /* Check if the actual number of options matches __driNConfigOptions. + /* Check if the actual number of options matches nConfigOptions. * A mismatch is not fatal (a hash table overflow would be) but we * want the driver developer's attention anyway. */ - nOptions = countOptions (info); - if (nOptions != __driNConfigOptions) { + realNoptions = countOptions (info); + if (realNoptions != nConfigOptions) { fprintf (stderr, - "Error: __driNConfigOptions (%u) does not match the actual number of options in\n" + "Error: nConfigOptions (%u) does not match the actual number of options in\n" " __driConfigOptions (%u).\n", - __driNConfigOptions, nOptions); + nConfigOptions, realNoptions); } } diff --git a/src/mesa/drivers/dri/common/xmlconfig.h b/src/mesa/drivers/dri/common/xmlconfig.h index 710e328e01..b636349b1f 100644 --- a/src/mesa/drivers/dri/common/xmlconfig.h +++ b/src/mesa/drivers/dri/common/xmlconfig.h @@ -81,21 +81,20 @@ typedef struct driOptionCache { * The value is the same in the screen and all contexts. */ } driOptionCache; -/** \brief XML document describing available options +/** \brief Parse XML option info from configOptions * - * This must be defined in a driver-specific soure file. xmlpool.h - * defines helper macros and common options. */ -extern const char __driConfigOptions[]; -/** \brief The number of options supported by a driver + * To be called in CreateScreen * - * This is used to choose an appropriate hash table size. So any value - * larger than the actual number of options will work. */ -extern const GLuint __driNConfigOptions; - -/** \brief Parse XML option info from __driConfigOptions + * \param info pointer to a driOptionCache that will store the option info + * \param configOptions XML document describing available configuration opts + * \param nConfigOptions number of options, used to choose a hash table size * - * To be called in CreateScreen */ -void driParseOptionInfo (driOptionCache *info); + * For the option information to be available to external configuration tools + * it must be a public symbol __driConfigOptions. It is also passed as a + * parameter to driParseOptionInfo in order to avoid driver-independent code + * depending on symbols in driver-specific code. */ +void driParseOptionInfo (driOptionCache *info, + const char *configOptions, GLuint nConfigOptions); /** \brief Initialize option cache from info and parse configuration files * * To be called in CreateContext. screenNum and driverName select -- cgit v1.2.3