-/* $Id: context.c,v 1.33 2000/01/18 17:36:16 brianp Exp $ */
+/* $Id: context.c,v 1.34 2000/01/24 16:19:55 brianp Exp $ */
/*
* Mesa 3-D graphics library
if (!ss)
return NULL;
- ss->DisplayList = NewHashTable();
+ ss->DisplayList = _mesa_NewHashTable();
- ss->TexObjects = NewHashTable();
+ ss->TexObjects = _mesa_NewHashTable();
/* Default Texture objects */
outOfMemory = GL_FALSE;
if (!ss->DisplayList || !ss->TexObjects || outOfMemory) {
/* Ran out of memory at some point. Free everything and return NULL */
if (ss->DisplayList)
- DeleteHashTable(ss->DisplayList);
+ _mesa_DeleteHashTable(ss->DisplayList);
if (ss->TexObjects)
- DeleteHashTable(ss->TexObjects);
+ _mesa_DeleteHashTable(ss->TexObjects);
if (ss->DefaultD[1])
gl_free_texture_object(ss, ss->DefaultD[1]);
if (ss->DefaultD[2])
{
/* Free display lists */
while (1) {
- GLuint list = HashFirstEntry(ss->DisplayList);
+ GLuint list = _mesa_HashFirstEntry(ss->DisplayList);
if (list) {
gl_destroy_list(ctx, list);
}
break;
}
}
- DeleteHashTable(ss->DisplayList);
+ _mesa_DeleteHashTable(ss->DisplayList);
/* Free texture objects */
while (ss->TexObjectList)
/* this function removes from linked list too! */
gl_free_texture_object(ss, ss->TexObjectList);
}
- DeleteHashTable(ss->TexObjects);
+ _mesa_DeleteHashTable(ss->TexObjects);
FREE(ss);
}
-/* $Id: dlist.c,v 1.24 2000/01/13 00:24:48 brianp Exp $ */
+/* $Id: dlist.c,v 1.25 2000/01/24 16:19:54 brianp Exp $ */
/*
* Mesa 3-D graphics library
if (list==0)
return;
- block = (Node *) HashLookup(ctx->Shared->DisplayList, list);
+ block = (Node *) _mesa_HashLookup(ctx->Shared->DisplayList, list);
n = block;
done = block ? GL_FALSE : GL_TRUE;
}
}
- HashRemove(ctx->Shared->DisplayList, list);
+ _mesa_HashRemove(ctx->Shared->DisplayList, list);
}
static GLboolean
islist(GLcontext *ctx, GLuint list)
{
- if (list > 0 && HashLookup(ctx->Shared->DisplayList, list)) {
+ if (list > 0 && _mesa_HashLookup(ctx->Shared->DisplayList, list)) {
return GL_TRUE;
}
else {
ctx->CallDepth++;
- n = (Node *) HashLookup(ctx->Shared->DisplayList, list);
+ n = (Node *) _mesa_HashLookup(ctx->Shared->DisplayList, list);
done = GL_FALSE;
while (!done) {
return 0;
}
- base = HashFindFreeKeyBlock(ctx->Shared->DisplayList, range);
+ base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range);
if (base) {
/* reserve the list IDs by with empty/dummy lists */
GLint i;
for (i=0; i<range; i++) {
- HashInsert(ctx->Shared->DisplayList, base+i, make_empty_list());
+ _mesa_HashInsert(ctx->Shared->DisplayList, base+i, make_empty_list());
}
}
return base;
/* Destroy old list, if any */
gl_destroy_list(ctx, ctx->CurrentListNum);
/* Install the list */
- HashInsert(ctx->Shared->DisplayList, ctx->CurrentListNum, ctx->CurrentListPtr);
+ _mesa_HashInsert(ctx->Shared->DisplayList, ctx->CurrentListNum, ctx->CurrentListPtr);
if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
return;
}
- n = (Node *) HashLookup(ctx->Shared->DisplayList, list);
+ n = (Node *) _mesa_HashLookup(ctx->Shared->DisplayList, list);
fprintf( f, "START-LIST %u, address %p\n", list, (void*)n );
-/* $Id: hash.c,v 1.5 2000/01/04 08:14:36 brianp Exp $ */
+/* $Id: hash.c,v 1.6 2000/01/24 16:19:54 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
*
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
struct HashEntry *Next;
};
-struct HashTable {
+struct _mesa_HashTable {
struct HashEntry *Table[TABLE_SIZE];
GLuint MaxKey;
};
/*
* Return pointer to a new, empty hash table.
*/
-struct HashTable *NewHashTable(void)
+struct _mesa_HashTable *_mesa_NewHashTable(void)
{
- return CALLOC_STRUCT(HashTable);
+ return CALLOC_STRUCT(_mesa_HashTable);
}
/*
* Delete a hash table.
*/
-void DeleteHashTable(struct HashTable *table)
+void _mesa_DeleteHashTable(struct _mesa_HashTable *table)
{
GLuint i;
assert(table);
* key - the key
* Return: user data pointer or NULL if key not in table
*/
-void *HashLookup(const struct HashTable *table, GLuint key)
+void *_mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key)
{
GLuint pos;
const struct HashEntry *entry;
* key - the key (not zero)
* data - pointer to user data
*/
-void HashInsert(struct HashTable *table, GLuint key, void *data)
+void _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data)
{
/* search for existing entry with this key */
GLuint pos;
* Input: table - the hash table
* key - key of entry to remove
*/
-void HashRemove(struct HashTable *table, GLuint key)
+void _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key)
{
GLuint pos;
struct HashEntry *entry, *prev;
* By calling this function until zero is returned we can get
* the keys of all entries in the table.
*/
-GLuint HashFirstEntry(const struct HashTable *table)
+GLuint _mesa_HashFirstEntry(const struct _mesa_HashTable *table)
{
GLuint pos;
assert(table);
/*
* Dump contents of hash table for debugging.
*/
-void HashPrint(const struct HashTable *table)
+void _mesa_HashPrint(const struct _mesa_HashTable *table)
{
GLuint i;
assert(table);
* numKeys - number of keys needed
* Return: starting key of free block or 0 if failure
*/
-GLuint HashFindFreeKeyBlock(const struct HashTable *table, GLuint numKeys)
+GLuint _mesa_HashFindFreeKeyBlock(const struct _mesa_HashTable *table, GLuint numKeys)
{
GLuint maxKey = ~((GLuint) 0);
if (maxKey - numKeys > table->MaxKey) {
GLuint freeStart = 1;
GLuint key;
for (key=1; key!=maxKey; key++) {
- if (HashLookup(table, key)) {
+ if (_mesa_HashLookup(table, key)) {
/* darn, this key is already in use */
freeCount = 0;
freeStart = key+1;
printf("&a = %p\n", &a);
printf("&b = %p\n", &b);
- t = NewHashTable();
- HashInsert(t, 501, &a);
- HashInsert(t, 10, &c);
- HashInsert(t, 0xfffffff8, &b);
- HashPrint(t);
- printf("Find 501: %p\n", HashLookup(t,501));
- printf("Find 1313: %p\n", HashLookup(t,1313));
- printf("Find block of 100: %d\n", HashFindFreeKeyBlock(t, 100));
- DeleteHashTable(t);
+ t = _mesa_NewHashTable();
+ _mesa_HashInsert(t, 501, &a);
+ _mesa_HashInsert(t, 10, &c);
+ _mesa_HashInsert(t, 0xfffffff8, &b);
+ _mesa_HashPrint(t);
+ printf("Find 501: %p\n", _mesa_HashLookup(t,501));
+ printf("Find 1313: %p\n", _mesa_HashLookup(t,1313));
+ printf("Find block of 100: %d\n", _mesa_HashFindFreeKeyBlock(t, 100));
+ _mesa_DeleteHashTable(t);
return 0;
}
-/* $Id: hash.h,v 1.2 1999/11/11 01:22:26 brianp Exp $ */
+/* $Id: hash.h,v 1.3 2000/01/24 16:19:54 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
*
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
-extern struct HashTable *NewHashTable(void);
+extern struct _mesa_HashTable *_mesa_NewHashTable(void);
-extern void DeleteHashTable(struct HashTable *table);
+extern void _mesa_DeleteHashTable(struct _mesa_HashTable *table);
-extern void *HashLookup(const struct HashTable *table, GLuint key);
+extern void *_mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key);
-extern void HashInsert(struct HashTable *table, GLuint key, void *data);
+extern void _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data);
-extern void HashRemove(struct HashTable *table, GLuint key);
+extern void _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key);
-extern GLuint HashFirstEntry(const struct HashTable *table);
+extern GLuint _mesa_HashFirstEntry(const struct _mesa_HashTable *table);
-extern void HashPrint(const struct HashTable *table);
+extern void _mesa_HashPrint(const struct _mesa_HashTable *table);
-extern GLuint HashFindFreeKeyBlock(const struct HashTable *table, GLuint numKeys);
+extern GLuint _mesa_HashFindFreeKeyBlock(const struct _mesa_HashTable *table, GLuint numKeys);
#endif
-/* $Id: texobj.c,v 1.10 1999/12/01 21:10:08 brianp Exp $ */
+/* $Id: texobj.c,v 1.11 2000/01/24 16:19:55 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
*
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
if (name > 0) {
/* insert into hash table */
- HashInsert(shared->TexObjects, name, obj);
+ _mesa_HashInsert(shared->TexObjects, name, obj);
}
}
return obj;
if (t->Name) {
/* remove from hash table */
- HashRemove(shared->TexObjects, t->Name);
+ _mesa_HashRemove(shared->TexObjects, t->Name);
}
/* free texture image */
return;
}
- first = HashFindFreeKeyBlock(ctx->Shared->TexObjects, n);
+ first = _mesa_HashFindFreeKeyBlock(ctx->Shared->TexObjects, n);
/* Return the texture names */
for (i=0;i<n;i++) {
struct gl_texture_object *t;
if (texName[i]>0) {
t = (struct gl_texture_object *)
- HashLookup(ctx->Shared->TexObjects, texName[i]);
+ _mesa_HashLookup(ctx->Shared->TexObjects, texName[i]);
if (t) {
GLuint u;
for (u=0; u<MAX_TEXTURE_UNITS; u++) {
if (texName == 0)
newTexObj = ctx->Shared->DefaultD[dim];
else {
- struct HashTable *hash = ctx->Shared->TexObjects;
+ struct _mesa_HashTable *hash = ctx->Shared->TexObjects;
newTexObj = (struct gl_texture_object *) HashLookup(hash, texName);
if (!newTexObj)
struct gl_texture_object *t;
if (texName[i]>0) {
t = (struct gl_texture_object *)
- HashLookup(ctx->Shared->TexObjects, texName[i]);
+ _mesa_HashLookup(ctx->Shared->TexObjects, texName[i]);
if (t) {
t->Priority = CLAMP( priorities[i], 0.0F, 1.0F );
return GL_FALSE;
}
t = (struct gl_texture_object *)
- HashLookup(ctx->Shared->TexObjects, texName[i]);
+ _mesa_HashLookup(ctx->Shared->TexObjects, texName[i]);
if (t) {
if (ctx->Driver.IsTextureResident)
residences[i] = ctx->Driver.IsTextureResident( ctx, t );
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glIsTextures",
GL_FALSE);
- if (texture>0 && HashLookup(ctx->Shared->TexObjects, texture)) {
+ if (texture>0 && _mesa_HashLookup(ctx->Shared->TexObjects, texture)) {
return GL_TRUE;
}
else {