/* Copyright (c) 2001, Stanford University
* All rights reserved
*
* See the file LICENSE.txt for information on redistributing this software.
*/
#include "chromium.h"
#include "cr_error.h"
#include "cr_mem.h"
#include "cr_idpool.h"
typedef struct FreeElemRec {
} FreeElem;
struct CRIdPoolRec {
};
{
return pool;
}
{
{
crFree(i);
}
}
/*
* Allocate a block of <count> IDs. Return index of first one.
* Return 0 if we fail.
*/
{
FreeElem *f;
while (f)
{
{
/* found a sufficiently large enough block */
{
/* remove this block from linked list */
{
/* remove from head */
}
else
{
/* remove from elsewhere */
}
crFree(f);
}
#ifdef DEBUG
/* make sure the IDs really are allocated */
{
GLuint i;
for (i = 0; i < count; i++)
{
}
}
#endif
return ret;
}
else {
f = f->next;
}
}
/* failed to find free block */
return 0;
}
/*
* Free a block of <count> IDs starting at <first>.
*/
{
FreeElem *i;
/*********************************/
/* Add the name to the freeList */
/* Find the bracketing sequences */
{
/* EMPTY BODY */
}
/* j will always be valid */
if (!i)
return;
return;
/* Case: j:(~,first-1) */
{
{
/* Collapse */
if (i->prev)
{
}
{
}
crFree(i);
}
return;
}
/* Case: j->next: (first+1, ~) */
{
{
/* Collapse */
if (i->prev)
{
}
{
}
crFree(i);
}
return;
}
/* Case: j: (first+1, ~) j->next: null */
{
return;
}
/* allocate a new FreeElem node */
/* Case: j: (~,first-(2+)) j->next: (first+(2+), ~) or null */
{
if (i->next)
{
}
return;
}
/* Case: j: (first+(2+), ~) */
/* Can only happen if j = t->freeList! */
{
return;
}
}
/*
* Mark the given Id as being allocated.
*/
{
FreeElem *f;
while (f)
{
{
/* found the block */
{
f->min++;
}
{
f->max--;
}
else
{
/* somewhere in the middle - split the block */
if (f->next)
}
return;
}
f = f->next;
}
/* if we get here, the ID was already allocated - that's OK */
}
/*
* Determine if the given id is free. Return GL_TRUE if so.
*/
{
FreeElem *i;
/* First find which region it fits in */
{
/* EMPTY BODY */
}
if (i)
return GL_TRUE;
else
return GL_FALSE;
}
/*
* Determine if the given id is used. Return GL_TRUE if so.
*/
{
}