- made fixes to hkl
- Introduced a help system - introduced a module for handling automatic updates of files during long measurements - Added a circular buffer and handling facilities to varlog - Upgraded documentation SKIPPED: psi/faverage.h psi/nxamor.tex psi/pimotor.h psi/pimotor.tex
This commit is contained in:
234
SCinter.c
234
SCinter.c
@ -6,6 +6,9 @@
|
|||||||
|
|
||||||
Mark Koennecke, November 1996
|
Mark Koennecke, November 1996
|
||||||
|
|
||||||
|
Made ListObjects moe intelligent: list objects according to interface etc.
|
||||||
|
Mark Koennecke, December 2003
|
||||||
|
|
||||||
Copyright:
|
Copyright:
|
||||||
|
|
||||||
Labor fuer Neutronenstreuung
|
Labor fuer Neutronenstreuung
|
||||||
@ -422,11 +425,9 @@ extern char *SkipSpace(char *pPtr);
|
|||||||
|
|
||||||
free(self);
|
free(self);
|
||||||
}
|
}
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
/*--------------------------------------------------------------------------*/
|
static void printAll(SicsInterp *pSics, SConnection *pCon)
|
||||||
int ListObjects(SConnection *pCon, SicsInterp *pSics, void *pData,
|
{
|
||||||
int argc, char *argv[])
|
|
||||||
{
|
|
||||||
CommandList *pCurrent;
|
CommandList *pCurrent;
|
||||||
char pBueffel[256];
|
char pBueffel[256];
|
||||||
int iNum = 0;
|
int iNum = 0;
|
||||||
@ -465,6 +466,228 @@ extern char *SkipSpace(char *pPtr);
|
|||||||
strcat(pBueffel,"\r\n");
|
strcat(pBueffel,"\r\n");
|
||||||
SCWrite(pCon,pBueffel,eStatus);
|
SCWrite(pCon,pBueffel,eStatus);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------------------
|
||||||
|
printInterface prints only those objects which implement an interface
|
||||||
|
as specified bi the id given
|
||||||
|
-------------------------------------------------------------------------*/
|
||||||
|
static void printInterface(SicsInterp *pSics, SConnection *pCon, int id)
|
||||||
|
{
|
||||||
|
CommandList *pCurrent;
|
||||||
|
char pBueffel[256];
|
||||||
|
int iNum = 0;
|
||||||
|
pObjectDescriptor pObj = NULL;
|
||||||
|
|
||||||
|
assert(pSics);
|
||||||
|
assert(pCon);
|
||||||
|
|
||||||
|
pBueffel[0] = '\0';
|
||||||
|
pCurrent = pSics->pCList;
|
||||||
|
while(pCurrent)
|
||||||
|
{
|
||||||
|
pObj = FindDescriptor(pCurrent->pData);
|
||||||
|
if(pObj != NULL)
|
||||||
|
{
|
||||||
|
if(pObj->GetInterface(pObj,id) != NULL)
|
||||||
|
{
|
||||||
|
if(iNum == 0)
|
||||||
|
{
|
||||||
|
strcpy(pBueffel,pCurrent->pName);
|
||||||
|
iNum++;
|
||||||
|
}
|
||||||
|
else if(iNum < 4)
|
||||||
|
{
|
||||||
|
strcat(pBueffel," ");
|
||||||
|
strcat(pBueffel,pCurrent->pName);
|
||||||
|
iNum++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcat(pBueffel," ");
|
||||||
|
strcat(pBueffel,pCurrent->pName);
|
||||||
|
strcat(pBueffel,"\r\n");
|
||||||
|
SCWrite(pCon,pBueffel,eStatus);
|
||||||
|
iNum = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pCurrent = pCurrent->pNext;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* write final entries */
|
||||||
|
strcat(pBueffel,"\r\n");
|
||||||
|
SCWrite(pCon,pBueffel,eStatus);
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------------------
|
||||||
|
printMatch prints only those objects which match the wildcard string given
|
||||||
|
-------------------------------------------------------------------------*/
|
||||||
|
extern int match(const char *mask, const char *name); /* from wwildcard.c */
|
||||||
|
|
||||||
|
static void printMatch(SicsInterp *pSics, SConnection *pCon, char *mask)
|
||||||
|
{
|
||||||
|
CommandList *pCurrent;
|
||||||
|
char pBueffel[256];
|
||||||
|
int iNum = 0;
|
||||||
|
pObjectDescriptor pObj = NULL;
|
||||||
|
|
||||||
|
assert(pSics);
|
||||||
|
assert(pCon);
|
||||||
|
|
||||||
|
pBueffel[0] = '\0';
|
||||||
|
pCurrent = pSics->pCList;
|
||||||
|
while(pCurrent)
|
||||||
|
{
|
||||||
|
pObj = FindDescriptor(pCurrent->pData);
|
||||||
|
if(pObj != NULL)
|
||||||
|
{
|
||||||
|
if(!match(mask,pObj->name))
|
||||||
|
{
|
||||||
|
if(iNum == 0)
|
||||||
|
{
|
||||||
|
strcpy(pBueffel,pCurrent->pName);
|
||||||
|
iNum++;
|
||||||
|
}
|
||||||
|
else if(iNum < 4)
|
||||||
|
{
|
||||||
|
strcat(pBueffel," ");
|
||||||
|
strcat(pBueffel,pCurrent->pName);
|
||||||
|
iNum++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcat(pBueffel," ");
|
||||||
|
strcat(pBueffel,pCurrent->pName);
|
||||||
|
strcat(pBueffel,"\r\n");
|
||||||
|
SCWrite(pCon,pBueffel,eStatus);
|
||||||
|
iNum = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pCurrent = pCurrent->pNext;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* write final entries */
|
||||||
|
strcat(pBueffel,"\r\n");
|
||||||
|
SCWrite(pCon,pBueffel,eStatus);
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------------------
|
||||||
|
printType prints only those objects which match the type given
|
||||||
|
-------------------------------------------------------------------------*/
|
||||||
|
static void printType(SicsInterp *pSics, SConnection *pCon, char *type)
|
||||||
|
{
|
||||||
|
CommandList *pCurrent;
|
||||||
|
char pBueffel[256];
|
||||||
|
int iNum = 0;
|
||||||
|
|
||||||
|
assert(pSics);
|
||||||
|
assert(pCon);
|
||||||
|
|
||||||
|
pBueffel[0] = '\0';
|
||||||
|
pCurrent = pSics->pCList;
|
||||||
|
while(pCurrent)
|
||||||
|
{
|
||||||
|
if(pCurrent->pData != NULL)
|
||||||
|
{
|
||||||
|
if(iHasType(pCurrent->pData,type))
|
||||||
|
{
|
||||||
|
if(iNum == 0)
|
||||||
|
{
|
||||||
|
strcpy(pBueffel,pCurrent->pName);
|
||||||
|
iNum++;
|
||||||
|
}
|
||||||
|
else if(iNum < 4)
|
||||||
|
{
|
||||||
|
strcat(pBueffel," ");
|
||||||
|
strcat(pBueffel,pCurrent->pName);
|
||||||
|
iNum++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcat(pBueffel," ");
|
||||||
|
strcat(pBueffel,pCurrent->pName);
|
||||||
|
strcat(pBueffel,"\r\n");
|
||||||
|
SCWrite(pCon,pBueffel,eStatus);
|
||||||
|
iNum = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pCurrent = pCurrent->pNext;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* write final entries */
|
||||||
|
strcat(pBueffel,"\r\n");
|
||||||
|
SCWrite(pCon,pBueffel,eStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
int ListObjects(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
|
int argc, char *argv[])
|
||||||
|
{
|
||||||
|
|
||||||
|
if(argc < 2)
|
||||||
|
{
|
||||||
|
printAll(pSics,pCon);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
strtolower(argv[1]);
|
||||||
|
/*
|
||||||
|
stand alone subcommands
|
||||||
|
*/
|
||||||
|
if(strstr(argv[1],"var") != NULL)
|
||||||
|
{
|
||||||
|
printType(pSics,pCon,"SicsVariable");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if(strstr(argv[1],"mot") != NULL)
|
||||||
|
{
|
||||||
|
printType(pSics,pCon,"Motor");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
subcommand with three args
|
||||||
|
*/
|
||||||
|
if(argc < 3)
|
||||||
|
{
|
||||||
|
SCWrite(pCon,"ERROR: missing parameter to command or bad subcommand",
|
||||||
|
eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
interface
|
||||||
|
*/
|
||||||
|
if(strcmp(argv[1],"inter") == 0)
|
||||||
|
{
|
||||||
|
strtolower(argv[2]);
|
||||||
|
if(strstr(argv[2],"driv") != NULL)
|
||||||
|
{
|
||||||
|
printInterface(pSics,pCon,DRIVEID);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if(strstr(argv[2],"coun") != NULL)
|
||||||
|
{
|
||||||
|
printInterface(pSics,pCon,COUNTID);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if(strstr(argv[2],"env") != NULL)
|
||||||
|
{
|
||||||
|
printInterface(pSics,pCon,ENVIRINTERFACE);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
SCWrite(pCon,"ERROR: interface description nor recognized",eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
match
|
||||||
|
*/
|
||||||
|
if(strcmp(argv[1],"match") == 0)
|
||||||
|
{
|
||||||
|
printMatch(pSics,pCon,argv[2]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
@ -567,3 +790,4 @@ void *FindDrivable(SicsInterp *pSics, char *name){
|
|||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ the error can be ignored or was fully resolved.
|
|||||||
\item[pParList] is text string containing a comma separated list of
|
\item[pParList] is text string containing a comma separated list of
|
||||||
all parameters understood by this driver.
|
all parameters understood by this driver.
|
||||||
\item[pPrivate] Is a pointer to a driver specific specific data
|
\item[pPrivate] Is a pointer to a driver specific specific data
|
||||||
structure. This data structure will not be messed with by upper level code.
|
structure. This data structure shall not be messed with by upper level code.
|
||||||
\end{description}
|
\end{description}
|
||||||
|
|
||||||
\subsubsection{The Controller Object}
|
\subsubsection{The Controller Object}
|
||||||
|
2
conman.c
2
conman.c
@ -654,7 +654,7 @@ void SCSetWriteFunc(SConnection *self, writeFunc x)
|
|||||||
iRet = NETWrite(self->pSock,buffer,strlen(buffer));
|
iRet = NETWrite(self->pSock,buffer,strlen(buffer));
|
||||||
if(!HasNL(buffer))
|
if(!HasNL(buffer))
|
||||||
{
|
{
|
||||||
iRet = NETWrite(self->pSock,"\n",sizeof("\n"));
|
iRet = NETWrite(self->pSock,"\n",strlen("\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!iRet)
|
if(!iRet)
|
||||||
|
33
conman.h
33
conman.h
@ -22,9 +22,6 @@
|
|||||||
|
|
||||||
#define MAXLOGFILES 10
|
#define MAXLOGFILES 10
|
||||||
|
|
||||||
typedef int (*writeFunc)(struct __SConnection *pCon,
|
|
||||||
char *pMessage, int iCode);
|
|
||||||
|
|
||||||
typedef struct __SConnection {
|
typedef struct __SConnection {
|
||||||
/* object basics */
|
/* object basics */
|
||||||
pObjectDescriptor pDes;
|
pObjectDescriptor pDes;
|
||||||
@ -38,7 +35,8 @@ typedef int (*writeFunc)(struct __SConnection *pCon,
|
|||||||
int iTelnet;
|
int iTelnet;
|
||||||
int iOutput;
|
int iOutput;
|
||||||
int iFiles;
|
int iFiles;
|
||||||
writeFunc write;
|
int (*write)(struct __SConnection *pCon,
|
||||||
|
char *pMessage, int iCode);
|
||||||
mkChannel *pDataSock;
|
mkChannel *pDataSock;
|
||||||
char *pDataComp;
|
char *pDataComp;
|
||||||
int iDataPort;
|
int iDataPort;
|
||||||
@ -47,11 +45,10 @@ typedef int (*writeFunc)(struct __SConnection *pCon,
|
|||||||
int eInterrupt;
|
int eInterrupt;
|
||||||
int iUserRights;
|
int iUserRights;
|
||||||
int inUse;
|
int inUse;
|
||||||
|
int iDummy;
|
||||||
int iGrab;
|
int iGrab;
|
||||||
|
int iErrCode;
|
||||||
SicsInterp *pSics;
|
SicsInterp *pSics;
|
||||||
|
|
||||||
/* flag for parameter change */
|
|
||||||
int parameterChange;
|
|
||||||
|
|
||||||
/* a FIFO */
|
/* a FIFO */
|
||||||
pCosta pStack;
|
pCosta pStack;
|
||||||
@ -61,12 +58,6 @@ typedef int (*writeFunc)(struct __SConnection *pCon,
|
|||||||
|
|
||||||
/* Tasking Stuff */
|
/* Tasking Stuff */
|
||||||
int iEnd;
|
int iEnd;
|
||||||
/* for keeping track of the login
|
|
||||||
process on a non telnet connection.
|
|
||||||
Should only be used in SCTaskFunction
|
|
||||||
*/
|
|
||||||
int iLogin;
|
|
||||||
time_t conStart;
|
|
||||||
}SConnection;
|
}SConnection;
|
||||||
|
|
||||||
#include "nserver.h"
|
#include "nserver.h"
|
||||||
@ -90,32 +81,26 @@ typedef int (*writeFunc)(struct __SConnection *pCon,
|
|||||||
int SCSendOK(SConnection *self);
|
int SCSendOK(SConnection *self);
|
||||||
int SCnoSock(SConnection *pCon);
|
int SCnoSock(SConnection *pCon);
|
||||||
int SCWriteUUencoded(SConnection *pCon, char *pName, void *iData, int iLen);
|
int SCWriteUUencoded(SConnection *pCon, char *pName, void *iData, int iLen);
|
||||||
int SCWriteZipped(SConnection *pCon, char *pName, void *pData, int iDataLen);
|
|
||||||
writeFunc SCGetWriteFunc(SConnection *pCon);
|
|
||||||
void SCSetWriteFunc(SConnection *pCon, writeFunc x);
|
|
||||||
int SCOnlySockWrite(SConnection *self, char *buffer, int iOut);
|
|
||||||
int SCNotWrite(SConnection *self, char *buffer, int iOut);
|
|
||||||
/************************* CallBack *********************************** */
|
/************************* CallBack *********************************** */
|
||||||
int SCRegister(SConnection *pCon, SicsInterp *pSics,
|
int SCRegister(SConnection *pCon, SicsInterp *pSics,
|
||||||
void *pInter, long lID);
|
void *pInter, long lID);
|
||||||
int SCUnregister(SConnection *pCon, void *pInter);
|
int SCUnregister(SConnection *pCon, void *pInter);
|
||||||
/******************************* Interrupt *********************************/
|
/******************************* Error **************************************/
|
||||||
void SCSetInterrupt(SConnection *self, int eCode);
|
void SCSetInterrupt(SConnection *self, int eCode);
|
||||||
int SCGetInterrupt(SConnection *self);
|
int SCGetInterrupt(SConnection *self);
|
||||||
|
void SCSetError(SConnection *pCon, int iCode);
|
||||||
|
int SCGetError(SConnection *pCon);
|
||||||
/****************************** Macro ***************************************/
|
/****************************** Macro ***************************************/
|
||||||
int SCinMacro(SConnection *pCon);
|
int SCinMacro(SConnection *pCon);
|
||||||
int SCsetMacro(SConnection *pCon, int iMode);
|
int SCsetMacro(SConnection *pCon, int iMode);
|
||||||
/************************** parameters changed ? **************************/
|
|
||||||
void SCparChange(SConnection *pCon);
|
|
||||||
/* *************************** Info *************************************** */
|
/* *************************** Info *************************************** */
|
||||||
int SCGetRights(SConnection *self);
|
int SCGetRights(SConnection *self);
|
||||||
int SCSetRights(SConnection *pCon, int iNew);
|
int SCSetRights(SConnection *pCon, int iNew);
|
||||||
int SCMatchRights(SConnection *pCon, int iCode);
|
int SCMatchRights(SConnection *pCon, int iCode);
|
||||||
int SCGetOutClass(SConnection *self);
|
int SCGetOutClass(SConnection *self);
|
||||||
int SCGetGrab(SConnection *pCon);
|
int SCGetGrab(SConnection *pCon);
|
||||||
/********************* simulation mode ************************************/
|
|
||||||
void SCSetSimMode(SConnection *pCon, int value);
|
|
||||||
int SCinSimMode(SConnection *pCon);
|
|
||||||
/* **************************** Invocation ******************************** */
|
/* **************************** Invocation ******************************** */
|
||||||
int SCInvoke(SConnection *self,SicsInterp *pInter,char *pCommand);
|
int SCInvoke(SConnection *self,SicsInterp *pInter,char *pCommand);
|
||||||
|
|
||||||
|
14
counter.c
14
counter.c
@ -104,6 +104,7 @@
|
|||||||
{
|
{
|
||||||
self->isUpToDate = 0;
|
self->isUpToDate = 0;
|
||||||
self->tStart = time(&tX);
|
self->tStart = time(&tX);
|
||||||
|
InvokeCallBack(self->pCall,COUNTSTART,pCon);
|
||||||
return iRet;
|
return iRet;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -231,6 +232,7 @@
|
|||||||
{
|
{
|
||||||
SCWrite(pCon,"ERROR: Cannot fix counter problem, aborting",eError);
|
SCWrite(pCon,"ERROR: Cannot fix counter problem, aborting",eError);
|
||||||
SCSetInterrupt(pCon,eAbortBatch);
|
SCSetInterrupt(pCon,eAbortBatch);
|
||||||
|
InvokeCallBack(self->pCall,COUNTEND,NULL);
|
||||||
return eCt;
|
return eCt;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -238,6 +240,10 @@
|
|||||||
return HWBusy;
|
return HWBusy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
handle count parameters and notify listeners on progress
|
||||||
|
*/
|
||||||
sMon.fCurrent = fControl;
|
sMon.fCurrent = fControl;
|
||||||
sMon.fPreset = self->pDriv->fPreset;
|
sMon.fPreset = self->pDriv->fPreset;
|
||||||
sMon.pName = self->name;
|
sMon.pName = self->name;
|
||||||
@ -251,6 +257,14 @@
|
|||||||
self->iCallbackCounter++;
|
self->iCallbackCounter++;
|
||||||
}
|
}
|
||||||
self->pDriv->fLastCurrent = fControl;
|
self->pDriv->fLastCurrent = fControl;
|
||||||
|
|
||||||
|
/*
|
||||||
|
notification on finish
|
||||||
|
*/
|
||||||
|
if(eCt == HWIdle)
|
||||||
|
{
|
||||||
|
InvokeCallBack(self->pCall,COUNTEND,NULL);
|
||||||
|
}
|
||||||
return eCt;
|
return eCt;
|
||||||
}
|
}
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
34
doc/manager/helpman.htm
Normal file
34
doc/manager/helpman.htm
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<HTML>
|
||||||
|
<HEAD>
|
||||||
|
<TITLE>The SICS Online Help System</TITLE>
|
||||||
|
</HEAD>
|
||||||
|
<BODY>
|
||||||
|
<H1>The SICS Online Help System</H1>
|
||||||
|
<P>
|
||||||
|
SICS has a simple built in help system. Help text is stored in simple
|
||||||
|
ASCII text files which are printed to the client on demand. The help
|
||||||
|
system can search for help files in several directories. Typically one
|
||||||
|
would want one directory with general SICS help files and another one
|
||||||
|
with instrument specific help files. If help is invoked without any
|
||||||
|
options, a default help file is printed. This file is supposed to
|
||||||
|
contain a directory of available help topics together with a brief
|
||||||
|
description. The normal usage is: help topicname . The help system
|
||||||
|
will then search for a file named topicname.txt in its help
|
||||||
|
directories.
|
||||||
|
</P>
|
||||||
|
<p>
|
||||||
|
A SICS manager will need to configure this help system. A new
|
||||||
|
directory can be added to the list of directories to search with the
|
||||||
|
command:
|
||||||
|
<pre>
|
||||||
|
help configure adddir dirname
|
||||||
|
</pre>
|
||||||
|
The default help file can be specified with:
|
||||||
|
<pre>
|
||||||
|
help configure defaultfile filename
|
||||||
|
</pre>
|
||||||
|
Each of these command given without a parameter print the current
|
||||||
|
settings.
|
||||||
|
</P>
|
||||||
|
</BODY>
|
||||||
|
</HTML>
|
@ -19,6 +19,7 @@ Go to:
|
|||||||
<li> A discussion of SICS <a href = var.htm> variables</a>.
|
<li> A discussion of SICS <a href = var.htm> variables</a>.
|
||||||
<li> Advice about <a href=hwini.htm> hardware </a> configuration.
|
<li> Advice about <a href=hwini.htm> hardware </a> configuration.
|
||||||
<li> A description of <a href = command.htm> command </a> initialisation.
|
<li> A description of <a href = command.htm> command </a> initialisation.
|
||||||
|
<li> Managing the SICS <a href="helpman.htm"> help </a> system.
|
||||||
</ul>
|
</ul>
|
||||||
</p>
|
</p>
|
||||||
<!latex-on>
|
<!latex-on>
|
||||||
|
@ -46,6 +46,7 @@ which is described elsewhere.
|
|||||||
%html var.htm 1
|
%html var.htm 1
|
||||||
%html hwini.htm 1
|
%html hwini.htm 1
|
||||||
%html command.htm 1
|
%html command.htm 1
|
||||||
|
%html helpman.htm 2
|
||||||
%html special.htm 1
|
%html special.htm 1
|
||||||
%html serial.htm 2
|
%html serial.htm 2
|
||||||
%html status.htm 2
|
%html status.htm 2
|
||||||
@ -54,6 +55,8 @@ which is described elsewhere.
|
|||||||
%html alias.htm 2
|
%html alias.htm 2
|
||||||
%html cron.htm 2
|
%html cron.htm 2
|
||||||
%html rs232.htm 2
|
%html rs232.htm 2
|
||||||
|
%html nxscript.htm 2
|
||||||
|
%html nxupdate.htm 2
|
||||||
%html ../user/trouble.htm 1
|
%html ../user/trouble.htm 1
|
||||||
%html move.htm 1
|
%html move.htm 1
|
||||||
\end{document}
|
\end{document}
|
||||||
|
71
doc/manager/nxupdate.htm
Normal file
71
doc/manager/nxupdate.htm
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<HTML>
|
||||||
|
<HEAD>
|
||||||
|
<TITLE>Automatic Updating of NeXus Files</TITLE>
|
||||||
|
</HEAD>
|
||||||
|
<BODY>
|
||||||
|
<H1>Automatic Updating of NeXus Files</H1>
|
||||||
|
<P>
|
||||||
|
Some instruments perform measurements for quite long counting
|
||||||
|
times. In such cases it is advisable to save the data measured so far
|
||||||
|
to file in order to protect against hardware or software failures. To
|
||||||
|
this purpose an automatic file upgrade manager is provided. On
|
||||||
|
installation the automatic update object is connected wth a counting
|
||||||
|
device through the the callback interface. This makes sure that the
|
||||||
|
update manager is automatically notified when counting starts or
|
||||||
|
finishes.
|
||||||
|
</P>
|
||||||
|
<h2>Prerequisites for Using the Automatic Update Manager</h2>
|
||||||
|
<p>
|
||||||
|
In order to use automatic updating, three programs must be
|
||||||
|
provided. Each of these programs can be a script which uses the
|
||||||
|
nxscript facility. It can also be a SICS command.
|
||||||
|
<dl>
|
||||||
|
<dt>startScript
|
||||||
|
<dd>This program is supposed to write the static part of the file. It
|
||||||
|
is called once when the file is created.
|
||||||
|
<dt>updateScript
|
||||||
|
<dd>This program is supposed to create and update the variable data
|
||||||
|
elements in the NeXus file. This is called frequently.
|
||||||
|
<dt>linkScript
|
||||||
|
<dd>This program is supposed to create the links within the NeXus
|
||||||
|
file. This is called once after startcript and updateScript have been
|
||||||
|
run.
|
||||||
|
</dl>
|
||||||
|
</p>
|
||||||
|
<h2>Installing Automatic Update</h2>
|
||||||
|
<p>
|
||||||
|
An automatic update object is installed into SICS with:
|
||||||
|
<pre>
|
||||||
|
updatefactory name countername
|
||||||
|
</pre>
|
||||||
|
name is a placeholder for the name under which SICS knows the
|
||||||
|
automatic update object. name is available as a SICS command later on.
|
||||||
|
countername is a placeholder for a counter
|
||||||
|
object (counter or HM) which triggers automatic updating of NeXus
|
||||||
|
files. This object has to support both the countable and callback
|
||||||
|
interfaces of SICS. Suitable SICS objects include counter and
|
||||||
|
histogram memory objects.
|
||||||
|
</p>
|
||||||
|
<h2>Configuring Automatic Update</h2>
|
||||||
|
<p>
|
||||||
|
The SICS command created with updatefactory (see above) supports a few
|
||||||
|
parameters which allow for the configuration of the whole
|
||||||
|
process. Parameters follow the normal SICS syntax. Futhermore there is
|
||||||
|
a subcommand list, which lists all configuration
|
||||||
|
parameters. Supported parameters are:
|
||||||
|
<dl>
|
||||||
|
<dt>startScript
|
||||||
|
<dd>The program supposed to write the static part of the file.
|
||||||
|
<dt>updateScript
|
||||||
|
<dd>The program supposed to create and update the variable data
|
||||||
|
elements in the NeXus file.
|
||||||
|
<dt>linkScript
|
||||||
|
<dd>This program supposed to create the links within the NeXus
|
||||||
|
file.
|
||||||
|
<dt>updateintervall
|
||||||
|
<dd>The time intervall in seconds between updates. The defualt is
|
||||||
|
1200, eg. 20 minutes.
|
||||||
|
</dl>
|
||||||
|
</p>
|
||||||
|
</BODY>
|
||||||
|
</HTML>
|
@ -15,6 +15,8 @@ This section describes a few commands which need not be known to SICS users.
|
|||||||
<li> <a href="cron.htm">Reoccuring tasks</a>.
|
<li> <a href="cron.htm">Reoccuring tasks</a>.
|
||||||
<li> Direct access to <a href="rs232.htm">RS232 controllers</a> through
|
<li> Direct access to <a href="rs232.htm">RS232 controllers</a> through
|
||||||
the terminal server.
|
the terminal server.
|
||||||
|
<li>Scripting the content of<a href="nxscript.htm"> NeXus</a> files.
|
||||||
|
<li>Automatic <a href="nxupdate.htm">update</a> of files during long counting operations.
|
||||||
</uL>
|
</uL>
|
||||||
<!latex-on>
|
<!latex-on>
|
||||||
</P>
|
</P>
|
||||||
|
@ -10,7 +10,7 @@ This object implements this complex movement as a virtual motor.
|
|||||||
|
|
||||||
The following formulas are used for the necessary calculations:
|
The following formulas are used for the necessary calculations:
|
||||||
\begin{eqnarray}
|
\begin{eqnarray}
|
||||||
delta height & = & h_{s} - R \sin \alpha \\
|
delta height & = & h_{s} - \sin \alpha \\
|
||||||
delta x & = & |x_{c} - x_{s}| - R \cos \alpha \\
|
delta x & = & |x_{c} - x_{s}| - R \cos \alpha \\
|
||||||
omega & = & -2 MOM + 2 SOM \\
|
omega & = & -2 MOM + 2 SOM \\
|
||||||
\end{eqnarray}
|
\end{eqnarray}
|
||||||
@ -18,7 +18,7 @@ with
|
|||||||
\begin{eqnarray}
|
\begin{eqnarray}
|
||||||
h_{s} & = & \tan(2MOM)|x_{c} - x_{s}| \\
|
h_{s} & = & \tan(2MOM)|x_{c} - x_{s}| \\
|
||||||
R & = & \sqrt{hs^{2} - |x_{c} - x_{s}|^{2}} \\
|
R & = & \sqrt{hs^{2} - |x_{c} - x_{s}|^{2}} \\
|
||||||
\alpha & = & 180 -90 - \beta - 2SOM \\
|
\alpha & = & ATT - 2SOM \\
|
||||||
\beta & = & 180 - 90 - 2MOM \\
|
\beta & = & 180 - 90 - 2MOM \\
|
||||||
MOM & = & polarizer \omega \\
|
MOM & = & polarizer \omega \\
|
||||||
SOM & = & sample \omega \\
|
SOM & = & sample \omega \\
|
||||||
@ -141,6 +141,34 @@ $\langle$amorinterface {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
\mbox{}\verb@ Mark Koennecke, September 1999@\\
|
\mbox{}\verb@ Mark Koennecke, September 1999@\\
|
||||||
\mbox{}\verb@----------------------------------------------------------------------------*/@\\
|
\mbox{}\verb@----------------------------------------------------------------------------*/@\\
|
||||||
|
\mbox{}\verb@@\\
|
||||||
|
\mbox{}\verb@/* distance detector sample */@\\
|
||||||
|
\mbox{}\verb@#define PARDS 0@\\
|
||||||
|
\mbox{}\verb@/* constant height of sample: height = PARDH + MOTSOZ + MOTSTZ */@\\
|
||||||
|
\mbox{}\verb@#define PARDH 1@\\
|
||||||
|
\mbox{}\verb@/* distance diaphragm 4 - sample */@\\
|
||||||
|
\mbox{}\verb@#define PARDD4 2@\\
|
||||||
|
\mbox{}\verb@/* distance to diaphragm 5 */@\\
|
||||||
|
\mbox{}\verb@#define PARDD5 3@\\
|
||||||
|
\mbox{}\verb@/* interrupt to issue when a motor fails on this */@\\
|
||||||
|
\mbox{}\verb@#define PARINT 4@\\
|
||||||
|
\mbox{}\verb@/* base height of counter station */@\\
|
||||||
|
\mbox{}\verb@#define PARDDH 5@\\
|
||||||
|
\mbox{}\verb@/* height of D4 */@\\
|
||||||
|
\mbox{}\verb@#define PARD4H 6@\\
|
||||||
|
\mbox{}\verb@/* height of D5 */@\\
|
||||||
|
\mbox{}\verb@#define PARD5H 7@\\
|
||||||
|
\mbox{}\verb@/* base height of analyzer */@\\
|
||||||
|
\mbox{}\verb@#define PARANA 8@\\
|
||||||
|
\mbox{}\verb@/* distance of analyzer from sample */@\\
|
||||||
|
\mbox{}\verb@#define PARADIS 9@\\
|
||||||
|
\mbox{}\verb@/* flag analyzer calculation on/off */@\\
|
||||||
|
\mbox{}\verb@#define ANAFLAG 10@\\
|
||||||
|
\mbox{}\verb@/* constant for second detector */@\\
|
||||||
|
\mbox{}\verb@#define PARDDD 11@\\
|
||||||
|
\mbox{}\verb@/* constant part of AOM */@\\
|
||||||
|
\mbox{}\verb@#define PARAOM 12@\\
|
||||||
|
\mbox{}\verb@@\\
|
||||||
\mbox{}\verb@@$\langle$putput {\footnotesize ?}$\rangle$\verb@@\\
|
\mbox{}\verb@@$\langle$putput {\footnotesize ?}$\rangle$\verb@@\\
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
\mbox{}\verb@@$\langle$amoredata {\footnotesize ?}$\rangle$\verb@@\\
|
\mbox{}\verb@@$\langle$amoredata {\footnotesize ?}$\rangle$\verb@@\\
|
||||||
|
@ -105,7 +105,7 @@ the error can be ignored or was fully resolved.
|
|||||||
\item[pParList] is text string containing a comma separated list of
|
\item[pParList] is text string containing a comma separated list of
|
||||||
all parameters understood by this driver.
|
all parameters understood by this driver.
|
||||||
\item[pPrivate] Is a pointer to a driver specific specific data
|
\item[pPrivate] Is a pointer to a driver specific specific data
|
||||||
structure. This data structure will not be messed with by upper level code.
|
structure. This data structure shall not be messed with by upper level code.
|
||||||
\end{description}
|
\end{description}
|
||||||
|
|
||||||
\subsubsection{The Controller Object}
|
\subsubsection{The Controller Object}
|
||||||
|
@ -212,6 +212,29 @@ take care of invoking the apropriate commands on all registered counting
|
|||||||
devices.
|
devices.
|
||||||
|
|
||||||
|
|
||||||
|
\subsubsection{Locking the Device Executor}
|
||||||
|
In some instances user code may wish to lock the device executor. An
|
||||||
|
example is a long running data saving operation. In order to do this
|
||||||
|
two functions are provided:
|
||||||
|
|
||||||
|
\begin{flushleft} \small
|
||||||
|
\begin{minipage}{\linewidth} \label{scrap4}
|
||||||
|
$\langle$devlock {\footnotesize ?}$\rangle\equiv$
|
||||||
|
\vspace{-1ex}
|
||||||
|
\begin{list}{}{} \item
|
||||||
|
\mbox{}\verb@@\\
|
||||||
|
\mbox{}\verb@ void LockDeviceExecutor(pExeList self);@\\
|
||||||
|
\mbox{}\verb@ void UnlockDeviceExecutor(pExeList self);@\\
|
||||||
|
\mbox{}\verb@@\\
|
||||||
|
\mbox{}\verb@@$\diamond$
|
||||||
|
\end{list}
|
||||||
|
\vspace{-1ex}
|
||||||
|
\footnotesize\addtolength{\baselineskip}{-1ex}
|
||||||
|
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||||
|
\item Macro referenced in scrap ?.
|
||||||
|
\end{list}
|
||||||
|
\end{minipage}\\[4ex]
|
||||||
|
\end{flushleft}
|
||||||
\subsubsection{The Rest}
|
\subsubsection{The Rest}
|
||||||
The rest of the interface includes initialisation and deletion routines
|
The rest of the interface includes initialisation and deletion routines
|
||||||
and some access routines. With the devexec being such an important system
|
and some access routines. With the devexec being such an important system
|
||||||
@ -219,7 +242,7 @@ component a function {\bf GetExecutor} is provided which retrieves a pointer
|
|||||||
to the global SICS device executor.
|
to the global SICS device executor.
|
||||||
|
|
||||||
\begin{flushleft} \small
|
\begin{flushleft} \small
|
||||||
\begin{minipage}{\linewidth} \label{scrap4}
|
\begin{minipage}{\linewidth} \label{scrap5}
|
||||||
\verb@"devexec.h"@ {\footnotesize ? }$\equiv$
|
\verb@"devexec.h"@ {\footnotesize ? }$\equiv$
|
||||||
\vspace{-1ex}
|
\vspace{-1ex}
|
||||||
\begin{list}{}{} \item
|
\begin{list}{}{} \item
|
||||||
@ -308,7 +331,8 @@ to the global SICS device executor.
|
|||||||
\mbox{}\verb@ connection with non blocking operation such as motors started@\\
|
\mbox{}\verb@ connection with non blocking operation such as motors started@\\
|
||||||
\mbox{}\verb@ with run.@\\
|
\mbox{}\verb@ with run.@\\
|
||||||
\mbox{}\verb@ */@\\
|
\mbox{}\verb@ */@\\
|
||||||
\mbox{}\verb@ @\\
|
\mbox{}\verb@/*--------------------------- Locking ---------------------------------*/@\\
|
||||||
|
\mbox{}\verb@ @$\langle$devlock {\footnotesize ?}$\rangle$\verb@ @\\
|
||||||
\mbox{}\verb@/* -------------------------- Executor management -------------------------*/@\\
|
\mbox{}\verb@/* -------------------------- Executor management -------------------------*/@\\
|
||||||
\mbox{}\verb@ @\\
|
\mbox{}\verb@ @\\
|
||||||
\mbox{}\verb@ pExeList GetExecutor(void);@\\
|
\mbox{}\verb@ pExeList GetExecutor(void);@\\
|
||||||
|
@ -36,10 +36,16 @@ $\langle$evdata {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ pObjectDescriptor pDes;@\\
|
\mbox{}\verb@ pObjectDescriptor pDes;@\\
|
||||||
\mbox{}\verb@ pIDrivable pDrivInt;@\\
|
\mbox{}\verb@ pIDrivable pDrivInt;@\\
|
||||||
\mbox{}\verb@ pEVInterface pEnvir;@\\
|
\mbox{}\verb@ pEVInterface pEnvir;@\\
|
||||||
|
\mbox{}\verb@ pICallBack pCall;@\\
|
||||||
|
\mbox{}\verb@ int callCount;@\\
|
||||||
\mbox{}\verb@ pEVDriver pDriv;@\\
|
\mbox{}\verb@ pEVDriver pDriv;@\\
|
||||||
\mbox{}\verb@ EVMode eMode;@\\
|
\mbox{}\verb@ EVMode eMode;@\\
|
||||||
\mbox{}\verb@ float fTarget;@\\
|
\mbox{}\verb@ float fTarget;@\\
|
||||||
|
\mbox{}\verb@ time_t start;@\\
|
||||||
|
\mbox{}\verb@ time_t lastt;@\\
|
||||||
\mbox{}\verb@ char *pName;@\\
|
\mbox{}\verb@ char *pName;@\\
|
||||||
|
\mbox{}\verb@ char *driverName;@\\
|
||||||
|
\mbox{}\verb@ char *errorScript;@\\
|
||||||
\mbox{}\verb@ ObPar *pParam;@\\
|
\mbox{}\verb@ ObPar *pParam;@\\
|
||||||
\mbox{}\verb@ int iLog;@\\
|
\mbox{}\verb@ int iLog;@\\
|
||||||
\mbox{}\verb@ pVarLog pLog;@\\
|
\mbox{}\verb@ pVarLog pLog;@\\
|
||||||
@ -63,11 +69,17 @@ the second field a pointer to an Drivable interface. Each environment
|
|||||||
controller needs to implement that in order to allow SICS drive the device
|
controller needs to implement that in order to allow SICS drive the device
|
||||||
to a new value. The third field is a pointer to an environment interface.
|
to a new value. The third field is a pointer to an environment interface.
|
||||||
This is needed in order to enable monitoring of the device when it has
|
This is needed in order to enable monitoring of the device when it has
|
||||||
reached its target value. The fourth field is a pointer to the driver for
|
reached its target value. Then there is a pointer to a callback
|
||||||
|
interface. The fifth field is a pointer to the driver for
|
||||||
the actual hardware. Next is the mode the device is in. Of course there
|
the actual hardware. Next is the mode the device is in. Of course there
|
||||||
must be floating point value which defines the current target value for the
|
must be floating point value which defines the current target value for the
|
||||||
device. pName is a pointer to a string representing the name of the
|
device. start and lastt are used to control the settling time.
|
||||||
controller. Then there is a
|
|
||||||
|
pName is a pointer to a string representing the name of the
|
||||||
|
controller. driverName is the name of the driver used by this
|
||||||
|
device. errorScript is the name of a script command to run when the
|
||||||
|
controller goes out of tolerance.
|
||||||
|
Then there is a
|
||||||
parameter array. iLog is a boolean which says if data should be logged
|
parameter array. iLog is a boolean which says if data should be logged
|
||||||
for this controller or not. pLog is the a pointer to a Varlog structure
|
for this controller or not. pLog is the a pointer to a Varlog structure
|
||||||
holding the logging information. Then there is a switch, iWarned, which is
|
holding the logging information. Then there is a switch, iWarned, which is
|
||||||
@ -91,6 +103,8 @@ $\langle$evdriv {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ typedef struct __EVDriver {@\\
|
\mbox{}\verb@ typedef struct __EVDriver {@\\
|
||||||
\mbox{}\verb@ int (*SetValue)(pEVDriver self, float fNew);@\\
|
\mbox{}\verb@ int (*SetValue)(pEVDriver self, float fNew);@\\
|
||||||
\mbox{}\verb@ int (*GetValue)(pEVDriver self, float *fPos);@\\
|
\mbox{}\verb@ int (*GetValue)(pEVDriver self, float *fPos);@\\
|
||||||
|
\mbox{}\verb@ int (*GetValues)(pEVDriver self, float *fTarget,@\\
|
||||||
|
\mbox{}\verb@ float *fPos, float *fDelta);@\\
|
||||||
\mbox{}\verb@ int (*Send)(pEVDriver self, char *pCommand,@\\
|
\mbox{}\verb@ int (*Send)(pEVDriver self, char *pCommand,@\\
|
||||||
\mbox{}\verb@ char *pReplyBuffer, int iReplBufLen); @\\
|
\mbox{}\verb@ char *pReplyBuffer, int iReplBufLen); @\\
|
||||||
\mbox{}\verb@ int (*GetError)(pEVDriver self, int *iCode,@\\
|
\mbox{}\verb@ int (*GetError)(pEVDriver self, int *iCode,@\\
|
||||||
@ -287,6 +301,8 @@ See the documentation for commands understood.
|
|||||||
\mbox{}\verb@#define UPLIMIT 4@\\
|
\mbox{}\verb@#define UPLIMIT 4@\\
|
||||||
\mbox{}\verb@#define LOWLIMIT 5@\\
|
\mbox{}\verb@#define LOWLIMIT 5@\\
|
||||||
\mbox{}\verb@#define SAFEVALUE 6@\\
|
\mbox{}\verb@#define SAFEVALUE 6@\\
|
||||||
|
\mbox{}\verb@#define MAXWAIT 7@\\
|
||||||
|
\mbox{}\verb@#define SETTLE 8@\\
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
\mbox{}\verb@@$\langle$evdata {\footnotesize ?}$\rangle$\verb@@\\
|
\mbox{}\verb@@$\langle$evdata {\footnotesize ?}$\rangle$\verb@@\\
|
||||||
\mbox{}\verb@@$\diamond$
|
\mbox{}\verb@@$\diamond$
|
||||||
|
@ -17,7 +17,9 @@ $\langle$Modes {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ eHNormal,@\\
|
\mbox{}\verb@ eHNormal,@\\
|
||||||
\mbox{}\verb@ eHTOF,@\\
|
\mbox{}\verb@ eHTOF,@\\
|
||||||
\mbox{}\verb@ eHStrobo,@\\
|
\mbox{}\verb@ eHStrobo,@\\
|
||||||
\mbox{}\verb@ eHRPT@\\
|
\mbox{}\verb@ eHRPT,@\\
|
||||||
|
\mbox{}\verb@ ePSD,@\\
|
||||||
|
\mbox{}\verb@ eSANSTOF@\\
|
||||||
\mbox{}\verb@ } HistMode;@\\
|
\mbox{}\verb@ } HistMode;@\\
|
||||||
\mbox{}\verb@@$\diamond$
|
\mbox{}\verb@@$\diamond$
|
||||||
\end{list}
|
\end{list}
|
||||||
@ -29,6 +31,7 @@ $\langle$Modes {\footnotesize ?}$\rangle\equiv$
|
|||||||
\end{list}
|
\end{list}
|
||||||
\end{minipage}\\[4ex]
|
\end{minipage}\\[4ex]
|
||||||
\end{flushleft}
|
\end{flushleft}
|
||||||
|
These modes are specific to the SINQ histogram memory.
|
||||||
A histogram memory can be operated in transparent mode. It has not yet been
|
A histogram memory can be operated in transparent mode. It has not yet been
|
||||||
defined what this means but it is sort of storing raw data from the detector
|
defined what this means but it is sort of storing raw data from the detector
|
||||||
without any summing or processing. Normal mode is better defined, this is
|
without any summing or processing. Normal mode is better defined, this is
|
||||||
@ -99,6 +102,11 @@ command. Then on initialisation first the logical histogram memory
|
|||||||
evaluates the general options and then the driver in its Config
|
evaluates the general options and then the driver in its Config
|
||||||
function evaluates the driver specific options.
|
function evaluates the driver specific options.
|
||||||
|
|
||||||
|
The histogram memory supports several dimensions, a time binning
|
||||||
|
option and optional buffering of histogram memory data read from the
|
||||||
|
actual HM. All this data management stuff is handled in a separate
|
||||||
|
class, HMdata. See the documentation for HMdata for more details.
|
||||||
|
|
||||||
|
|
||||||
\subsubsection{The Histogram memory driver}
|
\subsubsection{The Histogram memory driver}
|
||||||
Adhering to the Sics paradigm of dividing any device into a logical device
|
Adhering to the Sics paradigm of dividing any device into a logical device
|
||||||
@ -113,16 +121,7 @@ $\langle$HistType {\footnotesize ?}$\rangle\equiv$
|
|||||||
\begin{list}{}{} \item
|
\begin{list}{}{} \item
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
\mbox{}\verb@ typedef struct __HistDriver {@\\
|
\mbox{}\verb@ typedef struct __HistDriver {@\\
|
||||||
\mbox{}\verb@ /* configuration data */@\\
|
\mbox{}\verb@ pHMdata data;@\\
|
||||||
\mbox{}\verb@ HistMode eHistMode;@\\
|
|
||||||
\mbox{}\verb@ OverFlowMode eFlow;@\\
|
|
||||||
\mbox{}\verb@ int iRank;@\\
|
|
||||||
\mbox{}\verb@ int iDims[MAXDIM];@\\
|
|
||||||
\mbox{}\verb@ int nDim;@\\
|
|
||||||
\mbox{}\verb@ int iLength;@\\
|
|
||||||
\mbox{}\verb@ int iBinWidth;@\\
|
|
||||||
\mbox{}\verb@ float fTime[MAXCHAN];@\\
|
|
||||||
\mbox{}\verb@ int iTimeChan;@\\
|
|
||||||
\mbox{}\verb@ /* counting operations data */@\\
|
\mbox{}\verb@ /* counting operations data */@\\
|
||||||
\mbox{}\verb@ CounterMode eCount;@\\
|
\mbox{}\verb@ CounterMode eCount;@\\
|
||||||
\mbox{}\verb@ float fCountPreset;@\\
|
\mbox{}\verb@ float fCountPreset;@\\
|
||||||
@ -183,15 +182,6 @@ $\langle$HistType {\footnotesize ?}$\rangle\equiv$
|
|||||||
\end{minipage}\\[4ex]
|
\end{minipage}\\[4ex]
|
||||||
\end{flushleft}
|
\end{flushleft}
|
||||||
Quite a lot, but a histogram memory is quite a complex piece of equipment.
|
Quite a lot, but a histogram memory is quite a complex piece of equipment.
|
||||||
The configuration information is in the elements EhistMode, eOverFlowMode,
|
|
||||||
iRank, iDims and iBinWidth fields. iDim and nDim desribe the logical
|
|
||||||
dimensions of the histogram memory. These may be different from the
|
|
||||||
dimensions used for data transfer. For instance the SANS detector is
|
|
||||||
handled internally as 1600+ numbers where it really is a filed o
|
|
||||||
128*128.
|
|
||||||
Additionally there is an array of
|
|
||||||
floating point values which denote the time binning for time-o-flight
|
|
||||||
operation or the stroboscopic binning axis in stroboscopic mode.
|
|
||||||
|
|
||||||
The fields fPreset and CounterMode hold the counting parameter data.
|
The fields fPreset and CounterMode hold the counting parameter data.
|
||||||
|
|
||||||
@ -324,11 +314,6 @@ $\langle$HistST {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ pICountable pCountInt;@\\
|
\mbox{}\verb@ pICountable pCountInt;@\\
|
||||||
\mbox{}\verb@ pICallBack pCall;@\\
|
\mbox{}\verb@ pICallBack pCall;@\\
|
||||||
\mbox{}\verb@ pStringDict pOption;@\\
|
\mbox{}\verb@ pStringDict pOption;@\\
|
||||||
\mbox{}\verb@ HistInt *iLocalData;@\\
|
|
||||||
\mbox{}\verb@ int iLocalLength;@\\
|
|
||||||
\mbox{}\verb@ int iLocalUpdate;@\\
|
|
||||||
\mbox{}\verb@ time_t tLocal;@\\
|
|
||||||
\mbox{}\verb@ int iUpdateIntervall;@\\
|
|
||||||
\mbox{}\verb@ } HistMem;@\\
|
\mbox{}\verb@ } HistMem;@\\
|
||||||
\mbox{}\verb@@$\diamond$
|
\mbox{}\verb@@$\diamond$
|
||||||
\end{list}
|
\end{list}
|
||||||
@ -451,6 +436,7 @@ $\langle$Protos {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ float GetHistCountTime(pHistMem self,SConnection *pCon);@\\
|
\mbox{}\verb@ float GetHistCountTime(pHistMem self,SConnection *pCon);@\\
|
||||||
\mbox{}\verb@ int HistDoCount(pHistMem self, SConnection *pCon);@\\
|
\mbox{}\verb@ int HistDoCount(pHistMem self, SConnection *pCon);@\\
|
||||||
\mbox{}\verb@ int HistBlockCount(pHistMem self, SConnection *pCon);@\\
|
\mbox{}\verb@ int HistBlockCount(pHistMem self, SConnection *pCon);@\\
|
||||||
|
\mbox{}\verb@ void HistDirty(pHistMem self); @\\
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
\mbox{}\verb@@$\diamond$
|
\mbox{}\verb@@$\diamond$
|
||||||
\end{list}
|
\end{list}
|
||||||
@ -488,6 +474,9 @@ $\langle$Protos {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ int GetHistogram(pHistMem self, SConnection *pCon,@\\
|
\mbox{}\verb@ int GetHistogram(pHistMem self, SConnection *pCon,@\\
|
||||||
\mbox{}\verb@ int i,int iStart, int iEnd, HistInt *lData, int iDataLen);@\\
|
\mbox{}\verb@ int i,int iStart, int iEnd, HistInt *lData, int iDataLen);@\\
|
||||||
\mbox{}\verb@ HistInt *GetHistogramPointer(pHistMem self,SConnection *pCon);@\\
|
\mbox{}\verb@ HistInt *GetHistogramPointer(pHistMem self,SConnection *pCon);@\\
|
||||||
|
\mbox{}\verb@ int GetHistogramDirect(pHistMem self, SConnection *pCon,@\\
|
||||||
|
\mbox{}\verb@ int i, int iStart, int iEnd, @\\
|
||||||
|
\mbox{}\verb@ HistInt *lData, int iDataLen);@\\
|
||||||
\mbox{}\verb@ int PresetHistogram(pHistMem self, SConnection *pCon, HistInt lVal);@\\
|
\mbox{}\verb@ int PresetHistogram(pHistMem self, SConnection *pCon, HistInt lVal);@\\
|
||||||
\mbox{}\verb@@$\diamond$
|
\mbox{}\verb@@$\diamond$
|
||||||
\end{list}
|
\end{list}
|
||||||
@ -514,6 +503,11 @@ initialises the HM from the lData provided. GetHistogram reads an histogram
|
|||||||
into lData but maximum iDataLen items. PresetHistogram presets the HM to the
|
into lData but maximum iDataLen items. PresetHistogram presets the HM to the
|
||||||
value lVal. Can be used to clear the HM.
|
value lVal. Can be used to clear the HM.
|
||||||
|
|
||||||
|
GetHistogram and GetHistogramPointer try to buffer the data when
|
||||||
|
possible and configured. The configuration happens through the
|
||||||
|
definition of an update intervall. GetHistogramDirect never buffers
|
||||||
|
but goes for the histogram memory directly.
|
||||||
|
|
||||||
The histogram memory object buffers the histograms for a adjustable
|
The histogram memory object buffers the histograms for a adjustable
|
||||||
period of time. GetHistogramPointer retrieves a pointer to the local
|
period of time. GetHistogramPointer retrieves a pointer to the local
|
||||||
histogram buffer. It also makes sure, that the histogram has been
|
histogram buffer. It also makes sure, that the histogram has been
|
||||||
@ -620,7 +614,7 @@ following.
|
|||||||
\mbox{}\verb@----------------------------------------------------------------------------*/@\\
|
\mbox{}\verb@----------------------------------------------------------------------------*/@\\
|
||||||
\mbox{}\verb@#ifndef SICSHISTDRIV@\\
|
\mbox{}\verb@#ifndef SICSHISTDRIV@\\
|
||||||
\mbox{}\verb@#define SICSHISTDRIV@\\
|
\mbox{}\verb@#define SICSHISTDRIV@\\
|
||||||
\mbox{}\verb@#define MAXCHAN 4096@\\
|
\mbox{}\verb@#include "hmdata.h"@\\
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
\mbox{}\verb@@$\langle$HistType {\footnotesize ?}$\rangle$\verb@@\\
|
\mbox{}\verb@@$\langle$HistType {\footnotesize ?}$\rangle$\verb@@\\
|
||||||
\mbox{}\verb@@$\langle$HistDrivProt {\footnotesize ?}$\rangle$\verb@@\\
|
\mbox{}\verb@@$\langle$HistDrivProt {\footnotesize ?}$\rangle$\verb@@\\
|
||||||
|
@ -24,6 +24,7 @@ $\langle$hkldat {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ double fLastHKL[5];@\\
|
\mbox{}\verb@ double fLastHKL[5];@\\
|
||||||
\mbox{}\verb@ int iNOR;@\\
|
\mbox{}\verb@ int iNOR;@\\
|
||||||
\mbox{}\verb@ int iQuad;@\\
|
\mbox{}\verb@ int iQuad;@\\
|
||||||
|
\mbox{}\verb@ int iHM;@\\
|
||||||
\mbox{}\verb@ pMotor pTheta;@\\
|
\mbox{}\verb@ pMotor pTheta;@\\
|
||||||
\mbox{}\verb@ pMotor pOmega;@\\
|
\mbox{}\verb@ pMotor pOmega;@\\
|
||||||
\mbox{}\verb@ pMotor pChi;@\\
|
\mbox{}\verb@ pMotor pChi;@\\
|
||||||
@ -51,6 +52,8 @@ The fields are more or less self explaining:
|
|||||||
or is updated automatically from a wavelength variable.
|
or is updated automatically from a wavelength variable.
|
||||||
\item[fLastHKL] the HKL of the last reflection calculated.
|
\item[fLastHKL] the HKL of the last reflection calculated.
|
||||||
\item[iNor] a flag for normal beam calculation mode.
|
\item[iNor] a flag for normal beam calculation mode.
|
||||||
|
\item[iHM] a flag for histogram memory mode. In this mode two theta
|
||||||
|
limits are checked alos for detector 2 and 3.
|
||||||
\item[pTheta] The two theta motor. All motor are needed for boundary
|
\item[pTheta] The two theta motor. All motor are needed for boundary
|
||||||
checking.
|
checking.
|
||||||
\item[pOmega] The omega axis motor.
|
\item[pOmega] The omega axis motor.
|
||||||
|
@ -60,6 +60,7 @@ $\langle$obdes {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ /*---------------------------------------------------------------------------*/@\\
|
\mbox{}\verb@ /*---------------------------------------------------------------------------*/@\\
|
||||||
\mbox{}\verb@ pObjectDescriptor CreateDescriptor(char *name);@\\
|
\mbox{}\verb@ pObjectDescriptor CreateDescriptor(char *name);@\\
|
||||||
\mbox{}\verb@ void DeleteDescriptor(pObjectDescriptor self);@\\
|
\mbox{}\verb@ void DeleteDescriptor(pObjectDescriptor self);@\\
|
||||||
|
\mbox{}\verb@ pObjectDescriptor FindDescriptor(void *pData);@\\
|
||||||
\mbox{}\verb@ @\\
|
\mbox{}\verb@ @\\
|
||||||
\mbox{}\verb@/*============================================================================@\\
|
\mbox{}\verb@/*============================================================================@\\
|
||||||
\mbox{}\verb@ Objects which do not carry data need a dummy descriptor. Otherwise@\\
|
\mbox{}\verb@ Objects which do not carry data need a dummy descriptor. Otherwise@\\
|
||||||
@ -207,6 +208,8 @@ $\langle$count {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ typedef struct {@\\
|
\mbox{}\verb@ typedef struct {@\\
|
||||||
\mbox{}\verb@ int ID;@\\
|
\mbox{}\verb@ int ID;@\\
|
||||||
\mbox{}\verb@ int (*Halt)(void *self);@\\
|
\mbox{}\verb@ int (*Halt)(void *self);@\\
|
||||||
|
\mbox{}\verb@ void (*SetCountParameters)(void *self, float fPreset,@\\
|
||||||
|
\mbox{}\verb@ CounterMode eMode);\@\\
|
||||||
\mbox{}\verb@ int (*StartCount)(void *self, SConnection *pCon);@\\
|
\mbox{}\verb@ int (*StartCount)(void *self, SConnection *pCon);@\\
|
||||||
\mbox{}\verb@ int (*CheckCountStatus)(void *self, SConnection *pCon);@\\
|
\mbox{}\verb@ int (*CheckCountStatus)(void *self, SConnection *pCon);@\\
|
||||||
\mbox{}\verb@ int (*Pause)(void *self, SConnection *pCon);@\\
|
\mbox{}\verb@ int (*Pause)(void *self, SConnection *pCon);@\\
|
||||||
@ -313,6 +316,11 @@ $\langle$cifunc {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ void *pUserData, KillFuncIT pKill);@\\
|
\mbox{}\verb@ void *pUserData, KillFuncIT pKill);@\\
|
||||||
\mbox{}\verb@ int RemoveCallback(pICallBack pInterface, long iID);@\\
|
\mbox{}\verb@ int RemoveCallback(pICallBack pInterface, long iID);@\\
|
||||||
\mbox{}\verb@ int RemoveCallback2(pICallBack pInterface, void *pUserData);@\\
|
\mbox{}\verb@ int RemoveCallback2(pICallBack pInterface, void *pUserData);@\\
|
||||||
|
\mbox{}\verb@@\\
|
||||||
|
\mbox{}\verb@ int CallbackScript(SConnection *pCon, SicsInterp *pSics, void *pData,@\\
|
||||||
|
\mbox{}\verb@ int argc, char *argv[]); @\\
|
||||||
|
\mbox{}\verb@@\\
|
||||||
|
\mbox{}\verb@ pICallBack GetCallbackInterface(void *pData); @\\
|
||||||
\mbox{}\verb@@$\diamond$
|
\mbox{}\verb@@$\diamond$
|
||||||
\end{list}
|
\end{list}
|
||||||
\vspace{-1ex}
|
\vspace{-1ex}
|
||||||
@ -360,8 +368,16 @@ RegisterCallBack.
|
|||||||
search key for deletion is the pointer to user data. All callbacks related
|
search key for deletion is the pointer to user data. All callbacks related
|
||||||
to this user data in the interface specified will be removed.
|
to this user data in the interface specified will be removed.
|
||||||
|
|
||||||
|
{\bf CallbackScript} allows to connect callbacks to scripts. Please
|
||||||
|
note, that those scripts will have a dummy connection to clients only
|
||||||
|
and will not be able to write to clients. All output occurring in
|
||||||
|
these scripts will be directed to stdout though, in order to support
|
||||||
|
debugging.
|
||||||
|
|
||||||
|
|
||||||
All these functions are implemented in the file callback.c.
|
All these functions are implemented in the file callback.c.
|
||||||
|
|
||||||
|
|
||||||
\subsubsection{The Environment Interface}
|
\subsubsection{The Environment Interface}
|
||||||
This interface is used by the environment monitor in order to monitor
|
This interface is used by the environment monitor in order to monitor
|
||||||
the status of a environment controller. The interface looks like this:
|
the status of a environment controller. The interface looks like this:
|
||||||
|
@ -18,6 +18,7 @@ $\langle$servdat {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ pEnvMon pMonitor;@\\
|
\mbox{}\verb@ pEnvMon pMonitor;@\\
|
||||||
\mbox{}\verb@ mkChannel *pServerPort;@\\
|
\mbox{}\verb@ mkChannel *pServerPort;@\\
|
||||||
\mbox{}\verb@ pNetRead pReader;@\\
|
\mbox{}\verb@ pNetRead pReader;@\\
|
||||||
|
\mbox{}\verb@ int simMode;@\\
|
||||||
\mbox{}\verb@ } SicsServer;@\\
|
\mbox{}\verb@ } SicsServer;@\\
|
||||||
\mbox{}\verb@@$\diamond$
|
\mbox{}\verb@@$\diamond$
|
||||||
\end{list}
|
\end{list}
|
||||||
@ -40,6 +41,8 @@ This module monitors sample environment controllers.
|
|||||||
the SICS server is listening for connections.
|
the SICS server is listening for connections.
|
||||||
\item[pReader] points to a data structure which defines the network
|
\item[pReader] points to a data structure which defines the network
|
||||||
communication object.
|
communication object.
|
||||||
|
\item[simMode] a flag which is true when the SICS server is a simulation
|
||||||
|
server.
|
||||||
\end{description}
|
\end{description}
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,6 +60,8 @@ time-of-flight mode.
|
|||||||
\mbox{}\verb@----------------------------------------------------------------------*/@\\
|
\mbox{}\verb@----------------------------------------------------------------------*/@\\
|
||||||
\mbox{}\verb@#ifndef NXAMOR@\\
|
\mbox{}\verb@#ifndef NXAMOR@\\
|
||||||
\mbox{}\verb@#define NXAMOR@\\
|
\mbox{}\verb@#define NXAMOR@\\
|
||||||
|
\mbox{}\verb@#include <scan.h>@\\
|
||||||
|
\mbox{}\verb@#include <HistMem.h>@\\
|
||||||
\mbox{}\verb@@$\langle$namor {\footnotesize ?}$\rangle$\verb@@\\
|
\mbox{}\verb@@$\langle$namor {\footnotesize ?}$\rangle$\verb@@\\
|
||||||
\mbox{}\verb@#endif@\\
|
\mbox{}\verb@#endif@\\
|
||||||
\mbox{}\verb@@$\diamond$
|
\mbox{}\verb@@$\diamond$
|
||||||
|
@ -194,7 +194,7 @@ NexUs API which holds the dictionary information within a NeXus file.
|
|||||||
One additional data type is needed for this API:
|
One additional data type is needed for this API:
|
||||||
\begin{flushleft} \small
|
\begin{flushleft} \small
|
||||||
\begin{minipage}{\linewidth} \label{scrap1}
|
\begin{minipage}{\linewidth} \label{scrap1}
|
||||||
$\langle$tata {\footnotesize 4a}$\rangle\equiv$
|
$\langle$tata {\footnotesize ?}$\rangle\equiv$
|
||||||
\vspace{-1ex}
|
\vspace{-1ex}
|
||||||
\begin{list}{}{} \item
|
\begin{list}{}{} \item
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
@ -213,7 +213,7 @@ NXdict will be used as a handle for the dictionary currently in use.
|
|||||||
\subsubsection{Dictionary Maintainance Function}
|
\subsubsection{Dictionary Maintainance Function}
|
||||||
\begin{flushleft} \small
|
\begin{flushleft} \small
|
||||||
\begin{minipage}{\linewidth} \label{scrap2}
|
\begin{minipage}{\linewidth} \label{scrap2}
|
||||||
$\langle$dicman {\footnotesize 4b}$\rangle\equiv$
|
$\langle$dicman {\footnotesize ?}$\rangle\equiv$
|
||||||
\vspace{-1ex}
|
\vspace{-1ex}
|
||||||
\begin{list}{}{} \item
|
\begin{list}{}{} \item
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
@ -264,7 +264,7 @@ $\langle$dicman {\footnotesize 4b}$\rangle\equiv$
|
|||||||
\subsubsection{Data Handling functions}
|
\subsubsection{Data Handling functions}
|
||||||
\begin{flushleft} \small
|
\begin{flushleft} \small
|
||||||
\begin{minipage}{\linewidth} \label{scrap3}
|
\begin{minipage}{\linewidth} \label{scrap3}
|
||||||
$\langle$dicdata {\footnotesize 5}$\rangle\equiv$
|
$\langle$dicdata {\footnotesize ?}$\rangle\equiv$
|
||||||
\vspace{-1ex}
|
\vspace{-1ex}
|
||||||
\begin{list}{}{} \item
|
\begin{list}{}{} \item
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
@ -347,7 +347,7 @@ The NXDICT data handling functions go in pairs. The version ending in
|
|||||||
|
|
||||||
\begin{flushleft} \small
|
\begin{flushleft} \small
|
||||||
\begin{minipage}{\linewidth} \label{scrap4}
|
\begin{minipage}{\linewidth} \label{scrap4}
|
||||||
$\langle$dicutil {\footnotesize 6}$\rangle\equiv$
|
$\langle$dicutil {\footnotesize ?}$\rangle\equiv$
|
||||||
\vspace{-1ex}
|
\vspace{-1ex}
|
||||||
\begin{list}{}{} \item
|
\begin{list}{}{} \item
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
@ -411,7 +411,7 @@ the current approach poses a serious performance problem.
|
|||||||
Thus, the NXdict data structure looks like this:
|
Thus, the NXdict data structure looks like this:
|
||||||
\begin{flushleft} \small
|
\begin{flushleft} \small
|
||||||
\begin{minipage}{\linewidth} \label{scrap5}
|
\begin{minipage}{\linewidth} \label{scrap5}
|
||||||
$\langle$dicdat {\footnotesize 7}$\rangle\equiv$
|
$\langle$dicdat {\footnotesize ?}$\rangle\equiv$
|
||||||
\vspace{-1ex}
|
\vspace{-1ex}
|
||||||
\begin{list}{}{} \item
|
\begin{list}{}{} \item
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
@ -1155,7 +1155,7 @@ $\langle$deftok {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ {"-type",DTYPE},@\\
|
\mbox{}\verb@ {"-type",DTYPE},@\\
|
||||||
\mbox{}\verb@ {"-rank",DRANK},@\\
|
\mbox{}\verb@ {"-rank",DRANK},@\\
|
||||||
\mbox{}\verb@ {"-attr",DATTR},@\\
|
\mbox{}\verb@ {"-attr",DATTR},@\\
|
||||||
\mbox{}\verb@ {NULL,0} };@\\
|
\mbox{}\verb@ {"",0} };@\\
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
\mbox{}\verb@/*-----------------------------------------------------------------------*/@\\
|
\mbox{}\verb@/*-----------------------------------------------------------------------*/@\\
|
||||||
\mbox{}\verb@ static void NXDIDefToken(ParDat *sStat)@\\
|
\mbox{}\verb@ static void NXDIDefToken(ParDat *sStat)@\\
|
||||||
@ -1543,7 +1543,7 @@ $\langle$nxpasds {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ iRank = atoi(pParse->pToken);@\\
|
\mbox{}\verb@ iRank = atoi(pParse->pToken);@\\
|
||||||
\mbox{}\verb@ break;@\\
|
\mbox{}\verb@ break;@\\
|
||||||
\mbox{}\verb@ case DDIM:@\\
|
\mbox{}\verb@ case DDIM:@\\
|
||||||
\mbox{}\verb@ iRet = NXDIParseDim(pParse, iDim);@\\
|
\mbox{}\verb@ iRet = NXDIParseDim (pParse, (int *) iDim);@\\
|
||||||
\mbox{}\verb@ if(iRet == NX_ERROR)@\\
|
\mbox{}\verb@ if(iRet == NX_ERROR)@\\
|
||||||
\mbox{}\verb@ {@\\
|
\mbox{}\verb@ {@\\
|
||||||
\mbox{}\verb@ LLDdelete(iList);@\\
|
\mbox{}\verb@ LLDdelete(iList);@\\
|
||||||
@ -1599,7 +1599,7 @@ $\langle$nxpasds {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ /* we need to create it, if we may */@\\
|
\mbox{}\verb@ /* we need to create it, if we may */@\\
|
||||||
\mbox{}\verb@ if(pParse->iMayCreate)@\\
|
\mbox{}\verb@ if(pParse->iMayCreate)@\\
|
||||||
\mbox{}\verb@ {@\\
|
\mbox{}\verb@ {@\\
|
||||||
\mbox{}\verb@ iRet = NXmakedata(hfil,pName,iType, iRank,iDim);@\\
|
\mbox{}\verb@ iRet = NXmakedata (hfil, pName, iType, iRank, (int *) iDim);@\\
|
||||||
\mbox{}\verb@ if(iRet != NX_OK)@\\
|
\mbox{}\verb@ if(iRet != NX_OK)@\\
|
||||||
\mbox{}\verb@ { @\\
|
\mbox{}\verb@ { @\\
|
||||||
\mbox{}\verb@ /* a comment on this one has already been written! */@\\
|
\mbox{}\verb@ /* a comment on this one has already been written! */@\\
|
||||||
@ -1669,7 +1669,7 @@ $\langle$parsetype {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ {"DFNT_UINT16",DFNT_UINT16},@\\
|
\mbox{}\verb@ {"DFNT_UINT16",DFNT_UINT16},@\\
|
||||||
\mbox{}\verb@ {"DFNT_INT32",DFNT_INT32},@\\
|
\mbox{}\verb@ {"DFNT_INT32",DFNT_INT32},@\\
|
||||||
\mbox{}\verb@ {"DFNT_UINT32",DFNT_UINT32},@\\
|
\mbox{}\verb@ {"DFNT_UINT32",DFNT_UINT32},@\\
|
||||||
\mbox{}\verb@ {NULL,-122} };@\\
|
\mbox{}\verb@ {"",0} };@\\
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
@ -2737,15 +2737,15 @@ $\langle$free {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@#include "napi.h" /* make sure, napi is included */@\\
|
\mbox{}\verb@#include "napi.h" /* make sure, napi is included */@\\
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
\mbox{}\verb@/*-------------------- NXDict data types & defines ----------------------*/@\\
|
\mbox{}\verb@/*-------------------- NXDict data types & defines ----------------------*/@\\
|
||||||
\mbox{}\verb@@$\langle$tata {\footnotesize 4a}$\rangle$\verb@@\\
|
\mbox{}\verb@@$\langle$tata {\footnotesize ?}$\rangle$\verb@@\\
|
||||||
\mbox{}\verb@#define NXquiet 0@\\
|
\mbox{}\verb@#define NXquiet 0@\\
|
||||||
\mbox{}\verb@#define NXalot 1@\\
|
\mbox{}\verb@#define NXalot 1@\\
|
||||||
\mbox{}\verb@/*-------------------- Dictionary Maintainance ----------------------------*/@\\
|
\mbox{}\verb@/*-------------------- Dictionary Maintainance ----------------------------*/@\\
|
||||||
\mbox{}\verb@@$\langle$dicman {\footnotesize 4b}$\rangle$\verb@@\\
|
\mbox{}\verb@@$\langle$dicman {\footnotesize ?}$\rangle$\verb@@\\
|
||||||
\mbox{}\verb@/*----------------- Dictionary added data transfer -----------------------*/ @\\
|
\mbox{}\verb@/*----------------- Dictionary added data transfer -----------------------*/ @\\
|
||||||
\mbox{}\verb@@$\langle$dicdata {\footnotesize 5}$\rangle$\verb@@\\
|
\mbox{}\verb@@$\langle$dicdata {\footnotesize ?}$\rangle$\verb@@\\
|
||||||
\mbox{}\verb@/*-------------------- Utility Functions --------------------------------*/@\\
|
\mbox{}\verb@/*-------------------- Utility Functions --------------------------------*/@\\
|
||||||
\mbox{}\verb@@$\langle$dicutil {\footnotesize 6}$\rangle$\verb@@\\
|
\mbox{}\verb@@$\langle$dicutil {\footnotesize ?}$\rangle$\verb@@\\
|
||||||
\mbox{}\verb@#endif@\\
|
\mbox{}\verb@#endif@\\
|
||||||
\mbox{}\verb@@$\diamond$
|
\mbox{}\verb@@$\diamond$
|
||||||
\end{list}
|
\end{list}
|
||||||
@ -2804,7 +2804,7 @@ $\langle$free {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ dictionaries.@\\
|
\mbox{}\verb@ dictionaries.@\\
|
||||||
\mbox{}\verb@*/@\\
|
\mbox{}\verb@*/@\\
|
||||||
\mbox{}\verb@/*-------------------------------------------------------------------------*/@\\
|
\mbox{}\verb@/*-------------------------------------------------------------------------*/@\\
|
||||||
\mbox{}\verb@@$\langle$dicdat {\footnotesize 7}$\rangle$\verb@@\\
|
\mbox{}\verb@@$\langle$dicdat {\footnotesize ?}$\rangle$\verb@@\\
|
||||||
\mbox{}\verb@/*-------------------------------------------------------------------------*/@\\
|
\mbox{}\verb@/*-------------------------------------------------------------------------*/@\\
|
||||||
\mbox{}\verb@ static char *NXDIReadFile(FILE *fd)@\\
|
\mbox{}\verb@ static char *NXDIReadFile(FILE *fd)@\\
|
||||||
\mbox{}\verb@ {@\\
|
\mbox{}\verb@ {@\\
|
||||||
|
@ -50,6 +50,7 @@ $\langle$pimoti {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@----------------------------------------------------------------------------*/@\\
|
\mbox{}\verb@----------------------------------------------------------------------------*/@\\
|
||||||
\mbox{}\verb@#ifndef PIMOTOR@\\
|
\mbox{}\verb@#ifndef PIMOTOR@\\
|
||||||
\mbox{}\verb@#define PIMOTOR@\\
|
\mbox{}\verb@#define PIMOTOR@\\
|
||||||
|
\mbox{}\verb@#include <motor.h>@\\
|
||||||
\mbox{}\verb@@$\langle$pimoti {\footnotesize ?}$\rangle$\verb@@\\
|
\mbox{}\verb@@$\langle$pimoti {\footnotesize ?}$\rangle$\verb@@\\
|
||||||
\mbox{}\verb@#endif@\\
|
\mbox{}\verb@#endif@\\
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
|
@ -87,6 +87,7 @@ There are two sections: Building the SICS applications and building the Java
|
|||||||
The first step is to untar the sics.tar file. As a result a directory sics
|
The first step is to untar the sics.tar file. As a result a directory sics
|
||||||
with several subdirectories will be created. These subdirectories are:
|
with several subdirectories will be created. These subdirectories are:
|
||||||
\begin{description}
|
\begin{description}
|
||||||
|
\item[psi]PSI specific commands and code.
|
||||||
\item[hardsup] contains David Madens and other hardware drivers.
|
\item[hardsup] contains David Madens and other hardware drivers.
|
||||||
\item[motor] contains the unix version of David Madens el734\_test program.
|
\item[motor] contains the unix version of David Madens el734\_test program.
|
||||||
\item[doc/programmer]holds programming documentation for SICS.
|
\item[doc/programmer]holds programming documentation for SICS.
|
||||||
@ -95,7 +96,9 @@ The first step is to untar the sics.tar file. As a result a directory sics
|
|||||||
\item[bin] Holds the final binary files.
|
\item[bin] Holds the final binary files.
|
||||||
\item[tcl] Some Tcl helper code.
|
\item[tcl] Some Tcl helper code.
|
||||||
\item[doc/manager]The SICS managers documentation.
|
\item[doc/manager]The SICS managers documentation.
|
||||||
\item[difrac] The DIFRAC four circle diffraction subsystem.
|
\item[difrac] The DIFRAC four circle diffraction subsystem. This is
|
||||||
|
not used anymore.
|
||||||
|
\item[matrix] A matrix manipulation package.
|
||||||
\end{description}
|
\end{description}
|
||||||
For most programs makefiles are provided.
|
For most programs makefiles are provided.
|
||||||
Makefiles may need a little editing to correct the location of libraries.
|
Makefiles may need a little editing to correct the location of libraries.
|
||||||
@ -134,6 +137,8 @@ Again the first step is the untaring of tha java.tar file. This creates a
|
|||||||
\item[spread] Another layout manager package.
|
\item[spread] Another layout manager package.
|
||||||
\item[topsi] The topsi and general scan status display.
|
\item[topsi] The topsi and general scan status display.
|
||||||
\item[amor] The AMOR user interface program.
|
\item[amor] The AMOR user interface program.
|
||||||
|
\item[tas] The Triple Axis user interface program.
|
||||||
|
\item[trics] The TRICS user interface program.
|
||||||
\end{description}
|
\end{description}
|
||||||
Furthermore there are some Java source file in the main directory together
|
Furthermore there are some Java source file in the main directory together
|
||||||
with some htm files and makefiles. For each of the Java clients a makefile
|
with some htm files and makefiles. For each of the Java clients a makefile
|
||||||
@ -149,11 +154,11 @@ Furthermore there are some Java source file in the main directory together
|
|||||||
\item[Jar-File] make -f make.powder jar
|
\item[Jar-File] make -f make.powder jar
|
||||||
\end{description}
|
\end{description}
|
||||||
|
|
||||||
|
|
||||||
\section{Kernel Objects and Modules}
|
\section{Kernel Objects and Modules}
|
||||||
This section describes the modules defining the SICS kernel.
|
This section describes the modules defining the SICS kernel.
|
||||||
\include{task}
|
\include{task}
|
||||||
\include{nserver}
|
\include{nserver}
|
||||||
|
\include{site}
|
||||||
\include{ini}
|
\include{ini}
|
||||||
\include{passwd}
|
\include{passwd}
|
||||||
\include{network}
|
\include{network}
|
||||||
@ -171,6 +176,9 @@ This section describes the modules defining the SICS kernel.
|
|||||||
\include{interrupt}
|
\include{interrupt}
|
||||||
\include{ofac}
|
\include{ofac}
|
||||||
\include{servlog}
|
\include{servlog}
|
||||||
|
\include{help}
|
||||||
|
\include{Busy}
|
||||||
|
\include{hmcontrol}
|
||||||
\subsection{The commandlog}
|
\subsection{The commandlog}
|
||||||
This is yet another logging facility of SICS. The idea is that all I/O
|
This is yet another logging facility of SICS. The idea is that all I/O
|
||||||
going to connections with user or manager level rights is logged.
|
going to connections with user or manager level rights is logged.
|
||||||
@ -187,6 +195,7 @@ writing to it. The rest is implemented as file statics in commandlog.c.
|
|||||||
This section describes the SICS objects implementing commands and objects
|
This section describes the SICS objects implementing commands and objects
|
||||||
common to all SICS instruments.
|
common to all SICS instruments.
|
||||||
\include{scan}
|
\include{scan}
|
||||||
|
\include{userscan}
|
||||||
\include{center}
|
\include{center}
|
||||||
\include{danu}
|
\include{danu}
|
||||||
\include{drive}
|
\include{drive}
|
||||||
@ -202,6 +211,13 @@ common to all SICS instruments.
|
|||||||
\include{token}
|
\include{token}
|
||||||
\include{udpquieck}
|
\include{udpquieck}
|
||||||
\include{xytable}
|
\include{xytable}
|
||||||
|
\include{lin2ang}
|
||||||
|
\include{lomax}
|
||||||
|
\include{nxscript}
|
||||||
|
\include{nxupdate}
|
||||||
|
\include{sicsdata}
|
||||||
|
\include{simsync}
|
||||||
|
\include{anticollider}
|
||||||
|
|
||||||
\section{SICS Hardware Objects}
|
\section{SICS Hardware Objects}
|
||||||
This section deals with objects and modules representing instrument
|
This section deals with objects and modules representing instrument
|
||||||
@ -228,24 +244,31 @@ right as utility functions. However, the preferred and supported way of
|
|||||||
accessing SICS hardware objects is through the interface functions.
|
accessing SICS hardware objects is through the interface functions.
|
||||||
|
|
||||||
\include{velo}
|
\include{velo}
|
||||||
\include{velodorn}
|
|
||||||
\include{evcontroller}
|
\include{evcontroller}
|
||||||
\include{itc4}
|
|
||||||
\include{bruker}
|
|
||||||
\include{tclev}
|
\include{tclev}
|
||||||
\include{evdrivers}
|
\include{evdrivers}
|
||||||
|
|
||||||
\include{motor}
|
\include{motor}
|
||||||
\include{pimotor}
|
|
||||||
|
|
||||||
\include{counter}
|
\include{counter}
|
||||||
|
\include{hmdata}
|
||||||
\include{histogram}
|
\include{histogram}
|
||||||
\include{sinqhmdriv}
|
|
||||||
\include{histsim}
|
\include{histsim}
|
||||||
\include{choco}
|
\include{choco}
|
||||||
|
\include{switchedmotor}
|
||||||
|
\include{tcldriveable}
|
||||||
|
\include{rs232controller}
|
||||||
|
\include{gpib}
|
||||||
|
|
||||||
|
\section{PSI Specific Hardware}
|
||||||
|
\include{velodorn}
|
||||||
|
\include{itc4}
|
||||||
|
\include{bruker}
|
||||||
|
\include{pimotor}
|
||||||
|
\include{sinqhmdriv}
|
||||||
\include{serial}
|
\include{serial}
|
||||||
\include{serialwait}
|
\include{serialwait}
|
||||||
\include{sps}
|
\include{sps}
|
||||||
|
\include{frame}
|
||||||
|
\include{ecb}
|
||||||
|
|
||||||
\section{Powder Diffraction Specific Objects}
|
\section{Powder Diffraction Specific Objects}
|
||||||
\include{dmc}
|
\include{dmc}
|
||||||
@ -275,6 +298,9 @@ The files nxsans.h and nxsans.c implement the NeXus writing functions for SANS.
|
|||||||
\include{tricsnex}
|
\include{tricsnex}
|
||||||
\include{difrac}
|
\include{difrac}
|
||||||
|
|
||||||
|
\section{Triple Axis Specific Code}
|
||||||
|
\include{tas}
|
||||||
|
|
||||||
\section{Helper Objects}
|
\section{Helper Objects}
|
||||||
This section describes helper objects which implement useful data
|
This section describes helper objects which implement useful data
|
||||||
structures or utilities.
|
structures or utilities.
|
||||||
|
@ -66,6 +66,7 @@ $\langle$scandata {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ SConnection *pCon;@\\
|
\mbox{}\verb@ SConnection *pCon;@\\
|
||||||
\mbox{}\verb@ char pRecover[1024];@\\
|
\mbox{}\verb@ char pRecover[1024];@\\
|
||||||
\mbox{}\verb@ char pHeaderFile[1024];@\\
|
\mbox{}\verb@ char pHeaderFile[1024];@\\
|
||||||
|
\mbox{}\verb@ int (*PrepareScan)(pScanData self);@\\
|
||||||
\mbox{}\verb@ int (*WriteHeader)(pScanData self);@\\
|
\mbox{}\verb@ int (*WriteHeader)(pScanData self);@\\
|
||||||
\mbox{}\verb@ int (*WriteScanPoints)@\\
|
\mbox{}\verb@ int (*WriteScanPoints)@\\
|
||||||
\mbox{}\verb@ (pScanData self, @\\
|
\mbox{}\verb@ (pScanData self, @\\
|
||||||
@ -78,6 +79,7 @@ $\langle$scandata {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ (pScanData self,@\\
|
\mbox{}\verb@ (pScanData self,@\\
|
||||||
\mbox{}\verb@ int iP);@\\
|
\mbox{}\verb@ int iP);@\\
|
||||||
\mbox{}\verb@ long lPos;@\\
|
\mbox{}\verb@ long lPos;@\\
|
||||||
|
\mbox{}\verb@ int posSoft;@\\
|
||||||
\mbox{}\verb@ void *pCounterData;@\\
|
\mbox{}\verb@ void *pCounterData;@\\
|
||||||
\mbox{}\verb@ char pCounterName[512];@\\
|
\mbox{}\verb@ char pCounterName[512];@\\
|
||||||
\mbox{}\verb@ int iChannel;@\\
|
\mbox{}\verb@ int iChannel;@\\
|
||||||
@ -140,6 +142,9 @@ line is permitted.
|
|||||||
finding data.
|
finding data.
|
||||||
\item[pCon] The connection object to use for error reporting during scan
|
\item[pCon] The connection object to use for error reporting during scan
|
||||||
execution.
|
execution.
|
||||||
|
\item[PrepareScan] checks limits of scan variables and memorizes
|
||||||
|
important scan information. Sometimes this is not wanted, that is why
|
||||||
|
it is parametrized here.
|
||||||
\item[WriteHeader] is a pointer to a function which writes the header part
|
\item[WriteHeader] is a pointer to a function which writes the header part
|
||||||
of the scan file. Replace this function if another data format is needed.
|
of the scan file. Replace this function if another data format is needed.
|
||||||
\item[WriteScanPoints] is a pointer to a function which will be called after
|
\item[WriteScanPoints] is a pointer to a function which will be called after
|
||||||
@ -154,22 +159,24 @@ This function together with ScanDrive and the data writing functions allow for
|
|||||||
\item[CollectScanData] reads all the scan data into the scan's data
|
\item[CollectScanData] reads all the scan data into the scan's data
|
||||||
structures after any scan point. Overload this if a different storage
|
structures after any scan point. Overload this if a different storage
|
||||||
scheme is required especiallay for polarising scans.
|
scheme is required especiallay for polarising scans.
|
||||||
|
\item[posSoft] is a flag which is true if scan variable are stored with
|
||||||
|
soft position, i.e. with zeropoints applied.
|
||||||
\item[pCounterData] is a pointer to a counter structure. This defines the
|
\item[pCounterData] is a pointer to a counter structure. This defines the
|
||||||
counter to use and is initialized at creation of the scan data structure.
|
counter to use and is initialized at creation of the scan data structure.
|
||||||
\item[pCountername] is the name of the counter used.
|
\item[pCountername] is the name of the counter used.
|
||||||
\item[iChannel] is the channel to use for counting. 0 is the main counter,
|
\item[iChannel] is the channel to use for counting. 0 is the main counter,
|
||||||
everything baove one of the monitors.
|
everything above one of the monitors.
|
||||||
\item[pCount, iCounts] is a dynamic array containing iCounts sets of
|
\item[pCount, iCounts] is a dynamic array containing iCounts sets of
|
||||||
counting infomation. For each scan point this array holds the counts
|
counting infomation. For each scan point this array holds the counts
|
||||||
measured. iCounts is also the current scan position.
|
measured. iCounts is also the current scan position.
|
||||||
\item[iWindow] the width of the window used for peak integration. See
|
\item[iWindow] the width of the window used for peak integration. See
|
||||||
integrate.w,c for more details.
|
integrate.w,c for more details.
|
||||||
\item[pCommand] It turned out that a way is needed to define user defined
|
\item[pCommand] It turned out that a way is needed to define user defined
|
||||||
speciality scans. This is implemented by setting the channel number to -10
|
speciality scans, especially for those magnetic polarized guys. The way
|
||||||
and then have the scan command execute a Tcl script for each scan point.
|
it is done is that scan has to be configured user. In this mode, ScanCount
|
||||||
This Tcl script has to return a Tcl list containing the values to enter for
|
will call a script which does everything necessary at the scan point,
|
||||||
counter and monitor for the scan point. pCommand now is the name of the
|
including adding data to the data file. pCommand now holds the name of
|
||||||
Tcl procedure to invoke.
|
the script to invoke.
|
||||||
\item[pSpecial] Usually NULL. A entry which allows customized scans to keep
|
\item[pSpecial] Usually NULL. A entry which allows customized scans to keep
|
||||||
some additional data in the scan data structure.
|
some additional data in the scan data structure.
|
||||||
\end{description}
|
\end{description}
|
||||||
@ -206,6 +213,7 @@ $\langle$scaninter {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ char *pName, int iLength);@\\
|
\mbox{}\verb@ char *pName, int iLength);@\\
|
||||||
\mbox{}\verb@ int GetScanVarStep(pScanData self, int iWhich, @\\
|
\mbox{}\verb@ int GetScanVarStep(pScanData self, int iWhich, @\\
|
||||||
\mbox{}\verb@ float *fStep);@\\
|
\mbox{}\verb@ float *fStep);@\\
|
||||||
|
\mbox{}\verb@ int isScanVarSoft(pScanData self);@\\
|
||||||
\mbox{}\verb@ int GetScanMonitor(pScanData self, int iWhich, @\\
|
\mbox{}\verb@ int GetScanMonitor(pScanData self, int iWhich, @\\
|
||||||
\mbox{}\verb@ long *lData, int iDataLen);@\\
|
\mbox{}\verb@ long *lData, int iDataLen);@\\
|
||||||
\mbox{}\verb@ int GetScanNP(pScanData self);@\\
|
\mbox{}\verb@ int GetScanNP(pScanData self);@\\
|
||||||
@ -221,7 +229,23 @@ $\langle$scaninter {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ /*@\\
|
\mbox{}\verb@ /*@\\
|
||||||
\mbox{}\verb@ resets the configurable scan functions to their default values.@\\
|
\mbox{}\verb@ resets the configurable scan functions to their default values.@\\
|
||||||
\mbox{}\verb@ */@\\
|
\mbox{}\verb@ */@\\
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@ int NonCheckPrepare(pScanData self);@\\
|
||||||
|
\mbox{}\verb@ /*@\\
|
||||||
|
\mbox{}\verb@ a function for the PrepareScan field in the scan data structure@\\
|
||||||
|
\mbox{}\verb@ which does not check the boundaries of the scan as the default@\\
|
||||||
|
\mbox{}\verb@ PrepareScan does.@\\
|
||||||
|
\mbox{}\verb@ */@\\
|
||||||
|
\mbox{}\verb@ int AppendScanLine(pScanData self, char *line);@\\
|
||||||
|
\mbox{}\verb@ /*@\\
|
||||||
|
\mbox{}\verb@ AppendScanLine appends a line to the scan data file. When finished@\\
|
||||||
|
\mbox{}\verb@ it updates the position pointer in the file to point behind the@\\
|
||||||
|
\mbox{}\verb@ added line. @\\
|
||||||
|
\mbox{}\verb@ */@\\
|
||||||
|
\mbox{}\verb@ int StoreScanCounts(pScanData self, char *data);@\\
|
||||||
|
\mbox{}\verb@ /*@\\
|
||||||
|
\mbox{}\verb@ parses the numbers in data and stores them as the count and@\\
|
||||||
|
\mbox{}\verb@ monitor data for the current scan point.@\\
|
||||||
|
\mbox{}\verb@ */ @\\
|
||||||
\mbox{}\verb@/*------------------------ Interpreter Interface --------------------------*/@\\
|
\mbox{}\verb@/*------------------------ Interpreter Interface --------------------------*/@\\
|
||||||
\mbox{}\verb@ int ScanFactory(SConnection *pCon, SicsInterp *pSics, void *pData,@\\
|
\mbox{}\verb@ int ScanFactory(SConnection *pCon, SicsInterp *pSics, void *pData,@\\
|
||||||
\mbox{}\verb@ int argc, char *argv[]);@\\
|
\mbox{}\verb@ int argc, char *argv[]);@\\
|
||||||
@ -279,6 +303,17 @@ summed counts and the variance. See the section on integrate for more
|
|||||||
details.
|
details.
|
||||||
\item[ResetScanFunctions] reinstalls the default functions for scan
|
\item[ResetScanFunctions] reinstalls the default functions for scan
|
||||||
processing into the ScanData structure.
|
processing into the ScanData structure.
|
||||||
|
\item[NonCheckPrepare] Before a scan is started, various data
|
||||||
|
structures in the scan object are initialized. Thereby the scan
|
||||||
|
boundaries are checked against the motor limits. For some scans this
|
||||||
|
is not feasible. This version omits this check and must be entered as
|
||||||
|
the PrepareScan function field in the scan data structure by code
|
||||||
|
using the scan module.
|
||||||
|
\item[AppendScanLine] appends a line to the scan file. This is useful
|
||||||
|
for user configured scans, for instance in polarisation mode.
|
||||||
|
\item[StoreScanCounts] parses the data given in data and stores the
|
||||||
|
numbers as count values as the count data for the current scan point.
|
||||||
|
Another feature for supporting user configurable scans.
|
||||||
\item[SimScan] creates a simulated gaussian peak with the given
|
\item[SimScan] creates a simulated gaussian peak with the given
|
||||||
parameters. Used for debugging several things.
|
parameters. Used for debugging several things.
|
||||||
\item[ScanFactory] is the SICS interpreter object creation function
|
\item[ScanFactory] is the SICS interpreter object creation function
|
||||||
|
@ -30,6 +30,10 @@ $\langle$SQType {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ pSINQHM pMaster;@\\
|
\mbox{}\verb@ pSINQHM pMaster;@\\
|
||||||
\mbox{}\verb@ int iLastHMError;@\\
|
\mbox{}\verb@ int iLastHMError;@\\
|
||||||
\mbox{}\verb@ int iLastCTError;@\\
|
\mbox{}\verb@ int iLastCTError;@\\
|
||||||
|
\mbox{}\verb@ HistMode eHistMode;@\\
|
||||||
|
\mbox{}\verb@ int iBinWidth;@\\
|
||||||
|
\mbox{}\verb@ OverFlowMode eFlow;@\\
|
||||||
|
\mbox{}\verb@ int extraDetector;@\\
|
||||||
\mbox{}\verb@ } SinqHMDriv;@\\
|
\mbox{}\verb@ } SinqHMDriv;@\\
|
||||||
\mbox{}\verb@@$\diamond$
|
\mbox{}\verb@@$\diamond$
|
||||||
\end{list}
|
\end{list}
|
||||||
@ -59,7 +63,10 @@ The driver implements all the functions specified in the driver interface.
|
|||||||
Please note that these contain functions for the deletion of driver private
|
Please note that these contain functions for the deletion of driver private
|
||||||
data structures which will be automatically called form DeleteHistDriver.
|
data structures which will be automatically called form DeleteHistDriver.
|
||||||
Therefore the only function to define is CreateSINQDriver which sets things
|
Therefore the only function to define is CreateSINQDriver which sets things
|
||||||
up.
|
up. Another function is isSINQHMDriv which tests if the driver given as an
|
||||||
|
argument actually is a SINQHM driver. This is currently only used in
|
||||||
|
amorstat.c which has to circumvent normal SICS mechanisms for performance
|
||||||
|
reasons.
|
||||||
|
|
||||||
\begin{flushleft} \small
|
\begin{flushleft} \small
|
||||||
\begin{minipage}{\linewidth} \label{scrap2}
|
\begin{minipage}{\linewidth} \label{scrap2}
|
||||||
@ -68,6 +75,7 @@ $\langle$Protos {\footnotesize ?}$\rangle\equiv$
|
|||||||
\begin{list}{}{} \item
|
\begin{list}{}{} \item
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
\mbox{}\verb@ pHistDriver CreateSINQDriver(pStringDict pOption);@\\
|
\mbox{}\verb@ pHistDriver CreateSINQDriver(pStringDict pOption);@\\
|
||||||
|
\mbox{}\verb@ int isSINQHMDriv(pHistDriver test);@\\
|
||||||
\mbox{}\verb@@$\diamond$
|
\mbox{}\verb@@$\diamond$
|
||||||
\end{list}
|
\end{list}
|
||||||
\vspace{-1ex}
|
\vspace{-1ex}
|
||||||
@ -94,7 +102,7 @@ $\langle$Protos {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@----------------------------------------------------------------------------*/@\\
|
\mbox{}\verb@----------------------------------------------------------------------------*/@\\
|
||||||
\mbox{}\verb@#ifndef SINQHMDRIVER@\\
|
\mbox{}\verb@#ifndef SINQHMDRIVER@\\
|
||||||
\mbox{}\verb@#define SINQHMDRIVER@\\
|
\mbox{}\verb@#define SINQHMDRIVER@\\
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@#include "hardsup/sinqhm.h"@\\
|
||||||
\mbox{}\verb@@$\langle$SQType {\footnotesize ?}$\rangle$\verb@@\\
|
\mbox{}\verb@@$\langle$SQType {\footnotesize ?}$\rangle$\verb@@\\
|
||||||
\mbox{}\verb@/*-------------------------------------------------------------------------*/@\\
|
\mbox{}\verb@/*-------------------------------------------------------------------------*/@\\
|
||||||
\mbox{}\verb@@$\langle$Protos {\footnotesize ?}$\rangle$\verb@@\\
|
\mbox{}\verb@@$\langle$Protos {\footnotesize ?}$\rangle$\verb@@\\
|
||||||
|
@ -1,129 +1,143 @@
|
|||||||
\chapter{Site Adaptions}\label{site}
|
\subsubsection{Site Abstraction Layer}
|
||||||
Any new site adapting SICS will have different hardware and thus
|
With ANSTO using SICS as well it became necessary to separate the
|
||||||
require different drivers. Moreover additional commands may need to be
|
general parts of SICS from the installation specific components. Each
|
||||||
added in order to support special hardware, instrument specific
|
installation will have a separate set of drivers and, to some
|
||||||
computations or status displays and local usage patterns. In order to
|
extent, instrument specific commands. Such code has to be in a
|
||||||
separate such site specific code from the SICS kernel, the site data
|
separate library. Access to this library is through an interface which
|
||||||
structure was conceived. Any new site is supposed to create a library
|
consists of a structure containing pointers to functions which allow
|
||||||
which provides site specific code and the site data structure which
|
for the creation of site specific drivers and commands. Moreover, the
|
||||||
allows SICS to locate the code. A site data structure can be retrieved
|
site specific library has to implement a function, getSite, which
|
||||||
using:
|
returns the appropriate data structure for the site for which SICS is
|
||||||
\begin{verbatim}
|
being compiled. This data structure looks like this:
|
||||||
pSite getSite(void);
|
|
||||||
\end{verbatim}
|
|
||||||
The site data structure is meant to be a singleton. It is a site's
|
|
||||||
programmers task to provide an implementation of getSite which returns
|
|
||||||
a nice site structure.
|
|
||||||
|
|
||||||
The site data structure is a structure which holds pointers to
|
\begin{flushleft} \small
|
||||||
functions. A user has to implement suitable functions along the
|
\begin{minipage}{\linewidth} \label{scrap1}
|
||||||
signatures given and assign them to this data structure.
|
$\langle$sitedata {\footnotesize ?}$\rangle\equiv$
|
||||||
\begin{verbatim}
|
\vspace{-1ex}
|
||||||
typedef struct {
|
\begin{list}{}{} \item
|
||||||
void (*AddSiteCommands)(SicsInterp *pSics);
|
\mbox{}\verb@@\\
|
||||||
void (*RemoveSiteCommands)(SicsInterp *pSics);
|
\mbox{}\verb@ typedef struct {@\\
|
||||||
pMotor (*CreateMotor)(SConnection *pCon,
|
\mbox{}\verb@ void (*AddSiteCommands)(SicsInterp *pSics);@\\
|
||||||
int argc, char *argv[]);
|
\mbox{}\verb@ void (*RemoveSiteCommands)(SicsInterp *pSics);@\\
|
||||||
pCounterDriver (*CreateCounterDriver)(
|
\mbox{}\verb@ pMotor (*CreateMotor)(SConnection *pCon,@\\
|
||||||
SConnection *pCon,
|
\mbox{}\verb@ int argc, char *argv[]);@\\
|
||||||
int argc,
|
\mbox{}\verb@ pCounterDriver (*CreateCounterDriver)(@\\
|
||||||
char *argv[]);
|
\mbox{}\verb@ SConnection *pCon,@\\
|
||||||
HistDriver *(*CreateHistogramMemoryDriver)(
|
\mbox{}\verb@ int argc, @\\
|
||||||
char *name, pStringDict pOption);
|
\mbox{}\verb@ char *argv[]);@\\
|
||||||
pVelSelDriv (*CreateVelocitySelector)(char *name,
|
\mbox{}\verb@ HistDriver *(*CreateHistogramMemoryDriver)(@\\
|
||||||
char *array, Tcl_Interp *pTcl);
|
\mbox{}\verb@ char *name, pStringDict pOption);@\\
|
||||||
pCodri (*CreateControllerDriver)(SConnection *pCon,
|
\mbox{}\verb@ pVelSelDriv (*CreateVelocitySelector)(char *name, @\\
|
||||||
int argc,
|
\mbox{}\verb@ char *array, Tcl_Interp *pTcl);@\\
|
||||||
char *argv[]);
|
\mbox{}\verb@ pCodri (*CreateControllerDriver)(SConnection *pCon,@\\
|
||||||
pEVControl (*InstallEnvironmentController)(
|
\mbox{}\verb@ int argc,@\\
|
||||||
SicsInterp *pSics,
|
\mbox{}\verb@ char *argv[]);@\\
|
||||||
SConnection *pCon,
|
\mbox{}\verb@ pEVControl (*InstallEnvironmentController)(@\\
|
||||||
int argc,
|
\mbox{}\verb@ SicsInterp *pSics,@\\
|
||||||
char *argv[]);
|
\mbox{}\verb@ SConnection *pCon,@\\
|
||||||
int (*ConfigureScan)(pScanData self,
|
\mbox{}\verb@ int argc,@\\
|
||||||
char *option);
|
\mbox{}\verb@ char *argv[]);@\\
|
||||||
void (*KillSite)(void *pData);
|
\mbox{}\verb@ int (*ConfigureScan)(pScanData self,@\\
|
||||||
}Site, *pSite;
|
\mbox{}\verb@ char *option);@\\
|
||||||
\end{verbatim}
|
\mbox{}\verb@ void (*KillSite)(void *pData);@\\
|
||||||
|
\mbox{}\verb@}Site, *pSite;@\\
|
||||||
The members of this data structure:
|
\mbox{}\verb@@$\diamond$
|
||||||
|
\end{list}
|
||||||
|
\vspace{-1ex}
|
||||||
|
\footnotesize\addtolength{\baselineskip}{-1ex}
|
||||||
|
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||||
|
\item Macro referenced in scrap ?.
|
||||||
|
\end{list}
|
||||||
|
\end{minipage}\\[4ex]
|
||||||
|
\end{flushleft}
|
||||||
\begin{description}
|
\begin{description}
|
||||||
\item[AddSiteCommand] adds site specific commands coded in C to the
|
\item[AddSiteCommands] adds site specific object creation and
|
||||||
SICS interpreter pSics.
|
instrument specific commands to the SICS interpreter, pSics.
|
||||||
\item[RemoveSiteCommands] removes object creation commands after SICS
|
\item[RemoveSiteCommands] will be called to remove surplus object
|
||||||
has processed the instrument initialization file. See \ref{factory}
|
creation commands after the SICS interpreter has processed the
|
||||||
for details on the scheme.
|
initialization files. Please note, that SICS does not support the
|
||||||
\item[CreateMotor] creates a motor object. \verb+argv[0]+ contains the
|
removal of objects at runtime in general. This is due to the fact that
|
||||||
motors name, \verb+argv[1]+ the identifier for the motor driver and
|
any possible object may be used by or linked to others and and it
|
||||||
the rest of argv, argc holds further driver initialisation
|
would be a bookeeping nightmare to keep track of all those relations.
|
||||||
parameters. Any errors in processing the arguments can be reported to
|
\item[CreateMotor] creates a motor using the arguments in argc and
|
||||||
pCon. If CreateMotor can create a suitable motor object, a pointer to
|
argv. It returns a pointer to the new motor structure on success or
|
||||||
it is returned, if not NULL must be returned.
|
NULL in case of a failure. This function has to return a complete
|
||||||
\item[CreateCounterDriver] creates a driver for a counter. argc, argv
|
motor in order to allow for special configurations of the motor to
|
||||||
is the full array of arguments given to the MakeCounter factory
|
take place in its initialization.
|
||||||
function. Of interest are: \verb+argv[1]+ the counter name,
|
\item[CreateCounterDriver] returns a driver for a new counter box
|
||||||
\verb+argv[2]+, the driver identifier and the rest of the
|
driver if the parameters are valid or NULL if not. Driver arguments
|
||||||
initialization arguments. On success a pointer to
|
are in the argc, argv pair.
|
||||||
new driver is returned, on failure NULL.
|
|
||||||
\item[CreateHistogramMemoryDriver] creates a driver for a histogram
|
\item[CreateHistogramMemoryDriver] creates a driver for a histogram
|
||||||
memory. The driver is identified through name, the options database is
|
memory. The driver type is specified through name.
|
||||||
in pOptions. Histogram memory initialization follows the following
|
Driver options are in pOptions.
|
||||||
pattern:
|
\item[CreateVelocitySelector] create a driver for a velocity selector.
|
||||||
\begin{itemize}
|
The parameter name is the name of the driver, array is the name of a
|
||||||
\item At first the raw driver is created. This code has to initializie
|
Tcl array holding configuration parameters for the driver and pTcl is
|
||||||
defaults in the options data base.
|
the Tcl interpreter in which array lives.
|
||||||
\item Then, with calls to {\em hmname configure opt val} the options
|
\item[CreateControllerDriver] creates a driver for the general
|
||||||
database is populated with the histogram memories configuration
|
controller module within SICS. argc and argv hold the parameters,
|
||||||
options. The options database is pOptions a dictionary of name value
|
starting with the name of the driver to create.
|
||||||
pairs.
|
\item[InstallEnvironmentController] installs a a sample
|
||||||
\item In the last step, with {\bf hmname init} the options are parsed
|
environment device such as a temperature controller or magnet
|
||||||
and the driver is supposed to connect to the histogram memory. See
|
controller etc. into the interpreter pSics. pCon is a connection
|
||||||
Configure in the histogram memory driver.
|
object to which errors can be
|
||||||
\end{itemize}
|
reported, argc and argv are the controller parameters starting with
|
||||||
On success a pointer to
|
the driver name. This method does not get away with creating a driver
|
||||||
new driver is returned, on failure NULL.
|
but must install the command into SICS because some environment
|
||||||
\item[CreateVelolcitySelector] creates a driver for a velocity selector. The
|
devices overload the standard Wrapper function with special ones. The
|
||||||
driver is identified by nname, array is the name of a Tcl array in
|
newly created object is still returned for further processing. In the
|
||||||
pTcl holding initialization parameters for name.
|
case of failure NULL is returned. Errors will have been printed to
|
||||||
\item[CreateControllerDriver] generates a driver for a SICS general controller
|
pCon.
|
||||||
object. \verb+argv[0]+ is the driver identifier, the rest of argc,
|
\item[ConfigureScan] allows for modules which configure the scan
|
||||||
\verb+argv[]+ are further initialization parameters. Any errors in
|
object. option is the option to xxscan configure to process, the scan
|
||||||
parsing argc, argv can be reported to pCon. On success a pointer to
|
object to configure is passed in in self. This returns 1 on success
|
||||||
new driver is returned, on failure NULL.
|
and 0 on failures or options which are not recognized.
|
||||||
\item[InstallEnvironmentController] installs a sample environment
|
\item[KillSite] is a function to remove the site data structure when
|
||||||
controller into pSics. \verb+argv[3]+ is the driver identifier,
|
SICS is done with it. pData must point to the site data structure.
|
||||||
\verb+argv[2]+ is the SICS name of the environment device command, the
|
KillSite's purpose is to free all memory associated with
|
||||||
rest are initialization parameters. This function must also install
|
the site data structure. This is mostly a cleanup thing, to keep the
|
||||||
the command into pSics with AddCommand. This is because for many PSI
|
fortify logs clear off inconsequential and confusing data.
|
||||||
environment devices special interpreter wrapper functions are
|
\end{description}
|
||||||
provided. Any errors encountered while processing the arguments has to
|
|
||||||
be reported to pCon. On success a pointer to the environment
|
|
||||||
controller is returned, on failure NULL.
|
|
||||||
\item[ConfigureScan] configures the SICS general scan object self according
|
|
||||||
to the value of option. Returns 1 on success and 0 on failure. SICS
|
|
||||||
general scan object is a data structure holding function pointers for
|
|
||||||
various steps in the scan. These functions can be overloaded in order
|
|
||||||
to provide for special scans. See the documentation in scan.tex,
|
|
||||||
scan.h and scan.c for more details.
|
|
||||||
\end{description}
|
|
||||||
|
|
||||||
|
|
||||||
All the simulation drivers for the hardware are part of the SICS
|
|
||||||
kernel and need not be initialized from these functions. SICS also
|
|
||||||
handles sample environment devices built in Tcl or on the general
|
|
||||||
controller object.
|
|
||||||
|
|
||||||
|
|
||||||
The site data structure suffers a little from inconsistencies
|
|
||||||
introduced through varying concepts for initializing SICS objects implemented
|
|
||||||
in various stage of the development of SICS. If you need to bypass the schemes
|
|
||||||
introduced here, consider implementing an own factory command and
|
|
||||||
install it through AddSiteCommand, RemoveSiteCommand.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Good luck!
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\begin{flushleft} \small
|
||||||
|
\begin{minipage}{\linewidth} \label{scrap2}
|
||||||
|
\verb@"site.h"@ {\footnotesize ? }$\equiv$
|
||||||
|
\vspace{-1ex}
|
||||||
|
\begin{list}{}{} \item
|
||||||
|
\mbox{}\verb@@\\
|
||||||
|
\mbox{}\verb@/*-----------------------------------------------------------------------@\\
|
||||||
|
\mbox{}\verb@ S i t e A b s t r a c t i o n L a y e r@\\
|
||||||
|
\mbox{}\verb@@\\
|
||||||
|
\mbox{}\verb@With ANSTO using SICS as well it became necessary to separate the@\\
|
||||||
|
\mbox{}\verb@general parts of SICS from the installation specific components. Each@\\
|
||||||
|
\mbox{}\verb@installation will have a separate set of drivers and, to some@\\
|
||||||
|
\mbox{}\verb@extent, instrument specific commands. Such code has to be in a@\\
|
||||||
|
\mbox{}\verb@separate library. Access to this library is through an interface which@\\
|
||||||
|
\mbox{}\verb@consists of a structure containing pointers to functions which allow@\\
|
||||||
|
\mbox{}\verb@for the creation of site specific drivers and commands. Moreover, the@\\
|
||||||
|
\mbox{}\verb@site specific library has to implement a function, getSite, which@\\
|
||||||
|
\mbox{}\verb@returns the appropriate data structure for the site for which SICS is@\\
|
||||||
|
\mbox{}\verb@being compiled. @\\
|
||||||
|
\mbox{}\verb@------------------------------------------------------------------------*/@\\
|
||||||
|
\mbox{}\verb@#ifndef SICSSITE@\\
|
||||||
|
\mbox{}\verb@#define SICSSITE@\\
|
||||||
|
\mbox{}\verb@#include <sics.h>@\\
|
||||||
|
\mbox{}\verb@#include <motor.h>@\\
|
||||||
|
\mbox{}\verb@#include <countdriv.h>@\\
|
||||||
|
\mbox{}\verb@#include <HistDriv.i>@\\
|
||||||
|
\mbox{}\verb@#include <stringdict.h>@\\
|
||||||
|
\mbox{}\verb@#include <velo.h>@\\
|
||||||
|
\mbox{}\verb@#include <tcl.h>@\\
|
||||||
|
\mbox{}\verb@#include <codri.h>@\\
|
||||||
|
\mbox{}\verb@#include <evcontroller.h>@\\
|
||||||
|
\mbox{}\verb@#include <scan.h>@\\
|
||||||
|
\mbox{}\verb@@$\langle$sitedata {\footnotesize ?}$\rangle$\verb@@\\
|
||||||
|
\mbox{}\verb@/*-------------------------------------------------------------------*/@\\
|
||||||
|
\mbox{}\verb@pSite getSite(void);@\\
|
||||||
|
\mbox{}\verb@#endif@\\
|
||||||
|
\mbox{}\verb@@$\diamond$
|
||||||
|
\end{list}
|
||||||
|
\vspace{-2ex}
|
||||||
|
\end{minipage}\\[4ex]
|
||||||
|
\end{flushleft}
|
||||||
|
@ -46,6 +46,7 @@ $\langle$dh {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
\mbox{}\verb@ int GetDornierStatus(void **pData, pDornierStatus pDornier);@\\
|
\mbox{}\verb@ int GetDornierStatus(void **pData, pDornierStatus pDornier);@\\
|
||||||
\mbox{}\verb@ int DornierSend(void **pData, char *pCommand, char *pReply, int iLen);@\\
|
\mbox{}\verb@ int DornierSend(void **pData, char *pCommand, char *pReply, int iLen);@\\
|
||||||
|
\mbox{}\verb@ int DecodeNewDornierStatus(char *pText, pDornierStatus pDornier);@\\
|
||||||
\mbox{}\verb@@$\diamond$
|
\mbox{}\verb@@$\diamond$
|
||||||
\end{list}
|
\end{list}
|
||||||
\vspace{-1ex}
|
\vspace{-1ex}
|
||||||
@ -69,6 +70,8 @@ $\langle$dh {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
\mbox{}\verb@ Mark Koennecke, Juli 1997@\\
|
\mbox{}\verb@ Mark Koennecke, Juli 1997@\\
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
|
\mbox{}\verb@ updated to support new format fo status messages, Mark Koennecke, July 2003@\\
|
||||||
|
\mbox{}\verb@@\\
|
||||||
\mbox{}\verb@ copyright: see implementation file.@\\
|
\mbox{}\verb@ copyright: see implementation file.@\\
|
||||||
\mbox{}\verb@------------------------------------------------------------------------------*/@\\
|
\mbox{}\verb@------------------------------------------------------------------------------*/@\\
|
||||||
\mbox{}\verb@#ifndef VELODORN@\\
|
\mbox{}\verb@#ifndef VELODORN@\\
|
||||||
|
@ -36,7 +36,19 @@ system for instance file names are case sensitive and that had to be
|
|||||||
preserved. Commands defined in the scripting language are lower case by
|
preserved. Commands defined in the scripting language are lower case by
|
||||||
convention.
|
convention.
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
Most SICS objects also hold the parameters required for their proper
|
||||||
|
operation. The general syntax for handling such parameters is:
|
||||||
|
<pre>
|
||||||
|
objectname parametername
|
||||||
|
</pre>
|
||||||
|
prints the current value of the parameter
|
||||||
|
</p>
|
||||||
|
<pre>
|
||||||
|
objectname parametername newvalue
|
||||||
|
</pre>
|
||||||
|
sets the parameter value to newvalue if you are properly authorized.
|
||||||
|
</p>
|
||||||
<h3>Authorisation</h3>
|
<h3>Authorisation</h3>
|
||||||
<p>
|
<p>
|
||||||
A client server system is potentially open to unauthorised hackers
|
A client server system is potentially open to unauthorised hackers
|
||||||
|
@ -21,9 +21,6 @@ manually from the command line through the following commands:
|
|||||||
is minutes.
|
is minutes.
|
||||||
<DT>storefocus intervall newval
|
<DT>storefocus intervall newval
|
||||||
<DD>Sets the update intervall to newval minutes.
|
<DD>Sets the update intervall to newval minutes.
|
||||||
<DT>killfile
|
|
||||||
<DD>This command will overwrite the last data file written and thus
|
|
||||||
effectively erase it. Therefore this command requires manager privilege.
|
|
||||||
</DL>
|
</DL>
|
||||||
FOCUS has three detector banks which may not all be active at all
|
FOCUS has three detector banks which may not all be active at all
|
||||||
times. Thus a way is needed to tell SICS about the configuration of
|
times. Thus a way is needed to tell SICS about the configuration of
|
||||||
|
@ -75,15 +75,10 @@ for its number type.
|
|||||||
</UL>
|
</UL>
|
||||||
<DT> Rank
|
<DT> Rank
|
||||||
<DD> Rank defines the number of histograms in memory.
|
<DD> Rank defines the number of histograms in memory.
|
||||||
<DT> Length
|
|
||||||
<DD> gives the length of an individual histogram.
|
|
||||||
<DT> BinWidth
|
<DT> BinWidth
|
||||||
<DD> determines the size of a single bin in histogram memory in bytes.
|
<DD> determines the size of a single bin in histogram memory in bytes.
|
||||||
<DT>dim0, dim1, dim2, ... dimn
|
<DT>dim0, dim1, dim2, ... dimn
|
||||||
<DD>define the logical dimensions of the histogram. Must be set if the
|
<DD>define the logical dimensions of the histogram.
|
||||||
the sum command (see below) is to be used. This is a clutch necessary to
|
|
||||||
cope with the different notions of dimensions in the SINQ histogram memory
|
|
||||||
and physics.
|
|
||||||
</DL>
|
</DL>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
@ -126,6 +121,8 @@ will be generated starting from start with a stepwidth of step (example: HM genb
|
|||||||
configured with this command. The time bin iNum is set to the value value.
|
configured with this command. The time bin iNum is set to the value value.
|
||||||
<DT>HM clearbin
|
<DT>HM clearbin
|
||||||
<DD>Deletes the currently active time binning information.
|
<DD>Deletes the currently active time binning information.
|
||||||
|
<dt>HM notimebin
|
||||||
|
<dd>returns the number of currently configured timebins.
|
||||||
</DL>
|
</DL>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -150,6 +147,10 @@ transfer the configuration from the host computer to the actual HM.
|
|||||||
<DD> starts counting using the currently active values for CountMode and
|
<DD> starts counting using the currently active values for CountMode and
|
||||||
preset. This command does not block, i.e. in order to inhibit further
|
preset. This command does not block, i.e. in order to inhibit further
|
||||||
commands from the console, you have to give Success afterwards.
|
commands from the console, you have to give Success afterwards.
|
||||||
|
<DT>HM countblock
|
||||||
|
<DD> starts counting using the currently active values for CountMode and
|
||||||
|
preset. This command does block, i.e. you can give new commands only when
|
||||||
|
the counting operation finishes.
|
||||||
<DT>HM initval <i>val</i>
|
<DT>HM initval <i>val</i>
|
||||||
<DD> initialises the whole histogram memory to the value val. Ususally 0 in
|
<DD> initialises the whole histogram memory to the value val. Ususally 0 in
|
||||||
order to clear the HM.
|
order to clear the HM.
|
||||||
@ -164,3 +165,5 @@ allow to retrieve a subset of a histogram between iStart and iEnd.
|
|||||||
</p>
|
</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,6 +53,17 @@ Optionally a psi value and a hamilton position can be specified.
|
|||||||
the motors to drive to that position. This command will wait for the
|
the motors to drive to that position. This command will wait for the
|
||||||
diffractometer to arrive at the setting angles requested.
|
diffractometer to arrive at the setting angles requested.
|
||||||
Optionally a psi value and a hamilton position can be specified.
|
Optionally a psi value and a hamilton position can be specified.
|
||||||
|
<dt>hkl hm
|
||||||
|
<dd>Retrieves the value of the histogram memory flag.
|
||||||
|
<dt>hkl hm val
|
||||||
|
<dd>Sets the histogram memory flag to val. This is a special for
|
||||||
|
TRICS. TRICS has three detectors at 0, 45, 90 degree offset to two
|
||||||
|
theta. If this flag is greater 0, hkl checks if the reflection to be
|
||||||
|
calculated is on any of the three detectors and calculates two theta
|
||||||
|
accordingly.
|
||||||
|
<dt>hkl fromangles two-theta om chi phi
|
||||||
|
<dd>Calculates hkl from the angles given on the command line using the
|
||||||
|
current UB matrix and wavelength.
|
||||||
</DL>
|
</DL>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
@ -3,10 +3,14 @@
|
|||||||
<TITLE>Hklscan</TITLE>
|
<TITLE>Hklscan</TITLE>
|
||||||
</HEAD>
|
</HEAD>
|
||||||
<BODY>
|
<BODY>
|
||||||
<H1>Hklscan</H1>
|
<H1>Hklscan and Hklscan2d</H1>
|
||||||
<P>
|
<P>
|
||||||
Hklscan is a command which allows to scan in reciprocal space expressed as
|
Hklscan is a command which allows to scan in reciprocal space expressed as
|
||||||
Miller indizes on a four circle diffractometer. Prerequisite for this is
|
Miller indizes on a four circle diffractometer. Hklscan operates with
|
||||||
|
a single detector. Hklscan2d does the same as hklscan but for the
|
||||||
|
position sensitive detectors, saving data into NeXus files. Hklscan
|
||||||
|
and Hklscan2d share the same syntax.
|
||||||
|
Prerequisite for this is
|
||||||
the existence of a scan object and the hkl-object for doing crystallographic
|
the existence of a scan object and the hkl-object for doing crystallographic
|
||||||
calculations. Make sure the properties of the hkl object (UB, wavelength, NB)
|
calculations. Make sure the properties of the hkl object (UB, wavelength, NB)
|
||||||
have some reasonable relation to reality, otherwise the diffractometer may
|
have some reasonable relation to reality, otherwise the diffractometer may
|
||||||
@ -25,10 +29,15 @@ Hklscan is a command which allows to scan in reciprocal space expressed as
|
|||||||
<dd>executes the HKL scan. NP is the number of points to do, mode is the
|
<dd>executes the HKL scan. NP is the number of points to do, mode is the
|
||||||
counting mode and can be either timer or monitor and preset is the preset
|
counting mode and can be either timer or monitor and preset is the preset
|
||||||
value for the counter at each step.
|
value for the counter at each step.
|
||||||
|
<dt>hklscan2d sim NP mode preset
|
||||||
|
<dd>This command only for hklscan2d. It tries to calculate all points
|
||||||
|
in the hkl scan and complains if it cannot reached or stays
|
||||||
|
silent. Use this to test if your hklscan2d can be performed.
|
||||||
</dl>
|
</dl>
|
||||||
Data is written automatically into a slightly modified TOPSI data format
|
Data is written automatically into a slightly modified TOPSI data format
|
||||||
file. The status display with topsistatus or scanstatus might be slightly
|
file for hklscan. The status display with topsistatus or scanstatus
|
||||||
erratic as it uses two theta as x-axis.
|
might be slightly erratic as it uses two theta as x-axis. Hklscan2d
|
||||||
|
writes data into NeXus files.
|
||||||
</P>
|
</P>
|
||||||
</BODY>
|
</BODY>
|
||||||
</HTML>
|
</HTML>
|
||||||
|
59
doc/user/lowmax.htm
Normal file
59
doc/user/lowmax.htm
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
<HTML>
|
||||||
|
<HEAD>
|
||||||
|
<TITLE>The Local Maximum Search Module</TITLE>
|
||||||
|
</HEAD>
|
||||||
|
<BODY>
|
||||||
|
<h1>The Local Maximum Search Module</h1>
|
||||||
|
<p>
|
||||||
|
This module allows to search for local maxima in two-dimensional
|
||||||
|
datasets stored within a SICS histogram memory. All commands
|
||||||
|
act upon the current content of the histogram memory. The following
|
||||||
|
commands are understood:
|
||||||
|
<dl>
|
||||||
|
<dt>lowmax stat hm
|
||||||
|
<dd>calculates the average and the maximum count in the frame
|
||||||
|
currently held in histogram memory hm.
|
||||||
|
<dt>lowmax search hm
|
||||||
|
<dd>searches the frame held in histogram memory hm for local
|
||||||
|
maxima. Local maxima are returned as sets of three numbers which are
|
||||||
|
the x and y coordinates and the intensity. Each set of numbers is
|
||||||
|
separated from the next one by the @ symbol.
|
||||||
|
<dt>lowmax cog hm x y
|
||||||
|
<dd>calculates the center ogf gravity for the pixel at coordinates x
|
||||||
|
and y in histogram memory hm. Four numbers are returned: the new x and
|
||||||
|
y coordinates, the intensity of the peak and the number of points
|
||||||
|
contributing to the peak.
|
||||||
|
<dt>lowmax steepness val
|
||||||
|
<dd>accesses the steepness parameter for the peak search. With a
|
||||||
|
parameter val sets a new value, without print the current value.
|
||||||
|
<dt>lowmax window val
|
||||||
|
<dd>accesses the window parameter for the peak search. With a
|
||||||
|
parameter val sets a new value, without print the current value.
|
||||||
|
<dt>lowmax threshold val
|
||||||
|
<dd>accesses the thresholds parameter for the peak search. With a
|
||||||
|
parameter val sets a new value, without print the current value.
|
||||||
|
<dt>lowmax cogwindow val
|
||||||
|
<dd>accesses the cogwindow parameter for the peak search. With a
|
||||||
|
parameter val sets a new value, without print the current value.
|
||||||
|
<dt>lowmax cogcontour val
|
||||||
|
<dd>accesses the cogcontour parameter for the peak search. With a
|
||||||
|
parameter val sets a new value, without print the current value.
|
||||||
|
</dl>
|
||||||
|
The local maximum search can be tuned through the parameters: The
|
||||||
|
window parameter sets the size of the quadratic area for which a
|
||||||
|
candidate pixel must be the local maximum. Threshold sets a minimum
|
||||||
|
count rate for a local maximum. Steepness sets a minimum difference to
|
||||||
|
the borders of the window used for the local maximum search which must
|
||||||
|
be fulfilled.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
The center of gravity calculation can be tuned mainly through the
|
||||||
|
cogcontour parameter which determines at which percentage of the
|
||||||
|
maximum value of the peak the center of gravity calculation
|
||||||
|
stops. Cogwindow is the size of the area in which a center of gravity
|
||||||
|
is calculated. Can be set rather generously.
|
||||||
|
</p>
|
||||||
|
</BODY>
|
||||||
|
</HTML>
|
||||||
|
|
||||||
|
|
@ -7,14 +7,25 @@
|
|||||||
<p>
|
<p>
|
||||||
SICS has a built in macro facility. This macro facility is aimed at instrument managers and users alike. Instrument managers may provide customised measurement procedures in this language, users may write batch files in this language. The macro language is John Ousterhout's Tool Command Language (TCL). Tcl has control constructs, variables of its own, loop constructs, associative arrays and procedures. Tcl is well documented by several books and online tutorials, therefore no details on Tcl will be given here. All SICS commands are available in the macro language. Some potentially harmful Tcl commands have been deleted from the standard Tcl interpreter. These are: exec, source, puts, vwait, exit,gets and socket. A macro or batch file can be executed with the command:</p>
|
SICS has a built in macro facility. This macro facility is aimed at instrument managers and users alike. Instrument managers may provide customised measurement procedures in this language, users may write batch files in this language. The macro language is John Ousterhout's Tool Command Language (TCL). Tcl has control constructs, variables of its own, loop constructs, associative arrays and procedures. Tcl is well documented by several books and online tutorials, therefore no details on Tcl will be given here. All SICS commands are available in the macro language. Some potentially harmful Tcl commands have been deleted from the standard Tcl interpreter. These are: exec, source, puts, vwait, exit,gets and socket. A macro or batch file can be executed with the command:</p>
|
||||||
<p>
|
<p>
|
||||||
<b> fileeval <i>name</i> </b> tries to open the file name and executes the script in this file. </p>
|
<b> fileeval <i>name</i> </b> tries to open the file name and
|
||||||
|
executes the script in this file.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<b>batchrun <i>name</i></b> prepends to name a directory name
|
||||||
|
configured in the variable batchroot and then executes that
|
||||||
|
batchfile. The usage scenerio is that you have a directory where you
|
||||||
|
keep batch files. Then the variable batcroot is set to contain the path
|
||||||
|
to that directory. Batchrun then allows to start scripts in that
|
||||||
|
directory without specifying the full path.
|
||||||
Then there are some special commands which can be used within macro-sripts:
|
Then there are some special commands which can be used within macro-sripts:
|
||||||
<p>
|
<p>
|
||||||
<b> ClientPut sometext1 ... </b> writes everything after ClientPut to
|
<b> ClientPut sometext1 ... </b>Usally SICS suppresses any messages
|
||||||
the client which started the script. This is needed as SICS supresses
|
from SICS during the processing of batch files. This is in order not
|
||||||
the output from intermediate commands in scripts. Except error
|
to confuse users with the output of intermediate results during
|
||||||
messages and warnings. With clientput this scheme can be circumvented
|
the processing of batch files. Error messages and warnings, however,
|
||||||
and data be printed from within scripts.</p>
|
come through always. Clientput now allows to send messages to the
|
||||||
|
user on purpose from within scripts.
|
||||||
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<b> SICSType object </b> allows to query the type of the object specified by object. Possible return values are<ul>
|
<b> SICSType object </b> allows to query the type of the object specified by object. Possible return values are<ul>
|
||||||
<li> <b> DRIV </b> if the object is a SICS drivable object such as a motor
|
<li> <b> DRIV </b> if the object is a SICS drivable object such as a motor
|
||||||
|
@ -47,8 +47,83 @@ or equal to zero for the motor being movable.
|
|||||||
<li> <b> Precision </b> denotes the precision to expect from the motor in positioning. Can usually only be set by managers.
|
<li> <b> Precision </b> denotes the precision to expect from the motor in positioning. Can usually only be set by managers.
|
||||||
<li> <b> AccessCode </b> specifies the level of user privilege necessary to operate the motor. Some motors are for adjustment only and can be harmful to move once the adjustment has been done. Others must be moved for the experiment. Values are 0 - 3 for internal, manager, user and spy. This parameter can only be changed by managers.
|
<li> <b> AccessCode </b> specifies the level of user privilege necessary to operate the motor. Some motors are for adjustment only and can be harmful to move once the adjustment has been done. Others must be moved for the experiment. Values are 0 - 3 for internal, manager, user and spy. This parameter can only be changed by managers.
|
||||||
<li> <b> Sign </b> reverses the operating sense of the motor.
|
<li> <b> Sign </b> reverses the operating sense of the motor.
|
||||||
For cases where electricians and not physicists have defined the operating sense of the motor. Usually a parameter not to be changed by ordinary users.
|
For cases where electricians and not physicists have defined the
|
||||||
|
operating sense of the motor. Usually a parameter not to be changed
|
||||||
|
by ordinary users.
|
||||||
|
<li><b> failafter </b>This is the number of consecutive failures of
|
||||||
|
positioning operations this motor allows before it thinks that
|
||||||
|
something is really broken and aborts the experiment.
|
||||||
|
<li><b> maxretry </b>When a motor finishes driving, SICS checks if the
|
||||||
|
desired position was reached. If the position read back from the motor
|
||||||
|
is not within precision to the desired value, the motor is
|
||||||
|
restarted. This is done at max maxretry times. After maxretry retries,
|
||||||
|
the motor throws an error.
|
||||||
|
<li></b> ignorefault </b>If this is bigger then 0, positioning faults
|
||||||
|
from the motor will be ignored.
|
||||||
</ul>
|
</ul>
|
||||||
<p>
|
<p>
|
||||||
|
<h2>Motor Error Handling Concepts</h2>
|
||||||
|
<p>
|
||||||
|
As mechanical components motors are prone to errors. SICS knows about
|
||||||
|
two different classes of motor errors:
|
||||||
|
<dl>
|
||||||
|
<dt>HWFault
|
||||||
|
<dd>This is when there is a problem communicating with the motor, a
|
||||||
|
limit is violated etc. SICS assumes that such errors are so grave that
|
||||||
|
no fix is possible. If such a HWFault is detected a configurable
|
||||||
|
interrupt (see parameter InterruptMode) is set which can be used by
|
||||||
|
upper level code to act upon the problem.
|
||||||
|
<dt>HWPosFault
|
||||||
|
<dd>This is a positioning failure, i.e. The motor did not reach the
|
||||||
|
desired position. Such a positioning problem can come from two
|
||||||
|
sources:
|
||||||
|
<ul>
|
||||||
|
<li>The positioning problem is reported by the motor driver. SICS then
|
||||||
|
assumes that the driver has done something to solve the problem and
|
||||||
|
promotes this problem to a HWFault.
|
||||||
|
<li>The motor driver reported no error and SICS figures out by itself,
|
||||||
|
that the desired position has not been reached. SICS thinks that this
|
||||||
|
is the case if the difference between the desired position and the
|
||||||
|
position read from the motor controller is greater then the parameter
|
||||||
|
precision. If SICS detects such a problem it tries to reposition the
|
||||||
|
motor. This is done for the number of times specified through the
|
||||||
|
parameter maxretries. If the position has not been reached after
|
||||||
|
maxretries repositionings, a HWFault is assumed.
|
||||||
|
</ul>
|
||||||
|
</dl>
|
||||||
|
In any case lots of warnings and infos are printed.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
If SICS tries to drive an axis which is for some reason broken to
|
||||||
|
often hardware damage may occur (and HAS occurred!). Now, SICS has no
|
||||||
|
means to detect if the mispositioning of a motor is due to a concrete
|
||||||
|
block in the path of the instrument or any other reason. What SICS can
|
||||||
|
do though is to count how often a motor mispositions in
|
||||||
|
sequence. This means SICS counts mispositionings if it cannot drive a
|
||||||
|
motor, if the motor is driven succesfully, the count is cleared. If
|
||||||
|
the count of mispositionings becomes higher then the parameter
|
||||||
|
failafter, SICS thinks that there is something really, really wrong
|
||||||
|
and aborts the measurement and prints an error message containing the
|
||||||
|
string: MOTOR ALARM.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
There are some common pitfalls with this scheme:
|
||||||
|
<dl>
|
||||||
|
<dt>You want upper level code to be signalled when your critical motor
|
||||||
|
fails.
|
||||||
|
<dd>Solution: set the parameter interruptmode to something useful and
|
||||||
|
check for the interrupt in upper level code.
|
||||||
|
<dt>SICS falsly reports mispositionings.
|
||||||
|
<dd>Solution: increase the precision parameter.
|
||||||
|
<dt>You know that a motor is broken, you cannot fix it, but you want
|
||||||
|
to measure anyway.
|
||||||
|
<dd>Solution: increase the precision parameter, if SICS finds the
|
||||||
|
positioning problem, increase maxretries, increase the failafter
|
||||||
|
parameter. In the worst case set the ignorefault parameter to greater
|
||||||
|
0, this will prevent all motor alarms.
|
||||||
|
</dl>
|
||||||
|
</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,9 +21,6 @@ manually from the command line through the following commands:
|
|||||||
is minutes. Default is 20 minutes.
|
is minutes. Default is 20 minutes.
|
||||||
<DT>storedata intervall <i>newval</i>
|
<DT>storedata intervall <i>newval</i>
|
||||||
<DD>Sets the update intervall to newval minutes.
|
<DD>Sets the update intervall to newval minutes.
|
||||||
<DT>killfile
|
|
||||||
<DD>This command will overwrite the last data file written and thus
|
|
||||||
effectively erase it. Therefore this command requires manager privilege.
|
|
||||||
</DL>
|
</DL>
|
||||||
</P>
|
</P>
|
||||||
</BODY>
|
</BODY>
|
||||||
|
@ -225,15 +225,17 @@ can be achieved by using the drive command.
|
|||||||
and <b>log frequency</b> (both below)
|
and <b>log frequency</b> (both below)
|
||||||
</DL>
|
</DL>
|
||||||
<h3>Logging </h3>
|
<h3>Logging </h3>
|
||||||
The values of any sample environement device can be logged. There are two
|
The values of any sample environement device can be logged. There are three
|
||||||
features:
|
features:
|
||||||
<ul>
|
<ul>
|
||||||
<li>Logging to a file wih a configurable time intervall between log
|
<li>Logging to a file wih a configurable time intervall between log
|
||||||
file entries.
|
file entries.
|
||||||
<li>Sums are kept internally which allow the calculation of the mean
|
<li>Sums are kept internally which allow the calculation of the mean
|
||||||
value and the standard deviation at all times.
|
value and the standard deviation at all times.
|
||||||
|
<li>A circular buffer holding 1000 timestamps plus values is
|
||||||
|
automatically updated.
|
||||||
</ul>
|
</ul>
|
||||||
The last system is automatically switched on after the first drive or
|
The last two systems are automatically switched on after the first drive or
|
||||||
run command on the environment device completed.
|
run command on the environment device completed.
|
||||||
This system is run through the following commands.
|
This system is run through the following commands.
|
||||||
<DL>
|
<DL>
|
||||||
@ -245,7 +247,7 @@ standard deviation.
|
|||||||
values and prints them.
|
values and prints them.
|
||||||
<DT>name log frequency val
|
<DT>name log frequency val
|
||||||
<DD> With a parameter sets, without a parameter requests the logging intervall
|
<DD> With a parameter sets, without a parameter requests the logging intervall
|
||||||
for the log file.
|
for the log file and the circular buffer.
|
||||||
This parameter specifies the time intervall in seconds
|
This parameter specifies the time intervall in seconds
|
||||||
between log records. The default is 300 seconds.
|
between log records. The default is 300 seconds.
|
||||||
<DT>name log file filename
|
<DT>name log file filename
|
||||||
@ -255,12 +257,22 @@ Logging will happen any 5 minutes initially. The logging frequency
|
|||||||
of the form date time value. The name of the file must be specified relative
|
of the form date time value. The name of the file must be specified relative
|
||||||
to the SICS server.
|
to the SICS server.
|
||||||
<DT>name log flush
|
<DT>name log flush
|
||||||
<DD>DigitalUnix buffers output heavily. With this command an update of
|
<DD>Unix buffers output heavily. With this command an update of
|
||||||
the file can be enforced.
|
the file can be enforced.
|
||||||
<DT>name log status
|
<DT>name log status
|
||||||
<DD>Queries if logging to file is currently happening or not.
|
<DD>Queries if logging to file is currently happening or not.
|
||||||
<DT>name log close
|
<DT>name log close
|
||||||
<DD> Stops logging data to the file.
|
<DD> Stops logging data to the file.
|
||||||
|
<dt>name log tosicsdata dataname
|
||||||
|
<dd>copies the content of the circular buffer to a sicsdata
|
||||||
|
buffer. This is used by graphical clients to display the content of
|
||||||
|
the circular buffer.
|
||||||
|
<dt>name log dump
|
||||||
|
<dd>Prints the content of the circular log buffer to screen.
|
||||||
|
<dt>name log dumptofile filename
|
||||||
|
<dd>Prints the content of the circular log buffer into the file
|
||||||
|
specified as filename. Note, this file is on the computer where the
|
||||||
|
SICS server resides.
|
||||||
</DL>
|
</DL>
|
||||||
</P>
|
</P>
|
||||||
|
|
||||||
@ -509,7 +521,7 @@ At SANS there is a Eurotherm temperature controller for the sample heater.
|
|||||||
with the following command. The eurotherm needs to be connected with a
|
with the following command. The eurotherm needs to be connected with a
|
||||||
nullmodem adapter.
|
nullmodem adapter.
|
||||||
<BLOCKQUOTE>
|
<BLOCKQUOTE>
|
||||||
evfactory new name euro Mac-PC Mac-port Mac-channel
|
evfactory new name euro computer port channel
|
||||||
</BLOCKQUOTE>
|
</BLOCKQUOTE>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
@ -663,19 +675,19 @@ device. The LTC-11 behaves like a normal SICS environment control device
|
|||||||
plus a few additional commands. An LTC-11 can be configured into SICS with
|
plus a few additional commands. An LTC-11 can be configured into SICS with
|
||||||
the following command:
|
the following command:
|
||||||
<BLOCKQUOTE>
|
<BLOCKQUOTE>
|
||||||
evfactory new name ltc11 Mac-PC Mac-port Mac-channel
|
evfactory new name ltc11 computer port channel
|
||||||
</BLOCKQUOTE>
|
</BLOCKQUOTE>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
name is a placeholder for the name of the device within SICS. A good
|
name is a placeholder for the name of the device within SICS. A good
|
||||||
suggestion is temperature.
|
suggestion is temperature.
|
||||||
ltc11 is the keyword for selecting the LTC-11 driver. Mac-PC is the name of
|
ltc11 is the keyword for selecting the LTC-11 driver. Computer is the name of
|
||||||
the Macintosh PC to which the controller has been connected, Mac-Port is the
|
the computer running David Maden's SerPortServer program, port is the
|
||||||
port number at which the Macintosh-PC's serial port server listens.
|
port number at which the SerPortServer program listens.
|
||||||
Mac-channel is the RS-232 channel to which the controller has been
|
Channel is the RS-232 channel to which the controller has been
|
||||||
connected. For example (at DMC):
|
connected. For example (at DMC):
|
||||||
<pre>
|
<pre>
|
||||||
evfactory new temperature ltc11 lnsp18.psi.ch 4000 6
|
evfactory new temperature ltc11 localhost 4000 6
|
||||||
</pre>
|
</pre>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
@ -24,19 +24,20 @@ these SICS client programs. SICS Clients and the SICServer communicate
|
|||||||
with each other through the TCP/IP network.
|
with each other through the TCP/IP network.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Currently these SICS clients are available:
|
Currently the following SICS clients are available:
|
||||||
<uL>
|
<uL>
|
||||||
<li> A command line control client for sending commands to the SICS
|
<li> A command line control client for sending commands to the SICS
|
||||||
server and displaying its repsonses.
|
server and displaying its repsonses.
|
||||||
<li> A status display for the powder diffractometers DMC and HRPT.
|
<li> A status display for the powder diffractometers DMC and HRPT.
|
||||||
<li> A status display for TOPSI.
|
<li> A status display for TOPSI.
|
||||||
<li> A status display for SANS.
|
<li> A status display for SANS and SANS2.
|
||||||
<li> A status display for FOCUS.
|
<li> A status display for FOCUS.
|
||||||
<li> A AMOR control and status program.
|
<li> A AMOR control and status program.
|
||||||
<li> A triple axis control and status program.
|
<li> A triple axis control and status program.
|
||||||
<li> A SICS variable watcher. This application graphically logs the
|
<li> A SICS variable watcher. This application graphically logs the
|
||||||
change of a SICS variable over time. Useful for monitoring for
|
change of a SICS variable over time. Useful for monitoring for
|
||||||
instance temperature controllers.
|
instance temperature controllers.
|
||||||
|
<li>A graphical client for TRICS.
|
||||||
</ul>
|
</ul>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
@ -71,12 +72,26 @@ following commands at the command prompt:
|
|||||||
<DD> for the triple axis status display and control application.
|
<DD> for the triple axis status display and control application.
|
||||||
<DT>varwatch &
|
<DT>varwatch &
|
||||||
<DD> for the variable watcher.
|
<DD> for the variable watcher.
|
||||||
|
<dt>trics-&
|
||||||
|
<dd>for the starting the TRICS graphical client.
|
||||||
</dl>
|
</dl>
|
||||||
On a PC you may find icons for starting the different programs on the
|
On a PC you may find icons for starting the different programs on the
|
||||||
desktop.
|
desktop.
|
||||||
Each of these clients has usage instructions online which can be displayed
|
Each of these clients has usage instructions online which can be displayed
|
||||||
through the help/about menu entry.
|
through the help/about menu entry.
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
Another option to start SICS clients is the Java Webstart mechanism
|
||||||
|
which is available for most platforms. Java webstart requires both
|
||||||
|
Java and Java webstart to be installed on the computer running the
|
||||||
|
client. Then clients can be started directly from a WWW-page. The
|
||||||
|
advantage is that clients are automatically updated in this system as
|
||||||
|
soon as new version have been copied to the WWW-site. Installation
|
||||||
|
instructions for Java webstart and links to start all SICS clients
|
||||||
|
though this mechanism can be found at:
|
||||||
|
<a href="http://lns00.psi.ch/sics/wstart"> the SICS webstart</a>
|
||||||
|
page. This service is only accessible within the PSI network.
|
||||||
|
</p>
|
||||||
<h2>Connecting</h2>
|
<h2>Connecting</h2>
|
||||||
<p>
|
<p>
|
||||||
After startup any SICS client is not connected to a SICS server and thus not
|
After startup any SICS client is not connected to a SICS server and thus not
|
||||||
@ -101,11 +116,11 @@ the SICS server log in as the instrument user at the instrument computer and
|
|||||||
invoke the appropriate command to start the server. These are:
|
invoke the appropriate command to start the server. These are:
|
||||||
<dl>
|
<dl>
|
||||||
<DT>DMC
|
<DT>DMC
|
||||||
<DD>Computer = lnsa05,User = DMC
|
<DD>Computer = lnsa05, User = DMC
|
||||||
<DT>TOPSI
|
<DT>TOPSI
|
||||||
<DD>Computer = lnsa07,User = TOPSI
|
<DD>Computer = topsi, User = TOPSI
|
||||||
<DT>SANS
|
<DT>SANS
|
||||||
<DD>Computer = lnsa10,User = SANS
|
<DD>Computer = sans, User = SANS
|
||||||
<DT>TRICS
|
<DT>TRICS
|
||||||
<DD>Computer = lnsa18, User = TRICS
|
<DD>Computer = lnsa18, User = TRICS
|
||||||
<DT>HRPT
|
<DT>HRPT
|
||||||
@ -115,7 +130,7 @@ invoke the appropriate command to start the server. These are:
|
|||||||
<DT>AMOR
|
<DT>AMOR
|
||||||
<DD>Computer = lnsa14, User = AMOR
|
<DD>Computer = lnsa14, User = AMOR
|
||||||
<DT>TASP
|
<DT>TASP
|
||||||
<DD>Computer = lnsa12, User = TASP
|
<DD>Computer = tasp, User = TASP
|
||||||
<DT>POLDI
|
<DT>POLDI
|
||||||
<DD>Computer = poldi, User = POLDI
|
<DD>Computer = poldi, User = POLDI
|
||||||
</dl>
|
</dl>
|
||||||
|
@ -11,7 +11,27 @@
|
|||||||
<p>
|
<p>
|
||||||
<b> resetserver </b> resets the server after an interrupt.</p>
|
<b> resetserver </b> resets the server after an interrupt.</p>
|
||||||
<p>
|
<p>
|
||||||
<b> dir </b> a single word command which lists all objects available in the SICS system in its current configuration.</p>
|
<b> dir </b> a command which lists objects available in the SICS
|
||||||
|
system. Dir without any options prints a list of all objects. The
|
||||||
|
list can be restricted with:
|
||||||
|
<dl>
|
||||||
|
<dt>dir var
|
||||||
|
<dd>prints all SICS primitive variables
|
||||||
|
<dt>dir mot
|
||||||
|
<dd>prints a list of all motors
|
||||||
|
<dt>dir inter driv
|
||||||
|
<dd> prints a list of all drivable objects. This is more then motors
|
||||||
|
and includes virtual motors such as environment devices and wavelength
|
||||||
|
as well.
|
||||||
|
<dt>dir inter count
|
||||||
|
<dd>Shows everything which can be counted upon.
|
||||||
|
<dt>dir inter env
|
||||||
|
<dd>Shows all currently configured environment devices.
|
||||||
|
<dt>dir match wildcard
|
||||||
|
<dd>lists all objects which match the wildcard string given in
|
||||||
|
wildcard.
|
||||||
|
</dl>
|
||||||
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<b> status </b> A single word command which makes SICS print its current
|
<b> status </b> A single word command which makes SICS print its current
|
||||||
status. Possible return values can be:
|
status. Possible return values can be:
|
||||||
@ -45,5 +65,12 @@ above and restores SICS to the state it was in when the status was saved with
|
|||||||
backup. If no file argument is given the system default file gets
|
backup. If no file argument is given the system default file gets
|
||||||
read.
|
read.
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
<b>killfile</b> decrements the data number used for SICS file writing
|
||||||
|
and thus consequently overwrites the last datafile. This is useful
|
||||||
|
when useless data files have been created during tests. As this is
|
||||||
|
critical command in normal user operations, this command requires
|
||||||
|
managers privilege.
|
||||||
|
</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -72,9 +72,9 @@
|
|||||||
e.g. ALF1-ALF4 (carry out command given on variables between ALF1 and
|
e.g. ALF1-ALF4 (carry out command given on variables between ALF1 and
|
||||||
ALF4 in storage order; see section V)
|
ALF4 in storage order; see section V)
|
||||||
e.g. DM,ALF1-ALF4,SS,DA (a combination of the above) Variables separated
|
e.g. DM,ALF1-ALF4,SS,DA (a combination of the above) Variables separated
|
||||||
by commas need not be typed in their order of storage in THE Program.
|
by commas need not be typed in their order of storage in the program.
|
||||||
|
|
||||||
Note : that for this type of syntax (type a) the only acceptable
|
Note : that for this type of syntax (type A) the only acceptable
|
||||||
variable separators are ' ' (i.e. a space), ',' and '-' (' ' and ','
|
variable separators are ' ' (i.e. a space), ',' and '-' (' ' and ','
|
||||||
are equivalent).
|
are equivalent).
|
||||||
|
|
||||||
@ -87,9 +87,9 @@
|
|||||||
variables in storage [QK, QL] take the values 0 and 2 )
|
variables in storage [QK, QL] take the values 0 and 2 )
|
||||||
e.g. QH=1,0,2.0,AS=3.24,CC=90 (a combination of the above)
|
e.g. QH=1,0,2.0,AS=3.24,CC=90 (a combination of the above)
|
||||||
|
|
||||||
In commands involving this construction type (B) THE Program echoes
|
In commands involving this construction type (B) the program echoes
|
||||||
the variable names and values it has understood.
|
the variable names and values it has understood.
|
||||||
Possible separators are ',' and ' ' ('space')
|
Possible separators are ',' and ' ' ('space')
|
||||||
|
|
||||||
There is a third type of commands which requires no parameters. These
|
There is a third type of commands which requires no parameters. These
|
||||||
commands are:-
|
commands are:-
|
||||||
@ -159,7 +159,7 @@
|
|||||||
<pre>
|
<pre>
|
||||||
|
|
||||||
CO(UNT) : Counts for a given preset TIme or MoNitor.
|
CO(UNT) : Counts for a given preset TIme or MoNitor.
|
||||||
This is a command of type b syntax. If the command is issued alone,
|
This is a command of type B syntax. If the command is issued alone,
|
||||||
the preset used will be that most recently set. However, the preset
|
the preset used will be that most recently set. However, the preset
|
||||||
may also be specified on the same line as the COUNT command.
|
may also be specified on the same line as the COUNT command.
|
||||||
(For use of COnt in a P.A. file, see SCan and PA).
|
(For use of COnt in a P.A. file, see SCan and PA).
|
||||||
@ -223,11 +223,11 @@
|
|||||||
new position and the appropriate variable is altered in the memory.
|
new position and the appropriate variable is altered in the memory.
|
||||||
|
|
||||||
A DRIVE command will fail (non destructively) if:
|
A DRIVE command will fail (non destructively) if:
|
||||||
l a motor or power supply is protected or fixed
|
- a motor or power supply is protected or fixed
|
||||||
l a software or hard limit is exceeded; the soft limits may be changed
|
- a software or hard limit is exceeded; the soft limits may be changed
|
||||||
if necessary using the SET command provided the value desired is
|
if necessary using the SET command provided the value desired is
|
||||||
within the allowed range.
|
within the allowed range.
|
||||||
l there is ambiguity among the driven variables.
|
- there is ambiguity among the driven variables.
|
||||||
e.g. DR KI=2.662,A2=40<CR>
|
e.g. DR KI=2.662,A2=40<CR>
|
||||||
sets two different targets for A2 and fails.
|
sets two different targets for A2 and fails.
|
||||||
|
|
||||||
@ -332,7 +332,7 @@
|
|||||||
(within a certain tolerance) to the positions.
|
(within a certain tolerance) to the positions.
|
||||||
Clear exceptions are for a power supply which has
|
Clear exceptions are for a power supply which has
|
||||||
been turned disabled, the abort of a DRive via
|
been turned disabled, the abort of a DRive via
|
||||||
^C^C and, for instance, the incident wavevector
|
Interrupt and, for instance, the incident wavevector
|
||||||
after a drive of A1 or A2.
|
after a drive of A1 or A2.
|
||||||
</pre>
|
</pre>
|
||||||
<h3><a name="LOG">LOG</a></h3>
|
<h3><a name="LOG">LOG</a></h3>
|
||||||
@ -379,7 +379,7 @@
|
|||||||
non-zero.(This is because it no longer behaves as a flipper.)
|
non-zero.(This is because it no longer behaves as a flipper.)
|
||||||
|
|
||||||
Note that the ON and OFF commands are the only ones which can be used
|
Note that the ON and OFF commands are the only ones which can be used
|
||||||
to change F1 and F2. Both ON and OFF are of type Asyntax.
|
to change F1 and F2. Both ON and OFF are of type A syntax.
|
||||||
|
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
@ -398,8 +398,9 @@
|
|||||||
be printed for every point in every scan until disabled.
|
be printed for every point in every scan until disabled.
|
||||||
Typing OU with NO following variables will stop the output of ALL
|
Typing OU with NO following variables will stop the output of ALL
|
||||||
variables apart from scanned ones.
|
variables apart from scanned ones.
|
||||||
Type A syntax. A variable that has to be output because it is scanned a
|
Type A syntax. A variable that has to be output because it is scanned
|
||||||
nd has also been selected with the OUT command will only be output once.
|
and has also been selected with the OUT command will only be output
|
||||||
|
once.
|
||||||
|
|
||||||
e.g. OU A3,A4<CR>
|
e.g. OU A3,A4<CR>
|
||||||
A3 & A4 will be printed in addition to the scan variables.
|
A3 & A4 will be printed in addition to the scan variables.
|
||||||
@ -546,23 +547,9 @@
|
|||||||
|
|
||||||
2) data files :
|
2) data files :
|
||||||
|
|
||||||
All of this data is also output to a disk file. This file is called
|
|
||||||
either TEMP##.SCN or SV####.SCN where # represents a digit between 0
|
|
||||||
and 9. Both types of data files are used sequentially and thus
|
|
||||||
periodically overwritten but obviously the TEMP##.SCN files disappear
|
|
||||||
sooner.
|
|
||||||
|
|
||||||
A scan initiated from the terminal will be stored in a TEMP file
|
|
||||||
(unless the appropriate SWITCH is on ) while scans input from .JOB files
|
|
||||||
are always saved permanently. The TEMP files are lost ( but see SAVE).
|
|
||||||
For more details on data files see section VI below.
|
|
||||||
|
|
||||||
All SV####.SCN files are copied to the mainframe computer automatically
|
All tas####.dat files are copied to the mainframe computer
|
||||||
and transfered to the SPECTRA database for Backup and archiving. They
|
automatically.
|
||||||
can be accessed by the SPECTRA program or by the 3-axis programs (PKFIT
|
|
||||||
or FILING).
|
|
||||||
Programs for manipulating data files are described in another manual
|
|
||||||
(PKFIT, FILING, LOOK, LIST, LHEAD etc.)
|
|
||||||
|
|
||||||
3) Scan output :
|
3) Scan output :
|
||||||
|
|
||||||
@ -602,7 +589,7 @@
|
|||||||
|
|
||||||
As with the DRIVE command, scans in Q-E space are carried out at fixed
|
As with the DRIVE command, scans in Q-E space are carried out at fixed
|
||||||
KI (FX=1) or fixed KF (FX=2). During a scan with Kf fixed (i.e.FX=2)
|
KI (FX=1) or fixed KF (FX=2). During a scan with Kf fixed (i.e.FX=2)
|
||||||
THE Program will automatically check and adjust A5 and A6; for Ki
|
the program will automatically check and adjust A5 and A6; for Ki
|
||||||
fixed (FX=1) however, MAD Program will not adjust at check and adjust
|
fixed (FX=1) however, MAD Program will not adjust at check and adjust
|
||||||
at every point A1 and A2 because these variables are not likely to
|
at every point A1 and A2 because these variables are not likely to
|
||||||
move in a Ki-fix scan.
|
move in a Ki-fix scan.
|
||||||
@ -680,9 +667,9 @@
|
|||||||
described below. In response to the command <em>SW</em>, MAD
|
described below. In response to the command <em>SW</em>, MAD
|
||||||
generates output of the following form:
|
generates output of the following form:
|
||||||
|
|
||||||
1 Powder Mode OFF
|
1 Powder Mode OFF
|
||||||
2 Polarization mode OFF
|
2 Polarization mode OFF
|
||||||
Give Switch Number to change or RETURN to finish >
|
Give Switch Number to change or RETURN to finish >
|
||||||
|
|
||||||
To change a value of one switch, enter the appropriate number
|
To change a value of one switch, enter the appropriate number
|
||||||
(from 1 to 2) and hit <Return>. To make no change, type
|
(from 1 to 2) and hit <Return>. To make no change, type
|
||||||
@ -847,7 +834,7 @@ however, corresponds to a transmission minimum for Ki neutrons.
|
|||||||
by SET.
|
by SET.
|
||||||
|
|
||||||
The following list gives the variable identifiers and definitions,
|
The following list gives the variable identifiers and definitions,
|
||||||
where the order is as the variables are stored in THE Program.
|
where the order is as the variables are stored in the program.
|
||||||
|
|
||||||
|
|
||||||
P.A Variables : Variables marked with an asterisk are not recognized
|
P.A Variables : Variables marked with an asterisk are not recognized
|
||||||
|
@ -345,6 +345,7 @@ H H L
|
|||||||
%html histogram.htm 2
|
%html histogram.htm 2
|
||||||
%html nextrics.htm 2
|
%html nextrics.htm 2
|
||||||
%html peaksearch.htm 2
|
%html peaksearch.htm 2
|
||||||
|
%html lowmax.htm 2
|
||||||
%html trscan.htm 2
|
%html trscan.htm 2
|
||||||
|
|
||||||
%html psddata.htm 1
|
%html psddata.htm 1
|
||||||
|
@ -11,6 +11,7 @@ TRICS with a PSD requires the following special features.
|
|||||||
histogram memory</a>.
|
histogram memory</a>.
|
||||||
<li><a href="nextrics.htm">NeXus</a> data handling for TRICS.
|
<li><a href="nextrics.htm">NeXus</a> data handling for TRICS.
|
||||||
<li>A <a href="peaksearch.htm">peak search</a> command.
|
<li>A <a href="peaksearch.htm">peak search</a> command.
|
||||||
|
<li>A <a href="lowmax.htm">local maximum search</a> command.
|
||||||
<li>A TRICS specific <a href="trscan.htm">count and scan</a> command.
|
<li>A TRICS specific <a href="trscan.htm">count and scan</a> command.
|
||||||
</ul>
|
</ul>
|
||||||
</p>
|
</p>
|
||||||
|
@ -41,7 +41,11 @@ This means the log file has been started at August, 8, 2001 at 00:01:01.
|
|||||||
There is a new log file daily. Load appropriate files into the editor and
|
There is a new log file daily. Load appropriate files into the editor and
|
||||||
look what really happened.
|
look what really happened.
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
Another good ideas is to use the unix command grep on assorted log
|
||||||
|
files. A grep for the strings ERROR or WARNING will more ofteh then
|
||||||
|
not give an indication for the nature of the problem.
|
||||||
|
</p>
|
||||||
<p>
|
<p>
|
||||||
The log files show you all commands given and all the responses of the system.
|
The log files show you all commands given and all the responses of the system.
|
||||||
Additionally there are hourly time stamps in the file which allow to narrow
|
Additionally there are hourly time stamps in the file which allow to narrow
|
||||||
@ -63,12 +67,8 @@ The log files show you all commands given and all the responses of the system.
|
|||||||
<dt>EL737__BAD_BSY
|
<dt>EL737__BAD_BSY
|
||||||
<dd>A counting operation was aborted while the beam was off. Unfortunately,
|
<dd>A counting operation was aborted while the beam was off. Unfortunately,
|
||||||
the counter box does not respond to commands in this state and ignores the
|
the counter box does not respond to commands in this state and ignores the
|
||||||
stop command sent to it during the abort operation. This can be resolved by
|
stop command sent to it during the abort operation. This can be
|
||||||
the command:
|
safely ignored, SICS fixes this condition.
|
||||||
<pre>
|
|
||||||
counter stop
|
|
||||||
</pre>
|
|
||||||
when the beam is on again.
|
|
||||||
</dl>
|
</dl>
|
||||||
</p>
|
</p>
|
||||||
<h2>Starting SICS</h2>
|
<h2>Starting SICS</h2>
|
||||||
|
104
doc/user/userrefman
Normal file
104
doc/user/userrefman
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
\documentclass[12pt,a4paper]{report}
|
||||||
|
%%\usepackage[dvips]{graphics}
|
||||||
|
%%\usepackage{epsf}
|
||||||
|
\setlength{\textheight}{24cm}
|
||||||
|
\setlength{\textwidth}{16cm}
|
||||||
|
\setlength{\headheight}{0cm}
|
||||||
|
\setlength{\headsep}{0cm}
|
||||||
|
\setlength{\topmargin}{0cm}
|
||||||
|
\setlength{\oddsidemargin}{0cm}
|
||||||
|
\setlength{\evensidemargin}{0cm}
|
||||||
|
\setlength{\hoffset}{0cm}
|
||||||
|
\setlength{\marginparwidth}{0cm}
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
%html -d hr " "
|
||||||
|
%html -s report
|
||||||
|
\begin{center}
|
||||||
|
\begin{huge}
|
||||||
|
SICS Master User Manual\\
|
||||||
|
\end{huge}
|
||||||
|
\today\\
|
||||||
|
Dr. Mark K\"onnecke \\
|
||||||
|
Labor f\"ur Neutronenstreuung\\
|
||||||
|
Paul Scherrer Institut\\
|
||||||
|
CH--5232 Villigen--PSI\\
|
||||||
|
Switzerland\\
|
||||||
|
\end{center}
|
||||||
|
\clearpage
|
||||||
|
\clearpage
|
||||||
|
\tableofcontents
|
||||||
|
\clearpage
|
||||||
|
|
||||||
|
\chapter{Introduction}
|
||||||
|
This is the master user manual for SICS. It gives an overview over all
|
||||||
|
command implemented, independent of a specific instrument. This is to
|
||||||
|
be used as the source for more instrument specific user manuals and
|
||||||
|
gives an overview of the commands available within SICS. Please note,
|
||||||
|
that many instruments have special commands realized as scripts in the
|
||||||
|
SICS built in scripting language. Only the most common of such
|
||||||
|
commands are listed here.
|
||||||
|
|
||||||
|
\chapter{System Commands and Concepts}
|
||||||
|
%html sicsinvoc.htm 2
|
||||||
|
%html basic.htm 2
|
||||||
|
%html logging.htm 2
|
||||||
|
%html logbook.htm 3
|
||||||
|
%html commandlog.htm 3
|
||||||
|
%html batch.htm 2
|
||||||
|
%html macro.htm 3
|
||||||
|
%html buffer.htm 3
|
||||||
|
%html token.htm 2
|
||||||
|
%html system.htm 2
|
||||||
|
%html config.htm 2
|
||||||
|
%html madsim.htm 2
|
||||||
|
%html trouble.htm 2
|
||||||
|
|
||||||
|
|
||||||
|
\chapter{Hardware Related Commands}
|
||||||
|
%html drive.htm 1
|
||||||
|
%html motor.htm 2
|
||||||
|
%html chopper.htm 2
|
||||||
|
%html counter.htm 2
|
||||||
|
%html count.htm 2
|
||||||
|
%html histogram.htm 2
|
||||||
|
%html samenv.htm 2
|
||||||
|
%html ctrl.htm 2
|
||||||
|
%html velocity.htm 2
|
||||||
|
%html velolambda.htm 2
|
||||||
|
|
||||||
|
\chapter{Common User Commands}
|
||||||
|
%html topscan.htm 2
|
||||||
|
%html hkl.htm 2
|
||||||
|
%html optimise.htm 2
|
||||||
|
%html xytable.htm 2
|
||||||
|
%html lowmax.htm 2
|
||||||
|
|
||||||
|
\chapter{PSI Specific Commands}
|
||||||
|
\section{Commands specific to the TOF--diffractometer FOCUS}
|
||||||
|
%html focussps.htm 3
|
||||||
|
%html fowrite.htm 3
|
||||||
|
|
||||||
|
\section{Reflectometer AMOR specific Commands}
|
||||||
|
%html amor2t.htm 3
|
||||||
|
%html amorstore.htm 3
|
||||||
|
%html amortof.htm 3
|
||||||
|
|
||||||
|
\section{TRICS Specific Commands}
|
||||||
|
%html hklscan.htm 3
|
||||||
|
%html trscan.htm 3
|
||||||
|
%html mesure.htm 3
|
||||||
|
%html nextrics.htm 3
|
||||||
|
%html peaksearch.htm 3
|
||||||
|
|
||||||
|
\section{Fourier Diffractometer POLDI Specific Commands}
|
||||||
|
%html poldiscan.htm 2
|
||||||
|
%html poldiwrite.htm 3
|
||||||
|
|
||||||
|
\section{Triple Axis Spectrometer Specific Commands}
|
||||||
|
%html tasmad.html 3
|
||||||
|
%html tasvariables.html 3
|
||||||
|
%html tascommands.html 3
|
||||||
|
|
||||||
|
|
||||||
|
\end{document}
|
267
evcontroller.c
267
evcontroller.c
@ -6,6 +6,14 @@
|
|||||||
|
|
||||||
Mark Koennecke, Juli 1997
|
Mark Koennecke, Juli 1997
|
||||||
|
|
||||||
|
Implemented calling site specific initialisation routines.
|
||||||
|
Mark Koennecke, July 2003
|
||||||
|
|
||||||
|
Implemented scripted out of tolerance handling and retrieval of
|
||||||
|
driver name.
|
||||||
|
Mark Koennecke, December 2003
|
||||||
|
|
||||||
|
|
||||||
Copyright:
|
Copyright:
|
||||||
|
|
||||||
Labor fuer Neutronenstreuung
|
Labor fuer Neutronenstreuung
|
||||||
@ -331,35 +339,45 @@
|
|||||||
|
|
||||||
return iRes;
|
return iRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------- Error Handlers --------------------------------*/
|
/*---------------------------- Error Handlers --------------------------------*/
|
||||||
static int ErrLazy(void *pData)
|
static void ErrWrite(char *txt)
|
||||||
{
|
{
|
||||||
pEVControl self = NULL;
|
|
||||||
pExeList pExe;
|
pExeList pExe;
|
||||||
SConnection *pCon = NULL;
|
SConnection *pCon = NULL;
|
||||||
|
|
||||||
|
pExe = GetExecutor();
|
||||||
|
pCon = GetExeOwner(pExe);
|
||||||
|
|
||||||
|
if(pCon)
|
||||||
|
{
|
||||||
|
SCWrite(pCon,txt,eWarning);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ServerWriteGlobal(txt,eWarning);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------------------*/
|
||||||
|
static void ErrReport(pEVControl self)
|
||||||
|
{
|
||||||
float fPos, fDelta;
|
float fPos, fDelta;
|
||||||
char pBueffel[256];
|
char pBueffel[256];
|
||||||
|
|
||||||
|
self->pDriv->GetValues(self->pDriv,&self->fTarget,&fPos,&fDelta);
|
||||||
|
sprintf(pBueffel,"WARNING: %s is out of range by %g",self->pName,fDelta);
|
||||||
|
ErrWrite(pBueffel);
|
||||||
|
self->iWarned = 1;
|
||||||
|
}
|
||||||
|
/*-------------------------------------------------------------------------*/
|
||||||
|
static int ErrLazy(void *pData)
|
||||||
|
{
|
||||||
|
pEVControl self = NULL;
|
||||||
|
|
||||||
self = (pEVControl)pData;
|
self = (pEVControl)pData;
|
||||||
assert(self);
|
assert(self);
|
||||||
|
|
||||||
|
ErrReport(self);
|
||||||
self->pDriv->GetValues(self->pDriv,&self->fTarget,&fPos,&fDelta);
|
|
||||||
sprintf(pBueffel,"WARNING: %s is out of range by %g",self->pName,fDelta);
|
|
||||||
pExe = GetExecutor();
|
|
||||||
pCon = GetExeOwner(pExe);
|
|
||||||
if(!self->iWarned)
|
|
||||||
{
|
|
||||||
if(pCon)
|
|
||||||
{
|
|
||||||
SCWrite(pCon,pBueffel,eWarning);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ServerWriteGlobal(pBueffel,eWarning);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self->iWarned = 1;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
@ -367,33 +385,14 @@
|
|||||||
{
|
{
|
||||||
pEVControl self = NULL;
|
pEVControl self = NULL;
|
||||||
pExeList pExe;
|
pExeList pExe;
|
||||||
SConnection *pCon = NULL;
|
|
||||||
float fPos, fDelta;
|
|
||||||
char pBueffel[256];
|
|
||||||
int iRet;
|
int iRet;
|
||||||
|
|
||||||
self = (pEVControl)pData;
|
self = (pEVControl)pData;
|
||||||
assert(self);
|
assert(self);
|
||||||
|
|
||||||
self->pDriv->GetValues(self->pDriv,&self->fTarget,&fPos,&fDelta);
|
ErrReport(self);
|
||||||
sprintf(pBueffel,"WARNING: %s is out of range by %g",self->pName,fDelta);
|
|
||||||
pExe = GetExecutor();
|
pExe = GetExecutor();
|
||||||
pCon = GetExeOwner(pExe);
|
|
||||||
|
|
||||||
if(!self->iWarned)
|
|
||||||
{
|
|
||||||
if(pCon)
|
|
||||||
{
|
|
||||||
SCWrite(pCon,pBueffel,eWarning);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ServerWriteGlobal(pBueffel,eWarning);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self->iWarned = 1;
|
|
||||||
|
|
||||||
|
|
||||||
if(IsCounting(pExe))
|
if(IsCounting(pExe))
|
||||||
{
|
{
|
||||||
SCWrite(GetExeOwner(pExe),"Pausing till OK",eError);
|
SCWrite(GetExeOwner(pExe),"Pausing till OK",eError);
|
||||||
@ -412,38 +411,59 @@
|
|||||||
ContinueExecution(pExe);
|
ContinueExecution(pExe);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
static int ErrScript(void *pData)
|
||||||
|
{
|
||||||
|
pEVControl self = NULL;
|
||||||
|
int iRet;
|
||||||
|
Tcl_Interp *pTcl = NULL;
|
||||||
|
pExeList pExe;
|
||||||
|
char pBueffel[256];
|
||||||
|
|
||||||
|
self = (pEVControl)pData;
|
||||||
|
assert(self);
|
||||||
|
|
||||||
|
ErrReport(self);
|
||||||
|
|
||||||
|
pExe = GetExecutor();
|
||||||
|
if(self->errorScript != NULL)
|
||||||
|
{
|
||||||
|
pTcl = InterpGetTcl(pServ->pSics);
|
||||||
|
iRet = Tcl_Eval(pTcl,self->errorScript);
|
||||||
|
if(iRet != TCL_OK)
|
||||||
|
{
|
||||||
|
snprintf(pBueffel,255,
|
||||||
|
"ERROR: %s while processing errorscript for %s",
|
||||||
|
pTcl->result,self->pName);
|
||||||
|
ErrWrite(pBueffel);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
assume that everything is fine again after the script
|
||||||
|
returns
|
||||||
|
*/
|
||||||
|
self->eMode = EVMonitor;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
snprintf(pBueffel,255,
|
||||||
|
"ERROR: script error handling requested for %s, but no script given",
|
||||||
|
self->pName);
|
||||||
|
ErrWrite(pBueffel);
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int ErrInterrupt(void *pData)
|
static int ErrInterrupt(void *pData)
|
||||||
{
|
{
|
||||||
pEVControl self = NULL;
|
pEVControl self = NULL;
|
||||||
pExeList pExe;
|
|
||||||
SConnection *pCon = NULL;
|
|
||||||
float fPos,fDelta;
|
|
||||||
char pBueffel[256];
|
|
||||||
int iRet;
|
|
||||||
|
|
||||||
self = (pEVControl)pData;
|
self = (pEVControl)pData;
|
||||||
assert(self);
|
assert(self);
|
||||||
|
|
||||||
/* report problem */
|
ErrReport(self);
|
||||||
self->pDriv->GetValues(self->pDriv,&self->fTarget,&fPos,&fDelta);
|
|
||||||
sprintf(pBueffel,"WARNING: %s is out of range by %g",self->pName,fDelta);
|
|
||||||
pExe = GetExecutor();
|
|
||||||
pCon = GetExeOwner(pExe);
|
|
||||||
if(!self->iWarned)
|
|
||||||
{
|
|
||||||
if(pCon)
|
|
||||||
{
|
|
||||||
SCWrite(pCon,pBueffel,eWarning);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ServerWriteGlobal(pBueffel,eWarning);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self->iWarned = 1;
|
|
||||||
|
|
||||||
/* interrupt */
|
/* interrupt */
|
||||||
SetInterrupt((int)ObVal(self->pParam,INTERRUPT));
|
SetInterrupt((int)ObVal(self->pParam,INTERRUPT));
|
||||||
@ -453,31 +473,13 @@
|
|||||||
static int ErrRun(void *pData)
|
static int ErrRun(void *pData)
|
||||||
{
|
{
|
||||||
pEVControl self = NULL;
|
pEVControl self = NULL;
|
||||||
pExeList pExe;
|
|
||||||
SConnection *pCon = NULL;
|
|
||||||
float fPos, fDelta;
|
|
||||||
char pBueffel[256];
|
|
||||||
int iRet;
|
|
||||||
|
|
||||||
self = (pEVControl)pData;
|
self = (pEVControl)pData;
|
||||||
assert(self);
|
assert(self);
|
||||||
|
|
||||||
/* report problem */
|
ErrReport(self);
|
||||||
self->pDriv->GetValues(self->pDriv,&self->fTarget,&fPos,&fDelta);
|
|
||||||
sprintf(pBueffel,"WARNING: %s is out of range by %g",self->pName,fDelta);
|
ErrWrite("Running to safe value");
|
||||||
pExe = GetExecutor();
|
|
||||||
pCon = GetExeOwner(pExe);
|
|
||||||
if(pCon)
|
|
||||||
{
|
|
||||||
SCWrite(pCon,pBueffel,eWarning);
|
|
||||||
SCWrite(pCon,"Driving to a safe place",eWarning);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ServerWriteGlobal(pBueffel,eWarning);
|
|
||||||
ServerWriteGlobal("Driving to a safe place",eWarning);
|
|
||||||
}
|
|
||||||
|
|
||||||
self->pDriv->SetValue(self->pDriv, ObVal(self->pParam,SAFEVALUE));
|
self->pDriv->SetValue(self->pDriv, ObVal(self->pParam,SAFEVALUE));
|
||||||
self->eMode = EVIdle;
|
self->eMode = EVIdle;
|
||||||
return 1;
|
return 1;
|
||||||
@ -511,6 +513,10 @@
|
|||||||
iStatus = ErrRun(pData);
|
iStatus = ErrRun(pData);
|
||||||
return iStatus;
|
return iStatus;
|
||||||
break;
|
break;
|
||||||
|
case 4: /* invoke a script */
|
||||||
|
iStatus = ErrScript(pData);
|
||||||
|
return iStatus;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -807,6 +813,14 @@
|
|||||||
{
|
{
|
||||||
VarlogDelete(self->pLog);
|
VarlogDelete(self->pLog);
|
||||||
}
|
}
|
||||||
|
if(self->driverName != NULL)
|
||||||
|
{
|
||||||
|
free(self->driverName);
|
||||||
|
}
|
||||||
|
if(self->errorScript != NULL)
|
||||||
|
{
|
||||||
|
free(self->errorScript);
|
||||||
|
}
|
||||||
free(self);
|
free(self);
|
||||||
}
|
}
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
@ -935,43 +949,55 @@
|
|||||||
assert(self);
|
assert(self);
|
||||||
assert(pCon);
|
assert(pCon);
|
||||||
|
|
||||||
sprintf(pBueffel,"Parameter listing for %s",self->pName);
|
snprintf(pBueffel,255,"Parameter listing for %s",self->pName);
|
||||||
SCWrite(pCon,pBueffel,eValue);
|
SCWrite(pCon,pBueffel,eValue);
|
||||||
|
|
||||||
sprintf(pBueffel,"%s.%s = %g ",self->pName, "tolerance",
|
snprintf(pBueffel,255,"%s.%s = %g ",self->pName, "tolerance",
|
||||||
ObVal(self->pParam,TOLERANCE));
|
ObVal(self->pParam,TOLERANCE));
|
||||||
SCWrite(pCon,pBueffel, eValue);
|
SCWrite(pCon,pBueffel, eValue);
|
||||||
sprintf(pBueffel,"%s.%s = %g",self->pName, "access",
|
snprintf(pBueffel,255,"%s.%s = %g",self->pName, "access",
|
||||||
ObVal(self->pParam,ACCESS));
|
ObVal(self->pParam,ACCESS));
|
||||||
SCWrite(pCon,pBueffel, eValue);
|
SCWrite(pCon,pBueffel, eValue);
|
||||||
sprintf(pBueffel,"%s.%s = %g",self->pName, "ErrorHandler",
|
snprintf(pBueffel,255,"%s.%s = %g",self->pName, "ErrorHandler",
|
||||||
ObVal(self->pParam,ERRORHANDLER));
|
ObVal(self->pParam,ERRORHANDLER));
|
||||||
SCWrite(pCon,pBueffel, eValue);
|
SCWrite(pCon,pBueffel, eValue);
|
||||||
sprintf(pBueffel,"%s.%s = %g",self->pName, "interrupt",
|
snprintf(pBueffel,255,"%s.%s = %g",self->pName, "interrupt",
|
||||||
ObVal(self->pParam,INTERRUPT));
|
ObVal(self->pParam,INTERRUPT));
|
||||||
SCWrite(pCon,pBueffel, eValue);
|
SCWrite(pCon,pBueffel, eValue);
|
||||||
sprintf(pBueffel,"%s.%s = %g",self->pName, "UpperLimit",
|
snprintf(pBueffel,255,"%s.%s = %g",self->pName, "UpperLimit",
|
||||||
ObVal(self->pParam,UPLIMIT));
|
ObVal(self->pParam,UPLIMIT));
|
||||||
SCWrite(pCon,pBueffel, eValue);
|
SCWrite(pCon,pBueffel, eValue);
|
||||||
sprintf(pBueffel,"%s.%s = %g",self->pName, "LowerLimit",
|
snprintf(pBueffel,255,"%s.%s = %g",self->pName, "LowerLimit",
|
||||||
ObVal(self->pParam,LOWLIMIT));
|
ObVal(self->pParam,LOWLIMIT));
|
||||||
SCWrite(pCon,pBueffel, eValue);
|
SCWrite(pCon,pBueffel, eValue);
|
||||||
sprintf(pBueffel,"%s.%s = %g",self->pName, "SafeValue",
|
snprintf(pBueffel,255,"%s.%s = %g",self->pName, "SafeValue",
|
||||||
ObVal(self->pParam,SAFEVALUE));
|
ObVal(self->pParam,SAFEVALUE));
|
||||||
SCWrite(pCon,pBueffel, eValue);
|
SCWrite(pCon,pBueffel, eValue);
|
||||||
sprintf(pBueffel,"%s.%s = %g",self->pName, "MaxWait",
|
snprintf(pBueffel,255,"%s.%s = %g",self->pName, "MaxWait",
|
||||||
ObVal(self->pParam,MAXWAIT));
|
ObVal(self->pParam,MAXWAIT));
|
||||||
SCWrite(pCon,pBueffel, eValue);
|
SCWrite(pCon,pBueffel, eValue);
|
||||||
sprintf(pBueffel,"%s.%s = %g",self->pName, "Settle",
|
snprintf(pBueffel,255,"%s.%s = %g",self->pName, "Settle",
|
||||||
ObVal(self->pParam,SETTLE));
|
ObVal(self->pParam,SETTLE));
|
||||||
SCWrite(pCon,pBueffel, eValue);
|
SCWrite(pCon,pBueffel, eValue);
|
||||||
EVCGetPos(self,pCon,&fPos);
|
EVCGetPos(self,pCon,&fPos);
|
||||||
sprintf(pBueffel,"%s.%s = %g",self->pName, "CurrentValue",
|
snprintf(pBueffel,255,"%s.%s = %g",self->pName, "CurrentValue",
|
||||||
fPos);
|
fPos);
|
||||||
SCWrite(pCon,pBueffel, eValue);
|
SCWrite(pCon,pBueffel, eValue);
|
||||||
sprintf(pBueffel,"%s.%s = %g",self->pName, "TargetValue",
|
snprintf(pBueffel,255,"%s.%s = %g",self->pName, "TargetValue",
|
||||||
self->fTarget);
|
self->fTarget);
|
||||||
SCWrite(pCon,pBueffel, eValue);
|
SCWrite(pCon,pBueffel, eValue);
|
||||||
|
snprintf(pBueffel,255,"%s.driver = %s",self->pName, self->driverName);
|
||||||
|
SCWrite(pCon,pBueffel, eValue);
|
||||||
|
if(self->errorScript != NULL)
|
||||||
|
{
|
||||||
|
snprintf(pBueffel,255,"%s.errorScript = %s", self->pName,
|
||||||
|
self->errorScript);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
snprintf(pBueffel,255,"%s.errorScript = UNDEFINED", self->pName);
|
||||||
|
}
|
||||||
|
SCWrite(pCon,pBueffel, eValue);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1109,6 +1135,35 @@
|
|||||||
}
|
}
|
||||||
else /* parameter request */
|
else /* parameter request */
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
catch case of errorScript
|
||||||
|
*/
|
||||||
|
strtolower(argv[1]);
|
||||||
|
if(strcmp(argv[1],"errorscript") == 0)
|
||||||
|
{
|
||||||
|
if(self->errorScript != NULL)
|
||||||
|
{
|
||||||
|
snprintf(pBueffel,255,"%s.errorScript = %s",self->pName,
|
||||||
|
self->errorScript);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
snprintf(pBueffel,255,"%s.errorScript = UNDEFINED",
|
||||||
|
self->pName);
|
||||||
|
}
|
||||||
|
SCWrite(pCon,pBueffel,eValue);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
catch case for drivername
|
||||||
|
*/
|
||||||
|
if(strcmp(argv[1],"driver") == 0)
|
||||||
|
{
|
||||||
|
snprintf(pBueffel,255,"%s.driver = %s", self->pName,
|
||||||
|
self->driverName);
|
||||||
|
SCWrite(pCon,pBueffel,eValue);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
iRet = EVCGetPar(self,argv[1],&fPos);
|
iRet = EVCGetPar(self,argv[1],&fPos);
|
||||||
if(!iRet)
|
if(!iRet)
|
||||||
{
|
{
|
||||||
@ -1127,6 +1182,21 @@
|
|||||||
}
|
}
|
||||||
else /* try to set parameter */
|
else /* try to set parameter */
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
first catch case of errorScript
|
||||||
|
*/
|
||||||
|
strtolower(argv[1]);
|
||||||
|
if(strcmp(argv[1],"errorscript") == 0)
|
||||||
|
{
|
||||||
|
Arg2Text(argc-2,&argv[2],pBueffel,255);
|
||||||
|
if(self->errorScript != NULL)
|
||||||
|
{
|
||||||
|
free(self->errorScript);
|
||||||
|
}
|
||||||
|
self->errorScript = strdup(pBueffel);
|
||||||
|
SCSendOK(pCon);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
iRet = Tcl_GetDouble(pSics->pTcl,argv[2],&dVal);
|
iRet = Tcl_GetDouble(pSics->pTcl,argv[2],&dVal);
|
||||||
if(iRet != TCL_OK)
|
if(iRet != TCL_OK)
|
||||||
{
|
{
|
||||||
@ -1346,7 +1416,8 @@ static pEVControl InstallCommonControllers(SicsInterp *pSics,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EVRegisterController(FindEMON(pSics),argv[2],pNew, pCon);
|
EVRegisterController(FindEMON(pSics),argv[2],pNew, pCon);
|
||||||
|
pNew->driverName = strdup(argv[3]);
|
||||||
SCSendOK(pCon);
|
SCSendOK(pCon);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
#line 211 "evcontroller.w"
|
#line 222 "evcontroller.w"
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------
|
||||||
E N V I R O N M E N T C O N T R O L L E R
|
E N V I R O N M E N T C O N T R O L L E R
|
||||||
@ -14,7 +14,7 @@
|
|||||||
#define SICSEVCONTROL
|
#define SICSEVCONTROL
|
||||||
#include "varlog.h"
|
#include "varlog.h"
|
||||||
|
|
||||||
#line 133 "evcontroller.w"
|
#line 144 "evcontroller.w"
|
||||||
|
|
||||||
/*--------------------------- live & death --------------------------------*/
|
/*--------------------------- live & death --------------------------------*/
|
||||||
typedef struct __EVControl *pEVControl;
|
typedef struct __EVControl *pEVControl;
|
||||||
@ -44,6 +44,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#line 224 "evcontroller.w"
|
#line 235 "evcontroller.w"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
#line 228 "evcontroller.w"
|
#line 239 "evcontroller.w"
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
Environment controller datastructure
|
Environment controller datastructure
|
||||||
@ -18,6 +18,7 @@
|
|||||||
#define MAXWAIT 7
|
#define MAXWAIT 7
|
||||||
#define SETTLE 8
|
#define SETTLE 8
|
||||||
|
|
||||||
|
|
||||||
#line 29 "evcontroller.w"
|
#line 29 "evcontroller.w"
|
||||||
|
|
||||||
typedef struct __EVControl {
|
typedef struct __EVControl {
|
||||||
@ -29,9 +30,11 @@
|
|||||||
pEVDriver pDriv;
|
pEVDriver pDriv;
|
||||||
EVMode eMode;
|
EVMode eMode;
|
||||||
float fTarget;
|
float fTarget;
|
||||||
time_t start;
|
time_t start;
|
||||||
time_t lastt;
|
time_t lastt;
|
||||||
char *pName;
|
char *pName;
|
||||||
|
char *driverName;
|
||||||
|
char *errorScript;
|
||||||
ObPar *pParam;
|
ObPar *pParam;
|
||||||
int iLog;
|
int iLog;
|
||||||
pVarLog pLog;
|
pVarLog pLog;
|
||||||
@ -42,5 +45,5 @@
|
|||||||
void (*KillPrivate)(void *pData);
|
void (*KillPrivate)(void *pData);
|
||||||
} EVControl;
|
} EVControl;
|
||||||
|
|
||||||
#line 244 "evcontroller.w"
|
#line 257 "evcontroller.w"
|
||||||
|
|
||||||
|
@ -41,7 +41,11 @@ $\langle$evdata {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ pEVDriver pDriv;@\\
|
\mbox{}\verb@ pEVDriver pDriv;@\\
|
||||||
\mbox{}\verb@ EVMode eMode;@\\
|
\mbox{}\verb@ EVMode eMode;@\\
|
||||||
\mbox{}\verb@ float fTarget;@\\
|
\mbox{}\verb@ float fTarget;@\\
|
||||||
|
\mbox{}\verb@ time_t start;@\\
|
||||||
|
\mbox{}\verb@ time_t lastt;@\\
|
||||||
\mbox{}\verb@ char *pName;@\\
|
\mbox{}\verb@ char *pName;@\\
|
||||||
|
\mbox{}\verb@ char *driverName;@\\
|
||||||
|
\mbox{}\verb@ char *errorScript;@\\
|
||||||
\mbox{}\verb@ ObPar *pParam;@\\
|
\mbox{}\verb@ ObPar *pParam;@\\
|
||||||
\mbox{}\verb@ int iLog;@\\
|
\mbox{}\verb@ int iLog;@\\
|
||||||
\mbox{}\verb@ pVarLog pLog;@\\
|
\mbox{}\verb@ pVarLog pLog;@\\
|
||||||
@ -69,8 +73,13 @@ reached its target value. Then there is a pointer to a callback
|
|||||||
interface. The fifth field is a pointer to the driver for
|
interface. The fifth field is a pointer to the driver for
|
||||||
the actual hardware. Next is the mode the device is in. Of course there
|
the actual hardware. Next is the mode the device is in. Of course there
|
||||||
must be floating point value which defines the current target value for the
|
must be floating point value which defines the current target value for the
|
||||||
device. pName is a pointer to a string representing the name of the
|
device. start and lastt are used to control the settling time.
|
||||||
controller. Then there is a
|
|
||||||
|
pName is a pointer to a string representing the name of the
|
||||||
|
controller. driverName is the name of the driver used by this
|
||||||
|
device. errorScript is the name of a script command to run when the
|
||||||
|
controller goes out of tolerance.
|
||||||
|
Then there is a
|
||||||
parameter array. iLog is a boolean which says if data should be logged
|
parameter array. iLog is a boolean which says if data should be logged
|
||||||
for this controller or not. pLog is the a pointer to a Varlog structure
|
for this controller or not. pLog is the a pointer to a Varlog structure
|
||||||
holding the logging information. Then there is a switch, iWarned, which is
|
holding the logging information. Then there is a switch, iWarned, which is
|
||||||
@ -94,6 +103,8 @@ $\langle$evdriv {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ typedef struct __EVDriver {@\\
|
\mbox{}\verb@ typedef struct __EVDriver {@\\
|
||||||
\mbox{}\verb@ int (*SetValue)(pEVDriver self, float fNew);@\\
|
\mbox{}\verb@ int (*SetValue)(pEVDriver self, float fNew);@\\
|
||||||
\mbox{}\verb@ int (*GetValue)(pEVDriver self, float *fPos);@\\
|
\mbox{}\verb@ int (*GetValue)(pEVDriver self, float *fPos);@\\
|
||||||
|
\mbox{}\verb@ int (*GetValues)(pEVDriver self, float *fTarget,@\\
|
||||||
|
\mbox{}\verb@ float *fPos, float *fDelta);@\\
|
||||||
\mbox{}\verb@ int (*Send)(pEVDriver self, char *pCommand,@\\
|
\mbox{}\verb@ int (*Send)(pEVDriver self, char *pCommand,@\\
|
||||||
\mbox{}\verb@ char *pReplyBuffer, int iReplBufLen); @\\
|
\mbox{}\verb@ char *pReplyBuffer, int iReplBufLen); @\\
|
||||||
\mbox{}\verb@ int (*GetError)(pEVDriver self, int *iCode,@\\
|
\mbox{}\verb@ int (*GetError)(pEVDriver self, int *iCode,@\\
|
||||||
@ -290,6 +301,8 @@ See the documentation for commands understood.
|
|||||||
\mbox{}\verb@#define UPLIMIT 4@\\
|
\mbox{}\verb@#define UPLIMIT 4@\\
|
||||||
\mbox{}\verb@#define LOWLIMIT 5@\\
|
\mbox{}\verb@#define LOWLIMIT 5@\\
|
||||||
\mbox{}\verb@#define SAFEVALUE 6@\\
|
\mbox{}\verb@#define SAFEVALUE 6@\\
|
||||||
|
\mbox{}\verb@#define MAXWAIT 7@\\
|
||||||
|
\mbox{}\verb@#define SETTLE 8@\\
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
\mbox{}\verb@@$\langle$evdata {\footnotesize ?}$\rangle$\verb@@\\
|
\mbox{}\verb@@$\langle$evdata {\footnotesize ?}$\rangle$\verb@@\\
|
||||||
\mbox{}\verb@@$\diamond$
|
\mbox{}\verb@@$\diamond$
|
||||||
|
@ -36,7 +36,11 @@ used by EVControl:
|
|||||||
pEVDriver pDriv;
|
pEVDriver pDriv;
|
||||||
EVMode eMode;
|
EVMode eMode;
|
||||||
float fTarget;
|
float fTarget;
|
||||||
|
time_t start;
|
||||||
|
time_t lastt;
|
||||||
char *pName;
|
char *pName;
|
||||||
|
char *driverName;
|
||||||
|
char *errorScript;
|
||||||
ObPar *pParam;
|
ObPar *pParam;
|
||||||
int iLog;
|
int iLog;
|
||||||
pVarLog pLog;
|
pVarLog pLog;
|
||||||
@ -57,8 +61,13 @@ reached its target value. Then there is a pointer to a callback
|
|||||||
interface. The fifth field is a pointer to the driver for
|
interface. The fifth field is a pointer to the driver for
|
||||||
the actual hardware. Next is the mode the device is in. Of course there
|
the actual hardware. Next is the mode the device is in. Of course there
|
||||||
must be floating point value which defines the current target value for the
|
must be floating point value which defines the current target value for the
|
||||||
device. pName is a pointer to a string representing the name of the
|
device. start and lastt are used to control the settling time.
|
||||||
controller. Then there is a
|
|
||||||
|
pName is a pointer to a string representing the name of the
|
||||||
|
controller. driverName is the name of the driver used by this
|
||||||
|
device. errorScript is the name of a script command to run when the
|
||||||
|
controller goes out of tolerance.
|
||||||
|
Then there is a
|
||||||
parameter array. iLog is a boolean which says if data should be logged
|
parameter array. iLog is a boolean which says if data should be logged
|
||||||
for this controller or not. pLog is the a pointer to a Varlog structure
|
for this controller or not. pLog is the a pointer to a Varlog structure
|
||||||
holding the logging information. Then there is a switch, iWarned, which is
|
holding the logging information. Then there is a switch, iWarned, which is
|
||||||
@ -77,6 +86,8 @@ used:
|
|||||||
typedef struct __EVDriver {
|
typedef struct __EVDriver {
|
||||||
int (*SetValue)(pEVDriver self, float fNew);
|
int (*SetValue)(pEVDriver self, float fNew);
|
||||||
int (*GetValue)(pEVDriver self, float *fPos);
|
int (*GetValue)(pEVDriver self, float *fPos);
|
||||||
|
int (*GetValues)(pEVDriver self, float *fTarget,
|
||||||
|
float *fPos, float *fDelta);
|
||||||
int (*Send)(pEVDriver self, char *pCommand,
|
int (*Send)(pEVDriver self, char *pCommand,
|
||||||
char *pReplyBuffer, int iReplBufLen);
|
char *pReplyBuffer, int iReplBufLen);
|
||||||
int (*GetError)(pEVDriver self, int *iCode,
|
int (*GetError)(pEVDriver self, int *iCode,
|
||||||
@ -240,6 +251,8 @@ See the documentation for commands understood.
|
|||||||
#define UPLIMIT 4
|
#define UPLIMIT 4
|
||||||
#define LOWLIMIT 5
|
#define LOWLIMIT 5
|
||||||
#define SAFEVALUE 6
|
#define SAFEVALUE 6
|
||||||
|
#define MAXWAIT 7
|
||||||
|
#define SETTLE 8
|
||||||
|
|
||||||
@<evdata@>
|
@<evdata@>
|
||||||
@}
|
@}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
#line 247 "evcontroller.w"
|
#line 260 "evcontroller.w"
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
Environment device driver datastructure
|
Environment device driver datastructure
|
||||||
@ -12,13 +12,13 @@
|
|||||||
#define DEVREDO 2
|
#define DEVREDO 2
|
||||||
|
|
||||||
|
|
||||||
#line 76 "evcontroller.w"
|
#line 85 "evcontroller.w"
|
||||||
|
|
||||||
typedef struct __EVDriver {
|
typedef struct __EVDriver {
|
||||||
int (*SetValue)(pEVDriver self, float fNew);
|
int (*SetValue)(pEVDriver self, float fNew);
|
||||||
int (*GetValue)(pEVDriver self, float *fPos);
|
int (*GetValue)(pEVDriver self, float *fPos);
|
||||||
int (*GetValues)(pEVDriver self, float *fTarget,
|
int (*GetValues)(pEVDriver self, float *fTarget,
|
||||||
float *fPos, float *fDelta);
|
float *fPos, float *fDelta);
|
||||||
int (*Send)(pEVDriver self, char *pCommand,
|
int (*Send)(pEVDriver self, char *pCommand,
|
||||||
char *pReplyBuffer, int iReplBufLen);
|
char *pReplyBuffer, int iReplBufLen);
|
||||||
int (*GetError)(pEVDriver self, int *iCode,
|
int (*GetError)(pEVDriver self, int *iCode,
|
||||||
@ -30,7 +30,7 @@
|
|||||||
void (*KillPrivate)(void *pData);
|
void (*KillPrivate)(void *pData);
|
||||||
} EVDriver;
|
} EVDriver;
|
||||||
|
|
||||||
#line 258 "evcontroller.w"
|
#line 271 "evcontroller.w"
|
||||||
|
|
||||||
/*-------------------- life & death of a driver --------------------------*/
|
/*-------------------- life & death of a driver --------------------------*/
|
||||||
pEVDriver CreateEVDriver(int argc, char *argv[]);
|
pEVDriver CreateEVDriver(int argc, char *argv[]);
|
||||||
|
1
event.h
1
event.h
@ -37,7 +37,6 @@
|
|||||||
#define COUNTSTART 10
|
#define COUNTSTART 10
|
||||||
#define COUNTEND 11
|
#define COUNTEND 11
|
||||||
#define FILELOADED 12
|
#define FILELOADED 12
|
||||||
#define MOTEND 13
|
|
||||||
|
|
||||||
#line 92 "event.w"
|
#line 92 "event.w"
|
||||||
|
|
||||||
|
152
help.c
Normal file
152
help.c
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
/*-----------------------------------------------------------------------
|
||||||
|
Implementation file for the SICS help system.
|
||||||
|
|
||||||
|
copyright: see file COPYRIGHT
|
||||||
|
|
||||||
|
Mark Koennecke, December 2003
|
||||||
|
-----------------------------------------------------------------------*/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include "fortify.h"
|
||||||
|
#include "sics.h"
|
||||||
|
#include "help.h"
|
||||||
|
|
||||||
|
extern char *stptok(const char *s, char *tok, size_t toklen, char *brk);
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------*/
|
||||||
|
#define PATHSEP ":"
|
||||||
|
#define DIRSEP "/"
|
||||||
|
static char *helpDirs = NULL;
|
||||||
|
static char *defaultFile="master.txt";
|
||||||
|
/*----------------------------------------------------------------------*/
|
||||||
|
void KillHelp(void *pData){
|
||||||
|
if(helpDirs != NULL){
|
||||||
|
free(helpDirs);
|
||||||
|
helpDirs = NULL;
|
||||||
|
}
|
||||||
|
if(defaultFile != NULL){
|
||||||
|
free(defaultFile);
|
||||||
|
defaultFile = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------------------*/
|
||||||
|
static FILE *findHelpFile(char *name){
|
||||||
|
FILE *fd = NULL;
|
||||||
|
char pBueffel[256];
|
||||||
|
char dir[132];
|
||||||
|
char *pPtr;
|
||||||
|
|
||||||
|
if(helpDirs == NULL){
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
pPtr = helpDirs;
|
||||||
|
while( (pPtr = stptok(pPtr,dir,131,PATHSEP)) != NULL){
|
||||||
|
strcpy(pBueffel,dir);
|
||||||
|
strcat(pBueffel,DIRSEP);
|
||||||
|
strncat(pBueffel,name,(254-strlen(pBueffel)));
|
||||||
|
fd = fopen(pBueffel,"r");
|
||||||
|
if(fd != NULL){
|
||||||
|
return fd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
this means: not found!
|
||||||
|
*/
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------*/
|
||||||
|
static void printHelpFile(SConnection *pCon, FILE *fd){
|
||||||
|
char line[132];
|
||||||
|
|
||||||
|
while(fgets(line,131,fd) != NULL){
|
||||||
|
SCWrite(pCon,line,eValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------*/
|
||||||
|
static void configureHelp(SConnection *pCon,
|
||||||
|
char *option, char *parameter){
|
||||||
|
char *pPtr = NULL;
|
||||||
|
int length;
|
||||||
|
|
||||||
|
strtolower(option);
|
||||||
|
if(strcmp(option,"adddir") == 0){
|
||||||
|
if(parameter == NULL){
|
||||||
|
SCWrite(pCon,helpDirs,eValue);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
pPtr = helpDirs;
|
||||||
|
if(pPtr != NULL){
|
||||||
|
length = strlen(pPtr) + strlen(PATHSEP) + strlen(parameter) + 2;
|
||||||
|
helpDirs = (char *)malloc(length*sizeof(char));
|
||||||
|
memset(helpDirs,0,length*sizeof(char));
|
||||||
|
strcpy(helpDirs,pPtr);
|
||||||
|
strcat(helpDirs,PATHSEP);
|
||||||
|
strcat(helpDirs,parameter);
|
||||||
|
free(pPtr);
|
||||||
|
} else {
|
||||||
|
helpDirs=strdup(parameter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if(strcmp(option,"defaultfile") == 0){
|
||||||
|
if(parameter == NULL){
|
||||||
|
SCWrite(pCon,defaultFile,eValue);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
if(defaultFile != NULL){
|
||||||
|
free(defaultFile);
|
||||||
|
}
|
||||||
|
defaultFile = strdup(parameter);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
SCWrite(pCon,"Unknown option to configure",eWarning);
|
||||||
|
SCWrite(pCon,"Known options: defaultfile, adddir",eWarning);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------------------*/
|
||||||
|
int SicsHelp(SConnection *pCon,SicsInterp *pSics, void *pData,
|
||||||
|
int argc, char *argv[]){
|
||||||
|
char helpFile[256];
|
||||||
|
FILE *fd = NULL;
|
||||||
|
|
||||||
|
strncpy(helpFile,defaultFile,255);
|
||||||
|
|
||||||
|
if(argc > 1){
|
||||||
|
strtolower(argv[1]);
|
||||||
|
/*
|
||||||
|
check for configure
|
||||||
|
*/
|
||||||
|
if(strcmp(argv[1],"configure") == 0){
|
||||||
|
if(argc < 3){
|
||||||
|
SCWrite(pCon,"ERROR: need an option to configure",eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if(argc > 3){
|
||||||
|
configureHelp(pCon,argv[2],argv[3]);
|
||||||
|
} else {
|
||||||
|
configureHelp(pCon,argv[2],NULL);
|
||||||
|
}
|
||||||
|
SCSendOK(pCon);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
the parameter is a help file name
|
||||||
|
*/
|
||||||
|
strncpy(helpFile,argv[1],255);
|
||||||
|
strncat(helpFile,".txt",255);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
print the helpFile
|
||||||
|
*/
|
||||||
|
fd = findHelpFile(helpFile);
|
||||||
|
if(fd == NULL){
|
||||||
|
SCWrite(pCon,"ERROR: failed to locate helpFile:",eError);
|
||||||
|
SCWrite(pCon,helpFile,eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
printHelpFile(pCon,fd);
|
||||||
|
fclose(fd);
|
||||||
|
}
|
17
help.h
Normal file
17
help.h
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
/*-----------------------------------------------------------------------
|
||||||
|
Header file for the SICS help system.
|
||||||
|
|
||||||
|
copyright: see file COPYRIGHT
|
||||||
|
|
||||||
|
Mark Koennecke, December 2003
|
||||||
|
-----------------------------------------------------------------------*/
|
||||||
|
#ifndef SICSHELP
|
||||||
|
#define SICSHELP
|
||||||
|
|
||||||
|
int SicsHelp(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
|
int argc, char *argv[]);
|
||||||
|
|
||||||
|
void KillHelp(void *pData);
|
||||||
|
#endif
|
||||||
|
|
37
help.w
Normal file
37
help.w
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
\subsection{The SICS Help System}
|
||||||
|
SICS has a very simple help system. It is based on plain text files
|
||||||
|
containing the help texts. There is a default help file which is
|
||||||
|
printed when help is called without arguments. Other help files are
|
||||||
|
printed by the command: help name. The name of the text file is then
|
||||||
|
name.txt. This file is earched in a configurable small set of
|
||||||
|
directories. This allows to separate general SICS help files and
|
||||||
|
instrument specific help files.
|
||||||
|
|
||||||
|
This system is implemented as a module defined in help.c. The
|
||||||
|
interface is simply the interpreter function implementing the help
|
||||||
|
command. There is also a function for removing the data associated
|
||||||
|
with help.
|
||||||
|
|
||||||
|
@o help.h @{
|
||||||
|
/*-----------------------------------------------------------------------
|
||||||
|
Header file for the SICS help system.
|
||||||
|
|
||||||
|
copyright: see file COPYRIGHT
|
||||||
|
|
||||||
|
Mark Koennecke, December 2003
|
||||||
|
-----------------------------------------------------------------------*/
|
||||||
|
#ifndef SICSHELP
|
||||||
|
#define SICSHELP
|
||||||
|
|
||||||
|
int SicsHelp(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
|
int argc, char *argv[]);
|
||||||
|
|
||||||
|
void KillHelp(void *pData);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -911,7 +911,6 @@ void HistDirty(pHistMem self)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*----------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------*/
|
||||||
/*-----------------------------------------------------------------------*/
|
|
||||||
static int HMCountInterest(int iEvent, void *pEvent, void *pUser)
|
static int HMCountInterest(int iEvent, void *pEvent, void *pUser)
|
||||||
{
|
{
|
||||||
SConnection *pCon = NULL;
|
SConnection *pCon = NULL;
|
||||||
|
44
hkl.c
44
hkl.c
@ -18,6 +18,10 @@
|
|||||||
three detectors.
|
three detectors.
|
||||||
|
|
||||||
Mark Koennecke, May 2002
|
Mark Koennecke, May 2002
|
||||||
|
|
||||||
|
Added handling of the chi ==0 or chi == 180 degree case to tryTweakOmega
|
||||||
|
|
||||||
|
Mark Koennecke, December 2003
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -35,6 +39,11 @@
|
|||||||
the space we leave in omega in order to allow for a scan to be done
|
the space we leave in omega in order to allow for a scan to be done
|
||||||
*/
|
*/
|
||||||
#define SCANBORDER 3.
|
#define SCANBORDER 3.
|
||||||
|
/*
|
||||||
|
the tolerance in chi we give before we allow to fix omega with phi
|
||||||
|
*/
|
||||||
|
#define CHITOLERANCE 3.
|
||||||
|
#define ABS(x) (x < 0 ? -(x) : (x))
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
static int HKLSave(void *pData, char *name, FILE *fd)
|
static int HKLSave(void *pData, char *name, FILE *fd)
|
||||||
{
|
{
|
||||||
@ -466,9 +475,22 @@ static int checkNormalBeam(double om, double *gamma, double nu,
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
static int chiVertical(double chi){
|
||||||
|
if(ABS(chi - .0) < CHITOLERANCE){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if(ABS(chi - 180.0) < CHITOLERANCE){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
/*-----------------------------------------------------------------------
|
/*-----------------------------------------------------------------------
|
||||||
tryOmegaTweak tries to calculate a psi angle in order to put an
|
tryOmegaTweak tries to calculate a psi angle in order to put an
|
||||||
offending omega back into range.
|
offending omega back into range.
|
||||||
|
|
||||||
|
This routine also handles the special case when chi ~ 0 or chi ~ 180.
|
||||||
|
Then it is possible to fix a omega problem by turing in phi.
|
||||||
-----------------------------------------------------------------------*/
|
-----------------------------------------------------------------------*/
|
||||||
static int tryOmegaTweak(pHKL self, MATRIX z1, double *stt, double *om,
|
static int tryOmegaTweak(pHKL self, MATRIX z1, double *stt, double *om,
|
||||||
double *chi, double *phi){
|
double *chi, double *phi){
|
||||||
@ -506,6 +528,22 @@ static int tryOmegaTweak(pHKL self, MATRIX z1, double *stt, double *om,
|
|||||||
omOffset = *om - omTarget;
|
omOffset = *om - omTarget;
|
||||||
omOffset = -omOffset;
|
omOffset = -omOffset;
|
||||||
|
|
||||||
|
/*
|
||||||
|
check for the special case of chi == 0 or chi == 180
|
||||||
|
*/
|
||||||
|
if(chiVertical(*chi)){
|
||||||
|
dumstt = *stt;
|
||||||
|
offom = omTarget;
|
||||||
|
offchi = *chi;
|
||||||
|
offphi = *phi - omOffset;
|
||||||
|
if(checkBisecting(self,&dumstt,offom,offchi,offphi)){
|
||||||
|
*om = offom;
|
||||||
|
*chi = offchi;
|
||||||
|
*phi = offphi;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
calculate angles with omega offset
|
calculate angles with omega offset
|
||||||
*/
|
*/
|
||||||
@ -622,8 +660,6 @@ static int calculateBisecting(MATRIX z1, pHKL self, SConnection *pCon,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*----------------------------------------------------------------------*/
|
|
||||||
#define ABS(x) (x < 0 ? -(x) : (x))
|
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
static int calculateNormalBeam(MATRIX z1, pHKL self, SConnection *pCon,
|
static int calculateNormalBeam(MATRIX z1, pHKL self, SConnection *pCon,
|
||||||
float fSet[4], double myPsi, int iRetry)
|
float fSet[4], double myPsi, int iRetry)
|
||||||
@ -1508,14 +1544,14 @@ ente:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(pBueffel," theta = %f, omega = %f, chi = %f, phi = %f",
|
sprintf(pBueffel," 2-theta = %f, omega = %f, chi = %f, phi = %f",
|
||||||
fSet[0], fSet[1], fSet[2],fSet[3]);
|
fSet[0], fSet[1], fSet[2],fSet[3]);
|
||||||
SCWrite(pCon,pBueffel,eValue);
|
SCWrite(pCon,pBueffel,eValue);
|
||||||
}
|
}
|
||||||
if(!iRet)
|
if(!iRet)
|
||||||
{
|
{
|
||||||
SCWrite(pCon,
|
SCWrite(pCon,
|
||||||
"WARNING: Settings violate motor limits or cannot be calculated",
|
"WARNING: Cannot drive to the hkl of your desire",
|
||||||
eWarning);
|
eWarning);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,6 @@ the maximum number of slaves
|
|||||||
int nSlaves;
|
int nSlaves;
|
||||||
float fPreset;
|
float fPreset;
|
||||||
CounterMode eMode;
|
CounterMode eMode;
|
||||||
pICallBack pCall;
|
|
||||||
} HMcontrol, *pHMcontrol;
|
} HMcontrol, *pHMcontrol;
|
||||||
|
|
||||||
|
|
||||||
|
4
make_gen
4
make_gen
@ -19,10 +19,10 @@ SOBJ = network.o ifile.o conman.o SCinter.o splitter.o passwd.o \
|
|||||||
histmem.o histdriv.o histsim.o interface.o callback.o \
|
histmem.o histdriv.o histsim.o interface.o callback.o \
|
||||||
event.o emon.o evcontroller.o evdriver.o simev.o perfmon.o \
|
event.o emon.o evcontroller.o evdriver.o simev.o perfmon.o \
|
||||||
danu.o nxdict.o varlog.o stptok.o nread.o \
|
danu.o nxdict.o varlog.o stptok.o nread.o \
|
||||||
scan.o fitcenter.o telnet.o token.o \
|
scan.o fitcenter.o telnet.o token.o wwildcard.o\
|
||||||
tclev.o hkl.o integrate.o optimise.o dynstring.o nxutil.o \
|
tclev.o hkl.o integrate.o optimise.o dynstring.o nxutil.o \
|
||||||
mesure.o uubuffer.o commandlog.o udpquieck.o \
|
mesure.o uubuffer.o commandlog.o udpquieck.o \
|
||||||
rmtrail.o \
|
rmtrail.o help.o nxupdate.o\
|
||||||
simchop.o choco.o chadapter.o trim.o scaldate.o \
|
simchop.o choco.o chadapter.o trim.o scaldate.o \
|
||||||
hklscan.o xytable.o \
|
hklscan.o xytable.o \
|
||||||
circular.o maximize.o sicscron.o \
|
circular.o maximize.o sicscron.o \
|
||||||
|
49
napi5.c
49
napi5.c
@ -121,7 +121,7 @@ NXstatus CALLING_STYLE NX5closegroup (NXhandle fid);
|
|||||||
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;
|
||||||
int rdcc_nelmts;
|
unsigned long rdcc_nelmts;
|
||||||
size_t rdcc_nbytes;
|
size_t rdcc_nbytes;
|
||||||
double rdcc_w0;
|
double rdcc_w0;
|
||||||
|
|
||||||
@ -343,7 +343,26 @@ NXstatus CALLING_STYLE NX5closegroup (NXhandle fid);
|
|||||||
pFile=NXI5assert(*fid);
|
pFile=NXI5assert(*fid);
|
||||||
|
|
||||||
iRet=0;
|
iRet=0;
|
||||||
|
/*
|
||||||
|
printf("HDF5 object count before close: %d\n",
|
||||||
|
H5Fget_obj_count(pFile->iFID,H5F_OBJ_ALL));
|
||||||
|
*/
|
||||||
iRet = H5Fclose(pFile->iFID);
|
iRet = H5Fclose(pFile->iFID);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Please leave this here, it helps debugging HDF5 resource leakages
|
||||||
|
printf("HDF5 object count after close: %d\n",
|
||||||
|
H5Fget_obj_count(H5F_OBJ_ALL,H5F_OBJ_ALL));
|
||||||
|
printf("HDF5 dataset count after close: %d\n",
|
||||||
|
H5Fget_obj_count(H5F_OBJ_ALL,H5F_OBJ_DATASET));
|
||||||
|
printf("HDF5 group count after close: %d\n",
|
||||||
|
H5Fget_obj_count(H5F_OBJ_ALL,H5F_OBJ_GROUP));
|
||||||
|
printf("HDF5 datatype count after close: %d\n",
|
||||||
|
H5Fget_obj_count(H5F_OBJ_ALL,H5F_OBJ_DATATYPE));
|
||||||
|
printf("HDF5 attribute count after close: %d\n",
|
||||||
|
H5Fget_obj_count(H5F_OBJ_ALL,H5F_OBJ_ATTR));
|
||||||
|
*/
|
||||||
|
|
||||||
if (iRet < 0) {
|
if (iRet < 0) {
|
||||||
NXIReportError (NXpData, "ERROR: HDF cannot close HDF file");
|
NXIReportError (NXpData, "ERROR: HDF cannot close HDF file");
|
||||||
}
|
}
|
||||||
@ -368,16 +387,17 @@ NXstatus CALLING_STYLE NX5closegroup (NXhandle fid);
|
|||||||
pNexusFile5 pFile;
|
pNexusFile5 pFile;
|
||||||
hid_t iRet;
|
hid_t iRet;
|
||||||
hid_t attr1,aid1, aid2;
|
hid_t attr1,aid1, aid2;
|
||||||
char pBuffer[1024];
|
char pBuffer[1024] = "";
|
||||||
|
|
||||||
pFile = NXI5assert (fid);
|
pFile = NXI5assert (fid);
|
||||||
/* create and configure the group */
|
/* create and configure the group */
|
||||||
if (pFile->iCurrentG==0)
|
if (pFile->iCurrentG==0)
|
||||||
{
|
{
|
||||||
iRet = H5Gcreate(pFile->iFID,(const char*)name, 0);
|
iRet = H5Gcreate(pFile->iFID,(const char*)name, 0);
|
||||||
|
snprintf(pBuffer,1023,"/%s",name);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
sprintf(pBuffer,"/%s/%s",pFile->name_ref,name);
|
snprintf(pBuffer,1023,"/%s/%s",pFile->name_ref,name);
|
||||||
iRet = H5Gcreate(pFile->iFID,(const char*)pBuffer, 0);
|
iRet = H5Gcreate(pFile->iFID,(const char*)pBuffer, 0);
|
||||||
}
|
}
|
||||||
if (iRet < 0) {
|
if (iRet < 0) {
|
||||||
@ -385,7 +405,7 @@ NXstatus CALLING_STYLE NX5closegroup (NXhandle fid);
|
|||||||
return NX_ERROR;
|
return NX_ERROR;
|
||||||
}
|
}
|
||||||
pFile->iVID = iRet;
|
pFile->iVID = iRet;
|
||||||
strcpy(pFile->name_ref,pBuffer);
|
strncpy(pFile->name_ref,pBuffer,1023);
|
||||||
aid2 = H5Screate(H5S_SCALAR);
|
aid2 = H5Screate(H5S_SCALAR);
|
||||||
aid1 = H5Tcopy(H5T_C_S1);
|
aid1 = H5Tcopy(H5T_C_S1);
|
||||||
H5Tset_size(aid1, strlen(nxclass));
|
H5Tset_size(aid1, strlen(nxclass));
|
||||||
@ -840,10 +860,9 @@ NXstatus CALLING_STYLE NX5closegroup (NXhandle fid);
|
|||||||
NXstatus CALLING_STYLE NX5putdata (NXhandle fid, void *data)
|
NXstatus CALLING_STYLE NX5putdata (NXhandle fid, void *data)
|
||||||
{
|
{
|
||||||
pNexusFile5 pFile;
|
pNexusFile5 pFile;
|
||||||
NXname pBuffer;
|
|
||||||
hid_t iRet;
|
hid_t iRet;
|
||||||
|
|
||||||
char pError[512];
|
char pError[512] = "";
|
||||||
|
|
||||||
pFile = NXI5assert (fid);
|
pFile = NXI5assert (fid);
|
||||||
|
|
||||||
@ -851,7 +870,7 @@ NXstatus CALLING_STYLE NX5closegroup (NXhandle fid);
|
|||||||
iRet = H5Dwrite (pFile->iCurrentD, pFile->iCurrentT, H5S_ALL, H5S_ALL,
|
iRet = H5Dwrite (pFile->iCurrentD, pFile->iCurrentT, H5S_ALL, H5S_ALL,
|
||||||
H5P_DEFAULT, data);
|
H5P_DEFAULT, data);
|
||||||
if (iRet < 0) {
|
if (iRet < 0) {
|
||||||
sprintf (pError, "ERROR: failure to write data to %s", pBuffer);
|
snprintf (pError,511, "ERROR: failure to write data");
|
||||||
NXIReportError (NXpData, pError);
|
NXIReportError (NXpData, pError);
|
||||||
return NX_ERROR;
|
return NX_ERROR;
|
||||||
}
|
}
|
||||||
@ -1328,6 +1347,7 @@ NXstatus CALLING_STYLE NX5closegroup (NXhandle fid);
|
|||||||
*datatype=iPtype;
|
*datatype=iPtype;
|
||||||
strcpy(nxclass, "SDS");
|
strcpy(nxclass, "SDS");
|
||||||
H5Tclose(atype);
|
H5Tclose(atype);
|
||||||
|
H5Tclose(type);
|
||||||
H5Dclose(grp);
|
H5Dclose(grp);
|
||||||
}
|
}
|
||||||
return NX_OK;
|
return NX_OK;
|
||||||
@ -1355,7 +1375,7 @@ NXstatus CALLING_STYLE NX5closegroup (NXhandle fid);
|
|||||||
NXstatus CALLING_STYLE NX5getdata (NXhandle fid, void *data)
|
NXstatus CALLING_STYLE NX5getdata (NXhandle fid, void *data)
|
||||||
{
|
{
|
||||||
pNexusFile5 pFile;
|
pNexusFile5 pFile;
|
||||||
int iStart[H5S_MAX_RANK];
|
int iStart[H5S_MAX_RANK], status;
|
||||||
hid_t data_id, memtype_id, size_id, sign_id;
|
hid_t data_id, memtype_id, size_id, sign_id;
|
||||||
int dims;
|
int dims;
|
||||||
|
|
||||||
@ -1418,7 +1438,18 @@ NXstatus CALLING_STYLE NX5closegroup (NXhandle fid);
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* actually read */
|
/* actually read */
|
||||||
H5Dread (pFile->iCurrentD, memtype_id, H5S_ALL, H5S_ALL,H5P_DEFAULT, data);
|
status = H5Dread (pFile->iCurrentD, memtype_id,
|
||||||
|
H5S_ALL, H5S_ALL,H5P_DEFAULT, data);
|
||||||
|
if(data_id == H5T_STRING)
|
||||||
|
{
|
||||||
|
H5Tclose(memtype_id);
|
||||||
|
}
|
||||||
|
if(status < 0)
|
||||||
|
{
|
||||||
|
NXIReportError (NXpData, "ERROR: failed to transfer dataset");
|
||||||
|
return NX_ERROR;
|
||||||
|
|
||||||
|
}
|
||||||
return NX_OK;
|
return NX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
mkChannel *pServerPort;
|
mkChannel *pServerPort;
|
||||||
pNetRead pReader;
|
pNetRead pReader;
|
||||||
int simMode;
|
int simMode;
|
||||||
SConnection *dummyCon;
|
|
||||||
} SicsServer;
|
} SicsServer;
|
||||||
|
|
||||||
|
|
||||||
|
385
nxdict.c
385
nxdict.c
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
#line 2264 "nxdict.w"
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------
|
||||||
Nexus Dictionary API implementation file.
|
Nexus Dictionary API implementation file.
|
||||||
|
|
||||||
@ -18,24 +20,14 @@
|
|||||||
August, 1997
|
August, 1997
|
||||||
|
|
||||||
Version: 1.0
|
Version: 1.0
|
||||||
|
|
||||||
Version 1.1
|
|
||||||
|
|
||||||
Updated to use the combined HDF4 HDF5 API. New keyword -chunk which
|
|
||||||
defines the chunk buffer size for a SDS.
|
|
||||||
|
|
||||||
Mark Koennecke, August 2001
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <mfhdf.h>
|
#include <mfhdf.h>
|
||||||
#include "fortify.h"
|
|
||||||
#include "lld.h"
|
#include "lld.h"
|
||||||
#include "napi.h"
|
#include "napi.h"
|
||||||
#include "stringdict.h"
|
#include "stringdict.h"
|
||||||
@ -49,13 +41,14 @@
|
|||||||
extern void *NXpData;
|
extern void *NXpData;
|
||||||
extern void (*NXIReportError)(void *pData, char *pBuffer);
|
extern void (*NXIReportError)(void *pData, char *pBuffer);
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
/* #define DEFDEBUG 1 */
|
#define DEFDEBUG 1
|
||||||
/* define DEFDEBUG when you wish to print your definition strings before
|
/* define DEFDEBUG when you wish to print your definition strings before
|
||||||
action. This can help a lot to resolve mysteries when working with
|
action. This can help a lot to resolve mysteries when working with
|
||||||
dictionaries.
|
dictionaries.
|
||||||
*/
|
*/
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#line 362 "nxdict.w"
|
||||||
|
|
||||||
typedef struct __NXdict
|
typedef struct __NXdict
|
||||||
{
|
{
|
||||||
@ -65,6 +58,7 @@
|
|||||||
/*------------------ verbosity level -------------------------------------*/
|
/*------------------ verbosity level -------------------------------------*/
|
||||||
static int iVerbosity = 0 ;
|
static int iVerbosity = 0 ;
|
||||||
|
|
||||||
|
#line 2311 "nxdict.w"
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
static char *NXDIReadFile(FILE *fd)
|
static char *NXDIReadFile(FILE *fd)
|
||||||
@ -106,6 +100,7 @@
|
|||||||
}
|
}
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#line 490 "nxdict.w"
|
||||||
|
|
||||||
#define FWORD 1
|
#define FWORD 1
|
||||||
#define FHASH 2
|
#define FHASH 2
|
||||||
@ -178,9 +173,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#line 2351 "nxdict.w"
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#line 566 "nxdict.w"
|
||||||
|
|
||||||
#define AMODE 0
|
#define AMODE 0
|
||||||
#define DMODE 1
|
#define DMODE 1
|
||||||
@ -269,6 +266,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#line 2353 "nxdict.w"
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
NXstatus NXDinitfromfile(char *filename, NXdict *pData)
|
NXstatus NXDinitfromfile(char *filename, NXdict *pData)
|
||||||
@ -279,6 +277,7 @@
|
|||||||
char pError[512];
|
char pError[512];
|
||||||
|
|
||||||
|
|
||||||
|
#line 383 "nxdict.w"
|
||||||
|
|
||||||
/* allocate a new NXdict structure */
|
/* allocate a new NXdict structure */
|
||||||
if(iVerbosity == NXalot)
|
if(iVerbosity == NXalot)
|
||||||
@ -303,6 +302,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#line 2362 "nxdict.w"
|
||||||
|
|
||||||
|
|
||||||
|
#line 410 "nxdict.w"
|
||||||
|
|
||||||
/* is there a file name argument */
|
/* is there a file name argument */
|
||||||
if(filename == NULL)
|
if(filename == NULL)
|
||||||
@ -315,6 +318,10 @@
|
|||||||
return NX_OK;
|
return NX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#line 2363 "nxdict.w"
|
||||||
|
|
||||||
|
|
||||||
|
#line 424 "nxdict.w"
|
||||||
|
|
||||||
fd = fopen(filename,"rb");
|
fd = fopen(filename,"rb");
|
||||||
if(!fd)
|
if(!fd)
|
||||||
@ -327,6 +334,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#line 2364 "nxdict.w"
|
||||||
|
|
||||||
|
|
||||||
|
#line 444 "nxdict.w"
|
||||||
|
|
||||||
/* read the file contents */
|
/* read the file contents */
|
||||||
if(iVerbosity == NXalot)
|
if(iVerbosity == NXalot)
|
||||||
{
|
{
|
||||||
@ -350,6 +363,8 @@
|
|||||||
}
|
}
|
||||||
NXDIParse(pBuffer, pNew->pDictionary);
|
NXDIParse(pBuffer, pNew->pDictionary);
|
||||||
|
|
||||||
|
#line 2365 "nxdict.w"
|
||||||
|
|
||||||
|
|
||||||
if(iVerbosity == NXalot)
|
if(iVerbosity == NXalot)
|
||||||
{
|
{
|
||||||
@ -361,6 +376,8 @@
|
|||||||
}
|
}
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#line 660 "nxdict.w"
|
||||||
|
|
||||||
NXdict NXDIAssert(NXdict handle)
|
NXdict NXDIAssert(NXdict handle)
|
||||||
{
|
{
|
||||||
NXdict self = NULL;
|
NXdict self = NULL;
|
||||||
@ -370,9 +387,12 @@
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#line 2376 "nxdict.w"
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#line 671 "nxdict.w"
|
||||||
|
|
||||||
NXstatus NXDclose(NXdict handle, char *filename)
|
NXstatus NXDclose(NXdict handle, char *filename)
|
||||||
{
|
{
|
||||||
NXdict self;
|
NXdict self;
|
||||||
@ -421,8 +441,12 @@
|
|||||||
return NX_OK;
|
return NX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#line 2378 "nxdict.w"
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#line 724 "nxdict.w"
|
||||||
|
|
||||||
NXstatus NXDadd(NXdict handle, char *alias, char *pDef)
|
NXstatus NXDadd(NXdict handle, char *alias, char *pDef)
|
||||||
{
|
{
|
||||||
NXdict self;
|
NXdict self;
|
||||||
@ -467,7 +491,14 @@
|
|||||||
}
|
}
|
||||||
return NX_OK;
|
return NX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#line 2380 "nxdict.w"
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#line 776 "nxdict.w"
|
||||||
|
|
||||||
#define NORMAL 1
|
#define NORMAL 1
|
||||||
#define ALIAS 2
|
#define ALIAS 2
|
||||||
pDynString NXDItextreplace(NXdict handle, char *pDefString)
|
pDynString NXDItextreplace(NXdict handle, char *pDefString)
|
||||||
@ -564,12 +595,23 @@
|
|||||||
return NX_OK;
|
return NX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#line 2382 "nxdict.w"
|
||||||
|
|
||||||
/*------------------- The Defintion String Parser -----------------------*/
|
/*------------------- The Defintion String Parser -----------------------*/
|
||||||
/*------- Data structures */
|
/*------- Data structures */
|
||||||
|
|
||||||
|
#line 886 "nxdict.w"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char pText[20];
|
char pText[20];
|
||||||
int iCode;
|
int iCode;
|
||||||
} TokDat;
|
} TokDat;
|
||||||
|
|
||||||
|
#line 2385 "nxdict.w"
|
||||||
|
|
||||||
|
|
||||||
|
#line 896 "nxdict.w"
|
||||||
|
|
||||||
#define TERMSDS 100
|
#define TERMSDS 100
|
||||||
#define TERMVG 200
|
#define TERMVG 200
|
||||||
#define TERMLINK 300
|
#define TERMLINK 300
|
||||||
@ -583,15 +625,32 @@
|
|||||||
int iTerminal;
|
int iTerminal;
|
||||||
} ParDat;
|
} ParDat;
|
||||||
|
|
||||||
|
#line 2386 "nxdict.w"
|
||||||
|
|
||||||
|
|
||||||
|
#line 1101 "nxdict.w"
|
||||||
|
|
||||||
static void DummyError(void *pData, char *pError)
|
static void DummyError(void *pData, char *pError)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#line 2387 "nxdict.w"
|
||||||
|
|
||||||
|
|
||||||
|
#line 1215 "nxdict.w"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char name[256];
|
char name[256];
|
||||||
char value[256];
|
char value[256];
|
||||||
}AttItem;
|
}AttItem;
|
||||||
|
|
||||||
|
#line 2388 "nxdict.w"
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#line 918 "nxdict.w"
|
||||||
|
|
||||||
/*---------------- Token name defines ---------------------------*/
|
/*---------------- Token name defines ---------------------------*/
|
||||||
#define DSLASH 0
|
#define DSLASH 0
|
||||||
#define DKOMMA 1
|
#define DKOMMA 1
|
||||||
@ -606,14 +665,10 @@
|
|||||||
#define DCLOSE 11
|
#define DCLOSE 11
|
||||||
#define DATTR 12
|
#define DATTR 12
|
||||||
#define DEND 13
|
#define DEND 13
|
||||||
#define DLZW 14
|
|
||||||
#define DHUF 15
|
|
||||||
#define DRLE 16
|
|
||||||
#define CHUNK 17
|
|
||||||
|
|
||||||
/*----------------- Keywords ----------------------------------------*/
|
/*----------------- Keywords ----------------------------------------*/
|
||||||
|
|
||||||
static TokDat TokenList[12] = {
|
static TokDat TokenList[8] = {
|
||||||
{"SDS",DSDS},
|
{"SDS",DSDS},
|
||||||
{"NXLINK",DLINK},
|
{"NXLINK",DLINK},
|
||||||
{"NXVGROUP",DGROUP},
|
{"NXVGROUP",DGROUP},
|
||||||
@ -621,11 +676,7 @@
|
|||||||
{"-type",DTYPE},
|
{"-type",DTYPE},
|
||||||
{"-rank",DRANK},
|
{"-rank",DRANK},
|
||||||
{"-attr",DATTR},
|
{"-attr",DATTR},
|
||||||
{"-chunk",CHUNK},
|
{"",0} };
|
||||||
{"-LZW",DLZW},
|
|
||||||
{"-HUF",DHUF},
|
|
||||||
{"-RLE",DRLE},
|
|
||||||
{NULL,0} };
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
static void NXDIDefToken(ParDat *sStat)
|
static void NXDIDefToken(ParDat *sStat)
|
||||||
@ -693,7 +744,7 @@
|
|||||||
sStat->pToken[i] = '\0';
|
sStat->pToken[i] = '\0';
|
||||||
|
|
||||||
/*--------- try to find word in Tokenlist */
|
/*--------- try to find word in Tokenlist */
|
||||||
for(i = 0; i < 10; i++)
|
for(i = 0; i < 7; i++)
|
||||||
{
|
{
|
||||||
if(strcmp(sStat->pToken,TokenList[i].pText) == 0)
|
if(strcmp(sStat->pToken,TokenList[i].pText) == 0)
|
||||||
{
|
{
|
||||||
@ -708,8 +759,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#line 2390 "nxdict.w"
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#line 1114 "nxdict.w"
|
||||||
|
|
||||||
int NXDIParsePath(NXhandle hfil, ParDat *pParse)
|
int NXDIParsePath(NXhandle hfil, ParDat *pParse)
|
||||||
{
|
{
|
||||||
int iRet, iToken;
|
int iRet, iToken;
|
||||||
@ -800,8 +855,12 @@
|
|||||||
return NX_ERROR;
|
return NX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#line 2392 "nxdict.w"
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#line 1481 "nxdict.w"
|
||||||
|
|
||||||
static int NXDIParseAttr(ParDat *pParse, int iList)
|
static int NXDIParseAttr(ParDat *pParse, int iList)
|
||||||
{
|
{
|
||||||
char pError[256];
|
char pError[256];
|
||||||
@ -860,7 +919,12 @@
|
|||||||
return NX_OK;
|
return NX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#line 2394 "nxdict.w"
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#line 1428 "nxdict.w"
|
||||||
|
|
||||||
static int NXDIParseDim(ParDat *pParse, int *iDim)
|
static int NXDIParseDim(ParDat *pParse, int *iDim)
|
||||||
{
|
{
|
||||||
char pError[256];
|
char pError[256];
|
||||||
@ -908,7 +972,13 @@
|
|||||||
}
|
}
|
||||||
return NX_OK;
|
return NX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#line 2396 "nxdict.w"
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#line 1379 "nxdict.w"
|
||||||
|
|
||||||
static TokDat tDatType[] = {
|
static TokDat tDatType[] = {
|
||||||
{"DFNT_FLOAT32",DFNT_FLOAT32},
|
{"DFNT_FLOAT32",DFNT_FLOAT32},
|
||||||
{"DFNT_FLOAT64",DFNT_FLOAT64},
|
{"DFNT_FLOAT64",DFNT_FLOAT64},
|
||||||
@ -918,8 +988,7 @@
|
|||||||
{"DFNT_UINT16",DFNT_UINT16},
|
{"DFNT_UINT16",DFNT_UINT16},
|
||||||
{"DFNT_INT32",DFNT_INT32},
|
{"DFNT_INT32",DFNT_INT32},
|
||||||
{"DFNT_UINT32",DFNT_UINT32},
|
{"DFNT_UINT32",DFNT_UINT32},
|
||||||
{"DFNT_CHAR",DFNT_CHAR},
|
{"",0} };
|
||||||
{NULL,-122} };
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -954,15 +1023,19 @@
|
|||||||
return NX_ERROR;
|
return NX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#line 2398 "nxdict.w"
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#line 1223 "nxdict.w"
|
||||||
|
|
||||||
static int NXDIParseSDS(NXhandle hfil, ParDat *pParse)
|
static int NXDIParseSDS(NXhandle hfil, ParDat *pParse)
|
||||||
{
|
{
|
||||||
int iType = DFNT_FLOAT32;
|
int iType = DFNT_FLOAT32;
|
||||||
int iRank = 1;
|
int iRank = 1;
|
||||||
int iCompress = NX_COMP_NONE;
|
int32 iDim[MAX_VAR_DIMS];
|
||||||
int32 iDim[MAX_VAR_DIMS], iChunk[MAX_VAR_DIMS];
|
int iList;
|
||||||
int iList, iChunkDefined = 0 ;
|
int iRet, iStat;
|
||||||
int iRet, iStat, i;
|
|
||||||
char pError[256];
|
char pError[256];
|
||||||
char pName[MAX_NC_NAME];
|
char pName[MAX_NC_NAME];
|
||||||
void (*ErrFunc)(void *pData, char *pErr);
|
void (*ErrFunc)(void *pData, char *pErr);
|
||||||
@ -1006,17 +1079,8 @@
|
|||||||
}
|
}
|
||||||
iRank = atoi(pParse->pToken);
|
iRank = atoi(pParse->pToken);
|
||||||
break;
|
break;
|
||||||
case CHUNK: /* chunk size for compression */
|
|
||||||
iRet = NXDIParseDim(pParse, iChunk);
|
|
||||||
if(iRet == NX_ERROR)
|
|
||||||
{
|
|
||||||
LLDdelete(iList);
|
|
||||||
return iRet;
|
|
||||||
}
|
|
||||||
iChunkDefined = 1;
|
|
||||||
break;
|
|
||||||
case DDIM:
|
case DDIM:
|
||||||
iRet = NXDIParseDim(pParse, iDim);
|
iRet = NXDIParseDim (pParse, (int *) iDim);
|
||||||
if(iRet == NX_ERROR)
|
if(iRet == NX_ERROR)
|
||||||
{
|
{
|
||||||
LLDdelete(iList);
|
LLDdelete(iList);
|
||||||
@ -1039,15 +1103,6 @@
|
|||||||
return iRet;
|
return iRet;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DLZW:
|
|
||||||
iCompress = NX_COMP_LZW;
|
|
||||||
break;
|
|
||||||
case DRLE:
|
|
||||||
iCompress = NX_COMP_RLE;
|
|
||||||
break;
|
|
||||||
case DHUF:
|
|
||||||
iCompress = NX_COMP_HUF;
|
|
||||||
break;
|
|
||||||
case DEND:
|
case DEND:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1060,19 +1115,8 @@
|
|||||||
}
|
}
|
||||||
NXDIDefToken(pParse);
|
NXDIDefToken(pParse);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* whew! got all information for doing the SDS
|
|
||||||
However, if the chunk sizes for compression have not
|
|
||||||
been set, default them to the dimensions of the data set
|
|
||||||
*/
|
|
||||||
if(iChunkDefined == 0)
|
|
||||||
{
|
|
||||||
for(i = 0; i < iRank; i++)
|
|
||||||
{
|
|
||||||
iChunk[i] = iDim[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/* whew! got all information for doing the SDS */
|
||||||
/* first install dummy error handler, try open it, then
|
/* first install dummy error handler, try open it, then
|
||||||
deinstall again and create if allowed
|
deinstall again and create if allowed
|
||||||
*/
|
*/
|
||||||
@ -1092,8 +1136,7 @@
|
|||||||
/* we need to create it, if we may */
|
/* we need to create it, if we may */
|
||||||
if(pParse->iMayCreate)
|
if(pParse->iMayCreate)
|
||||||
{
|
{
|
||||||
iRet = NXcompmakedata(hfil,pName,iType, iRank,iDim,
|
iRet = NXmakedata (hfil, pName, iType, iRank, (int *) iDim);
|
||||||
iCompress,iChunk);
|
|
||||||
if(iRet != NX_OK)
|
if(iRet != NX_OK)
|
||||||
{
|
{
|
||||||
/* a comment on this one has already been written! */
|
/* a comment on this one has already been written! */
|
||||||
@ -1107,7 +1150,6 @@
|
|||||||
LLDdelete(iList);
|
LLDdelete(iList);
|
||||||
return iRet;
|
return iRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* put attributes in */
|
/* put attributes in */
|
||||||
iRet = LLDnodePtr2First(iList);
|
iRet = LLDnodePtr2First(iList);
|
||||||
while(iRet != 0)
|
while(iRet != 0)
|
||||||
@ -1137,7 +1179,13 @@
|
|||||||
}
|
}
|
||||||
return NX_OK;
|
return NX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#line 2400 "nxdict.w"
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#line 1544 "nxdict.w"
|
||||||
|
|
||||||
static int NXDIParseLink(NXhandle hfil, NXdict pDict,ParDat *pParse)
|
static int NXDIParseLink(NXhandle hfil, NXdict pDict,ParDat *pParse)
|
||||||
{
|
{
|
||||||
char pError[256];
|
char pError[256];
|
||||||
@ -1166,8 +1214,14 @@
|
|||||||
return NXDopenalias(hfil, pDict, pParse->pToken);
|
return NXDopenalias(hfil, pDict, pParse->pToken);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#line 2402 "nxdict.w"
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
int NXDIDefParse(NXhandle hFil, NXdict pDict, ParDat *pParse)
|
|
||||||
|
#line 1034 "nxdict.w"
|
||||||
|
|
||||||
|
static int NXDIDefParse(NXhandle hFil, NXdict pDict, ParDat *pParse)
|
||||||
{
|
{
|
||||||
int iRet;
|
int iRet;
|
||||||
char pError[256];
|
char pError[256];
|
||||||
@ -1217,8 +1271,14 @@
|
|||||||
}
|
}
|
||||||
return NX_OK;
|
return NX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#line 2404 "nxdict.w"
|
||||||
|
|
||||||
/*----------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------*/
|
||||||
NXstatus NXDIUnwind(NXhandle hFil, int iDepth)
|
|
||||||
|
#line 1576 "nxdict.w"
|
||||||
|
|
||||||
|
static NXstatus NXDIUnwind(NXhandle hFil, int iDepth)
|
||||||
{
|
{
|
||||||
int i, iRet;
|
int i, iRet;
|
||||||
|
|
||||||
@ -1232,7 +1292,13 @@
|
|||||||
}
|
}
|
||||||
return NX_OK;
|
return NX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#line 2406 "nxdict.w"
|
||||||
|
|
||||||
/*-------------------- The Data Transfer Functions ----------------------*/
|
/*-------------------- The Data Transfer Functions ----------------------*/
|
||||||
|
|
||||||
|
#line 1597 "nxdict.w"
|
||||||
|
|
||||||
NXstatus NXDopendef(NXhandle hfil, NXdict dict, char *pDef)
|
NXstatus NXDopendef(NXhandle hfil, NXdict dict, char *pDef)
|
||||||
{
|
{
|
||||||
NXdict pDict;
|
NXdict pDict;
|
||||||
@ -1266,18 +1332,24 @@
|
|||||||
/* do not rewind on links */
|
/* do not rewind on links */
|
||||||
return iRet;
|
return iRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#line 2408 "nxdict.w"
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#line 1637 "nxdict.w"
|
||||||
|
|
||||||
NXstatus NXDopenalias(NXhandle hfil, NXdict dict, char *pAlias)
|
NXstatus NXDopenalias(NXhandle hfil, NXdict dict, char *pAlias)
|
||||||
{
|
{
|
||||||
NXdict pDict;
|
NXdict pDict;
|
||||||
int iRet;
|
int iRet;
|
||||||
char pDefinition[2048];
|
char pDefinition[1024];
|
||||||
pDynString pReplaced = NULL;
|
pDynString pReplaced = NULL;
|
||||||
|
|
||||||
pDict = NXDIAssert(dict);
|
pDict = NXDIAssert(dict);
|
||||||
|
|
||||||
/* get Definition String */
|
/* get Definition String */
|
||||||
iRet = NXDget(pDict,pAlias,pDefinition,2047);
|
iRet = NXDget(pDict,pAlias,pDefinition,1023);
|
||||||
if(iRet != NX_OK)
|
if(iRet != NX_OK)
|
||||||
{
|
{
|
||||||
sprintf(pDefinition,"ERROR: alias %s not recognized",pAlias);
|
sprintf(pDefinition,"ERROR: alias %s not recognized",pAlias);
|
||||||
@ -1297,7 +1369,13 @@
|
|||||||
DeleteDynString(pReplaced);
|
DeleteDynString(pReplaced);
|
||||||
return iRet;
|
return iRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#line 2410 "nxdict.w"
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#line 1674 "nxdict.w"
|
||||||
|
|
||||||
NXstatus NXDputdef(NXhandle hFil, NXdict dict, char *pDef, void *pData)
|
NXstatus NXDputdef(NXhandle hFil, NXdict dict, char *pDef, void *pData)
|
||||||
{
|
{
|
||||||
NXdict pDict;
|
NXdict pDict;
|
||||||
@ -1344,18 +1422,24 @@
|
|||||||
}
|
}
|
||||||
return iStat;
|
return iStat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#line 2412 "nxdict.w"
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#line 1725 "nxdict.w"
|
||||||
|
|
||||||
NXstatus NXDputalias(NXhandle hFil, NXdict dict, char *pAlias, void *pData)
|
NXstatus NXDputalias(NXhandle hFil, NXdict dict, char *pAlias, void *pData)
|
||||||
{
|
{
|
||||||
NXdict pDict;
|
NXdict pDict;
|
||||||
int iRet;
|
int iRet;
|
||||||
char pDefinition[2048];
|
char pDefinition[1024];
|
||||||
pDynString pReplaced = NULL;
|
pDynString pReplaced = NULL;
|
||||||
|
|
||||||
pDict = NXDIAssert(dict);
|
pDict = NXDIAssert(dict);
|
||||||
|
|
||||||
/* get Definition String */
|
/* get Definition String */
|
||||||
iRet = NXDget(pDict,pAlias,pDefinition,2047);
|
iRet = NXDget(pDict,pAlias,pDefinition,1023);
|
||||||
if(iRet != NX_OK)
|
if(iRet != NX_OK)
|
||||||
{
|
{
|
||||||
sprintf(pDefinition,"ERROR: alias %s not recognized",pAlias);
|
sprintf(pDefinition,"ERROR: alias %s not recognized",pAlias);
|
||||||
@ -1375,7 +1459,13 @@
|
|||||||
DeleteDynString(pReplaced);
|
DeleteDynString(pReplaced);
|
||||||
return iRet;
|
return iRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#line 2414 "nxdict.w"
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#line 1760 "nxdict.w"
|
||||||
|
|
||||||
NXstatus NXDgetdef(NXhandle hFil, NXdict dict, char *pDef, void *pData)
|
NXstatus NXDgetdef(NXhandle hFil, NXdict dict, char *pDef, void *pData)
|
||||||
{
|
{
|
||||||
NXdict pDict;
|
NXdict pDict;
|
||||||
@ -1424,18 +1514,23 @@
|
|||||||
return iStat;
|
return iStat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#line 2416 "nxdict.w"
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#line 1812 "nxdict.w"
|
||||||
|
|
||||||
NXstatus NXDgetalias(NXhandle hFil, NXdict dict, char *pAlias, void *pData)
|
NXstatus NXDgetalias(NXhandle hFil, NXdict dict, char *pAlias, void *pData)
|
||||||
{
|
{
|
||||||
NXdict pDict;
|
NXdict pDict;
|
||||||
int iRet;
|
int iRet;
|
||||||
char pDefinition[2048];
|
char pDefinition[1024];
|
||||||
pDynString pReplaced = NULL;
|
pDynString pReplaced = NULL;
|
||||||
|
|
||||||
pDict = NXDIAssert(dict);
|
pDict = NXDIAssert(dict);
|
||||||
|
|
||||||
/* get Definition String */
|
/* get Definition String */
|
||||||
iRet = NXDget(pDict,pAlias,pDefinition,2047);
|
iRet = NXDget(pDict,pAlias,pDefinition,1023);
|
||||||
if(iRet != NX_OK)
|
if(iRet != NX_OK)
|
||||||
{
|
{
|
||||||
sprintf(pDefinition,"ERROR: alias %s not recognized",pAlias);
|
sprintf(pDefinition,"ERROR: alias %s not recognized",pAlias);
|
||||||
@ -1455,92 +1550,13 @@
|
|||||||
DeleteDynString(pReplaced);
|
DeleteDynString(pReplaced);
|
||||||
return iRet;
|
return iRet;
|
||||||
}
|
}
|
||||||
/*------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
NXstatus NXDinfodef(NXhandle hFil, NXdict dict, char *pDef, int *rank,
|
#line 2418 "nxdict.w"
|
||||||
int dimension[], int *iType)
|
|
||||||
{
|
|
||||||
NXdict pDict;
|
|
||||||
ParDat pParse;
|
|
||||||
int iRet, i, iStat;
|
|
||||||
|
|
||||||
pDict = NXDIAssert(dict);
|
|
||||||
|
|
||||||
/* parse and act on definition string */
|
|
||||||
pParse.iMayCreate = 0;
|
|
||||||
pParse.pPtr = pDef;
|
|
||||||
pParse.iDepth = 0;
|
|
||||||
#ifdef DEFDEBUG
|
|
||||||
printf("Getting: %s\n",pDef);
|
|
||||||
#endif
|
|
||||||
iRet = NXDIDefParse(hFil,pDict,&pParse);
|
|
||||||
if(iRet == NX_ERROR)
|
|
||||||
{
|
|
||||||
/* unwind and throw up */
|
|
||||||
NXDIUnwind(hFil,pParse.iDepth);
|
|
||||||
return NX_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* only SDS can be written */
|
|
||||||
if(pParse.iTerminal != TERMSDS)
|
|
||||||
{
|
|
||||||
NXIReportError(NXpData,
|
|
||||||
"ERROR: can only write to an SDS!");
|
|
||||||
iStat = NX_ERROR;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* the SDS should be open by now, read it */
|
|
||||||
iStat = NXgetinfo(hFil, rank,dimension, iType);
|
|
||||||
iRet = NXclosedata(hFil);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* rewind the hierarchy */
|
|
||||||
iRet = NXDIUnwind(hFil,pParse.iDepth);
|
|
||||||
if(iRet != NX_OK)
|
|
||||||
{
|
|
||||||
return NX_ERROR;
|
|
||||||
}
|
|
||||||
return iStat;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
NXstatus NXDinfoalias(NXhandle hFil, NXdict dict, char *pAlias, int *rank,
|
#line 1849 "nxdict.w"
|
||||||
int dimension[], int *iType)
|
|
||||||
{
|
|
||||||
NXdict pDict;
|
|
||||||
int iRet;
|
|
||||||
char pDefinition[2048];
|
|
||||||
pDynString pReplaced = NULL;
|
|
||||||
|
|
||||||
pDict = NXDIAssert(dict);
|
|
||||||
|
|
||||||
/* get Definition String */
|
|
||||||
iRet = NXDget(pDict,pAlias,pDefinition,2047);
|
|
||||||
if(iRet != NX_OK)
|
|
||||||
{
|
|
||||||
sprintf(pDefinition,"ERROR: alias %s not recognized",pAlias);
|
|
||||||
NXIReportError(NXpData,pDefinition);
|
|
||||||
return NX_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* do text replacement */
|
|
||||||
pReplaced = NXDItextreplace(dict,pDefinition);
|
|
||||||
if(!pReplaced)
|
|
||||||
{
|
|
||||||
return NX_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* call NXDgetdef */
|
|
||||||
iRet = NXDinfodef(hFil,dict,GetCharArray(pReplaced),rank,dimension,iType);
|
|
||||||
DeleteDynString(pReplaced);
|
|
||||||
return iRet;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
|
||||||
NXstatus NXDdeflink(NXhandle hFil, NXdict dict,
|
NXstatus NXDdeflink(NXhandle hFil, NXdict dict,
|
||||||
char *pTarget, char *pVictim)
|
char *pTarget, char *pVictim)
|
||||||
{
|
{
|
||||||
@ -1629,7 +1645,7 @@
|
|||||||
NXstatus NXDaliaslink(NXhandle hFil, NXdict dict,
|
NXstatus NXDaliaslink(NXhandle hFil, NXdict dict,
|
||||||
char *pTarget, char *pVictim)
|
char *pTarget, char *pVictim)
|
||||||
{
|
{
|
||||||
char pTargetDef[2048], pVictimDef[2048];
|
char pTargetDef[1024], pVictimDef[1024];
|
||||||
int iRet;
|
int iRet;
|
||||||
NXdict pDict;
|
NXdict pDict;
|
||||||
pDynString pRep1 = NULL, pRep2 = NULL;
|
pDynString pRep1 = NULL, pRep2 = NULL;
|
||||||
@ -1637,7 +1653,7 @@
|
|||||||
pDict = NXDIAssert(dict);
|
pDict = NXDIAssert(dict);
|
||||||
|
|
||||||
/* get Target Definition String */
|
/* get Target Definition String */
|
||||||
iRet = NXDget(pDict,pTarget,pTargetDef,2047);
|
iRet = NXDget(pDict,pTarget,pTargetDef,1023);
|
||||||
if(iRet != NX_OK)
|
if(iRet != NX_OK)
|
||||||
{
|
{
|
||||||
sprintf(pTargetDef,"ERROR: alias %s not recognized",pTarget);
|
sprintf(pTargetDef,"ERROR: alias %s not recognized",pTarget);
|
||||||
@ -1646,7 +1662,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* get Victim definition string */
|
/* get Victim definition string */
|
||||||
iRet = NXDget(pDict,pVictim,pVictimDef,2047);
|
iRet = NXDget(pDict,pVictim,pVictimDef,1023);
|
||||||
if(iRet != NX_OK)
|
if(iRet != NX_OK)
|
||||||
{
|
{
|
||||||
sprintf(pTargetDef,"ERROR: alias %s not recognized",pTarget);
|
sprintf(pTargetDef,"ERROR: alias %s not recognized",pTarget);
|
||||||
@ -1672,6 +1688,14 @@
|
|||||||
DeleteDynString(pRep2);
|
DeleteDynString(pRep2);
|
||||||
return iRet;
|
return iRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#line 2420 "nxdict.w"
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#line 1986 "nxdict.w"
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
static void SNXFormatTime(char *pBuffer, int iBufLen)
|
static void SNXFormatTime(char *pBuffer, int iBufLen)
|
||||||
{
|
{
|
||||||
@ -1682,7 +1706,7 @@
|
|||||||
iDate = time(NULL);
|
iDate = time(NULL);
|
||||||
psTime = localtime(&iDate);
|
psTime = localtime(&iDate);
|
||||||
memset(pBuffer,0,iBufLen);
|
memset(pBuffer,0,iBufLen);
|
||||||
strftime(pBuffer,iBufLen,"%Y-%m-%d %H:%M:%S",psTime);
|
strftime(pBuffer,iBufLen,"%Y-%d-%m %H:%M:%S",psTime);
|
||||||
}
|
}
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
NXstatus NXUwriteglobals(NXhandle pFile,
|
NXstatus NXUwriteglobals(NXhandle pFile,
|
||||||
@ -1697,28 +1721,26 @@
|
|||||||
char pBueffel[512];
|
char pBueffel[512];
|
||||||
int iStat;
|
int iStat;
|
||||||
|
|
||||||
/* store global attributes, now done by NXopen
|
/* store global attributes */
|
||||||
iStat = NXputattr(pFile,"file_name",filename,
|
iStat = NXputattr(pFile,"file_name",filename,
|
||||||
strlen(filename)+1,NX_CHAR);
|
strlen(filename)+1,DFNT_INT8);
|
||||||
if(iStat == NX_ERROR)
|
if(iStat == NX_ERROR)
|
||||||
{
|
{
|
||||||
return NX_ERROR;
|
return NX_ERROR;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
/* write creation time, now done by NXopen
|
/* write creation time */
|
||||||
SNXFormatTime(pBueffel,512);
|
SNXFormatTime(pBueffel,512);
|
||||||
iStat = NXputattr(pFile,"file_time",pBueffel,
|
iStat = NXputattr(pFile,"file_time",pBueffel,
|
||||||
strlen(pBueffel)+1,NX_CHAR);
|
strlen(pBueffel)+1,DFNT_INT8);
|
||||||
if(iStat == NX_ERROR)
|
if(iStat == NX_ERROR)
|
||||||
{
|
{
|
||||||
return NX_ERROR;
|
return NX_ERROR;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
/* instrument name */
|
/* instrument name */
|
||||||
iStat = NXputattr(pFile,"instrument",instrument,
|
iStat = NXputattr(pFile,"instrument",instrument,
|
||||||
strlen(instrument)+1,NX_CHAR);
|
strlen(instrument)+1,DFNT_INT8);
|
||||||
if(iStat == NX_ERROR)
|
if(iStat == NX_ERROR)
|
||||||
{
|
{
|
||||||
return iStat;
|
return iStat;
|
||||||
@ -1726,7 +1748,7 @@
|
|||||||
|
|
||||||
/* owner */
|
/* owner */
|
||||||
iStat = NXputattr(pFile,"owner",owner,
|
iStat = NXputattr(pFile,"owner",owner,
|
||||||
strlen(owner)+1,NX_CHAR);
|
strlen(owner)+1,DFNT_INT8);
|
||||||
if(iStat == NX_ERROR)
|
if(iStat == NX_ERROR)
|
||||||
{
|
{
|
||||||
return iStat;
|
return iStat;
|
||||||
@ -1734,7 +1756,7 @@
|
|||||||
|
|
||||||
/* Adress */
|
/* Adress */
|
||||||
iStat = NXputattr(pFile,"owner_adress",adress,
|
iStat = NXputattr(pFile,"owner_adress",adress,
|
||||||
strlen(adress)+1,NX_CHAR);
|
strlen(adress)+1,DFNT_INT8);
|
||||||
if(iStat == NX_ERROR)
|
if(iStat == NX_ERROR)
|
||||||
{
|
{
|
||||||
return iStat;
|
return iStat;
|
||||||
@ -1742,7 +1764,7 @@
|
|||||||
|
|
||||||
/* phone */
|
/* phone */
|
||||||
iStat = NXputattr(pFile,"owner_telephone_number",phone,
|
iStat = NXputattr(pFile,"owner_telephone_number",phone,
|
||||||
strlen(phone)+1,NX_CHAR);
|
strlen(phone)+1,DFNT_INT8);
|
||||||
if(iStat == NX_ERROR)
|
if(iStat == NX_ERROR)
|
||||||
{
|
{
|
||||||
return iStat;
|
return iStat;
|
||||||
@ -1750,7 +1772,7 @@
|
|||||||
|
|
||||||
/* fax */
|
/* fax */
|
||||||
iStat = NXputattr(pFile,"owner_fax_number",fax,
|
iStat = NXputattr(pFile,"owner_fax_number",fax,
|
||||||
strlen(fax)+1,NX_CHAR);
|
strlen(fax)+1,DFNT_INT8);
|
||||||
if(iStat == NX_ERROR)
|
if(iStat == NX_ERROR)
|
||||||
{
|
{
|
||||||
return iStat;
|
return iStat;
|
||||||
@ -1758,14 +1780,20 @@
|
|||||||
|
|
||||||
/* email */
|
/* email */
|
||||||
iStat = NXputattr(pFile,"owner_email",email,
|
iStat = NXputattr(pFile,"owner_email",email,
|
||||||
strlen(email)+1,NX_CHAR);
|
strlen(email)+1,DFNT_INT8);
|
||||||
if(iStat == NX_ERROR)
|
if(iStat == NX_ERROR)
|
||||||
{
|
{
|
||||||
return iStat;
|
return iStat;
|
||||||
}
|
}
|
||||||
return NX_OK;
|
return NX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#line 2422 "nxdict.w"
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#line 2082 "nxdict.w"
|
||||||
|
|
||||||
NXstatus NXUentergroup(NXhandle hFil, char *name, char *class)
|
NXstatus NXUentergroup(NXhandle hFil, char *name, char *class)
|
||||||
{
|
{
|
||||||
void (*ErrFunc)(void *pData, char *pErr);
|
void (*ErrFunc)(void *pData, char *pErr);
|
||||||
@ -1800,7 +1828,13 @@
|
|||||||
}
|
}
|
||||||
return NX_OK;
|
return NX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#line 2424 "nxdict.w"
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#line 2119 "nxdict.w"
|
||||||
|
|
||||||
NXstatus NXUenterdata(NXhandle hFil, char *label, int datatype,
|
NXstatus NXUenterdata(NXhandle hFil, char *label, int datatype,
|
||||||
int rank, int dim[], char *pUnits)
|
int rank, int dim[], char *pUnits)
|
||||||
{
|
{
|
||||||
@ -1843,7 +1877,13 @@
|
|||||||
}
|
}
|
||||||
return NX_OK;
|
return NX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#line 2426 "nxdict.w"
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#line 2165 "nxdict.w"
|
||||||
|
|
||||||
NXstatus NXUallocSDS(NXhandle hFil, void **pData)
|
NXstatus NXUallocSDS(NXhandle hFil, void **pData)
|
||||||
{
|
{
|
||||||
int iDIM[MAX_VAR_DIMS];
|
int iDIM[MAX_VAR_DIMS];
|
||||||
@ -1873,8 +1913,6 @@
|
|||||||
lLength *= sizeof(float64);
|
lLength *= sizeof(float64);
|
||||||
break;
|
break;
|
||||||
case DFNT_INT8:
|
case DFNT_INT8:
|
||||||
case DFNT_CHAR:
|
|
||||||
case DFNT_UCHAR8:
|
|
||||||
lLength *= sizeof(int8);
|
lLength *= sizeof(int8);
|
||||||
break;
|
break;
|
||||||
case DFNT_UINT8:
|
case DFNT_UINT8:
|
||||||
@ -1905,10 +1943,15 @@
|
|||||||
NXIReportError(NXpData,"ERROR: memory exhausted in NXUallocSDS");
|
NXIReportError(NXpData,"ERROR: memory exhausted in NXUallocSDS");
|
||||||
return NX_ERROR;
|
return NX_ERROR;
|
||||||
}
|
}
|
||||||
memset(*pData,0,lLength);
|
|
||||||
return NX_OK;
|
return NX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#line 2428 "nxdict.w"
|
||||||
|
|
||||||
/*----------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#line 2229 "nxdict.w"
|
||||||
|
|
||||||
NXstatus NXUfreeSDS(void **pData)
|
NXstatus NXUfreeSDS(void **pData)
|
||||||
{
|
{
|
||||||
free(*pData);
|
free(*pData);
|
||||||
@ -1916,3 +1959,5 @@
|
|||||||
return NX_OK;
|
return NX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#line 2430 "nxdict.w"
|
||||||
|
|
||||||
|
6
nxdict.h
6
nxdict.h
@ -48,13 +48,7 @@
|
|||||||
NXstatus NXDgetalias(NXhandle file, NXdict dict,
|
NXstatus NXDgetalias(NXhandle file, NXdict dict,
|
||||||
char *alias, void *pData);
|
char *alias, void *pData);
|
||||||
NXstatus NXDgetdef(NXhandle file, NXdict dict, char *pDefString, void *pData);
|
NXstatus NXDgetdef(NXhandle file, NXdict dict, char *pDefString, void *pData);
|
||||||
|
|
||||||
NXstatus NXDinfoalias(NXhandle hFil, NXdict dict, char *pAlias, int *rank,
|
|
||||||
int dimension[], int *iType);
|
|
||||||
|
|
||||||
NXstatus NXDinfodef(NXhandle hFil, NXdict dict, char *pDef, int *rank,
|
|
||||||
int dimension[], int *iType);
|
|
||||||
|
|
||||||
NXstatus NXDaliaslink(NXhandle file, NXdict dict,
|
NXstatus NXDaliaslink(NXhandle file, NXdict dict,
|
||||||
char *pAlias1, char *pAlias2);
|
char *pAlias1, char *pAlias2);
|
||||||
NXstatus NXDdeflink(NXhandle file, NXdict dict,
|
NXstatus NXDdeflink(NXhandle file, NXdict dict,
|
||||||
|
28
nxdict.tex
28
nxdict.tex
@ -194,7 +194,7 @@ NexUs API which holds the dictionary information within a NeXus file.
|
|||||||
One additional data type is needed for this API:
|
One additional data type is needed for this API:
|
||||||
\begin{flushleft} \small
|
\begin{flushleft} \small
|
||||||
\begin{minipage}{\linewidth} \label{scrap1}
|
\begin{minipage}{\linewidth} \label{scrap1}
|
||||||
$\langle$tata {\footnotesize 4a}$\rangle\equiv$
|
$\langle$tata {\footnotesize ?}$\rangle\equiv$
|
||||||
\vspace{-1ex}
|
\vspace{-1ex}
|
||||||
\begin{list}{}{} \item
|
\begin{list}{}{} \item
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
@ -213,7 +213,7 @@ NXdict will be used as a handle for the dictionary currently in use.
|
|||||||
\subsubsection{Dictionary Maintainance Function}
|
\subsubsection{Dictionary Maintainance Function}
|
||||||
\begin{flushleft} \small
|
\begin{flushleft} \small
|
||||||
\begin{minipage}{\linewidth} \label{scrap2}
|
\begin{minipage}{\linewidth} \label{scrap2}
|
||||||
$\langle$dicman {\footnotesize 4b}$\rangle\equiv$
|
$\langle$dicman {\footnotesize ?}$\rangle\equiv$
|
||||||
\vspace{-1ex}
|
\vspace{-1ex}
|
||||||
\begin{list}{}{} \item
|
\begin{list}{}{} \item
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
@ -264,7 +264,7 @@ $\langle$dicman {\footnotesize 4b}$\rangle\equiv$
|
|||||||
\subsubsection{Data Handling functions}
|
\subsubsection{Data Handling functions}
|
||||||
\begin{flushleft} \small
|
\begin{flushleft} \small
|
||||||
\begin{minipage}{\linewidth} \label{scrap3}
|
\begin{minipage}{\linewidth} \label{scrap3}
|
||||||
$\langle$dicdata {\footnotesize 5}$\rangle\equiv$
|
$\langle$dicdata {\footnotesize ?}$\rangle\equiv$
|
||||||
\vspace{-1ex}
|
\vspace{-1ex}
|
||||||
\begin{list}{}{} \item
|
\begin{list}{}{} \item
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
@ -347,7 +347,7 @@ The NXDICT data handling functions go in pairs. The version ending in
|
|||||||
|
|
||||||
\begin{flushleft} \small
|
\begin{flushleft} \small
|
||||||
\begin{minipage}{\linewidth} \label{scrap4}
|
\begin{minipage}{\linewidth} \label{scrap4}
|
||||||
$\langle$dicutil {\footnotesize 6}$\rangle\equiv$
|
$\langle$dicutil {\footnotesize ?}$\rangle\equiv$
|
||||||
\vspace{-1ex}
|
\vspace{-1ex}
|
||||||
\begin{list}{}{} \item
|
\begin{list}{}{} \item
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
@ -411,7 +411,7 @@ the current approach poses a serious performance problem.
|
|||||||
Thus, the NXdict data structure looks like this:
|
Thus, the NXdict data structure looks like this:
|
||||||
\begin{flushleft} \small
|
\begin{flushleft} \small
|
||||||
\begin{minipage}{\linewidth} \label{scrap5}
|
\begin{minipage}{\linewidth} \label{scrap5}
|
||||||
$\langle$dicdat {\footnotesize 7}$\rangle\equiv$
|
$\langle$dicdat {\footnotesize ?}$\rangle\equiv$
|
||||||
\vspace{-1ex}
|
\vspace{-1ex}
|
||||||
\begin{list}{}{} \item
|
\begin{list}{}{} \item
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
@ -1155,7 +1155,7 @@ $\langle$deftok {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ {"-type",DTYPE},@\\
|
\mbox{}\verb@ {"-type",DTYPE},@\\
|
||||||
\mbox{}\verb@ {"-rank",DRANK},@\\
|
\mbox{}\verb@ {"-rank",DRANK},@\\
|
||||||
\mbox{}\verb@ {"-attr",DATTR},@\\
|
\mbox{}\verb@ {"-attr",DATTR},@\\
|
||||||
\mbox{}\verb@ {NULL,0} };@\\
|
\mbox{}\verb@ {"",0} };@\\
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
\mbox{}\verb@/*-----------------------------------------------------------------------*/@\\
|
\mbox{}\verb@/*-----------------------------------------------------------------------*/@\\
|
||||||
\mbox{}\verb@ static void NXDIDefToken(ParDat *sStat)@\\
|
\mbox{}\verb@ static void NXDIDefToken(ParDat *sStat)@\\
|
||||||
@ -1543,7 +1543,7 @@ $\langle$nxpasds {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ iRank = atoi(pParse->pToken);@\\
|
\mbox{}\verb@ iRank = atoi(pParse->pToken);@\\
|
||||||
\mbox{}\verb@ break;@\\
|
\mbox{}\verb@ break;@\\
|
||||||
\mbox{}\verb@ case DDIM:@\\
|
\mbox{}\verb@ case DDIM:@\\
|
||||||
\mbox{}\verb@ iRet = NXDIParseDim(pParse, iDim);@\\
|
\mbox{}\verb@ iRet = NXDIParseDim (pParse, (int *) iDim);@\\
|
||||||
\mbox{}\verb@ if(iRet == NX_ERROR)@\\
|
\mbox{}\verb@ if(iRet == NX_ERROR)@\\
|
||||||
\mbox{}\verb@ {@\\
|
\mbox{}\verb@ {@\\
|
||||||
\mbox{}\verb@ LLDdelete(iList);@\\
|
\mbox{}\verb@ LLDdelete(iList);@\\
|
||||||
@ -1599,7 +1599,7 @@ $\langle$nxpasds {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ /* we need to create it, if we may */@\\
|
\mbox{}\verb@ /* we need to create it, if we may */@\\
|
||||||
\mbox{}\verb@ if(pParse->iMayCreate)@\\
|
\mbox{}\verb@ if(pParse->iMayCreate)@\\
|
||||||
\mbox{}\verb@ {@\\
|
\mbox{}\verb@ {@\\
|
||||||
\mbox{}\verb@ iRet = NXmakedata(hfil,pName,iType, iRank,iDim);@\\
|
\mbox{}\verb@ iRet = NXmakedata (hfil, pName, iType, iRank, (int *) iDim);@\\
|
||||||
\mbox{}\verb@ if(iRet != NX_OK)@\\
|
\mbox{}\verb@ if(iRet != NX_OK)@\\
|
||||||
\mbox{}\verb@ { @\\
|
\mbox{}\verb@ { @\\
|
||||||
\mbox{}\verb@ /* a comment on this one has already been written! */@\\
|
\mbox{}\verb@ /* a comment on this one has already been written! */@\\
|
||||||
@ -1669,7 +1669,7 @@ $\langle$parsetype {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ {"DFNT_UINT16",DFNT_UINT16},@\\
|
\mbox{}\verb@ {"DFNT_UINT16",DFNT_UINT16},@\\
|
||||||
\mbox{}\verb@ {"DFNT_INT32",DFNT_INT32},@\\
|
\mbox{}\verb@ {"DFNT_INT32",DFNT_INT32},@\\
|
||||||
\mbox{}\verb@ {"DFNT_UINT32",DFNT_UINT32},@\\
|
\mbox{}\verb@ {"DFNT_UINT32",DFNT_UINT32},@\\
|
||||||
\mbox{}\verb@ {NULL,-122} };@\\
|
\mbox{}\verb@ {"",0} };@\\
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
@ -2737,15 +2737,15 @@ $\langle$free {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@#include "napi.h" /* make sure, napi is included */@\\
|
\mbox{}\verb@#include "napi.h" /* make sure, napi is included */@\\
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
\mbox{}\verb@/*-------------------- NXDict data types & defines ----------------------*/@\\
|
\mbox{}\verb@/*-------------------- NXDict data types & defines ----------------------*/@\\
|
||||||
\mbox{}\verb@@$\langle$tata {\footnotesize 4a}$\rangle$\verb@@\\
|
\mbox{}\verb@@$\langle$tata {\footnotesize ?}$\rangle$\verb@@\\
|
||||||
\mbox{}\verb@#define NXquiet 0@\\
|
\mbox{}\verb@#define NXquiet 0@\\
|
||||||
\mbox{}\verb@#define NXalot 1@\\
|
\mbox{}\verb@#define NXalot 1@\\
|
||||||
\mbox{}\verb@/*-------------------- Dictionary Maintainance ----------------------------*/@\\
|
\mbox{}\verb@/*-------------------- Dictionary Maintainance ----------------------------*/@\\
|
||||||
\mbox{}\verb@@$\langle$dicman {\footnotesize 4b}$\rangle$\verb@@\\
|
\mbox{}\verb@@$\langle$dicman {\footnotesize ?}$\rangle$\verb@@\\
|
||||||
\mbox{}\verb@/*----------------- Dictionary added data transfer -----------------------*/ @\\
|
\mbox{}\verb@/*----------------- Dictionary added data transfer -----------------------*/ @\\
|
||||||
\mbox{}\verb@@$\langle$dicdata {\footnotesize 5}$\rangle$\verb@@\\
|
\mbox{}\verb@@$\langle$dicdata {\footnotesize ?}$\rangle$\verb@@\\
|
||||||
\mbox{}\verb@/*-------------------- Utility Functions --------------------------------*/@\\
|
\mbox{}\verb@/*-------------------- Utility Functions --------------------------------*/@\\
|
||||||
\mbox{}\verb@@$\langle$dicutil {\footnotesize 6}$\rangle$\verb@@\\
|
\mbox{}\verb@@$\langle$dicutil {\footnotesize ?}$\rangle$\verb@@\\
|
||||||
\mbox{}\verb@#endif@\\
|
\mbox{}\verb@#endif@\\
|
||||||
\mbox{}\verb@@$\diamond$
|
\mbox{}\verb@@$\diamond$
|
||||||
\end{list}
|
\end{list}
|
||||||
@ -2804,7 +2804,7 @@ $\langle$free {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ dictionaries.@\\
|
\mbox{}\verb@ dictionaries.@\\
|
||||||
\mbox{}\verb@*/@\\
|
\mbox{}\verb@*/@\\
|
||||||
\mbox{}\verb@/*-------------------------------------------------------------------------*/@\\
|
\mbox{}\verb@/*-------------------------------------------------------------------------*/@\\
|
||||||
\mbox{}\verb@@$\langle$dicdat {\footnotesize 7}$\rangle$\verb@@\\
|
\mbox{}\verb@@$\langle$dicdat {\footnotesize ?}$\rangle$\verb@@\\
|
||||||
\mbox{}\verb@/*-------------------------------------------------------------------------*/@\\
|
\mbox{}\verb@/*-------------------------------------------------------------------------*/@\\
|
||||||
\mbox{}\verb@ static char *NXDIReadFile(FILE *fd)@\\
|
\mbox{}\verb@ static char *NXDIReadFile(FILE *fd)@\\
|
||||||
\mbox{}\verb@ {@\\
|
\mbox{}\verb@ {@\\
|
||||||
|
154
nxscript.c
154
nxscript.c
@ -234,6 +234,34 @@ static void putCounter(SConnection *pCon, SicsInterp *pSics, pNXScript self,
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
/*----------------------------------------------------------------------*/
|
||||||
|
static void updateHMDim(NXScript *self, pHistMem mem){
|
||||||
|
int iDim[MAXDIM];
|
||||||
|
int i, rank, timeLength, status;
|
||||||
|
char dummy[40], value[20];
|
||||||
|
const float *timeBin;
|
||||||
|
|
||||||
|
/*
|
||||||
|
update the dimension variables in the dictionary
|
||||||
|
*/
|
||||||
|
GetHistDim(mem,iDim,&rank);
|
||||||
|
for(i = 0; i < rank; i++){
|
||||||
|
sprintf(dummy,"dim%1.1d", i);
|
||||||
|
sprintf(value,"%d",iDim[i]);
|
||||||
|
status = NXDupdate(self->dictHandle,dummy,value);
|
||||||
|
if(status == 0) {
|
||||||
|
NXDadd(self->dictHandle,dummy,value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
timeBin = GetHistTimeBin(mem,&timeLength);
|
||||||
|
if(timeLength > 2){
|
||||||
|
sprintf(dummy,"%d",timeLength);
|
||||||
|
status = NXDupdate(self->dictHandle,"timedim",dummy);
|
||||||
|
if(status == 0) {
|
||||||
|
NXDadd(self->dictHandle,"timedim",dummy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
The sequence of things is important in here: The code for updating
|
The sequence of things is important in here: The code for updating
|
||||||
the dimensions variables also applies the time binning to the length.
|
the dimensions variables also applies the time binning to the length.
|
||||||
@ -244,11 +272,9 @@ static void putHistogramMemory(SConnection *pCon, SicsInterp *pSics,
|
|||||||
pNXScript self,
|
pNXScript self,
|
||||||
int argc, char *argv[]){
|
int argc, char *argv[]){
|
||||||
pHistMem mem = NULL;
|
pHistMem mem = NULL;
|
||||||
int status, start, length, iDim[MAXDIM], rank, i, subset = 0;
|
int status, start, length, i, subset = 0;
|
||||||
HistInt *iData = NULL;
|
HistInt *iData = NULL;
|
||||||
char buffer[256], dummy[40], value[20];
|
char buffer[256];
|
||||||
const float *timeBin;
|
|
||||||
int timeLength;
|
|
||||||
|
|
||||||
if(argc < 4){
|
if(argc < 4){
|
||||||
SCWrite(pCon,"ERROR: insufficient number of arguments to puthm",
|
SCWrite(pCon,"ERROR: insufficient number of arguments to puthm",
|
||||||
@ -272,26 +298,7 @@ static void putHistogramMemory(SConnection *pCon, SicsInterp *pSics,
|
|||||||
start = 0;
|
start = 0;
|
||||||
length = GetHistLength(mem);
|
length = GetHistLength(mem);
|
||||||
|
|
||||||
/*
|
updateHMDim(self,mem);
|
||||||
update the dimension variables in the dictionary
|
|
||||||
*/
|
|
||||||
GetHistDim(mem,iDim,&rank);
|
|
||||||
for(i = 0; i < rank; i++){
|
|
||||||
sprintf(dummy,"dim%1.1d", i);
|
|
||||||
sprintf(value,"%d",iDim[i]);
|
|
||||||
status = NXDupdate(self->dictHandle,dummy,value);
|
|
||||||
if(status == 0) {
|
|
||||||
NXDadd(self->dictHandle,dummy,value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
timeBin = GetHistTimeBin(mem,&timeLength);
|
|
||||||
if(timeLength > 2){
|
|
||||||
sprintf(dummy,"%d",timeLength);
|
|
||||||
status = NXDupdate(self->dictHandle,"timedim",dummy);
|
|
||||||
if(status == 0) {
|
|
||||||
NXDadd(self->dictHandle,"timedim",dummy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
check for further arguments specifying a subset
|
check for further arguments specifying a subset
|
||||||
@ -314,6 +321,105 @@ static void putHistogramMemory(SConnection *pCon, SicsInterp *pSics,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
read HM
|
||||||
|
*/
|
||||||
|
if(subset){
|
||||||
|
iData = (HistInt *)malloc(length*sizeof(HistInt));
|
||||||
|
if(!iData){
|
||||||
|
SCWrite(pCon,"ERROR: out of memory for reading histogram memory",
|
||||||
|
eError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
memset(iData,0,length*sizeof(HistInt));
|
||||||
|
status = GetHistogramDirect(mem,pCon,0,start,start+length,iData,
|
||||||
|
length*sizeof(HistInt));
|
||||||
|
}else{
|
||||||
|
/*
|
||||||
|
status = GetHistogram(mem,pCon,0,start,length,iData,
|
||||||
|
length*sizeof(HistInt));
|
||||||
|
*/
|
||||||
|
iData = GetHistogramPointer(mem,pCon);
|
||||||
|
if(iData == NULL){
|
||||||
|
status = 0;
|
||||||
|
} else {
|
||||||
|
status = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!status){
|
||||||
|
SCWrite(pCon,"ERROR: failed to read histogram memory",eError);
|
||||||
|
if(subset){
|
||||||
|
free(iData);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
finally: write
|
||||||
|
*/
|
||||||
|
status = NXDputalias(self->fileHandle, self->dictHandle,argv[2],iData);
|
||||||
|
if(status != NX_OK){
|
||||||
|
sprintf(buffer,"ERROR: failed to write histogram memory data");
|
||||||
|
SCWrite(pCon,buffer,eError);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(subset){
|
||||||
|
free(iData);
|
||||||
|
}
|
||||||
|
SCSendOK(pCon);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------
|
||||||
|
defunct as of december 2003
|
||||||
|
*/
|
||||||
|
static void putHistogramMemoryChunked(SConnection *pCon, SicsInterp *pSics,
|
||||||
|
pNXScript self,
|
||||||
|
int argc, char *argv[]){
|
||||||
|
pHistMem mem = NULL;
|
||||||
|
int status, start, length, i, noChunks, chunkDim[MAXDIM], rank;
|
||||||
|
HistInt *iData = NULL;
|
||||||
|
char buffer[256];
|
||||||
|
int subset;
|
||||||
|
|
||||||
|
if(argc < 5){
|
||||||
|
SCWrite(pCon,"ERROR: insufficient number of arguments to puthmchunked",
|
||||||
|
eError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
find Histogram Memory
|
||||||
|
*/
|
||||||
|
mem = (pHistMem)FindCommandData(pSics,argv[3],"HistMem");
|
||||||
|
if(!mem){
|
||||||
|
sprintf(buffer,"ERROR: HistMem %s not found!", argv[3]);
|
||||||
|
SCWrite(pCon,buffer,eError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
default: everything
|
||||||
|
*/
|
||||||
|
start = 0;
|
||||||
|
length = GetHistLength(mem);
|
||||||
|
|
||||||
|
updateHMDim(self,mem);
|
||||||
|
|
||||||
|
/*
|
||||||
|
check for an argument defining the number of chunks
|
||||||
|
*/
|
||||||
|
status = Tcl_GetInt(InterpGetTcl(pSics),argv[4],&noChunks);
|
||||||
|
if(status != TCL_OK){
|
||||||
|
sprintf(buffer,"ERROR: failed to convert %s to integer",
|
||||||
|
argv[4]);
|
||||||
|
SCWrite(pCon,buffer,eError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
read HM
|
read HM
|
||||||
*/
|
*/
|
||||||
|
289
nxupdate.c
Normal file
289
nxupdate.c
Normal file
@ -0,0 +1,289 @@
|
|||||||
|
/*-----------------------------------------------------------------------
|
||||||
|
Automatic update of NeXus files a scheduled time intervalls.
|
||||||
|
For more information see nxudpate.tex.
|
||||||
|
|
||||||
|
copyright: see file COPYRIGHT
|
||||||
|
|
||||||
|
Mark Koennecke, December 2003
|
||||||
|
----------------------------------------------------------------------*/
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include "fortify.h"
|
||||||
|
#include "sics.h"
|
||||||
|
#include "splitter.h"
|
||||||
|
#include "nxupdate.h"
|
||||||
|
#include "nxupdate.i"
|
||||||
|
/*-------------------------------------------------------------------*/
|
||||||
|
static int UpdateTask(void *pData){
|
||||||
|
pNXupdate self = NULL;
|
||||||
|
|
||||||
|
self = (pNXupdate)pData;
|
||||||
|
if(self == NULL){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
update when intervall reached or when end
|
||||||
|
*/
|
||||||
|
if(time(NULL) >= self->nextUpdate || self->iEnd == 1){
|
||||||
|
if(self->updateScript != NULL){
|
||||||
|
InterpExecute(pServ->pSics,self->pCon,self->updateScript);
|
||||||
|
}
|
||||||
|
self->nextUpdate = time(NULL) + self->updateIntervall;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(self->iEnd == 1){
|
||||||
|
self->pCon = NULL;
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
static int CountCallback(int iEvent, void *pEventData, void *pUser){
|
||||||
|
pNXupdate self = NULL;
|
||||||
|
SConnection *pCon = NULL;
|
||||||
|
|
||||||
|
self = (pNXupdate)pUser;
|
||||||
|
pCon = (SConnection *)pEventData;
|
||||||
|
if(iEvent == COUNTSTART){
|
||||||
|
assert(pCon);
|
||||||
|
assert(self);
|
||||||
|
/*
|
||||||
|
start file
|
||||||
|
*/
|
||||||
|
if(self->startScript != NULL){
|
||||||
|
InterpExecute(pServ->pSics,pCon,self->startScript);
|
||||||
|
}
|
||||||
|
if(self->updateScript != NULL){
|
||||||
|
InterpExecute(pServ->pSics,pCon,self->updateScript);
|
||||||
|
}
|
||||||
|
if(self->linkScript != NULL){
|
||||||
|
InterpExecute(pServ->pSics,pCon,self->linkScript);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
register update function
|
||||||
|
*/
|
||||||
|
self->nextUpdate = time(NULL) + self->updateIntervall;
|
||||||
|
self->iEnd = 0;
|
||||||
|
self->pCon = pCon;
|
||||||
|
TaskRegister(pServ->pTasker,UpdateTask,NULL,NULL,self,1);
|
||||||
|
return 1;
|
||||||
|
} else if(iEvent == COUNTEND){
|
||||||
|
self->iEnd = 1;
|
||||||
|
assert(self);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------*/
|
||||||
|
void KillUpdate(void *pData){
|
||||||
|
pNXupdate self = NULL;
|
||||||
|
|
||||||
|
self = (pNXupdate)pData;
|
||||||
|
if(self == NULL){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(self->startScript != NULL){
|
||||||
|
free(self->startScript);
|
||||||
|
self->startScript = NULL;
|
||||||
|
}
|
||||||
|
if(self->updateScript != NULL){
|
||||||
|
free(self->updateScript);
|
||||||
|
self->updateScript = NULL;
|
||||||
|
}
|
||||||
|
if(self->linkScript != NULL){
|
||||||
|
free(self->linkScript);
|
||||||
|
self->linkScript = NULL;
|
||||||
|
}
|
||||||
|
free(self);
|
||||||
|
}
|
||||||
|
/*-------------------------------------------------------------------*/
|
||||||
|
static void printUpdateList(SConnection *pCon, pNXupdate self, char *name){
|
||||||
|
char pBueffel[256];
|
||||||
|
|
||||||
|
snprintf(pBueffel,255,"%s.startScript = %s",name, self->startScript);
|
||||||
|
SCWrite(pCon,pBueffel,eValue);
|
||||||
|
snprintf(pBueffel,255,"%s.updateScript = %s",name, self->updateScript);
|
||||||
|
SCWrite(pCon,pBueffel,eValue);
|
||||||
|
snprintf(pBueffel,255,"%s.linkScript = %s",name, self->linkScript);
|
||||||
|
SCWrite(pCon,pBueffel,eValue);
|
||||||
|
snprintf(pBueffel,255,"%s.updateIntervall = %d",name,
|
||||||
|
self->updateIntervall);
|
||||||
|
SCWrite(pCon,pBueffel,eValue);
|
||||||
|
}
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
static int printUpdateParameters(SConnection *pCon, pNXupdate self,
|
||||||
|
char *name, char *param){
|
||||||
|
char pBueffel[256];
|
||||||
|
if(strcmp(param,"list") == 0){
|
||||||
|
printUpdateList(pCon,self, name);
|
||||||
|
return 1;
|
||||||
|
} else if(strcmp(param,"startscript") == 0){
|
||||||
|
snprintf(pBueffel,255,"%s.startScript = %s",name, self->startScript);
|
||||||
|
SCWrite(pCon,pBueffel,eValue);
|
||||||
|
return 1;
|
||||||
|
} else if(strcmp(param,"updatescript")== 0){
|
||||||
|
snprintf(pBueffel,255,"%s.updateScript = %s",name, self->updateScript);
|
||||||
|
SCWrite(pCon,pBueffel,eValue);
|
||||||
|
return 1;
|
||||||
|
} else if(strcmp(param,"linkscript") == 0){
|
||||||
|
snprintf(pBueffel,255,"%s.linkScript = %s",name, self->linkScript);
|
||||||
|
SCWrite(pCon,pBueffel,eValue);
|
||||||
|
return 1;
|
||||||
|
} else if(strcmp(param,"updateintervall") == 0){
|
||||||
|
snprintf(pBueffel,255,"%s.updateIntervall = %d",name,
|
||||||
|
self->updateIntervall);
|
||||||
|
SCWrite(pCon,pBueffel,eValue);
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
snprintf(pBueffel,255,"ERROR: parameter %s not known", param);
|
||||||
|
SCWrite(pCon,pBueffel,eValue);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------*/
|
||||||
|
static int configureUpdate(SConnection *pCon, pNXupdate self,
|
||||||
|
char *param, char *value){
|
||||||
|
char pBueffel[256];
|
||||||
|
int newUpdate;
|
||||||
|
|
||||||
|
if(strcmp(param,"startscript") == 0){
|
||||||
|
if(self->startScript != NULL){
|
||||||
|
free(self->startScript);
|
||||||
|
}
|
||||||
|
self->startScript = strdup(value);
|
||||||
|
SCSendOK(pCon);
|
||||||
|
return 1;
|
||||||
|
} else if(strcmp(param,"updatescript")== 0){
|
||||||
|
if(self->updateScript != NULL){
|
||||||
|
free(self->updateScript);
|
||||||
|
}
|
||||||
|
self->updateScript = strdup(value);
|
||||||
|
SCSendOK(pCon);
|
||||||
|
return 1;
|
||||||
|
} else if(strcmp(param,"linkscript") == 0){
|
||||||
|
if(self->linkScript != NULL){
|
||||||
|
free(self->linkScript);
|
||||||
|
}
|
||||||
|
self->linkScript = strdup(value);
|
||||||
|
SCSendOK(pCon);
|
||||||
|
return 1;
|
||||||
|
} else if(strcmp(param,"updateintervall") == 0){
|
||||||
|
if(Tcl_GetInt(InterpGetTcl(pServ->pSics),value,&newUpdate) != TCL_OK){
|
||||||
|
snprintf(pBueffel,255,
|
||||||
|
"ERROR: %s not an int, cannot set updateIntervall", value);
|
||||||
|
SCWrite(pCon,pBueffel,eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
self->updateIntervall = newUpdate;
|
||||||
|
SCSendOK(pCon);
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
snprintf(pBueffel,255,"ERROR: parameter %s not known", param);
|
||||||
|
SCWrite(pCon,pBueffel,eValue);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------*/
|
||||||
|
int UpdateAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
|
int argc, char *argv[]){
|
||||||
|
pNXupdate self = NULL;
|
||||||
|
char pBueffel[132];
|
||||||
|
|
||||||
|
self = (pNXupdate)pData;
|
||||||
|
assert(self);
|
||||||
|
|
||||||
|
if(argc < 2){
|
||||||
|
snprintf(pBueffel,131,"ERROR: need argument to %s", argv[0]);
|
||||||
|
SCWrite(pCon,pBueffel,eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(argc < 3){
|
||||||
|
strtolower(argv[1]);
|
||||||
|
return printUpdateParameters(pCon,self,argv[0], argv[1]);
|
||||||
|
} else {
|
||||||
|
Arg2Text(argc-2,&argv[2],pBueffel,131);
|
||||||
|
return configureUpdate(pCon,self,argv[1],pBueffel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
not reached
|
||||||
|
*/
|
||||||
|
assert(0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------*/
|
||||||
|
int UpdateFactory(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
|
int argc, char *argv[]){
|
||||||
|
pICountable pCount = NULL;
|
||||||
|
pICallBack pCall = NULL;
|
||||||
|
void *pPtr = NULL;
|
||||||
|
char pBueffel[256];
|
||||||
|
pNXupdate self = NULL;
|
||||||
|
CommandList *pCom = NULL;
|
||||||
|
|
||||||
|
if(argc < 3){
|
||||||
|
SCWrite(pCon,"ERROR: insuffcient number of argument to UpdateFactory",
|
||||||
|
eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
argv[1] = name
|
||||||
|
argv[2] = counter with which to register for automatic notifications
|
||||||
|
*/
|
||||||
|
pCom = FindCommand(pSics,argv[2]);
|
||||||
|
if(pCom){
|
||||||
|
pPtr = pCom->pData;
|
||||||
|
}
|
||||||
|
if(!pPtr){
|
||||||
|
snprintf(pBueffel,255,"ERROR: cannot find %s to register to", argv[2]);
|
||||||
|
SCWrite(pCon,pBueffel,eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
pCount = GetCountableInterface(pPtr);
|
||||||
|
pCall = GetCallbackInterface(pPtr);
|
||||||
|
if(!pCount || !pCall){
|
||||||
|
snprintf(pBueffel,255,"ERROR: %s is not a usable counter",argv[2]);
|
||||||
|
SCWrite(pCon,pBueffel,eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
allocate memory and initialize
|
||||||
|
*/
|
||||||
|
self = (pNXupdate)malloc(sizeof(NXupdate));
|
||||||
|
if(self == NULL){
|
||||||
|
SCWrite(pCon,"ERROR: out of memory in UpdateFactory",eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
memset(self,0,sizeof(NXupdate));
|
||||||
|
self->pDes = CreateDescriptor("AutoUpdate");
|
||||||
|
if(self->pDes == NULL){
|
||||||
|
SCWrite(pCon,"ERROR: out of memory in UpdateFactory",eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
self->startScript = strdup("UNDEFINED");
|
||||||
|
self->updateScript = strdup("UNDEFINED");
|
||||||
|
self->linkScript = strdup("UNDEFINED");
|
||||||
|
self->updateIntervall = 1200; /* 20 min */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
register callbacks
|
||||||
|
*/
|
||||||
|
RegisterCallback(pCall,COUNTSTART,CountCallback,
|
||||||
|
self,NULL);
|
||||||
|
RegisterCallback(pCall,COUNTEND,CountCallback,
|
||||||
|
self,NULL);
|
||||||
|
|
||||||
|
AddCommand(pSics,argv[1],UpdateAction,KillUpdate,self);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
20
nxupdate.h
Normal file
20
nxupdate.h
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
/*-----------------------------------------------------------------------
|
||||||
|
Automatic update of NeXus files a scheduled time intervalls.
|
||||||
|
For more information see nxudpate.tex.
|
||||||
|
|
||||||
|
copyright: see file COPYRIGHT
|
||||||
|
|
||||||
|
Mark Koennecke, December 2003
|
||||||
|
----------------------------------------------------------------------*/
|
||||||
|
#ifndef NXUPDATE
|
||||||
|
#define NXUPDATE
|
||||||
|
|
||||||
|
int UpdateAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
|
int argc, char *argv[]);
|
||||||
|
int UpdateFactory(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
|
int argc, char *argv[]);
|
||||||
|
|
||||||
|
void KillUpdate(void *pData);
|
||||||
|
#endif
|
||||||
|
|
94
nxupdate.w
Normal file
94
nxupdate.w
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
\subsection{NeXus File Update}
|
||||||
|
When performing long term measurements it is advisable to save the
|
||||||
|
current state of the measurement at regular time intervalls in order
|
||||||
|
to protect against loss of data caused by computer or software
|
||||||
|
failures. This is a general object which takes care of it. This is
|
||||||
|
meant to work closely with the nxscript module for scripting the
|
||||||
|
content of NeXus files but is not restricted to it. In general, the
|
||||||
|
user has to specify the names of three scripts or SICS commands which
|
||||||
|
implement the following functionality:
|
||||||
|
\begin{description}
|
||||||
|
\item[startScript] This script is supposed to write all constant data
|
||||||
|
and is called once when counting starts.
|
||||||
|
\item[updateScript] is called whenever an update is called for. This
|
||||||
|
script is supposed to create and update those datasets which vary in
|
||||||
|
the course of the measurement.
|
||||||
|
\item[linkScript] This script is called once when the measurement
|
||||||
|
starts after startScript and updateScript. Then the NeXus file is
|
||||||
|
complete enough to create all the links required. This has to be done
|
||||||
|
by this script.
|
||||||
|
\end{description}
|
||||||
|
The NeXus file is automatically updated when counting finishes.
|
||||||
|
|
||||||
|
|
||||||
|
The data structure for holding the information required by this
|
||||||
|
object:
|
||||||
|
@d nxupdate @{
|
||||||
|
typedef struct __NXUPDATE {
|
||||||
|
pObjectDescriptor pDes;
|
||||||
|
char *startScript;
|
||||||
|
char *updateScript;
|
||||||
|
char *linkScript;
|
||||||
|
int updateIntervall;
|
||||||
|
time_t nextUpdate;
|
||||||
|
int iEnd;
|
||||||
|
SConnection *pCon;
|
||||||
|
}NXupdate, *pNXupdate;
|
||||||
|
@}
|
||||||
|
The fields:
|
||||||
|
\begin{description}
|
||||||
|
\item[pDes] The standard object descriptor.
|
||||||
|
\item[startScript] The name of the program to call for starting a
|
||||||
|
file.
|
||||||
|
\item[updateScript] The name of the program to use for updating a
|
||||||
|
file.
|
||||||
|
\item[linkScript] The name of the program to use for creating links in
|
||||||
|
the NeXus file.
|
||||||
|
\item[updateIntervall] The time in seconds between updates.
|
||||||
|
\item[nextUpdate] The time value for the next scheduled update.
|
||||||
|
\item[iEnd] A flag which becomes 1 when counting ends and makes the
|
||||||
|
UpdateTask to stop.
|
||||||
|
\item[pCon] The connection for which we are updating.
|
||||||
|
\end{description}
|
||||||
|
|
||||||
|
This object has no public C interface. There is only ainterpreter
|
||||||
|
function which allows to configure the object and a factory function
|
||||||
|
for creating an object of this type.
|
||||||
|
|
||||||
|
@o nxupdate.h @{
|
||||||
|
/*-----------------------------------------------------------------------
|
||||||
|
Automatic update of NeXus files a scheduled time intervalls.
|
||||||
|
For more information see nxudpate.tex.
|
||||||
|
|
||||||
|
copyright: see file COPYRIGHT
|
||||||
|
|
||||||
|
Mark Koennecke, December 2003
|
||||||
|
----------------------------------------------------------------------*/
|
||||||
|
#ifndef NXUPDATE
|
||||||
|
#define NXUPDATE
|
||||||
|
|
||||||
|
int UpdateAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
|
int argc, char *argv[]);
|
||||||
|
int UpdateFactory(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
|
int argc, char *argv[]);
|
||||||
|
|
||||||
|
void KillUpdate(void *pData);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@}
|
||||||
|
|
||||||
|
@o nxupdate.i @{
|
||||||
|
/*-----------------------------------------------------------------------
|
||||||
|
Automatic update of NeXus files a scheduled time intervalls.
|
||||||
|
For more information see nxudpate.tex.
|
||||||
|
|
||||||
|
Internal, automatically generated file, do not modify. Modify in
|
||||||
|
nxudpate.w
|
||||||
|
|
||||||
|
copyright: see file COPYRIGHT
|
||||||
|
|
||||||
|
Mark Koennecke, December 2003
|
||||||
|
----------------------------------------------------------------------*/
|
||||||
|
@<nxupdate@>
|
||||||
|
|
||||||
|
@}
|
5
ofac.c
5
ofac.c
@ -101,7 +101,9 @@
|
|||||||
#include "tclintimpl.h"
|
#include "tclintimpl.h"
|
||||||
#include "tcldrivable.h"
|
#include "tcldrivable.h"
|
||||||
#include "sicsdata.h"
|
#include "sicsdata.h"
|
||||||
|
#include "help.h"
|
||||||
#include "site.h"
|
#include "site.h"
|
||||||
|
#include "nxupdate.h"
|
||||||
/*----------------------- Server options creation -------------------------*/
|
/*----------------------- Server options creation -------------------------*/
|
||||||
static int IFServerOption(SConnection *pCon, SicsInterp *pSics, void *pData,
|
static int IFServerOption(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
int argc, char *argv[])
|
int argc, char *argv[])
|
||||||
@ -223,6 +225,7 @@
|
|||||||
AddCommand(pInter,"sicscron",MakeCron,NULL,NULL);
|
AddCommand(pInter,"sicscron",MakeCron,NULL,NULL);
|
||||||
AddCommand(pInter,"sicsdatafactory",SICSDataFactory,NULL,NULL);
|
AddCommand(pInter,"sicsdatafactory",SICSDataFactory,NULL,NULL);
|
||||||
AddCommand(pInter,"scriptcallback",CallbackScript,NULL,NULL);
|
AddCommand(pInter,"scriptcallback",CallbackScript,NULL,NULL);
|
||||||
|
AddCommand(pInter,"help",SicsHelp,KillHelp,NULL);
|
||||||
|
|
||||||
/* commands to do with the executor. Only StopExe carries the
|
/* commands to do with the executor. Only StopExe carries the
|
||||||
DeleteFunction in order to avoid double deletion. All the
|
DeleteFunction in order to avoid double deletion. All the
|
||||||
@ -272,6 +275,7 @@
|
|||||||
AddCommand(pInter,"MakeTclInt",MakeTclInt,NULL,NULL);
|
AddCommand(pInter,"MakeTclInt",MakeTclInt,NULL,NULL);
|
||||||
AddCommand(pInter,"TclReplaceDrivable",TclReplaceDrivable,NULL,NULL);
|
AddCommand(pInter,"TclReplaceDrivable",TclReplaceDrivable,NULL,NULL);
|
||||||
AddCommand(pInter,"DrivableInvoke", TclDrivableInvoke,NULL,NULL);
|
AddCommand(pInter,"DrivableInvoke", TclDrivableInvoke,NULL,NULL);
|
||||||
|
AddCommand(pInter,"UpdateFactory",UpdateFactory,NULL,NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
install site specific commands
|
install site specific commands
|
||||||
@ -326,6 +330,7 @@
|
|||||||
RemoveCommand(pSics,"MakeGPIB");
|
RemoveCommand(pSics,"MakeGPIB");
|
||||||
RemoveCommand(pSics,"MakeNXScript");
|
RemoveCommand(pSics,"MakeNXScript");
|
||||||
RemoveCommand(pSics,"MakeTclInt");
|
RemoveCommand(pSics,"MakeTclInt");
|
||||||
|
RemoveCommand(pSics,"UpdateFactory");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
remove site specific installation commands
|
remove site specific installation commands
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#ifndef SERIALSICSWAIT
|
#ifndef SERIALSICSWAIT
|
||||||
#define SERIALSICSWAIT
|
#define SERIALSICSWAIT
|
||||||
#include "sics.h"
|
#include "sics.h"
|
||||||
#include "psi/hardsup/serialsinq.h"
|
#include "hardsup/serialsinq.h"
|
||||||
int SerialSicsExecute(void **pData, char *pCommand, char *pReply,
|
int SerialSicsExecute(void **pData, char *pCommand, char *pReply,
|
||||||
int iBufLen);
|
int iBufLen);
|
||||||
|
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
#include "HistMem.h"
|
#include "HistMem.h"
|
||||||
#include "sicsdata.h"
|
#include "sicsdata.h"
|
||||||
|
|
||||||
#define INTTYPE 0
|
|
||||||
#define FLOATTYPE 1
|
|
||||||
/*--------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------*/
|
||||||
static void KillSICSData(void *pData){
|
static void KillSICSData(void *pData){
|
||||||
pSICSData self = NULL;
|
pSICSData self = NULL;
|
||||||
@ -110,6 +108,10 @@ static void assignType(pSICSData self, int start, int end, int type){
|
|||||||
self->dataType[i] = type;
|
self->dataType[i] = type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*-----------------------------------------------------------------------*/
|
||||||
|
void assignSICSType(pSICSData self, int start, int end, int type){
|
||||||
|
assignType(self,start,end,type);
|
||||||
|
}
|
||||||
/*------------------------------------------------------------------------
|
/*------------------------------------------------------------------------
|
||||||
netEncode transforms the data in the array into network format.
|
netEncode transforms the data in the array into network format.
|
||||||
- int become ints in network byte order
|
- int become ints in network byte order
|
||||||
|
@ -11,6 +11,9 @@
|
|||||||
----------------------------------------------------------------------*/
|
----------------------------------------------------------------------*/
|
||||||
#ifndef SICSDATA
|
#ifndef SICSDATA
|
||||||
#define SICSDATA
|
#define SICSDATA
|
||||||
|
#define INTTYPE 0
|
||||||
|
#define FLOATTYPE 1
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
pObjectDescriptor pDes;
|
pObjectDescriptor pDes;
|
||||||
@ -27,6 +30,8 @@
|
|||||||
|
|
||||||
pSICSData createSICSData(void);
|
pSICSData createSICSData(void);
|
||||||
|
|
||||||
|
void assignSICSType(pSICSData self, int start, int end, int type);
|
||||||
|
|
||||||
int SICSDataFactory(SConnection *pCon, SicsInterp *pSics,
|
int SICSDataFactory(SConnection *pCon, SicsInterp *pSics,
|
||||||
void *pData,
|
void *pData,
|
||||||
int argc, char *argv[]);
|
int argc, char *argv[]);
|
||||||
|
@ -39,6 +39,8 @@ This object exports the following functions:
|
|||||||
|
|
||||||
pSICSData createSICSData(void);
|
pSICSData createSICSData(void);
|
||||||
|
|
||||||
|
void assignSICSType(pSICSData self, int start, int end, int type);
|
||||||
|
|
||||||
int SICSDataFactory(SConnection *pCon, SicsInterp *pSics,
|
int SICSDataFactory(SConnection *pCon, SicsInterp *pSics,
|
||||||
void *pData,
|
void *pData,
|
||||||
int argc, char *argv[]);
|
int argc, char *argv[]);
|
||||||
@ -71,6 +73,9 @@ which users may interact with the SICSData element.
|
|||||||
----------------------------------------------------------------------*/
|
----------------------------------------------------------------------*/
|
||||||
#ifndef SICSDATA
|
#ifndef SICSDATA
|
||||||
#define SICSDATA
|
#define SICSDATA
|
||||||
|
#define INTTYPE 0
|
||||||
|
#define FLOATTYPE 1
|
||||||
|
|
||||||
@<sidastruc@>
|
@<sidastruc@>
|
||||||
/*------------------------------------------------------------------*/
|
/*------------------------------------------------------------------*/
|
||||||
@<sidafunc@>
|
@<sidafunc@>
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
# Counter counter
|
||||||
|
counter SetPreset 300.000000
|
||||||
|
counter SetMode Timer
|
||||||
|
@ -32,7 +32,15 @@ static void syncLogin(void)
|
|||||||
connect
|
connect
|
||||||
*/
|
*/
|
||||||
connection = NETConnect(hostname, port);
|
connection = NETConnect(hostname, port);
|
||||||
NETRead(connection,pBueffel,1020,10*1000);
|
for(i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
NETRead(connection,pBueffel,1020,10*1000);
|
||||||
|
if(strstr(pBueffel,"OK") != NULL)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
SicsWait(1);
|
||||||
|
}
|
||||||
if(connection != NULL)
|
if(connection != NULL)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
2
token.h
2
token.h
@ -5,7 +5,7 @@
|
|||||||
This is the header file for the SICS token management
|
This is the header file for the SICS token management
|
||||||
functions. It implements the token command.
|
functions. It implements the token command.
|
||||||
|
|
||||||
Mark Koennecke, January 1998
|
Mark Koenencke, January 1998
|
||||||
|
|
||||||
copyright: see copyright.h
|
copyright: see copyright.h
|
||||||
|
|
||||||
|
201
varlog.c
201
varlog.c
@ -6,12 +6,16 @@
|
|||||||
|
|
||||||
Mark Koennecke, September 1997
|
Mark Koennecke, September 1997
|
||||||
|
|
||||||
Substantially revised to calculate running measn and standard deviations
|
Substantially revised to calculate running means and standard deviations
|
||||||
instead of storing data ain a list. The module now supports running
|
instead of storing data in a list. The module now supports running
|
||||||
averages and logging to file.
|
averages and logging to file.
|
||||||
|
|
||||||
Mark Koennecke, April 2000
|
Mark Koennecke, April 2000
|
||||||
|
|
||||||
|
Added support for a circular buffer of logged values.
|
||||||
|
|
||||||
|
Mark Koennecke, December 2003
|
||||||
|
|
||||||
Copyright:
|
Copyright:
|
||||||
|
|
||||||
Labor fuer Neutronenstreuung
|
Labor fuer Neutronenstreuung
|
||||||
@ -50,10 +54,17 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "fortify.h"
|
#include "fortify.h"
|
||||||
#include "lld.h"
|
#include "lld.h"
|
||||||
#include "conman.h"
|
#include "sics.h"
|
||||||
#include "varlog.h"
|
#include "varlog.h"
|
||||||
#include "commandlog.h"
|
#include "commandlog.h"
|
||||||
|
#include "circular.h"
|
||||||
|
#include "sicsdata.h"
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------*/
|
||||||
|
/*
|
||||||
|
maximum values in the circular buffer
|
||||||
|
*/
|
||||||
|
#define MAXRING 1024
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
typedef struct __VarLog
|
typedef struct __VarLog
|
||||||
{
|
{
|
||||||
@ -63,6 +74,7 @@
|
|||||||
double dSum;
|
double dSum;
|
||||||
double dDeviation;
|
double dDeviation;
|
||||||
FILE *fd;
|
FILE *fd;
|
||||||
|
pCircular pTail;
|
||||||
}VarLog;
|
}VarLog;
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
@ -87,6 +99,12 @@
|
|||||||
pNew->dSum = 0.;
|
pNew->dSum = 0.;
|
||||||
pNew->dDeviation = 0.;
|
pNew->dDeviation = 0.;
|
||||||
pNew->fd = NULL;
|
pNew->fd = NULL;
|
||||||
|
pNew->pTail = createCircular(MAXRING,free);
|
||||||
|
if(!pNew->pTail)
|
||||||
|
{
|
||||||
|
VarlogDelete(pNew);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
*self = pNew;
|
*self = pNew;
|
||||||
return 1;
|
return 1;
|
||||||
@ -98,6 +116,10 @@
|
|||||||
{
|
{
|
||||||
fclose(self->fd);
|
fclose(self->fd);
|
||||||
}
|
}
|
||||||
|
if(self->pTail != NULL)
|
||||||
|
{
|
||||||
|
deleteCircular(self->pTail);
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
@ -129,7 +151,8 @@
|
|||||||
int iFile = 0;
|
int iFile = 0;
|
||||||
char pBuffer[80];
|
char pBuffer[80];
|
||||||
double dMean, dTmp;
|
double dMean, dTmp;
|
||||||
|
pLogItem newLog = NULL;
|
||||||
|
|
||||||
assert(self);
|
assert(self);
|
||||||
|
|
||||||
tCurrent = time(NULL);
|
tCurrent = time(NULL);
|
||||||
@ -161,7 +184,7 @@
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if, log time passed, write to file */
|
/* if, log time passed, write to file and into ring buffer */
|
||||||
if(tCurrent > self->tNext)
|
if(tCurrent > self->tNext)
|
||||||
{
|
{
|
||||||
if(iFile)
|
if(iFile)
|
||||||
@ -169,6 +192,14 @@
|
|||||||
VLFormatTime(tCurrent,pBuffer,79);
|
VLFormatTime(tCurrent,pBuffer,79);
|
||||||
fprintf(self->fd," %s %f \n", pBuffer,fVal);
|
fprintf(self->fd," %s %f \n", pBuffer,fVal);
|
||||||
}
|
}
|
||||||
|
newLog = (pLogItem)malloc(sizeof(LogItem));
|
||||||
|
if(newLog != NULL)
|
||||||
|
{
|
||||||
|
newLog->tTime = tCurrent;
|
||||||
|
newLog->fVal = fVal;
|
||||||
|
setCircular(self->pTail,newLog);
|
||||||
|
nextCircular(self->pTail);
|
||||||
|
}
|
||||||
self->tNext = tCurrent + self->tFrequency;
|
self->tNext = tCurrent + self->tFrequency;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -203,6 +234,112 @@
|
|||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
/*-----------------------------------------------------------------------*/
|
||||||
|
static int VarlogToSicsData(pVarLog self, pSICSData data)
|
||||||
|
{
|
||||||
|
int i, length;
|
||||||
|
int *dataPtr = NULL;
|
||||||
|
pLogItem log = NULL;
|
||||||
|
|
||||||
|
dataPtr = getSICSDataPointer(data,0,2*MAXRING+1);
|
||||||
|
if(!dataPtr)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
dataPtr[0] = MAXRING;
|
||||||
|
|
||||||
|
/*
|
||||||
|
skip back MAXRING steps
|
||||||
|
*/
|
||||||
|
for(i = 0; i < MAXRING; i++)
|
||||||
|
{
|
||||||
|
previousCircular(self->pTail);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
forward again and copy data
|
||||||
|
*/
|
||||||
|
for(i = 0; i < MAXRING; i++)
|
||||||
|
{
|
||||||
|
log = getCircular(self->pTail);
|
||||||
|
if(log != NULL)
|
||||||
|
{
|
||||||
|
dataPtr[i+1] = (int)log->tTime;
|
||||||
|
memcpy(&dataPtr[i+1+MAXRING],&log->fVal,sizeof(float));
|
||||||
|
}
|
||||||
|
nextCircular(self->pTail);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
assign data types
|
||||||
|
*/
|
||||||
|
assignSICSType(data,0,MAXRING+1,INTTYPE);
|
||||||
|
assignSICSType(data,MAXRING+1,2*MAXRING+1,FLOATTYPE);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------------------*/
|
||||||
|
static void VarlogDump(pVarLog self, SConnection *pCon)
|
||||||
|
{
|
||||||
|
int i, length;
|
||||||
|
pLogItem log = NULL;
|
||||||
|
char timeBuffer[132], pBueffel[256];
|
||||||
|
|
||||||
|
/*
|
||||||
|
skip back MAXRING steps
|
||||||
|
*/
|
||||||
|
for(i = 0; i < MAXRING; i++)
|
||||||
|
{
|
||||||
|
previousCircular(self->pTail);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
forward again and print data
|
||||||
|
*/
|
||||||
|
for(i = 0; i < MAXRING; i++)
|
||||||
|
{
|
||||||
|
log = getCircular(self->pTail);
|
||||||
|
if(log != NULL)
|
||||||
|
{
|
||||||
|
if(log->tTime > 0)
|
||||||
|
{
|
||||||
|
VLFormatTime(log->tTime,timeBuffer,131);
|
||||||
|
snprintf(pBueffel,255,"%s %12.3f",timeBuffer,log->fVal);
|
||||||
|
SCWrite(pCon,pBueffel,eValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nextCircular(self->pTail);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------------------*/
|
||||||
|
static void VarLogDumpFile(pVarLog self, FILE *fd)
|
||||||
|
{
|
||||||
|
int i, length;
|
||||||
|
pLogItem log = NULL;
|
||||||
|
char timeBuffer[132], pBueffel[256];
|
||||||
|
|
||||||
|
/*
|
||||||
|
skip back MAXRING steps
|
||||||
|
*/
|
||||||
|
for(i = 0; i < MAXRING; i++)
|
||||||
|
{
|
||||||
|
previousCircular(self->pTail);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
forward again and print data
|
||||||
|
*/
|
||||||
|
for(i = 0; i < MAXRING; i++)
|
||||||
|
{
|
||||||
|
log = getCircular(self->pTail);
|
||||||
|
if(log != NULL)
|
||||||
|
{
|
||||||
|
if(log->tTime > 0)
|
||||||
|
{
|
||||||
|
VLFormatTime(log->tTime,timeBuffer,131);
|
||||||
|
fprintf(fd,"%s %12.3f",timeBuffer,log->fVal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nextCircular(self->pTail);
|
||||||
|
}
|
||||||
|
}
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
int VarlogWrapper(pVarLog self, SConnection *pCon,
|
int VarlogWrapper(pVarLog self, SConnection *pCon,
|
||||||
char *subcommand, char *sub2, char *pVarName)
|
char *subcommand, char *sub2, char *pVarName)
|
||||||
@ -213,6 +350,8 @@
|
|||||||
char pBueffel[256];
|
char pBueffel[256];
|
||||||
char *pData = NULL;
|
char *pData = NULL;
|
||||||
long lNew;
|
long lNew;
|
||||||
|
pSICSData data = NULL;
|
||||||
|
FILE *fd = NULL;
|
||||||
|
|
||||||
|
|
||||||
strtolower(subcommand);
|
strtolower(subcommand);
|
||||||
@ -314,7 +453,55 @@
|
|||||||
SCWrite(pCon,pBueffel,eValue);
|
SCWrite(pCon,pBueffel,eValue);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*-------------- tosicsdata */
|
||||||
|
else if(strcmp(subcommand,"tosicsdata") == 0)
|
||||||
|
{
|
||||||
|
if(!sub2)
|
||||||
|
{
|
||||||
|
SCWrite(pCon,"ERROR: tosicsdata needs an argument",eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
data = FindCommandData(pServ->pSics,sub2,"SICSData");
|
||||||
|
if(!data)
|
||||||
|
{
|
||||||
|
snprintf(pBueffel,255,"ERROR: %s is no sicsdata object",sub2);
|
||||||
|
SCWrite(pCon,pBueffel,eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
iRet = VarlogToSicsData(self,data);
|
||||||
|
if(iRet == 0)
|
||||||
|
{
|
||||||
|
SCWrite(pCon,"ERROR: out of memory in VarlogToSicsData",eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
SCSendOK(pCon);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
/* ---------------- dumpring */
|
||||||
|
else if(strcmp(subcommand,"dump") == 0)
|
||||||
|
{
|
||||||
|
VarlogDump(self,pCon);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
/*---------------- dumptofile */
|
||||||
|
else if(strcmp(subcommand,"dumptofile") == 0)
|
||||||
|
{
|
||||||
|
if(sub2 != NULL)
|
||||||
|
{
|
||||||
|
fd = fopen(sub2,"w");
|
||||||
|
}
|
||||||
|
if(fd == NULL)
|
||||||
|
{
|
||||||
|
snprintf(pBueffel,255,"ERROR: failed to open %s",sub2);
|
||||||
|
SCWrite(pCon,pBueffel,eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
VarLogDumpFile(self,fd);
|
||||||
|
fclose(fd);
|
||||||
|
SCSendOK(pCon);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
/* command not recognized */
|
/* command not recognized */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -323,3 +510,5 @@
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
4
varlog.h
4
varlog.h
@ -23,9 +23,11 @@
|
|||||||
int VarlogAdd(pVarLog self, float fVal);
|
int VarlogAdd(pVarLog self, float fVal);
|
||||||
/*------------------------------ data recovery -------------------------*/
|
/*------------------------------ data recovery -------------------------*/
|
||||||
int VarlogLength(pVarLog self, int *iLength);
|
int VarlogLength(pVarLog self, int *iLength);
|
||||||
|
int VarlogGetTime(pVarLog self, time_t *tTime);
|
||||||
|
int VarlogGetVal(pVarLog self, float *fValues);
|
||||||
int VarlogGetMean(pVarLog self, float *fMean, float *fStdDev);
|
int VarlogGetMean(pVarLog self, float *fMean, float *fStdDev);
|
||||||
/*------------------------------ interpreter ---------------------------*/
|
/*------------------------------ interpreter ---------------------------*/
|
||||||
int VarlogWrapper(pVarLog self, SConnection *pCon,
|
int VarlogWrapper(pVarLog self,SConnection *pCon,
|
||||||
char *subcommand, char *sub2,char *pVarName);
|
char *subcommand, char *sub2,char *pVarName);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -27,7 +27,7 @@ $\langle$logint {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ int VarlogGetVal(pVarLog self, float *fValues);@\\
|
\mbox{}\verb@ int VarlogGetVal(pVarLog self, float *fValues);@\\
|
||||||
\mbox{}\verb@ int VarlogGetMean(pVarLog self, float *fMean, float *fStdDev);@\\
|
\mbox{}\verb@ int VarlogGetMean(pVarLog self, float *fMean, float *fStdDev);@\\
|
||||||
\mbox{}\verb@/*------------------------------ interpreter ---------------------------*/@\\
|
\mbox{}\verb@/*------------------------------ interpreter ---------------------------*/@\\
|
||||||
\mbox{}\verb@ int VarlogWrapper(pVarLog self, int *iSwitch, SConnection *pCon, @\\
|
\mbox{}\verb@ int VarlogWrapper(pVarLog self,SConnection *pCon, @\\
|
||||||
\mbox{}\verb@ char *subcommand, char *sub2,char *pVarName);@\\
|
\mbox{}\verb@ char *subcommand, char *sub2,char *pVarName);@\\
|
||||||
\mbox{}\verb@@$\diamond$
|
\mbox{}\verb@@$\diamond$
|
||||||
\end{list}
|
\end{list}
|
||||||
|
2
varlog.w
2
varlog.w
@ -22,7 +22,7 @@ The following functions are provided:
|
|||||||
int VarlogGetVal(pVarLog self, float *fValues);
|
int VarlogGetVal(pVarLog self, float *fValues);
|
||||||
int VarlogGetMean(pVarLog self, float *fMean, float *fStdDev);
|
int VarlogGetMean(pVarLog self, float *fMean, float *fStdDev);
|
||||||
/*------------------------------ interpreter ---------------------------*/
|
/*------------------------------ interpreter ---------------------------*/
|
||||||
int VarlogWrapper(pVarLog self, int *iSwitch, SConnection *pCon,
|
int VarlogWrapper(pVarLog self,SConnection *pCon,
|
||||||
char *subcommand, char *sub2,char *pVarName);
|
char *subcommand, char *sub2,char *pVarName);
|
||||||
@}
|
@}
|
||||||
|
|
||||||
|
@ -44,6 +44,8 @@
|
|||||||
|
|
||||||
/*-------------------- live & death ----------------------------------------*/
|
/*-------------------- live & death ----------------------------------------*/
|
||||||
pVelSelDriv VSCreateSim(void);
|
pVelSelDriv VSCreateSim(void);
|
||||||
|
pVelSelDriv VSCreateDornierSINQ(char *name,Tcl_Interp *pTcl);
|
||||||
|
|
||||||
void VSDeleteDriver(pVelSelDriv self);
|
void VSDeleteDriver(pVelSelDriv self);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
50
wwildcard.c
Normal file
50
wwildcard.c
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#define MAX_CALLS 200
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
int match(const char *mask, const char *name)
|
||||||
|
{
|
||||||
|
int calls=0, wild=0, q=0;
|
||||||
|
const char *m=mask, *n=name, *ma=mask, *na=name;
|
||||||
|
|
||||||
|
for(;;) {
|
||||||
|
if (++calls > MAX_CALLS) return 1;
|
||||||
|
if (*m == '*') {
|
||||||
|
while (*m == '*') ++m;
|
||||||
|
wild = 1;
|
||||||
|
ma = m;
|
||||||
|
na = n;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!*m) {
|
||||||
|
if (!*n) return 0;
|
||||||
|
|
||||||
|
for (--m; (m > mask) && (*m == '?'); --m) ;
|
||||||
|
|
||||||
|
if ((*m == '*') && (m > mask) &&
|
||||||
|
(m[-1] != '\\'))
|
||||||
|
return 0;
|
||||||
|
if (!wild)
|
||||||
|
return 1;
|
||||||
|
m = ma;
|
||||||
|
} else if (!*n) {
|
||||||
|
while(*m == '*') ++m;
|
||||||
|
return (*m != 0);
|
||||||
|
}
|
||||||
|
if ((*m == '\\') && ((m[1] == '*') || (m[1] == '?'))) {
|
||||||
|
++m;
|
||||||
|
q = 1;
|
||||||
|
} else {
|
||||||
|
q = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((tolower(*m) != tolower(*n)) && ((*m != '?') || q)) {
|
||||||
|
if (!wild) return 1;
|
||||||
|
m = ma;
|
||||||
|
n = ++na;
|
||||||
|
} else {
|
||||||
|
if (*m) ++m;
|
||||||
|
if (*n) ++n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Reference in New Issue
Block a user