- Fixed missalignment in TAS scan messages

- Fixed a counting/driving race in devexec
- Fixed some problems with sanscheck


SKIPPED:
	psi/tasscan.c
	psi/utils/check/amorcheck
	psi/utils/check/dmccheck
	psi/utils/check/focuscheck
	psi/utils/check/hrptcheck
	psi/utils/check/sanscheck
	psi/utils/check/sicssyntaxlib.tcl
	psi/utils/check/topsicheck
	psi/utils/check/tricscheck
This commit is contained in:
cvs
2003-11-25 10:29:21 +00:00
parent 04bb17e56c
commit 90b5e37552
6 changed files with 220 additions and 124 deletions

View File

@ -431,11 +431,15 @@
} }
break; break;
case HWBusy: case HWBusy:
if(pCountInt) if(pCountInt != NULL && pDrivInt != NULL)
{ {
SetStatus(eCountDrive);
}
else if(pCountInt != NULL && pDrivInt == NULL)
{
SetStatus(eCounting); SetStatus(eCounting);
} }
else if(pDrivInt) else if(pDrivInt != NULL && pCountInt == NULL)
{ {
SetStatus(eDriving); SetStatus(eDriving);
} }

48
hkl.c
View File

@ -603,12 +603,23 @@ static int calculateBisecting(MATRIX z1, pHKL self, SConnection *pCon,
} }
/* /*
giving up! giving up! But calculate one more time in order to show Jurg where
he should be.
*/ */
for(i = 0; i < 4; i++) z1mToBisecting(self->fLambda,z1,&stt,&om,&chi,&phi);
{ if(iRetry == 1){
fSet[i] = .0; rotatePsi(om,chi,phi,psi,&ompsi,&chipsi,&phipsi);
fSet[0] = (float)stt;
fSet[1] = (float)ompsi;
fSet[2] = (float)chipsi;
fSet[3]= (float)phipsi;
} else {
fSet[0] = (float)stt;
fSet[1] = (float)om;
fSet[2] = (float)chi;
fSet[3]= (float)phi;
} }
return 0; return 0;
} }
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
@ -1203,6 +1214,7 @@ ente:
char pBueffel[512]; char pBueffel[512];
float fUB[9], fPsi, fVal; float fUB[9], fPsi, fVal;
float fHKL[3], fSet[4]; float fHKL[3], fSet[4];
double dVal;
pHKL self = NULL; pHKL self = NULL;
CommandList *pCom = NULL; CommandList *pCom = NULL;
pDummy pDum = NULL; pDummy pDum = NULL;
@ -1269,6 +1281,34 @@ ente:
return 1; return 1;
} }
} }
else if(strcmp(argv[1],"fromangles") == 0)
{
if(argc < 6)
{
SCWrite(pCon,
"ERROR: need stt, om, chi,phi to calculate HKL from angles",
eError);
return 0;
}
for(i = 0; i < 4; i++)
{
iRet = Tcl_GetDouble(InterpGetTcl(pSics),argv[i+2],&dVal);
if(iRet != TCL_OK)
{
snprintf(pBueffel,511,"ERROR: failed to convert %s to number",
argv[i+2]);
SCWrite(pCon,pBueffel,eError);
return 0;
}
fSet[i] = (float)dVal;
}
angle2HKL(self,(double)fSet[0],(double)fSet[1],
(double)fSet[2],(double)fSet[3],fHKL);
sprintf(pBueffel,"HKL from angles: %8.4f %8.4f %8.4f ",
fHKL[0], fHKL[1],fHKL[2]);
SCWrite(pCon,pBueffel,eValue);
return 1;
}
/*------------- lambda */ /*------------- lambda */
else if(strcmp(argv[1],"lambda") == 0) else if(strcmp(argv[1],"lambda") == 0)
{ {

View File

@ -10,7 +10,7 @@
Mark Koennecke, August 2002 Mark Koennecke, August 2002
-----------------------------------------------------------------------*/ -----------------------------------------------------------------------*/
#include <stdlib.h> #include <stdlib.h>
#include <assert.h> #include <assert.h>
#include "fortify.h" #include "fortify.h"
#include "motreg.h" #include "motreg.h"

281
napi5.c
View File

@ -53,6 +53,11 @@
char iAccess[2]; char iAccess[2];
} NexusFile5, *pNexusFile5; } NexusFile5, *pNexusFile5;
/*
forward declaration of NX5closegroup in order to get rid of a nasty
warning
*/
NXstatus CALLING_STYLE NX5closegroup (NXhandle fid);
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
@ -116,14 +121,12 @@
unsigned int vers_major, vers_minor, vers_release, am1 ; unsigned int vers_major, vers_minor, vers_release, am1 ;
hid_t fapl; hid_t fapl;
int mdc_nelmts; int mdc_nelmts;
unsigned long rdcc_nelmts; int rdcc_nelmts;
size_t rdcc_nbytes; size_t rdcc_nbytes;
double rdcc_w0; double rdcc_w0;
/* turn off the automatic HDF error handling */ /* turn off the automatic HDF error handling */
H5Eset_auto(NULL,NULL);
H5Eset_auto(NULL,NULL);
#ifdef USE_FTIME #ifdef USE_FTIME
struct timeb timeb_struct; struct timeb timeb_struct;
#endif #endif
@ -193,6 +196,12 @@
iRet=H5Pget_cache(fapl,&mdc_nelmts,&rdcc_nelmts,&rdcc_nbytes,&rdcc_w0); iRet=H5Pget_cache(fapl,&mdc_nelmts,&rdcc_nelmts,&rdcc_nbytes,&rdcc_w0);
rdcc_nbytes=(size_t)cacheSize; rdcc_nbytes=(size_t)cacheSize;
iRet = H5Pset_cache(fapl,mdc_nelmts,rdcc_nelmts,rdcc_nbytes,rdcc_w0); iRet = H5Pset_cache(fapl,mdc_nelmts,rdcc_nelmts,rdcc_nbytes,rdcc_w0);
/*
setting the close degree is absolutely necessary in HDF5
versions > 1.6. If you use a lessere version and the compiler
complains, comment it out but keep this in mind.
*/
H5Pset_fclose_degree(fapl,H5F_CLOSE_STRONG);
am1 = H5F_ACC_TRUNC; am1 = H5F_ACC_TRUNC;
pNew->iFID = H5Fcreate (filename, am1, H5P_DEFAULT, fapl); pNew->iFID = H5Fcreate (filename, am1, H5P_DEFAULT, fapl);
} else { } else {
@ -331,7 +340,8 @@
pNexusFile5 pFile = NULL; pNexusFile5 pFile = NULL;
int iRet; int iRet;
pFile=NXI5assert(*fid); pFile=NXI5assert(*fid);
iRet=0; iRet=0;
iRet = H5Fclose(pFile->iFID); iRet = H5Fclose(pFile->iFID);
if (iRet < 0) { if (iRet < 0) {
@ -347,6 +357,7 @@
} }
free (pFile); free (pFile);
*fid = NULL; *fid = NULL;
H5garbage_collect();
return NX_OK; return NX_OK;
} }
@ -1139,7 +1150,68 @@
} }
return 1; return 1;
} }
/* --------------------------------------------------------------------- */
/* Operator function. */
herr_t group_info1(hid_t loc_id, const char *name, void *opdata)
{
NexusFile5 self;
H5G_stat_t statbuf;
self.iNX = *((int*)opdata);
H5Gget_objinfo(loc_id, name, 0, &statbuf);
switch (statbuf.type)
{
case H5G_GROUP:
self.iNX++;
*((int*)opdata)=self.iNX;
break;
case H5G_DATASET:
self.iNX++;
*((int*)opdata)=self.iNX;
break;
}
return 0;
}
/*-------------------------------------------------------------------------*/
NXstatus CALLING_STYLE NX5getgroupinfo (NXhandle fid, int *iN, NXname pName, NXname pClass)
{
pNexusFile5 pFile;
hid_t atype,attr_id;
char data[64];
int iRet;
pFile = NXI5assert (fid);
/* check if there is a group open */
if (pFile->iCurrentG == 0) {
strcpy (pName, "root");
strcpy (pClass, "NXroot");
pFile->iNX=0;
iRet=H5Giterate(pFile->iFID,"/",0,group_info1,&pFile->iNX);
*iN=pFile->iNX;
}
else {
strcpy (pName,pFile->name_ref);
attr_id = H5Aopen_name(pFile->iCurrentG,"NX_class");
if (attr_id<0) {
strcpy(pClass,"non");
} else {
atype=H5Tcopy(H5T_C_S1);
H5Tset_size(atype,64);
H5Aread(attr_id, atype, data);
strcpy(pClass,data);
pFile->iNX=0;
iRet=H5Giterate(pFile->iFID,pFile->name_ref,0,group_info1, &pFile->iNX);
*iN=pFile->iNX;
H5Aclose(attr_id);
}
}
return NX_OK;
}
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
NXstatus CALLING_STYLE NX5getnextentry (NXhandle fid,NXname name, NXname nxclass, int *datatype) NXstatus CALLING_STYLE NX5getnextentry (NXhandle fid,NXname name, NXname nxclass, int *datatype)
@ -1151,6 +1223,7 @@
char data[128]; char data[128];
char ph_name[1024]; char ph_name[1024];
info_type op_data; info_type op_data;
int iRet_iNX=-1;
pFile = NXI5assert (fid); pFile = NXI5assert (fid);
op_data.iname = NULL; op_data.iname = NULL;
@ -1161,6 +1234,18 @@
} }
iRet=H5Giterate(pFile->iFID,pFile->name_ref,&idx,nxgroup_info,&op_data); iRet=H5Giterate(pFile->iFID,pFile->name_ref,&idx,nxgroup_info,&op_data);
strcpy(nxclass,""); strcpy(nxclass,"");
if (pFile->iCurrentG == 0) {
pFile->iNX=0;
iRet_iNX = H5Giterate(pFile->iFID,"/",0,group_info1,&pFile->iNX);
} else {
pFile->iNX=0;
iRet_iNX = H5Giterate(pFile->iFID,pFile->name_ref,0,group_info1, &pFile->iNX);
}
if (idx == pFile->iNX) {
iRet_iNX = 2;
}
if (iRet > 0) if (iRet > 0)
{ {
pFile->iStack5[pFile->iStackPtr].iCurrentIDX++; pFile->iStack5[pFile->iStackPtr].iCurrentIDX++;
@ -1245,23 +1330,22 @@
H5Tclose(atype); H5Tclose(atype);
H5Dclose(grp); H5Dclose(grp);
} }
return NX_OK; return NX_OK;
} }
else if (iRet==0)
{
if (op_data.iname != NULL) {
free(op_data.iname);
}
pFile->iStack5[pFile->iStackPtr].iCurrentIDX = 0;
return NX_EOD;
}
else else
{ {
if (iRet_iNX == 2) {
if (op_data.iname != NULL) {
free(op_data.iname);
}
pFile->iStack5[pFile->iStackPtr].iCurrentIDX = 0;
return NX_EOD;
}
if (op_data.iname != NULL) { if (op_data.iname != NULL) {
free(op_data.iname); free(op_data.iname);
} }
NXIReportError (NXpData, NXIReportError (NXpData,
"ERROR: Iteration was not successful"); "ERROR: Iteration (directory) was not successful");
return NX_ERROR; return NX_ERROR;
} }
} }
@ -1567,16 +1651,42 @@
int iPType,rank; int iPType,rank;
char *iname = NULL; char *iname = NULL;
unsigned int idx; unsigned int idx;
int intern_idx=-1;
pFile = NXI5assert (fileid); pFile = NXI5assert (fileid);
idx=pFile->iAtt5.iCurrentIDX; idx=pFile->iAtt5.iCurrentIDX;
iRet=0;
if ((pFile->iCurrentD == 0) && (pFile->iCurrentG==0)) if ((pFile->iCurrentD == 0) && (pFile->iCurrentG==0))
{ {
/* global attribute */ /* global attribute */
pFile->iVID=H5Gopen(pFile->iFID,"/"); pFile->iVID=H5Gopen(pFile->iFID,"/");
iRet=H5Aiterate(pFile->iVID,&idx,attr_info,&iname); intern_idx=H5Aget_num_attrs(pFile->iVID);
if (intern_idx > idx) {
iRet=H5Aiterate(pFile->iVID,&idx,attr_info,&iname);
}
else
{
iRet=0;
}
intern_idx=-1;
if (iRet < 0) {
NXIReportError (NXpData, "ERROR iterating through ROOT Attr. list!");
return NX_ERROR;
}
} else { } else {
iRet=H5Aiterate(pFile->iCurrentD,&idx,attr_info,&iname); intern_idx=H5Aget_num_attrs(pFile->iCurrentD);
if (intern_idx > idx) {
iRet=H5Aiterate(pFile->iCurrentD,&idx,attr_info,&iname);
}
else
{
iRet=0;
}
intern_idx=-1;
if (iRet < 0) {
NXIReportError (NXpData, "ERROR iterating through Attr. list!");
return NX_ERROR;
}
} }
if (iRet>0) if (iRet>0)
{ {
@ -1650,31 +1760,28 @@
H5Tclose(atype); H5Tclose(atype);
H5Sclose(aspace); H5Sclose(aspace);
H5Aclose(pFile->iCurrentA); H5Aclose(pFile->iCurrentA);
if ((pFile->iCurrentD == 0) && (pFile->iCurrentG==0))
{
/* close group for global attribute */
H5Gclose(pFile->iVID);
}
return NX_OK; return NX_OK;
} }
else if (iRet==0)
{
if (iname != NULL) {
free(iname);
}
if (idx == 0)
{
pFile->iAtt5.iCurrentIDX = 0;
return NX_EOD;
}
pFile->iAtt5.iCurrentIDX = 0;
return NX_EOD;
}
else else
{ {
if (iname != NULL) { if ((pFile->iCurrentD == 0) && (pFile->iCurrentG==0))
free(iname); {
} /* global attribute */
intern_idx=H5Aget_num_attrs(pFile->iVID);
} else {
if (pFile->iCurrentD>0){
intern_idx=H5Aget_num_attrs(pFile->iCurrentD);
} else {
intern_idx=H5Aget_num_attrs(pFile->iCurrentG);
}
}
if ((intern_idx == 0)||(intern_idx == idx)) {
pFile->iAtt5.iCurrentIDX = 0;
if (iname != NULL) {
free(iname);
}
return NX_EOD;
}
NXIReportError (NXpData, NXIReportError (NXpData,
"ERROR: Iteration was not successful"); "ERROR: Iteration was not successful");
return NX_ERROR; return NX_ERROR;
@ -1792,33 +1899,42 @@
pNexusFile5 pFile; pNexusFile5 pFile;
char *iname = NULL; char *iname = NULL;
unsigned int idx; unsigned int idx;
int iRet; herr_t iRet;
pFile = NXI5assert (fid); pFile = NXI5assert (fid);
idx=0; idx=0;
*iN = idx;
if (pFile->iCurrentD == 0 && pFile->iCurrentG == 0) { if (pFile->iCurrentD == 0 && pFile->iCurrentG == 0) {
/* /*
global attribute global attribute
*/ */
pFile->iVID=H5Gopen(pFile->iFID,"/"); pFile->iVID=H5Gopen(pFile->iFID,"/");
iRet = H5Aiterate(pFile->iVID,&idx,attr_info,&iname); iRet = H5Aiterate(pFile->iVID,&idx,attr_info,&iname);
iRet = 1; if (iRet < 0) {
while (iRet != 0) { NXIReportError (NXpData, "iterating ERROR!");
iRet = H5Aiterate(pFile->iVID,&idx,attr_info,&iname); return NX_ERROR;
} }
idx=H5Aget_num_attrs(pFile->iVID);
if (idx > 0) { if (idx > 0) {
*iN = idx; *iN = idx;
} else { } else {
*iN = 1; *iN = 1;
} }
/*
if (iname != NULL) { if (iname != NULL) {
free(iname); free(iname);
} }
*/
return NX_OK; return NX_OK;
} }
else else
{ {
iRet=H5Aiterate(pFile->iCurrentD,&idx,attr_info,&iname); if (pFile->iCurrentD>0) {
iRet=H5Aiterate(pFile->iCurrentD,&idx,attr_info,&iname);
} else {
iRet=H5Aiterate(pFile->iCurrentG,&idx,attr_info,&iname);
}
} }
if (iRet<0) { if (iRet<0) {
NXIReportError (NXpData, "Attribute number cannot be fixed!"); NXIReportError (NXpData, "Attribute number cannot be fixed!");
@ -1828,84 +1944,17 @@
*iN=idx; *iN=idx;
return NX_OK; return NX_OK;
} }
iRet = 1; idx=H5Aget_num_attrs(pFile->iCurrentD);
while (iRet != 0) {
iRet = H5Aiterate(pFile->iCurrentD,&idx,attr_info,&iname);
}
if (idx > 0) { if (idx > 0) {
*iN = idx; *iN = idx;
} else { } else {
*iN = 1; *iN = 1;
} }
if (iname != NULL) {
free(iname);
}
return NX_OK; return NX_OK;
} }
/* --------------------------------------------------------------------- */
/* Operator function. */
herr_t group_info1(hid_t loc_id, const char *name, void *opdata)
{
NexusFile5 self;
H5G_stat_t statbuf;
self.iNX = *((int*)opdata);
H5Gget_objinfo(loc_id, name, 0, &statbuf);
switch (statbuf.type)
{
case H5G_GROUP:
self.iNX++;
*((int*)opdata)=self.iNX;
break;
case H5G_DATASET:
self.iNX++;
*((int*)opdata)=self.iNX;
break;
}
return 0;
}
/*-------------------------------------------------------------------------*/
NXstatus CALLING_STYLE NX5getgroupinfo (NXhandle fid, int *iN, NXname pName, NXname pClass)
{
pNexusFile5 pFile;
hid_t atype,attr_id;
char data[64];
int iRet;
pFile = NXI5assert (fid);
/* check if there is a group open */
if (pFile->iCurrentG == 0) {
strcpy (pName, "root");
strcpy (pClass, "NXroot");
pFile->iNX=0;
iRet=H5Giterate(pFile->iFID,"/",0,group_info1,&pFile->iNX);
*iN=pFile->iNX;
}
else {
strcpy (pName,pFile->name_ref);
attr_id = H5Aopen_name(pFile->iCurrentG,"NX_class");
if (attr_id<0) {
strcpy(pClass,"non");
} else {
atype=H5Tcopy(H5T_C_S1);
H5Tset_size(atype,64);
H5Aread(attr_id, atype, data);
strcpy(pClass,data);
pFile->iNX=0;
iRet=H5Giterate(pFile->iFID,pFile->name_ref,0,group_info1, &pFile->iNX);
*iN=pFile->iNX;
H5Aclose(attr_id);
}
}
return NX_OK;
}
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
NXstatus CALLING_STYLE NX5getgroupID (NXhandle fileid, NXlink* sRes) NXstatus CALLING_STYLE NX5getgroupID (NXhandle fileid, NXlink* sRes)

View File

@ -64,6 +64,7 @@
"Halted", "Halted",
"Dead", "Dead",
"Waiting for User Input", "Waiting for User Input",
"Counting/Driving",
NULL }; NULL };
static char *iText[] = { static char *iText[] = {
@ -80,6 +81,7 @@
"halt", "halt",
"dead", "dead",
"input", "input",
"count/drive",
NULL }; NULL };
static pICallBack pCall = NULL; static pICallBack pCall = NULL;

View File

@ -21,7 +21,8 @@
eBatch, eBatch,
eHalted, eHalted,
eDead, eDead,
eInput eInput,
eCountDrive
} Status; } Status;
/* for status display */ /* for status display */