Added reflist relabel

This relabels all reflections in numeric order again. This is necessary for travelsort
This commit is contained in:
2014-09-01 11:17:18 +02:00
parent 9500b59f04
commit 8ea20b87f4

View File

@ -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;
}