- Fixed state monitor eclipse commit problems. Siiiiiiiggggghhhhhh!

This commit is contained in:
koennecke
2007-01-30 03:19:43 +00:00
parent d61fbe0869
commit e4929d512c
11 changed files with 8655 additions and 26 deletions

View File

@ -41,7 +41,7 @@
Mark Koennecke, August 2001, modified SicsWriteStatus to write motor
positions on demand.
Made ListObjects moe intelligent: list objects according to interface etc.
Made ListObjects more intelligent: list objects according to interface etc.
Mark Koennecke, December 2003
Extended 'dir' command (function ListObjects) to list via typename from
@ -50,6 +50,8 @@
Modified printXXX functions to fix duplicate write of last buffer line.
Paul Hathaway, May 2004
Added FindAlias function, Mark Koennecke, January 2007
---------------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
@ -67,6 +69,7 @@
#include "motor.h"
#include "obdes.h"
#include "lld.h"
#include "dynstring.h"
/* M.Z. */
#include "definealias.h"
@ -1042,3 +1045,64 @@ static void freeList(int listID)
pCurrent = pNext;
}
}
/*---------------------------------------------------------------------*/
char *FindAliases(SicsInterp *pSics, char *name)
{
pDynString result = NULL;
CommandList *pOri = NULL, *pCom = NULL;
char *pTrans = NULL, *charResult = NULL;
int first;
pOri = FindCommand(pSics, name);
if(pOri == NULL)
{
return NULL;
}
if(pOri->pData == NULL)
{
return NULL;
}
result = CreateDynString(64,64);
if(result == NULL)
{
return NULL;
}
/* try first to locate Markus style aliases */
pTrans = TranslateAlias(&pSics->AList,name);
if(strcmp(pTrans,name) != 0)
{
DynStringCopy(result,pTrans);
charResult = strdup(GetCharArray(result));
DeleteDynString(result);
return charResult;
}
/*
* locate SicsAlias style aliases by comparing the original
* data pointer with the data pointers of other commands
*/
first = 1;
pCom = pSics->pCList;
while(pCom != NULL)
{
if(pCom != pOri && pCom->pData == pOri->pData)
{
if(first)
{
DynStringCopy(result,pCom->pName);
first = 0;
}
else
{
DynStringConcat(result,",");
DynStringConcat(result,pCom->pName);
}
}
pCom = pCom->pNext;
}
charResult = strdup(GetCharArray(result));
DeleteDynString(result);
return charResult;
}

View File

