Home | History | Annotate | Download | only in common

Lines Matching defs:cache

108 /** \brief Find an option in an option cache with the name as key */
109 static GLuint findOption (const driOptionCache *cache, const char *name) {
111 GLuint size = 1 << cache->tableSize, mask = size - 1;
119 hash = (hash >> (16-cache->tableSize/2)) & mask;
124 if (cache->info[hash].name == 0)
126 else if (!strcmp (name, cache->info[hash].name))
135 /** \brief Count the real number of options in an option cache */
136 static GLuint countOptions (const driOptionCache *cache) {
137 GLuint size = 1 << cache->tableSize;
140 if (cache->info[i].name)
490 driOptionCache *cache;
524 if (!parseValue (&v, data->cache->info[opt].type, value))
526 if (!checkValue (&v, &data->cache->info[opt]))
553 driOptionCache *cache = data->cache;
565 opt = findOption (cache, attrVal[OA_NAME]);
566 if (cache->info[opt].name)
570 XSTRDUP (cache->info[opt].name, attrVal[OA_NAME]);
573 cache->info[opt].type = DRI_BOOL;
575 cache->info[opt].type = DRI_ENUM;
577 cache->info[opt].type = DRI_INT;
579 cache->info[opt].type = DRI_FLOAT;
583 defaultVal = getenv (cache->info[opt].name);
588 cache->info[opt].name);
591 if (!parseValue (&cache->values[opt], cache->info[opt].type, defaultVal))
592 XML_FATAL ("illegal default value for %s: %s.", cache->info[opt].name, defaultVal);
595 if (cache->info[opt].type == DRI_BOOL)
597 if (!parseRanges (&cache->info[opt], attrVal[OA_VALID]))
599 if (!checkValue (&cache->values[opt], &cache->info[opt]))
602 } else if (cache->info[opt].type == DRI_ENUM) {
605 cache->info[opt].nRanges = 0;
606 cache->info[opt].ranges = NULL;
718 userData.cache = info;
748 driOptionCache *cache;
812 driOptionCache *cache = data->cache;
813 GLuint opt = findOption (cache, name);
814 if (cache->info[opt].name == NULL)
816 else if (getenv (cache->info[opt].name))
819 cache->info[opt].name);
820 else if (!parseValue (&cache->values[opt], cache->info[opt].type, value))
894 /** \brief Initialize an option cache based on info */
895 static void initOptionCache (driOptionCache *cache, const driOptionCache *info) {
896 cache->info = info->info;
897 cache->tableSize = info->tableSize;
898 cache->values = MALLOC ((1<<info->tableSize) * sizeof (driOptionValue));
899 if (cache->values == NULL) {
903 memcpy (cache->values, info->values,
946 void driParseConfigFiles (driOptionCache *cache, const driOptionCache *info,
953 initOptionCache (cache, info);
955 userData.cache = cache;
1011 void driDestroyOptionCache (driOptionCache *cache) {
1012 if (cache->values)
1013 FREE (cache->values);
1016 GLboolean driCheckOption (const driOptionCache *cache, const char *name,
1018 GLuint i = findOption (cache, name);
1019 return cache->info[i].name != NULL && cache->info[i].type == type;
1022 GLboolean driQueryOptionb (const driOptionCache *cache, const char *name) {
1023 GLuint i = findOption (cache, name);
1025 assert (cache->info[i].name != NULL);
1026 assert (cache->info[i].type == DRI_BOOL);
1027 return cache
1030 GLint driQueryOptioni (const driOptionCache *cache, const char *name) {
1031 GLuint i = findOption (cache, name);
1033 assert (cache->info[i].name != NULL);
1034 assert (cache->info[i].type == DRI_INT || cache->info[i].type == DRI_ENUM);
1035 return cache->values[i]._int;
1038 GLfloat driQueryOptionf (const driOptionCache *cache, const char *name) {
1039 GLuint i = findOption (cache, name);
1041 assert (cache->info[i].name != NULL);
1042 assert (cache->info[i].type == DRI_FLOAT);
1043 return cache->values[i]._float;