int StaticList_Insert(StaticList* list,StaticListNode* node,int pos)
{
TStaticList* sList = (TStaticList*)list;
int ret = (sList != NULL);
int index = 0;
int i = 0;
int current = 0;
ret = ret && (sList->header.data + 1 <= sList->capacity);
ret = ret && (pos >=0) && (node != NULL);
if( ret )
{
for(i=1;i<=sList->capacity;i++)
{
if( sList->node[i].next == AVAILABLE)
{
index = i;
break;
}
}
sList->node[index].data = (unsigned int)node;
sList->node[0] = sList->header;
for(i=0;(i<pos) && (sList->node[current].next != 0);i++)
{
current = sList->node[current].next;
}
sList->node[index].next = sList->node[current].next;
sList->node[current].next = index;
sList->node[0].data++;
sList->header = sList->node[0];
}
return ret;
}
{
TStaticList* sList = (TStaticList*)list;
int ret = (sList != NULL);
int index = 0;
int i = 0;
int current = 0;
ret = ret && (sList->header.data + 1 <= sList->capacity);
ret = ret && (pos >=0) && (node != NULL);
if( ret )
{
for(i=1;i<=sList->capacity;i++)
{
if( sList->node[i].next == AVAILABLE)
{
index = i;
break;
}
}
sList->node[index].data = (unsigned int)node;
sList->node[0] = sList->header;
for(i=0;(i<pos) && (sList->node[current].next != 0);i++)
{
current = sList->node[current].next;
}
sList->node[index].next = sList->node[current].next;
sList->node[current].next = index;
sList->node[0].data++;
sList->header = sList->node[0];
}
return ret;
}