- remove all stuff related to tecs

This commit is contained in:
2014-10-30 11:25:30 +01:00
parent ac04939284
commit c6715af717
301 changed files with 3 additions and 34213 deletions

View File

@ -14,7 +14,7 @@ OBJ=psi.o buffer.o ruli.o sps.o pimotor.o charbychar.o\
amorstat.o tasinit.o ptasdrive.o tasutil.o tasscan.o swmotor.o \ amorstat.o tasinit.o ptasdrive.o tasutil.o tasscan.o swmotor.o \
polterwrite.o ecb.o frame.o \ polterwrite.o ecb.o frame.o \
el737driv.o sinqhmdriv.o tdchm.o \ el737driv.o sinqhmdriv.o tdchm.o \
sanscook.o tecsdriv.o itc4driv.o itc4.o\ sanscook.o itc4driv.o itc4.o\
bruker.o ltc11.o eurodriv.o \ bruker.o ltc11.o eurodriv.o \
el755driv.o serial.o scontroller.o t_update.o \ el755driv.o serial.o scontroller.o t_update.o \
t_rlp.o t_conv.o el737hpdriv.o el734hp.o \ t_rlp.o t_conv.o el737hpdriv.o el734hp.o \

17
psi.c
View File

@ -26,7 +26,6 @@
#include <site.h> #include <site.h>
#include "sinqhmdriv.i" #include "sinqhmdriv.i"
#include "tdchm.h" #include "tdchm.h"
#include "tecsdriv.h"
#include "itc4.h" #include "itc4.h"
#include "bruker.h" #include "bruker.h"
#include "ltc11.h" #include "ltc11.h"
@ -312,9 +311,7 @@ static void ConfigureController(char *name, pEVControl pNew,
{ {
EVCSetPar(pNew, "upperlimit", 300.0, pCon); EVCSetPar(pNew, "upperlimit", 300.0, pCon);
EVCSetPar(pNew, "lowerlimit", 1.0, pCon); EVCSetPar(pNew, "lowerlimit", 1.0, pCon);
if (strcmp(name, "tecs") == 0) { if (strcmp(name, "euro") == 0) {
TecsCustomize(pCon, pNew);
} else if (strcmp(name, "euro") == 0) {
EVCSetPar(pNew, "upperlimit", 750.0, pCon); EVCSetPar(pNew, "upperlimit", 750.0, pCon);
EVCSetPar(pNew, "lowerlimit", 15.0, pCon); EVCSetPar(pNew, "lowerlimit", 15.0, pCon);
} else if (strcmp(name, "el755") == 0) { } else if (strcmp(name, "el755") == 0) {
@ -350,17 +347,7 @@ static pEVControl InstallPsiEnvironmentController(SicsInterp * pSics,
for the device. If 0 the default command will be installed later on for the device. If 0 the default command will be installed later on
*/ */
if (strcmp(argv[3], "tecs") == 0) { if (strcmp(argv[3], "itc4") == 0) {
checkError = 1;
pDriv = CreateTecsDriver(argc - 4, &argv[4]);
if (pDriv != NULL) {
pNew = CreateEVController(pDriv, argv[2], &status);
if (pNew) {
AddCommand(pSics, argv[2], TecsWrapper, DeleteEVController, pNew);
commandInstalled = 1;
}
}
} else if (strcmp(argv[3], "itc4") == 0) {
checkError = 1; checkError = 1;
pDriv = CreateITC4Driver(argc - 4, &argv[4]); pDriv = CreateITC4Driver(argc - 4, &argv[4]);
if (pDriv) { if (pDriv) {

View File

@ -1 +0,0 @@
cd ../../obj/$SICS_VERSION/psi/tecs

View File

@ -1,5 +0,0 @@
sensA.type=m sensA.curve=mz020124
sensB.type=s sensB.curve=r10409
dev="APD closed cycle refrigerator (TriCS)"
tlimit=310 resist=40 maxPower=16
prop=15 int=10 deriv=0

View File

@ -1,2 +0,0 @@
sensC.type=x
dev="APD auxilliary sensor"

View File

@ -1,7 +0,0 @@
sensA.type=k sensA.curve=x31318
sensB.type=s sensB.curve=std4
sensD.type=t sensD.curve=x31319
dev="4 K closed cycle refrigerator (FOCUS)"
tlimit=700 resist=25 maxPower=100
sensA.alarm=310
prop=50 int=20 deriv=0

View File

@ -1,8 +0,0 @@
sensA.type=t sensA.curve=x14231 sensA.alarm=310
sensB.type=m sensB.curve=pt
sensC.type=k sensC.curve=x10409
sensD.type=s sensD.curve=x24506
dev="4 K closed cycle refrigerator (FOCUS) with hi-T stage"
tlimit=700 resist=25 maxPower=100
prop=50 int=20 deriv=0

View File

@ -1,4 +0,0 @@
sensA.type=m sensA.curve=x31319
dev="4 K closed cycle refrigerator"
tlimit=310 resist=25 maxPower=100
prop=50 int=20 deriv=0

View File

@ -1,4 +0,0 @@
sensA.type=m sensA.curve=r10401
dev="CTI closed cycle refrigerator"
tlimit=310 resist=25 maxPower=25
prop=15 int=10 deriv=0

View File

@ -1,4 +0,0 @@
sensA.type=m sensA.curve=r10402
dev="CTI closed cycle refrigerator"
tlimit=310 resist=25 maxPower=25
prop=15 int=10 deriv=0

View File

@ -1,4 +0,0 @@
sensA.type=m sensA.curve=r10403
dev="CTI closed cycle refrigerator"
tlimit=310 resist=25 maxPower=25
prop=15 int=10 deriv=0

View File

@ -1,5 +0,0 @@
sensA.type=t sensA.curve=r10411 sensA.alarm=300
sensB.type=m sensB.curve=rhfe4140
dev="CTI closed cycle refrigerator (30...475 K)"
tlimit=600 resist=25 maxPower=25
prop=15 int=10 deriv=0

View File

@ -1,4 +0,0 @@
sensA.type=m sensA.curve=r10410
dev="CTI closed cycle refrigerator (high power)"
tlimit=310 resist=25 maxPower=25
prop=15 int=10 deriv=0

View File

@ -1,5 +0,0 @@
sensA.type=m sensA.curve=std1
sensB.type=t sensB.curve=r10413
dev="CTI closed cycle refrigerator (FOCUS, 475 K)"
tlimit=474 resist=50 maxPower=25
prop=15 int=10 deriv=0

View File

@ -1,7 +0,0 @@
sensC.type=s sensC.curve=rxdil
sensD.type=h full=0.0 empty=0.5
dev="dilution (Risoe)"
tlimit=375 resist=25 maxpower=25
prop=20 int=10 deriv=0
loop=2

View File

@ -1,6 +0,0 @@
sensA.type=m sensA.curve=psam
sensB.type=n sensB.curve=g24741
dev="Displex closed cycle refrigerator C"
tlimit=310 resist=50 maxpower=50
sensA.lim=30 sensB.lim=60
prop=15 int=10 deriv=0

View File

@ -1,4 +0,0 @@
sensA.type=m sensA.curve=x31317
dev="Displex closed cycle refrigerator E"
tlimit=310 resist=50 maxpower=50
prop=15 int=10 deriv=0

View File

@ -1,10 +0,0 @@
sensA.type=f
sensB.type=t sensB.curve=rhfe4140 sensB.alarm=323
sensC.type=s sensC.curve=std6
sensD.type=m sensD.curve=std6
dev="ILL Furnace (1500 K, typ K)"
tlimit=1500 resist=1000 maxPower=2000 powfact=2000
controlmode=1
prop=3 int=0.3 deriv=0
lscfg="LINEAR A,2,1.6,3,1,-1.4;INTYPE A,0,1,2,10,12;DISPFLD 4,A,4;DISPLAY:4"

View File

@ -1,5 +0,0 @@
sensC.type=m sensC.curve=std6
sensD.type=s sensD.curve=std6
dev="small furnace"
tlimit=800 resist=25 maxPower=100
prop=10 int=5 deriv=0

View File

@ -1,9 +0,0 @@
sensA.type=f
sensB.type=t sensB.curve=rhfe4140 sensB.alarm=373
sensC.type=s sensC.curve=std6
sensD.type=m sensD.curve=std6
dev="tantalum furnace (1400 K)"
tlimit=1405 resist=1000 maxPower=50 powfact=2000
controlmode=1
prop=10 int=5 deriv=0
lscfg="LINEAR A,2,1.6,3,1,-1.4;INTYPE A,0,1,2,10,12;DISPFLD 4,A,4;DISPLAY:4"

View File

@ -1,10 +0,0 @@
sensA.type=f
sensB.type=t sensB.curve=rhfe4140 sensB.alarm=323
sensC.type=s sensC.curve=type_c sensC.scale=2.0 sensC.kink=333.15
sensD.type=m sensD.curve=type_c sensD.scale=2.0 sensD.kink=333.15
dev="ILL Furnace (2000 K, typ C / W5)"
tlimit=1850 resist=1000 maxPower=2000 powfact=2000
controlmode=1
prop=3 int=0.3 deriv=0
lscfg="LINEAR A,2,1.6,3,1,-1.4;INTYPE A,0,1,2,10,12;DISPFLD 4,A,4;DISPLAY:4"

View File

@ -1,6 +0,0 @@
sensA.type=m sensA.curve=r3510
sensB.type=t sensB.curve=r3509
sensC.type=s sensC.curve=x14126
dev="He-flow 4 circle cryostat"
tlimit=310 resist=50 maxPower=25
prop=50 int=20 deriv=0

View File

@ -1,7 +0,0 @@
sensA.type=m sensA.curve=pt_ill sensA.lim=30
sensB.type=n sensB.curve=c_ab sensB.lim=40
sensC.type=l sensC.curve=c_ill sensC.lim=40
sensD.type=s sensD.curve=pt_ill sensD.lim=30
dev="high pressure orange cryostat 63ILLHV70"
tLimit=310 resist=50 maxpower=50 controlMode=0 full=4.64
prop=25 int=10 deriv=0

View File

@ -1,7 +0,0 @@
sensB.type=m sensB.curve=x15601
sensC.type=s sensC.curve=x12532
sensD.type=h
dev="orange cryostat 50 mm"
tLimit=310 resist=50 maxpower=25 controlMode=0
prop=25 int=10 deriv=0
full=4.64

View File

@ -1,6 +0,0 @@
sensA.type=m sensA.curve=ds3b
sensC.type=s sensC.curve=x14130
sensD.type=h
dev="orange cryostat 70 mm"
tLimit=310 resist=50 maxpower=25 controlMode=0 full=4.64
prop=25 int=10 deriv=0

View File

@ -1,2 +0,0 @@
sensC.type=s sensC.curve=x22637
dev="uniaxial pressure insert for ILL2"

View File

@ -1,6 +0,0 @@
sensA.type=m sensA.curve=rhfe8119
sensB.type=h
sensC.type=s sensC.curve=rhfe8244
dev="cryofurnace without power supply"
tLimit=450 resist=10 maxpower=40 controlMode=0 full=4.64
prop=25 int=10 deriv=0

View File

@ -1,7 +0,0 @@
sensA.type=m sensA.curve=rhfe8119
sensB.type=h
sensC.type=s sensC.curve=rhfe8244
dev="cryofurnace with power supply"
tLimit=600 resist=1000 maxpower=180 powFact=45
prop=25 int=10 deriv=0
controlMode=0 full=4.64

View File

@ -1,6 +0,0 @@
sensA.type=m sensA.curve=dt-470
sensB.type=h
sensC.type=s sensC.curve=x13089
dev="FOCUS orange cryostat 70 mm"
tLimit=310 resist=50 maxpower=25 controlMode=0 full=4.64
prop=25 int=10 deriv=0

View File

@ -1,7 +0,0 @@
sensB.type=m sensB.curve=x10045
sensC.type=s sensC.curve=x09882
sensD.type=h
dev="maxi orange crostat 100 mm"
tLimit=310 resist=50 maxpower=25 controlMode=0 full=4.64
prop=25 int=10 deriv=0
sensA.alarm=0

View File

@ -1,3 +0,0 @@
sensC.type=s sensC.curve=x09883
sensD.type=h
dev="precoolable sample stick for maxi orange cryostat"

View File

@ -1,30 +0,0 @@
# Code list for SE devices connected via LSC340
#
ill1 1 -1
ill2 2 -2
ill2p -3
ill3 3 -5
ill4 4 -6
ill5 5 -4
ill5n -7
cti1 6
cti2 7
cti3 8
cti4 9
cti6 11
apd 12
apdl -9
ccr4k 13
dil -18
ccr2 28 -28
hef4c 14 -11
sup4t 15 60
ma09 19 -19
dise 26 -26
ori1 29 -29
ori2 25 -25
ori3 22 -22
ma11_test -27
ma02 23 -23
ma15 24
dil2 -34

View File

@ -1,5 +0,0 @@
sensA.type=m sensA.curve=x29746
sensC.type=s sensC.curve=x29630
dev="1.8 T horizontal cryomagnet (Risoe)"
tlimit=310 resist=50 maxpower=50
prop=15 int=10 deriv=0

View File

@ -1,9 +0,0 @@
sensA.type=m sensA.curve=c17844
sensB.type=t sensB.curve=cplus70
sensC.type=s sensC.curve=x22642
sensD.type=h full=0.0 empty=0.5
dev="9 T vertical cryomagnet (Risoe)"
tlimit=310 resist=50 maxpower=50
swRangeOn=1
prop=20 int=10 deriv=0
lscfg="dispfld 4,B,3;display 4"

View File

@ -1,7 +0,0 @@
sensA.type=m sensA.curve=x14667
sensB.type=t sensB.curve=std4
sensC.type=s sensC.curve=x23167
sensD.type=k sensD.curve=std4
dev="11 T horizontal SANS cryomagnet"
tlimit=310 resist=50 maxpower=50
prop=10 int=10 deriv=0

View File

@ -1,3 +0,0 @@
sensC.type=t sensC.curve=cma11
dev="SANS test carbon resistors"
lscfg="dispfld 2,C,3;display 2"

View File

@ -1,7 +0,0 @@
sensA.type=m sensA.curve=x14667
sensB.type=t sensB.curve=std4
sensC.type=s sensC.curve=x12905
sensD.type=k sensD.curve=ccs130
dev="11 T horizontal SANS cryomagnet"
tlimit=310 resist=50 maxpower=50
prop=10 int=10 deriv=0

View File

@ -1,7 +0,0 @@
sensA.type=m sensA.curve=x14667
sensB.type=t sensB.curve=std4
sensC.type=s sensC.curve=x17627
sensD.type=k sensD.curve=std4
dev="11T SANS cryomagnet with rotatable sample stick"
tlimit=310 resist=50 maxpower=50
prop=10 int=10 deriv=0

View File

@ -1,4 +0,0 @@
sensA.type=s sensA.curve=x31254
dev="15 T rotatable sample stick"
tlimit=310 resist=40 maxpower=40
prop=15 int=10 deriv=0

View File

@ -1,6 +0,0 @@
sensA.type=m sensA.curve=pcry sensA.lim=50
sensB.type=n sensB.curve=c030311 sensB.lim=60
sensC.type=s sensC.curve=x24506
dev="orange cryostat 50 mm (Risoe)"
tlimit=310 resist=50 maxpower=50 controlmode=0
prop=25 int=10 deriv=0

View File

@ -1,7 +0,0 @@
sensA.type=m sensA.curve=pcry sensA.lim=30
sensB.type=n sensB.curve=c030307 sensB.lim=40
sensC.type=t sensC.curve=psam
sensD.type=s sensD.curve=x2060
dev="orange cryostat 50 mm (Risoe)"
tlimit=310 resist=50 maxpower=50 controlmode=0
prop=25 int=10 deriv=0

View File

@ -1,6 +0,0 @@
sensA.type=m sensA.curve=pcry sensA.lim=50
sensB.type=n sensB.curve=c020415 sensB.lim=60
sensC.type=s sensC.curve=x22643
dev="maxi orange cryostat 100 mm (Risoe)"
tlimit=310 resist=50 maxpower=50 controlmode=0
prop=25 int=10 deriv=0

View File

@ -1,2 +0,0 @@
INCRV C,0;LINEAR C:2,0.01,1,2
DISPFLD 2,C,4;DISPFLD 3,A,3;DISPLAY:3

View File

@ -1,6 +0,0 @@
sensA.type=m sensA.curve=rx1976 sensA.scale=0.01
dev="LTF dilution cryostat"
tlimit=12.0 resist=708 maxPower=0.01 powfact=0.03
prop=50 int=10 deriv=0
lscfg="INCRV C,0;LINEAR C:2,0.01,1,2;DISPFLD 2,C,4;DISPFLD 3,A,3;DISPLAY:3"

View File

@ -1,6 +0,0 @@
sensA.type=m sensA.curve=rx1611 sensA.scale=0.01
dev="LTF dilution cryostat"
tlimit=12.0 resist=708 maxPower=0.01 powfact=0.03
prop=50 int=10 deriv=0
lscfg="INCRV C,0;LINEAR C:2,0.01,1,2;DISPFLD 2,C,4;DISPFLD 3,A,3;DISPLAY:3"

View File

@ -1,5 +0,0 @@
sensA.type=m sensA.curve=ruox
sensB.type=h
dev="4 T vertical cryomagnet"
tlimit=273 resist=440 maxPower=5 full=4.6
prop=20 int=3 deriv=0

View File

@ -1,5 +0,0 @@
display 8
dispfld 5,A01,3
dispfld 6,A02,3
dispfld 7,A03,3
dispfld 8,A04,3

View File

@ -1,7 +0,0 @@
sensA.type=m sensA.curve=x14667
sensB.type=t sensB.curve=std4
sensC.type=s sensC.curve=x23167
sensD.type=k sensD.curve=std4
DEV="11 T horizontal SANS cryomagnet"
tlimit=310 resist=50 maxpower=50
prop=10 int=10 deriv=0

View File

@ -1,7 +0,0 @@
sensA.type=m sensA.curve=x14667
sensB.type=t sensB.curve=std4
sensC.type=s sensC.curve=x17627
sensD.type=k sensD.curve=std4
DEV="11T SANS cryomagnet with rotatable sample stick"
tlimit=310 resist=50 maxpower=50
prop=10 int=10 deriv=0

View File

@ -1,5 +0,0 @@
sensA.type=m sensA.curve=x12533
dev="variox cryostat"
tlimit=375 resist=25 maxpower=25
prop=20 int=10 deriv=0
loop=2

View File

@ -1,539 +0,0 @@
#include <stdlib.h>
#include <stdio.h>
#include <sys/socket.h>
#include <string.h>
#include <unistd.h>
#include <assert.h>
#include <signal.h>
#include "myc_err.h"
#include "coc_util.h"
#include "coc_client.h"
#include "myc_str.h"
/* --- non ANSI signal --- */
#ifndef SIGPIPE
#define SIGPIPE 13
#endif
#define COC_NETTMO 5
#define COC_RESTMO 60
#define ARG_CHAR 1
#define ARG_INT 2
#define ARG_FLT 3
#define ARG_ARR 4
#define ARG_OUT 5
/*-------------------------------------------------------------------------*/
int CocConnect(CocConn *conn) { /* connect, but do not start */
int i;
struct sockaddr_in sadr;
ERR_I(CocCreateSockAdr(&sadr, conn->host, conn->port));
ERR_SI(conn->fd=socket(AF_INET, SOCK_STREAM, 0));
i = 1;
ERR_SI(setsockopt(conn->fd,SOL_SOCKET,SO_REUSEADDR,&i,sizeof(int))); /* allow quick port reuse */
i=connect(conn->fd, (struct sockaddr *)&sadr, sizeof(sadr));
if (i<0) {
close(conn->fd);
conn->fd=-1;
if (errno==ECONNREFUSED) return(1);
ERR_COD(errno);
}
return(0);
OnError: return(-1);
}
int CocOpen(CocConn *conn) { /* connect and start, if not succsessful */
int i, try, tmo;
ERR_I(i=CocConnect(conn));
if (i==0) return(0);
/* connection refused */
if (conn->startcmd[0]=='\0') {
CocDelay(500);
ErrTxt("connect",1); return(1);
}
printf("Starting TecsServer ...\n\n%s\n", conn->startcmd);
ERR_I(system(conn->startcmd));
try=15;
tmo=100; /* wait total ca. 10 sec. for max. 15 tries */
while (try>0) {
try--;
CocDelay(tmo); tmo=tmo*5/4;
ERR_I(i=CocConnect(conn));
if (i==0) {
printf("\n... connected to TecsServer\n");
return(0);
}
}
ERR_MSG("can not start TECS, too many retries");
OnError: return(-1);
}
/*-------------------------------------------------------------------------*/
int CocInitClient(CocConn *conn, char *host, int port, char *magic, int bufsize, char *startcmd) {
int iret;
assert(conn!=NULL);
if (bufsize==0) bufsize=1024;
StrLink(&conn->cmdbuf, conn->cmdbuf_);
StrLink(&conn->resbuf, conn->resbuf_);
conn->port=port;
ERR_I(str_copy(conn->host, host));
ERR_I(str_copy(conn->magic, magic));
ERR_I(str_copy(conn->startcmd, startcmd));
conn->fd=-1;
ERR_I(iret=CocOpen(conn));
if (iret==0) {
iret=CocSendMagic(conn, conn->magic);
if (iret<0) {
CocCloseClient(conn);
iret=1;
}
}
return(iret);
OnError: return(-1);
}
/*-------------------------------------------------------------------------*/
int CocSendMagic(CocConn *conn, char *magic) {
char *err;
if (magic != conn->magic) {
str_copy(conn->magic, magic);
}
StrClear(&conn->resbuf); /* use return buffer for command in order to preserve command buffer */
ERR_I(StrPut(&conn->resbuf, "", COC_MAGIC));
ERR_I(StrPut(&conn->resbuf, magic, COC_SEP));
ERR_I(CocSend(conn->fd, conn->resbuf.buf, conn->resbuf.wrpos));
ERR_I(CocRecv(conn->fd, &conn->resbuf, COC_NETTMO, NULL));
ERR_P(err=StrGet(&conn->resbuf, NULL, COC_SEP));
if (err[0]!=COC_MAGIC) ERR_MSG("magic synch error");
if (err[1]!='\0') { ErrMsg(err+1); ErrTxt(": (response from server)",0); goto OnError; }
ERR_I(StrGetEnd(&conn->resbuf));
return(0);
OnError: return(-1);
}
/*-------------------------------------------------------------------------*/
int CocCheck(CocConn *conn) {
if (conn->fd<0) return(1);
ERR_I(CocSend(conn->fd, "_quit", 6));
ERR_I(CocRecv(conn->fd, &conn->resbuf, COC_NETTMO, NULL));
return(0);
OnError:
if (ErrCode==ECONNRESET || ErrCode==EPIPE) return(1);
return(-1);
}
/*-------------------------------------------------------------------------*/
int CocTryCmd(CocConn *conn) {
int iret=-1;
signal(SIGPIPE, SIG_IGN);
if (conn->fd<0) {
ERR_I(iret=CocConnect(conn)); /* was CocOpen earlier */
if (iret == 1) {
CocDelay(500);
ErrTxt("connect",1); return (-1);
}
iret=-1;
ERR_I(CocSendMagic(conn, conn->magic));
}
ERR_I(CocSend(conn->fd, conn->cmdbuf.buf, conn->cmdbuf.wrpos));
ERR_I(CocRecv(conn->fd, &conn->resbuf, COC_NETTMO, NULL));
return(0);
OnError:
if (ErrCode==ECONNRESET || ErrCode==EPIPE) return(-2);
return(iret);
}
/*-------------------------------------------------------------------------*/
int CocCmdWithRetry(CocConn *conn) {
int cnt, iret;
if (conn==NULL) ERR_MSG("not connected");
cnt=3;
while (1) {
cnt--;
if (cnt<=0) {
ERR_I(CocTryCmd(conn));
break;
}
iret=CocTryCmd(conn);
if (iret>=0) break;
if (conn->fd > 0) close(conn->fd);
conn->fd=-1;
if (iret==-1) goto OnError; /* severe error */
ErrShort(ErrMessage);
ErrShort("try to reconnect");
}
return(0);
OnError: return(-1);
}
/*-------------------------------------------------------------------------*/
void CocReset(CocConn *conn) {
assert(conn!=NULL);
StrClear(&conn->cmdbuf);
if (conn->synch!=COC_SYN0) {
conn->synch=COC_SYN0;
} else {
conn->synch=COC_SYN1;
}
StrPut(&conn->cmdbuf, "", conn->synch);
conn->nargs=0;
}
/*-------------------------------------------------------------------------*/
int CocPushArg(CocConn *conn, const char *name, void *value, int type, int size) {
StrBuf *buf;
int n;
assert(conn!=NULL);
assert(NULL==strchr(name, ' '));
buf=&conn->cmdbuf;
n=conn->nargs;
if (n>=sizeof(conn->args)/sizeof(conn->args[0])) ERR_MSG("too many return arguments");
conn->args[n].adr=value;
conn->args[n].type=type;
conn->args[n].size=size;
conn->args[n].cmd=buf->buf + buf->wrpos;
conn->nargs=n+1;
if (value==NULL) {
ERR_I(StrPut(buf, name, ' '));
} else {
ERR_I(StrPut(buf, name, COC_SEP));
}
return(0);
OnError: return(-1);
}
/*-------------------------------------------------------------------------*/
int CocPutStr(CocConn *conn, const char *name, const char *value) {
ERR_I(CocPushArg(conn, name, NULL, ARG_CHAR, 0));
ERR_I(StrPut(&conn->cmdbuf, value, COC_SEP));
return(0);
OnError: return(-1);
}
/*-------------------------------------------------------------------------*/
int CocPutFloat(CocConn *conn, const char *name, float value) {
ERR_I(CocPushArg(conn, name, NULL, ARG_FLT, 0));
ERR_I(StrPutFloat(&conn->cmdbuf, value, COC_SEP));
return(0);
OnError: return(-1);
}
/*-------------------------------------------------------------------------*/
int CocPutArray(CocConn *conn, const char *name, float *value, int value_size) {
ERR_I(CocPushArg(conn, name, NULL, ARG_ARR, 0));
ERR_I(StrPutArray(&conn->cmdbuf, value, value_size));
return(0);
OnError: return(-1);
}
/*-------------------------------------------------------------------------*/
int CocPutInt(CocConn *conn, const char *name, int value) {
ERR_I(CocPushArg(conn, name, NULL, ARG_INT, 0));
ERR_I(StrPutInt(&conn->cmdbuf, value, COC_SEP));
return(0);
OnError: return(-1);
}
/*-------------------------------------------------------------------------*/
int CocGetStr(CocConn *conn, const char *name, char *value, int value_len) {
return(CocPushArg(conn, name, value, ARG_CHAR, value_len));
}
/*-------------------------------------------------------------------------*/
int CocGetFloat(CocConn *conn, const char *name, float *value) {
return(CocPushArg(conn, name, value, ARG_FLT, 0));
}
/*-------------------------------------------------------------------------*/
int CocGetInt(CocConn *conn, const char *name, int *value) {
return(CocPushArg(conn, name, value, ARG_INT, 0));
}
/*-------------------------------------------------------------------------*/
int CocGetArray(CocConn *conn, const char *name, float *value, int value_size) {
return(CocPushArg(conn, name, value, ARG_ARR, value_size));
}
/*-------------------------------------------------------------------------*/
int CocGetOut(CocConn *conn, const char *name, OutFunc *func) {
return(CocPushArg(conn, name, func, ARG_OUT, 0));
}
/*-------------------------------------------------------------------------*/
int CocDoIt(CocConn *conn, char *res, int res_len) {
StrBuf *buf;
int i, pending;
float *arr;
CocArg *a;
char *resp, *t, tag, *str;
int iret=0;
int siz;
OutFunc *f;
assert(conn!=NULL);
ERR_I(CocCmdWithRetry(conn));
buf=&conn->resbuf;
while (buf->buf[0] != conn->synch) { /* throw away unsynchronized answers */
ERR_I(CocRecv(conn->fd, buf, COC_NETTMO, NULL));
}
pending=conn->nargs;
*res='\0';
while (1) {
if (buf->buf[0] != conn->synch) ERR_MSG("synch error");
ERR_P(StrGet(buf, NULL, conn->synch));
i=0;
a=conn->args;
while (pending>0 && i<conn->nargs) {
if (a->type!=0) {
resp=buf->buf + buf->rdpos;
tag=*resp;
if (tag==COC_DELAYED) { /* delayed response */
resp++;
ERR_P(StrGet(buf, NULL, COC_SEP));
} else {
pending--;
if (tag==COC_ERR || tag==COC_TRM) { /* error response */
str_ncat(res, a->cmd, res_len);
resp++;
ERR_P(StrGet(buf, NULL, COC_SEP));
str_ncat(res, ": ", res_len);
iret=1;
if (tag==COC_TRM) return(1);
} else {
if (a->adr==NULL) {
t=strchr(res, COC_SEP);
str_ncat(res, a->cmd, res_len);
t=strchr(t, ' ');
assert(t!=NULL); /* truncate argument */
*t=COC_SEP;
str_ncat(res, "=", res_len);
ERR_P(StrGet(buf, NULL, COC_SEP));
} else {
str_ncat(res, a->cmd, res_len);
str_ncat(res, "=", res_len);
if (a->type==ARG_INT) {
ERR_I(StrGetInt(buf, (int *)a->adr, COC_SEP));
} else if (a->type==ARG_FLT) {
ERR_I(StrGetFloat(buf, (float *)a->adr, COC_SEP));
} else if (a->type==ARG_ARR) {
arr=(float *)a->adr;
ERR_I(siz=StrGetArray(buf, arr, a->size));
while (siz < a->size) { /* fill with zeroes */
arr[siz++]=0.0;
}
resp="<array>";
} else if (a->type==ARG_CHAR) {
ERR_P(StrNGet(buf, (char *)a->adr, a->size, COC_SEP));
} else if (a->type==ARG_OUT) {
ERR_P(str=StrNGet(buf, NULL, 0, COC_SEP));
f=(OutFunc *)a->adr;
f->func(str, f->arg);
} else {
ERR_MSG("unknown type");
}
a->type=0; /* done */
}
}
str_ncat(res, resp, res_len);
str_ncat(res, "\n", res_len);
}
}
i++; a++;
}
ERR_I(StrGetEnd(buf));
if (pending==0) return(iret); /* no more delayed response awaiting */
ERR_I(CocRecv(conn->fd, buf, COC_RESTMO, NULL));
}
return(iret);
OnError: return(-1);
}
static int interrupt, logFd=0;
void CocIntSignal(int sig) {
char buf[4];
if (logFd) {
interrupt=2;
buf[0]=COC_CLRLOG;
buf[1]=COC_SEP; /* send "clear log" message */
printf("\nCLRLOG\n");
CocSend(logFd, buf, 2);
} else {
printf("\ninterrupt\n");
interrupt=1;
}
}
int CocWatchLog(CocConn *conn, char *loglist) {
char cbuf[1024];
StrBuf *buf;
int fd, iret;
#if __VMS
static int init=1;
if (init) {
init=0;
DECC$CRTL_INIT();
}
#endif
fd=conn->fd;
CocReset(conn);
ERR_I(CocPutStr(conn, "loglist", loglist));
ERR_I(CocDoIt(conn, cbuf, sizeof(cbuf)));
buf=&conn->resbuf;
interrupt=0;
logFd=fd;
signal(SIGINT, CocIntSignal);
while (!interrupt) {
logFd=fd;
ERR_I(iret=CocRecv(fd, buf, 60, &logFd));
if (iret>0) {
if (buf->buf[0]==COC_CLRLOG) { /* confirmed "clear log" message */
interrupt=3;
} else { /* it's a log message */
StrReset(buf);
while (!StrEnd(buf)) {
ERR_P(StrGet(buf, cbuf, COC_SEP));
printf("%s", cbuf);
}
}
}
}
signal(SIGINT, SIG_DFL);
logFd=0;
if (interrupt==1) { /* send "clear log" message */
cbuf[0]=COC_CLRLOG;
cbuf[1]=COC_SEP; /* send "clear log" message */
printf("\nclrlog\n");
CocSend(fd, cbuf, 2);
do {
ERR_I(CocRecv(fd, buf, 10, NULL));
} while (buf->buf[0]!=COC_CLRLOG);
}
return(0);
OnError:
signal(SIGINT, SIG_DFL);
return(-1);
}
int CocShowLog(CocConn *conn, char *loglist, int start, int lines) {
char cbuf[1024];
StrBuf *buf;
int fd, iret;
fd=conn->fd;
CocReset(conn);
if (start>0) {
ERR_I(CocPutInt(conn, "logstart", start));
}
ERR_I(CocPutInt(conn, "loglines", lines));
ERR_I(CocPutStr(conn, "logshow", loglist));
ERR_I(CocDoIt(conn, cbuf, sizeof(cbuf)));
buf=&conn->resbuf;
while (1) {
ERR_I(iret=CocRecv(fd, buf, 10, NULL));
if (iret<=0) break;
if (buf->buf[0]==COC_CLRLOG) { /* end of log message */
break;
} else { /* it's a log message */
StrReset(buf);
while (!StrEnd(buf)) {
ERR_P(StrGet(buf, cbuf, COC_SEP));
printf("%s", cbuf);
}
}
}
return(0);
OnError:
signal(SIGINT, SIG_DFL);
return(-1);
}
void CocCloseClient(CocConn *conn) {
assert(conn!=NULL);
if (conn->fd >= 0) close(conn->fd);
conn->fd=-1;
}
/*-------------------------------------------------------------------------*/
static char rbuf[256];
int CocSet(CocConn *conn, const char *name, const char *value) {
int iret;
assert(conn!=NULL);
CocReset(conn);
ERR_I(CocPutStr(conn, name, value));
ERR_I(iret=CocDoIt(conn, rbuf, sizeof(rbuf)));
if (iret) ERR_MSG(rbuf);
return(0);
OnError: return(-1);
}
int CocGetN(CocConn *conn, const char *name, char *value, int reslen) {
int iret;
assert(conn!=NULL);
CocReset(conn);
ERR_I(CocGetStr(conn, name, value, reslen));
ERR_I(iret=CocDoIt(conn, rbuf, sizeof(rbuf)));
if (iret) ERR_MSG(rbuf);
return(0);
OnError: return(-1);
}
int CocSetGetN(CocConn *conn, const char *name, const char *cmd, char *value, int reslen) {
assert(conn!=NULL);
CocReset(conn);
ERR_I(CocPutStr(conn, name, cmd));
ERR_I(CocDoIt(conn, value, reslen));
return(0);
OnError: return(-1);
}

View File

@ -1,88 +0,0 @@
#ifndef _COC_CLIENT_H_
#define _COC_CLIENT_H_
#include "myc_buf.h"
#include "coc_util.h"
typedef struct {
void (* func) (char *, void *);
void *arg;
} OutFunc;
typedef struct {
void *adr;
int type, size;
char *cmd;
} CocArg;
typedef struct {
int fd;
/* private */
int port;
StrBuf cmdbuf; /* for sending command */
StrBuf resbuf; /* for response */
char cmdbuf_[COC_CMD_LEN];
char resbuf_[COC_RES_LEN];
CocArg args[16];
int nargs;
char host[64];
char magic[32];
char startcmd[512];
char synch;
} CocConn;
int CocInitClient(CocConn *conn, char *host, int port, char *magic, int bufsize, char *startcmd);
/* initialize a connection to the server process
*/
int CocSendMagic(CocConn *conn, char *magic);
/* send magic word to the server for changing access rights
*/
void CocReset(CocConn *conn);
int CocPutStr(CocConn *conn, const char *name, const char *value);
int CocPutFloat(CocConn *conn, const char *name, float value);
int CocPutInt(CocConn *conn, const char *name, int value);
int CocPutArray(CocConn *conn, const char *name, float *value, int value_size);
int CocGetStr(CocConn *conn, const char *name, char *value, int value_len);
int CocGetFloat(CocConn *conn, const char *name, float *value);
int CocGetInt(CocConn *conn, const char *name, int *value);
int CocGetArray(CocConn *conn, const char *name, float *value, int value_size);
int CocGetOut(CocConn *conn, const char *name, OutFunc *f);
int CocDoIt(CocConn *conn, char *error, int error_len);
int CocCheck(CocConn *conn);
/*
returns 1, if not yet open
returns 0, if connection o.k.
returns -1 (error message), if connection died
*/
int CocWatchLog(CocConn *conn, char *list);
/*
Watch indefinitely for log messages
*/
int CocSet(CocConn *conn, const char *name, const char *value);
/*
set one variable
*/
int CocGetN(CocConn *conn, const char *name, char *value, int reslen);
#define CocGet(C,N,V) CocGetN(C,N,V,sizeof(V))
/*
read one variable. Use the macro if value is a fixed length array
*/
int CocSetGetN(CocConn *conn, const char *name, const char *cmd, char *value, int reslen);
#define CocSetGet(C,N,S,V) CocSetGetN(C,N,S,V,sizeof(V))
/*
set and get a variable. Use the macro if value is a fixed length array
*/
void CocCloseClient(CocConn *conn);
/*
close the connection to the server
*/
#endif /* _COC_CLIENT_H_ */

View File

@ -1,350 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <assert.h>
#include "coc_logfile.h"
#include "myc_time.h"
#include "myc_err.h"
#include "myc_str.h"
static FILE *fil=NULL;
static char lnam[224]="";
static char filnam[256]="";
static char ebuf[20000]="";
static char *statusBuf=NULL;
static int statusSize;
static char *eptr=&ebuf[0];
static int dated=0;
static int logMask=0;
static int wrtMask=0;
static int newLine=1;
static int logfileStd;
static int dirty, writeAll;
static int lastline=1;
static long int lastpos=0;
static int lastStamp=0;
static int openTime;
static int openDate;
void (*logfileOutRtn)(int, char *)=NULL;
void logfileOpen(int append) {
int year;
if (logfileStd) {
fil=stdout;
str_copy(filnam, "<stdout>");
return;
}
assert(fil==NULL);
openTime = mycNow();
openDate = mycDate(openTime); /* date in yyyymmdd decimal encoding */
openTime = openTime % (24*3600); /* seconds since midnight */
if (dated) {
sprintf(filnam, "%s%02d-%02d.log", lnam, openDate % 10000 / 100, openDate % 100);
} else {
if (lnam[0]=='\0') {
str_copy(filnam, "test.log");
} else {
str_copy(filnam, lnam);
str_append(filnam, ".log");
}
}
if (dated) {
fil=fopen(filnam, "a+");
if (fil != NULL) {
fseek(fil, 0, SEEK_SET); /* set position to start */
year=0;
fscanf(fil, "%4d", &year);
if (year != openDate / 10000) {
fclose(fil);
fil=fopen(filnam, "w+"); /* overwrite old logfile */
} else {
fseek(fil, 0, SEEK_END); /* set position to end */
}
}
} else {
fil=fopen(filnam, "w+"); /* overwrite last logfile */
}
if (fil==NULL) {
printf("Can not open %s\n", filnam);
fil=stdout;
str_copy(filnam, "<stdout>");
return;
}
ErrSetOutFile(fil);
fprintf(fil, "%04d-%02d-%02d %02d:%02d:%02d opened logfile\n"
, openDate / 10000, openDate % 10000 / 100, openDate % 100
, openTime / 3600, openTime / 60 % 60, openTime % 60);
lastStamp = openTime / 60;
}
void logfileStatusBuffer(char *buffer, int bufsize) {
statusBuf=buffer;
statusSize=bufsize-1;
}
char *logfileInit(char *path, int nodate, int use_stdout, int write_all) {
str_copy(lnam, path);
logfileStd=use_stdout;
writeAll=write_all;
dated=!nodate;
logfileOpen(1);
return(filnam);
}
void logfileStamp(char *text) {
int time, date, stamp;
time = mycNow();
date = mycDate(time); /* date in yyyymmdd decimal encoding */
time = time % (24*3600); /* seconds since midnight */
stamp=time / 60;
if (date != openDate ) { /* day has changed -> new logfile */
if (fil!=NULL) { fclose(fil); fil=NULL; }
lastpos=0;
lastline=1;
logfileOpen(1);
}
if (text==NULL) {
if (stamp>lastStamp+1) {
fprintf(fil, "---\t%02d:%02d:%02d\n", stamp / 60, stamp % 60, time % 60);
}
} else {
fprintf(fil, "\t%02d:%02d:%02d%s", stamp / 60, stamp % 60, time % 60, text);
}
dirty=0;
lastStamp=stamp;
}
void logfileOut(int mask, const char *fmt, ...)
{ va_list ap;
char buf[8192], *p;
int l;
va_start(ap, fmt);
if (mask & LOG_STAT && statusBuf!=NULL) {
if (newLine) {
statusBuf[0]='\0';
newLine=0;
}
buf[statusSize]='\0';
vsprintf(buf, fmt, ap);
assert(buf[statusSize]=='\0'); /* check for overflow */
if (buf[0]=='@') {
if (buf[1]==' ') {
str_ncat(statusBuf, buf+2, statusSize);
} else {
str_ncat(statusBuf, buf+1, statusSize);
}
} else {
str_ncat(statusBuf, buf, statusSize);
}
p=strchr(statusBuf, '\n');
if (p!=NULL) {
newLine=1;
*p='\0';
}
}
if (logfileOutRtn!=NULL) {
vsprintf(buf, fmt, ap); /* does not check for overflow! */
logfileOutRtn(mask, buf);
}
if (writeAll) {
vfprintf(fil, fmt, ap);
wrtMask=LOG_ALL;
} else if ((mask | LOG_NET) != LOG_NET) { /* do not store LOG_NET info */
if (eptr!=NULL) {
if (eptr-ebuf > sizeof(ebuf)-512) {
sprintf(eptr, "... buffer full ... \1\1");
eptr=NULL;
} else {
vsprintf(eptr, fmt, ap);
p=strchr(eptr, '\1');
if (p==NULL) {
l=strlen(eptr);
if (l>256) {
sprintf(buf, "unusual long output %.32s... (%d chars)\n", eptr, l);
logfileStamp(buf);
}
eptr+=l;
} else {
eptr=p; /* is in fact an error */
}
eptr[0]='\1'; /* put \1 as separator between blocks */
eptr[1]=mask & 31;
eptr[2]='\0';
eptr+=2;
}
}
wrtMask=wrtMask | mask;
}
va_end(ap);
}
void logfileMask(int mask) {
logMask=logMask | mask;
}
void logfileWrite0(int mask) {
char *s, *next;
logMask=logMask | mask;
if (dirty) logfileStamp(NULL); /* there was something written since last time */
s=ebuf;
if (writeAll || (*s!='\0' && (wrtMask & logMask))) {
next=strchr(s, '\1');
while (next!=NULL) {
*next='\0';
next++;
if (*next & logMask) {
if (*s=='@') { /* write out time */
logfileStamp(s+1);
} else {
logfileStamp(NULL); /* write stamp before write something */
fprintf(fil, "%s", s);
dirty=1;
}
}
s=next+1;
next=strchr(s, '\1');
}
}
ebuf[0]='\0';
eptr=&ebuf[0];
logMask=0;
wrtMask=0;
}
void logfileScan(int date, void (*scanLine)(void*, char*), void *arg) {
FILE *sFile;
char buf[256], *res;
if (date == openDate) {
sFile=fil;
rewind(sFile);
} else {
sprintf(buf, "%s%02d-%02d.log", lnam, date % 10000 / 100, date % 100);
sFile=fopen(buf, "r+");
if (sFile==NULL) return;
}
res=fgets(buf, sizeof(buf), sFile);
while (res!=NULL) {
if (res[0]=='\t') {
scanLine(arg, res+1);
}
res=fgets(buf, sizeof(buf), sFile);
}
if (sFile==fil) {
fseek(fil, 0, SEEK_END);
} else {
fclose(sFile);
}
}
void logfileWrite(int mask) {
logfileWrite0(mask);
fflush(fil);
}
void logfileShowErr(char *text)
{
logfileWrite0(LOG_ALL); /* write all */
ErrShow(text);
fflush(fil);
}
void logfileClose()
{
logfileWrite0(LOG_MAIN+LOG_INFO);
lastStamp=-2;
logfileOut(LOG_MAIN, "closed\n");
logfileStamp(NULL);
if (fil!=NULL) { fclose(fil); fil=NULL; }
filnam[0]='\0';
}
void logfileOutBuf(int mask, StrBuf *buf)
{ char str[256];
int rd0;
char *ret;
rd0=buf->rdpos;
if (buf->rdpos < 0 || buf->rdpos >= buf->dsize
|| buf->wrpos < 0 || buf->wrpos >= buf->dsize) {
logfileOut(mask, "<buffer corrupt>"); return;
}
while (!StrEnd(buf)) {
ret=StrGet(buf, str, '\0');
if (ret==NULL) {
ret="...";
buf->rdpos=buf->wrpos;
}
if (ret[0]<32 && ret[0]>0) {
logfileOut(mask, "[%d]%s;", ret[0], ret+1);
} else {
logfileOut(mask, "%s;", ret);
}
}
buf->rdpos=rd0;
}
int logfileLength(void) {
char lin[256];
int l, ll;
if (logfileStd || fil==NULL) return 0;
fseek(fil, lastpos, SEEK_SET);
ll=lastpos;
l=lastline;
while (NULL!=fgets(lin, sizeof(lin), fil)) {
lastpos=ll;
ll=ftell(fil);
lastline=l;
l++;
}
return(lastline);
}
long int logfilePos(int n) {
/* set file to the start of n-th last line n, if n<0 then position to the -n-th line */
int i;
char lin[256];
if (logfileStd || fil==NULL) return 0;
if (n>0) {
n=logfileLength()-n+1;
} else {
n=-n;
}
fseek(fil, 0, SEEK_SET);
for (i=1; i<n; i++) {
if (NULL==fgets(lin, sizeof(lin), fil)) return ftell(fil);
}
return ftell(fil);
}
long int logfileGetLines(long int pos, int linmax, char *line, int len_line) {
int l,i;
if (logfileStd || fil==NULL) {
line[0]='\0';
return 0;
}
l=0;
fseek(fil, pos, SEEK_SET);
for (i=0; i<linmax; i++) {
if (NULL==fgets(line+l, len_line-l, fil)) {
line[l]='\0';
return ftell(fil);
}
l=strlen(line);
}
pos=ftell(fil);
fseek(fil, 0, SEEK_END);
return pos;
}

View File

@ -1,28 +0,0 @@
#ifndef _COC_LOGFILE_H_
#define _COC_LOGFILE_H_
#include "myc_buf.h"
#define LOG_ALL 31
#define LOG_STAT 32
#define LOG_SER 8
#define LOG_NET 4
#define LOG_INFO 2
#define LOG_MAIN 1
#define logfileStatusBuf(B) logfileStatusBuffer(B,sizeof(B))
void logfileStatusBuffer(char *buffer, int bufsize);
char *logfileInit(char *path, int nodate, int use_stdout, int write_all);
void logfileOut(int mask, const char *fmt, ...);
void logfileOutBuf(int mask, StrBuf *buf);
void logfileShowErr(char *text);
void logfileMask(int mask);
void logfileScan(int date, void (*scanLine)(void*, char*), void *arg);
void logfileWrite(int mask);
void logfileClose(void);
long int logfilePos(int n);
long int logfileGetLines(long int pos, int linmax, char *line, int len_line);
extern void (*logfileOutRtn)(int, char *); /* custom output routine */
#endif /* _COC_LOGFILE_H_ */

View File

@ -1,664 +0,0 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/timeb.h>
#include <strings.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include "myc_mem.h"
#include "myc_err.h"
#include "coc_logfile.h"
#include "coc_util.h"
#include "coc_server.h"
#include "myc_str.h"
#include "myc_time.h"
#include "uselect.h"
#define COC_NUL COC_SEP
typedef struct _CocVar {
struct _CocVar *next;
char name[32];
void *var;
int access;
int type;
int size;
void *strucType;
int (*hdl)(int, void *, int);
int pending;
} CocVar;
CocVar *serverVarList=NULL;
static CocVar **varListHandle=&serverVarList;
static CocVar *lastDef=NULL;
typedef struct {
CocVar *var;
void *base;
int mode;
} Pend;
typedef struct _CocClient {
struct _CocClient *next;
int fd;
int mode;
Pend pend[16];
int npend;
int logmask;
char synch;
void *data;
} CocClient;
void *(*setData)(void *);
/*
static CocClientData **clData;
static int clDataSize;
*/
DeclStrBuf(buf, COC_CMD_LEN);
DeclStrBuf(bufo, COC_RES_LEN);
static fd_set mask, rmask;
static int maxfd;
CocClient *cList;
static int mainFd;
static int modified;
static char loglist[16];
void CocVarList(void **varList) {
if (varList==NULL) {
varListHandle=(CocVar **)varList;
} else {
varListHandle=&serverVarList;
}
}
void CocList() { CocVar *p;
p=*varListHandle;
while (p!=NULL) {
printf("%s %d ", p->name, p->type);
p=p->next;
}
printf("\n");
}
CocVar *CocFindVar1(const char *name) {
CocVar *p;
p=*varListHandle;
while (p!=NULL && 0!=strcasecmp(p->name,name)) p=p->next;
return(p);
}
void *CocFindVar(const char *name, void **adr) {
CocVar *p, *t;
const char *f;
void *base;
char nam[32];
f=str_split(nam, name, '.');
if (f==NULL) {
f=str_split(nam, name, '-');
if (f!=NULL) {
if (f[0]!='>') {
f=NULL;
} else {
f++;
}
}
}
if (f!=NULL) {
if (adr!=NULL) *adr=NULL;
p=CocFindVar1(nam);
if (p==NULL) { return(NULL); }
t=p->strucType;
if (t==NULL) { return(NULL); }
str_copy(nam, t->name);
str_append(nam, ":");
str_append(nam, f);
if (adr!=NULL) {
base=p->var;
if (p->type==COC_PTR) base=*(void **)base;
*adr=base;
}
} else if (adr!=NULL) {
*adr=NULL;
}
p=CocFindVar1(nam);
if (p!=NULL && p->type==COC_ALIAS) { /* recursive call for alias */
p=CocFindVar(p->var, adr);
}
return(p);
}
void *CocIntPtr(int *ptr) { return(ptr); }
void *CocFltPtr(float *ptr) { return(ptr); }
void *CocChrPtr(char *ptr) { return(ptr); }
void *CocDefVar(const char *name, void *var, int type, int size, int access) {
CocVar *p;
assert(varListHandle!=NULL);
p=CocFindVar1(name);
if (p==NULL) {
NEW(p,CocVar);
p->next=*varListHandle;
*varListHandle=p;
str_copy(p->name, name);
p->type=type;
p->size=size;
} else {
assert(p->type==type);
}
p->var=var;
p->access=access;
/* printf("define %s %d\n", name, (int)var); */
lastDef=p;
return(p);
OnError:
assert(0);
}
void CocHdl(int (*handler)(int, void *, int)) {
assert(lastDef!=NULL);
lastDef->hdl=handler;
}
int *CocSizePtr(void) {
assert(lastDef!=NULL && lastDef->type==COC_ARRAY);
return &lastDef->size;
}
void CocDefVarS(const char *name, const char *tname, void *var, int type) {
CocVar *p;
assert(type==COC_PTR || type==COC_STRUCT);
p=CocDefVar(name, var, type, 0, COC_RDONLY);
p->strucType=CocDefVar(tname, NULL, COC_TYPE, 0, COC_RDONLY);
}
char err_name[64];
int CocGetThisVar(CocVar *var, void *base, StrBuf *buf, int separator) {
void *adr;
if (base==NULL) {
adr=var->var;
if (adr==NULL)
ERR_MSG("NULL pointer accessed");
} else { /* dereference */
adr=(char *)base + (int)var->var;
}
/* printf("get %s %d\n", name, (int)adr); */
if (var->type==COC_CHAR) {
ERR_P(StrNGet(buf, (char *)adr, var->size, separator));
} else if (var->type==COC_INT) {
ERR_I(StrGetInt(buf, (int *)adr, separator));
} else if (var->type==COC_FLT) {
ERR_I(StrGetFloat(buf, (float *)adr, separator));
} else if (var->type==COC_ARRAY) {
ERR_I(StrGetArray(buf, (float *)adr, var->size));
} else {
ERR_MSG("unknown type");
}
return(0);
OnError: return(-1);
}
int CocPutThisVar(CocVar *var, void *base, StrBuf *buf, int separator) {
void *adr;
if (base==NULL) {
adr=var->var;
if (adr==NULL)
ERR_MSG("NULL pointer accessed");
} else { /* dereference */
adr=(char *)base + (int)var->var;
}
/* printf("put %s %d\n", name, (int)adr); */
if (var->type==COC_CHAR) {
ERR_I(StrPut(buf, adr, separator));
} else if (var->type==COC_INT) {
ERR_I(StrPutInt(buf, *(int *)adr, separator));
} else if (var->type==COC_FLT) {
ERR_I(StrPutFloat(buf, *(float *)adr, separator));
} else if (var->type==COC_ARRAY) {
ERR_I(StrPutArray(buf, (float *)adr, var->size));
} else {
ERR_MSG("unknown type");
}
return(0);
OnError: return(-1);
}
int CocGetVar(const char *name, StrBuf *buf, int separator) {
CocVar *var;
void *base;
static char msg[128];
var=CocFindVar(name, &base);
if (var==NULL) {
str_copy(msg, "undefined variable ; ");
str_append(msg, name);
ERR_MSG(msg);
}
ERR_I(CocGetThisVar(var, base, buf, separator));
return(0);
OnError: str_copy(err_name, name); ErrTxt(err_name,0); return(-1);
}
int CocPutVar(const char *name, StrBuf *buf, int separator) {
CocVar *var;
void *base;
var=CocFindVar(name, &base);
if (var==NULL) ERR_MSG("undefined variable");
ERR_I(CocPutThisVar(var, base, buf, separator));
return(0);
OnError: str_copy(err_name, name); ErrTxt(err_name,0); return(-1);
}
void CocFreeVarList(void) {
CocVar *p, *v;
v=*varListHandle;
while (v!=NULL) {
p=v;
v=p->next;
p->next=NULL;
FREE(p);
}
*varListHandle=NULL;
}
char *CocReadVars(char *str, char stop){
int i, l;
char *eql, *cr, buf[256];
StrBuf sbuf;
/* interprete variables until stop character appeares */
i=sscanf(str, "%255s%n", buf, &l);
while (i>0 && buf[0]!=stop) {
if (buf[0]=='!') {
cr=strchr(str, '\n');
if (cr==NULL) return strchr(str, '\0');
str=cr+1;
} else {
eql=strchr(buf,'=');
if (eql==NULL) ERR_MSG("syntax error");
*eql='\0';
if (eql[1] == '\'' || eql[1]== '"') {
eql=strchr(str, '=');
StrNLink(&sbuf, eql+1, 256);
ERR_I(CocGetVar(buf, &sbuf, StrNONE));
str = sbuf.buf + sbuf.rdpos;
} else {
str+=l;
StrLink(&sbuf, eql+1);
ERR_I(CocGetVar(buf, &sbuf, ' '));
}
}
i=sscanf(str, "%255s%n", buf, &l);
}
return str;
OnError: return NULL;
}
void CocToClients(int mask, char *str) {
int iret;
CocClient *cl;
cl=cList->next;
while (cl!=NULL) {
if (cl->logmask & mask) {
iret=CocSend(cl->fd, str, strlen(str)+1);
if (iret<0) {
cl->logmask=0; /* disable logging for dead clients */
logfileOut(LOG_MAIN, "(%d) disconnected while logging\n", cl->fd);
}
}
cl=cl->next;
}
}
int CocInitServer(void *(*setDataRtn)(void *), int port) {
int i;
struct sockaddr_in sadr;
setData=setDataRtn;
/*
clDataSize=clientDataSize;
clData=clientData;
*/
NEW(cList,CocClient); /* empty header */
ERR_SI(mainFd=socket(AF_INET, SOCK_STREAM, 0));
i = 1;
ERR_SI(setsockopt(mainFd,SOL_SOCKET,SO_REUSEADDR,&i,sizeof(int))); /* allow quick port reuse */
ERR_I(CocCreateSockAdr(&sadr, NULL, port));
ERR_SI(bind(mainFd, (struct sockaddr *)&sadr, sizeof(sadr)));
logfileOutRtn=CocToClients;
logfileOut(LOG_INFO, "created server on port %d\n", port);
ERR_SI(listen(mainFd, 8));
FD_ZERO(&mask);
FD_SET(mainFd, &mask);
maxfd=mainFd+1;
CocDefStr(loglist, COC_RDWR);
return(0);
OnError: return(-1);
}
int CocHandleThis(CocVar *var, void *base, StrBuf *outBuf, int mode, int fd) {
int iret;
if (var->hdl!=NULL) {
iret=var->hdl(mode, base, fd);
if (iret<0) { /* error */
ErrShow(var->name);
ERR_I(StrPut(outBuf, "", COC_ERR)); /* signal error message */
ERR_I(StrPut(outBuf, ErrMessage, COC_SEP));
return(0);
}
if (iret==COC_DRD) {
ERR_I(StrPut(outBuf, "", COC_DELAYED)); /* delayed response message */
ERR_I(StrPut(outBuf, "", COC_SEP)); /* empty message */
return(COC_DRD);
}
if (iret!=0 && iret!=COC_DWR)
ERR_MSG("illegal return value from handler");
} else {
iret=0;
}
ERR_I(CocPutThisVar(var, base, outBuf, COC_NUL));
return(iret);
OnError: return(-1);
}
int CocPushThisHandler(CocVar *var, CocClient *cl, void *base, int mode) {
int n;
if (mode==COC_DWR) {
if (var->pending && cl->npend != 0) return(0);
var->pending=1;
}
n=cl->npend;
if (n * sizeof(Pend) >= sizeof(cl->pend)) {
ERR_MSG("too many commands")
}
cl->pend[n].var=var;
cl->pend[n].base=base;
cl->pend[n].mode=mode;
cl->npend=n+1;
return(0);
OnError: return(-1);
}
int CocCallHandlers(void) {
CocClient *cl;
CocVar *var;
Pend *p;
int i, iret, mode, delayedRead;
char synch;
DeclStrBuf(bufr, COC_RES_LEN);
cl=cList->next;
while (cl!=NULL) {
delayedRead=0;
/* treat delayed write handlers first */
for (i=0; i<cl->npend; i++) {
p=&cl->pend[i];
mode=p->mode;
var=p->var;
assert(var!=NULL && var->hdl!=NULL);
if (mode==COC_DWR) {
var->pending=0;
ERR_I(var->hdl(mode, p->base, cl->fd));
p->mode=0;
} else {
delayedRead=1;
}
}
if (delayedRead) {
StrClear(&bufr);
synch=cl->synch;
ERR_I(StrPut(&bufr, "", cl->synch));
for (i=0; i<cl->npend; i++) {
p=&cl->pend[i];
mode=p->mode;
var=p->var;
assert(var!=NULL && var->hdl!=NULL);
if (mode==COC_DRD) {
iret=var->hdl(mode, p->base, cl->fd);
if (iret<0) { /* error */
ERR_I(StrPut(&bufr, "", COC_ERR)); /* signal error message */
ERR_I(StrPut(&bufr, ErrMessage, COC_SEP));
}
ERR_I(CocPutThisVar(var, p->base, &bufr, COC_NUL));
}
}
if (cl->synch==synch) { /* send only if no new request from client received */
assert(cl->fd!=0);
ERR_I(CocSend(cl->fd, bufr.buf, bufr.wrpos));
}
}
cl->npend=0;
cl=cl->next;
}
return(0);
OnError:
cl->npend=0;
return(-1);
}
void CocShowHandlers(char *buf, int buf_len) {
CocClient *cl;
Pend *p;
int i;
buf[0]='\0';
cl=cList->next;
while (cl!=NULL) {
for (i=0; i<cl->npend; i++) {
p=&cl->pend[i];
if (p->mode==COC_DWR) {
assert(p->var!=NULL);
if (buf[0]!='\0') str_ncat(buf, ", ", buf_len);
str_ncat(buf, p->var->name, buf_len);
}
}
cl=cl->next;
}
return;
}
#ifdef __VMS
typedef size_t socklen_type;
#else
typedef socklen_t socklen_type;
#endif
int CocHandle1Request(int tmo_msec, int fd) {
struct sockaddr_in cadr;
struct hostent *h;
struct timeval tmo={0,1};
CocClient *cl, *cl0;
CocVar *var;
int i, lmask, newfd, iret;
socklen_type cadrlen;
char *err, *varname;
void *base;
rmask=mask;
if (fd>0) FD_SET(fd, &rmask);
if (fd>=maxfd) maxfd=fd+1;
tmo.tv_sec=tmo_msec / 1000;
tmo.tv_usec=(tmo_msec % 1000)*1000+1;
ERR_I(i=uselect(maxfd,&rmask,NULL,NULL,&tmo));
if (fd>0 && FD_ISSET(fd, &rmask)) return(1); /* event on fd */
if (i==0) return(0); /* timeout */
if (FD_ISSET(mainFd, &rmask)) {
cadrlen=sizeof(cadr);
ERR_SI(newfd=accept(mainFd, (struct sockaddr *)&cadr, &cadrlen));
FD_SET(newfd, &mask);
if (newfd>=maxfd) maxfd=newfd+1;
NEW(cl, CocClient);
cl->fd=newfd;
cl->mode=0;
if (setData!=NULL) {
ERR_P(cl->data = setData(NULL)); /* create new client data object */
}
/*
ERR_SP(cList=calloc(1,sizeof(CocClient)+clDataSize));
*/
cl->next=cList->next;
cList->next=cl;
h=gethostbyaddr((void *)&cadr.sin_addr, 4, AF_INET);
if (h==NULL) {
logfileOut(LOG_INFO, "(%d) open from %s\n", newfd, "local");
} else {
logfileOut(LOG_INFO, "(%d) open from %s\n", newfd, h->h_name);
}
} else {
cl0=cList; cl=cl0->next;
while (cl!=NULL) {
if (FD_ISSET(cl->fd, &rmask)) {
iret=CocRecv(cl->fd, &buf, -1, NULL);
if (iret<=0) {
logfileOut(LOG_INFO, "(%d) disconnected\n",cl->fd);
close(cl->fd);
FD_CLR(cl->fd, &mask);
cl0->next=cl->next;
FREE(cl);
cl=cl0;
} else {
cl->logmask=0; /* stop output to log client */
lmask=0;
StrReset(&buf);
StrClear(&bufo);
err=NULL;
logfileOut(LOG_NET, "(%d) ", cl->fd);
logfileOutBuf(LOG_NET, &buf);
/* cl->npend=0; why that ? */
logfileOut(LOG_NET, "\n");
cl->synch=buf.buf[0];
ERR_P(StrGet(&buf, NULL, cl->synch));
ERR_I(StrPut(&bufo, "", cl->synch));
while (!StrEnd(&buf)) {
ERR_P(varname=StrGet(&buf, NULL, ' '));
if (cl->synch==COC_MAGIC) { /* access code */
if (0==strcmp(varname,"rdacs")) {
logfileOut(LOG_INFO, "set read mode\n");
cl->mode=1;
ERR_I(StrPut(&bufo, "", COC_SEP)); /* empty message */
} else if (0==strcmp(varname,"rwacs")) {
logfileOut(LOG_INFO, "set write mode\n");
cl->mode=2;
ERR_I(StrPut(&bufo, "", COC_SEP)); /* empty message */
} else {
ERR_I(StrPut(&bufo, "", COC_ERR)); /* signal error message */
ERR_I(StrPut(&bufo, "bad access code", COC_SEP));
}
ERR_P(StrGet(&buf, NULL, COC_NUL)); /* skip separator */
} else if (cl->mode==0) {
ERR_I(StrPut(&bufo, "", COC_ERR)); /* signal terminal error message */
ERR_I(StrPut(&bufo, "no access", COC_SEP));
ERR_P(StrGet(&buf, NULL, COC_NUL)); /* skip separator */
} else {
if (cl->data!=NULL) {
setData(cl->data);
}
var=CocFindVar(varname, &base);
if (var==NULL) {
ERR_I(StrPut(&bufo, "", COC_ERR)); /* signal error message */
ERR_I(StrPut(&bufo, "undefined variable", COC_SEP));
ERR_P(StrGet(&buf, NULL, COC_NUL)); /* skip separator */
} else if (buf.seen) { /* separator was there: set mode */
if (var->access > cl->mode) {
ERR_I(StrPut(&bufo, "", COC_ERR)); /* signal error message */
ERR_I(StrPut(&bufo, "no access", COC_SEP));
ERR_P(StrGet(&buf, NULL, COC_NUL)); /* skip separator */
} else {
ERR_I(CocGetThisVar(var, base, &buf, COC_SEP));
if (0==strcmp(var->name,"loglist")) {
str_upcase(loglist, loglist);
if (NULL!=strchr(loglist,'A')) lmask = lmask | LOG_ALL;
if (NULL!=strchr(loglist,'S')) lmask = lmask | LOG_SER;
if (NULL!=strchr(loglist,'N')) lmask = lmask | LOG_NET;
if (NULL!=strchr(loglist,'I')) lmask = lmask | LOG_INFO;
if (NULL!=strchr(loglist,'M')) lmask = lmask | LOG_MAIN;
ERR_I(StrPut(&bufo, "", COC_NUL)); /* o.k. */
} else {
ERR_I(iret=CocHandleThis(var, base, &bufo, COC_WR, cl->fd));
if (iret) ERR_I(CocPushThisHandler(var, cl, base, iret));
}
modified=1;
}
} else {
ERR_P(StrGet(&buf, NULL, COC_NUL)); /* skip separator */
ERR_I(iret=CocHandleThis(var, base, &bufo, COC_RD, cl->fd));
if (iret) ERR_I(CocPushThisHandler(var, cl, base, iret));
}
}
}
ERR_I(StrGetEnd(&buf));
logfileOut(LOG_NET, " ");
logfileOutBuf(LOG_NET, &bufo);
logfileOut(LOG_NET, "\n");
ERR_I(CocSend(cl->fd, bufo.buf, bufo.wrpos));
cl->logmask=lmask;
}
}
cl0=cl; cl=cl->next;
}
}
if (modified) return(2);
return(3);
OnError: return(-1);
}
int CocHandleRequests(int tmo_msec, int fd) {
int tdif, iret, tim0;
if (modified && fd==0) { /* earlier modification */
modified=0;
return(2);
}
tim0=mycMsecSince(0);
tdif=tmo_msec;
while (tdif>=0) {
ERR_I(iret=CocHandle1Request(tdif, fd));
if (fd==0) {
if (iret==2) return(2); /* modification of a variable */
} else {
if (iret==1) return(1); /* event on fd */
}
if (iret==0) return(0); /* timeout */
tdif = tmo_msec - mycMsecSince(tim0);
}
return(0); /* timeout */
OnError: return(-1);
}
void CocCloseServer() {
CocClient *cl, *cl0;
if (cList) {
cl=cList->next;
while (cl!=NULL) {
close(cl->fd);
cl0=cl;
cl=cl->next;
FREE(cl0);
}
FREE(cList);
}
close(mainFd);
}

View File

@ -1,123 +0,0 @@
#ifndef _SERVER_H_
#define _SERVER_H_
#include "myc_buf.h"
void CocVarList(void **varlist);
/*
instal a variable list
*/
void CocFreeVarList(void);
/*
free variable list
*/
void *CocFindVar(const char *name, void **adr);
/*
find a variable. returns NULL if not found.
*/
int CocPutVar(const char *name, StrBuf *buf, int separator);
/*
put a variable named <name> of variable list <varList> to the buffer <buf>
*/
int CocGetVar(const char *name, StrBuf *buf, int separator);
/*
get a variable named <name> of variable list <varList> from the buffer <buf>
*/
char *CocReadVars(char *str, char stop);
/*
read variables from the string str until a word starts with the stop character
the string has the form [ whitespace var=value ] whitespace stop-character
any text between an exclamation character and the next line break is treated as comment
*/
void CocHdl(int (*handler)(int, void *, int));
/*
define handler for last defined item
*/
int *CocSizePtr(void);
/*
get size pointer from last defined item (only valid when an array)
*/
void *CocIntPtr(int *ptr);
void *CocFltPtr(float *ptr);
void *CocChrPtr(char *ptr);
void *CocDefVar(const char *name, void *var, int type, int size, int access);
void CocDefVarS(const char *name, const char *tname, void *var, int type);
/*
Define variables. Call this routines not directly, but through
one of the macros below.
*/
#define CocDefInt(V,A) CocDefVar(#V,CocIntPtr(&V),COC_INT,0,A)
#define CocDefFlt(V,A) CocDefVar(#V,CocFltPtr(&V),COC_FLT,0,A)
#define CocDefStr(V,A) CocDefVar(#V,CocChrPtr(V),COC_CHAR,sizeof(V),A)
#define CocDefArr(V,A) CocDefVar(#V,CocFltPtr(V),COC_ARRAY,sizeof(V)/sizeof(float),A)
#define CocDefPtr(V,S) CocDefVarS(#V,#S,&V,((V!=(S *)NULL)*0+COC_PTR));
#define CocDefStruct(V,S) CocDefVarS(#V,#S,&V,((&V!=(S *)NULL)*0+COC_STRUCT));
#define CocIntFld(S,V,A) CocDefVar(#S":"#V,CocIntPtr(&((S *)NULL)->V),COC_INT,0,A);
#define CocFltFld(S,V,A) CocDefVar(#S":"#V,CocFltPtr(&((S *)NULL)->V),COC_FLT,0,A);
#define CocStrFld(S,V,A) CocDefVar(#S":"#V,CocChrPtr(((S *)NULL)->V),COC_CHAR,sizeof(((S *)NULL)->V),A);
#define CocArrFld(S,V,A) CocDefVar(#S":"#V,CocFltPtr(((S *)NULL)->V),COC_FLT,sizeof(((S *)NULL)->V)/sizeof(float),A);
#define CocAlias(A,V) CocDefVar(#A, #V, COC_ALIAS,0,0);
#define COC_RDONLY 3
#define COC_RDWR 2
#define COC_RDWRALL 1
#define COC_WR 1
#define COC_RD 2
#define COC_DWR 3
#define COC_DRD 4
#define COC_SHOW 5
#define COC_CHAR 1
#define COC_INT 2
#define COC_FLT 3
#define COC_ARRAY 4
#define COC_PTR 5
#define COC_STRUCT 6
#define COC_TYPE 7
#define COC_ALIAS 8
int CocInitServer(void *(*setDataRtn)(void *), int port);
int CocHandleRequests(int tmo_msec, int fd);
int CocHandle1Request(int tmo_msec, int fd);
/*
handle hetwork requests.
return value: <0: error
=0: timeout
=1: event on fd
=2: variable was changed
=3: other network request treated
CocHandle1Request handles only one network request
For CocHandleRequests:
if fd=0: returns when a network request has changed a variable,
or when timeout has expired (result is 0 or 2)
if fd>0: returns when an read event is pending on fd
or when timeout has expired (result is 0 or 1)
*/
/* server handlers removed
int CocPushHandler(const char *name);
*/
int CocCallHandlers(void);
void CocShowHandlers(char *buf, int buf_len);
void CocCloseServer(void);
#endif /* _SERVER_H_ */

View File

@ -1,113 +0,0 @@
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <string.h>
#include "myc_err.h"
#include "myc_str.h"
#include "coc_util.h"
#include "uselect.h"
/*-------------------------------------------------------------------------*/
/* CreateSocketAddress stolen from Tcl. Thanks to John Ousterhout */
int CocCreateSockAdr(
struct sockaddr_in *sockaddrPtr, /* Socket address */
const char *host, /* Host. NULL implies INADDR_ANY */
int port) /* Port number */
{
struct hostent *hostent; /* Host database entry */
struct in_addr addr; /* For 64/32 bit madness */
(void) memset((char *) sockaddrPtr, '\0', sizeof(struct sockaddr_in));
sockaddrPtr->sin_family = AF_INET;
sockaddrPtr->sin_port = htons((unsigned short) (port & 0xFFFF));
if (host == NULL || host[0]=='\0') {
addr.s_addr = INADDR_ANY;
} else {
hostent = gethostbyname(host);
if (hostent != NULL) {
memcpy((char *) &addr,
(char *) hostent->h_addr_list[0], (size_t) hostent->h_length);
} else {
addr.s_addr = inet_addr(host);
if (addr.s_addr == (unsigned long)-1) {
return -1; /* error */
}
}
}
/*
* There is a rumor that this assignment may require care on
* some 64 bit machines.
*/
sockaddrPtr->sin_addr.s_addr = addr.s_addr;
return 0;
}
/*-------------------------------------------------------------------------*/
void CocDelay(int msec) {
struct timeval tmo;
tmo.tv_sec=msec / 1000;
tmo.tv_usec=(msec % 1000)*1000+1;
uselect(1,NULL,NULL,NULL,&tmo);
}
/*-------------------------------------------------------------------------*/
int CocSend(int fd, char *str, int size) {
int siz;
siz=htonl(size);
ERR_SI(send(fd, &siz, 4, 0));
ERR_SI(send(fd, str, size, 0));
return(0);
OnError: return(-1);
}
/*-------------------------------------------------------------------------*/
int CocRecv(int fd, StrBuf *buf, int timeout, int *flag) {
struct timeval tmo={0,1};
fd_set mask;
int i, l;
int siz, n;
if (timeout>=0) {
tmo.tv_sec=timeout;
FD_ZERO(&mask);
FD_SET(fd, &mask);
ERR_SI(i=uselect(fd+1,&mask,NULL,NULL,&tmo));
if (flag!=NULL) {
*flag=0;
if (i==0) return(0);
} else {
if (i==0) { ERR_MSG("time out"); }
}
}
n=0;
ERR_SI(i=recv(fd, &n, 4, 0));
if (i!=4) {
ERR_COD(ECONNREFUSED);
}
siz=ntohl(n);
if (siz > buf->dsize)
ERR_MSG("buffer too small");
ERR_SI(l=recv(fd, buf->buf, siz, 0));
buf->wrpos=l;
while (buf->wrpos<siz) {
if (l==0) {
ERR_COD(ECONNRESET);
}
ERR_SI(l=recv(fd, buf->buf+buf->wrpos, siz, 0));
buf->wrpos+=l;
}
StrReset(buf);
return(buf->wrpos);
OnError: return(-1);
}

View File

@ -1,45 +0,0 @@
#ifndef _COC_UTIL_H_
#define _COC_UTIL_H_
#include <netinet/in.h>
#include "myc_buf.h"
#define COC_CMD_LEN 256
/* the follwing should be larger than 4x(largest array)+length of additional parameters */
#define COC_RES_LEN 50000
int CocCreateSockAdr(
struct sockaddr_in *sockaddrPtr, /* Socket address */
const char *host, /* Host. NULL implies INADDR_ANY */
int port); /* Port number */
/*
compose internet address
*/
void CocDelay(int msec);
/*
system independent delay function with msec resolution
*/
int CocSend(int fd, char *buf, int size);
/*
send a message
*/
int CocRecv(int fd, StrBuf *buf, int timeout, int *flag);
/*
receive message
if flag is NULL, a timeout generates an error
else *flag is set to zero between the select and the recv command
*/
#define COC_SEP '\0'
#define COC_DELAYED '\1'
#define COC_ERR '\2'
#define COC_TRM '\3'
#define COC_SYN0 '\4'
#define COC_SYN1 '\5'
#define COC_MAGIC '\6'
#define COC_CLRLOG '\7'
#endif /* _COC_UTIL_H_ */

View File

@ -1,735 +0,0 @@
program conv
include 'conv.inc'
logical init
integer i,j,l,lin,iostat
character*128 line
character*2048 input
data lun/0/,pos/0/,nlist/0/
path=' '
lp=0
verbose=.false.
call sys_get_cmdpar(input, l)
if (input .eq. ' ') then
verbose=.true.
print '(a,$)',
1' File(s) (separated with space): '
read(*,'(a)',end=99) input
if (input .eq. ' ') goto 99
endif
i=index(input, '-p')
if (i .ne. 0) then ! first path option valid from start
j=index(input(i+1:), ' ')
call str_trim(path, input(i+2:i+j), lp)
endif
i=0
do while (input(i+1:) .ne. ' ')
j=index(input(i+1:), ' ')
if (j .le. 1) then
i=i+1
else if (input(i+1:i+2) .eq. '-p') then
call str_trim(path, input(i+3:i+j), lp)
i=i+j
else if (input(i+1:i+1) .eq. '-') then
print *,'unknown option: ',input(i+1:i+j)
i=i+j
else
call str_trim(file, input(i+1:i+j), lf)
i=i+j
if (verbose) print *
open(1,name=file(1:lf),status='old',iostat=iostat)
if (iostat .ne. 0) then
if (verbose) then
print *,'can not open ',file(1:lf)
print "(x,60('-'))"
endif
nlist=nlist+1
list(nlist)='can not open '//file(1:lf)
else
lin=0
do
call lsc_errinit(1) ! 1=lun
call lsc_convert_table(lin)
if (lin .lt. 0) goto 19
if (verbose) print "(x,60('-'))"
enddo
19 continue
close(1)
endif
endif
enddo
do i=1,nlist
call str_trim(list(i), list(i), l)
print *,list(i)(1:l)
enddo
99 continue
end
subroutine pack(line, l, x, y, offset, m)
character line*(*)
integer l, offset, m
real x(m), y(m)
integer j,p
p=0
do j=1,m
call str_append(line, p, '#0,')
call cvt_real_str(line(p+1:), l, 1.0*(offset+j), 1, 0, 6, 3)
p=p+l
call str_append(line, p, ':')
call cvt_real_str(line(p+1:), l, x(j), 1, 0, 6, 3)
p=p+l
call str_append(line, p, ',')
call cvt_real_str(line(p+1:), l, y(j), 1, 0, 6, 3)
p=p+l
call str_append(line, p, ';')
enddo
line(p:p)=' '
l=p-1
end
subroutine lsc_convert_table(lin)
implicit none
include 'conv.inc'
integer lin
integer ntypes,nvolts, namps
parameter (ntypes=12, nvolts=12, namps=12)
integer np
real x(200), y(200), ex, ey
integer i,j,l,p,li,crc,form,iostat
character name*15, sensor*10, header*64, line*128, old*128, intype*16
character crcmp*3, filnam*128, cfgdir*128
character c40*40/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$+-&'/
integer unit, stype, excit, irange, coef, iunit, stdcurv
! codes
character types(0:ntypes)*12/'Special','Si Diode','GaAlAs Diode'
1 ,'Pt250 Ohm','Pt500 Ohm','Pt2500 Ohm','RhFe','C-Glass'
1 ,'Cernox','RuOx','Ge','Cap','Tc'/
integer nunits
parameter (nunits=3)
character units(nunits)*5/'mV','V','Ohm'/
integer nexcits
parameter (nexcits=12)
character excits(0:nexcits)*8/'Off','30nA','100nA','300nA','1uA','3uA'
1 ,'10uA','30uA','100uA','300uA','1mA','10mV','1mV'/
integer nforms
parameter (nforms=5)
character forms(nforms)*6/'ill','ill','lin','log','loglog'/
! default values
integer defu(ntypes)/ 1, 1, 2, 2,2, 2, 2, 2, 2, 2, 3, 1/ ! unit
integer defe(ntypes)/ 6, 6,10,10,8,10,11,11,11,12, 0, 0/ ! excit
integer defr(ntypes)/11,12, 8, 9,8, 8, 4, 4, 4, 1, 1, 6/ ! range
integer defc(ntypes)/ 1, 1, 2, 2,2, 2, 1, 1, 1, 1, 2, 2/ ! coef
real volts(nvolts)/1E-3,2.5E-3,5E-3,1E-2,2.5E-2,5E-2
1 ,1E-1,2.5E-1,5E-1,1E-0,2.5E-0,5E-0/
real amps(namps)/3E-8,1E-7,3E-7,1E-6,3E-6,1E-5,3E-5,1E-4,3E-4,1E-3
1 ,3E-8,3E-8/ ! minimal values are for voltage excitation
integer stdmax
parameter (stdmax=10)
character*40 stdhdr(stdmax)/
1 'DT-470 ,Standard ,2,+475.000E+0,1',
1 'DT-500-D ,Standard ,2,+365.000E+0,1',
1 'DT-500-E1 ,Standard ,2,+330.000E+0,1',
1 'PT-100 ,Standard ,3,+800.000E+0,2',
1 'PT-1000 ,Standard ,3,+800.000E+0,2',
1 'TYPE K ,Standard ,1,+1645.00E+0,2',
1 'TYPE E ,Standard ,1,+1188.50E+0,2',
1 'TYPE T ,Standard ,1,+673.000E+0,2',
1 'CrAuFe.03%,Standard ,1,+500.000E+0,2',
1 'CrAuFe.07%,Standard ,1,+610.000E+0,2'/
integer stdtype(stdmax)/1,1,1,4,5,12,12,12,12,12/
real tlim, range, xmax, ymax, curr, rl
real x1,x2,xi,y1,y2,yi,sum,sum1,sum2,mum,mum1,mum2,d,at,at1,at2
logical eof, first, inverted
! functions
integer lsc_getno
external lsc_getno, pack
first=.true.
eof=.false.
np=0
name=' '
sensor=' '
unit=0
tlim=0
stype=0
excit=0
form=0
range=-1.0
stdcurv=0
1 read(1,'(a)',err=97,end=97) line
call str_trim(line, line, l)
lin=lin+1
call str_first_nonblank(line, i)
if (i .eq. 0) goto 1
if (line(i:i) .eq. '!') goto 1
first=.false.
call str_upcase(line(1:l),line(i:l))
i=index(line(1:l),'!')
if (i .ne. 0) line=line(1:i-1)
call str_trim(line(1:l),line(1:l),l)
if (line(1:4) .ne. 'CURV') then
i=index(line,'=')
if (i .eq. 0) then
call lsc_error(lin, 'missing "="')
goto 1
endif
if (i .eq. l) then
call lsc_error(lin, 'missing value')
goto 1
endif
call str_first_nonblank(line(i+1:l), j)
i=i+j
if (line(1:4) .eq. 'SENS') then
sensor=line(i:l)
name=sensor
elseif (line(1:4) .eq. 'UNIT') then
unit=lsc_getno(units, nunits, line(i:l))
if (unit .le. 0) call lsc_error(lin, 'illegal unit')
elseif (line(1:4) .eq. 'TLIM') then
read(line(i:l),*,err=92,end=92) tlim
elseif (line(1:4) .eq. 'TYPE') then
stype=lsc_getno(types, ntypes+1, line(i:l))-1
if (stype .lt. 0) call lsc_error(lin, 'illegal type')
elseif (line(1:4) .eq. 'EXCI') then
call str_substitute(line(1:8),line(i:l),' ',char(0))
excit=lsc_getno(excits, nexcits, line(1:8))-1
if (excit .lt. 0) call lsc_error(lin, 'illegal excitation')
elseif (line(1:4) .eq. 'RANG') then
read(line(i:l),*,err=93,end=93) range
if (range .lt. 0) goto 93
elseif (line(1:4) .eq. 'FORM') then
form=lsc_getno(forms, nforms, line(i:l))
if (form .lt. 3) call lsc_error(lin, 'illegal format')
else
call lsc_error(lin, 'unknown parameter name')
endif
goto 1
endif
if (sensor .eq. ' ') call lsc_error(lin, 'missing sensor name')
i=index(line,'=')
if (i .ne. 0) then
read(line(i+1:l), *, err=2,end=2) stdcurv
2 continue
if (stdcurv .lt. 0 .or. stdcurv .gt. stdmax) then
call lsc_error(lin, 'illegal standard curve no.')
goto 101
endif
if (unit .ne. 0 .or. stype .ne. 0 .or.
1 excit .ne. 0 .or. tlim .ne. 0) then
if (verbose) then
print *,'Warning: all parameters except "sens"'
1 ,', "range" and "curv" are ignored',char(7)
endif
errstat=max(errstat,1)
endif
line=stdhdr(stdcurv)
i=index(line, ',')
if (i .eq. 0) goto 96 ! illegal stdhdr
j=index(line(i+1:), ',')
if (j .eq. 0) goto 96 ! illegal stdhdr
read(line(i+j+1:), *, err=96, end=96) unit, ymax, coef
stype=stdtype(stdcurv)
! if (range .lt. 0) then
! range=stdrange(stdcurv)
! end if
xmax=0
excit=0
tlim=0
goto 100
endif
if (line(5:) .ne. ' ') then
call lsc_error(lin, 'missing "="')
goto 101
end if
! user curve
if (unit .eq. 0) call lsc_error(lin, 'missing unit')
if (stype .eq. 0) then
if (excit .le. 0) call lsc_error(lin, 'missing excitation')
if (range .lt. 0) call lsc_error(lin, 'missing range')
else
if (excit .eq. 0) excit=defe(stype)
endif
3 np=np+1
read(1,'(a)',err=98,end=98) line
lin=lin+1
if (line .eq. ' ') goto 9
read(line, *, err=94, end=94) x(np), y(np)
goto 3
92 call lsc_error(lin,'illegal tlim')
goto 1
93 call lsc_error(lin,'illegal range')
goto 1
94 call lsc_error(lin,'illegal datapoint')
goto 101
95 call lsc_error(lin,'illegal table no')
goto 1
96 stop 'internal error: illegal stdhdr'
97 if (.not. first) then
call lsc_error(lin,'unexpected end of file')
endif
lin=-1
RETURN
98 eof=.true.
9 np=np-1 ! point (np) is not valid
if (np .lt. 2) call lsc_error(lin+np, 'not enough data points')
if (x(np) .lt. x(1)) then ! inverse order
j=np
do i=1,np/2
ex=x(i)
ey=y(i)
x(i)=x(j)
y(i)=y(j)
x(j)=ex
y(j)=ey
j=j-1
enddo
inverted=.true.
else
inverted=.false.
endif
do i=2,np
if (x(i) .le. x(i-1)) then
j=i
if (inverted) j=np-i+1
call lsc_error(lin+j, 'table not ordered')
goto 101
endif
enddo
xmax=x(np)
if (y(np) .lt. y(1)) then
coef=1
do i=2,np
if (y(i) .ge. y(i-1)) then
j=i
if (inverted) j=np-i+1
call lsc_error(lin+j, 'table not ordered')
goto 101
endif
enddo
ymax=y(1)
else
coef=2
do i=2,np
if (y(i) .le. y(i-1)) then
j=i
if (inverted) j=np-i+1
call lsc_error(lin+j, 'table not ordered')
goto 101
endif
enddo
ymax=y(np)
endif
101 continue
do i=1,np
if (x(i) .eq. 0.0) then
j=i
if (inverted) j=np-i+1
call lsc_error(lin+j, 'illegal sensor value')
endif
if (y(i) .le. 0.0) then
j=i
if (inverted) j=np-i+1
call lsc_error(lin+j, 'illegal temperature')
endif
enddo
if (errstat .gt. 1) goto 999
sum=0
sum1=0
sum2=0
mum=0
mum1=0
mum2=0
do i=2,np-1
xi=x(i)
x1=x(i-1)
x2=x(i+1)
yi=log(y(i))
y1=y(i-1)
y2=y(i+1)
d=abs(yi-log(y1+(xi-x1)/(x2-x1)*(y2-y1)))
sum=sum+d*d
if (d .gt. mum) then
mum=d
at=y(i)
endif
xi=log(abs(xi))
x1=log(abs(x1))
x2=log(abs(x2))
d=abs(yi-log(y1+(xi-x1)/(x2-x1)*(y2-y1)))
sum1=sum1+d*d
if (d .gt. mum1) then
mum1=d
at1=y(i)
endif
y1=log(y1)
y2=log(y2)
d=abs(yi-(y1+(xi-x1)/(x2-x1)*(y2-y1)))
sum2=sum2+d*d
if (d .gt. mum2) then
mum2=d
at2=y(i)
endif
enddo
if (np .gt. 2) then
sum=sqrt(sum/(np-1))*25
sum1=sqrt(sum1/(np-1))*25
sum2=sqrt(sum2/(np-1))*25
if (verbose) then
print '(x,a)','Interpolation accuracy mean worst at'
print '(13x,a,3(f8.2,a))','linear ',sum, '%',mum *25,'%',at,' K'
print '(13x,a,3(f8.2,a))','log/lin ',sum1,'%',mum1*25,'%',at1,' K'
print '(13x,a,3(f8.2,a))','log/log ',sum2,'%',mum2*25,'%',at2,' K'
endif
if (unit .eq. 3) then
sum1=(sum1/sum)**2+(mum1/mum)**2
sum2=(sum2/sum)**2+(mum2/mum)**2
if (form .eq. 0 .and. (sum1 .lt. 1.0 .or. sum2 .lt. 1.0)
1 .or. form .gt. 3) then
if (form .eq. 0 .and. sum2 .lt. sum1 .or. form .eq. 5) then
unit=5
do i=1,np
y(i)=log10(y(i))
enddo
else
unit=4
endif
do i=1,np
x(i)=log10(x(i))
enddo
endif
else
if (form .gt. 3 .and. verbose)
1 print *,'FORM ignored (not unit Ohm)'
endif
endif
100 continue
if (unit .eq. 1) then ! check for mV / V consistency
if (xmax .gt. 990) then
unit=2
do i=1,np
x(i)=x(i)/1000.0
enddo
endif
xmax=xmax/1000.0
range=range/1000.0
elseif (unit .eq. 2) then
if (xmax .lt. 0.5) then
unit=1
do i=1,np
x(i)=x(i)*1000.0
enddo
endif
endif
if (range .eq. 0) range=xmax
if (tlim .eq. 0 .or. tlim .gt. ymax) tlim=ymax
irange=0
if (range .gt. 0) then
if (unit .ge. 3) then ! Ohm
curr=amps(excit)
rl=range*curr ! convert Ohm to V
if (rl .gt. 5.0) then
! print *,'Warning: maximum range exceeded: '
! 1 , range,'>',5/curr,' Ohm',char(7)
! errstat=max(errstat,1)
irange=12
endif
else
rl=range ! V
endif
if (irange .eq. 0) then
if (stype.eq.12) then
j=6
else
j=nvolts
end if
do i=1,j
if (rl .le. volts(i)) then
irange=i
goto 150
endif
enddo
! print *,'Warning: maximum range exceeded: ', range,' > ',volts(j),' V',char(7)
! errstat=max(errstat,1)
irange=j
150 continue
if (excit .eq. 11) then ! 10 mV excit -> min. 10 mV range
if (irange .lt. 4) irange=4
endif
endif
else
irange=defr(stype)
range=xmax
endif
if (stdcurv.eq.0) then
if (unit .ge. 3) then
if (range*amps(excit) .gt. volts(irange)) then
print *,'Warning: max. range exceeded: '
1 ,range,' > ',volts(irange)/amps(excit),' Ohm',char(7)
errstat=max(errstat,1)
endif
else if (range .gt. volts(irange)) then
print *,'Warning: max. range exceeded: '
1 ,range,' > ',volts(irange), ' V',char(7)
errstat=max(errstat,1)
endif
endif
if (stype .gt. 0) then
if (excit .le. 0) excit=defe(stype)
if (irange .eq. 0) irange=defr(stype)
endif
if (verbose) then
print *,'Sensor type: ',types(stype)
print *,'Excitation: ',excits(excit)
if (unit .eq. 1) then
print *,'Sensor Range: ',volts(irange)*1000,' mV'
elseif (unit .eq. 2) then
print *,'Sensor Range: ',volts(irange),' V'
else
print *,'Sensor Range: ',volts(irange)/amps(excit),' Ohm'
if (unit .eq. 5) then
print *,'table double logarithmic'
elseif (unit .eq. 4) then
print *,'table logarithmic'
else
print *,'table linear'
endif
endif
if (coef .eq. 1) then
print *,'negative characteristic'
else
print *,'positive characteristic'
endif
print *
endif
if (stype .eq. 0) then
if (unit .ge. 3) then
iunit=2
else
iunit=1
endif
else
if (unit .le. 2) then ! mV / V
iunit=1
else ! Ohm
iunit=2
endif
if (iunit .ne. defu(stype) .or.
1 coef .ne. defc(stype) .or.
1 excit .ne. defe(stype) .or.
1 irange.ne. defr(stype)) then
if (stype .ne. 12) stype=0
endif
endif
if (stype .eq. 12) then
l=5
write (line(1:l), '(a,i1)') ',,,,',max(0,irange-5)
elseif (stype .eq. 0) then
l=14
write (line(1:l), '(i2,4(a,i2.0))')
1 stype,',',iunit,',',coef,',',excit,',',irange
else
l=2
write(line(1:l), '(i2)') stype
endif
call str_substitute(intype, line(1:l), ' ', char(0))
call str_trim(intype, intype, li)
if (tlim .gt. 1500) tlim=1500
if (tlim .lt. 0) tlim=0
if (stdcurv.eq.0) then
! calculate crc of table
crc=0
do i=1,np
call pack(line, l, x(i), y(i), i-1, 1)
call str_crc(crc, line(1:l))
enddo
call str_crc_comp(crc, crcmp)
write (header, "(a,x,a,',',a,',',i1,',',f8.3,',',i1)")
1 name(1:11), crcmp,sensor,unit,tlim,coef
else
crc=0
header=stdhdr(stdcurv)
endif
! compare with old file
call str_trim(filnam, sensor, l)
call str_lowcase(filnam, filnam)
filnam(l+1:)='.crv'
if (path(1:lp) .ne. ' ') then
filnam=path(1:lp)//filnam
endif
open(unit=2, file=filnam, status='old', iostat=iostat)
if (iostat .ne. 0) goto 198
read(2, '(a)',end=199) old
if (old .ne. header) goto 199
read(2, '(a)', end=199) old
if (old .ne. intype) goto 199
if (stdcurv .ne. 0) then
write(line, '(a, i2)') '$',stdcurv
read(2, '(a)', end=199) old
if (line .ne. old) goto 199
read(2, '(a)', end=197) old ! goto end (o.k.) if no more line
goto 199
endif
do i=1,np,ncolumn
read(2, '(a)', end=199) old
call pack(line, l, x(i), y(i), i-1, min(ncolumn,np-i+1))
if (line .ne. old) goto 199
enddo
read(2, '(a)', end=199) old
call pack(line, l, 0.0, 0.0, np, 1)
if (line .ne. old) goto 199
read(2, '(a)', end=197) old ! goto end (o.k.) if no more line
goto 199
197 close(2)
if (verbose) print *,'curve file has not changed: ',filnam
goto 200
! goto 999
198 if (verbose) print *,'create new curve file: ',filnam
nlist=nlist+1
list(nlist)='created '//filnam
goto 200
199 close(2)
if (verbose) print *,'modify curve file: ',filnam
nlist=nlist+1
list(nlist)='modified '//filnam
200 continue
open(unit=2, file=filnam, status='unknown', iostat=iostat)
if (iostat .ne. 0) then
call str_trim(filnam, filnam, l)
print *,'can not open ',filnam(1:l)
nlist=nlist-1
lin=-1
return
endif
call str_trim(header, header, l)
write(2, '(a)') header(1:l)
write(2, '(a)') intype(1:li)
if (stdcurv .ne. 0) then
write(2, '(a,i2)') '$',stdcurv
else
do i=1,np,ncolumn
call pack(line, l, x(i), y(i), i-1, min(ncolumn,np-i+1))
write(2,'(a)') line(1:l)
enddo
call pack(line, l, 0.0, 0.0, np, 1)
write(2,'(a)') line(1:l)
endif
close(2)
999 continue
if (errstat .gt. 0) then
if (name.eq.' ') name='<unknown>'
nlist=nlist+1
if (errstat .gt. 1) then
list(nlist)='error in '//file(1:lf)//', curve '//name
if (verbose) print *,'no curve file written'
lin=-1
else
list(nlist)='warning in '//file(1:lf)//', curve '//name
endif
endif
if (eof) lin=-1
return
end
integer function lsc_getno(list, n, name)
integer n
character list(n)*(*), name*(*)
character str*32
integer i,l
call str_trim(name, name, l)
l=min(l,len(str))
do i=1,n
call str_upcase(str(1:l), list(i))
if (name(1:l) .eq. str(1:l)) then
lsc_getno=i
RETURN
endif
enddo
lsc_getno=0
end
subroutine lsc_errinit(lunit)
include 'conv.inc'
integer lunit
lun=lunit
pos=0
errstat=0
end
subroutine lsc_error(lin, text)
include 'conv.inc'
integer lin
character text*(*)
integer i,l
character line*132
if (pos .eq. 0) then
print *
endif
if (lin .gt. pos) then
rewind lun
do i=1,lin-1
read(lun, '(a)', end=8) line
call str_trim(line, line, l)
if (i .gt. max(pos,lin-3)) then
print '(5x,a)',line(1:l)
endif
enddo
read(lun, '(a)', end=8) line
call str_trim(line, line, l)
print '(x,2a)','>>> ',line(1:l)
8 pos=lin
errstat=2
endif
9 print '(x,a)', text
end

View File

@ -1,665 +0,0 @@
program conv
use strings
integer, parameter :: ncolumn=3
logical init
integer lun/0/,pos/0/,nlist/0/,ctx/0/
integer i,l,lin
character*128 file, input, list(1000), line
logical wild
integer errstat
call sys_get_cmdpar(input, l)
if (input .ne. ' ') then
i=index(input, '.')
if (i .ne. 0) input(i:)=' '
endif
if (input == ' ') then
print '(a,$)',' Device(s) (lowercase, separated by space, return for all): '
read(*,'(a)',end=99) input
endif
if (input == 'all') input=' '
open(3, file='src/cfg/tecs.cfg', status='old',readonly,iostat=i)
if (i .ne. 0) then
print *,'can not open tecs.cfg'
end if
do
read(3, '(a)', iostat=i) line
if (i .ne. 0) EXIT
i=index(line, "'")
if (i==0) CYCLE
file=line(i+1:)
i=index(file, "'")
if (i<2) CYCLE
file(i:i)=' '
if (input .ne. ' ' .and. index(' '//input, ' '//file(1:i)) .eq. 0) CYCLE
file(i:)='.inp'
l=i+3
print *
open(1,name='src/cfg/'//file(1:l),status='old',readonly,iostat=i)
if (i .ne. 0) then
print *,'can not open ',file(1:l)
print "(x,60('-'))"
nlist=nlist+1
list(nlist)='can not open '//file(1:l)
else
lin=0
do
print "(x,60('-'))"
call lsc_errinit(1) ! 1=lun
call lsc_convert_table(lin, file(1:l))
if (lin<0) EXIT
enddo
close(1)
endif
enddo
print "(x,60('-'))"
do i=1,nlist
call str_trim(list(i), list(i), l)
print *,list(i)(1:l)
enddo
99 continue
contains
subroutine pack(line, l, x, y, offset, m)
character line*(*)
integer l, offset, m
real x(m), y(m)
integer j,p
p=0
do j=1,m
call str_append(line, p, '#0,')
call str_fmt_real(line(p+1:), l, 1.0*(offset+j), 1, 0, 6, 3)
p=p+l
call str_append(line, p, ':')
call str_fmt_real(line(p+1:), l, x(j), 1, 0, 6, 3)
p=p+l
call str_append(line, p, ',')
call str_fmt_real(line(p+1:), l, y(j), 1, 0, 6, 3)
p=p+l
call str_append(line, p, ';')
enddo
line(p:p)=' '
l=p-1
end subroutine
subroutine lsc_convert_table(lin, file)
implicit none
integer lin
character(len=*) file
integer, parameter :: ntypes=12, nvolts=12, namps=12
integer n
real x(200), y(200), ex, ey
integer i,j,l,p,li,crc,form
character name*15, sensor*10, header*64, line*128, old*128, intype*16
character crcmp*3, filnam*24
character months*12/'123456789ond'/
character c40*40/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$+-&'/
integer unit, type, excit, irange, coef, iunit, stdcurv
! codes
character types(0:ntypes)*12/'Special','Si Diode','GaAlAs Diode' &
,'Pt250 Ohm','Pt500 Ohm','Pt2500 Ohm','RhFe','C-Glass' &
,'Cernox','RuOx','Ge','??','TC'/
integer, parameter :: nunits=3
character units(nunits)*5/'mV','V','Ohm'/
integer, parameter :: nexcits=12
character excits(0:nexcits)*8/'Off','30nA','100nA','300nA','1uA','3uA' &
,'10uA','30uA','100uA','300uA','1mA','10mV','1mV'/
integer, parameter :: nforms=5
character forms(nforms)*6/'ill','ill','lin','log','loglog'/
! default values
integer defu(ntypes)/ 1, 1, 2, 2,2, 2, 2, 2, 2, 2, 3, 1/ ! unit
integer defe(ntypes)/ 6, 6,10,10,8,10,11,11,11,12, 0, 0/ ! excit
integer defr(ntypes)/11,12, 8, 9,8, 8, 4, 4, 4, 1, 1, 6/ ! range
integer defc(ntypes)/ 1, 1, 2, 2,2, 2, 1, 1, 1, 1, 2, 2/ ! coef
real volts(nvolts)/1E-3,2.5E-3,5E-3,1E-2,2.5E-2,5E-2 &
,1E-1,2.5E-1,5E-1,1E-0,2.5E-0,5E-0/
real amps(namps)/3E-8,1E-7,3E-7,1E-6,3E-6,1E-5,3E-5,1E-4,3E-4,1E-3 &
,3E-8,3E-8/ ! minimal values are for voltage excitation
integer, parameter :: stdmax=10
character (len=40) stdhdr(stdmax)/ &
'DT-470 ,Standard ,2,+475.000E+0,1', &
'DT-500-D ,Standard ,2,+365.000E+0,1', &
'DT-500-E1 ,Standard ,2,+330.000E+0,1', &
'PT-100 ,Standard ,3,+800.000E+0,2', &
'PT-1000 ,Standard ,3,+800.000E+0,2', &
'TYPE K ,Standard ,1,+1645.00E+0,2', &
'TYPE E ,Standard ,1,+1188.50E+0,2', &
'TYPE T ,Standard ,1,+673.000E+0,2', &
'CrAuFe.03%,Standard ,1,+500.000E+0,2', &
'CrAuFe.07%,Standard ,1,+610.000E+0,2'/
integer stdtype(stdmax)/1,1,1,4,5,12,12,12,12,12/
real tlim, range, xmax, ymax, curr, rl
real x1,x2,xi,y1,y2,yi,sum,sum1,sum2,mum,mum1,mum2,d,at,at1,at2
logical eof, first
first=.true.
eof=.false.
n=0
name=' '
sensor=' '
unit=0
tlim=0
type=0
excit=0
form=0
range=-1.0
stdcurv=0
1 read(1,'(q,a)',err=97,end=97) l,line
lin=lin+1
l=max(1,min(l,len(line)))
call str_first_nonblank(line, i)
if (i .eq. 0) goto 1
if (line(i:i) .eq. '!') goto 1
first=.false.
call str_upcase(line(1:l),line(i:l))
i=index(line(1:l),'!')
if (i .ne. 0) line=line(1:i-1)
call str_trim(line(1:l),line(1:l),l)
if (line(1:4) .ne. 'CURV') then
i=index(line,'=')
if (i .eq. 0) then
call lsc_error(lin, 'missing "="')
goto 1
endif
if (i .eq. l) then
call lsc_error(lin, 'missing value')
goto 1
endif
call str_first_nonblank(line(i+1:l), j)
i=i+j
if (line(1:4) .eq. 'NAME') then
call str_lowcase(name,line(i:l))
elseif (line(1:4) .eq. 'SENS') then
sensor=line(i:l)
elseif (line(1:4) .eq. 'UNIT') then
unit=lsc_getno(units, nunits, line(i:l))
if (unit .le. 0) call lsc_error(lin, 'illegal unit')
elseif (line(1:4) .eq. 'TLIM') then
read(line(i:l),*,err=92,end=92) tlim
elseif (line(1:4) .eq. 'TYPE') then
type=lsc_getno(types, ntypes, line(i:l))-1
if (type .lt. 0) call lsc_error(lin, 'illegal type')
elseif (line(1:4) .eq. 'EXCI') then
call str_substitute(line(1:8),line(i:l),' ',char(0))
excit=lsc_getno(excits, nexcits, line(1:8))-1
if (excit .lt. 0) call lsc_error(lin, 'illegal excitation')
elseif (line(1:4) .eq. 'RANG') then
read(line(i:l),*,err=93,end=93) range
if (range .lt. 0) goto 93
elseif (line(1:4) .eq. 'FORM') then
form=lsc_getno(forms, nforms, line(i:l))
if (form .lt. 3) call lsc_error(lin, 'illegal format')
else
call lsc_error(lin, 'unknown parameter name')
endif
goto 1
endif
if (name .eq. ' ') call lsc_error(lin, 'missing name')
i=index(line,'=')
if (i .ne. 0) then
read(line(i+1:l), *, err=2,end=2) stdcurv
2 continue
if (stdcurv<0 .or. stdcurv>stdmax) then
call lsc_error(lin, 'illegal standard curve no.')
goto 101
endif
if (unit/=0 .or. type/=0 .or. &
excit/=0 .or. tlim/=0 .or. sensor/=' ') then
print *,'Warning: all parameters except "name", "range" and "curv" are ignored',char(7)
errstat=max(errstat,1)
endif
line=stdhdr(stdcurv)
i=index(line, ',')
if (i .eq. 0) goto 96 ! illegal stdhdr
j=index(line(i+1:), ',')
if (j .eq. 0) goto 96 ! illegal stdhdr
read(line(i+j+1:), *, err=96, end=96) unit, ymax, coef
type=stdtype(stdcurv)
! if (range < 0) then
! range=stdrange(stdcurv)
! end if
xmax=0
excit=0
tlim=0
goto 100
endif
if (line(5:) /= ' ') then
call lsc_error(lin, 'missing "="')
goto 101
end if
! user curve
if (unit .eq. 0) call lsc_error(lin, 'missing unit')
if (type .eq. 0) then
if (excit .le. 0) call lsc_error(lin, 'missing excitation')
if (range .lt. 0) call lsc_error(lin, 'missing range')
else
if (excit .eq. 0) excit=defe(type)
endif
3 n=n+1
read(1,'(a)',err=98,end=98) line
lin=lin+1
if (line .eq. ' ') goto 9
read(line, *, err=94, end=94) x(n), y(n)
goto 3
92 call lsc_error(lin,'illegal tlim')
goto 1
93 call lsc_error(lin,'illegal range')
goto 1
94 call lsc_error(lin,'illegal datapoint')
goto 101
95 call lsc_error(lin,'illegal table no')
goto 1
96 stop 'internal error: illegal stdhdr'
97 if (.not. first) then
call lsc_error(lin,'unexpected end of file')
endif
lin=-1
RETURN
98 eof=.true.
9 x(n)=0
y(n)=0
if (n .lt. 3) call lsc_error(lin+n-1, 'not enough data points')
if (x(n-1) .lt. x(1)) then ! inverse order
j=n
do i=1,n/2
j=j-1
ex=x(i)
ey=y(i)
x(i)=x(j)
y(i)=y(j)
x(j)=ex
y(j)=ey
enddo
endif
do i=2,n-1
if (x(i) .le. x(i-1)) then
call lsc_error(lin+n, 'table not ordered')
goto 101
endif
enddo
xmax=x(n-1)
if (y(n-1) .lt. y(1)) then
coef=1
do i=2,n-1
if (y(i) .ge. y(i-1)) then
call lsc_error(lin+n, 'table not ordered')
goto 101
endif
enddo
ymax=y(1)
else
coef=2
do i=2,n-1
if (y(i) .le. y(i-1)) then
call lsc_error(lin+n, 'table not ordered')
goto 101
endif
enddo
ymax=y(n-1)
endif
101 continue
do i=1,n-1
if (x(i) .le. 0.0) call lsc_error(lin+n, 'illegal sensor value')
if (y(i) .le. 0.0) call lsc_error(lin+n, 'illegal temperature')
enddo
if (errstat .gt. 1) goto 999
sum=0
sum1=0
sum2=0
mum=0
mum1=0
mum2=0
do i=2,n-2
xi=x(i)
x1=x(i-1)
x2=x(i+1)
yi=log(y(i))
y1=y(i-1)
y2=y(i+1)
d=abs(yi-log(y1+(xi-x1)/(x2-x1)*(y2-y1)))
sum=sum+d*d
if (d .gt. mum) then
mum=d
at=y(i)
endif
xi=log(xi)
x1=log(x1)
x2=log(x2)
d=abs(yi-log(y1+(xi-x1)/(x2-x1)*(y2-y1)))
sum1=sum1+d*d
if (d .gt. mum1) then
mum1=d
at1=y(i)
endif
y1=log(y1)
y2=log(y2)
d=abs(yi-(y1+(xi-x1)/(x2-x1)*(y2-y1)))
sum2=sum2+d*d
if (d .gt. mum2) then
mum2=d
at2=y(i)
endif
enddo
if (n .gt. 3) then
sum=sqrt(sum/(n-2))*25
sum1=sqrt(sum1/(n-2))*25
sum2=sqrt(sum2/(n-2))*25
print '(x,a)','Interpolation accuracy mean worst at'
print '(13x,a,3(f8.2,a))','linear ',sum, '%',mum *25,'%',at,' K'
print '(13x,a,3(f8.2,a))','log/lin ',sum1,'%',mum1*25,'%',at1,' K'
print '(13x,a,3(f8.2,a))','log/log ',sum2,'%',mum2*25,'%',at2,' K'
if (unit .eq. 3) then
sum1=(sum1/sum)**2+(mum1/mum)**2
sum2=(sum2/sum)**2+(mum2/mum)**2
if (form .eq. 0 .and. (sum1 .lt. 1.0 .or. sum2 .lt. 1.0) &
.or. form .gt. 3) then
if (form .eq. 0 .and. sum2 .lt. sum1 .or. form .eq. 5) then
unit=5
do i=1,n-1
y(i)=log10(y(i))
enddo
else
unit=4
endif
do i=1,n-1
x(i)=log10(x(i))
enddo
endif
else
if (form .gt. 3) print *,'FORM ignored (not unit Ohm)'
endif
endif
100 continue
if (unit .eq. 1) then ! check for mV / V consistency
if (xmax .gt. 990) then
unit=2
do i=1,n-1
x(n)=x(n)/1000.0
enddo
endif
xmax=xmax/1000.0
range=range/1000.0
elseif (unit .eq. 2) then
if (xmax .lt. 0.5) then
unit=1
do i=1,n-1
x(n)=x(n)*1000.0
enddo
endif
endif
if (range .eq. 0) range=xmax
if (tlim .eq. 0 .or. tlim .gt. ymax) tlim=ymax
irange=0
if (range .gt. 0) then
if (unit .ge. 3) then ! Ohm
curr=amps(excit)
rl=range*curr ! convert Ohm to V
if (rl .gt. 5.0) then
! print *,'Warning: maximum range exceeded: ', range,'>',5/curr,' Ohm',char(7)
! errstat=max(errstat,1)
irange=12
endif
else
rl=range ! V
endif
if (irange .eq. 0) then
if (type==12) then
j=6
else
j=nvolts
end if
do i=1,j
if (rl .le. volts(i)) then
irange=i
goto 150
endif
enddo
! print *,'Warning: maximum range exceeded: ', range,' > ',volts(j),' V',char(7)
! errstat=max(errstat,1)
irange=j
150 continue
if (excit .eq. 11) then ! 10 mV excit -> min. 10 mV range
if (irange .lt. 4) irange=4
endif
endif
else
irange=defr(type)
range=xmax
endif
if (stdcurv==0) then
if (unit .ge. 3) then
if (range*amps(excit) .gt. volts(irange)) then
print *,'Warning: max. range exceeded: ',range,' > ',volts(irange)/amps(excit),' Ohm',char(7)
errstat=max(errstat,1)
endif
else if (range .gt. volts(irange)) then
print *,'Warning: max. range exceeded: ',range,' > ',volts(irange), ' V',char(7)
errstat=max(errstat,1)
endif
endif
if (type .gt. 0) then
if (excit .le. 0) excit=defe(type)
if (irange .eq. 0) irange=defr(type)
endif
print *,'Sensor type: ',types(type)
print *,'Excitation: ',excits(excit)
if (unit .eq. 1) then
print *,'Sensor Range: ',volts(irange)*1000,' mV'
elseif (unit .eq. 2) then
print *,'Sensor Range: ',volts(irange),' V'
else
print *,'Sensor Range: ',volts(irange)/amps(excit),' Ohm'
if (unit .eq. 5) then
print *,'table double logarithmic'
elseif (unit .eq. 4) then
print *,'table logarithmic'
else
print *,'table linear'
endif
endif
if (coef .eq. 1) then
print *,'negative characteristic'
else
print *,'positive characteristic'
endif
print *
if (type .eq. 0) then
if (unit .ge. 3) then
iunit=2
else
iunit=1
endif
else
if (unit .le. 2) then ! mV / V
iunit=1
else ! Ohm
iunit=2
endif
if (iunit .ne. defu(type) .or. &
coef .ne. defc(type) .or. &
excit .ne. defe(type) .or. &
irange.ne. defr(type)) then
if (type .ne. 12) type=0
endif
endif
if (type .eq. 12) then
l=5
write (line(1:l), '(a,i1)') ',,,,',max(0,irange-5)
elseif (type .eq. 0) then
l=14
write (line(1:l), '(i2,4(a,i2.0))') type,',',iunit,',',coef,',',excit,',',irange
else
l=2
write(line(1:l), '(i2)') type
endif
call str_substitute(intype, line(1:l), ' ', char(0))
call str_trim(intype, intype, li)
if (tlim .gt. 1500) tlim=1500
if (tlim .lt. 0) tlim=0
if (stdcurv==0) then
! calculate crc of table
crc=0
do i=1,n,ncolumn
call pack(line, l, x(i), y(i), i-1, 1)
call str_crc(crc, line(1:l))
enddo
call str_crc_comp(crc, crcmp)
write (header, "(a,x,a,',',a,',',i1,',',f8.3,',',i1)") name(1:11), crcmp,sensor,unit,tlim,coef
else
header=stdhdr(stdcurv)
endif
! compare with old file
call str_trim(filnam, name, l)
filnam(l+1:)='.crv'
filnam='tecs/'//filnam
open(unit=2, file=filnam, status='old', action='read',err=198)
read(2, '(a)',end=199) old
if (old/=header) goto 199
read(2, '(a)', end=199) old
if (old/=intype) goto 199
do i=1,n,ncolumn
read(2, '(a)') old
call pack(line, l, x(i), y(i), i-1, min(ncolumn,n-i+1))
if (line/=old) goto 199
enddo
close(2)
print *,'curve file has not changed: ',filnam
goto 999
198 print *,'create new curve file: ',filnam
nlist=nlist+1
list(nlist)='created '//filnam
goto 200
199 close(2)
print *,'modify curve file: ',filnam
nlist=nlist+1
list(nlist)='modified '//filnam
200 continue
open(unit=2, file=filnam, status='unknown', action='write', carriagecontrol='list')
call str_trim(header, header, l)
if (stdcurv/=0) then
write(2, '(a)') header(1:l)
write(2, '(a)') intype(1:li)
write(2, '(a,i2)') '$',stdcurv
else
write(2, '(a)') header(1:l)
write(2, '(a)') intype(1:li)
do i=1,n,ncolumn
call pack(line, l, x(i), y(i), i-1, min(ncolumn,n-i+1))
write(2,'(a)') line(1:l)
enddo
endif
close(2)
999 continue
if (errstat .gt. 0) then
if (name==' ') name='<unknown>'
nlist=nlist+1
if (errstat .gt. 1) then
list(nlist)='error in '//file//', curve '//name
print *,'no curve file written'
lin=-1
else
list(nlist)='warning in '//file//', curve '//name
endif
endif
if (eof) lin=-1
return
end subroutine
integer function lsc_getno(list, n, name)
integer n
character list(n)*(*), name*(*)
character str*32
integer i,l
call str_trim(name, name, l)
l=min(l,len(str))
do i=1,n
call str_upcase(str(1:l), list(i))
if (name(1:l) .eq. str(1:l)) then
lsc_getno=i
RETURN
endif
enddo
lsc_getno=0
end function
subroutine lsc_errinit(lunit)
integer lunit
lun=lunit
pos=0
errstat=0
end subroutine
subroutine lsc_error(lin, text)
integer lin
character text*(*)
integer i,l
character line*132
if (pos .eq. 0) then
print *
endif
if (lin .gt. pos) then
rewind lun
do i=1,lin-1
read(lun, '(q,a)', end=8) l,line
if (i .gt. max(pos,lin-3)) then
print '(5x,a)',line(1:max(1,min(l,len(line))))
endif
enddo
read(lun, '(q,a)', end=8) l,line
print '(x,2a)','>>> ',line(1:max(1,min(l,len(line))))
8 pos=lin
errstat=2
endif
9 print '(x,a)', text
end subroutine
end program

View File

@ -1,11 +0,0 @@
integer ncolumn
parameter (ncolumn=3)
integer lun,pos,nlist,errstat,lf,lp
common /convcom/lun,pos,nlist,errstat,lf,lp
logical verbose
common /convcom/verbose
character*128 file, path
common /convcom/file, path
character*128 list(1000)
common /convcom/list

View File

@ -1,208 +0,0 @@
!!------------------------------------------------------------------------------
!!
subroutine CVT_REAL_STR(RESULT, RESLEN, X, !!
1 WIDTH, FIXLEN, DIGITS, TRUNC) !!
!! =====================================================
!!
!! Convert X to RESULT (subroutine version)
!!
!! The number is converted using Fortran format F<WIDTH>.<FIXLEN>.
!! If the number is too large or the number of significant digits is to
!! low, the number digits after the decimal point is changed or, if this is
!! is not possible, an E-format is choosen. If WIDTH is lower than 6, the
!! result length will be larger in some cases.
!!
!! Default format (WIDTH < 0, FIXLEN < -1, DIGITS < 0)
!!
implicit none
!! Arguments
character*(*) RESULT !!
integer RESLEN !! length of result
real X !! number to be converted
integer WIDTH !! minimum width
integer FIXLEN !! minimum digits after comma
integer DIGITS !! minimum significant digits
integer TRUNC !! TRUNC=1,3: omit trailing zeros
!! TRUNC=0,1: decimal point always shown
integer bufmax
parameter (bufmax=32)
integer wid, fix, dig, trc
character*(bufmax) fixbuf, expbuf ! internal buffers
integer exponent
real mantissa
integer f0, fl, e0, el ! start and end of used buffer F/E
integer fdig, edig ! digits after decimal point F/E format
integer overhd ! overhead
integer p ! position of decimal point
integer digf ! number of digits-1 shown (F-Format)
integer le, l
character*8 rfmt
trc=trunc
if (mod(trc,2) .eq. 1) then ! defaults
wid=1
fix=0
dig=4
if (width .ge. 0) wid=width
else
wid=min(8,len(result))
if (width .ge. 0) wid=width
fix=max(0,wid/2-1)
dig=1
endif
if (fixlen .ge. 0) fix=fixlen
if (digits .ge. 0) dig=digits
wid=min(bufmax, wid, len(result))
dig=min(bufmax, dig)
if (x .eq. 0) then
exponent=0
mantissa=0
else
exponent=int(log10(abs(x))+100)-100
mantissa=x/10.0**exponent
endif
edig=min(max(wid-4,dig-1),len(result)-4)
fdig=min(max(fix,dig-1-exponent),len(result)-1)
! F-Format
11 f0=0
fl=bufmax+1 ! in case of write error
digf=-1
if (fdig .lt. -exponent) goto 14
write(rfmt, '(''(F'',I2.2,''.'',I2.2,'')'')') bufmax, fdig
write(fixbuf, rfmt, err=14) x
! reduce
f0=bufmax-fdig
if (exponent .gt. 0) f0=f0-exponent
do while(f0 .gt. 0 .and. fixbuf(f0:f0) .ne. ' ')
f0=f0-1
enddo
fl=bufmax-1
do while(fixbuf(fl+1:fl+1) .eq. ' ')
fl=fl-1
enddo
overhd=fl+1-f0-len(result)
do while (fixbuf(fl+1:fl+1) .eq. '0'
1 .and. (overhd .gt. 0 .or. mod(trc,2) .eq. 1))
fl=fl-1
overhd=overhd-1
enddo
if (fixbuf(fl+1:fl+1) .eq. '.' .and. trc .ge. 2) then
overhd=overhd-1
else
fl=fl+1
endif
if (overhd .gt. 0) then
12 if (fdig .ge. overhd) then
fdig=fdig-overhd
goto 11 ! try again with less digits
endif
fl=bufmax+1
endif
digf=fdig+exponent
! E-Format mantissa
14 if (x .eq. 0 .or. edig .lt. 0) goto 13
15 write(rfmt, '(''(F'',I2.2,''.'',I2.2,'')'')') bufmax-4, edig
write(expbuf(1:bufmax-4), rfmt, err=19) mantissa
if (exponent .gt. -10) then
if (exponent .lt. 10 .and. exponent .ge. 0) then
le=2
else
le=3
endif
else
le=4
endif
! reduce
e0=bufmax-6-edig
if (e0 .gt. 0) then
if (expbuf(e0:e0) .eq. '1') then ! 9.9 was rounded to 10
exponent=exponent+1
mantissa=mantissa/10.0
goto 15
endif
if (expbuf(e0:e0) .eq. '-') e0=e0-1
endif
el=bufmax-5
do while(expbuf(el+1:el+1) .eq. ' ')
el=el-1
enddo
overhd=el+le+1-e0-len(result)
do while (expbuf(el+1:el+1) .eq. '0' .and.
1 (overhd .gt. 0 .or. mod(trc,2) .ne. 0))
el=el-1
overhd=overhd-1
enddo
if (expbuf(el+1:el+1) .eq. '.' .and. trc .ge. 2) then
overhd=overhd-1
else
el=el+1
endif
if (overhd .gt. 0) then
if (edig .ge. overhd) then
edig=edig-overhd
goto 14 ! try again with less digits
endif
el=bufmax+1
else
write(rfmt, '(''(A,I'',I2.2,'')'')') le-1
write(expbuf(el+1:el+le), rfmt) 'E',exponent
el=el+le
endif
! Compare
l=fl-f0
if (l .gt. wid .and.
1 (edig .gt. digf .or.
1 edig .eq. digf .and. l .gt. el-e0 .or.
1 l .gt. len(result))) then ! E-format is better
fixbuf=expbuf
f0=e0
fl=el
p=bufmax-4-edig
else
p=bufmax-fdig
if (fix .eq. 0 .and. trc .ge. 2) p=p-1 ! Decimal point not needed if fix=0
endif
13 l=fl-f0
if (l .gt. len(result)) then
goto 19
elseif (p-f0 .gt. wid-fix .or. l .ge. wid) then ! Left just
result=fixbuf(f0+1:fl)
elseif (fl-p .gt. fix) then ! Right just
result=fixbuf(fl-wid+1:fl)
l=wid
else ! Decimal just
result=fixbuf(p+fix-wid+1:fl)
l=fl+wid-p-fix
endif
reslen=min(l, len(result))
return
19 result='******'
reslen=len(result)
end
subroutine cvt_bintim
stop 'CVT_BINTIM: obsolete'
end

View File

@ -1,86 +0,0 @@
#!/bin/tcsh
set what="$1"
set where="$2"
set destlist=( type@osf1 \
alpha=/afs/psi.ch/project/sinq/tru64/stow/tecs/bin/ \
type@linux \
slinux=/afs/psi.ch/project/sinq/sl-linux/stow/tecs/bin/ \
amor@amor:tecs/ focus@focus:tecs/ trics@trics:tecs/ \
tasp@tasp:tecs/ dmc@dmc:tecs/ hrpt@hrpt:tecs/ \
morpheus@morpheus:tecs/ sans@sans:tecs/ sans2@sans2:tecs/ \
l_samenv@lnsl15:tecs/ \
type@darwin \
macosx=/afs/psi.ch/project/sinq/mac_os/stow/tecs/bin/ \
prep1=admin@ldmprep1:bin/ prep2=admin@ldmprep2:bin/ \
)
set dests=""
set destl=""
foreach dest ($destlist)
set ext="${dest:s/=/ /}"
set ext=($ext)
if ("$ext" != "$dest") then
set dest="$ext[2]"
set d="$ext[1]"
else
set d=""
endif
set ext=${dest:s/@/ /}
set ext=($ext)
if ("$ext[1]" == type) then
set type=$ext[2]
else
if ("$d" == "") set d=$ext[1]
if ($?type) then
set t_$d=$type
else
echo "type undefined"
exit
endif
set d_$d=$dest
set dests=($dests $d)
endif
end
set items=(TecsServer TecsClient six)
echo ""
echo " all $items"
echo -n "distribute what: "
if ("$what" == "") then
set what=$<
endif
if ($what == all) then
set what=($items)
endif
echo ""
echo " all $dests"
echo "distribute where: "
if ("$where" == "") then
set where=$<
endif
if ($where == all) then
set where=($dests)
endif
set this=${0:h}
if ($this == $0) then
set this=./
endif
cd $this
#set obj=../../obj/$SICS_VERSION/psi/tecs
foreach dest ($where)
alias get 'set d=$'"d_$dest;"'set t=$'"t_$dest"
get
foreach item ($what)
if ("$t" == "$OSTYPE") then
echo $item to $d
rsync -e ssh -vt $item $d
endif
end
end

View File

@ -1,4 +0,0 @@
#include "fortify.c"
#ifndef FORTIFY
void null(void){}
#endif

View File

@ -1,10 +0,0 @@
amor: host=localhost:4000/10
dmc: host=psts225:3007
hrpt: host=psts229:3007
focus: host=psts215:3001
sans2: host=localhost:4000/6
sans: host=localhost:4000/11
tasp: host=psts231:3007
morpheus: host=localhost:4000/8
rita2: host=psts216:3007
trics: host=psts228:3007

View File

@ -1,5 +0,0 @@
sensA.type=m sensA.curve=mz020124
sensB.type=s sensB.curve=r10409
dev="APD closed cycle refrigerator (TriCS)"
tlimit=310 resist=40 maxPower=16
prop=15 int=10 deriv=0

View File

@ -1,2 +0,0 @@
sensC.type=x
dev="APD auxilliary sensor"

View File

@ -1,109 +0,0 @@
sens=c020415
unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically
!tlim=325 ! setpoint limit (automatic if omitted)
type=C ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted)
form=loglog
curv ! curve (sensor,temp/K) follows, must be ordered, but can be increasing or decreasing
87 278.58
87.7 273.38
88.4 267.75
89.1 261.75
89.9 254.55
90.7 247.11
91.6 238.55
92.6 228.96
93.7 218.46
95 206.33
96.6 192.03
98.9 173.02
104 138.05
106.2 125.83
108.4 115.1
110.6 105.67
112.8 97.379
115 90.068
117.2 83.601
119.4 77.863
121.7 72.535
124.1 67.603
126.6 63.049
129.1 59.004
131.7 55.261
134.4 51.8
137.3 48.498
140.3 45.466
143.4 42.683
147 39.828
150 37.712
154 35.206
158 33.003
162 31.056
166 29.324
170 27.775
175 26.057
180 24.543
185 23.201
191 21.781
197 20.532
203 19.429
210 18.293
217 17.293
225 16.29
233 15.409
242 14.539
251 13.775
261 13.028
272 12.31
284 11.628
297 10.985
311 10.384
326 9.8244
342 9.3062
360 8.8014
379 8.3407
400 7.9007
423 7.4854
448 7.0969
475 6.736
505 6.3915
540 6.0487
580 5.7176
620 5.4367
670 5.1397
720 4.8893
780 4.6356
840 4.4212
910 4.2092
990 4.0054
1080 3.8132
1180 3.6344
1300 3.456
1440 3.2845
1600 3.1239
1780 2.9757
1990 2.8344
2240 2.6977
2530 2.5697
2900 2.4393
3300 2.3271
3800 2.2154
4400 2.1099
5100 2.0131
6000 1.916
7100 1.8247
8400 1.7416
10000 1.663
12000 1.5879
14600 1.5142
18000 1.4427
22000 1.3801
27000 1.3216
34000 1.2614
43000 1.2054
55000 1.1518
71000 1.1009
93000 1.0519
124000 1.0041
300000 0.75

View File

@ -1,34 +0,0 @@
sens=c030307
unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically
!tlim=325 ! setpoint limit (automatic if omitted)
type=C ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted)
curv ! curve (sensor,temp/K) follows, must be ordered, but can be increasing or decreasing
100000 0.42
15000 1.05
8000 1.42
4000 1.99
2000 2.77
1600 3.1
1400 3.32
1200 3.61
1000 4.01
900 4.28
800 4.61
700 5.05
600 5.64
500 6.5
400 7.96
300 10.81
265 12.68
228 15.77
206 18.96
191 21.67
180 24.48
171 27.3
154 35.2
142 45
134 60
130 70
90 310

View File

@ -1,107 +0,0 @@
sens=c030311
unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically
!tlim=325 ! setpoint limit (automatic if omitted)
type=C ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted)
curv ! curve (sensor,temp/K) follows, must be ordered, but can be increasing or decreasing
94 331.07
95.6 301.46
98.2 258.68
100.3 229.17
102.1 207.24
103.8 189.07
105.4 173.97
107 160.58
108.6 148.68
110.2 138.09
111.9 128.07
113.6 119.17
115.3 111.22
117.1 103.71
118.9 97.013
120.8 90.694
122.8 84.763
124.8 79.468
126.9 74.498
129.1 69.849
131.4 65.511
133.8 61.473
136.3 57.722
138.9 54.241
141.7 50.902
144.6 47.825
147.6 44.991
151 42.141
154 39.899
158 37.247
162 34.917
166 32.859
170 31.029
174 29.394
179 27.58
184 25.982
189 24.565
195 23.065
201 21.747
207 20.581
214 19.38
221 18.324
229 17.263
237 16.331
246 15.411
255 14.602
265 13.812
276 13.051
288 12.328
301 11.646
315 11.009
330 10.416
346 9.8657
363 9.3576
382 8.8648
403 8.3941
426 7.9501
451 7.5349
478 7.1492
508 6.7812
540 6.4443
580 6.0862
620 5.7828
660 5.5221
710 5.2433
770 4.9621
830 4.7255
900 4.4923
980 4.2688
1070 4.0588
1170 3.8641
1280 3.685
1410 3.5088
1560 3.3408
1730 3.184
1930 3.0326
2160 2.8904
2430 2.7546
2700 2.6432
3100 2.5095
3500 2.4024
4000 2.2943
4600 2.1908
5300 2.0948
6200 1.9976
7300 1.9054
8600 1.8209
10300 1.736
12400 1.6564
15000 1.582
18000 1.5166
22000 1.4505
27000 1.3888
34000 1.3252
43000 1.2661
55000 1.2096
71000 1.156
93000 1.1043
123000 1.0554
170000 1.0039

View File

@ -1,74 +0,0 @@
sens=c1
unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically
!tlim=325 ! setpoint limit (automatic if omitted)
type=C ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted)
!excit=100uA ! (off,30nA,100nA,300nA,1uA,3uA,10uA,30uA,100uA,300uA,1mA,10mV,1mV) (if omitted: default from sensor type)
range=333333 ! range in sensor units (if rang=0: determine range from table, if omitted: default from sensor type)
curv ! curve (sensor,temp/K) follows, must be ordered, but can be increasing or decreasing
999999 1.00
272100 1.03
172977 1.12
112093 1.21
74662 1.31
50854.6 1.42
35305.6 1.53
25003.3 1.66
18090 1.80
13356.3 1.94
10053.4 2.10
7697.32 2.28
5986.53 2.47
4724.73 2.67
3784.47 2.89
3069.36 3.13
2518.99 3.39
2091.39 3.67
1755.38 3.97
1487.08 4.30
1273.44 4.66
1101.81 5.04
960.139 5.46
844.434 5.91
747.186 6.40
665.698 6.93
596.693 7.50
539.771 8.12
490.76 8.79
448.006 9.52
412.762 10.30
380.541 11.15
352.62 12.08
328.321 13.07
306.25 14.16
288.286 15.32
271.424 16.59
256.195 17.96
242.787 19.45
230.54 21.05
219.532 22.79
209.575 24.68
200.383 26.72
192.065 28.93
184.48 31.32
177.432 33.91
171.256 36.71
165.012 39.74
159.59 43.03
154.324 46.58
149.365 50.43
144.78 54.60
139.937 60.00
133.722 68.50
128.791 77.30
123.897 88.60
119.039 103.50
114.217 124.20
109.43 154.70
107.05 176.00
104.678 203.80
102.316 240.90
100.237 287.70
99.6953 300.00
90 310

View File

@ -1,87 +0,0 @@
sens=c12900
unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically
type=C ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted)
range=800000
curv ! curve (sensor,temp/K) follows, must be ordered, but can be increasing or decreasing
1012550 1.20497
546701 1.30399
312268 1.40162
114040 1.60623
51444 1.80617
26719.2 2.00576
15435.5 2.20444
9602.53 2.40494
6397.94 2.60259
4489.76 2.79906
3219.32 3.00654
2461.2 3.19842
1897.64 3.40336
1502.24 3.6079
1230.54 3.80022
1012.12 4.00621
841.192 4.22067
637.469 4.58241
489.918 4.97865
367.931 5.4844
264.075 6.1965
195.15 7.00194
144.285 8.00824
113.298 9.01723
92.4347 10.0564
78.2614 11.0715
67.9423 12.0828
60.1888 13.0842
54.1233 14.0857
49.3103 15.0747
45.3379 16.0757
42.0996 17.0531
39.3391 18.0384
36.9796 19.0217
34.9151 20.0177
32.9926 21.0862
30.5452 22.6981
28.6209 24.2233
26.9266 25.8078
25.4992 27.3598
24.2509 28.9385
23.0398 30.7055
21.8009 32.8076
20.3302 35.8012
19.1087 38.8327
18.0816 41.8826
17.2216 44.8952
16.4751 47.9305
16.0348 49.938
15.0984 54.8967
14.3247 59.8577
13.6715 64.8573
13.1178 69.8244
12.636 74.8078
12.2143 79.7839
11.8399 84.8244
11.5105 89.8012
11.2102 94.8438
10.942 99.8132
10.4716 109.826
10.0743 119.846
9.73462 129.833
9.43818 139.857
9.17665 149.828
8.94393 159.859
8.73457 169.862
8.54545 179.864
8.37336 189.826
8.21397 199.879
8.06779 209.858
7.93285 219.86
7.80698 229.843
7.68873 239.855
7.57774 249.851
7.47313 259.852
7.37448 269.854
7.28072 279.868
7.19198 289.881
7.10731 299.874
7.02683 309.874

View File

@ -1,93 +0,0 @@
sens=c17844
unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically
!tlim=325 ! setpoint limit (automatic if omitted)
type=C ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted)
!excit=300uA ! (off,30nA,100nA,300nA,1uA,3uA,10uA,30uA,100uA,300uA,1mA,10mV,1mV) (if omitted: default from sensor type)
range=1500000 ! range in sensor units (if rang=0: determine range from table, if omitted: default from sensor type)
curv ! curve (sensor,temp/K) follows, must be ordered, but can be increasing or decreasing
1600000.000 1.1
970035.6003 1.20121
505060.7083 1.30296
338710.9339 1.3989
120001.056 1.60059
51903.02439 1.80271
14804.70375 2.20221
9145.783794 2.39764
5892.856091 2.60368
4098.343859 2.798
2949.617582 2.99639
2170.79842 3.20492
1650.889664 3.41307
1316.149683 3.60371
1062.659731 3.80091
877.1929825 3.99488
724.6376812 4.20335
465.1162791 4.77734
358.4229391 5.17319
274.7252747 5.65299
201.2072435 6.31596
150.6024096 7.06791
111.1111111 8.04676
85.17887564 9.11986
70.92198582 10.0142
59.9880024 10.982
51.25576627 12.0445
45.74565416 12.9337
41.05090312 13.8897
37.09198813 14.9045
33.99048266 15.8801
31.56565657 16.7995
29.43773918 17.7499
27.5862069 18.7256
25.96728123 19.7153
24.27184466 20.9274
22.37637055 22.5615
20.90301003 24.0999
19.5427008 25.7898
18.43657817 27.4256
17.49475157 29.0442
16.50709805 31.0254
15.64945227 33.0448
14.53911021 36.2007
13.70801919 39.0782
12.97690112 42.0868
12.39157373 44.9234
11.84553423 47.9836
11.52339249 50.031
10.84245907 55.0141
10.28806584 59.9738
9.811616954 65.062
9.409993413 70.0969
9.071117562 75.0211
8.765778401 80.058
8.494733265 85.1505
8.25968448 90.1304
8.048289738 95.0917
7.840677435 100.499
7.505817008 110.505
7.22230247 120.57
6.97934115 130.684
6.770022341 140.651
6.582411796 150.794
6.416014372 160.824
6.26605677 170.879
6.130456106 181.012
6.007810153 191.033
5.895183635 201.141
5.788376939 211.227
5.691519636 221.232
5.602554765 231.279
5.518154729 241.451
5.437442227 251.53
5.361642807 261.574
5.291285253 272.626
5.2227503 281.619
5.158095631 291.746
5.096060745 301.885
5.03626108 311.966
5.007260528 317.011
4.979831682 322.01
4.947555907 328.015
4.927322 331.981

View File

@ -1,83 +0,0 @@
sens=c2
unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically
!tlim=325 ! setpoint limit (automatic if omitted)
type=C ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted)
!excit=100uA ! (off,30nA,100nA,300nA,1uA,3uA,10uA,30uA,100uA,300uA,1mA,10mV,1mV) (if omitted: default from sensor type)
!range=0 ! range in sensor units (if rang=0: determine range from table, if omitted: default from sensor type)
curv ! curve (sensor,temp/K) follows, must be ordered, but can be increasing or decreasing
179323 0.607
112538 0.749
75275 0.891
52838 1.033
38592 1.176
29156 1.318
22674 1.460
18077 1.593
14725 1.709
10302 1.930
8000 2.112
7000 2.211
6500 2.272
6000 2.332
5500 2.404
5000 2.500
4500 2.595
4000 2.713
3500 2.865
3000 3.050
2800 3.142
2600 3.234
2400 3.349
2200 3.485
2000 3.644
1800 3.825
1600 4.051
1500 4.186
1400 4.342
1300 4.510
1200 4.711
1100 4.945
1000 5.233
900 5.577
800 6.008
750 6.273
700 6.582
650 6.934
600 7.363
550 7.879
500 8.516
450 9.327
400 10.412
380 10.949
360 11.541
340 12.309
320 13.188
300 14.177
280 15.498
260 17.041
240 19.140
210 23.577
200 25.693
190 28.258
180 31.496
170 35.618
165 38.056
160 40.920
155 44.302
150 48.177
145 52.835
140 58.344
135 65.188
130 73.754
126 82.556
122 93.825
118 108.675
114 129.321
110 159.772
108 181.052
106 208.836
104 245.923
102 299.013
101.8 300.013
100 330.010

View File

@ -1,62 +0,0 @@
sens=c9r1al
unit=Ohm
type=C
form=loglog
curv
38580.4733 1.2
25527.04753 1.32
17468.3041 1.45
12066.93001 1.6
8650.280274 1.76
6306.651073 1.94
4694.252185 2.14
3573.626135 2.36
2783.444132 2.6
2216.839621 2.86
1791.14137 3.15
1470.704612 3.47
1227.87547 3.82
1033.9 4.22
880.7788603 4.67
762.3400194 5.16
668.2320962 5.7
592.0511811 6.3
530.3886753 6.96
479.7006886 7.69
437.5649046 8.5
402.2469771 9.4
372.7148658 10.39
347.5924137 11.49
326.2948196 12.7
307.9980846 14.04
292.2339082 15.52
278.5371412 17.16
266.6268462 18.97
256.2075009 20.97
247.0526452 23.18
238.9529249 25.63
231.8026482 28.33
225.437156 31.32
219.7716127 34.62
214.7027482 38.27
210.1529453 42.31
206.069282 46.77
202.3900793 51.7
199.0677301 57.15
196.059213 63.18
193.330802 69.85
190.8 77.4
188.5955401 85.3
186.5433486 94
184.635154 103.6
182.8665863 114.2
181.2481553 125.8
179.7615145 138.6
178.4065199 152.7
177.1754481 168.3
176.0711025 185.5
175.0943243 204.4
174.2406583 225.2
173.5048158 248.2
172.9 273
172.3429819 300.8

View File

@ -1,62 +0,0 @@
sens=c9r2ol
unit=Ohm
type=C
form=loglog
curv
38789.32947 1.2
25664.68349 1.32
17561.97111 1.45
12131.12683 1.6
8695.835664 1.76
6339.419493 1.94
4718.223268 2.14
3591.48302 2.36
2796.989741 2.6
2227.293804 2.86
1799.272921 3.15
1477.087842 3.47
1232.933811 3.82
1037.9 4.22
883.9434229 4.67
764.8583732 5.16
670.236992 5.7
593.6404296 6.3
531.6414898 6.96
480.6769466 7.69
438.3112675 8.5
402.8006434 9.4
373.1074033 10.39
347.8478818 11.49
326.4340868 12.7
308.0375238 14.04
292.1873372 15.52
278.4158399 17.16
266.4405616 18.97
255.9643678 20.97
246.7595627 23.18
238.6156499 25.63
231.4263609 28.33
225.0261383 31.32
219.3296834 34.62
214.2331629 38.27
209.658536 42.31
205.5525921 46.77
201.8533154 51.7
198.5128393 57.15
195.4879076 63.18
192.7446102 69.85
190.2 77.4
187.9625977 85.3
185.8374309 94
183.8172669 103.6
181.8985625 114.2
180.0943165 125.8
178.3856344 138.6
176.773299 152.7
175.2487852 168.3
173.8160903 185.5
172.4774782 204.4
171.22817 225.2
170.0608949 248.2
169 273
167.9638906 300.8

View File

@ -1,62 +0,0 @@
sens=c9r3tc
unit=Ohm
type=C
form=loglog
curv
33583.11255 1.2
22221.9409 1.32
15207.93789 1.45
10506.80125 1.6
7533.088074 1.76
5493.288397 1.94
4089.921887 2.14
3114.574484 2.36
2426.83216 2.6
1933.682604 2.86
1563.172136 3.15
1284.276995 3.47
1072.928372 3.82
904.1 4.22
770.8295786 4.67
667.7452215 5.16
585.837507 5.7
519.5327324 6.3
465.8641916 6.96
421.7474265 7.69
385.0741513 8.5
354.3348616 9.4
328.6313113 10.39
306.7657492 11.49
288.2291883 12.7
272.3044532 14.04
258.5839543 15.52
246.6628445 17.16
236.2966074 18.97
227.2280324 20.97
219.2600178 23.18
212.2103503 25.63
205.9870398 28.33
200.4467739 31.32
195.5157151 34.62
191.1039813 38.27
187.1440176 42.31
183.5897629 46.77
180.3875343 51.7
177.4958965 57.15
174.8774054 63.18
172.5027073 69.85
170.3 77.4
168.3554821 85.3
166.4930511 94
164.7069389 103.6
162.9944953 114.2
161.3679759 125.8
159.8109808 138.6
158.3246563 152.7
156.9014886 168.3
155.5455151 185.5
154.2593594 204.4
153.0389377 225.2
151.8774371 248.2
150.8 273
149.7365435 300.8

View File

@ -1,62 +0,0 @@
sens=c9r4bc
unit=Ohm
type=C
form=loglog
curv
34741.52828 1.2
22985.54894 1.32
15727.80503 1.45
10863.30101 1.6
7786.249475 1.76
5675.565508 1.94
4223.431152 2.14
3214.189828 2.36
2502.548036 2.6
1992.261231 2.86
1608.875297 3.15
1320.288379 3.47
1101.595261 3.82
926.9 4.22
788.9983497 4.67
682.331748 5.16
597.5776902 5.7
528.968784 6.3
473.4352285 6.96
427.7853788 7.69
389.8376848 8.5
358.0301859 9.4
331.4334214 10.39
308.8080177 11.49
289.6272999 12.7
273.1491705 14.04
258.9518758 15.52
246.6165002 17.16
235.89003 18.97
226.5063165 20.97
218.2614085 23.18
210.9667606 25.63
204.5271863 28.33
198.7943928 31.32
193.6919766 34.62
189.1269324 38.27
185.0293576 42.31
181.3515904 46.77
178.0380823 51.7
175.0459584 57.15
172.3364731 63.18
169.8792527 69.85
167.6 77.4
165.5852656 85.3
163.6502528 94
161.7890578 103.6
159.9989837 114.2
158.2929731 125.8
156.6539552 138.6
155.083202 152.7
153.5728121 168.3
152.1271003 185.5
150.748961 204.4
149.4341298 225.2
148.1753057 248.2
147 273
145.836448 300.8

View File

@ -1,24 +0,0 @@
sens=c_1
unit=Ohm
type=C
form=loglog
curv
50049 1
6549 2
2249 3
1149 4.2
674 6
399 10
299 15
259 20
229 27
209 35
189 50
173 77
165 100
156 150
152 200
147 300
139 500

View File

@ -1,24 +0,0 @@
sens=c_2
unit=Ohm
type=C
form=loglog
curv
50053 1
6553 2
2253 3
1153 4.2
678 6
403 10
303 15
263 20
233 27
213 35
193 50
177 77
169 100
160 150
156 200
151 300
143 500

View File

@ -1,24 +0,0 @@
sens=c_3
unit=Ohm
type=C
form=loglog
curv
50076 1
6576 2
2276 3
1176 4.2
701 6
426 10
326 15
286 20
256 27
236 35
216 50
200 77
192 100
183 150
179 200
174 300
166 500

View File

@ -1,23 +0,0 @@
sens=c_4
unit=Ohm
type=C
form=loglog
curv
50077 1
6577 2
2277 3
1177 4.2
702 6
427 10
327 15
287 20
257 27
237 35
217 50
201 77
193 100
184 150
180 200
175 300
167 500

View File

@ -1,70 +0,0 @@
sens=c_ab
unit=Ohm
type=C
form=loglog
curv
217890 1.05
166770 1.1
104660 1.2
70006 1.3
49139 1.4
35891 1.5
27115 1.6
21087 1.7
16812 1.8
13694 1.9
9580.4 2.1
7091 2.3
5479.2 2.5
4380.9 2.7
3600 2.9
3025.2 3.1
2589.8 3.3
2110.6 3.6
1768.5 3.9
1515 4.2
1321.7 4.5
1127.4 4.9
982.45 5.3
870.93 5.7
763.89 6.2
681.8 6.7
617.16 7.2
555.91 7.8
507.43 8.4
462.39 9.1
426.33 9.799
393.06 10.6
366.01 11.4
341.1 12.3
318.49 13.3
298.16 14.4
280.01 15.6
264.97 16.8
251.35 18.1
239.03 19.5
227.24 21.1
216.74 22.8
207.36 24.6
198.54 26.6
190.68 28.7
183.35 31.01
176.56 33.5
170.28 36.2
164.49 39.1
159.15 42.21
154.09 45.61
149.45 49.2
145.07 53.1
139.94 60
133.72 68.5
128.79 77.3
123.9 88.6
119.04 103.5
114.22 124.2
109.43 154.7
107.05 176
104.68 203.8
102.32 240.9
99.96 294
99.0 300

View File

@ -1,185 +0,0 @@
sens=c_ill
unit=Ohm
type=C
form=loglog
curv
90 310.451
100 177.957
110 115.629
120 82.078
130 62.133
140 49.348
150 40.656
160 34.463
170 29.88
180 26.38
190 23.636
200 21.437
220 18.15
240 15.823
260 14.097
280 12.767
300 11.712
320 10.855
340 10.144
360 9.545
380 9.033
400 8.589
420 8.202
440 7.859
460 7.555
480 7.282
500 7.036
520 6.813
540 6.61
560 6.424
580 6.253
600 6.095
620 5.949
640 5.813
660 5.687
680 5.569
700 5.458
720 5.354
740 5.256
760 5.164
780 5.077
800 4.995
820 4.916
840 4.842
860 4.772
880 4.705
900 4.641
920 4.579
940 4.521
960 4.465
980 4.411
1000 4.36
1050 4.24
1100 4.131
1150 4.032
1200 3.94
1250 3.856
1300 3.778
1350 3.706
1400 3.639
1450 3.576
1500 3.517
1550 3.461
1600 3.409
1650 3.36
1700 3.313
1750 3.269
1800 3.227
1850 3.187
1900 3.149
1950 3.113
2000 3.078
2100 3.013
2200 2.953
2300 2.898
2400 2.847
2500 2.799
2600 2.755
2700 2.713
2800 2.674
2900 2.637
3000 2.602
3100 2.569
3200 2.538
3300 2.508
3400 2.48
3500 2.453
3600 2.427
3700 2.403
3800 2.379
3900 2.356
4000 2.335
4100 2.314
4200 2.294
4300 2.275
4400 2.256
4500 2.239
4600 2.221
4700 2.205
4800 2.189
4900 2.173
5000 2.158
5200 2.129
5400 2.103
5600 2.077
5800 2.053
6000 2.03
6200 2.009
6400 1.988
6600 1.969
6800 1.95
7000 1.933
7200 1.916
7400 1.9
7600 1.884
7800 1.869
8000 1.855
8200 1.841
8400 1.828
8600 1.815
8800 1.803
9000 1.791
9200 1.78
9400 1.769
9600 1.758
9800 1.747
10000 1.737
10500 1.714
11000 1.692
11500 1.671
12000 1.652
12500 1.634
13000 1.616
13500 1.6
14000 1.585
14500 1.57
15000 1.557
15500 1.543
16000 1.531
16500 1.519
17000 1.507
17500 1.496
18000 1.485
18500 1.475
19000 1.465
19500 1.455
20000 1.446
21000 1.428
22000 1.412
23000 1.396
24000 1.381
25000 1.367
26000 1.354
27000 1.341
28001 1.329
29000 1.318
30001 1.307
31001 1.296
32000 1.286
33000 1.277
34000 1.268
35000 1.259
36001 1.251
37000 1.243
38001 1.236
39000 1.229
40000 1.222
41000 1.216
42000 1.21
43000 1.204
44000 1.199
45000 1.194
46000 1.19
47000 1.186
48001 1.182
49000 1.178
50000 1.175
55001 1.164
60000 1.161
65000 1.16

View File

@ -1,123 +0,0 @@
sens=c_t
unit=Ohm
type=C
form=loglog
curv
290277 0.8
49174 1.1844
45504 1.2021
37196 1.2575
29580 1.3252
23801 1.3965
19297 1.4695
15840 1.546
13083 1.6267
12653 1.6416
12118 1.6622
10903 1.7092
10060 1.7512
9168.6 1.7978
8437.1 1.8424
7757.7 1.8895
7171.7 1.9382
6624.6 1.9864
6131.6 2.0355
5672.1 2.0887
5441.5 2.1172
5278.3 2.1399
5122 2.1595
4906.5 2.1913
4551 2.2492
4266 2.3013
3960.9 2.3632
3716.3 2.4197
3466 2.4824
3258.7 2.541
3045.9 2.6078
2873.2 2.6686
2695.2 2.7384
2544.3 2.8036
2265.5 2.9445
2128.3 3.0242
2022.8 3.0924
1907.6 3.1744
1815.8 3.2462
1545.4 3.5039
1301.3 3.8249
1223.1 3.952
1120.2 4.1453
1030.7 4.3453
949.41 4.5588
871.45 4.7969
811.95 5.0209
755.31 5.2629
703.23 5.5225
657.85 5.7898
616.25 6.0735
578.68 6.3716
544.67 6.6851
507.24 7.0827
482.02 7.3788
459.77 7.6798
438.21 8.0109
417.54 8.3813
396.98 8.7969
377.93 9.251
360.75 9.7156
345.18 10.198
331.02 10.7
317.86 11.218
305.81 11.761
294.64 12.329
284.17 12.925
274.42 13.543
265.18 14.192
256.54 14.872
248.51 15.58
240.96 16.321
233.86 17.093
227.27 17.891
220.98 18.742
214.77 19.674
208.93 20.652
203.42 21.68
198.1 22.782
193.13 23.969
188.32 25.222
183.72 26.55
175.19 29.445
171.2 31.031
167.36 32.719
163.69 34.522
160.15 36.444
156.74 38.504
153.45 40.722
150.29 43.131
146.54 46.351
144.07 48.729
141.74 51.17
139.49 53.701
137.34 56.349
135.24 59.172
133.23 62.116
131.26 65.235
129.38 68.478
127.6 71.879
125.88 75.426
124.22 79.175
122.61 83.13
121.08 87.312
119.6 91.725
116.82 101.23
114.35 111.5
112.11 122.66
110.07 134.97
106.49 165.24
105.14 181.66
103.99 199.82
103.07 219.79
102.35 241.71
101.84 265.85
101.55 292.41
101.48 321.47

View File

@ -1,23 +0,0 @@
sens=cab505
unit=Ohm
type=C
form=loglog
curv
48000 2.5
9506 4.2
2800 8
1600 12
925.9 21.8
805.8 26.4
737.5 30.1
674.3 35
625.0 40
588.6 45
557.4 50
533.0 55
512.3 60
460.8 77
419.8 100.2
344.8 200
339.1 220
320 300

View File

@ -1,7 +0,0 @@
sensA.type=m sensA.curve=x31318
sensC.type=k sensC.curve=x31320
sensD.type=s sensD.curve=x31319
dev="4 K closed cycle refrigerator (FOCUS)"
tlimit=700 resist=25 maxPower=100
sensA.alarm=310
prop=50 int=20 deriv=0

View File

@ -1,8 +0,0 @@
sensA.type=t sensA.curve=x14231 sensA.alarm=310
sensB.type=m sensB.curve=pt100e
sensC.type=k sensC.curve=x10409
sensD.type=s sensD.curve=x24506
dev="4 K closed cycle refrigerator (FOCUS) with hi-T stage"
tlimit=700 resist=25 maxPower=100
prop=50 int=20 deriv=0

View File

@ -1,4 +0,0 @@
sensA.type=m sensA.curve=x22644
dev="4 K closed cycle refrigerator"
tlimit=310 resist=25 maxPower=100
prop=50 int=20 deriv=0

View File

@ -1,65 +0,0 @@
sens=ccs130
unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically
!tlim=325 ! setpoint limit (automatic if omitted)
type=C ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted)
!excit=100uA ! (off,30nA,100nA,300nA,1uA,3uA,10uA,30uA,100uA,300uA,1mA,10mV,1mV) (if omitted: default from sensor type)
!range=333333 ! range in sensor units (if rang=0: determine range from table, if omitted: default from sensor type)
curv ! curve (sensor,temp/K) follows, must be ordered, but can be increasing or decreasing
16000 1.244393476
15200 1.285367202
14440 1.328663252
13718 1.374439348
13032 1.422875796
12380 1.474181416
11761 1.52850843
11172 1.586218689
10613 1.647425693
10082 1.712465327
9577 1.781745861
9098 1.855443001
8643 1.934058129
8210 2.018215323
7799 2.108233951
7409 2.204664752
7038 2.308439192
6686 2.420075417
6351 2.540838002
6033 2.671491983
5731 2.813308366
5444 2.967822828
5171 3.136910729
4912 3.322118864
4666 3.52596846
4432 3.751599155
4210 4.001751141
3999 4.280838061
3799 4.59279255
3609 4.943939063
3428 5.342442547
3256 5.796123843
3093 6.313967225
2938 6.910359479
2791 7.599287093
2651 8.403199284
2518 9.344690735
2392 10.4503784
2272 11.76331676
2158 13.32775638
2050 15.19642266
1947 17.45575579
1849 20.19676627
1756 23.52986632
1668 27.5869931
1584 32.59016947
1504 38.77520717
1428 46.43078775
1356 55.90478999
1288 67.60768096
1223 82.26763593
1161 100.6430743
1102 123.6586838
1046 152.4202751
993 188.2165653
943 232.4978903
895 288.1383817
850 356.1477994

View File

@ -1,23 +0,0 @@
sens=cma11
unit=Ohm
type=C
form=loglog
curv
50007 1
6507 2
2207 3
1107 4.2
632 6
357 10
257 15
217 20
187 27
167 35
147 50
131 77
122 100
114 150
110 200
105 300
97 500

View File

@ -1,62 +0,0 @@
sens=cma11r1al
unit=Ohm
type=C
form=loglog
curv
53486 1.2
35350 1.32
24153 1.45
16649 1.6
11902 1.76
8645.8 1.94
6405.5 2.14
4848.6 2.36
3750.7 2.6
2963.5 2.86
2372.1 3.15
1926.9 3.47
1589.5 3.82
1320 4.22
1107.26 4.67
942.71 5.16
811.96 5.7
706.11 6.3
620.44 6.96
550.02 7.69
491.48 8.5
442.41 9.4
401.38 10.39
366.47 11.49
336.88 12.7
311.46 14.04
289.56 15.52
270.53 17.16
253.98 18.97
239.50 20.97
226.79 23.18
215.53 25.63
205.60 28.33
196.75 31.32
188.88 34.62
181.84 38.27
175.52 42.31
169.84 46.77
164.73 51.7
160.12 57.15
155.94 63.18
152.15 69.85
148.63 77.4
145.58 85.3
142.77 94
140.17 103.6
137.78 114.2
135.61 125.8
133.63 138.6
131.83 152.7
130.21 168.3
128.75 185.5
127.48 204.4
126.36 225.2
125.40 248.2
124.61 273
123.89 300.8

View File

@ -1,62 +0,0 @@
sens=cma11r2ol
unit=Ohm
type=C
form=loglog
curv
45084 1.2
29807 1.32
20375 1.45
14053 1.6
10054 1.76
7311.2 1.94
5424.1 2.14
4112.5 2.36
3187.7 2.6
2524.5 2.86
2026.3 3.15
1651.2 3.47
1367.0 3.82
1140 4.22
960.79 4.67
822.17 5.16
712.02 5.7
622.86 6.3
550.69 6.96
491.37 7.69
442.05 8.5
400.72 9.4
366.15 10.39
336.75 11.49
311.82 12.7
290.41 14.04
271.96 15.52
255.93 17.16
241.99 18.97
229.79 20.97
219.08 23.18
209.60 25.63
201.23 28.33
193.78 31.32
187.15 34.62
181.22 38.27
175.89 42.31
171.11 46.77
166.80 51.7
162.92 57.15
159.40 63.18
156.20 69.85
153.24 77.4
150.64 85.3
148.17 94
145.83 103.6
143.61 114.2
141.53 125.8
139.55 138.6
137.69 152.7
135.92 168.3
134.26 185.5
132.71 204.4
131.25 225.2
129.88 248.2
128.63 273
127.41 300.8

View File

@ -1,62 +0,0 @@
sens=cma11r3lc
unit=Ohm
type=C
form=loglog
curv
43962 1.2
29064 1.32
19867 1.45
13703 1.6
9803 1.76
7128.6 1.94
5288.4 2.14
4009.5 2.36
3107.7 2.6
2461.0 2.86
1975.2 3.15
1609.5 3.47
1332.4 3.82
1111 4.22
936.25 4.67
801.08 5.16
693.68 5.7
606.73 6.3
536.36 6.96
478.51 7.69
430.42 8.5
390.12 9.4
356.41 10.39
327.74 11.49
303.44 12.7
282.55 14.04
264.56 15.52
248.93 17.16
235.34 18.97
223.45 20.97
213.00 23.18
203.76 25.63
195.59 28.33
188.33 31.32
181.86 34.62
176.08 38.27
170.89 42.31
166.23 46.77
162.03 51.7
158.24 57.15
154.80 63.18
151.69 69.85
148.80 77.4
146.27 85.3
143.87 94
141.59 103.6
139.44 114.2
137.42 125.8
135.51 138.6
133.71 152.7
132.02 168.3
130.42 185.5
128.94 204.4
127.55 225.2
126.25 248.2
125.06 273
123.91 300.8

View File

@ -1,62 +0,0 @@
sens=cma11r4rc
unit=Ohm
type=C
form=loglog
curv
35372 1.2
23387 1.32
15987 1.45
11028 1.6
7891 1.76
5739.2 1.94
4258.8 2.14
3229.9 2.36
2504.4 2.6
1984.1 2.86
1593.3 3.15
1299.1 3.47
1076.1 3.82
898 4.22
757.41 4.67
648.66 5.16
562.26 5.7
492.31 6.3
435.70 6.96
389.16 7.69
350.47 8.5
318.04 9.4
290.93 10.39
267.86 11.49
248.31 12.7
231.51 14.04
217.03 15.52
204.46 17.16
193.52 18.97
183.95 20.97
175.55 23.18
168.11 25.63
161.55 28.33
155.70 31.32
150.50 34.62
145.85 38.27
141.67 42.31
137.92 46.77
134.54 51.7
131.49 57.15
128.73 63.18
126.22 69.85
123.90 77.4
121.84 85.3
119.87 94
117.96 103.6
116.12 114.2
114.36 125.8
112.66 138.6
111.03 152.7
109.45 168.3
107.94 185.5
106.48 204.4
105.09 225.2
103.74 248.2
102.47 273
101.21 300.8

View File

@ -1,23 +0,0 @@
sens=cplus45
unit=Ohm
type=C
form=loglog
curv
50045 1
6545 2
2245 3
1145 4.2
670 6
395 10
295 15
255 20
225 27
205 35
185 50
169 77
161 100
152 150
148 200
143 300
135 500

View File

@ -1,23 +0,0 @@
sens=cplus70
unit=Ohm
type=C
form=loglog
curv
50070 1
6570 2
2270 3
1170 4.2
695 6
420 10
320 15
280 20
250 27
230 35
210 50
194 77
186 100
177 150
173 200
168 300
135 500

View File

@ -1,51 +0,0 @@
sens=cs405
unit=Ohm
type=C
form=loglog
curv
8342.788494 0.29
7997.108246 0.3
7385.224382 0.32
6860.63041 0.34
6406.112969 0.36
5658.608243 0.4
5070.752206 0.44
4597.749769 0.48
4210.063652 0.52
3887.352305 0.56
3615.181303 0.6
3330.280576 0.65
3093.128214 0.7
2893.109164 0.75
2722.418161 0.8
2575.268002 0.85
2447.269899 0.9
2335.06011 0.95
2236.020956 1
2148.092966 1.05
2069.625085 1.1
1999.285056 1.15
1935.977983 1.2
1878.783871 1.25
1826.93583 1.3
1779.78886 1.35
1736.797991 1.4
1697.485938 1.45
1661.422111 1.5
1518.391902 1.75
1417.276946 2
1341.147035 2.25
1280.347927 2.5
1230.110043 2.75
1188.629004 3
1153.26912 3.25
1121.726004 3.5
1092.415035 3.75
1065.750065 4
1042.61099 4.25
1022.648076 4.5
1005.397982 4.75
990.4706816 5
966.1023663 5.5
946.5027198 6
470.0000000 300

View File

@ -1,4 +0,0 @@
sensA.type=m sensA.curve=r10401
dev="CTI closed cycle refrigerator"
tlimit=310 resist=25 maxPower=25
prop=15 int=10 deriv=0

View File

@ -1,4 +0,0 @@
sensA.type=m sensA.curve=r10402
dev="CTI closed cycle refrigerator"
tlimit=310 resist=25 maxPower=25
prop=15 int=10 deriv=0

Some files were not shown because too many files have changed in this diff Show More