diff --git a/reflist.c b/reflist.c index 968614e3..0a8c1645 100644 --- a/reflist.c +++ b/reflist.c @@ -422,6 +422,28 @@ static int NamesCmd(pSICSOBJ self, SConnection * pCon, pHdb commandNode, return 1; } /*----------------------------------------------------------------------*/ +static int RelabelCmd(pSICSOBJ self, SConnection * pCon, pHdb commandNode, + pHdb par[], int nPar) +{ + char buffer[10]; + pHdb node = NULL; + int count = 0; + + node = GetHipadabaNode(self->objectNode, "data"); + node = node->child; + while (node != NULL) { + snprintf(buffer,sizeof(buffer),"%4.4d", count); + if(node->name != NULL){ + free(node->name); + node->name = strdup(buffer); + } + count++; + node = node->next; + } + + return 1; +} +/*----------------------------------------------------------------------*/ static int SetIndexCmd(pSICSOBJ self, SConnection * pCon, pHdb commandNode, pHdb par[], int nPar) { @@ -585,6 +607,11 @@ pSICSOBJ CreateReflectionList(SConnection * pCon, SicsInterp * pSics, cmd = AddSICSHdbPar(pNew->objectNode, "count", usUser, MakeSICSFunc(CountTblCmd)); + cmd = AddSICSHdbPar(pNew->objectNode, "relabel", usUser, + MakeSICSFunc(RelabelCmd)); + + + AddCommand(pSics, name, InterInvokeSICSOBJ, KillSICSOBJ, pNew); return pNew; }