PSI UPDATE
r1724 | ffr | 2007-03-27 07:56:13 +1000 (Tue, 27 Mar 2007) | 2 lines
This commit is contained in:

committed by
Douglas Clowes

parent
cd0de991b4
commit
6921d0426c
@ -134,7 +134,11 @@ typedef struct __SINTER
|
||||
*/
|
||||
|
||||
char *FindAlias(SicsInterp *pSics, void *pData);
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
FindAliases locates alle aliases related to a gibe name. The result
|
||||
is returned as a komma separated list.
|
||||
*/
|
||||
char *FindAliases(SicsInterp *pSics, char *name);
|
||||
/*-------------------------------------------------------------------------
|
||||
FindCommandData finds a command with the name given. It tests the name in the
|
||||
ObjectDescriptor to be of name class. If all this succeeds a pointer
|
||||
|
4
conman.c
4
conman.c
@ -706,14 +706,18 @@ static void writeToLogFiles(SConnection *self, char *buffer)
|
||||
if(self->iMacro != 1)
|
||||
{
|
||||
sprintf(pBueffel,"To sock %d :",iRet);
|
||||
sendingConnection = self;
|
||||
WriteToCommandLog(pBueffel,buffer);
|
||||
sendingConnection = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(iOut == eError || iOut == eWarning)
|
||||
{
|
||||
sprintf(pBueffel,"To sock %d :",iRet);
|
||||
sendingConnection = self;
|
||||
WriteToCommandLog(pBueffel,buffer);
|
||||
sendingConnection = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ int MakeDiffScan(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
pNew->pDes->SaveStatus = SaveDiffScan;
|
||||
|
||||
if(argc > 1) {
|
||||
status = AddCommand(pSics,argv[2],
|
||||
status = AddCommand(pSics,argv[1],
|
||||
DiffScanWrapper,
|
||||
KillDiffScan,
|
||||
pNew);
|
||||
|
@ -143,6 +143,12 @@ attribute.
|
||||
<dt>nxscript makelink targetAlias victimAlias
|
||||
<dd>This creates a symbolic link for victimAlias in the group
|
||||
designated by targetAlias.
|
||||
<dt>nxscript putslab alias startlist sizelist obj
|
||||
<dd>Writes a slab of data. alias is the alis to write too. startslist is
|
||||
a Tcl list containing the start indexes, sizelist is the size of the slab
|
||||
to write as a Tcl list and obj is the SICS object to write. Obj can be a
|
||||
histogram memory; then the histogram memory data is written. Or it can be
|
||||
a sicsdata object, the value of which will then be written.
|
||||
</dl>
|
||||
</p>
|
||||
<H1>Automatic Updating of NeXus Files</H1>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<p>
|
||||
SICS has a built in macro facility. This macro facility is aimed at instrument managers and users alike. Instrument managers may provide customised measurement procedures in this language, users may write batch files in this language. The macro language is John Ousterhout's Tool Command Language (TCL). Tcl has control constructs, variables of its own, loop constructs, associative arrays and procedures. Tcl is well documented by several books and online tutorials, therefore no details on Tcl will be given here. All SICS commands are available in the macro language. Some potentially harmful Tcl commands have been deleted from the standard Tcl interpreter. These are: exec, source, puts, vwait, exit,gets and socket. A macro or batch file can be executed with the command:</p>
|
||||
<p>
|
||||
<b> fileeval <i>name</i> </b> tries to open the file name and
|
||||
<b> exe <i>name</i> </b> tries to open the file name and
|
||||
executes the script in this file.
|
||||
</p>
|
||||
<p>
|
||||
|
@ -40,7 +40,7 @@
|
||||
<dt> Examples <dd> Whenever examples are shown, anything which is actually
|
||||
typed by the user is shown <em>like this</em>. It will generally be shown
|
||||
in lower case. E.g.
|
||||
<pre> <em>scan a1=0 da1=1 np=6</em></pre>
|
||||
<pre> <em>sc a1=0 da1=1 np=6</em></pre>
|
||||
indicates that everything between the <em>s</em> and <em>6</em>, inclusive,
|
||||
is to be typed by the user.
|
||||
<dt> Optional Arguments <dd> Square brackets, [ ], indicate optional
|
||||
@ -69,11 +69,6 @@
|
||||
|
||||
(A) a sequence of variable names
|
||||
e.g. DM,DA,SS (carry out command given on variables DM, DA, SS)
|
||||
e.g. ALF1-ALF4 (carry out command given on variables between ALF1 and
|
||||
ALF4 in storage order; see section V)
|
||||
e.g. DM,ALF1-ALF4,SS,DA (a combination of the above) Variables separated
|
||||
by commas need not be typed in their order of storage in the program.
|
||||
|
||||
Note : that for this type of syntax (type A) the only acceptable
|
||||
variable separators are ' ' (i.e. a space), ',' and '-' (' ' and ','
|
||||
are equivalent).
|
||||
@ -115,13 +110,11 @@
|
||||
value.
|
||||
<a href="#LIST">LI</a> LIst : Listing of variables and parameters.
|
||||
LE ListEnergies Energies, k and Q values.
|
||||
LL ListLimits Limits and zeros.
|
||||
LZ ListZero Limits and zeros.
|
||||
LL ListLimits Limits and zeros. Same as lz.
|
||||
LZ ListZero Limits and zeros. Same as ll.
|
||||
LM ListMach Machine parameters.
|
||||
LS ListSample Sample parameters.
|
||||
LT ListTargets Targets and positions.
|
||||
LD ListDiaphragms Diaphragms.
|
||||
LP ListPower Power supply values.
|
||||
<a href="#LOG">LO</a> LOg : Controls terminal logging.
|
||||
<a href="#ONOFF">OF</a> OFf : Turns flipper off.
|
||||
<a href="#ONOFF">ON</a> ON : Turns flipper on.
|
||||
@ -129,17 +122,13 @@
|
||||
<a href="#PA">PA</a> Pol.An. : Defines a polarization analysis file (default
|
||||
file ext'n is .PAL).
|
||||
<a href="#PRINT">PR</a> PRint : Prints one ore more variables or parameters.
|
||||
<a href="#RUN">RU</a> RUn : Runs a jobfile.
|
||||
<a href="#SCAN">SC</a> SCan : Scans a variable with given or previously
|
||||
defined increment, number of points and
|
||||
time interval or monitor count.
|
||||
<a href="#SET">SE</a> SEt : Sets a parameter value.
|
||||
<a href="#SCANFAST">SF</a> ScanFast : Scans a variable quickly.
|
||||
<a href="#SCANFAST">FS</a> ScanFast : Scans a variable quickly.
|
||||
<a href="#SWITCHES">SW</a> SWitch : Sets some switches.
|
||||
<a href="#SETZERO">SZ</a> SetZero : Set zero in such a way that value as given
|
||||
is defined as actual position of variable
|
||||
(works only for simple variables, i.e.
|
||||
variables that have a zero).
|
||||
<a href="#SETZERO">SZ</a> SetZero : Sets the zero point offset of a variable.
|
||||
</pre>
|
||||
<h3><a name="CLEAR">CLEAR</a></h3>
|
||||
<pre>
|
||||
@ -150,8 +139,7 @@
|
||||
the motors or supplies which have been cleared are listed by THE
|
||||
Program.
|
||||
|
||||
e.g. CL A1-A3<CR>
|
||||
CL I3,RA,I4<CR>
|
||||
e.g. CL I3,RA,I4<CR>
|
||||
CL<CR>
|
||||
|
||||
</pre>
|
||||
@ -488,33 +476,6 @@
|
||||
e.g. PR A1,A5<CR>
|
||||
PR QH-EN,GM<CR>
|
||||
|
||||
</pre>
|
||||
<h3><a name="RUN">RUN</a></h3>
|
||||
<pre>
|
||||
|
||||
RU(N) : Runs a jobfile. All commands which may be issued at the terminal
|
||||
may also be included in a job-file which essentially replaces the user
|
||||
at the terminal.
|
||||
The commands in the job file are executed by running the job file.
|
||||
Before running the job file a syntax check is done. The file is listed
|
||||
on the terminal and all scans are checked for limit violations. When
|
||||
checking is complete, execution is started even if errors have been
|
||||
reported during the check. To interrupt the sequence type CTRL-C twice
|
||||
(see interruption section II above). If the RUN command is issued alone,
|
||||
MAD Program asks for a job file name. The default file extension for a
|
||||
job file is .JOB. The job-file name may also be given on the same line
|
||||
as the RUN command. Job files can be created as normal OpenVMS files
|
||||
using one edtir (EDT/TPU/NEDIT).
|
||||
Nesting : Job files may be nested. That is, a job file may contain any
|
||||
number of RUN commands. The nesting depth should not exceed 3 however.
|
||||
See also DO.
|
||||
|
||||
e.g. RU MYJOB.HET<CR> commands from file MYJOB.HET
|
||||
RU MYJOB<CR> commands from file MYJOB.JOB
|
||||
RUN<CR> gives prompt for job file name
|
||||
JOB-FILE NAME:
|
||||
|
||||
|
||||
</pre>
|
||||
<h3><a name="SCAN">SCAN</a></h3>
|
||||
<pre>
|
||||
@ -619,7 +580,7 @@
|
||||
sets dM and dA to 3.355 <20>
|
||||
|
||||
</pre>
|
||||
<h3><a name="SCANFAST">SF</a></h3>
|
||||
<h3><a name="SCANFAST">FS</a></h3>
|
||||
<table>
|
||||
<tr><td valign=top><b>ScanFast</b>
|
||||
<td>Scans a simple variable quickly. The variable is driven
|
||||
@ -636,7 +597,7 @@
|
||||
to be specified directly.
|
||||
</tr>
|
||||
<tr><td><td>Example:<pre>
|
||||
SF A1=6,DA1=1,NP=13,TI=2 --> A1 = 0 to +12 with
|
||||
FS A1=6,DA1=1,NP=13,TI=2 --> A1 = 0 to +12 with
|
||||
readings every 2 secs.</pre>
|
||||
</tr>
|
||||
<tr><td><td>All of the data is output to a disk file as with the
|
||||
@ -650,7 +611,7 @@
|
||||
<pre>
|
||||
|
||||
SZ : (SetZero.) This command sets the zero for a variable such that
|
||||
its current value is change into a specified value.
|
||||
its current value of the zer point offset is change into the specified value.
|
||||
Obviously this command works only for variables that have a zero.
|
||||
e.g. PR A3
|
||||
A3 -45.42
|
||||
@ -719,9 +680,9 @@ Example of phonon scan:
|
||||
<dd>Sets the title string (up to 72 characters) to be written to the data
|
||||
file header.
|
||||
<dt><em>set user ...</em>
|
||||
<dd>Sets the experiment user's name (6 characters).
|
||||
<dd>Sets the experiment user's name.
|
||||
<dt><em>set local ...</em>
|
||||
<dd>Sets the local contact's name (6 characters).
|
||||
<dd>Sets the local contact's name.
|
||||
</dl>
|
||||
|
||||
|
||||
@ -768,15 +729,14 @@ however, corresponds to a transmission minimum for Ki neutrons.
|
||||
l : Two-axis mode : If you want to work in TWO-AXIS mode, just SEt SA
|
||||
to 0 ! This will change the zero of A5 by 90<39> and any following drive
|
||||
of Ki or Kf will drive the detector to zero and the analyser
|
||||
perpendicular to the beam (just check that there is no absorbing cache
|
||||
[Cd, B4C,...] behind the analyser !). Due to the change of A5 zero the
|
||||
perpendicular to the beam. Due to the change of A5 zero the
|
||||
value of A5 will be ZERO (0!) with a analyser orthogonal to the
|
||||
scatterred beam.
|
||||
|
||||
l : Constant QM Mode: If you have a powder sample and want to work in
|
||||
<09>-1 at a given QM ( modulus of Q that you cannot drive), just SEt the
|
||||
sample lattice parameters (AS, BS, CS ) to 2.p and lattice angles
|
||||
(AA, BB, CC ) to 90<EFBFBD>. Any subsequent drive of QH will drive the
|
||||
l : Constant QM Mode: If you have a powder sample and want to work at
|
||||
a given QM ( modulus of Q that you cannot drive), just SEt the
|
||||
sample lattice parameters (AS, BS, CS ) to 2 PI (6.2832) and lattice angles
|
||||
(AA, BB, CC ) to 90. Any subsequent drive of QH will drive the
|
||||
machine to the correct QM value. Use the powder switch to inhibit the
|
||||
A3 (q) movement.
|
||||
|
||||
@ -864,7 +824,6 @@ FX =1 for constant Ki; =2 for constant Kf
|
||||
NP Number of points in a scan
|
||||
TI Preset time [seconds] for a COunt or SCan
|
||||
MN Preset monitor for a COunt or SCan
|
||||
TO Time-out in for WAit command [minutes]
|
||||
DTL lower temperature error allowed [Kelvin]
|
||||
DTU upper temperature error allowed [Kelvin]
|
||||
|
||||
@ -935,14 +894,10 @@ STU Sample upper translation
|
||||
ATL Anal lower translation
|
||||
ATU Anal upper translation
|
||||
MGL Mono lower goniometer (Reserved)
|
||||
MGU Mono upper goniometer
|
||||
SGL Sample lower goniometer
|
||||
SGU Sample upper goniometer
|
||||
AGL Anal lower goniometer (Reserved)
|
||||
AGU Anal upper goniometer
|
||||
MSC Mono "sample" changer (TASP only)
|
||||
ASC Anal "sample" changer (TASP only)
|
||||
CSC Collimator "sample" changer (TASP only)
|
||||
SRO Sample sample table ring rotation.
|
||||
|
||||
D1T D1B D1R D1L Diaphragm 1 (top/bottom/right/left)
|
||||
D2T D2B D2R D2L Diaphragm 2 (top/bottom/right/left)
|
||||
@ -950,7 +905,6 @@ D3T D3B D3R D3L Diaphragm 3 (top/bottom/right/left)
|
||||
|
||||
ILL Instruments:
|
||||
CH Monochromator changer position [degrees or mm]
|
||||
TM (LM) Monochromator translation [(IN20 : 5mm)]
|
||||
GM Monochromator goniometer angle [1 unit = 4<>]
|
||||
RM Monochromator curvature
|
||||
GL Sample goniometer angle; lower arc [1 unit = 4<>]
|
||||
@ -973,11 +927,14 @@ QM Length of Q [
|
||||
TT (T) Temperature of sample thermometer [K]
|
||||
TRT(RT) Temperature of regulation thermometer [K]
|
||||
(can only be printed out)
|
||||
</pre>
|
||||
<h3>Polarisation Analysis Variables</h3>
|
||||
<pre>
|
||||
*I1 -\
|
||||
*I2 \
|
||||
*I3 +-- power supply current values [A]
|
||||
. /
|
||||
*I11 -/
|
||||
*I6 -/
|
||||
|
||||
*HX -\ Components of Helmholtz fields at sample in Oersteds.
|
||||
*HY +-- HX is parallel to Q and HY is perpendicular to Q in
|
||||
@ -986,6 +943,7 @@ TRT(RT) Temperature of regulation thermometer [K]
|
||||
*F1 -\ Status of flippers one and two; these variables take the
|
||||
*F2 -/ values ON or OFF.
|
||||
</pre>
|
||||
|
||||
<h3><a name="Increments_Variables">Increments Variables</a></h3>
|
||||
<pre>
|
||||
For all variables A1 through T in the list of type (iv) variables
|
||||
|
@ -10,24 +10,27 @@ files are formatted in a format compatible to the ILL's triple axis
|
||||
data file format. Data files can be found in directories:
|
||||
<pre>
|
||||
|
||||
/home/INST/data/YYYY
|
||||
/home/INST/data/YYYY/HHH
|
||||
|
||||
</pre>
|
||||
on the instrument computer or in
|
||||
<pre>
|
||||
|
||||
/data/lnslib/data/INST/data/YYYY
|
||||
/afs/psi.ch/project/sinqdata/YYYY/INST/HHH
|
||||
|
||||
</pre>
|
||||
on any other LNS unix system. INST is a placeholder for the instrument
|
||||
name in capitals, YYYY for the year of data collection. Data files are
|
||||
name in capitals, YYYY for the year of data collection. HHH is the thousands
|
||||
directoy. In order to facilitate file handling, data files are grouped into directories
|
||||
containing thousand data files each. Thus files 0-999 will be in the 000 directory, files
|
||||
1000-1999 in the 001 directory etc. Data files are
|
||||
named according to the SINQ naming convention:
|
||||
<pre>
|
||||
instRRRRRYYYY.dat
|
||||
instYYYYnTRRRRR.dat
|
||||
</pre>
|
||||
with inst being the placeholder for the instrument name in lowercase,
|
||||
RRRRR the run number as a five digit number and YYYY again the year of
|
||||
data collection. Example: tasp003302002.dat is data collected in run
|
||||
RRRRRR the run number as a six digit number and YYYY again the year of
|
||||
data collection. Example: tasp2002n000330.dat is data collected in run
|
||||
number 330 in 2002.
|
||||
</p>
|
||||
<p>
|
||||
|
@ -1109,7 +1109,7 @@ static void ErrReport(pEVControl self)
|
||||
sprintf(pBueffel,"%s.%s = %g",self->pName,"CurrentValue", fPos);
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
*/
|
||||
SCPrintf(pCon, eValue, "%s = %g", self->pName, fPos);
|
||||
SCPrintf(pCon, eValue, "%s = %g", argv[0], fPos);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
15
fitcenter.c
15
fitcenter.c
@ -101,21 +101,6 @@
|
||||
GetScanVar(self->pScan,0,self->fAxis,self->iNP);
|
||||
GetScanVarName(self->pScan,0,self->pName,131);
|
||||
|
||||
/* correct fAxis for softzero points and sign
|
||||
when the scan variable is a motor
|
||||
*/
|
||||
if(!isScanVarSoft(self->pScan))
|
||||
{
|
||||
pMot = FindMotor(pServ->pSics,self->pName);
|
||||
if(pMot)
|
||||
{
|
||||
for(i = 0; i < self->iNP; i++)
|
||||
{
|
||||
self->fAxis[i] = MotorHardToSoftPosition(pMot,self->fAxis[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
10
histmem.c
10
histmem.c
@ -72,6 +72,10 @@
|
||||
* from histregress.c
|
||||
*/
|
||||
extern pHistDriver CreateRegressHM(pStringDict pOpt);
|
||||
/*
|
||||
* from slavehm.c
|
||||
*/
|
||||
extern pHistDriver MakeHMSlaveHM(pStringDict pOpt);
|
||||
/*------------------------------------------------------------------------*/
|
||||
static int HistHalt(void *pData)
|
||||
{
|
||||
@ -462,6 +466,12 @@ extern pHistDriver CreateRegressHM(pStringDict pOpt);
|
||||
{
|
||||
pNew->pDriv = CreateRegressHM(pOption);
|
||||
}
|
||||
/*
|
||||
else if(strcmp(driver,"slave") == 0)
|
||||
{
|
||||
pNew->pDriv = MakeHMSlaveHM(pOption);
|
||||
}
|
||||
*/
|
||||
else
|
||||
{
|
||||
site = getSite();
|
||||
|
2
hmdata.c
2
hmdata.c
@ -55,7 +55,7 @@ void clearHMData(pHMdata self){
|
||||
memset(self->localBuffer,0,size*sizeof(HistInt));
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static int resizeBuffer(pHMdata self){
|
||||
int resizeBuffer(pHMdata self){
|
||||
long size;
|
||||
int i;
|
||||
|
||||
|
1
hmdata.h
1
hmdata.h
@ -37,6 +37,7 @@
|
||||
|
||||
int configureHMdata(pHMdata self, pStringDict pOpt,
|
||||
SConnection *pCon);
|
||||
int resizeBuffer(pHMdata self);
|
||||
int genTimeBinning(pHMdata self, float start, float step,
|
||||
int noSteps);
|
||||
int setTimeBin(pHMdata self, int index, float value);
|
||||
|
1
hmdata.w
1
hmdata.w
@ -33,6 +33,7 @@ The following functions work on this data structure:
|
||||
|
||||
int configureHMdata(pHMdata self, pStringDict pOpt,
|
||||
SConnection *pCon);
|
||||
int resizeBuffer(pHMdata self);
|
||||
int genTimeBinning(pHMdata self, float start, float step,
|
||||
int noSteps);
|
||||
int setTimeBin(pHMdata self, int index, float value);
|
||||
|
2
make_gen
2
make_gen
@ -32,7 +32,7 @@ SOBJ = network.o ifile.o conman.o SCinter.o splitter.o passwd.o \
|
||||
mcstashm.o initializer.o remob.o tclmotdriv.o protocol.o \
|
||||
sinfox.o sicslist.o cone.o hipadaba.o sicshipadaba.o statistics.o \
|
||||
moregress.o hdbcommand.o multicounter.o regresscter.o histregress.o \
|
||||
sicshdbadapter.o polldriv.o sicspoll.o statemon.o
|
||||
sicshdbadapter.o polldriv.o sicspoll.o statemon.o hmslave.o
|
||||
|
||||
MOTOROBJ = motor.o simdriv.o
|
||||
COUNTEROBJ = countdriv.o simcter.o counter.o
|
||||
|
@ -26,7 +26,8 @@ SUBLIBS = psi/libpsi.a psi/hardsup/libhlib.a matrix/libmatrix.a \
|
||||
LIBS = -L$(HDFROOT)/lib $(SUBLIBS) $(NILIB)\
|
||||
-ltcl8.3 $(HDFROOT)/lib/libhdf5.a \
|
||||
$(HDFROOT)/lib/libmfhdf.a $(HDFROOT)/lib/libdf.a \
|
||||
$(HDFROOT)/lib/libjpeg.a -lsz -ljson -ldl -lz -lmxml -lghttp -lm -lc
|
||||
$(HDFROOT)/lib/libjpeg.a -lsz $(HDFROOT)/lib/libjson.a \
|
||||
-ldl -lz -lmxml -lghttp -lm -lc
|
||||
|
||||
include make_gen
|
||||
|
||||
|
@ -145,14 +145,7 @@
|
||||
|
||||
pDriv = GetDrivableInterface(pVar);
|
||||
assert(pDriv != NULL);
|
||||
if(strcmp(pDum->pDescriptor->name,"Motor") == 0)
|
||||
{
|
||||
MotorGetSoftPosition((pMotor)pVar,pCon,&value);
|
||||
}
|
||||
else
|
||||
{
|
||||
value = pDriv->GetValue(pVar,pCon);
|
||||
}
|
||||
value = pDriv->GetValue(pVar,pCon);
|
||||
return value;
|
||||
}
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
@ -1,3 +1,3 @@
|
||||
120
|
||||
133
|
||||
NEVER, EVER modify or delete this file
|
||||
You'll risk eternal damnation and a reincarnation as a cockroach!|n
|
@ -7,12 +7,11 @@
|
||||
# O P T I O N S
|
||||
# wwwMode = 1 when running for the WWW-VDMC application
|
||||
set wwwMode 0
|
||||
|
||||
if {$wwwMode == 1} {
|
||||
set home /home/lnswww/vinstrument/mcstas/dmc
|
||||
set datahome /home/lnswww/www/vinstrument
|
||||
} else {
|
||||
set home $env(HOME)/psi/workspace/sics/mcstas/dmc
|
||||
set home $env(HOME)/src/workspace/sics/mcstas/dmc
|
||||
}
|
||||
#--------------------------------- first all the server options are set
|
||||
#ServerOption RedirectFile $home/stdcdmc
|
||||
@ -246,3 +245,6 @@ hattach /Graphics/powder_diagram banana counts
|
||||
hsetprop /Graphics/powder_diagram/counts type data
|
||||
hsetprop /Graphics/powder_diagram/counts priv internal
|
||||
sicspoll add /Graphics/powder_diagram/counts hdb 60
|
||||
|
||||
restore
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
exe batchpath ./
|
||||
exe syspath ./
|
||||
# Motor omegam
|
||||
omegam sign 1.000000
|
||||
omegam SoftZero 0.000000
|
||||
@ -98,10 +100,10 @@ twothetad ignorefault 0.000000
|
||||
twothetad AccessCode 2.000000
|
||||
twothetad movecount 10.000000
|
||||
# Counter counter
|
||||
counter SetPreset 60000000.000000
|
||||
counter SetPreset 30000000.000000
|
||||
counter SetMode Monitor
|
||||
banana CountMode monitor
|
||||
banana preset 60000.000000
|
||||
banana preset 300.000000
|
||||
# Motor a1
|
||||
a1 sign 1.000000
|
||||
a1 SoftZero 0.000000
|
||||
@ -201,7 +203,7 @@ a9 precision 0.010000
|
||||
a9 ignorefault 0.000000
|
||||
a9 AccessCode 2.000000
|
||||
a9 movecount 10.000000
|
||||
title D3C
|
||||
title D3C in Senfsosse
|
||||
title setAccess 2
|
||||
user UNKNOWN
|
||||
user setAccess 2
|
||||
@ -215,7 +217,7 @@ comment2 UNKNOWN
|
||||
comment2 setAccess 2
|
||||
comment3 UNKNOWN
|
||||
comment3 setAccess 2
|
||||
starttime 2006-03-10 15:33:04
|
||||
starttime 2007-02-20 11:27:09
|
||||
starttime setAccess 2
|
||||
adress UNKNOWN
|
||||
adress setAccess 2
|
||||
@ -227,5 +229,5 @@ email UNKNOWN
|
||||
email setAccess 2
|
||||
sample_mur 0.000000
|
||||
sample_mur setAccess 2
|
||||
exe batchpath ./
|
||||
exe syspath ./
|
||||
lastdatafile /afs/psi.ch/user/k/koennecke/src/workspace/sics/mcstas/dmc/000/vdmc2007n000133.xml
|
||||
lastdatafile setAccess 2
|
||||
|
2
motor.c
2
motor.c
@ -135,7 +135,7 @@
|
||||
float fVal = 0.;
|
||||
|
||||
assert(pData);
|
||||
iRet = MotorGetHardPosition((pMotor)pData,pCon,&fVal);
|
||||
iRet = MotorGetSoftPosition((pMotor)pData,pCon,&fVal);
|
||||
if(iRet != OKOK)
|
||||
{
|
||||
fVal = -9999999.99;
|
||||
|
13
napi5.c
13
napi5.c
@ -589,7 +589,7 @@ static void ignoreError(void *data, char *text){
|
||||
hsize_t chunkdims[H5S_MAX_RANK];
|
||||
hsize_t mydim[H5S_MAX_RANK], mydim1[H5S_MAX_RANK];
|
||||
hsize_t size[2];
|
||||
hsize_t maxdims[1] = {H5S_UNLIMITED};
|
||||
hsize_t maxdims[H5S_MAX_RANK];
|
||||
|
||||
pFile = NXI5assert (fid);
|
||||
|
||||
@ -651,6 +651,8 @@ static void ignoreError(void *data, char *text){
|
||||
NXIReportError (NXpData, pBuffer);
|
||||
return NX_ERROR;
|
||||
}
|
||||
mydim[i] = dimensions[i];
|
||||
maxdims[i] = dimensions[i];
|
||||
}
|
||||
if (datatype == NX_CHAR)
|
||||
{
|
||||
@ -665,7 +667,8 @@ static void ignoreError(void *data, char *text){
|
||||
} else {
|
||||
if (dimensions[0] == NX_UNLIMITED)
|
||||
{
|
||||
mydim[0]=0;
|
||||
mydim[0]=1;
|
||||
maxdims[0] = H5S_UNLIMITED;
|
||||
dataspace=H5Screate_simple(rank, mydim, maxdims);
|
||||
} else {
|
||||
for(i = 0; i < rank; i++)
|
||||
@ -721,8 +724,10 @@ static void ignoreError(void *data, char *text){
|
||||
}
|
||||
if (dimensions[0] == NX_UNLIMITED)
|
||||
{
|
||||
size[0] = 1;
|
||||
size[1] = 1;
|
||||
for(i = 0; i < rank; i++){
|
||||
size[i] = dimensions[i];
|
||||
}
|
||||
size[0] = 1;
|
||||
iNew = H5Dextend (pFile->iCurrentD, size);
|
||||
if (iNew < 0) {
|
||||
sprintf (pBuffer, "ERROR: cannot create Dataset %s, check arguments",
|
||||
|
29
nserver.c
29
nserver.c
@ -132,6 +132,7 @@
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
self->dummyCon = SCCreateDummyConnection(self->pSics);
|
||||
|
||||
/*
|
||||
check for option RedirectFile and redirect stout/sterr to it
|
||||
@ -216,10 +217,6 @@
|
||||
NetReadRegister(pReader, self->pServerPort, naccept, NULL);
|
||||
|
||||
/* the device executor */
|
||||
pCom = FindCommand(self->pSics,"stopexe");
|
||||
assert(pCom);
|
||||
assert(pCom->pData);
|
||||
self->pExecutor = (pExeList)pCom->pData;
|
||||
openDevexecLog();
|
||||
DevexecLog("START","SICS");
|
||||
|
||||
@ -257,30 +254,6 @@
|
||||
EnvMonSignal,
|
||||
NULL,
|
||||
self->pMonitor,1);
|
||||
|
||||
|
||||
/* initialize the last saved status of the system */
|
||||
strcpy(pBueffel,"Restore ");
|
||||
pText = IFindOption(pSICSOptions,"statusfile");
|
||||
if(pText)
|
||||
{
|
||||
strcat(pBueffel,pText);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcat(pBueffel,DEFAULTSTATUSFILE);
|
||||
IFAddOption(pSICSOptions,"statusfile",
|
||||
DEFAULTSTATUSFILE);
|
||||
}
|
||||
self->dummyCon = pCon = SCCreateDummyConnection(self->pSics);
|
||||
if(pCon)
|
||||
{
|
||||
InterpExecute(self->pSics,pCon,pBueffel);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("ERROR: Cannot allocate dummy connection, status NOT loaded");
|
||||
}
|
||||
|
||||
/* install performance monitor */
|
||||
pMon = CreatePerfMon(20);
|
||||
|
22
nxdict.c
22
nxdict.c
@ -1164,11 +1164,14 @@
|
||||
*/
|
||||
if(iChunkDefined == 0)
|
||||
{
|
||||
for(i = 0; i < iRank; i++)
|
||||
{
|
||||
iChunk[i] = iDim[i];
|
||||
for(i = 0; i < iRank; i++)
|
||||
{
|
||||
iChunk[i] = iDim[i];
|
||||
}
|
||||
}
|
||||
if(iChunk[0] < 0) {
|
||||
iChunk[0] = 1;
|
||||
}
|
||||
|
||||
/* first install dummy error handler, try open it, then
|
||||
deinstall again and create if allowed
|
||||
@ -1349,19 +1352,8 @@
|
||||
iRet = NXDIUnwind(hfil,pParse.iDepth);
|
||||
return NX_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/* try rewinding the hierarchy */
|
||||
if(pParse.iTerminal == TERMSDS)
|
||||
{
|
||||
iStat = NXDIUnwind(hfil,pParse.iDepth);
|
||||
if(iStat != NX_OK)
|
||||
{
|
||||
return NX_ERROR;
|
||||
}
|
||||
}
|
||||
/* do not rewind on links */
|
||||
return iRet;
|
||||
return iRet;
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
NXstatus NXDopenalias(NXhandle hfil, NXdict dict, char *pAlias)
|
||||
|
338
nxscript.c
338
nxscript.c
@ -33,95 +33,6 @@
|
||||
|
||||
extern char *trim(char *str);
|
||||
|
||||
/*ANSTO MOD START */
|
||||
static void putArray(SConnection *pCon, SicsInterp *pSics,
|
||||
pNXScript self,
|
||||
int argc, char *argv[]){
|
||||
float *data = NULL;
|
||||
int length, i, status;
|
||||
char num[20];
|
||||
char buffer[256], defString[512], *varData;
|
||||
Tcl_Interp *tcl = NULL;
|
||||
double dVal;
|
||||
|
||||
if(argc < 5){
|
||||
SCWrite(pCon,"ERROR: insufficient number of arguments to array",
|
||||
eError);
|
||||
return;
|
||||
}
|
||||
tcl = InterpGetTcl(pSics);
|
||||
assert(tcl != NULL);
|
||||
|
||||
/*
|
||||
get array length
|
||||
*/
|
||||
status = Tcl_GetInt(tcl,argv[4],&length);
|
||||
if(status != TCL_OK){
|
||||
sprintf(buffer,"ERROR: failed to convert %s to integer",argv[4]);
|
||||
SCWrite(pCon,buffer,eError);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
allocate
|
||||
*/
|
||||
if(length > 0){
|
||||
data = (float *)malloc(length*sizeof(float));
|
||||
}
|
||||
if(data == NULL){
|
||||
snprintf(buffer,255,
|
||||
"ERROR: out of memory or invalid length at %s, length = %s",
|
||||
argv[2],argv[4]);
|
||||
SCWrite(pCon,buffer,eError);
|
||||
return;
|
||||
}
|
||||
memset(data,0,length*sizeof(float));
|
||||
|
||||
/*
|
||||
try getting data
|
||||
*/
|
||||
for(i = 0; i < length; i++){
|
||||
sprintf(num,"%d",i);
|
||||
varData = (char *)Tcl_GetVar2(tcl,argv[3],num,0);
|
||||
if(varData != NULL){
|
||||
status = Tcl_GetDouble(tcl,varData,&dVal);
|
||||
if(status != TCL_OK){
|
||||
sprintf(buffer,"ERROR: failed to convert %s to double",
|
||||
varData);
|
||||
SCWrite(pCon,buffer,eError);
|
||||
}
|
||||
data[i] = (float)dVal;
|
||||
} else {
|
||||
snprintf(buffer,254,"WARNING: failed to find array element %d", i);
|
||||
SCWrite(pCon,buffer,eError);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
build definition string
|
||||
*/
|
||||
status = NXDdefget(self->dictHandle,argv[2],buffer,254);
|
||||
if(!status){
|
||||
sprintf(buffer,"ERROR: alias %s for array not found",
|
||||
argv[2]);
|
||||
SCWrite(pCon,buffer,eError);
|
||||
free(data);
|
||||
return;
|
||||
}
|
||||
snprintf(defString,511,"%s -dim {%d} ",buffer,length);
|
||||
|
||||
/*
|
||||
write it!
|
||||
*/
|
||||
status = NXDputdef(self->fileHandle,self->dictHandle,defString,data);
|
||||
if(status != NX_OK){
|
||||
sprintf(buffer,"ERROR: failed to write array");
|
||||
SCWrite(pCon,buffer,eError);
|
||||
}
|
||||
free(data);
|
||||
SCSendOK(pCon);
|
||||
}
|
||||
/* ANSTO MOD END */
|
||||
/* missing in nxdict.h: */
|
||||
NXstatus NXDdefget(NXdict handle, char *pKey, char *pBuffer, int iBufLen);
|
||||
/*------------------------------------------------------------------------*/
|
||||
@ -480,11 +391,12 @@ static void putAttribute(SConnection *pCon, SicsInterp *pSics,
|
||||
return;
|
||||
}
|
||||
status = NXputattr(self->fileHandle,argv[3],(void *)argv[4],
|
||||
strlen(argv[4])+1, type);
|
||||
strlen(argv[4])+1, type);
|
||||
if(status != NX_OK){
|
||||
sprintf(buffer,"ERROR: failed to write attribute %s", argv[3]);
|
||||
SCWrite(pCon,buffer,eError);
|
||||
}
|
||||
NXopenpath(self->fileHandle,"/");
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void updateHMDim(NXScript *self, pHistMem mem){
|
||||
@ -683,10 +595,7 @@ static void putHistogramMemoryChunked(SConnection *pCon, SicsInterp *pSics,
|
||||
SCWrite(pCon,buffer,eError);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
read HM
|
||||
*/
|
||||
@ -736,6 +645,95 @@ static void putHistogramMemoryChunked(SConnection *pCon, SicsInterp *pSics,
|
||||
|
||||
return;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static int listToArray(SicsInterp *pSics, char *list,
|
||||
int intar[NX_MAXRANK]){
|
||||
int argc, status, i, val;
|
||||
CONST char **argv;
|
||||
Tcl_Interp *pTcl = InterpGetTcl(pSics);
|
||||
|
||||
status = Tcl_SplitList(pTcl, list, &argc, &argv);
|
||||
if(status != TCL_OK){
|
||||
return status;
|
||||
}
|
||||
|
||||
for(i = 0; i < argc; i++){
|
||||
status = Tcl_GetInt(pTcl,argv[i],&val);
|
||||
if(status != TCL_OK){
|
||||
return status;
|
||||
}
|
||||
intar[i] = val;
|
||||
}
|
||||
Tcl_Free((char *)argv);
|
||||
return TCL_OK;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void putSlab(SConnection *pCon, SicsInterp *pSics, pNXScript self,
|
||||
int argc, char *argv[]){
|
||||
int start[NX_MAXRANK], size[NX_MAXRANK];
|
||||
int status, written = 0;
|
||||
pHistMem mem = NULL;
|
||||
HistInt *histData = NULL;
|
||||
pSICSData data = NULL;
|
||||
|
||||
if(argc < 6){
|
||||
SCWrite(pCon,"ERROR: insufficient number of arguments to putslab",
|
||||
eError);
|
||||
return;
|
||||
}
|
||||
|
||||
status = NXDopenalias(self->fileHandle, self->dictHandle,argv[2]);
|
||||
if(status != NX_OK){
|
||||
SCPrintf(pCon,eError,"ERROR: failed to open alias %s", argv[2]);
|
||||
return;
|
||||
}
|
||||
|
||||
status = listToArray(pSics,argv[3],start);
|
||||
if(status != TCL_OK){
|
||||
SCWrite(pCon,"ERROR: failed to convert start value list", eError);
|
||||
return;
|
||||
}
|
||||
|
||||
status = listToArray(pSics,argv[4],size);
|
||||
if(status != TCL_OK){
|
||||
SCWrite(pCon,"ERROR: failed to convert size value list", eError);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* try to write HM data
|
||||
*/
|
||||
mem = (pHistMem)FindCommandData(pSics,argv[5],"HistMem");
|
||||
if(mem != NULL){
|
||||
histData = GetHistogramPointer(mem,pCon);
|
||||
if(histData){
|
||||
status = NXputslab(self->fileHandle, histData, start, size);
|
||||
if(status == NX_OK){
|
||||
written = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* try to look for sicsdata
|
||||
*/
|
||||
data = (pSICSData)FindCommandData(pSics,argv[5],"SICSData");
|
||||
if(data != NULL){
|
||||
status = NXputslab(self->fileHandle,data->data,start,size);
|
||||
if(status == NX_OK){
|
||||
written = 1;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* drop out of hierarchy
|
||||
*/
|
||||
NXopenpath(self->fileHandle,"/");
|
||||
|
||||
if(written == 0){
|
||||
SCWrite(pCon,"ERROR: failed to write data, data not recognised",
|
||||
eError);
|
||||
}
|
||||
}
|
||||
/*-------------------------------------------------------------------*/
|
||||
static void putTimeBinning(SConnection *pCon, SicsInterp *pSics,
|
||||
pNXScript self,
|
||||
@ -748,7 +746,7 @@ static void putTimeBinning(SConnection *pCon, SicsInterp *pSics,
|
||||
|
||||
if(argc < 4){
|
||||
SCWrite(pCon,"ERROR: insufficient number of arguments to puttimebinning",
|
||||
eError);
|
||||
eError);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -804,139 +802,7 @@ static void putTimeBinning(SConnection *pCon, SicsInterp *pSics,
|
||||
return;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
/**\brief Calculates polar angles on a 2D grid for cylindrical detectors.
|
||||
*
|
||||
* param dradius detector radius
|
||||
* param angsep angular separation between detector columns in radians
|
||||
* param active_height_mm of a detector in mm
|
||||
* param det_rot_rad detector rotation in radians
|
||||
* param row_zero vertical pixel at beam centre.
|
||||
* param ROI_row_offset horizontal pixel offset of ROI
|
||||
* param col_zero horizontal pixel at beam centre for detector rotation of zero.
|
||||
* param ROI_col_offset vertical pixel offset of ROI
|
||||
* param rownum number of detector rows
|
||||
* param colnum number of detector columns
|
||||
*
|
||||
* Detector pixel layout uses display coordinates viewed from the sample.
|
||||
* ie If you stand at the sample and face the detector the (0,0) is at the
|
||||
* left.
|
||||
*/
|
||||
float *G_TwoThetaArr=NULL;
|
||||
void polar_angle(double dradius, double angsep, double active_height_mm, double det_rot_rad, double row_zero, double ROI_row_offset, double col_zero, double ROI_col_offset, double rownum, double colnum) {
|
||||
|
||||
int row,col;
|
||||
double rowsep, height, alpha, pang;
|
||||
|
||||
if (G_TwoThetaArr != NULL)
|
||||
free(G_TwoThetaArr);
|
||||
|
||||
G_TwoThetaArr = (float *)malloc(rownum*colnum*sizeof(float));
|
||||
|
||||
|
||||
rowsep = active_height_mm/(rownum-1);
|
||||
|
||||
for (row=0; row < rownum; row++) {
|
||||
height=(row_zero - ROI_row_offset - row)*rowsep;
|
||||
for (col=0; col < colnum; col++) {
|
||||
alpha = (col_zero - ROI_col_offset - col)*angsep + det_rot_rad;
|
||||
pang = acos(dradius * cos(alpha)/sqrt(dradius*dradius+ height*height));
|
||||
G_TwoThetaArr[(int)(row*colnum+col)]=pang;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void putPolarArray(SConnection *pCon, SicsInterp *pSics,
|
||||
pNXScript self,
|
||||
int argc, char *argv[]){
|
||||
int status;
|
||||
char buffer[256];
|
||||
Tcl_Interp *tcl = NULL;
|
||||
|
||||
double angsep, det_rot_rad, active_height_mm, rowsep;
|
||||
double row_zero, ROI_row_offset, col_zero, ROI_col_offset, dradius;
|
||||
double rownum, colnum;
|
||||
|
||||
if(argc < 11){
|
||||
SCWrite(pCon,"ERROR: insufficient number of arguments to array",
|
||||
eError);
|
||||
return;
|
||||
}
|
||||
tcl = InterpGetTcl(pSics);
|
||||
assert(tcl != NULL);
|
||||
|
||||
|
||||
status = Tcl_GetDouble(tcl,argv[3],&dradius);
|
||||
if(status != TCL_OK){
|
||||
sprintf(buffer,"ERROR: failed to convert %s to double",argv[3]);
|
||||
SCWrite(pCon,buffer,eError);
|
||||
return;
|
||||
}
|
||||
status = Tcl_GetDouble(tcl,argv[4],&angsep);
|
||||
if(status != TCL_OK){
|
||||
sprintf(buffer,"ERROR: failed to convert %s to double",argv[4]);
|
||||
SCWrite(pCon,buffer,eError);
|
||||
return;
|
||||
}
|
||||
status = Tcl_GetDouble(tcl,argv[5],&active_height_mm);
|
||||
if(status != TCL_OK){
|
||||
sprintf(buffer,"ERROR: failed to convert %s to double",argv[5]);
|
||||
SCWrite(pCon,buffer,eError);
|
||||
return;
|
||||
}
|
||||
status = Tcl_GetDouble(tcl,argv[6],&det_rot_rad);
|
||||
if(status != TCL_OK){
|
||||
sprintf(buffer,"ERROR: failed to convert %s to double",argv[6]);
|
||||
SCWrite(pCon,buffer,eError);
|
||||
return;
|
||||
}
|
||||
status = Tcl_GetDouble(tcl,argv[7],&row_zero);
|
||||
if(status != TCL_OK){
|
||||
sprintf(buffer,"ERROR: failed to convert %s to double",argv[7]);
|
||||
SCWrite(pCon,buffer,eError);
|
||||
return;
|
||||
}
|
||||
status = Tcl_GetDouble(tcl,argv[8],&ROI_row_offset);
|
||||
if(status != TCL_OK){
|
||||
sprintf(buffer,"ERROR: failed to convert %s to double",argv[8]);
|
||||
SCWrite(pCon,buffer,eError);
|
||||
return;
|
||||
}
|
||||
status = Tcl_GetDouble(tcl,argv[9],&col_zero);
|
||||
if(status != TCL_OK){
|
||||
sprintf(buffer,"ERROR: failed to convert %s to double",argv[9]);
|
||||
SCWrite(pCon,buffer,eError);
|
||||
return;
|
||||
}
|
||||
status = Tcl_GetDouble(tcl,argv[10],&ROI_col_offset);
|
||||
if(status != TCL_OK){
|
||||
sprintf(buffer,"ERROR: failed to convert %s to double",argv[10]);
|
||||
SCWrite(pCon,buffer,eError);
|
||||
return;
|
||||
}
|
||||
status = Tcl_GetDouble(tcl,argv[11],&rownum);
|
||||
if(status != TCL_OK){
|
||||
sprintf(buffer,"ERROR: failed to convert %s to double",argv[11]);
|
||||
SCWrite(pCon,buffer,eError);
|
||||
return;
|
||||
}
|
||||
status = Tcl_GetDouble(tcl,argv[12],&colnum);
|
||||
if(status != TCL_OK){
|
||||
sprintf(buffer,"ERROR: failed to convert %s to double",argv[12]);
|
||||
SCWrite(pCon,buffer,eError);
|
||||
return;
|
||||
}
|
||||
|
||||
polar_angle(dradius, angsep, active_height_mm, det_rot_rad, row_zero, ROI_row_offset, col_zero, ROI_col_offset, rownum, colnum);
|
||||
|
||||
status = NXDputalias(self->fileHandle, self->dictHandle,argv[2],G_TwoThetaArr);
|
||||
if(status != NX_OK){
|
||||
sprintf(buffer,"ERROR: failed to write array");
|
||||
SCWrite(pCon,buffer,eError);
|
||||
}
|
||||
SCSendOK(pCon);
|
||||
}
|
||||
|
||||
static void putGenArray(SConnection *pCon, SicsInterp *pSics,
|
||||
static void putArray(SConnection *pCon, SicsInterp *pSics,
|
||||
pNXScript self,
|
||||
int argc, char *argv[]){
|
||||
float *data = NULL;
|
||||
@ -998,7 +864,7 @@ static void putGenArray(SConnection *pCon, SicsInterp *pSics,
|
||||
SCWrite(pCon,buffer,eError);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
|
||||
/*
|
||||
build definition string
|
||||
*/
|
||||
@ -1011,12 +877,11 @@ static void putGenArray(SConnection *pCon, SicsInterp *pSics,
|
||||
return;
|
||||
}
|
||||
snprintf(defString,511,"%s -dim {%d} ",buffer,length);
|
||||
|
||||
/*
|
||||
write it!
|
||||
*/
|
||||
status = NXDputdef(self->fileHandle,self->dictHandle,defString,data);
|
||||
#endif
|
||||
status = NXDputalias(self->fileHandle, self->dictHandle,argv[2],data);
|
||||
if(status != NX_OK){
|
||||
sprintf(buffer,"ERROR: failed to write array");
|
||||
SCWrite(pCon,buffer,eError);
|
||||
@ -1232,14 +1097,8 @@ static int handlePut(SConnection *pCon, SicsInterp *pSics, pNXScript self,
|
||||
/*=================*/
|
||||
putTimeBinning(pCon,pSics,self,argc,argv);
|
||||
}else if(strcmp(argv[1],"putarray") == 0){
|
||||
/*== ANSTO MOD ===*/
|
||||
/*================*/
|
||||
putArray(pCon,pSics,self,argc,argv);
|
||||
}else if(strcmp(argv[1],"putpolararray") == 0){
|
||||
/*================*/
|
||||
putPolarArray(pCon,pSics,self,argc,argv);
|
||||
}else if(strcmp(argv[1],"putgenarray") == 0){
|
||||
/*================*/
|
||||
putGenArray(pCon,pSics,self,argc,argv);
|
||||
}else if(strcmp(argv[1],"putintarray") == 0){
|
||||
/*================*/
|
||||
putIntArray(pCon,pSics,self,argc,argv);
|
||||
@ -1252,6 +1111,9 @@ static int handlePut(SConnection *pCon, SicsInterp *pSics, pNXScript self,
|
||||
}else if(strcmp(argv[1],"putattribute") == 0){
|
||||
/*===============*/
|
||||
putAttribute(pCon,pSics,self,argc,argv);
|
||||
}else if(strcmp(argv[1],"putslab") == 0){
|
||||
/*===============*/
|
||||
putSlab(pCon,pSics,self,argc,argv);
|
||||
} else {
|
||||
SCWrite(pCon,"ERROR: put command not recognised",eError);
|
||||
}
|
||||
|
191
nxxml.c
191
nxxml.c
@ -2,7 +2,7 @@
|
||||
* This is the implementation file for the XML file driver
|
||||
* for NeXus
|
||||
*
|
||||
* Copyright (C) 2004 Mark Koennecke
|
||||
* Copyright (C) 2006 Mark Koennecke
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -18,7 +18,7 @@
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* For further information, see <http://www.neutron.anl.gov/NeXus/>
|
||||
* For further information, see <http://www.nexusformat.org>
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <napi.h>
|
||||
@ -243,6 +243,7 @@ static mxml_node_t *searchGroupLinks(pXMLNexus xmlHandle, CONSTCHAR *name,
|
||||
mxml_node_t *current;
|
||||
mxml_node_t *test = NULL;
|
||||
const char *linkTarget;
|
||||
const char *linkName = NULL;
|
||||
|
||||
current = xmlHandle->stack[xmlHandle->stackPointer].current;
|
||||
linkNode = current;
|
||||
@ -257,6 +258,17 @@ static mxml_node_t *searchGroupLinks(pXMLNexus xmlHandle, CONSTCHAR *name,
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
test for named links
|
||||
*/
|
||||
linkName = mxmlElementGetAttr(linkNode,"name");
|
||||
if(test != NULL && linkName != NULL){
|
||||
if(strcmp(test->value.element.name,nxclass) == 0){
|
||||
if(strcmp(linkName, name) == 0){
|
||||
return test;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -374,8 +386,10 @@ NXstatus NXXmakedata (NXhandle fid,
|
||||
return NX_ERROR;
|
||||
}
|
||||
if(dimensions[0] < 0){
|
||||
NXIReportError(NXpData,
|
||||
"NeXus XML-API does not support unlimited dimensions");
|
||||
dimensions[0] = 1;
|
||||
}
|
||||
if ((datatype == NX_CHAR) && (rank > 1)) {
|
||||
NXIReportError(NXpData,"NeXus XML-API does not yet support multi-dimensional character arrays");
|
||||
return NX_ERROR;
|
||||
}
|
||||
|
||||
@ -419,6 +433,7 @@ static mxml_node_t *searchSDSLinks(pXMLNexus xmlHandle, CONSTCHAR *name){
|
||||
mxml_node_t *current;
|
||||
mxml_node_t *test = NULL;
|
||||
const char *linkTarget;
|
||||
const char *linkName = NULL;
|
||||
|
||||
current = xmlHandle->stack[xmlHandle->stackPointer].current;
|
||||
linkNode = current;
|
||||
@ -431,6 +446,15 @@ static mxml_node_t *searchSDSLinks(pXMLNexus xmlHandle, CONSTCHAR *name){
|
||||
return test;
|
||||
}
|
||||
}
|
||||
/*
|
||||
test for named links
|
||||
*/
|
||||
linkName = mxmlElementGetAttr(linkNode,"name");
|
||||
if(test != NULL && linkName != NULL){
|
||||
if(strcmp(linkName,name) == 0){
|
||||
return test;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -670,6 +694,38 @@ static void putSlabData(pNXDS dataset, pNXDS slabData, int dim,
|
||||
}
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------
|
||||
This is in order to support unlimited dimensions along the first axis
|
||||
-----------------------------------------------------------------------*/
|
||||
static int checkAndExtendDataset(mxml_node_t *node, pNXDS dataset,
|
||||
int start[], int size[]){
|
||||
int dim0, byteLength;
|
||||
void *oldData = NULL;
|
||||
char *typestring = NULL;
|
||||
|
||||
dim0 = start[0] + size[0];
|
||||
if(dim0 > dataset->dim[0]){
|
||||
byteLength = getNXDatasetByteLength(dataset);
|
||||
oldData = dataset->u.ptr;
|
||||
dataset->dim[0] = dim0;
|
||||
dataset->u.ptr = malloc(getNXDatasetByteLength(dataset));
|
||||
if(dataset->u.ptr == NULL){
|
||||
return 0;
|
||||
}
|
||||
memset(dataset->u.ptr,0,getNXDatasetByteLength(dataset));
|
||||
memcpy(dataset->u.ptr,oldData,byteLength);
|
||||
free(oldData);
|
||||
typestring = buildTypeString(dataset->type,dataset->rank,dataset->dim);
|
||||
if(typestring != NULL){
|
||||
mxmlElementSetAttr(node,TYPENAME,typestring);
|
||||
free(typestring);
|
||||
} else {
|
||||
NXIReportError(NXpData,"Failed to allocate typestring");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
NXstatus NXXputslab (NXhandle fid, void *data,
|
||||
int iStart[], int iSize[]){
|
||||
@ -678,7 +734,7 @@ NXstatus NXXputslab (NXhandle fid, void *data,
|
||||
mxml_node_t *userData = NULL;
|
||||
mxml_node_t *current = NULL;
|
||||
pNXDS dataset, slabData;
|
||||
int sourcePos[NX_MAXRANK], targetPos[NX_MAXRANK];
|
||||
int sourcePos[NX_MAXRANK], targetPos[NX_MAXRANK], status;
|
||||
|
||||
xmlHandle = (pXMLNexus)fid;
|
||||
assert(xmlHandle);
|
||||
@ -697,11 +753,20 @@ NXstatus NXXputslab (NXhandle fid, void *data,
|
||||
}
|
||||
dataset = (pNXDS)userData->value.custom.data;
|
||||
assert(dataset);
|
||||
|
||||
status = checkAndExtendDataset(current,dataset,iStart,iSize);
|
||||
if(status == 0){
|
||||
NXIReportError(NXpData,"Out of memory extending dataset");
|
||||
return NX_ERROR;
|
||||
}
|
||||
|
||||
slabData = makeSlabData(dataset, data, iSize);
|
||||
if(slabData == NULL){
|
||||
NXIReportError(NXpData,"Failed to allocate slab data");
|
||||
return NX_ERROR;
|
||||
}
|
||||
|
||||
|
||||
putSlabData(dataset,slabData,0,iStart,sourcePos,targetPos);
|
||||
free(slabData->dim);
|
||||
free(slabData);
|
||||
@ -882,16 +947,8 @@ NXstatus NXXputattr (NXhandle fid, CONSTCHAR *name, void *data,
|
||||
xmlHandle = (pXMLNexus)fid;
|
||||
assert(xmlHandle);
|
||||
|
||||
if(!isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){
|
||||
/*
|
||||
global attribute
|
||||
*/
|
||||
current = xmlHandle->stack[0].current;
|
||||
} else {
|
||||
/*
|
||||
dataset attribute
|
||||
*/
|
||||
current = xmlHandle->stack[xmlHandle->stackPointer].current;
|
||||
current = xmlHandle->stack[xmlHandle->stackPointer].current;
|
||||
if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){
|
||||
if(strcmp(name,TYPENAME) == 0){
|
||||
NXIReportError(NXpData,"type is a reserved attribute name, rejected");
|
||||
return NX_ERROR;
|
||||
@ -922,17 +979,7 @@ NXstatus NXXgetattr (NXhandle fid, char *name,
|
||||
xmlHandle = (pXMLNexus)fid;
|
||||
assert(xmlHandle);
|
||||
|
||||
if(!isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){
|
||||
/*
|
||||
global attribute
|
||||
*/
|
||||
current = xmlHandle->stack[0].current;
|
||||
} else {
|
||||
/*
|
||||
dataset attribute
|
||||
*/
|
||||
current = xmlHandle->stack[xmlHandle->stackPointer].current;
|
||||
}
|
||||
current = xmlHandle->stack[xmlHandle->stackPointer].current;
|
||||
|
||||
attribute = mxmlElementGetAttr(current,name);
|
||||
if(!attribute){
|
||||
@ -1014,6 +1061,7 @@ NXstatus NXXgetnextentry (NXhandle fid,NXname name,
|
||||
const char *target = NULL, *attname = NULL;
|
||||
pNXDS dataset;
|
||||
char pBueffel[256];
|
||||
const char *linkName = NULL;
|
||||
|
||||
xmlHandle = (pXMLNexus)fid;
|
||||
assert(xmlHandle);
|
||||
@ -1045,6 +1093,7 @@ NXstatus NXXgetnextentry (NXhandle fid,NXname name,
|
||||
}
|
||||
if(strcmp(next->value.element.name,"NAPIlink") == 0){
|
||||
target = mxmlElementGetAttr(next,"target");
|
||||
linkName = mxmlElementGetAttr(next,"name");
|
||||
if(target == NULL){
|
||||
NXIReportError(NXpData,"Corrupted file, NAPIlink without target");
|
||||
return NX_ERROR;
|
||||
@ -1078,6 +1127,12 @@ NXstatus NXXgetnextentry (NXhandle fid,NXname name,
|
||||
attname = mxmlElementGetAttr(next,"name");
|
||||
strcpy(name,attname);
|
||||
}
|
||||
/*
|
||||
this is for named links
|
||||
*/
|
||||
if(linkName != NULL){
|
||||
strcpy(name,linkName);
|
||||
}
|
||||
return NX_OK;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
@ -1108,17 +1163,7 @@ NXstatus NXXgetnextattr (NXhandle fid, NXname pName,
|
||||
xmlHandle = (pXMLNexus)fid;
|
||||
assert(xmlHandle);
|
||||
|
||||
if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){
|
||||
/*
|
||||
dataset attribute
|
||||
*/
|
||||
stackPtr = xmlHandle->stackPointer;
|
||||
} else {
|
||||
/*
|
||||
global attribute
|
||||
*/
|
||||
stackPtr = 0;
|
||||
}
|
||||
stackPtr = xmlHandle->stackPointer;
|
||||
|
||||
current = xmlHandle->stack[stackPtr].current;
|
||||
currentAtt = xmlHandle->stack[stackPtr].currentAttribute;
|
||||
@ -1128,10 +1173,20 @@ NXstatus NXXgetnextattr (NXhandle fid, NXname pName,
|
||||
return NX_EOD;
|
||||
}
|
||||
|
||||
/*
|
||||
hide group name attribute
|
||||
*/
|
||||
if(strcmp(current->value.element.attrs[currentAtt].name,"name") == 0
|
||||
&& !isDataNode(current) ){
|
||||
xmlHandle->stack[stackPtr].currentAttribute++;
|
||||
return NXXgetnextattr(fid,pName,iLength,iType);
|
||||
}
|
||||
|
||||
/*
|
||||
hide type attribute
|
||||
*/
|
||||
if(strcmp(current->value.element.attrs[currentAtt].name,TYPENAME) == 0){
|
||||
if(strcmp(current->value.element.attrs[currentAtt].name,TYPENAME) == 0
|
||||
&& isDataNode(current)){
|
||||
xmlHandle->stack[stackPtr].currentAttribute++;
|
||||
return NXXgetnextattr(fid,pName,iLength,iType);
|
||||
}
|
||||
@ -1161,18 +1216,7 @@ extern NXstatus NXXinitattrdir(NXhandle fid){
|
||||
xmlHandle = (pXMLNexus)fid;
|
||||
assert(xmlHandle);
|
||||
|
||||
if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){
|
||||
/*
|
||||
dataset attribute
|
||||
*/
|
||||
stackPtr = xmlHandle->stackPointer;
|
||||
} else {
|
||||
/*
|
||||
global attribute
|
||||
*/
|
||||
stackPtr = 0;
|
||||
}
|
||||
|
||||
stackPtr = xmlHandle->stackPointer;
|
||||
xmlHandle->stack[stackPtr].currentAttribute = 0;
|
||||
return NX_OK;
|
||||
}
|
||||
@ -1218,22 +1262,17 @@ NXstatus NXXgetattrinfo (NXhandle fid, int *iN){
|
||||
xmlHandle = (pXMLNexus)fid;
|
||||
assert(xmlHandle);
|
||||
|
||||
if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){
|
||||
/*
|
||||
dataset attribute
|
||||
*/
|
||||
stackPtr = xmlHandle->stackPointer;
|
||||
} else {
|
||||
/*
|
||||
global attribute
|
||||
*/
|
||||
stackPtr = 0;
|
||||
}
|
||||
stackPtr = xmlHandle->stackPointer;
|
||||
|
||||
current = xmlHandle->stack[stackPtr].current;
|
||||
|
||||
/*
|
||||
hide type attribute
|
||||
hide type and group name attributes
|
||||
*/
|
||||
if(!isDataNode(current)) {
|
||||
*iN = current->value.element.num_attrs -1;
|
||||
return NX_OK;
|
||||
}
|
||||
if(mxmlElementGetAttr(current,TYPENAME) != NULL){
|
||||
*iN = current->value.element.num_attrs -1;
|
||||
} else {
|
||||
@ -1413,6 +1452,34 @@ NXstatus NXXmakelink (NXhandle fid, NXlink* sLink){
|
||||
}
|
||||
return NX_OK;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
NXstatus NXXmakenamedlink (NXhandle fid, char *name, NXlink* sLink){
|
||||
pXMLNexus xmlHandle = NULL;
|
||||
mxml_node_t *current = NULL, *linkNode = NULL;
|
||||
mxml_node_t *linkedNode = NULL;
|
||||
|
||||
xmlHandle = (pXMLNexus)fid;
|
||||
assert(xmlHandle);
|
||||
|
||||
if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){
|
||||
NXIReportError(NXpData,"No group to link to open");
|
||||
return NX_ERROR;
|
||||
}
|
||||
current = xmlHandle->stack[xmlHandle->stackPointer].current;
|
||||
linkNode = mxmlNewElement(current,"NAPIlink");
|
||||
if(!linkNode){
|
||||
NXIReportError(NXpData,"Failed to allocate new link element");
|
||||
return NX_ERROR;
|
||||
}
|
||||
mxmlElementSetAttr(linkNode,"target",sLink->targetPath);
|
||||
mxmlElementSetAttr(linkNode,"name",name);
|
||||
linkedNode = getLinkTarget(xmlHandle,sLink->targetPath);
|
||||
if(linkedNode != NULL){
|
||||
mxmlElementSetAttr(linkedNode,"target",sLink->targetPath);
|
||||
}
|
||||
return NX_OK;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
NXstatus NXXsameID (NXhandle fileid, NXlink* pFirstID,
|
||||
NXlink* pSecondID){
|
||||
|
5
ofac.c
5
ofac.c
@ -203,6 +203,7 @@
|
||||
assert(pInter);
|
||||
|
||||
pExe = CreateExeList(pTask);
|
||||
pServ->pExecutor = pExe;
|
||||
pEnv = CreateEnvMon();
|
||||
|
||||
assert(pExe);
|
||||
@ -213,9 +214,6 @@
|
||||
AddCommand(pInter,"FileEval",MacroFileEval,NULL,NULL);
|
||||
|
||||
AddCommand(pInter,"InternEval",InternalFileEval,NULL,NULL);
|
||||
/*
|
||||
AddCommand(pInter,"FileWhere",MacroWhere,WhereKill,NULL);
|
||||
*/
|
||||
AddCommand(pInter,"ClientPut",ClientPut,NULL,NULL);
|
||||
AddCommand(pInter,"GumPut",GumPut,NULL,NULL);
|
||||
AddCommand(pInter,"broadcast",Broadcast,NULL,NULL);
|
||||
@ -246,6 +244,7 @@
|
||||
AddCommand(pInter,"udpquieck",QuieckAction,KillQuieck,NULL);
|
||||
AddCommand(pInter,"alias",MakeAlias,NULL,NULL);
|
||||
AddCommand(pInter,"sicscron",MakeCron,NULL,NULL);
|
||||
AddCommand(pInter,"dolater",MakeCron,NULL,NULL);
|
||||
AddCommand(pInter,"sicsdatafactory",SICSDataFactory,NULL,NULL);
|
||||
AddCommand(pInter,"scriptcallback",CallbackScript,NULL,NULL);
|
||||
AddCommand(pInter,"help",SicsHelp,KillHelp,NULL);
|
||||
|
17
optimise.c
17
optimise.c
@ -308,22 +308,7 @@
|
||||
{
|
||||
DynarGet(self->pVariables,i,&pData);
|
||||
pOVar = (pOVarEntry)pData;
|
||||
if(FindMotor(pServ->pSics,pOVar->pName) != NULL)
|
||||
{
|
||||
iRet = MotorGetSoftPosition(pOVar->pData,pCon,&fVal);
|
||||
if(iRet == 1)
|
||||
{
|
||||
pOVar->fCenter = fVal;
|
||||
}
|
||||
else
|
||||
{
|
||||
pOVar->fCenter = -1000.;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pOVar->fCenter = pOVar->pDriv->GetValue(pOVar->pData,pCon);
|
||||
}
|
||||
pOVar->fCenter = pOVar->pDriv->GetValue(pOVar->pData,pCon);
|
||||
if(pOVar->fCenter < -900.)
|
||||
{
|
||||
return SCANERROR;
|
||||
|
119
remob.c
119
remob.c
@ -44,6 +44,7 @@ typedef struct RemServer {
|
||||
int matchMap;
|
||||
int taskActive;
|
||||
int interestActive;
|
||||
int forwardMessages;
|
||||
SCStore conn;
|
||||
} RemServer;
|
||||
|
||||
@ -192,37 +193,42 @@ static int RemSetInterest(RemChannel *rc) {
|
||||
return 0;
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
static void RemConnect(RemServer *remserver, RemChannel *rc) {
|
||||
/* open channel rc, if not yet opened */
|
||||
static void RemConnect(RemServer *remserver, int both) {
|
||||
/* open channel 0 or both channels, if not yet opened */
|
||||
int iRet;
|
||||
char buf[256];
|
||||
mkChannel *chan;
|
||||
int i;
|
||||
RemChannel *rc;
|
||||
|
||||
if (!rc->chan) {
|
||||
rc->timeout = 0;
|
||||
chan = NETConnect(remserver->host, remserver->port);
|
||||
if (!chan) {
|
||||
return;
|
||||
}
|
||||
rc->chan = chan;
|
||||
if (rc != &remserver->rc[0]) { /* open the user channel */
|
||||
iRet = RemWrite(rc, "remuser sesam\n");
|
||||
} else { /* open spy channel */
|
||||
iRet = RemWrite(rc, "Spy 007\n");
|
||||
}
|
||||
if (iRet < 0) goto close;
|
||||
iRet = RemRead(rc, 1000);
|
||||
while (iRet > 0) { /* eat login response */
|
||||
if (StartsWith(rc->line, "Login OK")) {
|
||||
/* printf("connected\n"); */
|
||||
if (remserver->interestActive && rc == &remserver->rc[0]) { /* open the user channel */
|
||||
if (!RemSetInterest(rc)) goto close;
|
||||
}
|
||||
for (i = 0; i <= both; i++) {
|
||||
rc = &remserver->rc[i];
|
||||
if (!rc->chan) {
|
||||
rc->timeout = 0;
|
||||
chan = NETConnect(remserver->host, remserver->port);
|
||||
if (!chan) {
|
||||
return;
|
||||
}
|
||||
rc->chan = chan;
|
||||
if (i != 0) { /* open the user channel */
|
||||
iRet = RemWrite(rc, "remuser sesam\n");
|
||||
} else { /* open spy channel */
|
||||
iRet = RemWrite(rc, "Spy 007\n");
|
||||
}
|
||||
if (iRet < 0) goto close;
|
||||
iRet = RemRead(rc, 1000);
|
||||
while (iRet > 0) { /* eat login response */
|
||||
if (StartsWith(rc->line, "Login OK")) {
|
||||
/* printf("connected\n"); */
|
||||
if (remserver->interestActive && rc == &remserver->rc[0]) { /* open the user channel */
|
||||
if (!RemSetInterest(rc)) goto close;
|
||||
}
|
||||
break;
|
||||
}
|
||||
iRet = RemRead(rc, 1000);
|
||||
}
|
||||
if (iRet <= 0) goto close;
|
||||
}
|
||||
goto close;
|
||||
}
|
||||
return;
|
||||
close:
|
||||
@ -253,16 +259,18 @@ static int RemServerTask(void *data) {
|
||||
}
|
||||
}
|
||||
|
||||
/* forward all other messages */
|
||||
pCon = SCLoad(&remserver->conn);
|
||||
if (pCon) {
|
||||
RemCopy(rc, pCon);
|
||||
if (remserver->forwardMessages) {
|
||||
/* forward all other messages */
|
||||
pCon = SCLoad(&remserver->conn);
|
||||
if (pCon) {
|
||||
RemCopy(rc, pCon);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
static int RemTransact(RemServer *remserver, RemChannel *rc, SConnection *pCon,
|
||||
static int RemTransact(RemServer *remserver, int nChan, SConnection *pCon,
|
||||
char *cmd, ...) {
|
||||
/* the variable arguments are for filtering:
|
||||
|
||||
@ -278,7 +286,8 @@ static int RemTransact(RemServer *remserver, RemChannel *rc, SConnection *pCon,
|
||||
va_list ap;
|
||||
int try;
|
||||
int argMask;
|
||||
|
||||
RemChannel *rc = &remserver->rc[nChan];
|
||||
|
||||
try=2;
|
||||
if (rc->timeout) { /* eat old responses */
|
||||
while (RemRead(rc, 0) > 0) {
|
||||
@ -286,10 +295,8 @@ static int RemTransact(RemServer *remserver, RemChannel *rc, SConnection *pCon,
|
||||
}
|
||||
}
|
||||
tryagain:
|
||||
strcpy(buf, "transact ");
|
||||
strcat(buf, cmd);
|
||||
strcat(buf,"\n");
|
||||
RemConnect(remserver, rc);
|
||||
snprintf(buf, sizeof buf, "transact %s\n", cmd);
|
||||
RemConnect(remserver, nChan);
|
||||
iRet = RemWrite(rc, buf);
|
||||
if (iRet < 0) goto close;
|
||||
|
||||
@ -365,8 +372,9 @@ static int RemobHalt(void *self) {
|
||||
char buf[64];
|
||||
|
||||
assert(remob);
|
||||
RemConnect(remserver, rc);
|
||||
RemConnect(remserver, 1);
|
||||
snprintf(buf, sizeof(buf), "stopexe %s\n", remob->name);
|
||||
remob->status = HWFault;
|
||||
return RemWrite(rc, buf);
|
||||
}
|
||||
|
||||
@ -394,7 +402,7 @@ static float RemobGetValue(void *pData, SConnection *pCon) {
|
||||
value= none;
|
||||
snprintf(buf, sizeof(buf), "<%s", remob->name);
|
||||
/* get value needs only spy priviledge */
|
||||
iRet = RemTransact(remserver, &remserver->rc[0], pCon, remob->name, buf, &value, ">", NULL);
|
||||
iRet = RemTransact(remserver, 0, pCon, remob->name, buf, &value, ">", NULL);
|
||||
if (iRet <= 0) {
|
||||
return 0.0;
|
||||
}
|
||||
@ -456,25 +464,27 @@ static long RemobRun(void *self, SConnection *pCon, float fNew) {
|
||||
float fDelta;
|
||||
int rights;
|
||||
RemChannel *rc;
|
||||
|
||||
int nChan;
|
||||
|
||||
remserver = remob->server;
|
||||
SCSave(&remserver->conn, pCon);
|
||||
assert(remob);
|
||||
assert(pCon);
|
||||
|
||||
rights = SCGetRights(pCon);
|
||||
rc = &remserver->rc[rights <= usUser];
|
||||
RemConnect(remserver, &remserver->rc[0]); /* connect spy for listexe interest */
|
||||
nChan = rights <= usUser;
|
||||
rc = &remserver->rc[nChan];
|
||||
RemConnect(remserver, 0); /* connect spy for listexe interest */
|
||||
|
||||
remob->status = HWIdle;
|
||||
snprintf(buf, sizeof(buf), "run %s %f", remob->name, fNew);
|
||||
iRet = RemTransact(remserver, rc, pCon, buf, "!ERROR: somebody else", "!ERROR: cannot", ">", NULL);
|
||||
iRet = RemTransact(remserver, nChan, pCon, buf, "!ERROR: somebody else", "!ERROR: cannot", ">", NULL);
|
||||
if (iRet <= 0) return 0;
|
||||
|
||||
if (remserver->matchMap & 1) { /* already running, stop first */
|
||||
remob->status = HWBusy;
|
||||
snprintf(sBuf, sizeof(sBuf), "stopexe %s", remob->name);
|
||||
iRet = RemTransact(remserver, rc, pCon, sBuf, ">", NULL);
|
||||
iRet = RemTransact(remserver, nChan, pCon, sBuf, ">", NULL);
|
||||
if (iRet <= 0) return 0;
|
||||
while (remob->status == HWBusy) {
|
||||
iRet = RemRead(rc, 1000);
|
||||
@ -483,7 +493,7 @@ static long RemobRun(void *self, SConnection *pCon, float fNew) {
|
||||
RemCopy(rc, pCon);
|
||||
}
|
||||
}
|
||||
iRet = RemTransact(remserver, rc, pCon, buf, ">", NULL);
|
||||
iRet = RemTransact(remserver, nChan, pCon, buf, ">", NULL);
|
||||
if (iRet <= 0) return 0;
|
||||
}
|
||||
/* wait for "started" message */
|
||||
@ -542,6 +552,7 @@ int RemobAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
char acce[128], inte[128];
|
||||
*/
|
||||
int rights;
|
||||
int nChan;
|
||||
RemChannel *rc;
|
||||
|
||||
assert(pCon);
|
||||
@ -549,12 +560,13 @@ int RemobAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
assert(remob);
|
||||
|
||||
rights = SCGetRights(pCon);
|
||||
rc = &remserver->rc[rights <= usUser];
|
||||
nChan = (rights <= usUser);
|
||||
rc = &remserver->rc[nChan];
|
||||
if (rights >= usUser) {
|
||||
SCSave(&remserver->conn, pCon);
|
||||
}
|
||||
if (argc == 1) {
|
||||
iRet = RemTransact(remserver, rc, pCon, argv[0], ">", NULL);
|
||||
iRet = RemTransact(remserver, nChan, pCon, argv[0], ">", NULL);
|
||||
} else if (strcasecmp(argv[1],"list") == 0) {
|
||||
/*
|
||||
snprintf(acce, sizeof(acce), "!%s.accesscode", remob->name);
|
||||
@ -563,7 +575,7 @@ int RemobAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
|
||||
cmd = Arg2Tcl0(argc-1, argv+1, buf, sizeof buf, remob->name);
|
||||
if (cmd) {
|
||||
RemTransact(remserver, rc, pCon, cmd, ">", NULL);
|
||||
RemTransact(remserver, nChan, pCon, cmd, ">", NULL);
|
||||
if (cmd != buf) free(cmd);
|
||||
}
|
||||
iRet=1;
|
||||
@ -572,7 +584,7 @@ int RemobAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
for (i=1; i<argc; i++) {
|
||||
pos+=snprintf(buf+pos, sizeof(buf)-pos, "%s ", argv[i]);
|
||||
}
|
||||
iRet = RemTransact(remserver, rc, pCon, buf, ">", NULL);
|
||||
iRet = RemTransact(remserver, nChan, pCon, buf, ">", NULL);
|
||||
}
|
||||
return iRet;
|
||||
}
|
||||
@ -629,7 +641,7 @@ int RemServerAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
struct sockaddr_in adr;
|
||||
struct hostent *thishost;
|
||||
Remob *p, *next;
|
||||
int rights;
|
||||
int rights, nChan;
|
||||
RemChannel *rc;
|
||||
|
||||
assert(pCon);
|
||||
@ -637,8 +649,9 @@ int RemServerAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
assert(remserver);
|
||||
|
||||
rights = SCGetRights(pCon);
|
||||
rc = &remserver->rc[rights <= usUser];
|
||||
if (rights >= usUser) {
|
||||
nChan = (rights <= usUser);
|
||||
rc = &remserver->rc[nChan];
|
||||
if (nChan) {
|
||||
SCSave(&remserver->conn, pCon);
|
||||
}
|
||||
if (argc == 1) {
|
||||
@ -658,7 +671,7 @@ int RemServerAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
SCPrintf(pCon, eStatus, "%s = %s:%d %s:%s",
|
||||
argv[0], remserver->host, remserver->port, thishostname, serverport);
|
||||
} else if (argc>2 && strcasecmp(argv[1],"nowait") == 0) {
|
||||
RemConnect(remserver, rc);
|
||||
RemConnect(remserver, nChan);
|
||||
for (i=2; i<argc; i++) {
|
||||
if (i>2) {
|
||||
RemWrite(rc, " ");
|
||||
@ -690,7 +703,7 @@ int RemServerAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
for (i=1; i<argc; i++) {
|
||||
pos+=snprintf(buf+pos, sizeof(buf)-pos, "%s ", argv[i]);
|
||||
}
|
||||
iRet = RemTransact(remserver, rc, pCon, buf, ">", NULL);
|
||||
iRet = RemTransact(remserver, nChan, pCon, buf, ">", NULL);
|
||||
return iRet;
|
||||
}
|
||||
return 1;
|
||||
@ -826,6 +839,7 @@ static RemServer *RemServerInit(char *name, char *host, int port) {
|
||||
}
|
||||
remserver->taskActive = 1;
|
||||
remserver->interestActive = 0;
|
||||
remserver->forwardMessages = 1;
|
||||
TaskRegister(pServ->pTasker, RemServerTask, NULL, RemServerKill, remserver, 1);
|
||||
return remserver;
|
||||
}
|
||||
@ -854,8 +868,11 @@ int RemobCreate(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
|
||||
argtolower(argc,argv);
|
||||
if (argc >= 4 && strcmp(argv[1], "server") == 0) {
|
||||
if (argc == 5) {
|
||||
if (argc >= 5) {
|
||||
remserver = RemServerInit(argv[2], argv[3], atoi(argv[4]));
|
||||
if (remserver && argc > 5 && argv[5][0] == '0') {
|
||||
remserver->forwardMessages = 0;
|
||||
}
|
||||
} else {
|
||||
p = strchr(argv[3], ':');
|
||||
if (!p) {
|
||||
|
28
scan.c
28
scan.c
@ -209,8 +209,6 @@ static void ConfigureScanDict(pStringDict dict)
|
||||
self->ScanDrive = ScanDrive;
|
||||
self->ScanCount = ScanCount;
|
||||
self->CollectScanData = CollectScanData;
|
||||
self->posSoft = 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@ -1068,10 +1066,6 @@ CountEntry CollectCounterData(pScanData self)
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------*/
|
||||
int isScanVarSoft(pScanData self){
|
||||
return self->posSoft;
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
int GetScanVarStep(pScanData self, int iWhich, float *fStep)
|
||||
{
|
||||
pVarEntry pVar = NULL;
|
||||
@ -2101,14 +2095,6 @@ static int DumpScan(pScanData self, SConnection *pCon)
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
else if(strcmp(argv[2],"soft") == 0)
|
||||
{
|
||||
ResetScanFunctions(self);
|
||||
self->CollectScanData = CollectScanDataJochen;
|
||||
self->posSoft = 1;
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
site = getSite();
|
||||
@ -2421,20 +2407,6 @@ static int DumpScan(pScanData self, SConnection *pCon)
|
||||
}
|
||||
return AppendVarPos(pCon,self,i,(float)fStep);
|
||||
}
|
||||
else if(strcmp(argv[1],"softpos") == 0){
|
||||
if(argc > 2) {
|
||||
if(!SCMatchRights(pCon,usMugger)){
|
||||
return 0;
|
||||
}
|
||||
self->posSoft = atoi(argv[2]);
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
} else {
|
||||
sprintf(pBueffel,"%s.softpos = %d", argv[0],self->posSoft);
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/*------- savecounter */
|
||||
else if(strcmp(argv[1],"savecounter") == 0)
|
||||
{
|
||||
|
1
scan.h
1
scan.h
@ -39,7 +39,6 @@
|
||||
char *pName, int iLength);
|
||||
int GetScanVarStep(pScanData self, int iWhich,
|
||||
float *fStep);
|
||||
int isScanVarSoft(pScanData self);
|
||||
int GetScanMonitor(pScanData self, int iWhich,
|
||||
long *lData, int iDataLen);
|
||||
int GetScanNP(pScanData self);
|
||||
|
1
scan.i
1
scan.i
@ -46,7 +46,6 @@
|
||||
int iP);
|
||||
pStringDict scanFunctions;
|
||||
long lPos;
|
||||
int posSoft;
|
||||
void *pCounterData;
|
||||
char pCounterName[512];
|
||||
int iChannel;
|
||||
|
2
scan.tex
2
scan.tex
@ -222,7 +222,6 @@ $\langle$scandata {\footnotesize ?}$\rangle\equiv$
|
||||
\mbox{}\verb@ int iP);@\\
|
||||
\mbox{}\verb@ pStringDict scanFunctions;@\\
|
||||
\mbox{}\verb@ long lPos;@\\
|
||||
\mbox{}\verb@ int posSoft;@\\
|
||||
\mbox{}\verb@ void *pCounterData;@\\
|
||||
\mbox{}\verb@ char pCounterName[512];@\\
|
||||
\mbox{}\verb@ int iChannel;@\\
|
||||
@ -353,7 +352,6 @@ $\langle$scaninter {\footnotesize ?}$\rangle\equiv$
|
||||
\mbox{}\verb@ char *pName, int iLength);@\\
|
||||
\mbox{}\verb@ int GetScanVarStep(pScanData self, int iWhich, @\\
|
||||
\mbox{}\verb@ float *fStep);@\\
|
||||
\mbox{}\verb@ int isScanVarSoft(pScanData self);@\\
|
||||
\mbox{}\verb@ int GetScanMonitor(pScanData self, int iWhich, @\\
|
||||
\mbox{}\verb@ long *lData, int iDataLen);@\\
|
||||
\mbox{}\verb@ int GetScanNP(pScanData self);@\\
|
||||
|
2
scan.w
2
scan.w
@ -192,7 +192,6 @@ Scan variables have an interface:
|
||||
int iP);
|
||||
pStringDict scanFunctions;
|
||||
long lPos;
|
||||
int posSoft;
|
||||
void *pCounterData;
|
||||
char pCounterName[512];
|
||||
int iChannel;
|
||||
@ -312,7 +311,6 @@ functions:
|
||||
char *pName, int iLength);
|
||||
int GetScanVarStep(pScanData self, int iWhich,
|
||||
float *fStep);
|
||||
int isScanVarSoft(pScanData self);
|
||||
int GetScanMonitor(pScanData self, int iWhich,
|
||||
long *lData, int iDataLen);
|
||||
int GetScanNP(pScanData self);
|
||||
|
3
sics.h
3
sics.h
@ -16,8 +16,9 @@
|
||||
}CounterMode;
|
||||
|
||||
/* the following line suppresses const declarations in tcl.h.
|
||||
WARNING: including sics.h must always be done before tcl.h
|
||||
-> makes the compiler happy M.Z. */
|
||||
/* #define NO_CONST */
|
||||
#define NO_CONST
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
35
sicscron.c
35
sicscron.c
@ -2,7 +2,7 @@
|
||||
S I C S C R O N
|
||||
|
||||
A cron like command facility for SICS which allows to repeat a command
|
||||
at given time intervalls.
|
||||
at given time intervals.
|
||||
|
||||
copyright: see copyright.h
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
|
||||
|
||||
typedef struct {
|
||||
int iIntervall;
|
||||
int iInterval;
|
||||
time_t tNext;
|
||||
char *pCommand;
|
||||
SConnection *pCon;
|
||||
@ -57,13 +57,15 @@
|
||||
pCron self = (pCron)pData;
|
||||
int iRet;
|
||||
Tcl_Interp *pTcl = pServ->pSics->pTcl;
|
||||
|
||||
time_t now;
|
||||
|
||||
if(!self)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(time(NULL) > self->tNext)
|
||||
now = time(NULL);
|
||||
if(now >= self->tNext)
|
||||
{
|
||||
MacroPush(self->pCon);
|
||||
old=StatisticsBegin(self->stat);
|
||||
@ -76,9 +78,14 @@
|
||||
self->iEnd = 0;
|
||||
return 0;
|
||||
}
|
||||
self->tNext = time(NULL) + self->iIntervall;
|
||||
if (self->iEnd == 2) { /* dolater command */
|
||||
self->iEnd = 0;
|
||||
return 0;
|
||||
}
|
||||
self->tNext += self->iInterval;
|
||||
if (now > self->tNext) self->tNext = now + 1;
|
||||
}
|
||||
return self->iEnd;
|
||||
return self->iEnd > 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------*/
|
||||
static void CronSignal(void *pData, int iID, void *pSigData)
|
||||
@ -112,15 +119,15 @@
|
||||
/* enough arguments? */
|
||||
if(argc < 3)
|
||||
{
|
||||
SCWrite(pCon,"ERROR: not enough arguments to sicscron",eError);
|
||||
SCPrintf(pCon,eError,"ERROR: not enough arguments to %s", argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* interpret first argument as intervall in seconds */
|
||||
/* interpret first argument as interval in seconds */
|
||||
iRet = Tcl_GetInt(pSics->pTcl,argv[1],&iVal);
|
||||
if(iRet != TCL_OK)
|
||||
{
|
||||
SCWrite(pCon,"ERROR: failed to convert intervall argument to int",
|
||||
SCWrite(pCon,"ERROR: failed to convert interval argument to int",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
@ -146,10 +153,14 @@
|
||||
/* transfer the rights to the dummy connection */
|
||||
SCSetRights(pNew->pCon, rights);
|
||||
}
|
||||
pNew->iIntervall = iVal;
|
||||
pNew->iInterval = iVal;
|
||||
pNew->pCommand = cmd;
|
||||
pNew->tNext = 0;
|
||||
pNew->iEnd = 1;
|
||||
pNew->tNext = time(NULL) + iVal;
|
||||
if (strcasecmp(argv[0], "dolater") == 0) {
|
||||
pNew->iEnd = 2;
|
||||
} else {
|
||||
pNew->iEnd = 1;
|
||||
}
|
||||
pNew->stat = StatisticsNew(cmd);
|
||||
|
||||
TaskRegister(pServ->pTasker,
|
||||
|
98
sicsdata.c
98
sicsdata.c
@ -185,7 +185,7 @@ void clearSICSData(pSICSData self){
|
||||
memset(self->dataType,0,self->currentDataSize*sizeof(char));
|
||||
}
|
||||
/*--------------------------------------------------------------------*/
|
||||
static int dumpSICSData(pSICSData self, char *filename, SConnection *pCon){
|
||||
static int dumpSICSDataXY(pSICSData self, char *filename, SConnection *pCon){
|
||||
FILE *fd = NULL;
|
||||
char pBueffel[132];
|
||||
int i;
|
||||
@ -210,6 +210,32 @@ static int dumpSICSData(pSICSData self, char *filename, SConnection *pCon){
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
/*--------------------------------------------------------------------*/
|
||||
static int dumpSICSData(pSICSData self, char *filename, SConnection *pCon){
|
||||
FILE *fd = NULL;
|
||||
char pBueffel[132];
|
||||
int i;
|
||||
float fVal;
|
||||
|
||||
fd = fopen(filename,"w");
|
||||
if(fd == NULL){
|
||||
snprintf(pBueffel,131,"ERROR: cannot open %s", filename);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
return 0;
|
||||
}
|
||||
for(i = 0; i < self->dataUsed; i++){
|
||||
if(self->dataType[i] == INTTYPE){
|
||||
fprintf(fd," %d", self->data[i]);
|
||||
}
|
||||
if(self->dataType[i] == FLOATTYPE){
|
||||
memcpy(&fVal,self->data + i,sizeof(float));
|
||||
fprintf(fd," %.5f",fVal);
|
||||
}
|
||||
}
|
||||
fclose(fd);
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
/*-------------------------------------------------------------------*/
|
||||
static int putInt(pSICSData self, int argc, char *argv[],
|
||||
SConnection *pCon, SicsInterp *pSics){
|
||||
@ -249,6 +275,7 @@ static int putFloat(pSICSData self, int argc, char *argv[],
|
||||
int status, pos, *iData = NULL;
|
||||
float fVal;
|
||||
double dVal;
|
||||
char buffer[256];
|
||||
|
||||
assert(self);
|
||||
|
||||
@ -264,8 +291,9 @@ static int putFloat(pSICSData self, int argc, char *argv[],
|
||||
}
|
||||
status = Tcl_GetDouble(InterpGetTcl(pSics),argv[1],&dVal);
|
||||
if(status != TCL_OK){
|
||||
SCWrite(pCon,"ERROR: failed to convert putint value to float",
|
||||
eError);
|
||||
snprintf(buffer,255,"ERROR: faiuld to convert putfloat value %s to float",
|
||||
argv[1]);
|
||||
SCWrite(pCon,buffer,eError);
|
||||
return 0;
|
||||
}
|
||||
iData = getSICSDataPointer(self,pos,pos+1);
|
||||
@ -586,6 +614,58 @@ static int copyHM(pSICSData self, int argc, char *argv[],
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
/*--------------------------------------------------------------------*/
|
||||
static int copyHMBank(pSICSData self, int argc, char *argv[],
|
||||
SConnection *pCon, SicsInterp *pSics){
|
||||
int status, pos, i, bank, dataLength;
|
||||
pHistMem pHist = NULL;
|
||||
const float *fTimeBin = NULL;
|
||||
int *iData = NULL;
|
||||
|
||||
if(argc < 4){
|
||||
SCWrite(pCon,"ERROR: not enough arguments to SICSData copyhm",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
status = Tcl_GetInt(InterpGetTcl(pSics),argv[0],&pos);
|
||||
if(status != TCL_OK){
|
||||
SCWrite(pCon,
|
||||
"ERROR: failed to convert copyhmbank position to integer",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
pHist = (pHistMem)FindCommandData(pSics,argv[1],"HistMem");
|
||||
if(!pHist){
|
||||
SCWrite(pCon,"ERROR: histogram memory not found in copyhmbank",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
status = Tcl_GetInt(InterpGetTcl(pSics),argv[2],&bank);
|
||||
if(status != TCL_OK){
|
||||
SCWrite(pCon,
|
||||
"ERROR: failed to convert copyhmbank bank to integer",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
status = Tcl_GetInt(InterpGetTcl(pSics),argv[3],&dataLength);
|
||||
if(status != TCL_OK){
|
||||
SCWrite(pCon,
|
||||
"ERROR: failed to convert copyhmbank dataLength to integer",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
iData = getSICSDataPointer(self,pos,pos+dataLength);
|
||||
if(!iData){
|
||||
SCWrite(pCon,"ERROR: out of memory in SICSData copyhmbank",eError);
|
||||
return 0;
|
||||
}
|
||||
GetHistogramDirect(pHist,pCon,bank,0,dataLength,iData,
|
||||
dataLength*sizeof(int));
|
||||
assignType(self,pos,pos+dataLength,INTTYPE);
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static int copyData(pSICSData self,SicsInterp *pSics,
|
||||
SConnection *pCon,int argc, char *argv[]){
|
||||
@ -643,6 +723,13 @@ int SICSDataAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
snprintf(pBueffel,131,"%s = %d", argv[0], self->dataUsed);
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
return 1;
|
||||
} else if(strcmp(argv[1],"dumpxy") == 0){
|
||||
/* --------- dump */
|
||||
if(argc < 3){
|
||||
SCWrite(pCon,"ERROR: need a file name to dump to",eError);
|
||||
return 0;
|
||||
}
|
||||
return dumpSICSDataXY(self,argv[2],pCon);
|
||||
} else if(strcmp(argv[1],"dump") == 0){
|
||||
/* --------- dump */
|
||||
if(argc < 3){
|
||||
@ -684,8 +771,11 @@ int SICSDataAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
/*--------- copytimebin */
|
||||
return copyTimeBin(self,argc-2,&argv[2],pCon,pSics);
|
||||
} else if(strcmp(argv[1],"copyhm") == 0){
|
||||
/*--------- copytimebin */
|
||||
/*--------- copyhm */
|
||||
return copyHM(self,argc-2,&argv[2],pCon,pSics);
|
||||
} else if(strcmp(argv[1],"copyhmbank") == 0){
|
||||
/*--------- copyhmbank */
|
||||
return copyHMBank(self,argc-2,&argv[2],pCon,pSics);
|
||||
} else if(strcmp(argv[1],"writezipped") == 0){
|
||||
/*--------- writezipped */
|
||||
if(argc < 3){
|
||||
|
22
sicsstat.tcl
22
sicsstat.tcl
@ -1,19 +1,7 @@
|
||||
exe batchpath ./
|
||||
exe syspath ./
|
||||
# Motor brumm
|
||||
brumm sign 1.0000
|
||||
brumm hardlowerlim -180.0000
|
||||
brumm hardupperlim 180.0000
|
||||
brumm softlowerlim -180.0000
|
||||
brumm softupperlim 180.0000
|
||||
brumm softzero 0.0000
|
||||
brumm fixed -1.0000
|
||||
brumm interruptmode 0.0000
|
||||
brumm precision 0.2000
|
||||
brumm accesscode 2.0000
|
||||
brumm failafter 3.0000
|
||||
brumm maxretry 3.0000
|
||||
brumm ignorefault 0.0000
|
||||
brumm movecount 10.0000
|
||||
brumm errortype 0.0000
|
||||
brumm recover 1.0000
|
||||
# Counter counter
|
||||
counter SetPreset 3.000000
|
||||
counter SetMode Timer
|
||||
hm CountMode timer
|
||||
hm preset 3.000000
|
||||
|
@ -37,7 +37,7 @@ typedef struct __STATEMON {
|
||||
eventCode = STEND;
|
||||
} else {
|
||||
printf("Unrecognized event text from devexec in statemon.c: %s\n",
|
||||
text);
|
||||
(char *)text);
|
||||
return 0;
|
||||
}
|
||||
if(self != NULL){
|
||||
|
@ -47,14 +47,15 @@ int StatisticsCommand(SConnection *con, SicsInterp *pSics, void *pData,
|
||||
int argc, char *argv[]) {
|
||||
Statistics *p;
|
||||
tv_t now;
|
||||
double dif, percent, full, dt;
|
||||
double dif, percent, full, dt, calls;
|
||||
|
||||
gettimeofday(&now, 0);
|
||||
dif = timeFloat(timeDif(lastStat, now));
|
||||
SCPrintf(con, eStatus, " calls time[%] full[%] mean[ms] command");
|
||||
SCPrintf(con, eStatus, "calls/s time[%] full[%] mean[ms] command");
|
||||
SCPrintf(con, eStatus, "----------------------------------------------");
|
||||
for (p = list; p != NULL; p = p->next) {
|
||||
if (dif > 0) {
|
||||
calls = p->cnt / dif;
|
||||
percent = timeFloat(p->tim) * 100 / dif;
|
||||
full = timeFloat(p->total) * 100 / dif;
|
||||
if (full > 0 || percent > 0) {
|
||||
@ -63,7 +64,7 @@ int StatisticsCommand(SConnection *con, SicsInterp *pSics, void *pData,
|
||||
} else {
|
||||
dt = 0;
|
||||
}
|
||||
SCPrintf(con, eStatus, "%7ld %7.1f %7.1f %8.2f %s", p->cnt,
|
||||
SCPrintf(con, eStatus, "%7.1f %7.1f %7.1f %8.2f %s", calls,
|
||||
percent, full, dt, p->name);
|
||||
}
|
||||
}
|
||||
@ -73,6 +74,8 @@ int StatisticsCommand(SConnection *con, SicsInterp *pSics, void *pData,
|
||||
p->total.tv_sec = 0;
|
||||
p->total.tv_usec = 0;
|
||||
}
|
||||
SCPrintf(con, eStatus, "----------------------------------------------");
|
||||
SCPrintf(con, eStatus, "total time %.2f", dif);
|
||||
lastStat = now;
|
||||
return 1;
|
||||
}
|
||||
|
32
stdscan.c
32
stdscan.c
@ -787,16 +787,8 @@ int prepareDataFile(pScanData self){
|
||||
pVar = (pVarEntry)pDings;
|
||||
if(pVar)
|
||||
{
|
||||
if(jochenFlag == 1 &&
|
||||
strcmp(pVar->pObject->pDescriptor->name, "Motor") == 0)
|
||||
{
|
||||
MotorGetSoftPosition((pMotor)pVar->pObject,self->pCon,&fVal);
|
||||
}
|
||||
else
|
||||
{
|
||||
fVal = pVar->pInter->GetValue(pVar->pObject,self->pCon);
|
||||
}
|
||||
AppendScanVar(pVar,fVal);
|
||||
fVal = pVar->pInter->GetValue(pVar->pObject,self->pCon);
|
||||
AppendScanVar(pVar,fVal);
|
||||
sprintf(pItem,"%-9.9s ",ScanVarName(pVar));
|
||||
strcat(pHead,pItem);
|
||||
sprintf(pItem,"%-9.3f ",fVal);
|
||||
@ -841,11 +833,6 @@ int prepareDataFile(pScanData self){
|
||||
{
|
||||
return CollectScanDataIntern(self,iPoint,0);
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int CollectScanDataJochen(pScanData self, int iPoint)
|
||||
{
|
||||
return CollectScanDataIntern(self,iPoint,1);
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
int CollectSilent(pScanData self, int iPoint)
|
||||
{
|
||||
@ -867,15 +854,7 @@ int prepareDataFile(pScanData self){
|
||||
pVar = (pVarEntry)pDings;
|
||||
if(pVar)
|
||||
{
|
||||
if(jochenFlag == 1 &&
|
||||
strcmp(pVar->pObject->pDescriptor->name, "Motor") == 0)
|
||||
{
|
||||
MotorGetSoftPosition((pMotor)pVar->pObject,self->pCon,&fVal);
|
||||
}
|
||||
else
|
||||
{
|
||||
fVal = pVar->pInter->GetValue(pVar->pObject,self->pCon);
|
||||
}
|
||||
fVal = pVar->pInter->GetValue(pVar->pObject,self->pCon);
|
||||
AppendScanVar(pVar,fVal);
|
||||
}
|
||||
}
|
||||
@ -1140,7 +1119,10 @@ int StandardScanWrapper(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
}
|
||||
strtolower(argv[1]);
|
||||
self = (pScanData)FindCommandData(pSics,argv[2],"ScanObject");
|
||||
assert(self);
|
||||
if(self == NULL){
|
||||
SCWrite(pCon,"ERROR: scan object not found",eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(strcmp(argv[1],"writeheader") == 0){
|
||||
return WriteHeader(self);
|
||||
|
11
tasscanub.c
11
tasscanub.c
@ -142,16 +142,7 @@ static float readDrivable(char *val, SConnection *pCon){
|
||||
float fVal;
|
||||
|
||||
/*
|
||||
if motor: read motor
|
||||
*/
|
||||
pMot = FindMotor(pServ->pSics,val);
|
||||
if(pMot != NULL){
|
||||
MotorGetSoftPosition(pMot,pCon,&fVal);
|
||||
return fVal;
|
||||
}
|
||||
|
||||
/*
|
||||
else: read general drivable
|
||||
read general drivable
|
||||
*/
|
||||
pCom = FindCommand(pServ->pSics,val);
|
||||
if(pCom != NULL){
|
||||
|
@ -1,3 +1,3 @@
|
||||
75
|
||||
83
|
||||
NEVER, EVER modify or delete this file
|
||||
You'll risk eternal damnation and a reincarnation as a cockroach!|n
|
@ -89,6 +89,17 @@ test nxscript-1.13 {Writing sicsdata } -body {
|
||||
testNoError "nxscript putsicsdata testsd data"
|
||||
} -result OK
|
||||
|
||||
test nxscript-1.14 {Writing slabs } -body {
|
||||
data clear
|
||||
data putfloat 0 1.1
|
||||
testNoError "nxscript putslab testslab [list 0] [list 1] data"
|
||||
data putfloat 0 2.2
|
||||
testNoError "nxscript putslab testslab [list 1] [list 1] data"
|
||||
data putfloat 0 3.3
|
||||
testNoError "nxscript putslab testslab [list 2] [list 1] data"
|
||||
} -result OK
|
||||
|
||||
|
||||
test nxscript-1.20 {Close file} -body {
|
||||
testOK "nxscript close"
|
||||
} -result OK
|
||||
|
@ -24,6 +24,7 @@ testar=/entry1,NXentry/detector,NXdata/SDS x_axis
|
||||
testintar=/entry1,NXentry/detector,NXdata/SDS y_axis -type NX_INT32
|
||||
testsd=/entry1,NXentry/detector,NXdata/SDS gurke -rank 1 \
|
||||
-type NX_INT32 -dim {$(dim0)}
|
||||
testslab=/entry,NXentry/SDS slappy -rank 1 -dim {-1}
|
||||
testlink=/entry1,NXentry/detector,NXdata/NXVGROUP
|
||||
|
||||
|
||||
|
@ -193,4 +193,6 @@ hattach /instrument/sample a3 omega
|
||||
hattach /instrument/sample qh qh
|
||||
hmake /instrument/detector spy none
|
||||
hattach /instrument/detector hm data
|
||||
hattach /instrument lotte title
|
||||
hattach /instrument lotte title
|
||||
|
||||
restore
|
||||
|
@ -18,41 +18,41 @@ source testutil.tcl
|
||||
source sicstcldebug.tcl
|
||||
|
||||
#--------------- Test Miscellaneous stuff
|
||||
source testmisc.tcl
|
||||
#source testmisc.tcl
|
||||
|
||||
#-------------- Test for motors
|
||||
source mottest.tcl
|
||||
#source mottest.tcl
|
||||
|
||||
#-------------- Test Counter
|
||||
set countername aba
|
||||
set errorname aba
|
||||
source countertest.tcl
|
||||
#source countertest.tcl
|
||||
|
||||
#-------------- Test Multi Counter
|
||||
set countername multi
|
||||
source countertest.tcl
|
||||
#source countertest.tcl
|
||||
|
||||
#-------------- Test batch processing
|
||||
source batchtest.tcl
|
||||
#source batchtest.tcl
|
||||
|
||||
#-------------- Test scans
|
||||
source scantest.tcl
|
||||
#source scantest.tcl
|
||||
|
||||
#------------ Test peak optimization
|
||||
source optitest.tcl
|
||||
#source optitest.tcl
|
||||
|
||||
#----------- test histogram memory
|
||||
source histtest.tcl
|
||||
#source histtest.tcl
|
||||
|
||||
#----------- test sics data
|
||||
source testsicsdata.tcl
|
||||
#source testsicsdata.tcl
|
||||
|
||||
|
||||
#----------- test nxscript
|
||||
source nxscripttest.tcl
|
||||
|
||||
#------------ test SANS MultiMotor
|
||||
source testmumo.tcl
|
||||
#source testmumo.tcl
|
||||
|
||||
#------------ print test summary
|
||||
cleanupTests
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<NXroot NeXus_version="3.0.0" XML_version="mxml" file_name="test.xml"
|
||||
file_time="2006-11-08 14:30:21+0100" Instrument="Washmaschine" signal="1">
|
||||
file_time="2007-02-21 10:51:15+0100" Instrument="Washmaschine">
|
||||
<NXentry name="entry1">
|
||||
<testtext target="/entry1/testtext">Hugo ist eine Nassnase</testtext>
|
||||
<testfloat NAPItype="NX_FLOAT32">
|
||||
@ -40,7 +40,7 @@ file_time="2006-11-08 14:30:21+0100" Instrument="Washmaschine" signal="1">
|
||||
</counts4>
|
||||
</NXmonitor>
|
||||
<NXdata name="detector">
|
||||
<hmdata NAPItype="NX_INT32[23]">
|
||||
<hmdata NAPItype="NX_INT32[23]" signal="1">
|
||||
55 55 55 55
|
||||
55 55 55 55
|
||||
55 55 55 55
|
||||
@ -76,4 +76,9 @@ file_time="2006-11-08 14:30:21+0100" Instrument="Washmaschine" signal="1">
|
||||
</gurke>
|
||||
</NXdata>
|
||||
</NXentry>
|
||||
<NXentry name="entry">
|
||||
<slappy NAPItype="NX_FLOAT32[3]">
|
||||
1.1000 2.2000 3.3000
|
||||
</slappy>
|
||||
</NXentry>
|
||||
</NXroot>
|
||||
|
Reference in New Issue
Block a user