Update from PSI
r1039 | ffr | 2006-08-03 09:59:29 +1000 (Thu, 03 Aug 2006) | 2 lines
This commit is contained in:

committed by
Douglas Clowes

parent
4aa50787c2
commit
074f1cb3cd
46
SCinter.c
46
SCinter.c
@ -57,6 +57,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <tcl.h>
|
#include <tcl.h>
|
||||||
|
#include <time.h>
|
||||||
#include "fortify.h"
|
#include "fortify.h"
|
||||||
#include "sics.h"
|
#include "sics.h"
|
||||||
#include "splitter.h"
|
#include "splitter.h"
|
||||||
@ -151,6 +152,7 @@ static void freeList(int listID);
|
|||||||
pNew->pData = pData;
|
pNew->pData = pData;
|
||||||
pNew->pNext = NULL;
|
pNew->pNext = NULL;
|
||||||
pNew->startupOnly = startupOnly;
|
pNew->startupOnly = startupOnly;
|
||||||
|
pNew->stat = StatisticsNew(pBueffel);
|
||||||
|
|
||||||
/* find end of list */
|
/* find end of list */
|
||||||
tail = NULL;
|
tail = NULL;
|
||||||
@ -232,10 +234,14 @@ static void freeList(int listID);
|
|||||||
{
|
{
|
||||||
pInterp->pCList = pVictim->pNext;
|
pInterp->pCList = pVictim->pNext;
|
||||||
}
|
}
|
||||||
|
if (pVictim->stat) {
|
||||||
|
StatisticsKill(pVictim->stat);
|
||||||
|
}
|
||||||
free(pVictim);
|
free(pVictim);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define MAXLEN 256
|
#define MAXLEN 256
|
||||||
#define MAXCOM 50
|
#define MAXCOM 50
|
||||||
extern char *stptok(char *s, char *tok, unsigned int toklen, char *brk);
|
extern char *stptok(char *s, char *tok, unsigned int toklen, char *brk);
|
||||||
@ -252,6 +258,7 @@ extern char *SkipSpace(char *pPtr);
|
|||||||
char *pPtr;
|
char *pPtr;
|
||||||
char **argv = NULL;
|
char **argv = NULL;
|
||||||
commandContext comCon;
|
commandContext comCon;
|
||||||
|
Statistics *old;
|
||||||
|
|
||||||
|
|
||||||
assert(self);
|
assert(self);
|
||||||
@ -307,7 +314,9 @@ extern char *SkipSpace(char *pPtr);
|
|||||||
Tcl_ResetResult((Tcl_Interp *)self->pTcl);
|
Tcl_ResetResult((Tcl_Interp *)self->pTcl);
|
||||||
MacroPush(pCon);
|
MacroPush(pCon);
|
||||||
pCon->conStatus = 0;
|
pCon->conStatus = 0;
|
||||||
|
old = StatisticsBegin(pCommand->stat);
|
||||||
iRet = pCommand->OFunc(pCon, self, pCommand->pData, argc, argv);
|
iRet = pCommand->OFunc(pCon, self, pCommand->pData, argc, argv);
|
||||||
|
StatisticsEnd(old);
|
||||||
/* If a task is registered with the dev exec then conStatus is HWBusy*/
|
/* If a task is registered with the dev exec then conStatus is HWBusy*/
|
||||||
if (pCon->conStatus != HWBusy) {
|
if (pCon->conStatus != HWBusy) {
|
||||||
comCon = SCGetContext(pCon);
|
comCon = SCGetContext(pCon);
|
||||||
@ -444,29 +453,40 @@ extern char *SkipSpace(char *pPtr);
|
|||||||
void DeleteInterp(SicsInterp *self)
|
void DeleteInterp(SicsInterp *self)
|
||||||
{
|
{
|
||||||
CommandList *pCurrent = NULL;
|
CommandList *pCurrent = NULL;
|
||||||
CommandList *pTemp;
|
CommandList *pTemp, *tail;
|
||||||
Tcl_Interp *pTcl = NULL;
|
Tcl_Interp *pTcl = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
assert(self);
|
assert(self);
|
||||||
self->iDeleting = 1;
|
self->iDeleting = 1;
|
||||||
|
|
||||||
/* delete Commandlist */
|
/* find end of list */
|
||||||
|
tail = NULL;
|
||||||
pCurrent = self->pCList;
|
pCurrent = self->pCList;
|
||||||
while(pCurrent)
|
while(pCurrent != NULL)
|
||||||
{
|
{
|
||||||
if(pCurrent->KFunc)
|
tail = pCurrent;
|
||||||
|
pCurrent = pCurrent->pNext;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* delete Commandlist (reversed order) */
|
||||||
|
if (tail) {
|
||||||
|
pCurrent = tail;
|
||||||
|
while(pCurrent)
|
||||||
{
|
{
|
||||||
pCurrent->KFunc(pCurrent->pData);
|
if(pCurrent->KFunc)
|
||||||
|
{
|
||||||
|
pCurrent->KFunc(pCurrent->pData);
|
||||||
|
}
|
||||||
|
if(pCurrent->pName)
|
||||||
|
{
|
||||||
|
/* printf("Deleting %s\n",pCurrent->pName); */
|
||||||
|
free(pCurrent->pName);
|
||||||
|
}
|
||||||
|
pTemp = pCurrent->pPrevious;
|
||||||
|
free(pCurrent);
|
||||||
|
pCurrent = pTemp;
|
||||||
}
|
}
|
||||||
if(pCurrent->pName)
|
|
||||||
{
|
|
||||||
/* printf("Deleting %s\n",pCurrent->pName); */
|
|
||||||
free(pCurrent->pName);
|
|
||||||
}
|
|
||||||
pTemp = pCurrent->pNext;
|
|
||||||
free(pCurrent);
|
|
||||||
pCurrent = pTemp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FreeAliasList(&self->AList); /* M.Z. */
|
FreeAliasList(&self->AList); /* M.Z. */
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#ifndef SICSINTERPRETER
|
#ifndef SICSINTERPRETER
|
||||||
#define SICSINTERPRETER
|
#define SICSINTERPRETER
|
||||||
#include "Scommon.h"
|
#include "Scommon.h"
|
||||||
|
#include "statistics.h"
|
||||||
#include <tcl.h>
|
#include <tcl.h>
|
||||||
/* M.Z. */
|
/* M.Z. */
|
||||||
#include "definealias.i"
|
#include "definealias.i"
|
||||||
@ -31,6 +32,7 @@ typedef struct __Clist {
|
|||||||
struct __Clist *pNext;
|
struct __Clist *pNext;
|
||||||
struct __Clist *pPrevious;
|
struct __Clist *pPrevious;
|
||||||
int startupOnly;
|
int startupOnly;
|
||||||
|
Statistics *stat;
|
||||||
} CommandList;
|
} CommandList;
|
||||||
|
|
||||||
typedef struct __SINTER
|
typedef struct __SINTER
|
||||||
|
22
access.c
22
access.c
@ -3,8 +3,9 @@
|
|||||||
|
|
||||||
Mark Koennecke, November 1996
|
Mark Koennecke, November 1996
|
||||||
----------------------------------------------------------------------------*/
|
----------------------------------------------------------------------------*/
|
||||||
#ifndef PCODE
|
#include <string.h>
|
||||||
#define PCODE
|
#include <sics.h>
|
||||||
|
#include <splitter.h>
|
||||||
|
|
||||||
static char *aCode[] = {
|
static char *aCode[] = {
|
||||||
"internal",
|
"internal",
|
||||||
@ -13,4 +14,19 @@
|
|||||||
"spy",
|
"spy",
|
||||||
NULL };
|
NULL };
|
||||||
static int iCodes = 4;
|
static int iCodes = 4;
|
||||||
#endif
|
/*--------------------------------------------------------------------------*/
|
||||||
|
int decodeSICSPriv(char *privText){
|
||||||
|
int code = 0;
|
||||||
|
|
||||||
|
strtolower(privText);
|
||||||
|
while(aCode[code] != NULL){
|
||||||
|
if(strcmp(aCode[code], privText) == 0){
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
code++;
|
||||||
|
}
|
||||||
|
if(code >= iCodes){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
4
choco.c
4
choco.c
@ -99,7 +99,7 @@
|
|||||||
|
|
||||||
if(argc < 2)
|
if(argc < 2)
|
||||||
{
|
{
|
||||||
sprintf(pMessage, "ERROR: Ragument required for %s",argv[0]);
|
sprintf(pMessage, "ERROR: argument required for %s",argv[0]);
|
||||||
SCWrite(pCon,pMessage,eError);
|
SCWrite(pCon,pMessage,eError);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -149,7 +149,7 @@
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*----------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------*/
|
||||||
static void KillChoco(void *pData)
|
void KillChoco(void *pData)
|
||||||
{
|
{
|
||||||
pChoco self = NULL;
|
pChoco self = NULL;
|
||||||
|
|
||||||
|
1
choco.h
1
choco.h
@ -19,6 +19,7 @@
|
|||||||
pCodri CHGetDriver(pChoco self);
|
pCodri CHGetDriver(pChoco self);
|
||||||
int CHList(pChoco self, SConnection *pCon, char *name);
|
int CHList(pChoco self, SConnection *pCon, char *name);
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
void KillChoco(void *pData);
|
||||||
int ChocoAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
int ChocoAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
int argc, char *argv[]);
|
int argc, char *argv[]);
|
||||||
int ChocoFactory(SConnection *pCon, SicsInterp *pSics, void *pData,
|
int ChocoFactory(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
|
@ -85,7 +85,7 @@ controller driver.
|
|||||||
\item[SetPar] tries to set the parameter parname to the value
|
\item[SetPar] tries to set the parameter parname to the value
|
||||||
fValue. The last is floating point which covers the frequent
|
fValue. The last is floating point which covers the frequent
|
||||||
occurence of numeric values.
|
occurence of numeric values.
|
||||||
\item[SetPar2] The same as SetPar but uses test string as input for
|
\item[SetPar2] The same as SetPar but uses text string as input for
|
||||||
parameter setting.
|
parameter setting.
|
||||||
\item[GetPar] retrieves the parameter parname formatted as text. The
|
\item[GetPar] retrieves the parameter parname formatted as text. The
|
||||||
value is put into the buffer pBuffer. iBufLen is the maximum number of
|
value is put into the buffer pBuffer. iBufLen is the maximum number of
|
||||||
@ -129,6 +129,7 @@ $\langle$chocoint {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ pCodri CHGetDriver(pChoco self);@\\
|
\mbox{}\verb@ pCodri CHGetDriver(pChoco self);@\\
|
||||||
\mbox{}\verb@ int CHList(pChoco self, SConnection *pCon, char *name);@\\
|
\mbox{}\verb@ int CHList(pChoco self, SConnection *pCon, char *name);@\\
|
||||||
\mbox{}\verb@/*------------------------------------------------------------------------*/@\\
|
\mbox{}\verb@/*------------------------------------------------------------------------*/@\\
|
||||||
|
\mbox{}\verb@ void KillChoco(void *pData);@\\
|
||||||
\mbox{}\verb@ int ChocoAction(SConnection *pCon, SicsInterp *pSics, void *pData,@\\
|
\mbox{}\verb@ int ChocoAction(SConnection *pCon, SicsInterp *pSics, void *pData,@\\
|
||||||
\mbox{}\verb@ int argc, char *argv[]);@\\
|
\mbox{}\verb@ int argc, char *argv[]);@\\
|
||||||
\mbox{}\verb@ int ChocoFactory(SConnection *pCon, SicsInterp *pSics, void *pData,@\\
|
\mbox{}\verb@ int ChocoFactory(SConnection *pCon, SicsInterp *pSics, void *pData,@\\
|
||||||
@ -366,8 +367,7 @@ $\langle$evada {\footnotesize ?}$\rangle\equiv$
|
|||||||
\subsubsection{To Do}
|
\subsubsection{To Do}
|
||||||
This scheme seems to be quite promising for handling many SICS
|
This scheme seems to be quite promising for handling many SICS
|
||||||
objects. The following enhancements could be considered. Allow to set
|
objects. The following enhancements could be considered. Allow to set
|
||||||
certain primitive parameters without a drivable interface. And add an
|
certain primitive parameters without a drivable interface.
|
||||||
adapter for an environment variable in the controller.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
6
choco.w
6
choco.w
@ -72,7 +72,7 @@ controller driver.
|
|||||||
\item[SetPar] tries to set the parameter parname to the value
|
\item[SetPar] tries to set the parameter parname to the value
|
||||||
fValue. The last is floating point which covers the frequent
|
fValue. The last is floating point which covers the frequent
|
||||||
occurence of numeric values.
|
occurence of numeric values.
|
||||||
\item[SetPar2] The same as SetPar but uses test string as input for
|
\item[SetPar2] The same as SetPar but uses text string as input for
|
||||||
parameter setting.
|
parameter setting.
|
||||||
\item[GetPar] retrieves the parameter parname formatted as text. The
|
\item[GetPar] retrieves the parameter parname formatted as text. The
|
||||||
value is put into the buffer pBuffer. iBufLen is the maximum number of
|
value is put into the buffer pBuffer. iBufLen is the maximum number of
|
||||||
@ -111,6 +111,7 @@ includes:
|
|||||||
pCodri CHGetDriver(pChoco self);
|
pCodri CHGetDriver(pChoco self);
|
||||||
int CHList(pChoco self, SConnection *pCon, char *name);
|
int CHList(pChoco self, SConnection *pCon, char *name);
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
void KillChoco(void *pData);
|
||||||
int ChocoAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
int ChocoAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
int argc, char *argv[]);
|
int argc, char *argv[]);
|
||||||
int ChocoFactory(SConnection *pCon, SicsInterp *pSics, void *pData,
|
int ChocoFactory(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
@ -267,8 +268,7 @@ controller driver:
|
|||||||
\subsubsection{To Do}
|
\subsubsection{To Do}
|
||||||
This scheme seems to be quite promising for handling many SICS
|
This scheme seems to be quite promising for handling many SICS
|
||||||
objects. The following enhancements could be considered. Allow to set
|
objects. The following enhancements could be considered. Allow to set
|
||||||
certain primitive parameters without a drivable interface. And add an
|
certain primitive parameters without a drivable interface.
|
||||||
adapter for an environment variable in the controller.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
11
conman.c
11
conman.c
@ -65,6 +65,7 @@
|
|||||||
#include "uubuffer.h"
|
#include "uubuffer.h"
|
||||||
#include "commandlog.h"
|
#include "commandlog.h"
|
||||||
#include "stptok.h"
|
#include "stptok.h"
|
||||||
|
#include "sicshipadaba.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#define UUDEB 1
|
#define UUDEB 1
|
||||||
@ -361,6 +362,7 @@ extern pServer pServ;
|
|||||||
char pBueffel[132];
|
char pBueffel[132];
|
||||||
SConnection *pVictim = NULL;
|
SConnection *pVictim = NULL;
|
||||||
Item sItem;
|
Item sItem;
|
||||||
|
pHdb root = NULL;
|
||||||
|
|
||||||
pVictim = (SConnection *)pData;
|
pVictim = (SConnection *)pData;
|
||||||
if(!VerifyConnection(pVictim))
|
if(!VerifyConnection(pVictim))
|
||||||
@ -388,6 +390,15 @@ extern pServer pServ;
|
|||||||
*/
|
*/
|
||||||
KillCapture(pVictim);
|
KillCapture(pVictim);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* remove any callbacks which might still be active in the Hipadaba
|
||||||
|
*/
|
||||||
|
root = GetHipadabaRoot();
|
||||||
|
if(root != NULL)
|
||||||
|
{
|
||||||
|
InternalRemoveHipadabaCallback(root,pVictim->ident);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
If we have a grab, release it !
|
If we have a grab, release it !
|
||||||
*/
|
*/
|
||||||
|
258
devexec.c
258
devexec.c
@ -9,6 +9,9 @@
|
|||||||
revised for use with tasker: Mark Koennecke, September 1997
|
revised for use with tasker: Mark Koennecke, September 1997
|
||||||
Locking added: Mark Koennecke, August 2002
|
Locking added: Mark Koennecke, August 2002
|
||||||
|
|
||||||
|
Refactored and instrumentation for instrument staticstics added.
|
||||||
|
Mark Koennecke, July 2006
|
||||||
|
|
||||||
Copyright:
|
Copyright:
|
||||||
|
|
||||||
Labor fuer Neutronenstreuung
|
Labor fuer Neutronenstreuung
|
||||||
@ -39,10 +42,12 @@
|
|||||||
NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
|
NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
|
||||||
MODIFICATIONS.
|
MODIFICATIONS.
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <sys/time.h>
|
||||||
#include "fortify.h"
|
#include "fortify.h"
|
||||||
#include "sics.h"
|
#include "sics.h"
|
||||||
#include "nserver.h"
|
#include "nserver.h"
|
||||||
@ -52,11 +57,52 @@
|
|||||||
#include "devexec.h"
|
#include "devexec.h"
|
||||||
#include "status.h"
|
#include "status.h"
|
||||||
#include "lld.h"
|
#include "lld.h"
|
||||||
|
#include "commandlog.h"
|
||||||
|
#include "ifile.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#define DEBUG 1
|
#define DEBUG 1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*======================== Logging stuff ==================================*/
|
||||||
|
static FILE *devLog = NULL;
|
||||||
|
/*-------------------------------------------------------------------------*/
|
||||||
|
int openDevexecLog(){
|
||||||
|
char *fileName = NULL;
|
||||||
|
char fileBuffer[1024];
|
||||||
|
|
||||||
|
if(devLog == NULL){
|
||||||
|
fileName = IFindOption(pSICSOptions,"devexeclog");
|
||||||
|
if(fileName != NULL){
|
||||||
|
strcpy(fileBuffer,fileName);
|
||||||
|
} else {
|
||||||
|
fileBuffer[0] = '\0';
|
||||||
|
fileName = getenv("HOME");
|
||||||
|
if(fileName != NULL){
|
||||||
|
strcpy(fileBuffer,fileName);
|
||||||
|
}
|
||||||
|
strcat(fileBuffer,"/log/devexec.log");
|
||||||
|
}
|
||||||
|
devLog = fopen(fileBuffer,"a+");
|
||||||
|
}
|
||||||
|
if(devLog == NULL){
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*-------------------------------------------------------------------------*/
|
||||||
|
void DevexecLog(char *operation, char *device) {
|
||||||
|
struct timeval tv;
|
||||||
|
struct timezone tm;
|
||||||
|
if(devLog != NULL){
|
||||||
|
gettimeofday(&tv,&tm);
|
||||||
|
fprintf(devLog, "DEVEXEC:%s:%s:%ld:%ld\n",operation,device,
|
||||||
|
tv.tv_sec, tv.tv_usec);
|
||||||
|
fflush(devLog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*======================== internal data structures =======================*/
|
||||||
typedef struct _DevEntry {
|
typedef struct _DevEntry {
|
||||||
void *pData;
|
void *pData;
|
||||||
pObjectDescriptor pDescriptor;
|
pObjectDescriptor pDescriptor;
|
||||||
@ -64,6 +110,13 @@
|
|||||||
char *name;
|
char *name;
|
||||||
commandContext comCon;
|
commandContext comCon;
|
||||||
} DevEntry, *pDevEntry;
|
} DevEntry, *pDevEntry;
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
typedef struct {
|
||||||
|
pExeList self;
|
||||||
|
pDevEntry pDev;
|
||||||
|
pICountable pCountInt;
|
||||||
|
pIDrivable pDrivInt;
|
||||||
|
}checkContext, *pCheckContext;
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
static pDevEntry CreateDevEntry(pObjectDescriptor pDes, void *pData,
|
static pDevEntry CreateDevEntry(pObjectDescriptor pDes, void *pData,
|
||||||
float fVal, char *name)
|
float fVal, char *name)
|
||||||
@ -111,6 +164,7 @@
|
|||||||
int iLock;
|
int iLock;
|
||||||
pICallBack pCall;
|
pICallBack pCall;
|
||||||
time_t lastRun;
|
time_t lastRun;
|
||||||
|
int paused;
|
||||||
} ExeList;
|
} ExeList;
|
||||||
|
|
||||||
static pExeList pExecutor = NULL;
|
static pExeList pExecutor = NULL;
|
||||||
@ -167,6 +221,10 @@
|
|||||||
|
|
||||||
free(self);
|
free(self);
|
||||||
pServ->pExecutor = NULL;
|
pServ->pExecutor = NULL;
|
||||||
|
if(devLog != NULL){
|
||||||
|
fclose(devLog);
|
||||||
|
devLog = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
void ExeInterest(pExeList self, pDevEntry pDev, char *text) {
|
void ExeInterest(pExeList self, pDevEntry pDev, char *text) {
|
||||||
@ -284,6 +342,7 @@
|
|||||||
self->iEnd = 0;
|
self->iEnd = 0;
|
||||||
pCon->conStatus = HWBusy;
|
pCon->conStatus = HWBusy;
|
||||||
}
|
}
|
||||||
|
DevexecLog("START",pNew->name);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -386,7 +445,7 @@
|
|||||||
pCon,pCter->pDriv->fPreset);
|
pCon,pCter->pDriv->fPreset);
|
||||||
}
|
}
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
int CheckExeList(pExeList self)
|
int CheckExeListOld(pExeList self)
|
||||||
{
|
{
|
||||||
int iRet;
|
int iRet;
|
||||||
pDevEntry pDev = NULL;
|
pDevEntry pDev = NULL;
|
||||||
@ -402,7 +461,7 @@
|
|||||||
|
|
||||||
/* Sometimes this gets called, though nothing is running. There are
|
/* Sometimes this gets called, though nothing is running. There are
|
||||||
cases where this is feasible for maintainance, but in some cases it
|
cases where this is feasible for maintainance, but in some cases it
|
||||||
is pure rubbish, because nothing runs. This will ne checkd here.
|
is pure rubbish, because nothing runs. This will be checked here.
|
||||||
*/
|
*/
|
||||||
if((self->pOwner == NULL) || (LLDcheck(self->iList) == LIST_EMPTY))
|
if((self->pOwner == NULL) || (LLDcheck(self->iList) == LIST_EMPTY))
|
||||||
{
|
{
|
||||||
@ -421,10 +480,7 @@
|
|||||||
LLDnodeDataTo(self->iList,&pDev);
|
LLDnodeDataTo(self->iList,&pDev);
|
||||||
if(pDev)
|
if(pDev)
|
||||||
{
|
{
|
||||||
/*
|
SCPushContext(self->pOwner, pDev->comCon.transID, pDev->comCon.deviceID);
|
||||||
SCSetContext(self->pOwner,pDev->cmdID,pDev->name);
|
|
||||||
*/
|
|
||||||
SCPushContext(self->pOwner, pDev->comCon.transID, pDev->comCon.deviceID);
|
|
||||||
|
|
||||||
pDrivInt = pDev->pDescriptor->GetInterface(pDev->pData,DRIVEID);
|
pDrivInt = pDev->pDescriptor->GetInterface(pDev->pData,DRIVEID);
|
||||||
pCountInt = pDev->pDescriptor->GetInterface(pDev->pData,COUNTID);
|
pCountInt = pDev->pDescriptor->GetInterface(pDev->pData,COUNTID);
|
||||||
@ -560,6 +616,196 @@
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*-------------------------------------------------------------------------*/
|
||||||
|
static int checkInterrupt(pCheckContext pCheck, int targetStatus){
|
||||||
|
if(SCGetInterrupt(pCheck->self->pOwner) != eContinue) {
|
||||||
|
pCheck->self->iStatus = DEVINT;
|
||||||
|
SCPopContext(pCheck->self->pOwner);
|
||||||
|
SetStatus(eEager);
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
return targetStatus;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
static int initializeCheck(pCheckContext pCheck, pDevEntry pDev){
|
||||||
|
int eCode;
|
||||||
|
|
||||||
|
SCPushContext(pCheck->self->pOwner,
|
||||||
|
pDev->comCon.transID, pDev->comCon.deviceID);
|
||||||
|
pCheck->pDev = pDev;
|
||||||
|
pCheck->pDrivInt = pDev->pDescriptor->GetInterface(pDev->pData,DRIVEID);
|
||||||
|
pCheck->pCountInt = pDev->pDescriptor->GetInterface(pDev->pData,COUNTID);
|
||||||
|
if(pCheck->pDrivInt != NULL){
|
||||||
|
eCode = pCheck->pDrivInt->CheckStatus(pDev->pData,pCheck->self->pOwner);
|
||||||
|
} else if(pCheck->pCountInt != NULL) {
|
||||||
|
eCode = pCheck->pCountInt->CheckCountStatus(pDev->pData,pCheck->self->pOwner);
|
||||||
|
}
|
||||||
|
return eCode;
|
||||||
|
}
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
static int finishDevice(pCheckContext pCheck){
|
||||||
|
int status;
|
||||||
|
|
||||||
|
if(pCheck->pCountInt != NULL) {
|
||||||
|
pCheck->pCountInt->TransferData(pCheck->pDev->pData,pCheck->self->pOwner);
|
||||||
|
} else if(pCheck->pDrivInt != NULL) {
|
||||||
|
pCheck->pDrivInt->iErrorCount = 0;
|
||||||
|
}
|
||||||
|
ExeInterest(pCheck->self, pCheck->pDev, "finished");
|
||||||
|
DevexecLog("STOP",pCheck->pDev->name);
|
||||||
|
DeleteDevEntry(pCheck->pDev);
|
||||||
|
LLDnodeDelete(pCheck->self->iList);
|
||||||
|
status = LLDnodePtr2Prev(pCheck->self->iList);
|
||||||
|
SCWrite(pCheck->self->pOwner, "", eFinish);
|
||||||
|
pCheck->self->iStatus = DEVDONE;
|
||||||
|
return checkInterrupt(pCheck,status);
|
||||||
|
}
|
||||||
|
/*-------------------------------------------------------------------------*/
|
||||||
|
static int errorDevice(pCheckContext pCheck){
|
||||||
|
int status;
|
||||||
|
|
||||||
|
ExeInterest(pCheck->self, pCheck->pDev, "finished with problem");
|
||||||
|
DevexecLog("STOP",pCheck->pDev->name);
|
||||||
|
DeleteDevEntry(pCheck->pDev);
|
||||||
|
LLDnodeDelete(pCheck->self->iList);
|
||||||
|
status = LLDnodePtr2Prev(pCheck->self->iList);
|
||||||
|
SCWrite(pCheck->self->pOwner, "", eFinish);
|
||||||
|
pCheck->self->iStatus = DEVERROR;
|
||||||
|
if(pCheck->pDrivInt != NULL) {
|
||||||
|
pCheck->pDrivInt->iErrorCount++;
|
||||||
|
}
|
||||||
|
return checkInterrupt(pCheck,status);
|
||||||
|
}
|
||||||
|
/*-------------------------------------------------------------------------*/
|
||||||
|
static int testFinish(pExeList self){
|
||||||
|
if((self->pOwner == NULL) || (LLDcheck(self->iList) == LIST_EMPTY)) {
|
||||||
|
self->pOwner = NULL;
|
||||||
|
self->iRun = 0;
|
||||||
|
self->iEnd = 1;
|
||||||
|
self->iStop = 0;
|
||||||
|
self->lTask = -1;
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
int CheckExeList(pExeList self)
|
||||||
|
{
|
||||||
|
int iRet, status;
|
||||||
|
checkContext check;
|
||||||
|
pDevEntry pDev = NULL;
|
||||||
|
pICountable pCountInt = NULL;
|
||||||
|
pIDrivable pDrivInt = NULL;
|
||||||
|
int eCode;
|
||||||
|
int isCounting=0, isDriving=0;
|
||||||
|
char pBueffel[512];
|
||||||
|
SConnection *pCon;
|
||||||
|
pCon = self->pOwner;
|
||||||
|
|
||||||
|
assert(self);
|
||||||
|
|
||||||
|
/* Sometimes this gets called, though nothing is running. There are
|
||||||
|
cases where this is feasible for maintainance, but in some cases it
|
||||||
|
is pure rubbish, because nothing runs. This will be checked here.
|
||||||
|
*/
|
||||||
|
if(testFinish(self) == 1){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
check the status of all registered devices. Remove when finished
|
||||||
|
*/
|
||||||
|
check.self = self;
|
||||||
|
status = LLDnodePtr2First(self->iList);
|
||||||
|
while(status != 0)
|
||||||
|
{
|
||||||
|
LLDnodeDataTo(self->iList,&pDev);
|
||||||
|
if(pDev)
|
||||||
|
{
|
||||||
|
eCode = initializeCheck(&check,pDev);
|
||||||
|
if(eCode != HWNoBeam && eCode != HWPause && self->paused == 1){
|
||||||
|
DevexecLog("CONTINUE","ALL");
|
||||||
|
self->paused = 0;
|
||||||
|
}
|
||||||
|
switch(eCode)
|
||||||
|
{
|
||||||
|
case HWIdle:
|
||||||
|
case OKOK:
|
||||||
|
status = finishDevice(&check);
|
||||||
|
if(status < 0){
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case HWFault: /* real HW error: burning, no net etc.. */
|
||||||
|
status = errorDevice(&check);
|
||||||
|
if(status < 0){
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case HWNoBeam:
|
||||||
|
SetStatus(eOutOfBeam);
|
||||||
|
if(self->paused == 0){
|
||||||
|
self->paused = 1;
|
||||||
|
DevexecLog("NOBEAM","ALL");
|
||||||
|
}
|
||||||
|
status = checkInterrupt(&check,1);
|
||||||
|
if(status < 0){
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case HWPause:
|
||||||
|
SetStatus(ePaused);
|
||||||
|
if(self->paused == 0){
|
||||||
|
self->paused = 1;
|
||||||
|
DevexecLog("PAUSE","ALL");
|
||||||
|
}
|
||||||
|
status = checkInterrupt(&check,1);
|
||||||
|
if(status < 0){
|
||||||
|
/*
|
||||||
|
* continue in order to wait for devices to come to a stop
|
||||||
|
*/
|
||||||
|
ContinueExecution(self);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case HWBusy:
|
||||||
|
if(check.pDrivInt != NULL)
|
||||||
|
{
|
||||||
|
isDriving = 1;
|
||||||
|
}
|
||||||
|
else if(check.pCountInt != NULL)
|
||||||
|
{
|
||||||
|
isCounting = 1;
|
||||||
|
}
|
||||||
|
self->iStatus = DEVBUSY;
|
||||||
|
break;
|
||||||
|
case HWPosFault: /* cannot get somewhere... */
|
||||||
|
status = errorDevice(&check);
|
||||||
|
if(status < 0){
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
SCPopContext(self->pOwner);
|
||||||
|
}
|
||||||
|
status = LLDnodePtr2Next(self->iList);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isCounting) {
|
||||||
|
if (isDriving) {
|
||||||
|
SetStatus(eCountDrive);
|
||||||
|
} else {
|
||||||
|
SetStatus(eCounting);
|
||||||
|
}
|
||||||
|
} else if (isDriving) {
|
||||||
|
SetStatus(eDriving);
|
||||||
|
}
|
||||||
|
|
||||||
|
iRet = LLDnodePtr2First(self->iList);
|
||||||
|
return testFinish(self);
|
||||||
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int Wait4Success(pExeList self)
|
int Wait4Success(pExeList self)
|
||||||
{
|
{
|
||||||
|
@ -171,5 +171,6 @@
|
|||||||
|
|
||||||
pExeList GetExecutor(void);
|
pExeList GetExecutor(void);
|
||||||
void SetExecutor(pExeList pExe);
|
void SetExecutor(pExeList pExe);
|
||||||
|
/*----------------------- Logging -----------------------------------------*/
|
||||||
|
void DevexecLog(char *op, char *device);
|
||||||
#endif
|
#endif
|
||||||
|
@ -353,7 +353,8 @@ to the global SICS device executor.
|
|||||||
\mbox{}\verb@ @\\
|
\mbox{}\verb@ @\\
|
||||||
\mbox{}\verb@ pExeList GetExecutor(void);@\\
|
\mbox{}\verb@ pExeList GetExecutor(void);@\\
|
||||||
\mbox{}\verb@ void SetExecutor(pExeList pExe);@\\
|
\mbox{}\verb@ void SetExecutor(pExeList pExe);@\\
|
||||||
\mbox{}\verb@ @\\
|
\mbox{}\verb@/*----------------------- Logging -----------------------------------------*/@\\
|
||||||
|
\mbox{}\verb@ void DevexecLog(char *op, char *device); @\\
|
||||||
\mbox{}\verb@#endif @\\
|
\mbox{}\verb@#endif @\\
|
||||||
\mbox{}\verb@@$\diamond$
|
\mbox{}\verb@@$\diamond$
|
||||||
\end{list}
|
\end{list}
|
||||||
|
@ -299,7 +299,8 @@ to the global SICS device executor.
|
|||||||
|
|
||||||
pExeList GetExecutor(void);
|
pExeList GetExecutor(void);
|
||||||
void SetExecutor(pExeList pExe);
|
void SetExecutor(pExeList pExe);
|
||||||
|
/*----------------------- Logging -----------------------------------------*/
|
||||||
|
void DevexecLog(char *op, char *device);
|
||||||
#endif
|
#endif
|
||||||
@}
|
@}
|
||||||
|
|
||||||
|
2
drive.c
2
drive.c
@ -387,7 +387,7 @@
|
|||||||
}
|
}
|
||||||
else if(iRet == DEVINT)
|
else if(iRet == DEVINT)
|
||||||
{
|
{
|
||||||
sprintf(pBueffel,"Driving Interrupted!");
|
sprintf(pBueffel,"ERROR: Driving Interrupted!");
|
||||||
SCWrite(pCon,pBueffel,eError);
|
SCWrite(pCon,pBueffel,eError);
|
||||||
ClearExecutor(GetExecutor());
|
ClearExecutor(GetExecutor());
|
||||||
SetStatus(eOld);
|
SetStatus(eOld);
|
||||||
|
@ -71,13 +71,29 @@
|
|||||||
static long EVIDrive(void *pData, SConnection *pCon, float fVal)
|
static long EVIDrive(void *pData, SConnection *pCon, float fVal)
|
||||||
{
|
{
|
||||||
pEVControl self = NULL;
|
pEVControl self = NULL;
|
||||||
int iRet, iCode, i, iFix;
|
int iRet, iCode, i, iFix, savedStatus;
|
||||||
char pError[132], pBueffel[256];
|
char pError[132], pBueffel[256];
|
||||||
|
Tcl_Interp *pTcl = NULL;
|
||||||
|
|
||||||
self = (pEVControl)pData;
|
self = (pEVControl)pData;
|
||||||
assert(self);
|
assert(self);
|
||||||
assert(pCon);
|
assert(pCon);
|
||||||
|
|
||||||
|
if (self->runScript != NULL) {
|
||||||
|
savedStatus = GetStatus();
|
||||||
|
SetStatus(eBatch);
|
||||||
|
pTcl = InterpGetTcl(pServ->pSics);
|
||||||
|
snprintf(pBueffel, sizeof(pBueffel), "%s %f", self->runScript, fVal);
|
||||||
|
iRet = Tcl_Eval(pTcl,pBueffel);
|
||||||
|
SetStatus(savedStatus);
|
||||||
|
if(iRet != TCL_OK)
|
||||||
|
{
|
||||||
|
SCPrintf(pCon, eError,
|
||||||
|
"ERROR: %s while processing runscript for %s",
|
||||||
|
pTcl->result,self->pName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self->fTarget = fVal;
|
self->fTarget = fVal;
|
||||||
self->eMode = EVDrive;
|
self->eMode = EVDrive;
|
||||||
self->iStop = 0;
|
self->iStop = 0;
|
||||||
@ -848,6 +864,10 @@ static void ErrReport(pEVControl self)
|
|||||||
{
|
{
|
||||||
free(self->creationArgs);
|
free(self->creationArgs);
|
||||||
}
|
}
|
||||||
|
if (self->runScript != NULL)
|
||||||
|
{
|
||||||
|
free(self->runScript);
|
||||||
|
}
|
||||||
free(self);
|
free(self);
|
||||||
}
|
}
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
@ -1025,7 +1045,14 @@ static void ErrReport(pEVControl self)
|
|||||||
snprintf(pBueffel,255,"%s.errorScript = UNDEFINED", self->pName);
|
snprintf(pBueffel,255,"%s.errorScript = UNDEFINED", self->pName);
|
||||||
}
|
}
|
||||||
SCWrite(pCon,pBueffel, eValue);
|
SCWrite(pCon,pBueffel, eValue);
|
||||||
|
if(self->runScript != NULL)
|
||||||
|
{
|
||||||
|
SCPrintf(pCon, eValue, "%s.runScript = %s", self->pName, self->runScript);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SCPrintf(pCon, eValue, "%s.runScript = none", self->pName);
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
@ -1161,10 +1188,10 @@ static void ErrReport(pEVControl self)
|
|||||||
}
|
}
|
||||||
else /* parameter request */
|
else /* parameter request */
|
||||||
{
|
{
|
||||||
|
strtolower(argv[1]);
|
||||||
/*
|
/*
|
||||||
catch case of errorScript
|
catch case of errorScript
|
||||||
*/
|
*/
|
||||||
strtolower(argv[1]);
|
|
||||||
if(strcmp(argv[1],"errorscript") == 0)
|
if(strcmp(argv[1],"errorscript") == 0)
|
||||||
{
|
{
|
||||||
if(self->errorScript != NULL)
|
if(self->errorScript != NULL)
|
||||||
@ -1180,6 +1207,22 @@ static void ErrReport(pEVControl self)
|
|||||||
SCWrite(pCon,pBueffel,eValue);
|
SCWrite(pCon,pBueffel,eValue);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
catch case of runScript
|
||||||
|
*/
|
||||||
|
if(strcmp(argv[1],"runscript") == 0)
|
||||||
|
{
|
||||||
|
if(self->runScript != NULL)
|
||||||
|
{
|
||||||
|
SCPrintf(pCon, eValue,"%s.runScript = %s",self->pName,
|
||||||
|
self->runScript);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SCPrintf(pCon, eValue,"%s.runScript = none",self->pName);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
catch case for drivername
|
catch case for drivername
|
||||||
*/
|
*/
|
||||||
@ -1208,10 +1251,10 @@ static void ErrReport(pEVControl self)
|
|||||||
}
|
}
|
||||||
else /* try to set parameter */
|
else /* try to set parameter */
|
||||||
{
|
{
|
||||||
|
strtolower(argv[1]);
|
||||||
/*
|
/*
|
||||||
first catch case of errorScript
|
first catch case of errorScript
|
||||||
*/
|
*/
|
||||||
strtolower(argv[1]);
|
|
||||||
if(strcmp(argv[1],"errorscript") == 0)
|
if(strcmp(argv[1],"errorscript") == 0)
|
||||||
{
|
{
|
||||||
if(self->errorScript != NULL)
|
if(self->errorScript != NULL)
|
||||||
@ -1223,6 +1266,24 @@ static void ErrReport(pEVControl self)
|
|||||||
SCparChange(pCon);
|
SCparChange(pCon);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
catch case of runScript
|
||||||
|
*/
|
||||||
|
if(strcmp(argv[1],"runscript") == 0)
|
||||||
|
{
|
||||||
|
if(self->runScript != NULL)
|
||||||
|
{
|
||||||
|
free(self->runScript);
|
||||||
|
}
|
||||||
|
if (strcasecmp(argv[2],"none") == 0) {
|
||||||
|
self->runScript = NULL;
|
||||||
|
} else {
|
||||||
|
self->runScript = Arg2Tcl(argc-2,&argv[2],NULL,0);
|
||||||
|
}
|
||||||
|
SCSendOK(pCon);
|
||||||
|
SCparChange(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)
|
||||||
{
|
{
|
||||||
@ -1263,6 +1324,9 @@ static int EVSaveStatus(void *pData, char *name, FILE *fil)
|
|||||||
if(evc->errorScript != NULL) {
|
if(evc->errorScript != NULL) {
|
||||||
fprintf(fil, " %s errorScript %s\n", evc->pName, evc->errorScript);
|
fprintf(fil, " %s errorScript %s\n", evc->pName, evc->errorScript);
|
||||||
}
|
}
|
||||||
|
if(evc->runScript != NULL) {
|
||||||
|
fprintf(fil, " %s runScript %s\n", evc->pName, evc->runScript);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fprintf(fil, "}\n");
|
fprintf(fil, "}\n");
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
#line 227 "evcontroller.w"
|
#line 232 "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 148 "evcontroller.w"
|
#line 153 "evcontroller.w"
|
||||||
|
|
||||||
/*--------------------------- live & death --------------------------------*/
|
/*--------------------------- live & death --------------------------------*/
|
||||||
typedef struct __EVControl *pEVControl;
|
typedef struct __EVControl *pEVControl;
|
||||||
@ -45,6 +45,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#line 240 "evcontroller.w"
|
#line 245 "evcontroller.w"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
#line 244 "evcontroller.w"
|
#line 249 "evcontroller.w"
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
Environment controller datastructure
|
Environment controller datastructure
|
||||||
@ -43,9 +43,10 @@
|
|||||||
int iStop;
|
int iStop;
|
||||||
SCStore conn;
|
SCStore conn;
|
||||||
char *creationArgs;
|
char *creationArgs;
|
||||||
|
char *runScript;
|
||||||
void *pPrivate;
|
void *pPrivate;
|
||||||
void (*KillPrivate)(void *pData);
|
void (*KillPrivate)(void *pData);
|
||||||
} EVControl;
|
} EVControl;
|
||||||
|
|
||||||
#line 262 "evcontroller.w"
|
#line 267 "evcontroller.w"
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ $\langle$evdata {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ int iStop;@\\
|
\mbox{}\verb@ int iStop;@\\
|
||||||
\mbox{}\verb@ SCStore conn;@\\
|
\mbox{}\verb@ SCStore conn;@\\
|
||||||
\mbox{}\verb@ char *creationArgs;@\\
|
\mbox{}\verb@ char *creationArgs;@\\
|
||||||
|
\mbox{}\verb@ char *runScript;@\\
|
||||||
\mbox{}\verb@ void *pPrivate;@\\
|
\mbox{}\verb@ void *pPrivate;@\\
|
||||||
\mbox{}\verb@ void (*KillPrivate)(void *pData);@\\
|
\mbox{}\verb@ void (*KillPrivate)(void *pData);@\\
|
||||||
\mbox{}\verb@ } EVControl;@\\
|
\mbox{}\verb@ } EVControl;@\\
|
||||||
@ -88,6 +89,10 @@ holding the logging information. Then there is a switch, iWarned, which is
|
|||||||
used to prevent execessive output on environment controller error handling.
|
used to prevent execessive output on environment controller error handling.
|
||||||
iTcl is a boolean stating if the driver used is a proper C language driver
|
iTcl is a boolean stating if the driver used is a proper C language driver
|
||||||
or a Tcl driver.
|
or a Tcl driver.
|
||||||
|
creationArgs are the arguments needed to recreate the device. runScript
|
||||||
|
is a script called on every run or drive command. This script is intended
|
||||||
|
to set control parameters depending on the targetValue. The script is
|
||||||
|
called with the target temperature as argument.
|
||||||
This is followed by the void pointer for use by a derived
|
This is followed by the void pointer for use by a derived
|
||||||
class. KillPrivate is a pointer to a function capable of deleting pPrivate
|
class. KillPrivate is a pointer to a function capable of deleting pPrivate
|
||||||
properly.
|
properly.
|
||||||
|
@ -49,6 +49,7 @@ used by EVControl:
|
|||||||
int iStop;
|
int iStop;
|
||||||
SCStore conn;
|
SCStore conn;
|
||||||
char *creationArgs;
|
char *creationArgs;
|
||||||
|
char *runScript;
|
||||||
void *pPrivate;
|
void *pPrivate;
|
||||||
void (*KillPrivate)(void *pData);
|
void (*KillPrivate)(void *pData);
|
||||||
} EVControl;
|
} EVControl;
|
||||||
@ -76,6 +77,10 @@ holding the logging information. Then there is a switch, iWarned, which is
|
|||||||
used to prevent execessive output on environment controller error handling.
|
used to prevent execessive output on environment controller error handling.
|
||||||
iTcl is a boolean stating if the driver used is a proper C language driver
|
iTcl is a boolean stating if the driver used is a proper C language driver
|
||||||
or a Tcl driver.
|
or a Tcl driver.
|
||||||
|
creationArgs are the arguments needed to recreate the device. runScript
|
||||||
|
is a script called on every run or drive command. This script is intended
|
||||||
|
to set control parameters depending on the targetValue. The script is
|
||||||
|
called with the target temperature as argument.
|
||||||
This is followed by the void pointer for use by a derived
|
This is followed by the void pointer for use by a derived
|
||||||
class. KillPrivate is a pointer to a function capable of deleting pPrivate
|
class. KillPrivate is a pointer to a function capable of deleting pPrivate
|
||||||
properly.
|
properly.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
#line 265 "evcontroller.w"
|
#line 270 "evcontroller.w"
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
Environment device driver datastructure
|
Environment device driver datastructure
|
||||||
@ -12,7 +12,7 @@
|
|||||||
#define DEVREDO 2
|
#define DEVREDO 2
|
||||||
|
|
||||||
|
|
||||||
#line 87 "evcontroller.w"
|
#line 92 "evcontroller.w"
|
||||||
|
|
||||||
typedef struct __EVDriver {
|
typedef struct __EVDriver {
|
||||||
int (*SetValue)(pEVDriver self, float fNew);
|
int (*SetValue)(pEVDriver self, float fNew);
|
||||||
@ -31,7 +31,7 @@
|
|||||||
void (*KillPrivate)(void *pData);
|
void (*KillPrivate)(void *pData);
|
||||||
} EVDriver;
|
} EVDriver;
|
||||||
|
|
||||||
#line 276 "evcontroller.w"
|
#line 281 "evcontroller.w"
|
||||||
|
|
||||||
/*-------------------- life & death of a driver --------------------------*/
|
/*-------------------- life & death of a driver --------------------------*/
|
||||||
pEVDriver CreateEVDriver(int argc, char *argv[]);
|
pEVDriver CreateEVDriver(int argc, char *argv[]);
|
||||||
|
2
exe.w
2
exe.w
@ -171,6 +171,8 @@ int MakeExeManager(SConnection *pCon, SicsInterp *pSics, void *pData,
|
|||||||
int argc, char *argv[]);
|
int argc, char *argv[]);
|
||||||
int ExeManagerWrapper(SConnection *pCon, SicsInterp *pSics, void *pData,
|
int ExeManagerWrapper(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
int argc, char *argv[]);
|
int argc, char *argv[]);
|
||||||
|
int runExeBatchBuffer(void *pData, SConnection *pCon, SicsInterp *pSics,
|
||||||
|
char *name);
|
||||||
@}
|
@}
|
||||||
|
|
||||||
@o exeman.i -d @{
|
@o exeman.i -d @{
|
||||||
|
4
exebuf.h
4
exebuf.h
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
#line 207 "exe.w"
|
#line 209 "exe.w"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Buffer handling code for the Exe Buffer batch file processing
|
* Buffer handling code for the Exe Buffer batch file processing
|
||||||
@ -89,7 +89,7 @@
|
|||||||
*/
|
*/
|
||||||
char *exeBufName(pExeBuf self);
|
char *exeBufName(pExeBuf self);
|
||||||
|
|
||||||
#line 220 "exe.w"
|
#line 222 "exe.w"
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
4
exebuf.i
4
exebuf.i
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
#line 198 "exe.w"
|
#line 200 "exe.w"
|
||||||
|
|
||||||
/*--------------------------------------------------------------------
|
/*--------------------------------------------------------------------
|
||||||
Internal header file for the exe buffer module. Do not edit. This is
|
Internal header file for the exe buffer module. Do not edit. This is
|
||||||
@ -16,6 +16,6 @@ typedef struct __EXEBUF{
|
|||||||
int lineno;
|
int lineno;
|
||||||
} ExeBuf;
|
} ExeBuf;
|
||||||
|
|
||||||
#line 203 "exe.w"
|
#line 205 "exe.w"
|
||||||
|
|
||||||
|
|
||||||
|
39
exeman.c
39
exeman.c
@ -15,13 +15,13 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "fortify.h"
|
#include "fortify.h"
|
||||||
#include "sics.h"
|
#include "sics.h"
|
||||||
#include "exebuf.h"
|
|
||||||
#include "exeman.h"
|
|
||||||
#include "sdynar.h"
|
#include "sdynar.h"
|
||||||
#include "dynstring.h"
|
#include "dynstring.h"
|
||||||
#include "lld.h"
|
#include "lld.h"
|
||||||
#include "exeman.i"
|
|
||||||
#include "splitter.h"
|
#include "splitter.h"
|
||||||
|
#include "exebuf.h"
|
||||||
|
#include "exeman.i"
|
||||||
|
#include "exeman.h"
|
||||||
|
|
||||||
/*-------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------*/
|
||||||
static void KillExeMan(void *data){
|
static void KillExeMan(void *data){
|
||||||
@ -175,9 +175,9 @@ static pDynString locateBatchBuffer(pExeMan self, char *name){
|
|||||||
DeleteDynString(result);
|
DeleteDynString(result);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/*-------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------*/
|
||||||
static int runBatchBuffer(pExeMan self, SConnection *pCon,
|
static int runBatchBuffer(pExeMan self, SConnection *pCon,
|
||||||
SicsInterp *pSics, char *name){
|
SicsInterp *pSics, char *name){
|
||||||
pDynString filePath = NULL;
|
pDynString filePath = NULL;
|
||||||
char pBueffel[256];
|
char pBueffel[256];
|
||||||
pExeBuf buffer = NULL;
|
pExeBuf buffer = NULL;
|
||||||
@ -214,6 +214,17 @@ static int runBatchBuffer(pExeMan self, SConnection *pCon,
|
|||||||
self->exeStackPtr--;
|
self->exeStackPtr--;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
/*-------------------------------------------------------------------*/
|
||||||
|
int runExeBatchBuffer(void *pData, SConnection *pCon,
|
||||||
|
SicsInterp *pSics, char *name){
|
||||||
|
int status, oldEcho;
|
||||||
|
pExeMan self = (pExeMan)pData;
|
||||||
|
oldEcho = self->echo;
|
||||||
|
self->echo = 1;
|
||||||
|
status = runBatchBuffer(self,pCon,pSics,name);
|
||||||
|
self->echo = oldEcho;
|
||||||
|
return status;
|
||||||
|
}
|
||||||
/*========================== path management ========================*/
|
/*========================== path management ========================*/
|
||||||
static int handleBatchPath(pExeMan self, SConnection *pCon, int argc,
|
static int handleBatchPath(pExeMan self, SConnection *pCon, int argc,
|
||||||
char *argv[]){
|
char *argv[]){
|
||||||
@ -374,6 +385,18 @@ static int startUpload(pExeMan self, SConnection *pCon){
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
/*-------------------------------------------------------------------*/
|
||||||
|
static int clearUpload(pExeMan self, SConnection *pCon){
|
||||||
|
if(SCGetRights(pCon) > usUser){
|
||||||
|
SCWrite(pCon,"ERROR: no permission to clear buffer upload",eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if(self->uploadBuffer != NULL){
|
||||||
|
exeBufDelete(self->uploadBuffer);
|
||||||
|
self->uploadBuffer = NULL;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
static int appendLine(pExeMan self, SConnection *pCon,
|
static int appendLine(pExeMan self, SConnection *pCon,
|
||||||
int argc, char *argv[]){
|
int argc, char *argv[]){
|
||||||
@ -958,6 +981,12 @@ int ExeManagerWrapper(SConnection *pCon, SicsInterp *pSics, void *pData,
|
|||||||
SCSendOK(pCon);
|
SCSendOK(pCon);
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
|
}else if(strcmp(argv[1],"clearupload") == 0){
|
||||||
|
status = clearUpload(self,pCon);
|
||||||
|
if(status){
|
||||||
|
SCSendOK(pCon);
|
||||||
|
}
|
||||||
|
return status;
|
||||||
}else if(strcmp(argv[1],"info") == 0){
|
}else if(strcmp(argv[1],"info") == 0){
|
||||||
status = infoHandler(self,pCon,argc,argv);
|
status = infoHandler(self,pCon,argc,argv);
|
||||||
return status;
|
return status;
|
||||||
|
2
exeman.h
2
exeman.h
@ -13,5 +13,7 @@ int MakeExeManager(SConnection *pCon, SicsInterp *pSics, void *pData,
|
|||||||
int argc, char *argv[]);
|
int argc, char *argv[]);
|
||||||
int ExeManagerWrapper(SConnection *pCon, SicsInterp *pSics, void *pData,
|
int ExeManagerWrapper(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
int argc, char *argv[]);
|
int argc, char *argv[]);
|
||||||
|
int runExeBatchBuffer(void *pData, SConnection *pCon, SicsInterp *pSics,
|
||||||
|
char *name);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
4
exeman.i
4
exeman.i
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
#line 176 "exe.w"
|
#line 178 "exe.w"
|
||||||
|
|
||||||
/*-------------------------------------------------------------------
|
/*-------------------------------------------------------------------
|
||||||
Internal header file for the exe manager module. Do not edit. This
|
Internal header file for the exe manager module. Do not edit. This
|
||||||
@ -20,5 +20,5 @@ typedef struct __EXEMAN{
|
|||||||
int echo;
|
int echo;
|
||||||
}ExeMan, *pExeMan;
|
}ExeMan, *pExeMan;
|
||||||
|
|
||||||
#line 181 "exe.w"
|
#line 183 "exe.w"
|
||||||
|
|
||||||
|
37
fomerge.c
37
fomerge.c
@ -483,11 +483,34 @@ static int updateHMFMData(SicsInterp *pSics, SConnection *pCon)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/*-------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------*/
|
||||||
static int *calculateSum(HistInt *data, int iDet, int iTime)
|
static int *calculateDetSum(HistInt *data, int iDet, int iTime)
|
||||||
{
|
{
|
||||||
int i, j, iIndex;
|
int i, j, iIndex;
|
||||||
int *sum = NULL;
|
int *sum = NULL;
|
||||||
|
|
||||||
|
sum = (int *)malloc(iDet*sizeof(int));
|
||||||
|
if(!sum)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
memset(sum,0,iDet*sizeof(int));
|
||||||
|
|
||||||
|
for(i = 0; i < iDet; i++)
|
||||||
|
{
|
||||||
|
iIndex = i * iTime;
|
||||||
|
for(j = 0; j < iTime; j++)
|
||||||
|
{
|
||||||
|
sum[i] += data[iIndex+j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
/*-------------------------------------------------------------------*/
|
||||||
|
static int *calculateTimeSum(HistInt *data, int iDet, int iTime)
|
||||||
|
{
|
||||||
|
int i, j;
|
||||||
|
int *sum = NULL;
|
||||||
|
|
||||||
sum = (int *)malloc(iTime*sizeof(int));
|
sum = (int *)malloc(iTime*sizeof(int));
|
||||||
if(!sum)
|
if(!sum)
|
||||||
{
|
{
|
||||||
@ -495,16 +518,16 @@ static int *calculateSum(HistInt *data, int iDet, int iTime)
|
|||||||
}
|
}
|
||||||
memset(sum,0,iTime*sizeof(int));
|
memset(sum,0,iTime*sizeof(int));
|
||||||
|
|
||||||
for(i = 0; i < iDet; i++)
|
for(i = 0; i < iTime; i++)
|
||||||
{
|
{
|
||||||
iIndex = i * iTime;
|
for(j = 0; j < iDet; j++)
|
||||||
for(j = 0; j < iTime; j++)
|
|
||||||
{
|
{
|
||||||
sum[i] += data[iIndex+j];
|
sum[i] += data[j*iTime + i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------*/
|
||||||
static void checkSum(HistInt *sum, int iDet, char *name, SConnection *pCon){
|
static void checkSum(HistInt *sum, int iDet, char *name, SConnection *pCon){
|
||||||
int i, count;
|
int i, count;
|
||||||
@ -557,7 +580,7 @@ static int putSum(SicsInterp *pSics, SConnection *pCon,
|
|||||||
return NX_ERROR;
|
return NX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
sum = calculateSum(data,iDet,iTime);
|
sum = calculateDetSum(data,iDet,iTime);
|
||||||
if(!sum)
|
if(!sum)
|
||||||
{
|
{
|
||||||
SCWrite(pCon,"ERROR: out of memory summing bank",eError);
|
SCWrite(pCon,"ERROR: out of memory summing bank",eError);
|
||||||
@ -592,7 +615,7 @@ static int putElastic(SicsInterp *pSics, SConnection *pCon,
|
|||||||
}
|
}
|
||||||
fTimeBin = GetHistTimeBin(pMem,&iTime);
|
fTimeBin = GetHistTimeBin(pMem,&iTime);
|
||||||
iDet = getFMdim(MIDDLE);
|
iDet = getFMdim(MIDDLE);
|
||||||
sum = calculateSum(GetHistogramPointer(pMem,pCon),iDet,iTime);
|
sum = calculateTimeSum(GetHistogramPointer(pMem,pCon),iDet,iTime);
|
||||||
if(!sum)
|
if(!sum)
|
||||||
{
|
{
|
||||||
SCWrite(pCon,"ERROR: out of memory calculating elastic peak position",
|
SCWrite(pCon,"ERROR: out of memory calculating elastic peak position",
|
||||||
|
@ -11,14 +11,14 @@
|
|||||||
#ifndef FOURTABLE
|
#ifndef FOURTABLE
|
||||||
#define FOURTABLE
|
#define FOURTABLE
|
||||||
|
|
||||||
int MakeFourCircleTable(void);
|
int MakeFourCircleTable();
|
||||||
void DeleteFourCircleTable(int handle);
|
void DeleteFourCircleTable(int handle);
|
||||||
int HandleFourCircleCommands(int *table, SConnection *pCon,
|
int HandleFourCircleCommands(int *handle, SConnection *pCon,
|
||||||
int argc, char *argv[], int *err);
|
int argc, char *argv[], int *err);
|
||||||
char *GetFourCircleScanVar(int handle, double two_theta);
|
char *GetFourCircleScanVar(int handle, double two_theta);
|
||||||
int GetFourCircleScanNP(int handle, double two_theta);
|
|
||||||
double GetFourCircleStep(int handle, double two_theta);
|
double GetFourCircleStep(int handle, double two_theta);
|
||||||
float GetFourCirclePreset(int handle, double two_theta);
|
|
||||||
int SaveFourCircleTable(int handle, char *objName, FILE *fd);
|
int SaveFourCircleTable(int handle, char *objName, FILE *fd);
|
||||||
|
float GetFourCirclePreset(int handle, double twoTheta);
|
||||||
|
int GetFourCircleScanNP(int handle, double twoTheta);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
10
lin2ang.c
10
lin2ang.c
@ -70,7 +70,7 @@
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fprintf(fd,"%s length %f\n",name, self->length);
|
fprintf(fd,"%s length %f\n",name, self->length);
|
||||||
fprintf(fd,"%s zero %f\n",name, self->zero);
|
fprintf(fd,"%s softzero %f\n",name, self->zero);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -275,20 +275,20 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* zero point */
|
/* zero point */
|
||||||
if(strcmp(argv[1],"zero") == 0)
|
if(strcmp(argv[1],"softzero") == 0)
|
||||||
{
|
{
|
||||||
if(argc >= 3)
|
if(argc >= 3)
|
||||||
{
|
{
|
||||||
iRet = Tcl_GetDouble(pSics->pTcl,argv[2],&dVal);
|
iRet = Tcl_GetDouble(pSics->pTcl,argv[2],&dVal);
|
||||||
if(iRet != TCL_OK)
|
if(iRet != TCL_OK)
|
||||||
{
|
{
|
||||||
SCWrite(pCon,"ERROR: zero parameter not recognised as number",
|
SCWrite(pCon,"ERROR: softzero parameter not recognised as number",
|
||||||
eError);
|
eError);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(!SCMatchRights(pCon,usUser))
|
if(!SCMatchRights(pCon,usUser))
|
||||||
{
|
{
|
||||||
SCWrite(pCon,"ERROR: Insufficient privilege to change zero point",
|
SCWrite(pCon,"ERROR: Insufficient privilege to change softzero point",
|
||||||
eError);
|
eError);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -298,7 +298,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(pBueffel,"%s.zero = %f",argv[0],self->zero);
|
sprintf(pBueffel,"%s.softzero = %f",argv[0],self->zero);
|
||||||
SCWrite(pCon,pBueffel,eValue);
|
SCWrite(pCon,pBueffel,eValue);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
4
lld.c
4
lld.c
@ -208,6 +208,10 @@ void LLDdelete( int List )
|
|||||||
|
|
||||||
assert( (unsigned) List < ListCount );
|
assert( (unsigned) List < ListCount );
|
||||||
|
|
||||||
|
if(ListControl == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
Tmp = ListControl[ List ].first ; /* dummies are also deleted !!! */
|
Tmp = ListControl[ List ].first ; /* dummies are also deleted !!! */
|
||||||
while( NULL != Tmp ) /* still assuming last node has */
|
while( NULL != Tmp ) /* still assuming last node has */
|
||||||
{ /* a NULL next pointer ... */
|
{ /* a NULL next pointer ... */
|
||||||
|
66
macro.c
66
macro.c
@ -61,16 +61,15 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <tcl.h>
|
#include <tcl.h>
|
||||||
#include "SCinter.h"
|
#include <sics.h>
|
||||||
#include "conman.h"
|
|
||||||
#include "macro.h"
|
|
||||||
#include "status.h"
|
#include "status.h"
|
||||||
#include "obdes.h"
|
#include "macro.h"
|
||||||
#include "splitter.h"
|
#include "splitter.h"
|
||||||
#include "ifile.h"
|
#include "ifile.h"
|
||||||
#include "Dbg.h"
|
#include "Dbg.h"
|
||||||
#include "servlog.h"
|
#include "servlog.h"
|
||||||
#include "stringdict.h"
|
#include "stringdict.h"
|
||||||
|
#include "exeman.h"
|
||||||
|
|
||||||
#define SICSERROR "005567SICS"
|
#define SICSERROR "005567SICS"
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
@ -131,6 +130,7 @@
|
|||||||
char *lastCommand = NULL, comBuffer[132];
|
char *lastCommand = NULL, comBuffer[132];
|
||||||
int iRet = 0,i;
|
int iRet = 0,i;
|
||||||
int iMacro;
|
int iMacro;
|
||||||
|
Statistics *old;
|
||||||
|
|
||||||
/* get the datastructures */
|
/* get the datastructures */
|
||||||
pSics = (struct __SicsUnknown *)pData;
|
pSics = (struct __SicsUnknown *)pData;
|
||||||
@ -180,7 +180,9 @@
|
|||||||
/* invoke */
|
/* invoke */
|
||||||
iMacro = SCinMacro(pCon);
|
iMacro = SCinMacro(pCon);
|
||||||
SCsetMacro(pCon,1);
|
SCsetMacro(pCon,1);
|
||||||
|
old=StatisticsBegin(pCommand->stat);
|
||||||
iRet = pCommand->OFunc(pCon,pSinter,pCommand->pData,margc, myarg);
|
iRet = pCommand->OFunc(pCon,pSinter,pCommand->pData,margc, myarg);
|
||||||
|
StatisticsEnd(old);
|
||||||
SCsetMacro(pCon,iMacro);
|
SCsetMacro(pCon,iMacro);
|
||||||
/*
|
/*
|
||||||
lastUnkown gets deeply stacked with each SICS command exec'd.
|
lastUnkown gets deeply stacked with each SICS command exec'd.
|
||||||
@ -431,6 +433,21 @@ static int ProtectedExec(ClientData clientData, Tcl_Interp *interp,
|
|||||||
|
|
||||||
}
|
}
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
int MacroFileEvalNew(SConnection *pCon, SicsInterp *pInter, void *pData,
|
||||||
|
int argc, char *argv[])
|
||||||
|
{
|
||||||
|
void *pCom = NULL;
|
||||||
|
pCom = FindCommandData(pInter,"exe","ExeManager");
|
||||||
|
assert(pCom != NULL);
|
||||||
|
|
||||||
|
if(argc < 2){
|
||||||
|
SCWrite(pCon,"ERROR: no batch buffer to execute specified",
|
||||||
|
eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return runExeBatchBuffer(pCom,pCon,pInter,argv[1]);
|
||||||
|
}
|
||||||
|
/*----------------------------------------------------------------------*/
|
||||||
int MacroFileEval(SConnection *pCon, SicsInterp *pInter, void *pData,
|
int MacroFileEval(SConnection *pCon, SicsInterp *pInter, void *pData,
|
||||||
int argc, char *argv[])
|
int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -459,8 +476,8 @@ static int ProtectedExec(ClientData clientData, Tcl_Interp *interp,
|
|||||||
/* open filename */
|
/* open filename */
|
||||||
if( argc < 2)
|
if( argc < 2)
|
||||||
{
|
{
|
||||||
SCWrite(pCon,"ERROR: No filename specified ",eError);
|
SCWrite(pCon,"ERROR: No filename specified ",eError);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
fp = fopen(argv[1],"r");
|
fp = fopen(argv[1],"r");
|
||||||
if(!fp)
|
if(!fp)
|
||||||
@ -490,7 +507,7 @@ static int ProtectedExec(ClientData clientData, Tcl_Interp *interp,
|
|||||||
{
|
{
|
||||||
iChar = fgetc(fp);
|
iChar = fgetc(fp);
|
||||||
if(iChar == EOF)
|
if(iChar == EOF)
|
||||||
{
|
{
|
||||||
iChar = (int)'\n';
|
iChar = (int)'\n';
|
||||||
iRun = 0;
|
iRun = 0;
|
||||||
}
|
}
|
||||||
@ -505,11 +522,11 @@ static int ProtectedExec(ClientData clientData, Tcl_Interp *interp,
|
|||||||
SetStatus(eEager);
|
SetStatus(eEager);
|
||||||
FirstWord(pCom,pBueffel);
|
FirstWord(pCom,pBueffel);
|
||||||
if(FindCommand(pInter,pBueffel) != NULL)
|
if(FindCommand(pInter,pBueffel) != NULL)
|
||||||
{
|
{
|
||||||
sprintf(pBueffel,"%s:%d>> %s",pFile,iLine,pCom);
|
sprintf(pBueffel,"%s:%d>> %s",pFile,iLine,pCom);
|
||||||
SCWrite(pCon,pBueffel,eValue);
|
SCWrite(pCon,pBueffel,eValue);
|
||||||
if(pWhere != NULL)
|
if(pWhere != NULL)
|
||||||
{
|
{
|
||||||
free(pWhere);
|
free(pWhere);
|
||||||
}
|
}
|
||||||
pWhere = strdup(pBueffel);
|
pWhere = strdup(pBueffel);
|
||||||
@ -524,16 +541,16 @@ static int ProtectedExec(ClientData clientData, Tcl_Interp *interp,
|
|||||||
{ /* Tcl error */
|
{ /* Tcl error */
|
||||||
if(strlen(pTcl->result) > 2)
|
if(strlen(pTcl->result) > 2)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
local copy in order to resolve a valgrind error
|
local copy in order to resolve a valgrind error
|
||||||
*/
|
*/
|
||||||
strncpy(pBueffel,pTcl->result,511);
|
strncpy(pBueffel,pTcl->result,511);
|
||||||
SCWrite(pCon,pBueffel,eError);
|
SCWrite(pCon,pBueffel,eError);
|
||||||
}
|
}
|
||||||
pCom = Tcl_DStringValue(&command);
|
pCom = Tcl_DStringValue(&command);
|
||||||
SCWrite(pCon,"ERROR: in Tcl block:",eError);
|
SCWrite(pCon,"ERROR: in Tcl block:",eError);
|
||||||
SCWrite(pCon,pCom,eError);
|
SCWrite(pCon,pCom,eError);
|
||||||
SCWrite(pCon,"ERROR: end of Tcl error block",eError);
|
SCWrite(pCon,"ERROR: end of Tcl error block",eError);
|
||||||
}
|
}
|
||||||
else /* SICS error */
|
else /* SICS error */
|
||||||
{
|
{
|
||||||
@ -546,7 +563,7 @@ static int ProtectedExec(ClientData clientData, Tcl_Interp *interp,
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
Tcl_DStringFree(&command);
|
Tcl_DStringFree(&command);
|
||||||
SCWrite(pCon,"ERROR: batch processing interrupted",eError);
|
SCWrite(pCon,"ERROR: batch processing interrupted",eError);
|
||||||
SetStatus(eEager);
|
SetStatus(eEager);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -865,7 +882,7 @@ static int ProtectedExec(ClientData clientData, Tcl_Interp *interp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* make a string */
|
/* make a string */
|
||||||
pCommand = Arg2Tcl(argc,argv,pBueffel,sizeof(pBueffel));
|
pCommand = Arg2Tcl0(argc-1,argv+1,pBueffel,sizeof(pBueffel),self->command);
|
||||||
if (!pCommand) {
|
if (!pCommand) {
|
||||||
SCWrite(pCon, "ERROR: no more memory", eError);
|
SCWrite(pCon, "ERROR: no more memory", eError);
|
||||||
return 0;
|
return 0;
|
||||||
@ -895,8 +912,6 @@ static int ProtectedExec(ClientData clientData, Tcl_Interp *interp,
|
|||||||
}
|
}
|
||||||
return 1; /* not reached */
|
return 1; /* not reached */
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "access.c"
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
int TclPublish(SConnection *pCon, SicsInterp *pSics, void *pData,
|
int TclPublish(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
int argc, char *argv[])
|
int argc, char *argv[])
|
||||||
@ -924,17 +939,8 @@ static int ProtectedExec(ClientData clientData, Tcl_Interp *interp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* try convert last parameter to user code */
|
/* try convert last parameter to user code */
|
||||||
iUser = 0;
|
iUser = decodeSICSPriv(argv[2]);
|
||||||
strtolower(argv[2]);
|
if(iUser < 0)
|
||||||
while(aCode[iUser] != NULL)
|
|
||||||
{
|
|
||||||
if(strcmp(aCode[iUser],argv[2]) == 0)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
iUser++;
|
|
||||||
}
|
|
||||||
if(iUser > iCodes)
|
|
||||||
{
|
{
|
||||||
sprintf(pBueffel,"ERROR: cannot identify %s as a valid user code",
|
sprintf(pBueffel,"ERROR: cannot identify %s as a valid user code",
|
||||||
argv[2]);
|
argv[2]);
|
||||||
|
4
make_gen
4
make_gen
@ -8,7 +8,7 @@
|
|||||||
COBJ = Sclient.o network.o ifile.o intcli.o $(FORTIFYOBJ)
|
COBJ = Sclient.o network.o ifile.o intcli.o $(FORTIFYOBJ)
|
||||||
SOBJ = network.o ifile.o conman.o SCinter.o splitter.o passwd.o \
|
SOBJ = network.o ifile.o conman.o SCinter.o splitter.o passwd.o \
|
||||||
servlog.o sicvar.o nserver.o SICSmain.o motorlist.o\
|
servlog.o sicvar.o nserver.o SICSmain.o motorlist.o\
|
||||||
sicsexit.o costa.o task.o $(FORTIFYOBJ)\
|
sicsexit.o costa.o task.o $(FORTIFYOBJ) access.o\
|
||||||
macro.o ofac.o obpar.o obdes.o drive.o status.o intserv.o \
|
macro.o ofac.o obpar.o obdes.o drive.o status.o intserv.o \
|
||||||
devexec.o mumo.o mumoconf.o selector.o selvar.o fupa.o lld.o \
|
devexec.o mumo.o mumoconf.o selector.o selvar.o fupa.o lld.o \
|
||||||
lld_blob.o strrepl.o lin2ang.o fomerge.o napi4.o napi5.o \
|
lld_blob.o strrepl.o lin2ang.o fomerge.o napi4.o napi5.o \
|
||||||
@ -30,7 +30,7 @@ SOBJ = network.o ifile.o conman.o SCinter.o splitter.o passwd.o \
|
|||||||
s_rnge.o sig_die.o gpibcontroller.o $(NIOBJ) mcreader.o mccontrol.o\
|
s_rnge.o sig_die.o gpibcontroller.o $(NIOBJ) mcreader.o mccontrol.o\
|
||||||
hmdata.o nxscript.o tclintimpl.o sicsdata.o mcstascounter.o \
|
hmdata.o nxscript.o tclintimpl.o sicsdata.o mcstascounter.o \
|
||||||
mcstashm.o initializer.o remob.o tclmotdriv.o protocol.o \
|
mcstashm.o initializer.o remob.o tclmotdriv.o protocol.o \
|
||||||
sinfox.o sicslist.o cone.o
|
sinfox.o sicslist.o cone.o hipadaba.o sicshipadaba.o statistics.o
|
||||||
|
|
||||||
MOTOROBJ = motor.o simdriv.o
|
MOTOROBJ = motor.o simdriv.o
|
||||||
COUNTEROBJ = countdriv.o simcter.o counter.o
|
COUNTEROBJ = countdriv.o simcter.o counter.o
|
||||||
|
77
mesure.c
77
mesure.c
@ -32,6 +32,7 @@
|
|||||||
#include "nxscript.h"
|
#include "nxscript.h"
|
||||||
#include "fourtable.h"
|
#include "fourtable.h"
|
||||||
#include "lld.h"
|
#include "lld.h"
|
||||||
|
#include "stdscan.h"
|
||||||
|
|
||||||
extern void SNXFormatTime(char *pBueffel, int iLen);
|
extern void SNXFormatTime(char *pBueffel, int iLen);
|
||||||
extern float nintf(float f);
|
extern float nintf(float f);
|
||||||
@ -65,6 +66,7 @@
|
|||||||
int iLogFile; /* log file num at connection */
|
int iLogFile; /* log file num at connection */
|
||||||
SConnection *pCon; /* log file owning connection */
|
SConnection *pCon; /* log file owning connection */
|
||||||
char *pCurrentFile; /* current file root */
|
char *pCurrentFile; /* current file root */
|
||||||
|
char headerTemplate[512];
|
||||||
int iCount; /* count of reflection */
|
int iCount; /* count of reflection */
|
||||||
int CountMode; /* timer or preset */
|
int CountMode; /* timer or preset */
|
||||||
int np; /* number of scan points */
|
int np; /* number of scan points */
|
||||||
@ -146,7 +148,7 @@ static void ListMesure(pMesure self, char *name, SConnection *pCon)
|
|||||||
pMesure CreateMesure(pHKL pCryst, pScanData pScanner, pMotor pOmega,
|
pMesure CreateMesure(pHKL pCryst, pScanData pScanner, pMotor pOmega,
|
||||||
char *pOm, pMotor p2Theta, char *p2t,
|
char *pOm, pMotor p2Theta, char *p2t,
|
||||||
char *pFileRoot,
|
char *pFileRoot,
|
||||||
pDataNumber pDanu)
|
pDataNumber pDanu, char *hdTemplate)
|
||||||
{
|
{
|
||||||
pMesure pNew = NULL;
|
pMesure pNew = NULL;
|
||||||
|
|
||||||
@ -198,6 +200,7 @@ static void ListMesure(pMesure self, char *name, SConnection *pCon)
|
|||||||
#endif
|
#endif
|
||||||
pNew->lCounts = (long *)malloc(50*sizeof(long));
|
pNew->lCounts = (long *)malloc(50*sizeof(long));
|
||||||
pNew->stepTable = MakeFourCircleTable();
|
pNew->stepTable = MakeFourCircleTable();
|
||||||
|
strncpy(pNew->headerTemplate,hdTemplate,511);
|
||||||
return pNew;
|
return pNew;
|
||||||
}
|
}
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
@ -249,7 +252,7 @@ static void ListMesure(pMesure self, char *name, SConnection *pCon)
|
|||||||
/* check no of parameters
|
/* check no of parameters
|
||||||
inicom name hkl scan omega root danu
|
inicom name hkl scan omega root danu
|
||||||
*/
|
*/
|
||||||
if(argc < 8)
|
if(argc < 9)
|
||||||
{
|
{
|
||||||
SCWrite(pCon,
|
SCWrite(pCon,
|
||||||
"ERROR: Insufficient number of parameters to MesureFactory",eError);
|
"ERROR: Insufficient number of parameters to MesureFactory",eError);
|
||||||
@ -336,7 +339,7 @@ static void ListMesure(pMesure self, char *name, SConnection *pCon)
|
|||||||
|
|
||||||
/* finally create the thing */
|
/* finally create the thing */
|
||||||
pNew = CreateMesure(pCryst,pScan,pMot,argv[4], pMot2, argv[5],
|
pNew = CreateMesure(pCryst,pScan,pMot,argv[4], pMot2, argv[5],
|
||||||
argv[6],pDanu);
|
argv[6],pDanu,argv[8]);
|
||||||
if(!pNew)
|
if(!pNew)
|
||||||
{
|
{
|
||||||
SCWrite(pCon,"ERROR: no memory in MesureFactory",eError);
|
SCWrite(pCon,"ERROR: no memory in MesureFactory",eError);
|
||||||
@ -759,7 +762,7 @@ static int ScanReflection(pMesure self, float twoTheta, SConnection *pCon)
|
|||||||
char *pFile = NULL, *pPtr;
|
char *pFile = NULL, *pPtr;
|
||||||
float zero, pos;
|
float zero, pos;
|
||||||
pMotor pMot = NULL;
|
pMotor pMot = NULL;
|
||||||
|
FILE *temp = NULL;
|
||||||
|
|
||||||
assert(self);
|
assert(self);
|
||||||
assert(pCon);
|
assert(pCon);
|
||||||
@ -813,6 +816,19 @@ static int ScanReflection(pMesure self, float twoTheta, SConnection *pCon)
|
|||||||
SCSetInterrupt(pCon,eAbortBatch);
|
SCSetInterrupt(pCon,eAbortBatch);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
temp = fopen(self->headerTemplate,"r");
|
||||||
|
if(temp == NULL)
|
||||||
|
{
|
||||||
|
SCWrite(pCon,"ERROR: failed to open header template",eError);
|
||||||
|
}
|
||||||
|
if(temp != NULL && self->fRefl != NULL)
|
||||||
|
{
|
||||||
|
WriteTemplate(self->fRefl, temp, pFilename, NULL,
|
||||||
|
pCon, pServ->pSics);
|
||||||
|
fclose(temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* open hkl-data file */
|
/* open hkl-data file */
|
||||||
strcpy(pFilename,pRoot);
|
strcpy(pFilename,pRoot);
|
||||||
@ -855,59 +871,6 @@ static int ScanReflection(pMesure self, float twoTheta, SConnection *pCon)
|
|||||||
sprintf(pBuff,"user = %s",pVar->text);
|
sprintf(pBuff,"user = %s",pVar->text);
|
||||||
strcat(pBueffel,pBuff);
|
strcat(pBueffel,pBuff);
|
||||||
}
|
}
|
||||||
fprintf(self->fRefl,"%s\n",pBueffel);
|
|
||||||
fprintf(self->fRefl,"lambda = %f Angstroem\n",fVal);
|
|
||||||
fprintf(self->fRefl,
|
|
||||||
"UB = %7.6f %7.6f %7.6f %7.6f %7.6f %7.6f %7.6f %7.6f %7.6f\n",
|
|
||||||
fUB[0], fUB[1],fUB[2],fUB[3],fUB[4],fUB[5],fUB[6],fUB[7],fUB[8]);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* zero points for Juerg
|
|
||||||
*/
|
|
||||||
pBueffel[0] = '\0';
|
|
||||||
if(self->pCryst->pTheta != NULL){
|
|
||||||
MotorGetPar(self->pCryst->pTheta,"softzero",&zero);
|
|
||||||
snprintf(pBuff,131,"stt.zero = %f ", zero);
|
|
||||||
strcat(pBueffel,pBuff);
|
|
||||||
}
|
|
||||||
if(self->pCryst->pOmega != NULL){
|
|
||||||
MotorGetPar(self->pCryst->pOmega,"softzero",&zero);
|
|
||||||
snprintf(pBuff,131,"om.zero = %f ", zero);
|
|
||||||
strcat(pBueffel,pBuff);
|
|
||||||
}
|
|
||||||
if(self->pCryst->pChi != NULL){
|
|
||||||
MotorGetPar(self->pCryst->pChi,"softzero",&zero);
|
|
||||||
snprintf(pBuff,131,"chi.zero = %f ", zero);
|
|
||||||
strcat(pBueffel,pBuff);
|
|
||||||
}
|
|
||||||
if(self->pCryst->pPhi != NULL){
|
|
||||||
MotorGetPar(self->pCryst->pPhi,"softzero",&zero);
|
|
||||||
snprintf(pBuff,131,"phi.zero = %f ", zero);
|
|
||||||
strcat(pBueffel,pBuff);
|
|
||||||
}
|
|
||||||
fprintf(self->fRefl,"%s\n",pBueffel);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* CEX motors ....
|
|
||||||
*/
|
|
||||||
pBueffel[0] = '\0';
|
|
||||||
pMot = FindCommandData(pServ->pSics,"cex1","Motor");
|
|
||||||
if(pMot != NULL){
|
|
||||||
MotorGetSoftPosition(pMot,pCon,&pos);
|
|
||||||
snprintf(pBuff,131,"cex1 = %f ",pos);
|
|
||||||
strcat(pBueffel,pBuff);
|
|
||||||
}
|
|
||||||
pMot = FindCommandData(pServ->pSics,"cex2","Motor");
|
|
||||||
if(pMot != NULL){
|
|
||||||
MotorGetSoftPosition(pMot,pCon,&pos);
|
|
||||||
snprintf(pBuff,131,"cex2 = %f ",pos);
|
|
||||||
strcat(pBueffel,pBuff);
|
|
||||||
}
|
|
||||||
if(strlen(pBueffel) > 1) {
|
|
||||||
fprintf(self->fRefl,"%s\n",pBueffel);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
4
mesure.h
4
mesure.h
@ -17,8 +17,8 @@
|
|||||||
/*--------------------- live & death --------------------------------------*/
|
/*--------------------- live & death --------------------------------------*/
|
||||||
pMesure CreateMesure(pHKL pCryst, pScanData pScanner,
|
pMesure CreateMesure(pHKL pCryst, pScanData pScanner,
|
||||||
pMotor pOmega, char *pom,
|
pMotor pOmega, char *pom,
|
||||||
pMotor p2Theta, char *p2t,
|
pMotor p2Theta, char *p2t,
|
||||||
char *pFileRoot,pDataNumber pDanu);
|
char *pFileRoot,pDataNumber pDanu, char *headerTemplate);
|
||||||
void DeleteMesure(void *pData);
|
void DeleteMesure(void *pData);
|
||||||
|
|
||||||
int MesureFactory(SConnection *pCon, SicsInterp *pSics, void *pData,
|
int MesureFactory(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
|
@ -30,7 +30,8 @@ $\langle$mesureint {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@/*--------------------- live & death --------------------------------------*/@\\
|
\mbox{}\verb@/*--------------------- live & death --------------------------------------*/@\\
|
||||||
\mbox{}\verb@ pMesure CreateMesure(pHKL pCryst, pScanData pScanner, @\\
|
\mbox{}\verb@ pMesure CreateMesure(pHKL pCryst, pScanData pScanner, @\\
|
||||||
\mbox{}\verb@ pMotor pOmega, char *pom,@\\
|
\mbox{}\verb@ pMotor pOmega, char *pom,@\\
|
||||||
\mbox{}\verb@ char *pFileRoot,pDataNumber pDanu);@\\
|
\mbox{}\verb@ pMotor p2Theta, char *p2t,@\\
|
||||||
|
\mbox{}\verb@ char *pFileRoot,pDataNumber pDanu, char *headerTemplate);@\\
|
||||||
\mbox{}\verb@ void DeleteMesure(void *pData);@\\
|
\mbox{}\verb@ void DeleteMesure(void *pData);@\\
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
\mbox{}\verb@ int MesureFactory(SConnection *pCon, SicsInterp *pSics, void *pData,@\\
|
\mbox{}\verb@ int MesureFactory(SConnection *pCon, SicsInterp *pSics, void *pData,@\\
|
||||||
@ -117,11 +118,13 @@ $\langle$fourtableint {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
\mbox{}\verb@ int MakeFourCircleTable();@\\
|
\mbox{}\verb@ int MakeFourCircleTable();@\\
|
||||||
\mbox{}\verb@ void DeleteFourCircleTable(int handle);@\\
|
\mbox{}\verb@ void DeleteFourCircleTable(int handle);@\\
|
||||||
\mbox{}\verb@ int HandleFourCircleCommands(int handle, SConnection *pCon, @\\
|
\mbox{}\verb@ int HandleFourCircleCommands(int *handle, SConnection *pCon, @\\
|
||||||
\mbox{}\verb@ int argc, char *argv[], int *err);@\\
|
\mbox{}\verb@ int argc, char *argv[], int *err);@\\
|
||||||
\mbox{}\verb@ char *GetFourCircleScanVar(int handle, double two_theta);@\\
|
\mbox{}\verb@ char *GetFourCircleScanVar(int handle, double two_theta);@\\
|
||||||
\mbox{}\verb@ double GetFourCircleStep(int handle, double two_theta);@\\
|
\mbox{}\verb@ double GetFourCircleStep(int handle, double two_theta);@\\
|
||||||
\mbox{}\verb@ int SaveFourCircleTable(int handle, char *objName, FILE *fd);@\\
|
\mbox{}\verb@ int SaveFourCircleTable(int handle, char *objName, FILE *fd);@\\
|
||||||
|
\mbox{}\verb@ float GetFourCirclePreset(int handle, double twoTheta);@\\
|
||||||
|
\mbox{}\verb@ int GetFourCircleScanNP(int handle, double twoTheta);@\\
|
||||||
\mbox{}\verb@@$\diamond$
|
\mbox{}\verb@@$\diamond$
|
||||||
\end{list}
|
\end{list}
|
||||||
\vspace{-1ex}
|
\vspace{-1ex}
|
||||||
|
6
mesure.w
6
mesure.w
@ -26,7 +26,7 @@ The interface to this object consists of these functions:
|
|||||||
pMesure CreateMesure(pHKL pCryst, pScanData pScanner,
|
pMesure CreateMesure(pHKL pCryst, pScanData pScanner,
|
||||||
pMotor pOmega, char *pom,
|
pMotor pOmega, char *pom,
|
||||||
pMotor p2Theta, char *p2t,
|
pMotor p2Theta, char *p2t,
|
||||||
char *pFileRoot,pDataNumber pDanu);
|
char *pFileRoot,pDataNumber pDanu, char *headerTemplate);
|
||||||
void DeleteMesure(void *pData);
|
void DeleteMesure(void *pData);
|
||||||
|
|
||||||
int MesureFactory(SConnection *pCon, SicsInterp *pSics, void *pData,
|
int MesureFactory(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
@ -100,11 +100,13 @@ interface to this module is:
|
|||||||
@d fourtableint @{
|
@d fourtableint @{
|
||||||
int MakeFourCircleTable();
|
int MakeFourCircleTable();
|
||||||
void DeleteFourCircleTable(int handle);
|
void DeleteFourCircleTable(int handle);
|
||||||
int HandleFourCircleCommands(int handle, SConnection *pCon,
|
int HandleFourCircleCommands(int *handle, SConnection *pCon,
|
||||||
int argc, char *argv[], int *err);
|
int argc, char *argv[], int *err);
|
||||||
char *GetFourCircleScanVar(int handle, double two_theta);
|
char *GetFourCircleScanVar(int handle, double two_theta);
|
||||||
double GetFourCircleStep(int handle, double two_theta);
|
double GetFourCircleStep(int handle, double two_theta);
|
||||||
int SaveFourCircleTable(int handle, char *objName, FILE *fd);
|
int SaveFourCircleTable(int handle, char *objName, FILE *fd);
|
||||||
|
float GetFourCirclePreset(int handle, double twoTheta);
|
||||||
|
int GetFourCircleScanNP(int handle, double twoTheta);
|
||||||
@}
|
@}
|
||||||
Many functions takes as the first argument a handle to the four circle table as
|
Many functions takes as the first argument a handle to the four circle table as
|
||||||
created by MakeFourCircleTable.
|
created by MakeFourCircleTable.
|
||||||
|
2
motor.c
2
motor.c
@ -492,6 +492,8 @@ extern void KillPiPiezo(void *pData);
|
|||||||
|
|
||||||
pM = (pMotor)self;
|
pM = (pMotor)self;
|
||||||
|
|
||||||
|
/* MotorHalt(pM); */
|
||||||
|
|
||||||
if(pM->name)
|
if(pM->name)
|
||||||
free(pM->name);
|
free(pM->name);
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ static long MOLISetValue(void *data, SConnection *pCon, float val){
|
|||||||
return test;
|
return test;
|
||||||
} else {
|
} else {
|
||||||
tuktuk.running = 1;
|
tuktuk.running = 1;
|
||||||
LLDnodeDataFrom(self,&tuktuk);
|
LLDnodeDataFrom(self,&tuktuk);
|
||||||
}
|
}
|
||||||
iRet = LLDnodePtr2Next(self);
|
iRet = LLDnodePtr2Next(self);
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "site.h"
|
#include "site.h"
|
||||||
#include "tcldrivable.h"
|
#include "tcldrivable.h"
|
||||||
#include "nserver.h"
|
#include "nserver.h"
|
||||||
|
#include "sicshipadaba.h"
|
||||||
|
|
||||||
int ServerSetupInterrupt(int iPort, pNetRead pNet, pTaskMan pTasker);
|
int ServerSetupInterrupt(int iPort, pNetRead pNet, pTaskMan pTasker);
|
||||||
/*
|
/*
|
||||||
@ -42,6 +43,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
extern void StopExit(void); /* in SICSmain.c */
|
extern void StopExit(void); /* in SICSmain.c */
|
||||||
|
|
||||||
|
extern int openDevexecLog(); /* in devexec.c */
|
||||||
/* ========================= Less dreadful file statics =================== */
|
/* ========================= Less dreadful file statics =================== */
|
||||||
|
|
||||||
#define DEFAULTINIFILE "servo.tcl"
|
#define DEFAULTINIFILE "servo.tcl"
|
||||||
@ -215,6 +218,8 @@
|
|||||||
assert(pCom);
|
assert(pCom);
|
||||||
assert(pCom->pData);
|
assert(pCom->pData);
|
||||||
self->pExecutor = (pExeList)pCom->pData;
|
self->pExecutor = (pExeList)pCom->pData;
|
||||||
|
openDevexecLog();
|
||||||
|
DevexecLog("START","SICS");
|
||||||
|
|
||||||
|
|
||||||
/* initialize Interrupt Port */
|
/* initialize Interrupt Port */
|
||||||
@ -304,6 +309,7 @@
|
|||||||
|
|
||||||
/* clear all pending bullshit */
|
/* clear all pending bullshit */
|
||||||
ClearExecutor(self->pExecutor);
|
ClearExecutor(self->pExecutor);
|
||||||
|
DevexecLog("STOP","SICS");
|
||||||
|
|
||||||
/* shut telnet down */
|
/* shut telnet down */
|
||||||
KillTelnet();
|
KillTelnet();
|
||||||
@ -396,6 +402,7 @@
|
|||||||
|
|
||||||
KillFreeConnections();
|
KillFreeConnections();
|
||||||
|
|
||||||
|
killSICSHipadaba();
|
||||||
|
|
||||||
/* make fortify print his findings */
|
/* make fortify print his findings */
|
||||||
Fortify_DumpAllMemory(iFortifyScope);
|
Fortify_DumpAllMemory(iFortifyScope);
|
||||||
|
10
nxscript.c
10
nxscript.c
@ -394,10 +394,12 @@ static void updateHMDim(NXScript *self, pHistMem mem){
|
|||||||
timeBin = GetHistTimeBin(mem,&timeLength);
|
timeBin = GetHistTimeBin(mem,&timeLength);
|
||||||
if(timeLength > 2){
|
if(timeLength > 2){
|
||||||
sprintf(dummy,"%d",timeLength);
|
sprintf(dummy,"%d",timeLength);
|
||||||
status = NXDupdate(self->dictHandle,"timedim",dummy);
|
} else {
|
||||||
if(status == 0) {
|
sprintf(dummy,"%d",1);
|
||||||
NXDadd(self->dictHandle,"timedim",dummy);
|
}
|
||||||
}
|
status = NXDupdate(self->dictHandle,"timedim",dummy);
|
||||||
|
if(status == 0) {
|
||||||
|
NXDadd(self->dictHandle,"timedim",dummy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
|
10
obdes.c
10
obdes.c
@ -44,6 +44,7 @@
|
|||||||
#include "obdes.h"
|
#include "obdes.h"
|
||||||
#include "conman.h"
|
#include "conman.h"
|
||||||
#include "servlog.h"
|
#include "servlog.h"
|
||||||
|
#include "hipadaba.h"
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
static void *DefaultGetInterface(void *pData,int iID)
|
static void *DefaultGetInterface(void *pData,int iID)
|
||||||
@ -67,6 +68,7 @@
|
|||||||
}
|
}
|
||||||
pRes->name = strdup(name);
|
pRes->name = strdup(name);
|
||||||
pRes->pKeys = NULL;
|
pRes->pKeys = NULL;
|
||||||
|
pRes->parNode = NULL;
|
||||||
pRes->SaveStatus = DefaultSave;
|
pRes->SaveStatus = DefaultSave;
|
||||||
pRes->GetInterface = DefaultGetInterface;
|
pRes->GetInterface = DefaultGetInterface;
|
||||||
return pRes;
|
return pRes;
|
||||||
@ -77,6 +79,14 @@
|
|||||||
assert(self);
|
assert(self);
|
||||||
if(self->name) free(self->name);
|
if(self->name) free(self->name);
|
||||||
if(self->pKeys) IFDeleteOptions(self->pKeys);
|
if(self->pKeys) IFDeleteOptions(self->pKeys);
|
||||||
|
/*
|
||||||
|
* delate a parameter node only when not linked elsewhere
|
||||||
|
*/
|
||||||
|
if(self->parNode != NULL){
|
||||||
|
if(self->parNode->mama == NULL){
|
||||||
|
DeleteHipadabaNode(self->parNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
free(self);
|
free(self);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
2
obdes.h
2
obdes.h
@ -23,12 +23,14 @@
|
|||||||
#define SICSDESCRIPTOR
|
#define SICSDESCRIPTOR
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ifile.h>
|
#include <ifile.h>
|
||||||
|
#include <hipadaba.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *name;
|
char *name;
|
||||||
int (*SaveStatus)(void *self, char *name,FILE *fd);
|
int (*SaveStatus)(void *self, char *name,FILE *fd);
|
||||||
void *(*GetInterface)(void *self, int iInterfaceID);
|
void *(*GetInterface)(void *self, int iInterfaceID);
|
||||||
IPair *pKeys;
|
IPair *pKeys;
|
||||||
|
pHdb parNode;
|
||||||
} ObjectDescriptor, *pObjectDescriptor;
|
} ObjectDescriptor, *pObjectDescriptor;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
17
ofac.c
17
ofac.c
@ -118,6 +118,7 @@
|
|||||||
#include "sinfox.h"
|
#include "sinfox.h"
|
||||||
#include "sicslist.h"
|
#include "sicslist.h"
|
||||||
#include "cone.h"
|
#include "cone.h"
|
||||||
|
#include "sicshipadaba.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[])
|
||||||
@ -207,8 +208,11 @@
|
|||||||
/* permanent commands */
|
/* permanent commands */
|
||||||
AddCommand(pInter,"Sics_Exitus",SicsExit,NULL,NULL);
|
AddCommand(pInter,"Sics_Exitus",SicsExit,NULL,NULL);
|
||||||
AddCommand(pInter,"FileEval",MacroFileEval,NULL,NULL);
|
AddCommand(pInter,"FileEval",MacroFileEval,NULL,NULL);
|
||||||
|
|
||||||
AddCommand(pInter,"InternEval",InternalFileEval,NULL,NULL);
|
AddCommand(pInter,"InternEval",InternalFileEval,NULL,NULL);
|
||||||
|
/*
|
||||||
AddCommand(pInter,"FileWhere",MacroWhere,WhereKill,NULL);
|
AddCommand(pInter,"FileWhere",MacroWhere,WhereKill,NULL);
|
||||||
|
*/
|
||||||
AddCommand(pInter,"ClientPut",ClientPut,NULL,NULL);
|
AddCommand(pInter,"ClientPut",ClientPut,NULL,NULL);
|
||||||
AddCommand(pInter,"broadcast",Broadcast,NULL,NULL);
|
AddCommand(pInter,"broadcast",Broadcast,NULL,NULL);
|
||||||
AddCommand(pInter,"transact",TransactAction,NULL,NULL);
|
AddCommand(pInter,"transact",TransactAction,NULL,NULL);
|
||||||
@ -242,6 +246,7 @@
|
|||||||
AddCommand(pInter,"scriptcallback",CallbackScript,NULL,NULL);
|
AddCommand(pInter,"scriptcallback",CallbackScript,NULL,NULL);
|
||||||
AddCommand(pInter,"help",SicsHelp,KillHelp,NULL);
|
AddCommand(pInter,"help",SicsHelp,KillHelp,NULL);
|
||||||
AddCommand(pInter,"list",SicsList,NULL,NULL);
|
AddCommand(pInter,"list",SicsList,NULL,NULL);
|
||||||
|
AddCommand(pInter,"InstallHdb",InstallSICSHipadaba,NULL,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
|
||||||
@ -371,7 +376,7 @@
|
|||||||
RemoveCommand(pSics,"MakeLin2Ang");
|
RemoveCommand(pSics,"MakeLin2Ang");
|
||||||
RemoveCommand(pSics,"MakeSync");
|
RemoveCommand(pSics,"MakeSync");
|
||||||
RemoveCommand(pSics,"MakeHMControl");
|
RemoveCommand(pSics,"MakeHMControl");
|
||||||
/* RemoveCommand(pSics,"MakeRS232Controller"); */
|
RemoveCommand(pSics,"MakeRS232Controller");
|
||||||
RemoveCommand(pSics,"MakeMaxDetector");
|
RemoveCommand(pSics,"MakeMaxDetector");
|
||||||
RemoveCommand(pSics,"AntiColliderInstall");
|
RemoveCommand(pSics,"AntiColliderInstall");
|
||||||
RemoveCommand(pSics,"MakeGPIB");
|
RemoveCommand(pSics,"MakeGPIB");
|
||||||
@ -407,6 +412,7 @@
|
|||||||
/* insert here initialization routines ... */
|
/* insert here initialization routines ... */
|
||||||
|
|
||||||
INIT(SiteInit); /* site specific initializations */
|
INIT(SiteInit); /* site specific initializations */
|
||||||
|
INIT(StatisticsInit);
|
||||||
|
|
||||||
}
|
}
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
@ -423,18 +429,15 @@
|
|||||||
InitGeneral();
|
InitGeneral();
|
||||||
|
|
||||||
/* general initialization */
|
/* general initialization */
|
||||||
InitIniCommands(pSics,pServ->pTasker);
|
|
||||||
|
|
||||||
/* create a connection */
|
/* create a connection */
|
||||||
pCon = SCCreateDummyConnection(pSics);
|
pCon = SCCreateDummyConnection(pSics);
|
||||||
if(!pCon)
|
if(!pCon)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* removed (gives double output to stdout)
|
MakeExeManager(pCon,pSics,NULL,1, NULL);
|
||||||
pCon->iFiles = 1;
|
InitIniCommands(pSics,pServ->pTasker);
|
||||||
pCon->pFiles[0] = stdout;
|
|
||||||
*/
|
|
||||||
pCon->iFiles = 0;
|
pCon->iFiles = 0;
|
||||||
|
|
||||||
/* evaluate the file */
|
/* evaluate the file */
|
||||||
|
278
optimise.c
278
optimise.c
@ -22,6 +22,7 @@
|
|||||||
#include "scan.i"
|
#include "scan.i"
|
||||||
#include "fitcenter.h"
|
#include "fitcenter.h"
|
||||||
#include "optimise.h"
|
#include "optimise.h"
|
||||||
|
#include "stdscan.h"
|
||||||
|
|
||||||
#ifdef CYGNUS
|
#ifdef CYGNUS
|
||||||
#define MAXFLOAT 9999999.99
|
#define MAXFLOAT 9999999.99
|
||||||
@ -83,7 +84,6 @@
|
|||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
pOptimise CreateOptimiser(pCounter pCount)
|
pOptimise CreateOptimiser(pCounter pCount)
|
||||||
@ -466,6 +466,197 @@
|
|||||||
|
|
||||||
return iReturn;
|
return iReturn;
|
||||||
}
|
}
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
* We use the scan object here for counting. The reason is that this
|
||||||
|
* handles well in the common case of a single counter but also has
|
||||||
|
* provisions for other counting methods through the scan modules
|
||||||
|
* scripting mechanism
|
||||||
|
* ------------------------------------------------------------------------*/
|
||||||
|
static long ClimbCount(pOptimise self, SConnection *pCon)
|
||||||
|
{
|
||||||
|
int status;
|
||||||
|
long data[1];
|
||||||
|
int (*CollectFunc)(pScanData self, int iPoint) = NULL;
|
||||||
|
|
||||||
|
SilentPrepare(self->pScanner);
|
||||||
|
|
||||||
|
status = self->pScanner->ScanCount(self->pScanner,0);
|
||||||
|
if(status != 1)
|
||||||
|
{
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
if(self->pScanner->CollectScanData == CollectScanData)
|
||||||
|
{
|
||||||
|
CollectFunc = self->pScanner->CollectScanData;
|
||||||
|
self->pScanner->CollectScanData = CollectSilent;
|
||||||
|
}
|
||||||
|
status = self->pScanner->CollectScanData(self->pScanner,0);
|
||||||
|
if(CollectFunc != NULL)
|
||||||
|
{
|
||||||
|
self->pScanner->CollectScanData = CollectFunc;
|
||||||
|
}
|
||||||
|
if(status != 1)
|
||||||
|
{
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
GetScanCounts(self->pScanner,data,1);
|
||||||
|
return data[0];
|
||||||
|
}
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
static int ClimbDrive(SConnection *pCon,char *name, float value)
|
||||||
|
{
|
||||||
|
int status;
|
||||||
|
|
||||||
|
status = Start2Run(pCon,pServ->pSics,name,value);
|
||||||
|
if(status != 1)
|
||||||
|
{
|
||||||
|
return DRIVEERROR;
|
||||||
|
}
|
||||||
|
status = Wait4Success(GetExecutor());
|
||||||
|
if(status != DEVDONE)
|
||||||
|
{
|
||||||
|
return DRIVEERROR;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
/*-------------------------------------------------------------------------*/
|
||||||
|
static int ClimbVariable(pOptimise self, SConnection *pCon, int i)
|
||||||
|
{
|
||||||
|
pOVarEntry pOvar;
|
||||||
|
void *pData;
|
||||||
|
int status, direction = 1;
|
||||||
|
long oneCount, twoCount, lastCount, currentCount;
|
||||||
|
float varValue, startValue;
|
||||||
|
char buffer[256];
|
||||||
|
int (*CollectFunc)(pScanData self, int iPoint) = NULL;
|
||||||
|
|
||||||
|
assert(self);
|
||||||
|
assert( (i >= 0) && (i < self->iVar));
|
||||||
|
assert(pCon);
|
||||||
|
|
||||||
|
/* get variable data */
|
||||||
|
DynarGet(self->pVariables,i,&pData);
|
||||||
|
pOvar = (pOVarEntry)pData;
|
||||||
|
startValue = pOvar->fCenter;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* prepare scan object
|
||||||
|
*/
|
||||||
|
self->pScanner->pCon = pCon;
|
||||||
|
self->pScanner->pSics = pServ->pSics;
|
||||||
|
self->pScanner->iNP = 1;
|
||||||
|
self->pScanner->iMode = self->eCount;
|
||||||
|
self->pScanner->fPreset = self->fPreset;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* test for upwards direction
|
||||||
|
*/
|
||||||
|
varValue = pOvar->fCenter + pOvar->fStep;
|
||||||
|
status = ClimbDrive(pCon,pOvar->pName,varValue);
|
||||||
|
if(!status)
|
||||||
|
{
|
||||||
|
return DRIVEERROR;
|
||||||
|
}
|
||||||
|
oneCount = ClimbCount(self,pCon);
|
||||||
|
if(oneCount < 0)
|
||||||
|
{
|
||||||
|
return SCANERROR;
|
||||||
|
}
|
||||||
|
if(SCGetInterrupt(pCon) != eContinue)
|
||||||
|
{
|
||||||
|
return SCANABORT;
|
||||||
|
}
|
||||||
|
varValue = pOvar->fCenter - pOvar->fStep;
|
||||||
|
status = ClimbDrive(pCon,pOvar->pName,varValue);
|
||||||
|
if(!status)
|
||||||
|
{
|
||||||
|
return DRIVEERROR;
|
||||||
|
}
|
||||||
|
twoCount = ClimbCount(self,pCon);
|
||||||
|
if(SCGetInterrupt(pCon) != eContinue)
|
||||||
|
{
|
||||||
|
return SCANABORT;
|
||||||
|
}
|
||||||
|
if(twoCount < 0)
|
||||||
|
{
|
||||||
|
return SCANERROR;
|
||||||
|
}
|
||||||
|
if(oneCount > twoCount)
|
||||||
|
{
|
||||||
|
direction = 1;
|
||||||
|
lastCount = oneCount;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
direction = -1;
|
||||||
|
lastCount = twoCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* drive to the last best position
|
||||||
|
*/
|
||||||
|
varValue = pOvar->fCenter + direction*pOvar->fStep;
|
||||||
|
status = ClimbDrive(pCon,pOvar->pName,varValue);
|
||||||
|
if(!status)
|
||||||
|
{
|
||||||
|
return DRIVEERROR;
|
||||||
|
}
|
||||||
|
currentCount = lastCount;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* climb upwards as long as possible
|
||||||
|
*/
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
pOvar->fCenter = varValue;
|
||||||
|
varValue = pOvar->fCenter + direction * pOvar->fStep;
|
||||||
|
status = ClimbDrive(pCon,pOvar->pName,varValue);
|
||||||
|
if(!status)
|
||||||
|
{
|
||||||
|
return DRIVEERROR;
|
||||||
|
}
|
||||||
|
if(SCGetInterrupt(pCon) != eContinue)
|
||||||
|
{
|
||||||
|
return SCANABORT;
|
||||||
|
}
|
||||||
|
currentCount = ClimbCount(self,pCon);
|
||||||
|
if(currentCount < 0)
|
||||||
|
{
|
||||||
|
return SCANERROR;
|
||||||
|
}
|
||||||
|
if(SCGetInterrupt(pCon) != eContinue)
|
||||||
|
{
|
||||||
|
return SCANABORT;
|
||||||
|
}
|
||||||
|
snprintf(buffer,255,"Climbing %s, value = %f, count = %ld",
|
||||||
|
pOvar->pName, varValue, currentCount);
|
||||||
|
SCWrite(pCon,buffer,eWarning);
|
||||||
|
|
||||||
|
if(currentCount <= lastCount)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* we are finished. Drive to previous position and
|
||||||
|
* break
|
||||||
|
*/
|
||||||
|
status = ClimbDrive(pCon,pOvar->pName,pOvar->fCenter);
|
||||||
|
if(!status)
|
||||||
|
{
|
||||||
|
return DRIVEERROR;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* go on, we are not over the top yet
|
||||||
|
*/
|
||||||
|
lastCount = currentCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pOvar->fShift = ABS(startValue - pOvar->fCenter);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int CheckSuccess(pOptimise self)
|
static int CheckSuccess(pOptimise self)
|
||||||
{
|
{
|
||||||
@ -530,6 +721,45 @@
|
|||||||
}
|
}
|
||||||
return MAXCYCLE;
|
return MAXCYCLE;
|
||||||
}
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
int OptimiserClimb(pOptimise self, SConnection *pCon)
|
||||||
|
{
|
||||||
|
int i, iRet, iCycle, iRedoVar = 0;
|
||||||
|
char pBueffel[256];
|
||||||
|
|
||||||
|
assert(self);
|
||||||
|
|
||||||
|
if(self->iVar < 1)
|
||||||
|
{
|
||||||
|
SCWrite(pCon,"ERROR: Nothing to optimise",eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
iRet = OptimiserInit(self,pCon);
|
||||||
|
if(!iRet)
|
||||||
|
{
|
||||||
|
return iRet;
|
||||||
|
}
|
||||||
|
for(iCycle = 0; iCycle < self->iMaxCycles; iCycle++)
|
||||||
|
{
|
||||||
|
sprintf(pBueffel,"Optimiser cycle %d of %d started",iCycle, self->iMaxCycles);
|
||||||
|
SCWrite(pCon,pBueffel,eStatus);
|
||||||
|
for(i = iRedoVar; i < self->iVar; i++)
|
||||||
|
{
|
||||||
|
iRet = ClimbVariable(self,pCon,i);
|
||||||
|
if(iRet <= 0)
|
||||||
|
{
|
||||||
|
return iRet;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
iRet = CheckSuccess(self);
|
||||||
|
if(iRet)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return MAXCYCLE;
|
||||||
|
}
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
int MakeOptimiser(SConnection *pCon, SicsInterp *pSics, void *pData,
|
int MakeOptimiser(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
int argc, char *argv[])
|
int argc, char *argv[])
|
||||||
@ -717,6 +947,52 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*-------- climb */
|
||||||
|
else if(strcmp(argv[1],"climb") == 0)
|
||||||
|
{
|
||||||
|
/* check rights */
|
||||||
|
if(!SCMatchRights(pCon,usUser))
|
||||||
|
{
|
||||||
|
SCWrite(pCon,"ERROR: You are not aurhorised to do this!",eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
iRet = OptimiserClimb(self,pCon);
|
||||||
|
switch(iRet)
|
||||||
|
{
|
||||||
|
case PEAKLOST:
|
||||||
|
SCWrite(pCon,"ERROR: lost the peak, sorry!",eError);
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
case MAXCYCLE:
|
||||||
|
sprintf(pBueffel,"ERROR: could not optimise peak in %d cycles",
|
||||||
|
self->iMaxCycles);
|
||||||
|
SCWrite(pCon,pBueffel,eError);
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
case SCANERROR:
|
||||||
|
SCWrite(pCon,"ERROR: failed to scan the peak",eError);
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
case SCANABORT:
|
||||||
|
SCWrite(pCon,"ERROR: Scan was aborted, Optimiser follows",eError);
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
case DRIVEERROR:
|
||||||
|
SCWrite(pCon,"ERROR: Failure to drive variable to new position",eError);
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
SCWrite(pCon,"At long last, I finished optimising the peak",eValue);
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
SCWrite(pCon,"ERROR: Unidentified error krept into Optimiser",eError);
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
SCWrite(pCon,"Optimiser climbed successfully",eValue);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
/* ------ count mode */
|
/* ------ count mode */
|
||||||
if(strcmp(argv[1],"countmode") == 0)
|
if(strcmp(argv[1],"countmode") == 0)
|
||||||
{
|
{
|
||||||
|
@ -170,7 +170,6 @@ static int StartOscillation(pOscillator self, SConnection *pCon){
|
|||||||
static void KillOscillator(void *data){
|
static void KillOscillator(void *data){
|
||||||
pOscillator self = (pOscillator)data;
|
pOscillator self = (pOscillator)data;
|
||||||
if(self != NULL){
|
if(self != NULL){
|
||||||
StopOscillation(self);
|
|
||||||
if(self->pDes != NULL){
|
if(self->pDes != NULL){
|
||||||
DeleteDescriptor(self->pDes);
|
DeleteDescriptor(self->pDes);
|
||||||
}
|
}
|
||||||
|
@ -552,7 +552,11 @@ int SCWriteSycamore(SConnection *pCon, char *pBuffer, int iOut)
|
|||||||
|
|
||||||
if (iOut == eEvent) {
|
if (iOut == eEvent) {
|
||||||
DynStringConcat(pMsgString, " type=");
|
DynStringConcat(pMsgString, " type=");
|
||||||
DynStringConcat(pMsgString, pEventType[pCon->conEventType]);
|
/* Default type to VALUECHANGE if conEventType not set */
|
||||||
|
if (-1 == pCon->conEventType)
|
||||||
|
DynStringConcat(pMsgString, pEventType[0]);
|
||||||
|
else
|
||||||
|
DynStringConcat(pMsgString, pEventType[pCon->conEventType]);
|
||||||
/* DynStringConcat(pMsgString, " status=");
|
/* DynStringConcat(pMsgString, " status=");
|
||||||
DynStringConcat(pMsgString, pStatus[pCon->conStatus]);*/
|
DynStringConcat(pMsgString, pStatus[pCon->conStatus]);*/
|
||||||
}
|
}
|
||||||
|
6
remob.c
6
remob.c
@ -534,7 +534,6 @@ int RemobAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
|||||||
float fValue;
|
float fValue;
|
||||||
long lID;
|
long lID;
|
||||||
char *endp;
|
char *endp;
|
||||||
char *argv0;
|
|
||||||
char *cmd;
|
char *cmd;
|
||||||
/*
|
/*
|
||||||
char acce[128], inte[128];
|
char acce[128], inte[128];
|
||||||
@ -559,10 +558,7 @@ int RemobAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
|||||||
snprintf(inte, sizeof(inte), "!%s.interruptmode", remob->name);
|
snprintf(inte, sizeof(inte), "!%s.interruptmode", remob->name);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
argv0 = argv[0];
|
cmd = Arg2Tcl0(argc-1, argv+1, buf, sizeof buf, remob->name);
|
||||||
argv[0] = remob->name;
|
|
||||||
cmd = Arg2Tcl(argc, argv, buf, sizeof buf);
|
|
||||||
argv[0] = argv0;
|
|
||||||
if (cmd) {
|
if (cmd) {
|
||||||
RemTransact(remserver, rc, pCon, cmd, ">", NULL);
|
RemTransact(remserver, rc, pCon, cmd, ">", NULL);
|
||||||
if (cmd != buf) free(cmd);
|
if (cmd != buf) free(cmd);
|
||||||
|
38
scan.tex
38
scan.tex
@ -52,6 +52,7 @@ $\langle$scanvar {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ float fStep;@\\
|
\mbox{}\verb@ float fStep;@\\
|
||||||
\mbox{}\verb@ float *fData;@\\
|
\mbox{}\verb@ float *fData;@\\
|
||||||
\mbox{}\verb@ int dataList;@\\
|
\mbox{}\verb@ int dataList;@\\
|
||||||
|
\mbox{}\verb@ int logVar;@\\
|
||||||
\mbox{}\verb@ }VarEntry, *pVarEntry;@\\
|
\mbox{}\verb@ }VarEntry, *pVarEntry;@\\
|
||||||
\mbox{}\verb@@$\diamond$
|
\mbox{}\verb@@$\diamond$
|
||||||
\end{list}
|
\end{list}
|
||||||
@ -88,6 +89,14 @@ $\langle$scanvarint {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ pVarEntry MakeScanVar(SicsInterp *pSics, SConnection *pCon, char@\\
|
\mbox{}\verb@ pVarEntry MakeScanVar(SicsInterp *pSics, SConnection *pCon, char@\\
|
||||||
\mbox{}\verb@ *name, float start, float step);@\\
|
\mbox{}\verb@ *name, float start, float step);@\\
|
||||||
\mbox{}\verb@ /**@\\
|
\mbox{}\verb@ /**@\\
|
||||||
|
\mbox{}\verb@ * make a variable which is logged during the scan but not driven.@\\
|
||||||
|
\mbox{}\verb@ * @{\tt @}\verb@param pSics The interpreter in order to locate the variable.@\\
|
||||||
|
\mbox{}\verb@ * @{\tt @}\verb@param pCon A connection object for error reporting@\\
|
||||||
|
\mbox{}\verb@ * @{\tt @}\verb@param name The name of the variable to log@\\
|
||||||
|
\mbox{}\verb@ */@\\
|
||||||
|
\mbox{}\verb@ pVarEntry MakeLogVar(SicsInterp *pSics, @\\
|
||||||
|
\mbox{}\verb@ SConnection *pCon, char *name);@\\
|
||||||
|
\mbox{}\verb@ /**@\\
|
||||||
\mbox{}\verb@ * InitScanVar clears the list of scan points@\\
|
\mbox{}\verb@ * InitScanVar clears the list of scan points@\\
|
||||||
\mbox{}\verb@ * @{\tt @}\verb@param pvar The scna variable to clear@\\
|
\mbox{}\verb@ * @{\tt @}\verb@param pvar The scna variable to clear@\\
|
||||||
\mbox{}\verb@ */@\\
|
\mbox{}\verb@ */@\\
|
||||||
@ -145,6 +154,21 @@ $\langle$scanvarint {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ * @{\tt @}\verb@param np The number of slots in fData.@\\
|
\mbox{}\verb@ * @{\tt @}\verb@param np The number of slots in fData.@\\
|
||||||
\mbox{}\verb@ */@\\
|
\mbox{}\verb@ */@\\
|
||||||
\mbox{}\verb@ void CopyScanVar(pVarEntry pVar, float *fData, int np);@\\
|
\mbox{}\verb@ void CopyScanVar(pVarEntry pVar, float *fData, int np);@\\
|
||||||
|
\mbox{}\verb@ /**@\\
|
||||||
|
\mbox{}\verb@ * CheckScanVar checks if the scan variable can be driven through the@\\
|
||||||
|
\mbox{}\verb@ * whole range.@\\
|
||||||
|
\mbox{}\verb@ * @{\tt @}\verb@param pVar The scan variable to check@\\
|
||||||
|
\mbox{}\verb@ * @{\tt @}\verb@param pCon The connection object to which to report errors.@\\
|
||||||
|
\mbox{}\verb@ * @{\tt @}\verb@param np The number of points to check for.@\\
|
||||||
|
\mbox{}\verb@ * @{\tt @}\verb@return 0 on failuyre, 1 on success@\\
|
||||||
|
\mbox{}\verb@ */@\\
|
||||||
|
\mbox{}\verb@ int CheckScanVar(pVarEntry pVar, SConnection *pCon, int np);@\\
|
||||||
|
\mbox{}\verb@ /**@\\
|
||||||
|
\mbox{}\verb@ * queries if the variable is alogged variable or a drive one.@\\
|
||||||
|
\mbox{}\verb@ * @{\tt @}\verb@param pVar The variable to query.@\\
|
||||||
|
\mbox{}\verb@ * @{\tt @}\verb@return 1 if log var, 0 else@\\
|
||||||
|
\mbox{}\verb@ */@\\
|
||||||
|
\mbox{}\verb@ int isLogVar(pVarEntry pVar);@\\
|
||||||
\mbox{}\verb@@$\diamond$
|
\mbox{}\verb@@$\diamond$
|
||||||
\end{list}
|
\end{list}
|
||||||
\vspace{-1ex}
|
\vspace{-1ex}
|
||||||
@ -451,6 +475,15 @@ $\langle$stdscan {\footnotesize ?}$\rangle\equiv$
|
|||||||
\begin{list}{}{} \item
|
\begin{list}{}{} \item
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
\mbox{}\verb@ /**@\\
|
\mbox{}\verb@ /**@\\
|
||||||
|
\mbox{}\verb@ * make a filename according to SICS rules for this scan@\\
|
||||||
|
\mbox{}\verb@ */@\\
|
||||||
|
\mbox{}\verb@ char *ScanMakeFileName(SicsInterp *pSics, SConnection *pCon);@\\
|
||||||
|
\mbox{}\verb@ /*@\\
|
||||||
|
\mbox{}\verb@ * write the header bits from the template@\\
|
||||||
|
\mbox{}\verb@ */@\\
|
||||||
|
\mbox{}\verb@ void WriteTemplate(FILE *fd, FILE *temp, char *filename, pScanData pScan, @\\
|
||||||
|
\mbox{}\verb@ SConnection *pCon, SicsInterp *pSics);@\\
|
||||||
|
\mbox{}\verb@ /**@\\
|
||||||
\mbox{}\verb@ * write the header of the scan file@\\
|
\mbox{}\verb@ * write the header of the scan file@\\
|
||||||
\mbox{}\verb@ */@\\
|
\mbox{}\verb@ */@\\
|
||||||
\mbox{}\verb@ int WriteHeader(pScanData self);@\\
|
\mbox{}\verb@ int WriteHeader(pScanData self);@\\
|
||||||
@ -474,6 +507,10 @@ $\langle$stdscan {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ */ @\\
|
\mbox{}\verb@ */ @\\
|
||||||
\mbox{}\verb@ int NonCheckPrepare(pScanData self);@\\
|
\mbox{}\verb@ int NonCheckPrepare(pScanData self);@\\
|
||||||
\mbox{}\verb@ /**@\\
|
\mbox{}\verb@ /**@\\
|
||||||
|
\mbox{}\verb@ * prepare for a scan without complaining...@\\
|
||||||
|
\mbox{}\verb@ */@\\
|
||||||
|
\mbox{}\verb@ int SilentPrepare(pScanData self);@\\
|
||||||
|
\mbox{}\verb@ /**@\\
|
||||||
\mbox{}\verb@ * ScanDrive handles driving to the scan point iPoint.@\\
|
\mbox{}\verb@ * ScanDrive handles driving to the scan point iPoint.@\\
|
||||||
\mbox{}\verb@ */ @\\
|
\mbox{}\verb@ */ @\\
|
||||||
\mbox{}\verb@ int ScanDrive(pScanData self, int iPoint);@\\
|
\mbox{}\verb@ int ScanDrive(pScanData self, int iPoint);@\\
|
||||||
@ -494,6 +531,7 @@ $\langle$stdscan {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ */@\\
|
\mbox{}\verb@ */@\\
|
||||||
\mbox{}\verb@ int CollectScanData(pScanData self, int iPoint);@\\
|
\mbox{}\verb@ int CollectScanData(pScanData self, int iPoint);@\\
|
||||||
\mbox{}\verb@ int CollectScanDataJochen(pScanData self, int iPoint);@\\
|
\mbox{}\verb@ int CollectScanDataJochen(pScanData self, int iPoint);@\\
|
||||||
|
\mbox{}\verb@ int CollectSilent(pScanData self, int iPoint);@\\
|
||||||
\mbox{}\verb@/*===================================================================*/@\\
|
\mbox{}\verb@/*===================================================================*/@\\
|
||||||
\mbox{}\verb@ /**@\\
|
\mbox{}\verb@ /**@\\
|
||||||
\mbox{}\verb@ * Script invocation for writing the scan header.@\\
|
\mbox{}\verb@ * Script invocation for writing the scan header.@\\
|
||||||
|
38
scan.w
38
scan.w
@ -47,6 +47,7 @@ Scan variables are held in this data structure:
|
|||||||
float fStep;
|
float fStep;
|
||||||
float *fData;
|
float *fData;
|
||||||
int dataList;
|
int dataList;
|
||||||
|
int logVar;
|
||||||
}VarEntry, *pVarEntry;
|
}VarEntry, *pVarEntry;
|
||||||
@}
|
@}
|
||||||
The VarEntry structure holds the data for each single scan variable.
|
The VarEntry structure holds the data for each single scan variable.
|
||||||
@ -69,6 +70,14 @@ Scan variables have an interface:
|
|||||||
*/
|
*/
|
||||||
pVarEntry MakeScanVar(SicsInterp *pSics, SConnection *pCon, char
|
pVarEntry MakeScanVar(SicsInterp *pSics, SConnection *pCon, char
|
||||||
*name, float start, float step);
|
*name, float start, float step);
|
||||||
|
/**
|
||||||
|
* make a variable which is logged during the scan but not driven.
|
||||||
|
* @@param pSics The interpreter in order to locate the variable.
|
||||||
|
* @@param pCon A connection object for error reporting
|
||||||
|
* @@param name The name of the variable to log
|
||||||
|
*/
|
||||||
|
pVarEntry MakeLogVar(SicsInterp *pSics,
|
||||||
|
SConnection *pCon, char *name);
|
||||||
/**
|
/**
|
||||||
* InitScanVar clears the list of scan points
|
* InitScanVar clears the list of scan points
|
||||||
* @@param pvar The scna variable to clear
|
* @@param pvar The scna variable to clear
|
||||||
@ -127,6 +136,21 @@ Scan variables have an interface:
|
|||||||
* @@param np The number of slots in fData.
|
* @@param np The number of slots in fData.
|
||||||
*/
|
*/
|
||||||
void CopyScanVar(pVarEntry pVar, float *fData, int np);
|
void CopyScanVar(pVarEntry pVar, float *fData, int np);
|
||||||
|
/**
|
||||||
|
* CheckScanVar checks if the scan variable can be driven through the
|
||||||
|
* whole range.
|
||||||
|
* @@param pVar The scan variable to check
|
||||||
|
* @@param pCon The connection object to which to report errors.
|
||||||
|
* @@param np The number of points to check for.
|
||||||
|
* @@return 0 on failuyre, 1 on success
|
||||||
|
*/
|
||||||
|
int CheckScanVar(pVarEntry pVar, SConnection *pCon, int np);
|
||||||
|
/**
|
||||||
|
* queries if the variable is alogged variable or a drive one.
|
||||||
|
* @@param pVar The variable to query.
|
||||||
|
* @@return 1 if log var, 0 else
|
||||||
|
*/
|
||||||
|
int isLogVar(pVarEntry pVar);
|
||||||
@}
|
@}
|
||||||
|
|
||||||
\subsubsection{The Scan Object}
|
\subsubsection{The Scan Object}
|
||||||
@ -396,6 +420,15 @@ format of this template is documented in the SICS managers
|
|||||||
documentation.
|
documentation.
|
||||||
|
|
||||||
@d stdscan @{
|
@d stdscan @{
|
||||||
|
/**
|
||||||
|
* make a filename according to SICS rules for this scan
|
||||||
|
*/
|
||||||
|
char *ScanMakeFileName(SicsInterp *pSics, SConnection *pCon);
|
||||||
|
/*
|
||||||
|
* write the header bits from the template
|
||||||
|
*/
|
||||||
|
void WriteTemplate(FILE *fd, FILE *temp, char *filename, pScanData pScan,
|
||||||
|
SConnection *pCon, SicsInterp *pSics);
|
||||||
/**
|
/**
|
||||||
* write the header of the scan file
|
* write the header of the scan file
|
||||||
*/
|
*/
|
||||||
@ -419,6 +452,10 @@ documentation.
|
|||||||
* second version of PrepareScan which does not check scan limits
|
* second version of PrepareScan which does not check scan limits
|
||||||
*/
|
*/
|
||||||
int NonCheckPrepare(pScanData self);
|
int NonCheckPrepare(pScanData self);
|
||||||
|
/**
|
||||||
|
* prepare for a scan without complaining...
|
||||||
|
*/
|
||||||
|
int SilentPrepare(pScanData self);
|
||||||
/**
|
/**
|
||||||
* ScanDrive handles driving to the scan point iPoint.
|
* ScanDrive handles driving to the scan point iPoint.
|
||||||
*/
|
*/
|
||||||
@ -440,6 +477,7 @@ documentation.
|
|||||||
*/
|
*/
|
||||||
int CollectScanData(pScanData self, int iPoint);
|
int CollectScanData(pScanData self, int iPoint);
|
||||||
int CollectScanDataJochen(pScanData self, int iPoint);
|
int CollectScanDataJochen(pScanData self, int iPoint);
|
||||||
|
int CollectSilent(pScanData self, int iPoint);
|
||||||
/*===================================================================*/
|
/*===================================================================*/
|
||||||
/**
|
/**
|
||||||
* Script invocation for writing the scan header.
|
* Script invocation for writing the scan header.
|
||||||
|
45
scanvar.h
45
scanvar.h
@ -21,7 +21,7 @@
|
|||||||
float fStep;
|
float fStep;
|
||||||
float *fData;
|
float *fData;
|
||||||
int dataList;
|
int dataList;
|
||||||
int logVar;
|
int logVar;
|
||||||
}VarEntry, *pVarEntry;
|
}VarEntry, *pVarEntry;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
@ -35,22 +35,21 @@
|
|||||||
* @param start The start position from which to scan
|
* @param start The start position from which to scan
|
||||||
* @param step The step width with which to scan.
|
* @param step The step width with which to scan.
|
||||||
* @return A pointer to a new scan variable object on success, NULL
|
* @return A pointer to a new scan variable object on success, NULL
|
||||||
* else NULL
|
* else
|
||||||
*/
|
*/
|
||||||
pVarEntry MakeScanVar(SicsInterp *pSics, SConnection *pCon, char
|
pVarEntry MakeScanVar(SicsInterp *pSics, SConnection *pCon, char
|
||||||
*name, float start, float step);
|
*name, float start, float step);
|
||||||
/*
|
/**
|
||||||
* Make a variable which is logged during the scan
|
* make a variable which is logged during the scan but not driven.
|
||||||
* @param pSics The SICS interpreter to search for the variable
|
* @param pSics The interpreter in order to locate the variable.
|
||||||
* @param pCon A connection to report problems to
|
* @param pCon A connection object for error reporting
|
||||||
* @param name The name of the variable to log
|
* @param name The name of the variable to log
|
||||||
* @return A pointer to a new scan variable object on success, NULL
|
|
||||||
* else NULL
|
|
||||||
*/
|
*/
|
||||||
pVarEntry MakeLogVar(SicsInterp *pSics, SConnection *pCon, char *name);
|
pVarEntry MakeLogVar(SicsInterp *pSics,
|
||||||
|
SConnection *pCon, char *name);
|
||||||
/**
|
/**
|
||||||
* InitScanVar clears the list of scan points
|
* InitScanVar clears the list of scan points
|
||||||
* @param pvar The scan variable to clear
|
* @param pvar The scna variable to clear
|
||||||
*/
|
*/
|
||||||
void InitScanVar(pVarEntry pVar);
|
void InitScanVar(pVarEntry pVar);
|
||||||
/**
|
/**
|
||||||
@ -76,14 +75,6 @@
|
|||||||
* @return The step width for the scan.
|
* @return The step width for the scan.
|
||||||
*/
|
*/
|
||||||
float ScanVarStep(pVarEntry pVar);
|
float ScanVarStep(pVarEntry pVar);
|
||||||
/**
|
|
||||||
* check if the scan is possible, i.e the scan variable does
|
|
||||||
* not violate the limits in the scan
|
|
||||||
* @param pVar The scan variable to check
|
|
||||||
* @param pCon The connection to report errors to
|
|
||||||
* @return 1 when OK, 0 when the limits are violated.
|
|
||||||
*/
|
|
||||||
int CheckScanVar(pVarEntry pVar, SConnection *pCon, int np);
|
|
||||||
/**
|
/**
|
||||||
* StartScanVar starts the scan variable to drive to the next
|
* StartScanVar starts the scan variable to drive to the next
|
||||||
* position.
|
* position.
|
||||||
@ -115,7 +106,19 @@
|
|||||||
*/
|
*/
|
||||||
void CopyScanVar(pVarEntry pVar, float *fData, int np);
|
void CopyScanVar(pVarEntry pVar, float *fData, int np);
|
||||||
/**
|
/**
|
||||||
* enquires if a variable is a logged variable or a proper scan variable
|
* CheckScanVar checks if the scan variable can be driven through the
|
||||||
*/
|
* whole range.
|
||||||
|
* @param pVar The scan variable to check
|
||||||
|
* @param pCon The connection object to which to report errors.
|
||||||
|
* @param np The number of points to check for.
|
||||||
|
* @return 0 on failuyre, 1 on success
|
||||||
|
*/
|
||||||
|
int CheckScanVar(pVarEntry pVar, SConnection *pCon, int np);
|
||||||
|
/**
|
||||||
|
* queries if the variable is alogged variable or a drive one.
|
||||||
|
* @param pVar The variable to query.
|
||||||
|
* @return 1 if log var, 0 else
|
||||||
|
*/
|
||||||
int isLogVar(pVarEntry pVar);
|
int isLogVar(pVarEntry pVar);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
6
sics.h
6
sics.h
@ -36,6 +36,12 @@
|
|||||||
|
|
||||||
extern pServer pServ;
|
extern pServer pServ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decode privilege text. Implemented in access.c
|
||||||
|
* @param the text to decode
|
||||||
|
* @return -1 if code invalid, else the privilege code
|
||||||
|
*/
|
||||||
|
int decodeSICSPriv(char *privText);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
35
sicvar.c
35
sicvar.c
@ -136,13 +136,6 @@
|
|||||||
"float",
|
"float",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
static char *cAccess[] = {
|
|
||||||
"internal",
|
|
||||||
"mugger",
|
|
||||||
"user",
|
|
||||||
"spy",
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
int VarFactory(SConnection *pCon, SicsInterp *pSics, void *pData,
|
int VarFactory(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
int argc, char *argv[])
|
int argc, char *argv[])
|
||||||
@ -196,30 +189,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* argv[3] must be the access code, check that now */
|
/* argv[3] must be the access code, check that now */
|
||||||
i = 0;
|
i = decodeSICSPriv(argv[3]);
|
||||||
while(cAccess[i] != NULL)
|
if(i < 0){
|
||||||
{
|
|
||||||
if(strcmp(argv[3],cAccess[i]) == 0)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
switch(i)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
iCode = usInternal;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
iCode = usMugger;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
iCode = usUser;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
iCode = usSpy;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
sprintf(pBueffel," %s access code %s not recognized",
|
sprintf(pBueffel," %s access code %s not recognized",
|
||||||
argv[1], argv[3]);
|
argv[1], argv[3]);
|
||||||
SCWrite(pCon,pBueffel,eError);
|
SCWrite(pCon,pBueffel,eError);
|
||||||
@ -227,7 +198,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* now we can actually install the variable */
|
/* now we can actually install the variable */
|
||||||
pRes = VarCreate(iCode,eType,argv[1]);
|
pRes = VarCreate(i,eType,argv[1]);
|
||||||
if(!pRes)
|
if(!pRes)
|
||||||
{
|
{
|
||||||
sprintf(pBueffel,"Memory Error creating variable %s", argv[1]);
|
sprintf(pBueffel,"Memory Error creating variable %s", argv[1]);
|
||||||
|
21
splitter.c
21
splitter.c
@ -400,12 +400,18 @@ typedef enum _CharType {eSpace, eNum,eeText,eQuote} CharType;
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
char *Arg2Tcl(int argc, char *argv[], char *buffer, int buffersize) {
|
char *Arg2Tcl0(int argc, char *argv[], char *buffer, int buffersize, char *prepend) {
|
||||||
int i, l, firstArgToQuote, quote;
|
int i, l, firstArgToQuote, quote, prependlen;
|
||||||
char ch;
|
char ch;
|
||||||
char *res, *arg;
|
char *res, *arg;
|
||||||
|
|
||||||
l = 0;
|
if (prepend) {
|
||||||
|
prependlen = strlen(prepend);
|
||||||
|
l = prependlen + 1;
|
||||||
|
} else {
|
||||||
|
prependlen = 0;
|
||||||
|
l = 0;
|
||||||
|
}
|
||||||
firstArgToQuote = argc;
|
firstArgToQuote = argc;
|
||||||
quote = 0;
|
quote = 0;
|
||||||
for (i=0; i<argc; i++) {
|
for (i=0; i<argc; i++) {
|
||||||
@ -443,6 +449,11 @@ char *Arg2Tcl(int argc, char *argv[], char *buffer, int buffersize) {
|
|||||||
if (buffer == NULL) return NULL;
|
if (buffer == NULL) return NULL;
|
||||||
}
|
}
|
||||||
res = buffer;
|
res = buffer;
|
||||||
|
if (prepend) {
|
||||||
|
strcpy(res, prepend);
|
||||||
|
res += prependlen;
|
||||||
|
*res++ = ' ';
|
||||||
|
}
|
||||||
for (i=0; i<argc; i++) {
|
for (i=0; i<argc; i++) {
|
||||||
if (i >= firstArgToQuote) *res++ = '"';
|
if (i >= firstArgToQuote) *res++ = '"';
|
||||||
arg = argv[i];
|
arg = argv[i];
|
||||||
@ -464,6 +475,10 @@ char *Arg2Tcl(int argc, char *argv[], char *buffer, int buffersize) {
|
|||||||
*res='\0';
|
*res='\0';
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
char *Arg2Tcl(int argc, char *argv[], char *buffer, int buffersize) {
|
||||||
|
return Arg2Tcl0(argc, argv, buffer, buffersize, NULL);
|
||||||
|
}
|
||||||
/*============================================================================
|
/*============================================================================
|
||||||
|
|
||||||
Testprogram, can be activated by defining MAIN
|
Testprogram, can be activated by defining MAIN
|
||||||
|
@ -87,5 +87,10 @@ typedef struct _TokenEntry {
|
|||||||
if (result != NULL && result != buffer) free(result);
|
if (result != NULL && result != buffer) free(result);
|
||||||
|
|
||||||
!*/
|
!*/
|
||||||
|
char *Arg2Tcl0(int argc, char *argv[], char *buffer, int buffersize, char *prepend);
|
||||||
|
/*!
|
||||||
|
This function is added for convenience, and acts similar to Arg2Tcl.
|
||||||
|
If prepend is not NULL, its contents appear untreated before the args.
|
||||||
|
A space is used as separator.
|
||||||
|
!*/
|
||||||
#endif
|
#endif
|
||||||
|
234
stdscan.c
234
stdscan.c
@ -64,8 +64,240 @@ static char *fixExtension(char *filename)
|
|||||||
}
|
}
|
||||||
return fixExtension(pRes);
|
return fixExtension(pRes);
|
||||||
}
|
}
|
||||||
|
/*-------------------------------------------------------------------------*/
|
||||||
|
void WriteTemplate(FILE *fd, FILE *temp, char *filename, pScanData pScan,
|
||||||
|
SConnection *pCon, SicsInterp *pSics)
|
||||||
|
{
|
||||||
|
char pBuffer[512], pError[512], *pPtr, *pName;
|
||||||
|
CommandList *pCom = NULL;
|
||||||
|
pSicsVariable pVar = NULL;
|
||||||
|
pDummy pDum = NULL;
|
||||||
|
pIDrivable pDriv = NULL;
|
||||||
|
pMotor pMot = NULL;
|
||||||
|
pVarEntry pScanVar = NULL;
|
||||||
|
void *pVoid = NULL;
|
||||||
|
float fVal;
|
||||||
|
int iRet;
|
||||||
|
|
||||||
|
/* loop through description file and act along the way */
|
||||||
|
while(fgets(pBuffer,511,temp) != NULL)
|
||||||
|
{
|
||||||
|
pPtr = strstr(pBuffer,"!!VAR(");
|
||||||
|
if(pPtr) /* handle a Sics variable */
|
||||||
|
{
|
||||||
|
/* extract the name */
|
||||||
|
pName = pPtr + 6; /* first char of name */
|
||||||
|
*pPtr = '\0'; /* this is the starter of the line */
|
||||||
|
pPtr = pName;
|
||||||
|
while( (*pPtr != '\0') && (*pPtr != ')') )
|
||||||
|
{
|
||||||
|
pPtr++;
|
||||||
|
}
|
||||||
|
*pPtr = '\0';
|
||||||
|
/* find the variable */
|
||||||
|
pCom = FindCommand(pSics,pName);
|
||||||
|
if(!pCom)
|
||||||
|
{
|
||||||
|
sprintf(pError,"ERROR: variable %s NOT found",pName);
|
||||||
|
SCWrite(pCon,pError,eError);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
pVar = (pSicsVariable)pCom->pData;
|
||||||
|
if(!pVar)
|
||||||
|
{
|
||||||
|
sprintf(pError,"ERROR: variable %s NOT found",pName);
|
||||||
|
SCWrite(pCon,pError,eError);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
switch(pVar->eType)
|
||||||
|
{
|
||||||
|
case veFloat:
|
||||||
|
sprintf(pError,"%f",pVar->fVal);
|
||||||
|
break;
|
||||||
|
case veInt:
|
||||||
|
sprintf(pError,"%d",pVar->iVal);
|
||||||
|
break;
|
||||||
|
case veText:
|
||||||
|
sprintf(pError,"%s",pVar->text);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* finally write */
|
||||||
|
fprintf(fd,"%s %s\n",pBuffer,pError);
|
||||||
|
continue;
|
||||||
|
}/* end variable */
|
||||||
|
/*------- Drivable */
|
||||||
|
pPtr = strstr(pBuffer,"!!DRIV(");
|
||||||
|
if(pPtr)
|
||||||
|
{
|
||||||
|
/* extract the name */
|
||||||
|
pName = pPtr + 7; /* first char of name */
|
||||||
|
*pPtr = '\0'; /* this is the starter of the line */
|
||||||
|
pPtr = pName;
|
||||||
|
while( (*pPtr != '\0') && (*pPtr != ')') )
|
||||||
|
{
|
||||||
|
pPtr++;
|
||||||
|
}
|
||||||
|
*pPtr = '\0';
|
||||||
|
/* find the variable */
|
||||||
|
pCom = FindCommand(pSics,pName);
|
||||||
|
if(!pCom)
|
||||||
|
{
|
||||||
|
sprintf(pError,"ERROR: variable %s NOT found",pName);
|
||||||
|
SCWrite(pCon,pError,eError);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
pDum = (pDummy)pCom->pData;
|
||||||
|
if(!pDum)
|
||||||
|
{
|
||||||
|
sprintf(pError,"ERROR: variable %s is NOT drivable",pName);
|
||||||
|
SCWrite(pCon,pError,eError);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
pDriv = (pIDrivable)pDum->pDescriptor->GetInterface(pDum,DRIVEID);
|
||||||
|
if(!pDriv)
|
||||||
|
{
|
||||||
|
sprintf(pError,"ERROR: variable %s is NOT drivable",pName);
|
||||||
|
SCWrite(pCon,pError,eError);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
fVal = pDriv->GetValue(pDum,pCon);
|
||||||
|
fprintf(fd,"%s %f\n",pBuffer,fVal);
|
||||||
|
continue;
|
||||||
|
} /* end drive */
|
||||||
|
/*------- zero point */
|
||||||
|
pPtr = strstr(pBuffer,"!!ZERO(");
|
||||||
|
if(pPtr)
|
||||||
|
{
|
||||||
|
/* extract the name */
|
||||||
|
pName = pPtr + 7; /* first char of name */
|
||||||
|
*pPtr = '\0'; /* this is the starter of the line */
|
||||||
|
pPtr = pName;
|
||||||
|
while( (*pPtr != '\0') && (*pPtr != ')') )
|
||||||
|
{
|
||||||
|
pPtr++;
|
||||||
|
}
|
||||||
|
*pPtr = '\0';
|
||||||
|
/* find the motor */
|
||||||
|
pMot = FindMotor(pSics,pName);
|
||||||
|
if(!pMot)
|
||||||
|
{
|
||||||
|
sprintf(pError,"ERROR: motor %s NOT found",pName);
|
||||||
|
SCWrite(pCon,pError,eError);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
iRet = MotorGetPar(pMot,"softzero",&fVal);
|
||||||
|
if(!iRet)
|
||||||
|
{
|
||||||
|
SCWrite(pCon,"ERROR: failed to read zero point",eError);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
fprintf(fd,"%s %f\n",pBuffer,fVal);
|
||||||
|
continue;
|
||||||
|
} /* end zero point */
|
||||||
|
/*---------- scripted info */
|
||||||
|
pPtr = strstr(pBuffer,"!!SCRIPT(");
|
||||||
|
if(pPtr)
|
||||||
|
{
|
||||||
|
/* extract the name */
|
||||||
|
pName = pPtr + 9; /* first char of name */
|
||||||
|
*pPtr = '\0'; /* this is the starter of the line */
|
||||||
|
pPtr = pName;
|
||||||
|
while( (*pPtr != '\0') && (*pPtr != ')') )
|
||||||
|
{
|
||||||
|
pPtr++;
|
||||||
|
}
|
||||||
|
*pPtr = '\0';
|
||||||
|
if(Tcl_Eval(InterpGetTcl(pSics),pName) == TCL_OK)
|
||||||
|
{
|
||||||
|
fprintf(fd,"%s\n",Tcl_GetStringResult(InterpGetTcl(pSics)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SCWrite(pCon,"ERROR: failed to execute Tcl command",eError);
|
||||||
|
strncpy(pBuffer, Tcl_GetStringResult(InterpGetTcl(pSics)), 511);
|
||||||
|
SCWrite(pCon,pBuffer,eError);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* ------- date */
|
||||||
|
pPtr = strstr(pBuffer,"!!DATE!!");
|
||||||
|
if(pPtr)
|
||||||
|
{
|
||||||
|
*pPtr = '\0';
|
||||||
|
SNXFormatTime(pError,511);
|
||||||
|
fprintf(fd,"%s %s\n",pBuffer,pError);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/*-------- filename */
|
||||||
|
pPtr = strstr(pBuffer,"!!FILE!!");
|
||||||
|
if(pPtr)
|
||||||
|
{
|
||||||
|
*pPtr = '\0';
|
||||||
|
fprintf(fd,"%s %s\n",pBuffer,filename);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/*------------ scanzero */
|
||||||
|
pPtr = strstr(pBuffer,"!!SCANZERO!!");
|
||||||
|
if(pPtr && pScan != NULL)
|
||||||
|
{
|
||||||
|
*pPtr = '\0';
|
||||||
|
/* write zero point of first scan variable if motor */
|
||||||
|
DynarGet(pScan->pScanVar,0,&pVoid);
|
||||||
|
pScanVar = (pVarEntry)pVoid;
|
||||||
|
if(pScanVar)
|
||||||
|
{
|
||||||
|
pMot = NULL;
|
||||||
|
pMot = FindMotor(pSics,ScanVarName(pScanVar));
|
||||||
|
if(pMot != NULL)
|
||||||
|
{
|
||||||
|
MotorGetPar(pMot,"softzero",&fVal);
|
||||||
|
fprintf(fd,"%s zero = %8.3f\n",ScanVarName(pScanVar),
|
||||||
|
fVal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* --------- plain text */
|
||||||
|
fprintf(fd,"%s",pBuffer);
|
||||||
|
} /* end while */
|
||||||
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int WriteHeader(pScanData self)
|
int WriteHeader(pScanData self)
|
||||||
|
{
|
||||||
|
int i, iRet;
|
||||||
|
FILE *fd;
|
||||||
|
|
||||||
|
assert(self->pSics);
|
||||||
|
assert(self->pCon);
|
||||||
|
|
||||||
|
/* open data file */
|
||||||
|
self->fd = fopen(self->pFile,"w");
|
||||||
|
if(!self->fd)
|
||||||
|
{
|
||||||
|
SCWrite(self->pCon,"ERROR: cannot write data file",eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* open header description file */
|
||||||
|
fd = fopen(self->pHeaderFile,"r");
|
||||||
|
if(!fd)
|
||||||
|
{
|
||||||
|
SCWrite(self->pCon,"ERROR: cannot open header description file",eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
WriteTemplate(self->fd,fd,self->pFile,
|
||||||
|
self, self->pCon, self->pSics);
|
||||||
|
|
||||||
|
/* remember position for seeking to it for writing data */
|
||||||
|
self->lPos = ftell(self->fd);
|
||||||
|
|
||||||
|
fclose(fd);
|
||||||
|
fclose(self->fd);
|
||||||
|
self->fd = NULL;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
int WriteHeaderOld(pScanData self)
|
||||||
{
|
{
|
||||||
int i, iRet;
|
int i, iRet;
|
||||||
FILE *fd;
|
FILE *fd;
|
||||||
@ -615,7 +847,7 @@ int prepareDataFile(pScanData self){
|
|||||||
return CollectScanDataIntern(self,iPoint,1);
|
return CollectScanDataIntern(self,iPoint,1);
|
||||||
}
|
}
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
static int CollectSilent(pScanData self, int iPoint)
|
int CollectSilent(pScanData self, int iPoint)
|
||||||
{
|
{
|
||||||
pVarEntry pVar = NULL;
|
pVarEntry pVar = NULL;
|
||||||
void *pDings;
|
void *pDings;
|
||||||
|
14
stdscan.h
14
stdscan.h
@ -11,8 +11,15 @@
|
|||||||
#ifndef SICSSTDSCAN
|
#ifndef SICSSTDSCAN
|
||||||
#define SICSSTDSCAN
|
#define SICSSTDSCAN
|
||||||
|
|
||||||
|
/**
|
||||||
|
* make a filename according to SICS rules for this scan
|
||||||
|
*/
|
||||||
char *ScanMakeFileName(SicsInterp *pSics, SConnection *pCon);
|
char *ScanMakeFileName(SicsInterp *pSics, SConnection *pCon);
|
||||||
|
/*
|
||||||
|
* write the header bits from the template
|
||||||
|
*/
|
||||||
|
void WriteTemplate(FILE *fd, FILE *temp, char *filename, pScanData pScan,
|
||||||
|
SConnection *pCon, SicsInterp *pSics);
|
||||||
/**
|
/**
|
||||||
* write the header of the scan file
|
* write the header of the scan file
|
||||||
*/
|
*/
|
||||||
@ -36,7 +43,9 @@
|
|||||||
* second version of PrepareScan which does not check scan limits
|
* second version of PrepareScan which does not check scan limits
|
||||||
*/
|
*/
|
||||||
int NonCheckPrepare(pScanData self);
|
int NonCheckPrepare(pScanData self);
|
||||||
|
/**
|
||||||
|
* prepare for a scan without complaining...
|
||||||
|
*/
|
||||||
int SilentPrepare(pScanData self);
|
int SilentPrepare(pScanData self);
|
||||||
/**
|
/**
|
||||||
* ScanDrive handles driving to the scan point iPoint.
|
* ScanDrive handles driving to the scan point iPoint.
|
||||||
@ -59,6 +68,7 @@
|
|||||||
*/
|
*/
|
||||||
int CollectScanData(pScanData self, int iPoint);
|
int CollectScanData(pScanData self, int iPoint);
|
||||||
int CollectScanDataJochen(pScanData self, int iPoint);
|
int CollectScanDataJochen(pScanData self, int iPoint);
|
||||||
|
int CollectSilent(pScanData self, int iPoint);
|
||||||
/*===================================================================*/
|
/*===================================================================*/
|
||||||
/**
|
/**
|
||||||
* Script invocation for writing the scan header.
|
* Script invocation for writing the scan header.
|
||||||
|
38
tasdrive.c
38
tasdrive.c
@ -192,22 +192,24 @@ static int TASHalt(void *pData){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
static void writeMotPos(SConnection *pCon, char *name,
|
static void writeMotPos(SConnection *pCon, int silent, char *name,
|
||||||
float val, float target){
|
float val, float target){
|
||||||
char pBueffel[132];
|
char pBueffel[132];
|
||||||
|
|
||||||
snprintf(pBueffel,131,"Driving %5s from %8.3f to %8.3f",
|
if(silent != 1) {
|
||||||
name, val, target);
|
snprintf(pBueffel,131,"Driving %5s from %8.3f to %8.3f",
|
||||||
SCWrite(pCon,pBueffel,eWarning);
|
name, val, target);
|
||||||
|
SCWrite(pCon,pBueffel,eWarning);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int startMotors(ptasMot self, tasAngles angles,
|
static int startMotors(ptasMot self, tasAngles angles,
|
||||||
SConnection *pCon, int driveQ, int driveTilt){
|
SConnection *pCon, int driveQ, int driveTilt){
|
||||||
float val;
|
float val;
|
||||||
double curve;
|
double curve;
|
||||||
int status;
|
int status, silent;
|
||||||
|
|
||||||
|
silent = self->math->silent;
|
||||||
/*
|
/*
|
||||||
monochromator
|
monochromator
|
||||||
*/
|
*/
|
||||||
@ -220,7 +222,7 @@ static int startMotors(ptasMot self, tasAngles angles,
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
writeMotPos(pCon,"a1",val, angles.monochromator_two_theta/2.);
|
writeMotPos(pCon,silent,"a1",val, angles.monochromator_two_theta/2.);
|
||||||
|
|
||||||
val = self->math->motors[A2]->pDrivInt->GetValue(self->math->motors[A2],pCon);
|
val = self->math->motors[A2]->pDrivInt->GetValue(self->math->motors[A2],pCon);
|
||||||
if(ABS(val - angles.monochromator_two_theta) > MOTPREC){
|
if(ABS(val - angles.monochromator_two_theta) > MOTPREC){
|
||||||
@ -231,7 +233,7 @@ static int startMotors(ptasMot self, tasAngles angles,
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
writeMotPos(pCon,"a2",val, angles.monochromator_two_theta);
|
writeMotPos(pCon,silent,"a2",val, angles.monochromator_two_theta);
|
||||||
|
|
||||||
if(self->math->motors[MCV] != NULL){
|
if(self->math->motors[MCV] != NULL){
|
||||||
curve = maCalcVerticalCurvature(self->math->machine.monochromator,
|
curve = maCalcVerticalCurvature(self->math->machine.monochromator,
|
||||||
@ -245,7 +247,7 @@ static int startMotors(ptasMot self, tasAngles angles,
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
writeMotPos(pCon,"mcv",val, curve);
|
writeMotPos(pCon,silent,"mcv",val, curve);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(self->math->motors[MCH] != NULL){
|
if(self->math->motors[MCH] != NULL){
|
||||||
@ -260,7 +262,7 @@ static int startMotors(ptasMot self, tasAngles angles,
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
writeMotPos(pCon,"mch",val, curve);
|
writeMotPos(pCon,silent,"mch",val, curve);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -277,7 +279,7 @@ static int startMotors(ptasMot self, tasAngles angles,
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
writeMotPos(pCon,self->math->motors[A5]->name,
|
writeMotPos(pCon,silent,self->math->motors[A5]->name,
|
||||||
val, angles.analyzer_two_theta/2.);
|
val, angles.analyzer_two_theta/2.);
|
||||||
|
|
||||||
val = self->math->motors[A6]->pDrivInt->GetValue(self->math->motors[A6],pCon);
|
val = self->math->motors[A6]->pDrivInt->GetValue(self->math->motors[A6],pCon);
|
||||||
@ -289,7 +291,7 @@ static int startMotors(ptasMot self, tasAngles angles,
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
writeMotPos(pCon,"a6",val, angles.analyzer_two_theta);
|
writeMotPos(pCon,silent,"a6",val, angles.analyzer_two_theta);
|
||||||
|
|
||||||
if(self->math->motors[ACV] != NULL){
|
if(self->math->motors[ACV] != NULL){
|
||||||
curve = maCalcVerticalCurvature(self->math->machine.analyzer,
|
curve = maCalcVerticalCurvature(self->math->machine.analyzer,
|
||||||
@ -303,7 +305,7 @@ static int startMotors(ptasMot self, tasAngles angles,
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
writeMotPos(pCon,"acv",val, curve);
|
writeMotPos(pCon,silent,"acv",val, curve);
|
||||||
}
|
}
|
||||||
if(self->math->motors[ACH] != NULL){
|
if(self->math->motors[ACH] != NULL){
|
||||||
curve = maCalcHorizontalCurvature(self->math->machine.analyzer,
|
curve = maCalcHorizontalCurvature(self->math->machine.analyzer,
|
||||||
@ -319,7 +321,7 @@ static int startMotors(ptasMot self, tasAngles angles,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
writeMotPos(pCon,"ach",val, curve);
|
writeMotPos(pCon,silent,"ach",val, curve);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(driveQ == 0){
|
if(driveQ == 0){
|
||||||
@ -338,7 +340,7 @@ static int startMotors(ptasMot self, tasAngles angles,
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
writeMotPos(pCon,"a3",val, angles.a3);
|
writeMotPos(pCon,silent,"a3",val, angles.a3);
|
||||||
|
|
||||||
val = self->math->motors[A4]->pDrivInt->GetValue(self->math->motors[A4],pCon);
|
val = self->math->motors[A4]->pDrivInt->GetValue(self->math->motors[A4],pCon);
|
||||||
if(ABS(val - angles.sample_two_theta) > MOTPREC){
|
if(ABS(val - angles.sample_two_theta) > MOTPREC){
|
||||||
@ -349,7 +351,7 @@ static int startMotors(ptasMot self, tasAngles angles,
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
writeMotPos(pCon,"a4",val, angles.sample_two_theta);
|
writeMotPos(pCon,silent,"a4",val, angles.sample_two_theta);
|
||||||
|
|
||||||
if(driveTilt == 1){
|
if(driveTilt == 1){
|
||||||
val = self->math->motors[SGL]->pDrivInt->GetValue(self->math->motors[SGL],pCon);
|
val = self->math->motors[SGL]->pDrivInt->GetValue(self->math->motors[SGL],pCon);
|
||||||
@ -361,7 +363,7 @@ static int startMotors(ptasMot self, tasAngles angles,
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
writeMotPos(pCon,"sgl",val, angles.sgl);
|
writeMotPos(pCon,silent,"sgl",val, angles.sgl);
|
||||||
|
|
||||||
val = self->math->motors[SGU]->pDrivInt->GetValue(self->math->motors[SGU],pCon);
|
val = self->math->motors[SGU]->pDrivInt->GetValue(self->math->motors[SGU],pCon);
|
||||||
if(ABS(val - angles.sgu) > MOTPREC){
|
if(ABS(val - angles.sgu) > MOTPREC){
|
||||||
@ -372,7 +374,7 @@ static int startMotors(ptasMot self, tasAngles angles,
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
writeMotPos(pCon,"sgu",val, angles.sgu);
|
writeMotPos(pCon,silent,"sgu",val, angles.sgu);
|
||||||
}
|
}
|
||||||
self->math->mustDrive = 0;
|
self->math->mustDrive = 0;
|
||||||
return OKOK;
|
return OKOK;
|
||||||
|
57
tasscanub.c
57
tasscanub.c
@ -197,6 +197,8 @@ static int TASUBHeader(pScanData self)
|
|||||||
int fx;
|
int fx;
|
||||||
tasReflection r;
|
tasReflection r;
|
||||||
double kfix;
|
double kfix;
|
||||||
|
pSicsVariable sVar = NULL;
|
||||||
|
float f1, f2, f3, f4;
|
||||||
|
|
||||||
assert(self);
|
assert(self);
|
||||||
assert(pTAS);
|
assert(pTAS);
|
||||||
@ -345,6 +347,57 @@ static int TASUBHeader(pScanData self)
|
|||||||
r.qe.qk,
|
r.qe.qk,
|
||||||
r.qe.ql);
|
r.qe.ql);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* write mupad stuff if available
|
||||||
|
*/
|
||||||
|
sVar = FindCommandData(pServ->pSics,"w1","SicsVariable");
|
||||||
|
if(sVar != NULL)
|
||||||
|
{
|
||||||
|
f1 = sVar->fVal;
|
||||||
|
sVar = FindCommandData(pServ->pSics,"w2","SicsVariable");
|
||||||
|
if(sVar != NULL)
|
||||||
|
{
|
||||||
|
f2 = sVar->fVal;
|
||||||
|
}
|
||||||
|
sVar = FindCommandData(pServ->pSics,"w3","SicsVariable");
|
||||||
|
if(sVar != NULL)
|
||||||
|
{
|
||||||
|
f3 = sVar->fVal;
|
||||||
|
}
|
||||||
|
sVar = FindCommandData(pServ->pSics,"w4","SicsVariable");
|
||||||
|
if(sVar != NULL)
|
||||||
|
{
|
||||||
|
f4 = sVar->fVal;
|
||||||
|
}
|
||||||
|
fprintf(self->fd,"PARAM: W1=%8.4f, W2=%8.4f, W3=%8.4f, W4=%8.4f\n",
|
||||||
|
f1, f2, f3, f4);
|
||||||
|
|
||||||
|
sVar = FindCommandData(pServ->pSics,"p1","SicsVariable");
|
||||||
|
if(sVar != NULL)
|
||||||
|
{
|
||||||
|
f1 = sVar->fVal;
|
||||||
|
}
|
||||||
|
sVar = FindCommandData(pServ->pSics,"p2","SicsVariable");
|
||||||
|
if(sVar != NULL)
|
||||||
|
{
|
||||||
|
f2 = sVar->fVal;
|
||||||
|
}
|
||||||
|
sVar = FindCommandData(pServ->pSics,"p3","SicsVariable");
|
||||||
|
if(sVar != NULL)
|
||||||
|
{
|
||||||
|
f3 = sVar->fVal;
|
||||||
|
}
|
||||||
|
sVar = FindCommandData(pServ->pSics,"p4","SicsVariable");
|
||||||
|
if(sVar != NULL)
|
||||||
|
{
|
||||||
|
f4 = sVar->fVal;
|
||||||
|
}
|
||||||
|
fprintf(self->fd,"PARAM: P1=%8.4f, P2=%8.4f, P3=%8.4f, P4=%8.4f\n",
|
||||||
|
f1, f2, f3, f4);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
write currents if in polarisation mode
|
write currents if in polarisation mode
|
||||||
*/
|
*/
|
||||||
@ -639,6 +692,7 @@ static int TASUBScanDrive(pScanData self, int iPoint)
|
|||||||
int iTAS = 0;
|
int iTAS = 0;
|
||||||
pMotor pMot;
|
pMotor pMot;
|
||||||
|
|
||||||
|
pTAS->ub->silent = 1;
|
||||||
/*
|
/*
|
||||||
loop through all the scan variables
|
loop through all the scan variables
|
||||||
*/
|
*/
|
||||||
@ -668,6 +722,7 @@ static int TASUBScanDrive(pScanData self, int iPoint)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
status = Wait4Success(GetExecutor());
|
status = Wait4Success(GetExecutor());
|
||||||
|
pTAS->ub->silent = 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -776,6 +831,8 @@ static int TASUBScanCount(pScanData self, int iPoint)
|
|||||||
|
|
||||||
/* loop over all scan variables */
|
/* loop over all scan variables */
|
||||||
status = 1;
|
status = 1;
|
||||||
|
|
||||||
|
pTAS->ub->silent = 0;
|
||||||
for(i = 0; i < self->iScanVar; i++)
|
for(i = 0; i < self->iScanVar; i++)
|
||||||
{
|
{
|
||||||
DynarGet(self->pScanVar,i,&pDings);
|
DynarGet(self->pScanVar,i,&pDings);
|
||||||
|
70
tasub.c
70
tasub.c
@ -241,6 +241,10 @@ int TasUBFactory(SConnection *pCon,SicsInterp *pSics, void *pData,
|
|||||||
SCWrite(pCon,"ERROR: need name to install tasUB",eError);
|
SCWrite(pCon,"ERROR: need name to install tasUB",eError);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if(argc > 2 && argc < 14){
|
||||||
|
SCWrite(pCon,"ERROR: not enough motor names specified form MakeTasUB",eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
pNew = MakeTasUB();
|
pNew = MakeTasUB();
|
||||||
if(pNew == NULL){
|
if(pNew == NULL){
|
||||||
SCWrite(pCon,"ERROR: out of memory creating tasUB",eError);
|
SCWrite(pCon,"ERROR: out of memory creating tasUB",eError);
|
||||||
@ -250,19 +254,39 @@ int TasUBFactory(SConnection *pCon,SicsInterp *pSics, void *pData,
|
|||||||
/*
|
/*
|
||||||
assign motors
|
assign motors
|
||||||
*/
|
*/
|
||||||
pNew->motors[0] = FindMotor(pSics,"a1");
|
if(argc < 14){
|
||||||
pNew->motors[1] = FindMotor(pSics,"a2");
|
/*
|
||||||
pNew->motors[2] = FindMotor(pSics,"mcv");
|
* default names and assignement
|
||||||
pNew->motors[3] = FindMotor(pSics,"mch");
|
*/
|
||||||
pNew->motors[4] = FindMotor(pSics,"a3");
|
pNew->motors[0] = FindMotor(pSics,"a1");
|
||||||
pNew->motors[5] = FindMotor(pSics,"a4");
|
pNew->motors[1] = FindMotor(pSics,"a2");
|
||||||
pNew->motors[6] = FindMotor(pSics,"sgu");
|
pNew->motors[2] = FindMotor(pSics,"mcv");
|
||||||
pNew->motors[7] = FindMotor(pSics,"sgl");
|
pNew->motors[3] = FindMotor(pSics,"mch");
|
||||||
pNew->motors[8] = FindMotor(pSics,"a5");
|
pNew->motors[4] = FindMotor(pSics,"a3");
|
||||||
pNew->motors[9] = FindMotor(pSics,"a6");
|
pNew->motors[5] = FindMotor(pSics,"a4");
|
||||||
pNew->motors[10] = FindMotor(pSics,"acv");
|
pNew->motors[6] = FindMotor(pSics,"sgu");
|
||||||
pNew->motors[11] = FindMotor(pSics,"ach");
|
pNew->motors[7] = FindMotor(pSics,"sgl");
|
||||||
|
pNew->motors[8] = FindMotor(pSics,"a5");
|
||||||
|
pNew->motors[9] = FindMotor(pSics,"a6");
|
||||||
|
pNew->motors[10] = FindMotor(pSics,"acv");
|
||||||
|
pNew->motors[11] = FindMotor(pSics,"ach");
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* user defined names
|
||||||
|
*/
|
||||||
|
pNew->motors[0] = FindMotor(pSics,argv[2]);
|
||||||
|
pNew->motors[1] = FindMotor(pSics,argv[3]);
|
||||||
|
pNew->motors[2] = FindMotor(pSics,argv[4]);
|
||||||
|
pNew->motors[3] = FindMotor(pSics,argv[5]);
|
||||||
|
pNew->motors[4] = FindMotor(pSics,argv[6]);
|
||||||
|
pNew->motors[5] = FindMotor(pSics,argv[7]);
|
||||||
|
pNew->motors[6] = FindMotor(pSics,argv[8]);
|
||||||
|
pNew->motors[7] = FindMotor(pSics,argv[9]);
|
||||||
|
pNew->motors[8] = FindMotor(pSics,argv[10]);
|
||||||
|
pNew->motors[9] = FindMotor(pSics,argv[11]);
|
||||||
|
pNew->motors[10] = FindMotor(pSics,argv[12]);
|
||||||
|
pNew->motors[11] = FindMotor(pSics,argv[13]);
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
curvature motors may be missing, anything else is a serious problem
|
curvature motors may be missing, anything else is a serious problem
|
||||||
*/
|
*/
|
||||||
@ -275,6 +299,7 @@ int TasUBFactory(SConnection *pCon,SicsInterp *pSics, void *pData,
|
|||||||
status += testMotor(pNew, pCon,"a5",A5);
|
status += testMotor(pNew, pCon,"a5",A5);
|
||||||
status += testMotor(pNew, pCon,"a6",A6);
|
status += testMotor(pNew, pCon,"a6",A6);
|
||||||
if(status != 8){
|
if(status != 8){
|
||||||
|
SCWrite(pCon,"ERROR: a required motor is mssing, tasub NOT installed",eError);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1489,6 +1514,25 @@ int TasUBWrapper(SConnection *pCon,SicsInterp *pSics, void *pData,
|
|||||||
SCWrite(pCon,pBueffel,eValue);
|
SCWrite(pCon,pBueffel,eValue);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
} else if(strcmp(argv[1],"silent") == 0){
|
||||||
|
if(argc > 2){
|
||||||
|
strtolower(argv[2]);
|
||||||
|
if(!SCMatchRights(pCon,usUser)){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
status = Tcl_GetInt(InterpGetTcl(pSics),argv[2],&newSS);
|
||||||
|
if(status != TCL_OK){
|
||||||
|
SCWrite(pCon,"ERROR: failed to convert argument to number",eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
self->silent = newSS;
|
||||||
|
SCSendOK(pCon);
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
snprintf(pBueffel,131,"%s.silent = %d",argv[0],self->silent);
|
||||||
|
SCWrite(pCon,pBueffel,eValue);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
snprintf(pBueffel,131,"ERROR: subcommand %s to %s not defined",argv[1],
|
snprintf(pBueffel,131,"ERROR: subcommand %s to %s not defined",argv[1],
|
||||||
argv[0]);
|
argv[0]);
|
||||||
|
1
tasub.h
1
tasub.h
@ -30,6 +30,7 @@
|
|||||||
pMotor motors[12];
|
pMotor motors[12];
|
||||||
tasReflection r1, r2;
|
tasReflection r1, r2;
|
||||||
int ubValid;
|
int ubValid;
|
||||||
|
int silent;
|
||||||
}tasUB, *ptasUB;
|
}tasUB, *ptasUB;
|
||||||
|
|
||||||
|
|
||||||
|
4
tasub.w
4
tasub.w
@ -32,6 +32,7 @@ A data structure:
|
|||||||
pMotor motors[12];
|
pMotor motors[12];
|
||||||
tasReflection r1, r2;
|
tasReflection r1, r2;
|
||||||
int ubValid;
|
int ubValid;
|
||||||
|
int silent;
|
||||||
}tasUB, *ptasUB;
|
}tasUB, *ptasUB;
|
||||||
@}
|
@}
|
||||||
\begin{description}
|
\begin{description}
|
||||||
@ -55,6 +56,9 @@ A data structure:
|
|||||||
runtime.
|
runtime.
|
||||||
\item[r1,r2] The indexs of the reflections used for calculating the orientation
|
\item[r1,r2] The indexs of the reflections used for calculating the orientation
|
||||||
matrix.
|
matrix.
|
||||||
|
\item[ubValid] a flag denoting if the UB is valid.
|
||||||
|
\item[silent] A flga which when 1 suppresses the printing of motor positions
|
||||||
|
when driving. Usefule for scans.
|
||||||
\end{description}
|
\end{description}
|
||||||
|
|
||||||
For the virtual motors, there must be a data structure, too:
|
For the virtual motors, there must be a data structure, too:
|
||||||
|
@ -162,7 +162,7 @@ int TclIntAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
|||||||
cmd = Arg2Tcl(argc-2, &argv[2],pBuffer,1023);
|
cmd = Arg2Tcl(argc-2, &argv[2],pBuffer,1023);
|
||||||
if (cmd) {
|
if (cmd) {
|
||||||
if(self->fd != NULL){
|
if(self->fd != NULL){
|
||||||
fprintf(self->fd,"%s\n",pBuffer);
|
fprintf(self->fd,"%s\n",cmd);
|
||||||
}
|
}
|
||||||
if (cmd != pBuffer) free(cmd);
|
if (cmd != pBuffer) free(cmd);
|
||||||
SCSendOK(pCon);
|
SCSendOK(pCon);
|
||||||
|
11
ubcalc.c
11
ubcalc.c
@ -541,6 +541,7 @@ static int cellFromUBWrapper(pUBCALC self, SConnection *pCon){
|
|||||||
int UBCalcWrapper(SConnection *pCon, SicsInterp *pSics, void *pData,
|
int UBCalcWrapper(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
int argc, char *argv[]){
|
int argc, char *argv[]){
|
||||||
pUBCALC self = (pUBCALC)pData;
|
pUBCALC self = (pUBCALC)pData;
|
||||||
|
char pBuffer[512];
|
||||||
|
|
||||||
assert(self);
|
assert(self);
|
||||||
if(argc < 2){
|
if(argc < 2){
|
||||||
@ -550,7 +551,15 @@ int UBCalcWrapper(SConnection *pCon, SicsInterp *pSics, void *pData,
|
|||||||
strtolower(argv[1]);
|
strtolower(argv[1]);
|
||||||
|
|
||||||
if(strcmp(argv[1],"cell") == 0){
|
if(strcmp(argv[1],"cell") == 0){
|
||||||
return readCell(pCon, self, argc, argv);
|
if(argc > 3){
|
||||||
|
return readCell(pCon, self, argc, argv);
|
||||||
|
} else {
|
||||||
|
snprintf(pBuffer,511,"ubcalc cell = %f %f %f %f %f %f",
|
||||||
|
self->direct.a, self->direct.b, self->direct.c,
|
||||||
|
self->direct.alpha, self->direct.beta,self->direct.gamma);
|
||||||
|
SCWrite(pCon,pBuffer,eValue);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
} else if(strcmp(argv[1],"ref1") == 0){
|
} else if(strcmp(argv[1],"ref1") == 0){
|
||||||
return readReflection(pCon,pSics, &self->r1,argc,argv);
|
return readReflection(pCon,pSics, &self->r1,argc,argv);
|
||||||
} else if(strcmp(argv[1],"ref2") ==0){
|
} else if(strcmp(argv[1],"ref2") ==0){
|
||||||
|
1
varlog.c
1
varlog.c
@ -120,6 +120,7 @@
|
|||||||
{
|
{
|
||||||
deleteCircular(self->pTail);
|
deleteCircular(self->pTail);
|
||||||
}
|
}
|
||||||
|
free(self); /* M.Z. */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
Reference in New Issue
Block a user