- Switched to NAPI-3.0 with XML support
- Fixed exeman to write files by default into the first directory in batchpath - Fixed a bug in nxdict which prevented it from handling attributes containing :/ properly - Removed junk files - Fixed a bug in hklscan.c which made it dump core - Added XML support to nxscript.c - Added support for writing NeXus-XML data files to tasub
This commit is contained in:
98
tasscanub.c
98
tasscanub.c
@ -23,6 +23,7 @@
|
||||
#include <splitter.h>
|
||||
#include <status.h>
|
||||
#include "tasscanub.h"
|
||||
#include "nxscript.h"
|
||||
/*------------------------------------------------------------------------
|
||||
a little local utility for making a line of characters
|
||||
-------------------------------------------------------------------------*/
|
||||
@ -968,6 +969,100 @@ int TASUBPrepare(pScanData self)
|
||||
|
||||
return status;
|
||||
}
|
||||
/*---------------------------------------------------------------------*/
|
||||
static void TASUBDump(pTASdata self, SicsInterp *pSics, SConnection *pCon,
|
||||
int argc, char *argv[]){
|
||||
float v[3], ub[3][3], cell[6];
|
||||
int status, i, j;
|
||||
pNXScript nxscript = NULL;
|
||||
char pBueffel[256];
|
||||
tasReflection r;
|
||||
|
||||
if(argc < 4){
|
||||
SCWrite(pCon,"ERROR: not enough argument to dump tasub",eError);
|
||||
return;
|
||||
}
|
||||
|
||||
nxscript = (pNXScript)FindCommandData(pSics,argv[2],"NXScript");
|
||||
if(nxscript == NULL){
|
||||
snprintf(pBueffel,255,"ERROR: %s is no NXScript object",
|
||||
argv[2]);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
return;
|
||||
}
|
||||
if(nxscript->fileHandle == NULL){
|
||||
SCWrite(pCon,"ERROR: files is closed, cannot write",eError);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
write cell
|
||||
*/
|
||||
snprintf(pBueffel,255,"%s_cell",argv[3]);
|
||||
cell[0] = self->ub->cell.a;
|
||||
cell[1] = self->ub->cell.b;
|
||||
cell[2] = self->ub->cell.c;
|
||||
cell[3] = self->ub->cell.alpha;
|
||||
cell[4] = self->ub->cell.beta;
|
||||
cell[5] = self->ub->cell.gamma;
|
||||
status = NXDputalias(nxscript->fileHandle,nxscript->dictHandle,pBueffel,cell);
|
||||
if(status != NX_OK){
|
||||
snprintf(pBueffel,255,"ERROR: failed to write cell to %s_cell",argv[3]);
|
||||
SCWrite(pCon,pBueffel,eWarning);
|
||||
}
|
||||
|
||||
/*
|
||||
write planenormal
|
||||
*/
|
||||
for(i = 0; i < 3; i++){
|
||||
v[i] = self->ub->machine.planeNormal[i][0];
|
||||
}
|
||||
snprintf(pBueffel,255,"%s_norm",argv[3]);
|
||||
status = NXDputalias(nxscript->fileHandle,nxscript->dictHandle,pBueffel,v);
|
||||
if(status != NX_OK){
|
||||
snprintf(pBueffel,255,"ERROR: failed to write plane_normal to %s_norm",argv[3]);
|
||||
SCWrite(pCon,pBueffel,eWarning);
|
||||
}
|
||||
|
||||
/*
|
||||
write orienting reflections
|
||||
*/
|
||||
snprintf(pBueffel,255,"%s_vec1",argv[3]);
|
||||
findReflection(self->ub->reflectionList, self->ub->r1,&r);
|
||||
v[0] = r.qe.qh;
|
||||
v[1] = r.qe.qk;
|
||||
v[2] = r.qe.ql;
|
||||
status = NXDputalias(nxscript->fileHandle,nxscript->dictHandle,pBueffel,v);
|
||||
if(status != NX_OK){
|
||||
snprintf(pBueffel,255,"ERROR: failed to write plane vector 1 to %s_vec1",argv[3]);
|
||||
SCWrite(pCon,pBueffel,eWarning);
|
||||
}
|
||||
snprintf(pBueffel,255,"%s_vec2",argv[3]);
|
||||
findReflection(self->ub->reflectionList, self->ub->r2,&r);
|
||||
v[0] = r.qe.qh;
|
||||
v[1] = r.qe.qk;
|
||||
v[2] = r.qe.ql;
|
||||
status = NXDputalias(nxscript->fileHandle,nxscript->dictHandle,pBueffel,v);
|
||||
if(status != NX_OK){
|
||||
snprintf(pBueffel,255,"ERROR: failed to write plane vector 2 to %s_vec2",argv[3]);
|
||||
SCWrite(pCon,pBueffel,eWarning);
|
||||
}
|
||||
|
||||
/*
|
||||
write UB
|
||||
*/
|
||||
for(i = 0; i < 3; i++){
|
||||
for(j = 0; j < 3; j++){
|
||||
ub[i][j] = self->ub->machine.UB[i][j];
|
||||
}
|
||||
}
|
||||
snprintf(pBueffel,255,"%s_ub",argv[3]);
|
||||
status = NXDputalias(nxscript->fileHandle,nxscript->dictHandle,pBueffel,ub);
|
||||
if(status != NX_OK){
|
||||
snprintf(pBueffel,255,"ERROR: failed to write UB to %s_ub",argv[3]);
|
||||
SCWrite(pCon,pBueffel,eWarning);
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
int TASUBScan(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
int argc, char *argv[]){
|
||||
@ -1014,6 +1109,9 @@ int TASUBScan(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
}
|
||||
} else if(strcmp(argv[1],"prepare") == 0){
|
||||
return TASUBPrepare(self->pScan);
|
||||
} else if(strcmp(argv[1],"nxdump") == 0){
|
||||
TASUBDump(self,pSics,pCon,argc,argv);
|
||||
return 1;
|
||||
} else if(strcmp(argv[1],"drive") == 0){
|
||||
if(argc < 5) {
|
||||
SCWrite(pCon,"ERROR: insufficient number of arguments to tasscan drive",
|
||||
|
Reference in New Issue
Block a user