@ -173,6 +173,20 @@ typedef struct {
} ExeList;
static pExeList pExecutor = NULL;
/*--------------------------------------------------------------------------*/
static void *DevexecInterface(void *pData, int iInter)
{
pExeList self = NULL;
self = (pExeList)pData;
assert(self);
if(iInter == CALLBACKINTERFACE)
{
return self->pCall;
}
return NULL;
}
/*--------------------------------------------------------------------------*/
pExeList CreateExeList(pTaskMan pTask)
{
@ -208,6 +222,7 @@ typedef struct {
pRes->paused = 0;
pRes->pCall = CreateCallBackInterface();
pRes->lastRun = time(NULL);
pRes->pDes->GetInterface = DevexecInterface;
return pRes;
}
/*-------------------------------------------------------------------------*/
@ -1150,7 +1165,7 @@ static int testFinish(pExeList self){
SCPopContext(pCon);
return 1;
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
int ListExe(SConnection *pCon, SicsInterp *pSics, void *pData,
int argc, char *argv[])
{

View File

@ -67,6 +67,8 @@
"STATUS",
"POSITION",
"HDBVAL",
"STATESTART",
"STATEEND",
NULL
};

16
event.h
View File

@ -1,5 +1,5 @@
#line 96 "event.w"
#line 103 "event.w"
/*----------------------------------------------------------------------------
E V E N T
@ -14,15 +14,15 @@
#ifndef SICSEVENT
#define SICSEVENT
#line 13 "event.w"
#line 14 "event.w"
int Text2Event(char *pText);
#line 109 "event.w"
#line 116 "event.w"
#line 20 "event.w"
#line 21 "event.w"
#define VALUECHANGE 0
#define MOTDRIVE 1
@ -45,13 +45,15 @@
#define STATUS 18
#define POSITION 19
#define HDBVAL 20
#define STSTART 21
#define STEND 22
#line 111 "event.w"
#line 118 "event.w"
/*--------------- Signals for the Signalfunction of each task ------------*/
#line 80 "event.w"
#line 87 "event.w"
#define SICSINT 300
#define SICSBROADCAST 301
@ -59,6 +61,6 @@
#define TOKENRELEASE 303
#define COMLOG 304
#line 114 "event.w"
#line 121 "event.w"
#endif

View File

@ -870,7 +870,7 @@ int copyHdbValue(hdbValue *source, hdbValue *target){
break;
case HIPINTAR:
case HIPINTVARAR:
if(target->arrayLength != source->arrayLength){
if(target->arrayLength != source->arrayLength || target->v.intArray == NULL){
if(target->v.intArray != NULL){
free(target->v.intArray);
}
@ -881,13 +881,15 @@ int copyHdbValue(hdbValue *source, hdbValue *target){
memset(target->v.intArray,0,source->arrayLength * sizeof(int));
target->arrayLength = source->arrayLength;
}
if(source->v.intArray != NULL){
for(i = 0; i < source->arrayLength; i++){
target->v.intArray[i] = source->v.intArray[i];
}
}
break;
case HIPFLOATAR:
case HIPFLOATVARAR:
if(target->arrayLength != source->arrayLength){
if(target->arrayLength != source->arrayLength || target->v.floatArray == NULL){
if(target->v.floatArray != NULL){
free(target->v.floatArray);
}
@ -898,9 +900,11 @@ int copyHdbValue(hdbValue *source, hdbValue *target){
memset(target->v.floatArray,0,source->arrayLength * sizeof(double));
target->arrayLength = source->arrayLength;
}
if(source->v.floatArray != NULL){
for(i = 0; i < source->arrayLength; i++){
target->v.floatArray[i] = source->v.floatArray[i];
}
}
break;
case HIPOBJ:
target->v.obj = source->v.obj;

View File

@ -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
sicshdbadapter.o polldriv.o sicspoll.o statemon.o
MOTOROBJ = motor.o simdriv.o
COUNTEROBJ = countdriv.o simcter.o counter.o

8436
mcstas/dmc/dmcafter.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -6,13 +6,13 @@
#---------------------------------------------------------------------------
# O P T I O N S
# wwwMode = 1 when running for the WWW-VDMC application
set wwwMode 1
set wwwMode 0
if {$wwwMode == 1} {
set home /home/lnswww/vinstrument/mcstas/dmc
set datahome /home/lnswww/www/vinstrument
} else {
set home $env(HOME)/src/workspace/sics/mcstas/dmc
set home $env(HOME)/psi/workspace/sics/mcstas/dmc
}
#--------------------------------- first all the server options are set
#ServerOption RedirectFile $home/stdcdmc
@ -147,7 +147,6 @@ commandlog auto
commandlog intervall 5
#----------- enable sycamore
#InstallProtocolHandler
#InstallSinfox
#source sycFormat.tcl
#source /usr/lib/tcllib1.6.1/stooop/stooop.tcl
@ -155,3 +154,95 @@ commandlog intervall 5
#source sinfo.tcl
#source sycamore.tcl
#Publish sinfo Spy
#==================== install Hipadaba
proc hdbReadOnly {} {
error "Parameter is READ ONLY"
}
#------------------------------------
proc maketwotheta {} {
set txt [TwoThetaD]
set l [split $txt =]
set start [string trim [lindex $l 1]]
for {set i 0} {$i < 400} {incr i } {
append result [expr $start + $i * .2] " "
}
return $result
}
#-------------------------------------
InstallProtocolHandler
InstallHdb
MakeStateMon
hmake /dmc spy none
hsetprop /dmc type instrument
#-------- experiment
hmake /dmc/experiment spy none
hattach /dmc/experiment title title
hattach /dmc/experiment user user
hattach /dmc/experiment starttime starttime
hattach /dmc/experiment user user
hattach /dmc/experiment/user adress address
hattach /dmc/experiment/user phone phone
hattach /dmc/experiment/user email email
hattach /dmc/experiment comment1 comment1
hattach /dmc/experiment comment2 comment2
hattach /dmc/experiment comment3 comment3
#------- SINQ
hmake /dmc/sinq spy none
hmakescript /dmc/sinq/proton_monitor "counter getmonitor 4" hdbReadOnly int
sicspoll /dmc/sinq/proton_monitor hdb 10
#-------- monochromator
hmake /dmc/monochromator spy none
hattach /dmc/monochromator lambda wavelength
hattach /dmc/monochromator OmegaM theta
hattach /dmc/monochromator TwoThetaM two_theta
hattach /dmc/monochromator MonoX x_translation
hattach /dmc/monochromator MonoY y_translation
hattach /dmc/monochromator MonoChi chi
hattach /dmc/monochromator MonoPhi phi
hattach /dmc/monochromator CurveM vertical_focusing
hmakescript /dmc/monochromator/d_value "mono dd" "mono dd" float
hsetprop /dmc/monochromator/d_value priv manager
hmakescript /dmc/monochromator/scattering_sense "mono ss" "mono ss" int
hsetprop /dmc/monochromator/scattering_sense priv manager
#----------- sample
hmake /dmc/sample spy none
hmakescript /dmc/sample/name sample sample Text
hattach /dmc/sample Table rotation
hmakescript /dmc/sample/monitor "counter getmonitor 1" hdbReadOnly int
hsetprop /dmc/sample/monitor priv internal
#---------- detector
hmake /dmc/detector spy none
hattach /dmc/detector TwoThetaD two_theta
hmakescript /dmc/detector/preset "counter getpreset" hdbReadOnly float
hsetprop /dmc/detector/preset priv internal
hmakescript /dmc/detector/countmode "counter getmode" hdbReadOnly text
hsetprop /dmc/detector/countmode priv internal
sicspoll add /dmc/detector/preset hdb 30
sicspoll add /dmc/detector/countmode hdb 30
#------------ commands
hmake /commands spy none
hcommand /commands/count count
hsetprop /commands/count type command
hmake /commands/count/mode user text
hmake /commands/count/preset user float
hset /commands/count/preset 5
hset /commands/count/mode timer
#---------------- graphics
hmake /Graphics spy none
hmake /Graphics/powder_diagram spy none
hsetprop /Graphics/powder_diagram type graphdata
hsetprop /Graphics/powder_diagram viewer default
hmake /Graphics/powder_diagram/rank internal int
hset /Graphics/powder_diagram/rank 1
hmake /Graphics/powder_diagram/dim internal intar 1
hset /Graphics/powder_diagram/dim 400
hmakescript /Graphics/powder_diagram/two_theta maketwotheta hdbReadOnly floatar 400
sicspoll add /Graphics/powder_diagram/two_theta hdb 30
hsetprop /Graphics/powder_diagram/two_theta type axis
hsetprop /Graphics/powder_diagram/two_theta dim 0
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

View File

@ -164,6 +164,7 @@ proc rundmcoptsim {mode preset } {
} else {
return $msg
}
wait 5
}
#------------------------------------------------------------------------
proc copydmcdataold { } {

5
ofac.c
View File

@ -121,6 +121,7 @@
#include "sicshipadaba.h"
#include "multicounter.h"
#include "sicspoll.h"
#include "statemon.h"
/*----------------------- Server options creation -------------------------*/
static int IFServerOption(SConnection *pCon, SicsInterp *pSics, void *pData,
int argc, char *argv[])
@ -277,6 +278,7 @@
AddCommand(pInter,"MakeCounter",MakeCounter,NULL,NULL);
AddCommand(pInter,"MakeO2T",CreateO2T,NULL,NULL);
AddCommand(pInter,"SicsAlias",SicsAlias,NULL,NULL);
AddCommand(pInter,"SicsAlias",DefineAlias,NULL,NULL);
AddCommand(pInter,"DefineAlias",DefineAlias,NULL,NULL); /* M.Z. */
AddCommand(pInter,"MakeHM",MakeHistMemory,NULL,NULL);
AddCommand(pInter,"VelocitySelector",VelSelFactory,NULL,NULL);
@ -335,6 +337,8 @@
MakeMultiCounter,NULL,NULL);
AddCommand(pInter,"MakeSicsPoll",
InstallSICSPoll,NULL,NULL);
AddCommand(pInter,"MakeStateMon",
StateMonFactory,NULL,NULL);
/*
install site specific commands
@ -404,6 +408,7 @@
RemoveCommand(pSics,"InstallSinfox");
RemoveCommand(pSics,"MakeCone");
RemoveCommand(pSics,"MakeMultiCounter");
RemoveCommand(pSics,"MakeStateMon");
/*
remove site specific installation commands
*/

View File

@ -244,7 +244,8 @@ static pHdb CreateMotorAdapter(char *name, pMotor pMot){
}
MotorGetPar(pMot,"accesscode",&access);
AddPrivProperty(result,(int)access);
SetHdbProperty(result,"type","Motor");
SetHdbProperty(result,"type","drivable");
SetHdbProperty(result,"sicsdev",pMot->name);
/*
* We want to be notified when this motor drives around. Or
* its parameters change.
@ -274,6 +275,9 @@ static long totalSum(int *data, int length){
long result = 0l;
int i;
if(data == NULL){
return 0;
}
for(i = 0; i < length; i++){
result += data[i];
}
@ -389,7 +393,11 @@ static pHdb MakeSicsVarNode(pSicsVariable pVar, char *name){
if(node == NULL){
return NULL;
}
if(pVar->iLock == 1) {
AddPrivProperty(node,usInternal);
} else {
AddPrivProperty(node,pVar->iAccessCode);
}
pCall = MakeHipadabaCallback(SicsVarSetCallback,pVar,NULL,-1,-1);
if(pCall == NULL){
return NULL;
@ -460,6 +468,7 @@ int SICSHdbAdapter(SConnection *pCon, SicsInterp *pSics, void *pData,
}
SetHdbProperty(node,PRIVNAM,"user");
SetHdbProperty(node,"type","drivable");
SetHdbProperty(node,"sicsdev",argv[2]);
AddHipadabaChild(path,node,pCon);
SCSendOK(pCon);
return 1;