- Added reflection generation for symmetriqally missing reflections

to fourmess
- Fixed hdbtable, reflist and tasub up to work with GTSE
- Made TRICS do fast scans again
- Added support for SANS beam center calculations
- Fixed a bug where SICS apparently did double counting but in fact
  just omitted an error message and did not
- Added the harray command
This commit is contained in:
koennecke
2009-08-13 07:28:44 +00:00
parent eb5025ab3b
commit 98009be4c3
22 changed files with 653 additions and 80 deletions

View File

@@ -52,22 +52,22 @@ int SaveHdbTable(void *data, char *name, FILE * fd)
static int ClearTblCmd(pSICSOBJ self, SConnection *pCon, pHdb commandNode,
pHdb par[], int nPar)
{
pHdb node;
pHdb node, child, tmp;
node = GetHipadabaNode(self->objectNode,"data");
if(node != NULL){
if(CountHdbChildren(node) < 1){
return 1;
}
DeleteNodeData(node);
RemoveHdbNodeFromParent(node, pCon);
child = node->child;
while(child != NULL){
tmp = child;
child = child->next;
DeleteNodeData(tmp);
}
}
node = MakeHipadabaNode("data",HIPNONE,1);
if(node == NULL){
SCWrite(pCon,"ERROR: out of memory in ClearTblCmd", eError);
return 0;
}
AddHipadabaChild(self->objectNode,node,NULL);
node->child = NULL;
SendTreeChangeMessage(node,pCon);
SetDescriptorKey(self->pDes,"rowcount","0");
if(pCon != NULL){
SCparChange(pCon);
@@ -100,7 +100,8 @@ static int AddTblRowCmd(pSICSOBJ self, SConnection *pCon, pHdb commandNode,
child = template->child;
count = 0;
while(child != NULL){
val = MakeHipadabaNode(child->name,child->value.dataType, child->value.arrayLength);
val = MakeSICSHdbPar(child->name,usUser,
makeHdbValue(child->value.dataType, child->value.arrayLength));
if(count < nPar){
UpdateHipadabaPar(val,par[count]->value,pCon);
}
@@ -112,6 +113,7 @@ static int AddTblRowCmd(pSICSOBJ self, SConnection *pCon, pHdb commandNode,
child = GetHipadabaNode(self->objectNode,"data");
assert(child != NULL);
AddHipadabaChild(child,row, pCon);
SendTreeChangeMessage(child,pCon);
if(pCon != NULL){
SCparChange(pCon);
}
@@ -125,6 +127,10 @@ static int RepTblRowCmd(pSICSOBJ self, SConnection *pCon, pHdb commandNode,
char path[132];
pHdb row, val, child;
if(nPar < 1) {
SCPrintf(pCon,eError,"ERROR: no parameters found to reprow");
return 0;
}
snprintf(path,131,"data/%s", par[0]->value.v.text);
row = GetHipadabaNode(self->objectNode,path);
if(row == NULL){
@@ -134,7 +140,7 @@ static int RepTblRowCmd(pSICSOBJ self, SConnection *pCon, pHdb commandNode,
child = row->child;
count = 1;
while(child != NULL){
while(child != NULL && count < nPar){
if(count < nPar){
UpdateHipadabaPar(child,par[count]->value,pCon);
}
@@ -162,6 +168,7 @@ int ReadTableTemplate(pSICSOBJ self, SConnection *con)
template = GetHipadabaNode(self->objectNode,"template");
assert(template != NULL);
/* mogrify addrow */
node = GetHipadabaNode(self->objectNode,"addrow");
if(node != NULL){
DeleteHipadabaNode(node,pCon);
@@ -173,9 +180,12 @@ int ReadTableTemplate(pSICSOBJ self, SConnection *con)
SCWrite(pCon,"ERROR: out of memory in ReadTemplateCmd",eError );
return 0;
}
SetHdbProperty(cmd,"type","command");
SetHdbProperty(cmd,"priv","user");
child = template->child;
while(child != NULL){
node = MakeHipadabaNode(child->name, child->value.dataType, child->value.arrayLength);
node = MakeSICSHdbPar(child->name, usUser,
makeHdbValue(child->value.dataType, child->value.arrayLength));
if(node == NULL){
SCWrite(pCon,"ERROR: out of memory in ReadTemplateCmd",eError );
return 0;
@@ -184,18 +194,26 @@ int ReadTableTemplate(pSICSOBJ self, SConnection *con)
child = child->next;
}
/* mogrify reprow */
node = GetHipadabaNode(self->objectNode,"reprow");
if(node != NULL){
DeleteHipadabaNode(node,pCon);
}
cmd = AddSICSHdbPar(self->objectNode, "reprow", usUser,
MakeSICSFunc(AddTblRowCmd));
MakeSICSFunc(RepTblRowCmd));
if(cmd == NULL){
SCWrite(pCon,"ERROR: out of memory in ReadTemplateCmd",eError );
return 0;
}
node = MakeHipadabaNode("id",HIPTEXT,1);
SetHdbProperty(cmd,"type","command");
SetHdbProperty(cmd,"priv","user");
node = MakeSICSHdbPar("id",usUser, makeHdbValue(HIPTEXT,1));
AddHipadabaChild(cmd,node, pCon);
child = template->child;
while(child != NULL){
node = MakeHipadabaNode(child->name, child->value.dataType, child->value.arrayLength);
node = MakeSICSHdbPar(child->name, usUser,
makeHdbValue(child->value.dataType, child->value.arrayLength));
if(node == NULL){
SCWrite(pCon,"ERROR: out of memory in ReadTemplateCmd",eError );
return 0;
@@ -215,7 +233,7 @@ static int ReadTemplateCmd(pSICSOBJ self, SConnection *pCon, pHdb commandNode,
static int DelRowCmd(pSICSOBJ self, SConnection *pCon, pHdb commandNode,
pHdb par[], int nPar)
{
pHdb row = NULL;
pHdb row = NULL, data;
char path[132];
if(nPar < 1){
@@ -228,10 +246,12 @@ static int DelRowCmd(pSICSOBJ self, SConnection *pCon, pHdb commandNode,
SCPrintf(pCon,eError,"ERROR: row with ID %s not found", par[0]->value.v.text);
return 0;
}
data = row->mama;
DeleteHipadabaNode(row,pCon);
if(pCon != NULL){
SCparChange(pCon);
}
SendTreeChangeMessage(data,pCon);
SCSendOK(pCon);
return 1;
}
@@ -342,7 +362,7 @@ pSICSOBJ MakeHdbTable(char *name, char *hdbclass)
SetHdbProperty(result->objectNode,"viewer","mountaingumui.TableViewer");
result->pDes->SaveStatus = SaveHdbTable;
node = MakeHipadabaNode("template",HIPNONE,1);
node = MakeSICSHdbPar("template",usMugger,MakeHdbText("x,y"));
if(node == NULL){
return NULL;
}
@@ -358,15 +378,23 @@ pSICSOBJ MakeHdbTable(char *name, char *hdbclass)
cmd = AddSICSHdbPar(result->objectNode, "clear", usUser,
MakeSICSFunc(ClearTblCmd));
SetHdbProperty(cmd,"type","command");
SetHdbProperty(cmd,"priv","user");
cmd = AddSICSHdbPar(result->objectNode, "print", usUser,
MakeSICSFunc(ListTblCmd));
SetHdbProperty(cmd,"type","command");
SetHdbProperty(cmd,"priv","user");
cmd = AddSICSHdbPar(result->objectNode, "addrow", usUser,
MakeSICSFunc(AddTblRowCmd));
SetHdbProperty(cmd,"type","command");
SetHdbProperty(cmd,"priv","user");
cmd = AddSICSHdbPar(result->objectNode, "reprow", usUser,
MakeSICSFunc(RepTblRowCmd));
SetHdbProperty(cmd,"type","command");
SetHdbProperty(cmd,"priv","user");
cmd = AddSICSHdbPar(result->objectNode, "readtemplate", usUser,
MakeSICSFunc(ReadTemplateCmd));
@@ -374,12 +402,44 @@ pSICSOBJ MakeHdbTable(char *name, char *hdbclass)
cmd = AddSICSHdbPar(result->objectNode, "del", usUser,
MakeSICSFunc(DelRowCmd));
node = MakeHipadabaNode("id",HIPTEXT,1);
SetHdbProperty(cmd,"type","command");
SetHdbProperty(cmd,"priv","user");
SetHdbProperty(node,"priv","user");
AddHipadabaChild(cmd,node, NULL);
cmd = AddSICSHdbPar(result->objectNode, "get", usUser,
MakeSICSFunc(GetRowCmd));
SetHdbProperty(cmd,"type","command");
SetHdbProperty(cmd,"priv","user");
node = MakeHipadabaNode("id",HIPTEXT,1);
SetHdbProperty(node,"priv","user");
AddHipadabaChild(cmd,node, NULL);
return result;
}
/*---------------------------------------------------------------------------*/
int HdbTableFactory(SConnection *pCon, SicsInterp *pSics, void *pData,
int argc, char *argv[])
{
pSICSOBJ pNew = NULL;
int status;
if(argc < 2) {
SCWrite(pCon,"ERROR: need name of table to create", eError);
return 0;
}
pNew = MakeHdbTable(argv[1],"HdbTable");
if(pNew == NULL){
SCWrite(pCon,"ERROR: out of memory in MakeHdbTable", eError);
return 0;
}
status = AddCommand(pSics, argv[1], InterInvokeSICSOBJ, DefaultKill, pNew);
if (status != 1) {
SCWrite(pCon, "ERROR: duplicate HdbTable command not created", eError);
return 0;
}
return 1;
}