- Small fixes to histogram memory software

- Added simulation directories and instruments
This commit is contained in:
cvs
2002-10-30 08:59:29 +00:00
parent 269da71be2
commit 55eedb640b
24 changed files with 4406 additions and 51 deletions
+5 -5
View File
@@ -1,5 +1,5 @@
#line 477 "histogram.w"
#line 478 "histogram.w"
/*---------------------------------------------------------------------------
H I S T D R I V
@@ -13,7 +13,7 @@
#define MAXCHAN 16834
#line 82 "histogram.w"
#line 83 "histogram.w"
typedef struct __HistDriver {
/* configuration data */
@@ -77,17 +77,17 @@
void *pPriv;
} HistDriver;
#line 489 "histogram.w"
#line 490 "histogram.w"
#line 239 "histogram.w"
#line 240 "histogram.w"
pHistDriver CreateHistDriver(pStringDict pDict);
void DeleteHistDriver(pHistDriver self);
int HistDriverConfig(pHistDriver self, pStringDict pOpt,
SConnection *pCon);
#line 490 "histogram.w"
#line 491 "histogram.w"
#endif
+11 -10
View File
@@ -1,5 +1,5 @@
#line 450 "histogram.w"
#line 451 "histogram.w"
/*--------------------------------------------------------------------------
H I S T M E M
@@ -29,10 +29,11 @@
eHTOF,
eHStrobo,
eHRPT,
ePSD
ePSD,
eSANSTOF
} HistMode;
#line 34 "histogram.w"
#line 35 "histogram.w"
typedef enum {
eOIgnore,
@@ -41,22 +42,22 @@
eReflect
} OverFlowMode;
#line 470 "histogram.w"
#line 471 "histogram.w"
/*--------------------------------------------------------------------------*/
#line 303 "histogram.w"
#line 304 "histogram.w"
pHistMem CreateHistMemory(char *drivername);
void DeleteHistMemory(void *self);
#line 319 "histogram.w"
#line 320 "histogram.w"
int HistGetOption(pHistMem self, char *name, char *result, int iResultLen);
int HistSetOption(pHistMem self, char *name, char *value);
int HistConfigure(pHistMem self, SConnection *pCon, SicsInterp *pSics);
#line 347 "histogram.w"
#line 348 "histogram.w"
float GetHistPreset(pHistMem self);
int SetHistPreset(pHistMem self, float fVal);
@@ -71,7 +72,7 @@
int HistBlockCount(pHistMem self, SConnection *pCon);
#line 376 "histogram.w"
#line 377 "histogram.w"
int SetHistogram(pHistMem self, SConnection *pCon,
int i,int iStart, int iEnd, HistInt *lData);
@@ -83,7 +84,7 @@
HistInt *lData, int iDataLen);
int PresetHistogram(pHistMem self, SConnection *pCon, HistInt lVal);
#line 419 "histogram.w"
#line 420 "histogram.w"
int MakeHistMemory(SConnection *pCon, SicsInterp *pSics, void *pData,
int argc, char *argv[]);
@@ -92,7 +93,7 @@
int argc, char *argv[]);
#line 472 "histogram.w"
#line 473 "histogram.w"
#endif
+3 -3
View File
@@ -1,5 +1,5 @@
#line 495 "histogram.w"
#line 496 "histogram.w"
/*---------------------------------------------------------------------------
H I S T M E M -- Internal
@@ -11,7 +11,7 @@
#ifndef SICSHISTMEMINT
#define SICSHISTMEMINT
#line 261 "histogram.w"
#line 262 "histogram.w"
typedef struct __HistMem {
pObjectDescriptor pDes;
@@ -29,7 +29,7 @@
int iUpdateIntervall;
} HistMem;
#line 505 "histogram.w"
#line 506 "histogram.w"
#endif
+28
View File
@@ -0,0 +1,28 @@
/*-------------------------------------------------------------------------
Anticollider internal data structure definition. Generated from
anticollider.w. Do not edit.
-------------------------------------------------------------------------*/
typedef struct __ANTICOLLIDER{
pObjectDescriptor pDes;
pIDrivable pDriv;
int motorList;
int sequenceList;
char *colliderScript;
int isDirty;
int level;
}AntiCollider, *pAntiCollider;
typedef struct {
int level;
char pMotor[80];
float target;
}Sequence;
int StartLevel(int level, int sequenceList, int motorList,
SConnection *pCon);
+15 -1
View File
@@ -102,6 +102,7 @@
int iPort;
int iChannel;
void *pData;
int finishCount;
} EL737st;
/*------------------------------------------------------------------------*/
static int EL737GetStatus(struct __COUNTER *self, float *fControl)
@@ -143,18 +144,29 @@
self->lCounts[7] = iC4;
if(iRS == 0)
{
return HWIdle;
pEL737->finishCount++;
if(pEL737->finishCount >= 2)
{
return HWIdle;
}
else
{
return HWBusy;
}
}
else if((iRS == 1) || (iRS == 2))
{
pEL737->finishCount = 0;
return HWBusy;
}
else if( (iRS == 5) || (iRS == 6))
{
pEL737->finishCount = 0;
return HWNoBeam;
}
else
{
pEL737->finishCount = 0;
return HWPause;
}
}
@@ -179,6 +191,7 @@
iRet = EL737_StartCnt(&pEL737->pData,(int)nintf(self->fPreset),&iRS);
if(iRet == 1)
{
pEL737->finishCount = 0;
return OKOK;
}
else
@@ -191,6 +204,7 @@
iRet = EL737_StartTime(&pEL737->pData,self->fPreset,&iRS);
if(iRet == 1)
{
pEL737->finishCount = 0;
return OKOK;
}
else
+1
View File
@@ -108,6 +108,7 @@
"strobo",
"hrpt",
"psd",
"sanstof",
NULL
};
+3 -1
View File
@@ -654,7 +654,9 @@
myDim++;
}
}
if(self->pDriv->eHistMode == eHTOF || self->pDriv->eHistMode == ePSD)
if(self->pDriv->eHistMode == eHTOF
|| self->pDriv->eHistMode == ePSD
|| self->pDriv->eHistMode == eSANSTOF)
{
iDim[myDim] = self->pDriv->iTimeChan;
myDim++;
+2 -1
View File
@@ -18,7 +18,8 @@ $\langle$Modes {\footnotesize ?}$\rangle\equiv$
\mbox{}\verb@ eHTOF,@\\
\mbox{}\verb@ eHStrobo,@\\
\mbox{}\verb@ eHRPT,@\\
\mbox{}\verb@ ePSD@\\
\mbox{}\verb@ ePSD,@\\
\mbox{}\verb@ eSANSTOF@\\
\mbox{}\verb@ } HistMode;@\\
\mbox{}\verb@@$\diamond$
\end{list}
+2 -1
View File
@@ -13,7 +13,8 @@ histograms. Let's discuss these different modes first.
eHTOF,
eHStrobo,
eHRPT,
ePSD
ePSD,
eSANSTOF
} HistMode;
@}
A histogram memory can be operated in transparent mode. It has not yet been
+1727
View File
File diff suppressed because it is too large Load Diff
+43
View File
@@ -0,0 +1,43 @@
#define NXSIGNATURE 959697
#include "napi4.c"
/*
* HDF4 interface
*/
NX_EXTERNAL NXstatus CALLING_STYLE NX4open(CONSTCHAR *filename, NXaccess access_method, NXhandle* pHandle);
NX_EXTERNAL NXstatus CALLING_STYLE NX4close(NXhandle* pHandle);
NX_EXTERNAL NXstatus CALLING_STYLE NX4flush(NXhandle* pHandle);
NX_EXTERNAL NXstatus CALLING_STYLE NX4makegroup (NXhandle handle, CONSTCHAR* Vgroup, char* NXclass);
NX_EXTERNAL NXstatus CALLING_STYLE NX4opengroup (NXhandle handle, CONSTCHAR* Vgroup, char* NXclass);
NX_EXTERNAL NXstatus CALLING_STYLE NX4closegroup(NXhandle handle);
NX_EXTERNAL NXstatus CALLING_STYLE NX4makedata (NXhandle handle, CONSTCHAR* label, int datatype, int rank, int dim[]);
NX_EXTERNAL NXstatus CALLING_STYLE NX4compmakedata (NXhandle handle, CONSTCHAR* label, int datatype, int rank, int dim[], int comp_typ, int bufsize[]);
NX_EXTERNAL NXstatus CALLING_STYLE NX4compress (NXhandle handle, int compr_type);
NX_EXTERNAL NXstatus CALLING_STYLE NX4opendata (NXhandle handle, CONSTCHAR* label);
NX_EXTERNAL NXstatus CALLING_STYLE NX4closedata(NXhandle handle);
NX_EXTERNAL NXstatus CALLING_STYLE NX4getdata(NXhandle handle, void* data);
NX_EXTERNAL NXstatus CALLING_STYLE NX4getslab(NXhandle handle, void* data, int start[], int size[]);
NX_EXTERNAL NXstatus CALLING_STYLE NX4getattr(NXhandle handle, char* name, void* data, int* iDataLen, int* iType);
NX_EXTERNAL NXstatus CALLING_STYLE NX4putdata(NXhandle handle, void* data);
NX_EXTERNAL NXstatus CALLING_STYLE NX4putslab(NXhandle handle, void* data, int start[], int size[]);
NX_EXTERNAL NXstatus CALLING_STYLE NX4putattr(NXhandle handle, CONSTCHAR* name, void* data, int iDataLen, int iType);
NX_EXTERNAL NXstatus CALLING_STYLE NX4getinfo(NXhandle handle, int* rank, int dimension[], int* datatype);
NX_EXTERNAL NXstatus CALLING_STYLE NX4getgroupinfo(NXhandle handle, int* no_items, NXname name, NXname nxclass);
NX_EXTERNAL NXstatus CALLING_STYLE NX4initgroupdir(NXhandle handle);
NX_EXTERNAL NXstatus CALLING_STYLE NX4getnextentry(NXhandle handle, NXname name, NXname nxclass, int* datatype);
NX_EXTERNAL NXstatus CALLING_STYLE NX4getattrinfo(NXhandle handle, int* no_items);
NX_EXTERNAL NXstatus CALLING_STYLE NX4initattrdir(NXhandle handle);
NX_EXTERNAL NXstatus CALLING_STYLE NX4getnextattr(NXhandle handle, NXname pName, int *iLength, int *iType);
NX_EXTERNAL NXstatus CALLING_STYLE NX4getgroupID(NXhandle handle, NXlink* pLink);
NX_EXTERNAL NXstatus CALLING_STYLE NX4getdataID(NXhandle handle, NXlink* pLink);
NX_EXTERNAL NXstatus CALLING_STYLE NX4makelink(NXhandle handle, NXlink* pLink);
+629
View File
@@ -0,0 +1,629 @@
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <time.h>
#include "napi.h"
typedef struct {
NXhandle *pNexusData;
NXstatus (*nxclose)(NXhandle* pHandle);
NXstatus (*nxflush)(NXhandle* pHandle);
NXstatus (*nxmakegroup) (NXhandle handle, CONSTCHAR *name, char* NXclass);
NXstatus (*nxopengroup) (NXhandle handle, CONSTCHAR *name, char* NXclass);
NXstatus (*nxclosegroup)(NXhandle handle);
NXstatus (*nxmakedata) (NXhandle handle, CONSTCHAR* label, int datatype, int rank, int dim[]);
NXstatus (*nxcompmakedata) (NXhandle handle, CONSTCHAR* label, int datatype, int rank, int dim[], int comp_typ, int bufsize[]);
NXstatus (*nxcompress) (NXhandle handle, int compr_type);
NXstatus (*nxopendata) (NXhandle handle, CONSTCHAR* label);
NXstatus (*nxclosedata)(NXhandle handle);
NXstatus (*nxputdata)(NXhandle handle, void* data);
NXstatus (*nxputattr)(NXhandle handle, CONSTCHAR* name, void* data, int iDataLen, int iType);
NXstatus (*nxputslab)(NXhandle handle, void* data, int start[], int size[]);
NXstatus (*nxgetdataID)(NXhandle handle, NXlink* pLink);
NXstatus (*nxmakelink)(NXhandle handle, NXlink* pLink);
NXstatus (*nxgetdata)(NXhandle handle, void* data);
NXstatus (*nxgetinfo)(NXhandle handle, int* rank, int dimension[], int* datatype);
NXstatus (*nxgetnextentry)(NXhandle handle, NXname name, NXname nxclass, int* datatype);
NXstatus (*nxgetslab)(NXhandle handle, void* data, int start[], int size[]);
NXstatus (*nxgetnextattr)(NXhandle handle, NXname pName, int *iLength, int *iType);
NXstatus (*nxgetattr)(NXhandle handle, char* name, void* data, int* iDataLen, int* iType);
NXstatus (*nxgetattrinfo)(NXhandle handle, int* no_items);
NXstatus (*nxgetgroupID)(NXhandle handle, NXlink* pLink);
NXstatus (*nxgetgroupinfo)(NXhandle handle, int* no_items, NXname name, NXname nxclass);
NXstatus (*nxinitgroupdir)(NXhandle handle);
NXstatus (*nxinitattrdir)(NXhandle handle);
} NexusFunction, *pNexusFunction;
static int iFortifyScope;
/*------------------------------------------------------------------------
HDF-5 cache size special stuff
-------------------------------------------------------------------------*/
static long cacheSize = 1024000; /* 1MB, HDF-5 default */
NXstatus CALLING_STYLE NXsetcache(long newVal)
{
if(newVal > 0)
{
cacheSize = newVal;
return NX_OK;
}
return NX_ERROR;
}
/*---------------------------------------------------------------------*/
static void NXNXNXReportError(void *pData, char *string)
{
printf("%s \n",string);
}
/*---------------------------------------------------------------------*/
void *NXpData = NULL;
void (*NXIReportError)(void *pData, char *string) = NXNXNXReportError;
/*---------------------------------------------------------------------*/
void CALLING_STYLE NXMSetError(void *pData, void (*NewError)(void *pD, char *text))
{
NXpData = pData;
NXIReportError = NewError;
}
#ifdef HDF5
#include "napi5.h"
#endif
#ifdef HDF4
#include "napi4.h"
#endif
/* ----------------------------------------------------------------------
Definition of NeXus API
---------------------------------------------------------------------*/
NXstatus CALLING_STYLE NXopen(CONSTCHAR *filename, NXaccess am, NXhandle *gHandle)
{
int hdf_type=0;
int iRet=0;
NXhandle hdf5_handle;
NXhandle hdf4_handle;
pNexusFunction fHandle;
/* configure fortify
iFortifyScope = Fortify_EnterScope();
Fortify_CheckAllMemory();
*/
fHandle = (pNexusFunction)malloc(sizeof(NexusFunction));
if (fHandle == NULL) {
NXIReportError (NXpData,"ERROR: no memory to create Function structure");
return NX_ERROR;
}
if (am==NXACC_CREATE) {
/* HDF4 will be used ! */
hdf_type=1;
} else if (am==NXACC_CREATE5) {
/* HDF5 will be used ! */
hdf_type=2;
} else {
/* check file type hdf4/hdf5 for reading */
#ifdef HDF5
iRet=H5Fis_hdf5((const char*)filename);
#endif
if (iRet>0) {
hdf_type=2;
} else {
#ifdef HDF4
iRet=Hishdf(filename);
#endif
if (iRet>0) {
hdf_type=1;
}
}
}
if (hdf_type==1) {
/* HDF4 type */
#ifdef HDF4
iRet = NX4open(filename,am,&hdf4_handle);
fHandle->pNexusData=hdf4_handle;
fHandle->nxclose=NX4close;
fHandle->nxflush=NX4flush;
fHandle->nxmakegroup=NX4makegroup;
fHandle->nxopengroup=NX4opengroup;
fHandle->nxclosegroup=NX4closegroup;
fHandle->nxmakedata=NX4makedata;
fHandle->nxcompmakedata=NX4compmakedata;
fHandle->nxcompress=NX4compress;
fHandle->nxopendata=NX4opendata;
fHandle->nxclosedata=NX4closedata;
fHandle->nxputdata=NX4putdata;
fHandle->nxputattr=NX4putattr;
fHandle->nxputslab=NX4putslab;
fHandle->nxgetdataID=NX4getdataID;
fHandle->nxmakelink=NX4makelink;
fHandle->nxgetdata=NX4getdata;
fHandle->nxgetinfo=NX4getinfo;
fHandle->nxgetnextentry=NX4getnextentry;
fHandle->nxgetslab=NX4getslab;
fHandle->nxgetnextattr=NX4getnextattr;
fHandle->nxgetattr=NX4getattr;
fHandle->nxgetattrinfo=NX4getattrinfo;
fHandle->nxgetgroupID=NX4getgroupID;
fHandle->nxgetgroupinfo=NX4getgroupinfo;
fHandle->nxinitgroupdir=NX4initgroupdir;
fHandle->nxinitattrdir=NX4initattrdir;
#endif
} else if (hdf_type==2) {
/* HDF5 type */
#ifdef HDF5
iRet = NX5open(filename,am,&hdf5_handle);
fHandle->pNexusData=hdf5_handle;
fHandle->nxclose=NX5close;
fHandle->nxflush=NX5flush;
fHandle->nxmakegroup=NX5makegroup;
fHandle->nxopengroup=NX5opengroup;
fHandle->nxclosegroup=NX5closegroup;
fHandle->nxmakedata=NX5makedata;
fHandle->nxcompmakedata=NX5compmakedata;
fHandle->nxcompress=NX5compress;
fHandle->nxopendata=NX5opendata;
fHandle->nxclosedata=NX5closedata;
fHandle->nxputdata=NX5putdata;
fHandle->nxputattr=NX5putattr;
fHandle->nxputslab=NX5putslab;
fHandle->nxgetdataID=NX5getdataID;
fHandle->nxmakelink=NX5makelink;
fHandle->nxgetdata=NX5getdata;
fHandle->nxgetinfo=NX5getinfo;
fHandle->nxgetnextentry=NX5getnextentry;
fHandle->nxgetslab=NX5getslab;
fHandle->nxgetnextattr=NX5getnextattr;
fHandle->nxgetattr=NX5getattr;
fHandle->nxgetattrinfo=NX5getattrinfo;
fHandle->nxgetgroupID=NX5getgroupID;
fHandle->nxgetgroupinfo=NX5getgroupinfo;
fHandle->nxinitgroupdir=NX5initgroupdir;
fHandle->nxinitattrdir=NX5initattrdir;
#endif
} else {
NXIReportError (NXpData,"ERROR: Format couldn't be handled!");
*gHandle = NULL;
return NX_ERROR;
}
if(iRet == NX_OK)
{
*gHandle = fHandle;
return NX_OK;
}
else
{
free(fHandle);
return iRet;
}
}
/* ------------------------------------------------------------------------- */
NXstatus CALLING_STYLE NXclose (NXhandle *fid)
{
NXhandle hfil;
int status;
pNexusFunction pFunc=NULL;
pFunc = (pNexusFunction)*fid;
hfil = pFunc->pNexusData;
status = pFunc->nxclose(&hfil);
pFunc->pNexusData = hfil;
free(pFunc);
/*
Fortify_CheckAllMemory();
*/
return status;
}
/*-----------------------------------------------------------------------*/
NXstatus CALLING_STYLE NXmakegroup (NXhandle fid, CONSTCHAR *name, char *nxclass)
{
pNexusFunction pFunc = (pNexusFunction)fid;
return pFunc->nxmakegroup(pFunc->pNexusData, name, nxclass);
}
/*------------------------------------------------------------------------*/
NXstatus CALLING_STYLE NXopengroup (NXhandle fid, CONSTCHAR *name, char *nxclass)
{
pNexusFunction pFunc = (pNexusFunction)fid;
return pFunc->nxopengroup(pFunc->pNexusData, name, nxclass);
}
/* ------------------------------------------------------------------- */
NXstatus CALLING_STYLE NXclosegroup (NXhandle fid)
{
pNexusFunction pFunc = (pNexusFunction)fid;
return pFunc->nxclosegroup(pFunc->pNexusData);
}
/* --------------------------------------------------------------------- */
NXstatus CALLING_STYLE NXmakedata (NXhandle fid, CONSTCHAR *name, int datatype,
int rank, int dimensions[])
{
pNexusFunction pFunc = (pNexusFunction)fid;
return pFunc->nxmakedata(pFunc->pNexusData, name, datatype, rank, dimensions);
}
/* --------------------------------------------------------------------- */
NXstatus CALLING_STYLE NXcompmakedata (NXhandle fid, CONSTCHAR *name, int datatype,
int rank, int dimensions[],int compress_type, int chunk_size[])
{
pNexusFunction pFunc = (pNexusFunction)fid;
return pFunc->nxcompmakedata (pFunc->pNexusData, name, datatype, rank, dimensions, compress_type, chunk_size);
}
/* --------------------------------------------------------------------- */
NXstatus CALLING_STYLE NXcompress (NXhandle fid, int compress_type)
{
pNexusFunction pFunc = (pNexusFunction)fid;
return pFunc->nxcompress (pFunc->pNexusData, compress_type);
}
/* --------------------------------------------------------------------- */
NXstatus CALLING_STYLE NXopendata (NXhandle fid, CONSTCHAR *name)
{
pNexusFunction pFunc = (pNexusFunction)fid;
return pFunc->nxopendata(pFunc->pNexusData, name);
}
/* ----------------------------------------------------------------- */
NXstatus CALLING_STYLE NXclosedata (NXhandle fid)
{
pNexusFunction pFunc = (pNexusFunction)fid;
return pFunc->nxclosedata(pFunc->pNexusData);
}
/* ------------------------------------------------------------------- */
NXstatus CALLING_STYLE NXputdata (NXhandle fid, void *data)
{
pNexusFunction pFunc = (pNexusFunction)fid;
return pFunc->nxputdata(pFunc->pNexusData, data);
}
/* ------------------------------------------------------------------- */
NXstatus CALLING_STYLE NXputattr (NXhandle fid, CONSTCHAR *name, void *data,
int datalen, int iType)
{
pNexusFunction pFunc = (pNexusFunction)fid;
return pFunc->nxputattr(pFunc->pNexusData, name, data, datalen, iType);
}
/* ------------------------------------------------------------------- */
NXstatus CALLING_STYLE NXputslab (NXhandle fid, void *data, int iStart[], int iSize[])
{
pNexusFunction pFunc = (pNexusFunction)fid;
return pFunc->nxputslab(pFunc->pNexusData, data, iStart, iSize);
}
/* ------------------------------------------------------------------- */
NXstatus CALLING_STYLE NXgetdataID (NXhandle fid, NXlink* sRes)
{
pNexusFunction pFunc = (pNexusFunction)fid;
return pFunc->nxgetdataID(pFunc->pNexusData, sRes);
}
/* ------------------------------------------------------------------- */
NXstatus CALLING_STYLE NXmakelink (NXhandle fid, NXlink* sLink)
{
pNexusFunction pFunc = (pNexusFunction)fid;
return pFunc->nxmakelink(pFunc->pNexusData, sLink);
}
/*----------------------------------------------------------------------*/
NXstatus CALLING_STYLE NXflush(NXhandle *pHandle)
{
NXhandle hfil;
int status;
pNexusFunction pFunc=NULL;
pFunc = (pNexusFunction)*pHandle;
hfil = pFunc->pNexusData;
status = pFunc->nxflush(&hfil);
pFunc->pNexusData = hfil;
return status;
}
/*-------------------------------------------------------------------------*/
NXstatus CALLING_STYLE NXmalloc (void** data, int rank, int dimensions[], int datatype)
{
int i;
size_t size = 1;
*data = NULL;
for(i=0; i<rank; i++)
size *= dimensions[i];
if ((datatype == NX_CHAR) || (datatype == NX_INT8) || (datatype == NX_UINT8)) {
/* size is correct already */
}
else if ((datatype == NX_INT16) || (datatype == NX_UINT16)) {
size *= 2;
}
else if ((datatype == NX_INT32) || (datatype == NX_UINT32) || (datatype == NX_FLOAT32)) {
size *= 4;
}
else if (datatype == NX_FLOAT64) {
size *= 8;
}
else {
NXIReportError (NXpData, "ERROR: NXmalloc - unknown data type in array");
return NX_ERROR;
}
*data = (void*)malloc(size);
memset(*data,0,size);
return NX_OK;
}
/*-------------------------------------------------------------------------*/
NXstatus CALLING_STYLE NXfree (void** data)
{
if (data == NULL) {
NXIReportError (NXpData, "ERROR: passing NULL to NXfree");
return NX_ERROR;
}
if (*data == NULL) {
NXIReportError (NXpData,"ERROR: passing already freed pointer to NXfree");
return NX_ERROR;
}
free(*data);
*data = NULL;
return NX_OK;
}
/* --------------------------------------------------------------------- */
NXstatus CALLING_STYLE NXgetnextentry (NXhandle fid, NXname name, NXname nxclass, int *datatype)
{
pNexusFunction pFunc = (pNexusFunction)fid;
return pFunc->nxgetnextentry(pFunc->pNexusData, name, nxclass, datatype);
}
/*-------------------------------------------------------------------------*/
NXstatus CALLING_STYLE NXgetdata (NXhandle fid, void *data)
{
pNexusFunction pFunc = (pNexusFunction)fid;
return pFunc->nxgetdata(pFunc->pNexusData, data);
}
/*-------------------------------------------------------------------------*/
NXstatus CALLING_STYLE NXgetinfo (NXhandle fid, int *rank, int dimension[], int *iType)
{
pNexusFunction pFunc = (pNexusFunction)fid;
return pFunc->nxgetinfo(pFunc->pNexusData, rank, dimension, iType);
}
/*-------------------------------------------------------------------------*/
NXstatus CALLING_STYLE NXgetslab (NXhandle fid, void *data, int iStart[], int iSize[])
{
pNexusFunction pFunc = (pNexusFunction)fid;
return pFunc->nxgetslab(pFunc->pNexusData, data, iStart, iSize);
}
/*-------------------------------------------------------------------------*/
NXstatus CALLING_STYLE NXgetnextattr (NXhandle fileid, NXname pName,
int *iLength, int *iType)
{
pNexusFunction pFunc = (pNexusFunction)fileid;
return pFunc->nxgetnextattr(pFunc->pNexusData, pName, iLength, iType);
}
/*-------------------------------------------------------------------------*/
NXstatus CALLING_STYLE NXgetattr (NXhandle fid, char *name, void *data, int* datalen, int* iType)
{
pNexusFunction pFunc = (pNexusFunction)fid;
return pFunc->nxgetattr(pFunc->pNexusData, name, data, datalen, iType);
}
/*-------------------------------------------------------------------------*/
NXstatus CALLING_STYLE NXgetattrinfo (NXhandle fid, int *iN)
{
pNexusFunction pFunc = (pNexusFunction)fid;
return pFunc->nxgetattrinfo(pFunc->pNexusData, iN);
}
/*-------------------------------------------------------------------------*/
NXstatus CALLING_STYLE NXgetgroupID (NXhandle fileid, NXlink* sRes)
{
pNexusFunction pFunc = (pNexusFunction)fileid;
return pFunc->nxgetgroupID(pFunc->pNexusData, sRes);
}
/*-------------------------------------------------------------------------*/
NXstatus CALLING_STYLE NXgetgroupinfo (NXhandle fid, int *iN, NXname pName, NXname pClass)
{
pNexusFunction pFunc = (pNexusFunction)fid;
return pFunc->nxgetgroupinfo(pFunc->pNexusData, iN, pName, pClass);
}
/*-------------------------------------------------------------------------*/
NXstatus CALLING_STYLE NXinitattrdir (NXhandle fid)
{
pNexusFunction pFunc = (pNexusFunction)fid;
return pFunc->nxinitattrdir(pFunc->pNexusData);
}
/*-------------------------------------------------------------------------*/
NXstatus CALLING_STYLE NXinitgroupdir (NXhandle fid)
{
pNexusFunction pFunc = (pNexusFunction)fid;
return pFunc->nxinitgroupdir(pFunc->pNexusData);
}
/*----------------------------------------------------------------------
F77 - API - Support - Routines
----------------------------------------------------------------------*/
/*
* We store the whole of the NeXus file in the array - that way
* we can just pass the array name to C as it will be a valid
* NXhandle. We could store the NXhandle value in the FORTRAN array
* instead, but that would mean writing far more wrappers
*/
NXstatus CALLING_STYLE NXfopen(char * filename, NXaccess* am,
NexusFunction* pHandle)
{
NXstatus ret;
NXhandle fileid = NULL;
ret = NXopen(filename, *am, &fileid);
if (ret == NX_OK)
{
memcpy(pHandle, fileid, sizeof(NexusFunction));
}
else
{
memset(pHandle, 0, sizeof(NexusFunction));
}
if (fileid != NULL)
{
free(fileid);
}
return ret;
}
/*
* The pHandle from FORTRAN is a pointer to a static FORTRAN
* array holding the NexusFunction structure. We need to malloc()
* a temporary copy as NXclose will try to free() this
*/
NXstatus CALLING_STYLE NXfclose (NexusFunction* pHandle)
{
NXhandle h;
NXstatus ret;
h = (NXhandle)malloc(sizeof(NexusFunction));
memcpy(h, pHandle, sizeof(NexusFunction));
ret = NXclose(&h); /* does free(h) */
memset(pHandle, 0, sizeof(NexusFunction));
return ret;
}
/*---------------------------------------------------------------------*/
NXstatus CALLING_STYLE NXfflush(NexusFunction* pHandle)
{
NXhandle h;
NXstatus ret;
h = (NXhandle)malloc(sizeof(NexusFunction));
memcpy(h, pHandle, sizeof(NexusFunction));
ret = NXflush(&h); /* modifies and reallocates h */
memcpy(pHandle, h, sizeof(NexusFunction));
return ret;
}
/*----------------------------------------------------------------------*/
NXstatus CALLING_STYLE NXfmakedata(NXhandle fid, char *name, int *pDatatype,
int *pRank, int dimensions[])
{
NXstatus ret;
static char buffer[256];
int i, *reversed_dimensions;
reversed_dimensions = (int*)malloc(*pRank * sizeof(int));
if (reversed_dimensions == NULL)
{
sprintf (buffer,
"ERROR: Cannot allocate space for array rank of %d in NXfmakedata",
*pRank);
NXIReportError (NXpData, buffer);
return NX_ERROR;
}
/*
* Reverse dimensions array as FORTRAN is column major, C row major
*/
for(i=0; i < *pRank; i++)
{
reversed_dimensions[i] = dimensions[*pRank - i - 1];
}
ret = NXmakedata(fid, name, *pDatatype, *pRank, reversed_dimensions);
free(reversed_dimensions);
return ret;
}
NXstatus CALLING_STYLE NXfcompmakedata(NXhandle fid, char *name,
int *pDatatype,
int *pRank, int dimensions[],
int *compression_type, int chunk[])
{
NXstatus ret;
static char buffer[256];
int i, *reversed_dimensions, *reversed_chunk;
reversed_dimensions = (int*)malloc(*pRank * sizeof(int));
reversed_chunk = (int*)malloc(*pRank * sizeof(int));
if (reversed_dimensions == NULL || reversed_chunk == NULL)
{
sprintf (buffer,
"ERROR: Cannot allocate space for array rank of %d in NXfcompmakedata",
*pRank);
NXIReportError (NXpData, buffer);
return NX_ERROR;
}
/*
* Reverse dimensions array as FORTRAN is column major, C row major
*/
for(i=0; i < *pRank; i++)
{
reversed_dimensions[i] = dimensions[*pRank - i - 1];
reversed_chunk[i] = chunk[*pRank - i - 1];
}
ret = NXcompmakedata(fid, name, *pDatatype, *pRank,
reversed_dimensions,*compression_type, reversed_chunk);
free(reversed_dimensions);
free(reversed_chunk);
return ret;
}
/*-----------------------------------------------------------------------*/
NXstatus CALLING_STYLE NXfcompress(NXhandle fid, int *compr_type)
{
return NXcompress(fid,*compr_type);
}
/*-----------------------------------------------------------------------*/
NXstatus CALLING_STYLE NXfputattr(NXhandle fid, char *name, void *data,
int *pDatalen, int *pIType)
{
return NXputattr(fid, name, data, *pDatalen, *pIType);
}
+1837
View File
File diff suppressed because it is too large Load Diff
+47
View File
@@ -0,0 +1,47 @@
#define NX5SIGNATURE 959695
#include <hdf5.h>
#include "napi5.c"
/* HDF5 interface */
NX_EXTERNAL NXstatus CALLING_STYLE NX5open(CONSTCHAR *filename, NXaccess access_method, NXhandle* pHandle);
NX_EXTERNAL NXstatus CALLING_STYLE NX5close(NXhandle* pHandle);
NX_EXTERNAL NXstatus CALLING_STYLE NX5flush(NXhandle* pHandle);
NX_EXTERNAL NXstatus CALLING_STYLE NX5makegroup (NXhandle handle, CONSTCHAR *name, char* NXclass);
NX_EXTERNAL NXstatus CALLING_STYLE NX5opengroup (NXhandle handle, CONSTCHAR *name, char* NXclass);
NX_EXTERNAL NXstatus CALLING_STYLE NX5closegroup(NXhandle handle);
NX_EXTERNAL NXstatus CALLING_STYLE NX5makedata (NXhandle handle, CONSTCHAR* label, int datatype, int rank, int dim[]);
NX_EXTERNAL NXstatus CALLING_STYLE NX5compmakedata (NXhandle handle, CONSTCHAR* label, int datatype, int rank, int dim[], int comp_typ, int bufsize[]);
NX_EXTERNAL NXstatus CALLING_STYLE NX5compress (NXhandle handle, int compr_type);
NX_EXTERNAL NXstatus CALLING_STYLE NX5opendata (NXhandle handle, CONSTCHAR* label);
NX_EXTERNAL NXstatus CALLING_STYLE NX5closedata(NXhandle handle);
NX_EXTERNAL NXstatus CALLING_STYLE NX5putdata(NXhandle handle, void* data);
NX_EXTERNAL NXstatus CALLING_STYLE NX5putattr(NXhandle handle, CONSTCHAR* name, void* data, int iDataLen, int iType);
NX_EXTERNAL NXstatus CALLING_STYLE NX5putslab(NXhandle handle, void* data, int start[], int size[]);
NX_EXTERNAL NXstatus CALLING_STYLE NX5getdataID(NXhandle handle, NXlink* pLink);
NX_EXTERNAL NXstatus CALLING_STYLE NX5makelink(NXhandle handle, NXlink* pLink);
NX_EXTERNAL NXstatus CALLING_STYLE NX5getdata(NXhandle handle, void* data);
NX_EXTERNAL NXstatus CALLING_STYLE NX5getinfo(NXhandle handle, int* rank, int dimension[], int* datatype);
NX_EXTERNAL NXstatus CALLING_STYLE NX5getnextentry(NXhandle handle, NXname name, NXname nxclass, int* datatype);
NX_EXTERNAL NXstatus CALLING_STYLE NX5getslab(NXhandle handle, void* data, int start[], int size[]);
NX_EXTERNAL NXstatus CALLING_STYLE NX5getnextattr(NXhandle handle, NXname pName, int *iLength, int *iType);
NX_EXTERNAL NXstatus CALLING_STYLE NX5getattr(NXhandle handle, char* name, void* data, int* iDataLen, int* iType);
NX_EXTERNAL NXstatus CALLING_STYLE NX5getattrinfo(NXhandle handle, int* no_items);
NX_EXTERNAL NXstatus CALLING_STYLE NX5getgroupID(NXhandle handle, NXlink* pLink);
NX_EXTERNAL NXstatus CALLING_STYLE NX5getgroupinfo(NXhandle handle, int* no_items, NXname name, NXname nxclass);
NX_EXTERNAL NXstatus CALLING_STYLE NX5initgroupdir(NXhandle handle);
NX_EXTERNAL NXstatus CALLING_STYLE NX5initattrdir(NXhandle handle);
herr_t nxgroup_info(hid_t loc_id, const char *name, void *op_data);
herr_t attr_info(hid_t loc_id, const char *name, void *opdata);
herr_t group_info(hid_t loc_id, const char *name, void *opdata);
+2 -2
View File
@@ -92,10 +92,10 @@ gummimon1 = /entry1,NXentry/SANS,NXinstrument/detector,NXdetector/SDS \
gummi_monitor1 -rank 1 -dim {$(timedim)} \
-attr {units,counts}
gummimon2 = /entry1,NXentry/SANS,NXinstrument/detector,NXdetector/SDS \
gummi_monitor1 -rank 1 -dim {$(timedim)} \
gummi_monitor2 -rank 1 -dim {$(timedim)} \
-attr {units,counts}
gummimon3 = /entry1,NXentry/SANS,NXinstrument/detector,NXdetector/SDS \
gummi_monitor1 -rank 1 -dim {$(timedim)} \
gummi_monitor3 -rank 1 -dim {$(timedim)} \
-attr {units,counts}
#--------Sample
san = /entry1,NXentry/sample,NXsample/SDS name -type DFNT_CHAR -rank 1 \
+6 -6
View File
@@ -78,7 +78,7 @@ det1zerox 128.000000
det1zerox setAccess 1
mono2theta 36.77
mono2theta setAccess 1
monodescription unknownit crystal
monodescription unknownit crystal
monodescription setAccess 1
# Motor om
om sign 1.000000
@@ -176,7 +176,7 @@ twotheta SoftUpperLim 113.000000
twotheta Fixed -1.000000
twotheta InterruptMode 0.000000
twotheta AccessCode 2.000000
lastscancommand cscan a4 10. .1 10 5
lastscancommand cscan a4 10. .1 10 5
lastscancommand setAccess 2
sample_mur 0.000000
sample_mur setAccess 2
@@ -455,11 +455,11 @@ a1 SoftUpperLim 120.000000
a1 Fixed -1.000000
a1 InterruptMode 0.000000
a1 AccessCode 2.000000
user Uwe Filges
user Uwe Filges
user setAccess 2
sample D20 30K SNP Okt 2001 GS
sample D20 30K SNP Okt 2001 GS
sample setAccess 2
title endtest called with 23.000000 :Driving:
title endtest called with 23.000000 :Driving:
title setAccess 2
starttime 2002-08-07 08:09:45
starttime 2002-08-07 08:09:45
starttime setAccess 2
+1 -1
View File
@@ -14,7 +14,7 @@ FF = f90
CC = cc
CFLAGS = -std -g -I. -I../hardsup -I$(PGPLOT_DIR) -I/data/koenneck/include
BIN = ../bin
LFLAGS = -L../hardsup -L$PGPLOT_DIR
LFLAGS = -L../hardsup -L$PGPLOT_DIR -L/data/lnslib/lib
#------------ for Linux
## FF = g77
## CC = gcc
+13 -5
View File
@@ -841,13 +841,13 @@
yPos = (yPos - 2048)/psdYFactor;
if(xPos < 0 || xPos > psdXSize)
if(xPos < 0 || xPos >= psdXSize)
{
printf("X position out of range: %d, alllowed 0 - %d\n",
xPos, psdXSize);
continue;
}
if(yPos < 0 || yPos > psdYSize)
if(yPos < 0 || yPos >= psdYSize)
{
printf("Y position out of range: %d, alllowed 0 - %d\n",
yPos, psdYSize);
@@ -893,6 +893,11 @@
printf("Matched time stamp %d into bin %d\n", iTime,middl);
}
if(middl >= Tof_edges[0]->n_bins){
middl = Tof_edges[0]->n_bins-1;
printf("WARNING: Fixed bad time bin!\n");
}
/*
calculate histogram position to update
*/
@@ -959,12 +964,10 @@
counting at 1, and ANSI-C at 0
*/
edNum = edData.ui2[1] - 1;
/*
if(edNum < 0 || edNum >= MAX_PSD_ED){
printf("Got invalid detector number %d\n",edNum);
printf("Got invalid single detector number %d\n",edNum);
continue;
}
*/
/*
Extract time stamp and match to the appropriate time bin.
@@ -1005,6 +1008,11 @@
printf("Matched time stamp %d into bin %d\n", iTime,middl);
}
if(middl >= Tof_edges[0]->n_bins){
middl = Tof_edges[0]->n_bins-1;
printf("WARNING: Fixed bad time bin for single detector!\n");
}
/*
calculate histogram position to update
*/
+14 -2
View File
@@ -151,7 +151,7 @@
Dbg_mask = 0;
Dbg_lev0 = 0;
Dbg_lev1 = 1;
Dbg_lev1 = 0;
Dbg_lev2 = 0;
Dbg_lev3 = 0;
Cfgn_done = 0; /* Force a configuration before we can do anything. */
@@ -272,10 +272,22 @@
printf ("%s: Instrument = \"%s\"\n", Tsk_name[0], "HRPT");
Lwl_hdr_daq_mask = LWL_HDR_SYNC0_MASK | LWL_HDR_SYNC2_MASK;
Lwl_hdr_daq_soll = LWL_HDR_SYNC2_MASK;
}else if (strcmp (INST, "TRICS") == 0 || strcmp(INST,"AMOR") == 0) {
}else if (strcmp (INST, "TRICS") == 0) {
printf ("%s: Instrument = \"%s\"\n", Tsk_name[0], "TriCS");
/*
Lwl_hdr_daq_mask = LWL_HDR_NRL_MASK | LWL_PSD_PWF;
Lwl_hdr_daq_soll = 0;
*/
Lwl_hdr_daq_mask = 0x00f00000;
Lwl_hdr_daq_soll = 0x00e00000;
}else if (strcmp(INST,"AMOR") == 0) {
printf ("%s: Instrument = \"%s\"\n", Tsk_name[0], "TriCS");
/*
Lwl_hdr_daq_mask = LWL_HDR_NRL_MASK | LWL_PSD_PWF;
Lwl_hdr_daq_soll = 0;
*/
Lwl_hdr_daq_mask = 0x00f00000;
Lwl_hdr_daq_soll = 0x00600000;
}else if (strcmp (INST, "POLDI") == 0) {
printf ("%s: Instrument = \"%s\"\n", Tsk_name[0], "POLDI");
Lwl_hdr_daq_mask = LWL_HDR_NRL_MASK;
+2 -2
View File
@@ -1721,7 +1721,7 @@
rply_status_setup_and_send (skt, reply, KER__BAD_CREATE, is, /* No */
"Filler creation failed");
printf ("\n%s -- creation of FILLER failed: %d.\n",
Tsk_name[index], status);
Tsk_name[index], is);
free_HM_memory (NULL);
Cfgn_done = 0;
return ERROR;
@@ -3447,7 +3447,7 @@
return -1; /* Yes. */
}else { /* No */
Filler_pid = created_pid;
tmo = 1000; /* Normally give FILLER 1000 ticks to ..
tmo = 10000; /* Normally give FILLER 1000 ticks to ..
** .. get going */
if (suspendMode != 0) {
tmo = WAIT_FOREVER; /* But in debug mode, wait forever! */
+8
View File
@@ -235,6 +235,14 @@ pCon);
SINQHMDefineBank(pInternal->pMaster,0,0,self->iDims[0],
self->fTime,self->iTimeChan);
break;
case eSANSTOF:
iMode = SQHM__TOF;
self->iLength = self->iDims[0]*self->iDims[1];
self->iLength *= self->iTimeChan;
SINQHMDefineBank(pInternal->pMaster,0,0,
(self->iDims[0]*self->iDims[1]) + 3,
self->fTime,self->iTimeChan);
break;
case eHStrobo:
iMode = SQHM__HM_PSD | SQHM__STROBO;
break;
+2 -2
View File
@@ -362,7 +362,7 @@ typedef enum _CharType {eSpace, eNum,eeText,eQuote} CharType;
else
{
strcat(buf,argv[i]);
strcat(buf," ");
/* strcat(buf," "); */
}
}
return 1;
@@ -419,4 +419,4 @@ typedef enum _CharType {eSpace, eNum,eeText,eQuote} CharType;
}
#endif
+2 -9
View File
@@ -192,18 +192,11 @@
return -1;
}
/* if in simulation mode, return a random number */
/* if in simulation mode, return 1 */
if(self->iMode)
{
if(SimRandom() >= 50.)
{
*iSet = 1;
}
else
{
*iSet = 0;
}
return 1;
return 1;
}
/* send an R command down to the SPS */
+3
View File
@@ -81,3 +81,6 @@ MakeDrive
Publish scan User
Publish otUnknown User
MakeRuenBuffer
MakeRS232Controller marcel psxtemp 3004