diff --git a/binprot.c b/binprot.c index dcae992..f0ce52f 100644 --- a/binprot.c +++ b/binprot.c @@ -357,7 +357,12 @@ int BinHandler(Ascon *a) { } while (res == 1); p->nextFmt = str + pos; a->wrPos = 0; - a->state = AsconWriting; + if (GetDynStringLength(a->wrBuffer) == 0) { + /* prevent to swallow "garbage" */ + a->state = AsconWriteDone; + } else { + a->state = AsconWriting; + } a->lineCount = 0; return 1; case AsconReadStart: diff --git a/ease.c b/ease.c index 036696d..a434723 100644 --- a/ease.c +++ b/ease.c @@ -61,7 +61,7 @@ void EaseStop(EaseBase * eab, char *reason) snprintf(eab->msg, sizeof eab->msg, "offline (%s)", reason); ParPrintf(eab, eLogError, "ERROR: %s", eab->msg); } - eab->state = EASE_notconnected; + eab->state = EASE_offline; } /*----------------------------------------------------------------------------*/ @@ -754,7 +754,7 @@ static int EaseInit(SConnection * pCon, EaseBase * eab, int argc, : */ - int port=0, iRet, i; + int port, iRet, i; rs232 *ser; char *colon, *host; char buf[64]; diff --git a/make_gen b/make_gen index 0d13ce5..cf4796f 100644 --- a/make_gen +++ b/make_gen @@ -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 \ polterwrite.o ecb.o frame.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 \ el755driv.o serial.o scontroller.o t_update.o \ t_rlp.o t_conv.o el737hpdriv.o el734hp.o \ diff --git a/psi.c b/psi.c index ec24329..667c4c6 100644 --- a/psi.c +++ b/psi.c @@ -26,7 +26,6 @@ #include #include "sinqhmdriv.i" #include "tdchm.h" -#include "tecsdriv.h" #include "itc4.h" #include "bruker.h" #include "ltc11.h" @@ -313,9 +312,7 @@ static void ConfigureController(char *name, pEVControl pNew, { EVCSetPar(pNew, "upperlimit", 300.0, pCon); EVCSetPar(pNew, "lowerlimit", 1.0, pCon); - if (strcmp(name, "tecs") == 0) { - TecsCustomize(pCon, pNew); - } else if (strcmp(name, "euro") == 0) { + if (strcmp(name, "euro") == 0) { EVCSetPar(pNew, "upperlimit", 750.0, pCon); EVCSetPar(pNew, "lowerlimit", 15.0, pCon); } else if (strcmp(name, "el755") == 0) { @@ -351,17 +348,7 @@ static pEVControl InstallPsiEnvironmentController(SicsInterp * pSics, for the device. If 0 the default command will be installed later on */ - if (strcmp(argv[3], "tecs") == 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) { + if (strcmp(argv[3], "itc4") == 0) { checkError = 1; pDriv = CreateITC4Driver(argc - 4, &argv[4]); if (pDriv) { diff --git a/tecs/cd_obj b/tecs/cd_obj deleted file mode 100644 index 9212f7c..0000000 --- a/tecs/cd_obj +++ /dev/null @@ -1 +0,0 @@ -cd ../../obj/$SICS_VERSION/psi/tecs diff --git a/tecs/cfg/apd.cfg b/tecs/cfg/apd.cfg deleted file mode 100644 index d1849e7..0000000 --- a/tecs/cfg/apd.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/apdl.cfg b/tecs/cfg/apdl.cfg deleted file mode 100644 index 36b9255..0000000 --- a/tecs/cfg/apdl.cfg +++ /dev/null @@ -1,2 +0,0 @@ - sensC.type=x - dev="APD auxilliary sensor" diff --git a/tecs/cfg/ccr2.cfg b/tecs/cfg/ccr2.cfg deleted file mode 100644 index d399277..0000000 --- a/tecs/cfg/ccr2.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/ccr2ht.cfg b/tecs/cfg/ccr2ht.cfg deleted file mode 100644 index 3d002b3..0000000 --- a/tecs/cfg/ccr2ht.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/ccr4k.cfg b/tecs/cfg/ccr4k.cfg deleted file mode 100644 index 304b3f2..0000000 --- a/tecs/cfg/ccr4k.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/cti1.cfg b/tecs/cfg/cti1.cfg deleted file mode 100644 index 22a3872..0000000 --- a/tecs/cfg/cti1.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/cti2.cfg b/tecs/cfg/cti2.cfg deleted file mode 100644 index 141bef1..0000000 --- a/tecs/cfg/cti2.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/cti3.cfg b/tecs/cfg/cti3.cfg deleted file mode 100644 index db49323..0000000 --- a/tecs/cfg/cti3.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/cti4.cfg b/tecs/cfg/cti4.cfg deleted file mode 100644 index 6f535a4..0000000 --- a/tecs/cfg/cti4.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/cti5.cfg b/tecs/cfg/cti5.cfg deleted file mode 100644 index 752d299..0000000 --- a/tecs/cfg/cti5.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/cti6.cfg b/tecs/cfg/cti6.cfg deleted file mode 100644 index e7d7fa7..0000000 --- a/tecs/cfg/cti6.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/dil.cfg b/tecs/cfg/dil.cfg deleted file mode 100644 index d3ea599..0000000 --- a/tecs/cfg/dil.cfg +++ /dev/null @@ -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 - diff --git a/tecs/cfg/disc.cfg b/tecs/cfg/disc.cfg deleted file mode 100644 index 0c6b649..0000000 --- a/tecs/cfg/disc.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/dise.cfg b/tecs/cfg/dise.cfg deleted file mode 100644 index 0e1bea0..0000000 --- a/tecs/cfg/dise.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/fi.cfg b/tecs/cfg/fi.cfg deleted file mode 100644 index eb02c06..0000000 --- a/tecs/cfg/fi.cfg +++ /dev/null @@ -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" - diff --git a/tecs/cfg/fs.cfg b/tecs/cfg/fs.cfg deleted file mode 100644 index 17d9035..0000000 --- a/tecs/cfg/fs.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/ft.cfg b/tecs/cfg/ft.cfg deleted file mode 100644 index 412a88b..0000000 --- a/tecs/cfg/ft.cfg +++ /dev/null @@ -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" diff --git a/tecs/cfg/fw.cfg b/tecs/cfg/fw.cfg deleted file mode 100644 index e270efe..0000000 --- a/tecs/cfg/fw.cfg +++ /dev/null @@ -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" - diff --git a/tecs/cfg/hef4c.cfg b/tecs/cfg/hef4c.cfg deleted file mode 100644 index aa2df79..0000000 --- a/tecs/cfg/hef4c.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/hp.cfg b/tecs/cfg/hp.cfg deleted file mode 100644 index 57993d0..0000000 --- a/tecs/cfg/hp.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/ill1.cfg b/tecs/cfg/ill1.cfg deleted file mode 100644 index b17b7aa..0000000 --- a/tecs/cfg/ill1.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/ill2.cfg b/tecs/cfg/ill2.cfg deleted file mode 100644 index ef366e3..0000000 --- a/tecs/cfg/ill2.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/ill2p.cfg b/tecs/cfg/ill2p.cfg deleted file mode 100644 index b007ec8..0000000 --- a/tecs/cfg/ill2p.cfg +++ /dev/null @@ -1,2 +0,0 @@ - sensC.type=s sensC.curve=x22637 - dev="uniaxial pressure insert for ILL2" diff --git a/tecs/cfg/ill3.cfg b/tecs/cfg/ill3.cfg deleted file mode 100644 index 4284ad1..0000000 --- a/tecs/cfg/ill3.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/ill3f.cfg b/tecs/cfg/ill3f.cfg deleted file mode 100644 index a2a38dd..0000000 --- a/tecs/cfg/ill3f.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/ill4.cfg b/tecs/cfg/ill4.cfg deleted file mode 100644 index cfe1bbd..0000000 --- a/tecs/cfg/ill4.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/ill5.cfg b/tecs/cfg/ill5.cfg deleted file mode 100644 index 1e8a35d..0000000 --- a/tecs/cfg/ill5.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/ill5n.cfg b/tecs/cfg/ill5n.cfg deleted file mode 100644 index 9a23823..0000000 --- a/tecs/cfg/ill5n.cfg +++ /dev/null @@ -1,3 +0,0 @@ - sensC.type=s sensC.curve=x09883 - sensD.type=h - dev="precoolable sample stick for maxi orange cryostat" diff --git a/tecs/cfg/lsc.codes b/tecs/cfg/lsc.codes deleted file mode 100644 index a5a77c8..0000000 --- a/tecs/cfg/lsc.codes +++ /dev/null @@ -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 diff --git a/tecs/cfg/ma02.cfg b/tecs/cfg/ma02.cfg deleted file mode 100644 index 7ca80c3..0000000 --- a/tecs/cfg/ma02.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/ma09.cfg b/tecs/cfg/ma09.cfg deleted file mode 100644 index 134799d..0000000 --- a/tecs/cfg/ma09.cfg +++ /dev/null @@ -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" diff --git a/tecs/cfg/ma11.cfg b/tecs/cfg/ma11.cfg deleted file mode 100644 index f9fceff..0000000 --- a/tecs/cfg/ma11.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/ma11_test.cfg b/tecs/cfg/ma11_test.cfg deleted file mode 100644 index 92fafa9..0000000 --- a/tecs/cfg/ma11_test.cfg +++ /dev/null @@ -1,3 +0,0 @@ - sensC.type=t sensC.curve=cma11 - dev="SANS test carbon resistors" - lscfg="dispfld 2,C,3;display 2" diff --git a/tecs/cfg/ma11a.cfg b/tecs/cfg/ma11a.cfg deleted file mode 100644 index 9e8fcd2..0000000 --- a/tecs/cfg/ma11a.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/ma11r.cfg b/tecs/cfg/ma11r.cfg deleted file mode 100644 index 24538f7..0000000 --- a/tecs/cfg/ma11r.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/ma15.cfg b/tecs/cfg/ma15.cfg deleted file mode 100644 index 5e7286b..0000000 --- a/tecs/cfg/ma15.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/ori1.cfg b/tecs/cfg/ori1.cfg deleted file mode 100644 index 7b043ac..0000000 --- a/tecs/cfg/ori1.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/ori2.cfg b/tecs/cfg/ori2.cfg deleted file mode 100644 index 7bee7c7..0000000 --- a/tecs/cfg/ori2.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/ori3.cfg b/tecs/cfg/ori3.cfg deleted file mode 100644 index 069a927..0000000 --- a/tecs/cfg/ori3.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/rdr.cfg b/tecs/cfg/rdr.cfg deleted file mode 100644 index b9066b5..0000000 --- a/tecs/cfg/rdr.cfg +++ /dev/null @@ -1,2 +0,0 @@ -INCRV C,0;LINEAR C:2,0.01,1,2 -DISPFLD 2,C,4;DISPFLD 3,A,3;DISPLAY:3 diff --git a/tecs/cfg/rdr11.cfg b/tecs/cfg/rdr11.cfg deleted file mode 100644 index c65f94c..0000000 --- a/tecs/cfg/rdr11.cfg +++ /dev/null @@ -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" - diff --git a/tecs/cfg/rdr12.cfg b/tecs/cfg/rdr12.cfg deleted file mode 100644 index 5351238..0000000 --- a/tecs/cfg/rdr12.cfg +++ /dev/null @@ -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" - diff --git a/tecs/cfg/sup4t.cfg b/tecs/cfg/sup4t.cfg deleted file mode 100644 index 4e9c9bf..0000000 --- a/tecs/cfg/sup4t.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/test.cfg b/tecs/cfg/test.cfg deleted file mode 100644 index 241182b..0000000 --- a/tecs/cfg/test.cfg +++ /dev/null @@ -1,5 +0,0 @@ -display 8 -dispfld 5,A01,3 -dispfld 6,A02,3 -dispfld 7,A03,3 -dispfld 8,A04,3 diff --git a/tecs/cfg/tubby.cfg b/tecs/cfg/tubby.cfg deleted file mode 100644 index cfa8ca4..0000000 --- a/tecs/cfg/tubby.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/tubby2.cfg b/tecs/cfg/tubby2.cfg deleted file mode 100644 index 8f4c1cd..0000000 --- a/tecs/cfg/tubby2.cfg +++ /dev/null @@ -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 diff --git a/tecs/cfg/variox.cfg b/tecs/cfg/variox.cfg deleted file mode 100644 index 043af09..0000000 --- a/tecs/cfg/variox.cfg +++ /dev/null @@ -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 diff --git a/tecs/coc_client.c b/tecs/coc_client.c deleted file mode 100644 index 5e94b40..0000000 --- a/tecs/coc_client.c +++ /dev/null @@ -1,539 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#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 && inargs) { - 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=""; - } 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); -} - diff --git a/tecs/coc_client.h b/tecs/coc_client.h deleted file mode 100644 index 37d1a4e..0000000 --- a/tecs/coc_client.h +++ /dev/null @@ -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_ */ diff --git a/tecs/coc_logfile.c b/tecs/coc_logfile.c deleted file mode 100644 index d157fcc..0000000 --- a/tecs/coc_logfile.c +++ /dev/null @@ -1,350 +0,0 @@ -#include -#include -#include -#include -#include -#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, ""); - 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, ""); - 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, ""); 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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; inpend; 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; inpend; 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; inpend; 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); -} diff --git a/tecs/coc_server.h b/tecs/coc_server.h deleted file mode 100644 index 0ab953c..0000000 --- a/tecs/coc_server.h +++ /dev/null @@ -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 of variable list to the buffer -*/ - -int CocGetVar(const char *name, StrBuf *buf, int separator); -/* - get a variable named of variable list from the buffer -*/ - -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_ */ diff --git a/tecs/coc_util.c b/tecs/coc_util.c deleted file mode 100644 index be855b7..0000000 --- a/tecs/coc_util.c +++ /dev/null @@ -1,113 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#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->wrposbuf+buf->wrpos, siz, 0)); - buf->wrpos+=l; - } - StrReset(buf); - return(buf->wrpos); - OnError: return(-1); -} - diff --git a/tecs/coc_util.h b/tecs/coc_util.h deleted file mode 100644 index 22327e0..0000000 --- a/tecs/coc_util.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef _COC_UTIL_H_ -#define _COC_UTIL_H_ - -#include -#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_ */ diff --git a/tecs/conv.f b/tecs/conv.f deleted file mode 100644 index 40d17f1..0000000 --- a/tecs/conv.f +++ /dev/null @@ -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='' - 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 diff --git a/tecs/conv.f90 b/tecs/conv.f90 deleted file mode 100644 index 3ee85c1..0000000 --- a/tecs/conv.f90 +++ /dev/null @@ -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='' - 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 diff --git a/tecs/conv.inc b/tecs/conv.inc deleted file mode 100644 index 3febb0d..0000000 --- a/tecs/conv.inc +++ /dev/null @@ -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 - diff --git a/tecs/cvt.f b/tecs/cvt.f deleted file mode 100644 index 219730b..0000000 --- a/tecs/cvt.f +++ /dev/null @@ -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.. -!! 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 diff --git a/tecs/didi b/tecs/didi deleted file mode 100755 index edbac50..0000000 --- a/tecs/didi +++ /dev/null @@ -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 - diff --git a/tecs/fortify1.c b/tecs/fortify1.c deleted file mode 100644 index a3def4c..0000000 --- a/tecs/fortify1.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "fortify.c" -#ifndef FORTIFY - void null(void){} -#endif diff --git a/tecs/inilist b/tecs/inilist deleted file mode 100644 index 3c957e5..0000000 --- a/tecs/inilist +++ /dev/null @@ -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 diff --git a/tecs/inp/apd.cfg b/tecs/inp/apd.cfg deleted file mode 100644 index d1849e7..0000000 --- a/tecs/inp/apd.cfg +++ /dev/null @@ -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 diff --git a/tecs/inp/apdl.cfg b/tecs/inp/apdl.cfg deleted file mode 100644 index 36b9255..0000000 --- a/tecs/inp/apdl.cfg +++ /dev/null @@ -1,2 +0,0 @@ - sensC.type=x - dev="APD auxilliary sensor" diff --git a/tecs/inp/c020415.inp b/tecs/inp/c020415.inp deleted file mode 100644 index 444dc4c..0000000 --- a/tecs/inp/c020415.inp +++ /dev/null @@ -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 - - diff --git a/tecs/inp/c030307.inp b/tecs/inp/c030307.inp deleted file mode 100644 index 7e7681f..0000000 --- a/tecs/inp/c030307.inp +++ /dev/null @@ -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 - - diff --git a/tecs/inp/c030311.inp b/tecs/inp/c030311.inp deleted file mode 100644 index 3ee2056..0000000 --- a/tecs/inp/c030311.inp +++ /dev/null @@ -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 - - diff --git a/tecs/inp/c1.inp b/tecs/inp/c1.inp deleted file mode 100644 index ec5dc2b..0000000 --- a/tecs/inp/c1.inp +++ /dev/null @@ -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 - - diff --git a/tecs/inp/c12900.inp b/tecs/inp/c12900.inp deleted file mode 100644 index 4136dde..0000000 --- a/tecs/inp/c12900.inp +++ /dev/null @@ -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 - - diff --git a/tecs/inp/c17844.inp b/tecs/inp/c17844.inp deleted file mode 100644 index bd1ab0a..0000000 --- a/tecs/inp/c17844.inp +++ /dev/null @@ -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 - - diff --git a/tecs/inp/c2.inp b/tecs/inp/c2.inp deleted file mode 100644 index a83e1bb..0000000 --- a/tecs/inp/c2.inp +++ /dev/null @@ -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 - diff --git a/tecs/inp/c9r1al.inp b/tecs/inp/c9r1al.inp deleted file mode 100644 index d1ed6af..0000000 --- a/tecs/inp/c9r1al.inp +++ /dev/null @@ -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 diff --git a/tecs/inp/c9r2ol.inp b/tecs/inp/c9r2ol.inp deleted file mode 100644 index 4cc324a..0000000 --- a/tecs/inp/c9r2ol.inp +++ /dev/null @@ -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 diff --git a/tecs/inp/c9r3tc.inp b/tecs/inp/c9r3tc.inp deleted file mode 100644 index eba2386..0000000 --- a/tecs/inp/c9r3tc.inp +++ /dev/null @@ -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 diff --git a/tecs/inp/c9r4bc.inp b/tecs/inp/c9r4bc.inp deleted file mode 100644 index 2793fb3..0000000 --- a/tecs/inp/c9r4bc.inp +++ /dev/null @@ -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 diff --git a/tecs/inp/c_1.inp b/tecs/inp/c_1.inp deleted file mode 100644 index ccd717b..0000000 --- a/tecs/inp/c_1.inp +++ /dev/null @@ -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 - - diff --git a/tecs/inp/c_2.inp b/tecs/inp/c_2.inp deleted file mode 100644 index f623b60..0000000 --- a/tecs/inp/c_2.inp +++ /dev/null @@ -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 - - diff --git a/tecs/inp/c_3.inp b/tecs/inp/c_3.inp deleted file mode 100644 index 8086b2c..0000000 --- a/tecs/inp/c_3.inp +++ /dev/null @@ -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 - - diff --git a/tecs/inp/c_4.inp b/tecs/inp/c_4.inp deleted file mode 100644 index aecc9ad..0000000 --- a/tecs/inp/c_4.inp +++ /dev/null @@ -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 - diff --git a/tecs/inp/c_ab.inp b/tecs/inp/c_ab.inp deleted file mode 100644 index 4307465..0000000 --- a/tecs/inp/c_ab.inp +++ /dev/null @@ -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 diff --git a/tecs/inp/c_ill.inp b/tecs/inp/c_ill.inp deleted file mode 100644 index 99f4552..0000000 --- a/tecs/inp/c_ill.inp +++ /dev/null @@ -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 diff --git a/tecs/inp/c_t.inp b/tecs/inp/c_t.inp deleted file mode 100644 index 5302676..0000000 --- a/tecs/inp/c_t.inp +++ /dev/null @@ -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 - diff --git a/tecs/inp/cab505.inp b/tecs/inp/cab505.inp deleted file mode 100644 index b5f71b5..0000000 --- a/tecs/inp/cab505.inp +++ /dev/null @@ -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 diff --git a/tecs/inp/ccr2.cfg b/tecs/inp/ccr2.cfg deleted file mode 100644 index 4c7001c..0000000 --- a/tecs/inp/ccr2.cfg +++ /dev/null @@ -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 diff --git a/tecs/inp/ccr2ht.cfg b/tecs/inp/ccr2ht.cfg deleted file mode 100644 index 78e9d86..0000000 --- a/tecs/inp/ccr2ht.cfg +++ /dev/null @@ -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 diff --git a/tecs/inp/ccr4k.cfg b/tecs/inp/ccr4k.cfg deleted file mode 100644 index b974ab0..0000000 --- a/tecs/inp/ccr4k.cfg +++ /dev/null @@ -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 diff --git a/tecs/inp/ccs130.inp b/tecs/inp/ccs130.inp deleted file mode 100644 index 8a5bf71..0000000 --- a/tecs/inp/ccs130.inp +++ /dev/null @@ -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 diff --git a/tecs/inp/cma11.inp b/tecs/inp/cma11.inp deleted file mode 100644 index a86d33c..0000000 --- a/tecs/inp/cma11.inp +++ /dev/null @@ -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 - diff --git a/tecs/inp/cma11r1al.inp b/tecs/inp/cma11r1al.inp deleted file mode 100644 index 7a4ec6a..0000000 --- a/tecs/inp/cma11r1al.inp +++ /dev/null @@ -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 diff --git a/tecs/inp/cma11r2ol.inp b/tecs/inp/cma11r2ol.inp deleted file mode 100644 index 5110227..0000000 --- a/tecs/inp/cma11r2ol.inp +++ /dev/null @@ -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 diff --git a/tecs/inp/cma11r3lc.inp b/tecs/inp/cma11r3lc.inp deleted file mode 100644 index 1cb22b7..0000000 --- a/tecs/inp/cma11r3lc.inp +++ /dev/null @@ -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 diff --git a/tecs/inp/cma11r4rc.inp b/tecs/inp/cma11r4rc.inp deleted file mode 100644 index 0b350c9..0000000 --- a/tecs/inp/cma11r4rc.inp +++ /dev/null @@ -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 diff --git a/tecs/inp/cplus45.inp b/tecs/inp/cplus45.inp deleted file mode 100644 index 073af53..0000000 --- a/tecs/inp/cplus45.inp +++ /dev/null @@ -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 - diff --git a/tecs/inp/cplus70.inp b/tecs/inp/cplus70.inp deleted file mode 100644 index f04330d..0000000 --- a/tecs/inp/cplus70.inp +++ /dev/null @@ -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 - diff --git a/tecs/inp/cs405.inp b/tecs/inp/cs405.inp deleted file mode 100644 index 069ed8a..0000000 --- a/tecs/inp/cs405.inp +++ /dev/null @@ -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 diff --git a/tecs/inp/cti1.cfg b/tecs/inp/cti1.cfg deleted file mode 100644 index 22a3872..0000000 --- a/tecs/inp/cti1.cfg +++ /dev/null @@ -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 diff --git a/tecs/inp/cti2.cfg b/tecs/inp/cti2.cfg deleted file mode 100644 index 141bef1..0000000 --- a/tecs/inp/cti2.cfg +++ /dev/null @@ -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 diff --git a/tecs/inp/cti3.cfg b/tecs/inp/cti3.cfg deleted file mode 100644 index db49323..0000000 --- a/tecs/inp/cti3.cfg +++ /dev/null @@ -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 diff --git a/tecs/inp/cti4.cfg b/tecs/inp/cti4.cfg deleted file mode 100644 index 6f535a4..0000000 --- a/tecs/inp/cti4.cfg +++ /dev/null @@ -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 diff --git a/tecs/inp/cti5.cfg b/tecs/inp/cti5.cfg deleted file mode 100644 index 752d299..0000000 --- a/tecs/inp/cti5.cfg +++ /dev/null @@ -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 diff --git a/tecs/inp/cti6.cfg b/tecs/inp/cti6.cfg deleted file mode 100644 index e7d7fa7..0000000 --- a/tecs/inp/cti6.cfg +++ /dev/null @@ -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 diff --git a/tecs/inp/d69874.inp b/tecs/inp/d69874.inp deleted file mode 100644 index e5f115c..0000000 --- a/tecs/inp/d69874.inp +++ /dev/null @@ -1,89 +0,0 @@ -sens=d69874 -unit=V ! sensor format (mV,V,Ohm), log formats are choosen automatically -type=Si ! 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 -2.5 0.1 -1.70166 1.206115454 -1.70061 1.300724199 -1.69938 1.399359077 -1.69477 1.700224844 -1.68898 2.000190311 -1.67939 2.409015434 -1.66863 2.808319774 -1.65731 3.197090444 -1.64145 3.70800616 -1.62477 4.208805362 -1.59472 5.041509071 -1.5569 6.036625774 -1.51788 7.043615905 -1.4805 8.049115517 -1.44665 9.050640424 -1.41624 10.05672177 -1.38866 11.07133979 -1.36365 12.08035127 -1.34067 13.08622391 -1.31935 14.08984866 -1.29953 15.08281536 -1.28062 16.07888156 -1.26261 17.06589655 -1.24508 18.05563504 -1.22789 19.04434714 -1.21069 20.03489862 -1.192858 21.02628401 -1.177339 21.82222286 -1.160059 22.61615936 -1.146936 23.21226008 -1.136114 23.81471505 -1.128544 24.4170381 -1.123608 25.02342928 -1.120169 25.63556026 -1.116763 26.44767369 -1.114039 27.25143032 -1.111648 28.06297608 -1.108935 29.08217224 -1.106477 30.09146138 -1.102034 32.10717737 -1.096078 35.1165167 -1.090562 38.11868609 -1.083513 42.1166364 -1.076566 46.10865294 -1.066037 52.10658724 -1.055345 58.10314006 -1.044485 64.09583011 -1.033394 70.10097833 -1.022103 76.0942937 -1.010592 82.08489541 -0.998842 88.08520748 -0.986897 94.0812009 -0.974752 100.0831034 -0.954156 110.0771377 -0.922485 125.0690044 -0.890024 140.0681686 -0.856976 155.0489289 -0.823328 170.0614364 -0.789244 185.0654654 -0.754773 200.0624368 -0.719951 215.0556281 -0.68481 230.0511625 -0.649389 245.0460917 -0.613719 260.0499564 -0.577864 275.056954 -0.541869 290.0619192 -0.505755 305.0580423 -0.469434 320.0747391 -0.442465 331.1476827 -0.410011 344.4514919 -0.373359 359.3972318 -0.336519 374.3266317 -0.299337 389.3009365 -0.262007 404.251194 -0.22448 419.2132173 -0.18702 434.1328123 -0.149732 449.085075 -0.113418 464.0388254 -0.0796288 478.9810803 -0.0596554 488.9597505 -0.0426973 498.9433985 -0.0355291 503.9421281 - - diff --git a/tecs/inp/dil.cfg b/tecs/inp/dil.cfg deleted file mode 100644 index 9195ff7..0000000 --- a/tecs/inp/dil.cfg +++ /dev/null @@ -1,6 +0,0 @@ - sensC.type=s sensC.curve=rxdil - dev="dilution (Risoe)" - tlimit=375 resist=25 maxpower=25 - prop=20 int=10 deriv=0 - loop=2 - diff --git a/tecs/inp/disc.cfg b/tecs/inp/disc.cfg deleted file mode 100644 index 0c6b649..0000000 --- a/tecs/inp/disc.cfg +++ /dev/null @@ -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 diff --git a/tecs/inp/dise.cfg b/tecs/inp/dise.cfg deleted file mode 100644 index 27a337b..0000000 --- a/tecs/inp/dise.cfg +++ /dev/null @@ -1,6 +0,0 @@ - sensA.type=m sensA.curve=psam - sensB.type=n sensB.curve=g26552 - dev="Displex closed cycle refrigerator E" - tlimit=310 resist=50 maxpower=50 - sensA.lim=30 sensB.lim=60 - prop=15 int=10 deriv=0 diff --git a/tecs/inp/ds3b.inp b/tecs/inp/ds3b.inp deleted file mode 100644 index f8fbfb7..0000000 --- a/tecs/inp/ds3b.inp +++ /dev/null @@ -1,76 +0,0 @@ -sens=ds3b -unit=V ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=Si ! 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 -2.0 1.0 -1.701 1.023 -1.696 1.339 -1.691 1.634 -1.681 2.096 -1.671 2.507 -1.659 2.969 -1.644 3.482 -1.627 4.035 -1.602 4.782 -1.564 5.825 -1.527 6.836 -1.489 7.865 -1.455 8.890 -1.42273 9.93526 -1.39637 10.8854 -1.3709 11.8914 -1.34717 12.9115 -1.3257 13.9068 -1.30501 14.9288 -1.2869 15.871 -1.26837 16.872 -1.24986 17.9012 -1.23182 18.9267 -1.21451 19.9173 -1.19683 20.9082 -1.18224 21.6778 -1.1643 22.5364 -1.1509 23.1421 -1.13892 23.7461 -1.1304 24.3304 -1.12457 24.9558 -1.12113 25.5134 -1.11756 26.3163 -1.11473 27.1373 -1.11227 27.9723 -1.10969 28.963 -1.10731 29.9676 -1.10303 31.9567 -1.09724 34.9549 -1.09182 37.9771 -1.08496 41.9734 -1.06774 51.9579 -1.05704 57.9796 -1.04616 63.991 -1.03518 69.9483 -1.02386 75.9817 -1.01241 81.9671 -1.00074 87.9604 -0.98883 93.9712 -0.97685 99.929 -0.95628 109.968 -0.92481 124.962 -0.89261 139.951 -0.85971 154.977 -0.82636 169.973 -0.79251 184.99 -0.75829 200.005 -0.72381 214.98 -0.68899 229.971 -0.65383 244.991 -0.61847 259.998 -0.58301 274.976 -0.54722 290.026 -0.5113 305.074 -0.47525 320.108 -0.45111 330.134 - - diff --git a/tecs/inp/dt-470.inp b/tecs/inp/dt-470.inp deleted file mode 100644 index 3375d10..0000000 --- a/tecs/inp/dt-470.inp +++ /dev/null @@ -1,94 +0,0 @@ -sens=dt-470 -unit=V ! sensor format (mV,V,Ohm), log formats are choosen automatically -type=Si ! 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 -2.5 0.1 -1.7027 1.1 -1.69818 1.4 -1.69367 1.7 -1.68585 2.1 -1.67398 2.6 -1.65156 3.4 -1.62622 4.2 -1.59075 5.2 -1.50258 7.5 -1.46684 8.5 -1.43474 9.5 -1.40605 10.5 -1.38012 11.5 -1.35642 12.5 -1.33438 13.5 -1.30404 15 -1.26685 17 -1.22321 19.5 -1.19645 21 -1.17705 22 -1.15558 23 -1.13598 24 -1.12463 25 -1.11896 26 -1.11517 27 -1.11212 28 -1.10945 29 -1.10702 30 -1.10476 31 -1.10263 32 -1.1006 33 -1.09864 34 -1.09489 36 -1.08953 39 -1.08781 40 -1.0775 46 -1.06702 52 -1.0563 58 -1.04353 65 -1.03425 70 -1.02482 75 -1.01525 80 -1.00552 85 -0.99565 90 -0.98564 95 -0.9755 100 -0.96524 105 -0.95487 110 -0.9444 115 -0.93383 120 -0.92317 125 -0.91243 130 -0.90161 135 -0.89072 140 -0.87976 145 -0.86874 150 -0.84651 160 -0.82405 170 -0.80139 180 -0.77857 190 -0.744 205 -0.70909 220 -0.67389 235 -0.63842 250 -0.60275 265 -0.55494 285 -0.51892 300 -0.50691 305 -0.4586 325 -0.44647 330 -0.41005 345 -0.36111 365 -0.32417 380 -0.28701 395 -0.27456 400 -0.24964 410 -0.22463 420 -0.19961 430 -0.1871 435 -0.17464 440 -0.16221 445 -0.14985 450 -0.13759 455 -0.12547 460 -0.11356 465 -0.10191 470 -0.09062 475 - - diff --git a/tecs/inp/fi.cfg b/tecs/inp/fi.cfg deleted file mode 100644 index eb02c06..0000000 --- a/tecs/inp/fi.cfg +++ /dev/null @@ -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" - diff --git a/tecs/inp/fs.cfg b/tecs/inp/fs.cfg deleted file mode 100644 index 17d9035..0000000 --- a/tecs/inp/fs.cfg +++ /dev/null @@ -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 diff --git a/tecs/inp/ft.cfg b/tecs/inp/ft.cfg deleted file mode 100644 index 412a88b..0000000 --- a/tecs/inp/ft.cfg +++ /dev/null @@ -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" diff --git a/tecs/inp/fw.cfg b/tecs/inp/fw.cfg deleted file mode 100644 index e270efe..0000000 --- a/tecs/inp/fw.cfg +++ /dev/null @@ -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" - diff --git a/tecs/inp/g24741.inp b/tecs/inp/g24741.inp deleted file mode 100644 index d5ac5da..0000000 --- a/tecs/inp/g24741.inp +++ /dev/null @@ -1,57 +0,0 @@ -sens=g24741 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=Ge ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted) -range=33333 -curv ! curve (sensor,temp/K) follows, must be ordered, but can be increasing or decreasing -3716.48 3.614 -3303.08 3.805 -2939.81 4.007 -2634.1 4.211 -2207.84 4.568 -1850.95 4.962 -1510.33 5.464 -1168.62 6.17 -898.255 6.969 -664.661 7.969 -503.54 8.966 -385.764 9.997 -302.717 11.005 -241.569 12.011 -196.091 13.009 -161.375 14.009 -134.756 15.002 -113.613 16.009 -97.1542 16.995 -83.7844 17.987 -72.9223 18.98 -63.8891 19.986 -55.898 21.062 -46.4039 22.685 -39.5526 24.203 -33.94 25.781 -29.5042 27.352 -25.8808 28.938 -22.6148 30.71 -19.5475 32.811 -16.2503 35.791 -13.7919 38.802 -11.9208 41.828 -10.4837 44.827 -9.33607 47.855 -8.70341 49.86 -7.45938 54.825 -6.54015 59.805 -5.84053 64.822 -5.30420 69.803 -4.87975 74.794 -4.54002 79.775 -4.26248 84.818 -4.03819 89.795 -3.85122 94.839 -3.69833 99.809 -3.46425 109.82 -3.30216 119.843 -1 350 - - diff --git a/tecs/inp/g25328.inp b/tecs/inp/g25328.inp deleted file mode 100644 index a4d5014..0000000 --- a/tecs/inp/g25328.inp +++ /dev/null @@ -1,69 +0,0 @@ -sens=g25328 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=Ge ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted) -range=33333 -curv ! curve (sensor,temp/K) follows, must be ordered, but can be increasing or decreasing -51742 1.20397 -38374.4 1.30097 -29285.9 1.39987 -18336.7 1.59973 -12322.8 1.80467 -8953.12 2.00029 -6797.69 2.19633 -5283.47 2.40223 -4277.88 2.59821 -3518.79 2.80215 -2970 2.99976 -2553.86 3.19379 -2199.04 3.40534 -1942.6 3.59649 -1720.04 3.79904 -1539.73 3.99753 -1386.08 4.19945 -1141.13 4.6087 -960.495 5.01198 -788.722 5.52181 -617.915 6.22374 -481.462 7.01657 -359.562 8.04131 -276.645 9.05249 -216.121 10.0975 -173.58 11.1109 -142.19 12.115 -118.256 13.1243 -100.185 14.1049 -85.7627 15.0937 -74.0598 16.0946 -64.7476 17.0714 -57.0177 18.0515 -50.5646 19.0281 -45.0554 20.0179 -40.0589 21.0809 -33.8704 22.6975 -29.2326 24.2277 -25.307 25.8307 -22.174 27.4033 -19.5516 29.0097 -17.2057 30.757 -14.9274 32.8585 -12.4205 35.8717 -10.5431 38.8891 -9.09534 41.9407 -7.99882 44.9009 -7.09635 47.9674 -6.6064 49.9668 -5.633 54.9499 -4.92135 59.8927 -4.38084 64.8514 -3.96147 69.8101 -3.62938 74.7892 -3.36171 79.8027 -3.14631 84.787 -2.96943 89.7821 -2.82263 94.8151 -2.70184 99.7862 -2.51544 109.819 -2.38525 119.826 -1 350 - diff --git a/tecs/inp/g25550.inp b/tecs/inp/g25550.inp deleted file mode 100644 index 2ee7860..0000000 --- a/tecs/inp/g25550.inp +++ /dev/null @@ -1,69 +0,0 @@ -sens=g25550 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=Ge ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted) -range=33333 -curv ! curve (sensor,temp/K) follows, must be ordered, but can be increasing or decreasing -62321.3 1.2009 -46207 1.30013 -35094.4 1.40258 -22373.5 1.59752 -15326 1.79521 -11200.4 1.9899 -8362.98 2.20207 -6513.28 2.41223 -5356.83 2.5985 -4433.07 2.80016 -3742.13 3.00175 -3222.56 3.19821 -2805.65 3.39878 -2470.82 3.59887 -2194.89 3.8009 -1969.57 4.00008 -1775.99 4.20356 -1422.69 4.68654 -1220.45 5.05936 -1018.33 5.54189 -811.357 6.21394 -641.701 6.97679 -487.564 7.97051 -381.494 8.95538 -303.493 9.9658 -247.623 10.9549 -205.794 11.9455 -173.45 12.9489 -148.82 13.9294 -128.951 14.9234 -112.674 15.9345 -99.5655 16.9246 -88.6102 17.9191 -79.3856 18.913 -71.4038 19.9217 -64.0717 21.0093 -54.8993 22.659 -48.003 24.1928 -42.1299 25.7827 -37.3274 27.3466 -33.2266 28.9435 -29.4847 30.6837 -25.777 32.7852 -21.6144 35.807 -18.4462 38.8362 -15.9599 41.9041 -14.0667 44.8711 -12.4931 47.9476 -11.6357 49.9458 -9.86331 55.1436 -8.64011 59.988 -7.69916 64.8521 -6.95065 69.8121 -6.35553 74.7943 -5.87526 79.8043 -5.48659 84.7949 -5.16668 89.7832 -4.89963 94.8091 -4.67607 99.917 -4.33433 109.992 -4.09814 119.813 - - diff --git a/tecs/inp/g26550.inp b/tecs/inp/g26550.inp deleted file mode 100644 index d5ede42..0000000 --- a/tecs/inp/g26550.inp +++ /dev/null @@ -1,68 +0,0 @@ -sens=g26550 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=Ge ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted) -range=60000 -form=loglog -curv ! curve (sensor,temp/K) follows, must be ordered, but can be increasing or decreasing -51675.31367 1.26557 -35429.70923 1.40134 -22273.30233 1.60014 -15010.1018 1.80361 -10974.29819 1.9955 -8177.550987 2.20612 -6402.581521 2.4083 -5179.334456 2.60713 -4299.337042 2.80312 -3621.954841 3.00392 -3101.063665 3.20506 -2698.246949 3.40247 -2366.499828 3.60536 -2099.578824 3.80636 -1883.838736 4.00226 -1644.980342 4.26643 -1383.489437 4.63875 -1167.020468 5.04366 -961.5384615 5.5658 -751.8796992 6.28541 -588.2352941 7.10169 -446.4285714 8.13107 -349.6503497 9.15963 -277.7777778 10.2522 -228.8329519 11.2779 -192.6782274 12.2886 -165.2892562 13.287 -143.8848921 14.271 -126.7427123 15.2419 -112.7395716 16.2143 -101.2145749 17.1625 -91.49130833 18.1161 -82.98755187 19.0752 -75.52870091 20.049 -68.58710562 21.0886 -59.52380952 22.7074 -52.5210084 24.2179 -46.23208507 25.8398 -41.03405827 27.4352 -36.45643456 29.0979 -32.27888961 30.91 -28.20874471 33.0415 -23.63507445 36.0758 -20.15722637 39.0819 -17.45505324 42.0677 -15.2998776 45.0774 -13.57957632 48.0594 -12.60557166 50.0683 -10.6643916 55.076 -9.239582371 60.0479 -8.153281696 65.0502 -7.315288954 70.024 -6.668444919 74.8821 -6.132335807 79.8875 -5.700279314 84.8635 -5.340168749 89.9085 -5.048210409 94.8828 -4.795933049 100.02 -4.418912947 109.991 -4.150410891 119.985 -2.00 300 diff --git a/tecs/inp/g26552.inp b/tecs/inp/g26552.inp deleted file mode 100644 index 9c2ba9e..0000000 --- a/tecs/inp/g26552.inp +++ /dev/null @@ -1,69 +0,0 @@ -sens=g26552 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=Ge ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted) -range=33333 -curv ! curve (sensor,temp/K) follows, must be ordered, but can be increasing or decreasing -44339.7 1.26752 -30479.5 1.40131 -19063.5 1.60058 -12816.1 1.80449 -9363.14 1.99492 -6947.58 2.20682 -5431.88 2.40878 -4384.64 2.60805 -3637.07 2.80314 -3058.28 3.00423 -2614.88 3.20522 -2273.22 3.40257 -1991.83 3.60531 -1765.38 3.80634 -1582.8 4.00195 -1380.44 4.26656 -1159.05 4.63876 -975.898 5.04379 -798.593 5.56593 -623.062 6.28577 -483.097 7.10211 -361.38 8.13119 -277.733 9.16019 -215.352 10.2524 -173.155 11.2782 -142.178 12.2899 -118.874 13.2861 -100.926 14.2709 -86.8487 15.2417 -75.4522 16.2141 -66.3158 17.1623 -58.6667 18.1158 -52.189 19.0755 -46.619 20.0485 -41.5819 21.0898 -35.1838 22.7081 -30.4344 24.2187 -26.3232 25.8396 -23.0313 27.4345 -20.2266 29.0991 -17.7346 30.9099 -15.3757 33.0415 -12.7993 36.0755 -10.893 39.0826 -9.4386 42.0696 -8.29125 45.0773 -7.3856 48.0592 -6.87377 50.0678 -5.85986 55.0763 -5.11841 60.0483 -4.55332 65.0504 -4.11832 70.0235 -3.78204 74.8823 -3.50414 79.8877 -3.27933 84.8633 -3.09329 89.9091 -2.94139 94.8836 -2.81229 100.02 -2.61888 109.99 -2.48327 119.985 -1 350 - - diff --git a/tecs/inp/gemark.inp b/tecs/inp/gemark.inp deleted file mode 100644 index 4b79c18..0000000 --- a/tecs/inp/gemark.inp +++ /dev/null @@ -1,105 +0,0 @@ -sens=gemark -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=Ge ! 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 -992.7556998 1 -792.1858987 1.1 -653.3182511 1.2 -552.6026325 1.3 -476.8394272 1.4 -418.1430416 1.5 -371.2262706 1.6 -332.9399159 1.7 -301.2666387 1.8 -274.7819189 1.9 -252.4107683 2 -233.326363 2.1 -216.8968945 2.2 -202.6260845 2.3 -190.1282584 2.4 -179.0951525 2.5 -169.2860274 2.6 -160.5048437 2.7 -152.5965004 2.8 -145.4329823 2.9 -138.9113482 3 -132.9452312 3.1 -127.4641573 3.2 -122.4082475 3.3 -117.7278231 3.4 -113.3802387 3.5 -109.329501 3.6 -105.5444561 3.7 -101.9985953 3.8 -98.66854327 3.9 -95.53422694 4 -89.78411574 4.2 -84.63036666 4.4 -79.9817946 4.6 -75.76394149 4.8 -71.91810156 5 -68.39563463 5.2 -65.15718079 5.4 -62.16911131 5.6 -59.40347818 5.8 -56.83732393 6 -51.16738451 6.5 -46.37614641 7 -42.28750151 7.5 -38.77347458 8 -35.73473767 8.5 -33.09366895 9 -30.7880927 9.5 -28.76957297 10 -26.99811498 10.5 -25.43582083 11 -24.04933649 11.5 -22.81264984 12 -21.70478628 12.5 -20.7087146 13 -19.81020181 13.5 -18.99659056 14 -18.25670823 14.5 -17.58098117 15 -16.96112438 15.5 -16.39008975 16 -15.86178642 16.5 -15.3710694 17 -14.91350279 17.5 -14.48533597 18 -14.08331295 18.5 -13.70467074 19 -13.3469953 19.5 -13.00822897 20 -12.38041392 21 -11.80935842 22 -11.28600739 23 -10.8031861 24 -10.35529442 25 -9.937879436 26 -9.547310328 27 -9.180686215 28 -8.835616101 29 -8.510135723 30 -8.202631541 31 -7.911729004 32 -7.636291925 33 -7.375312858 34 -7.127928135 35 -6.893358558 36 -6.670875366 37 -6.459793187 38 -6.259469861 39 -6.069291409 40 -5.6863 42.177 -5.226 45.156 -3 70 -1.85 100 -1.15 140 -0.69 200 -0.37 310 - - diff --git a/tecs/inp/hef4c.cfg b/tecs/inp/hef4c.cfg deleted file mode 100644 index aa2df79..0000000 --- a/tecs/inp/hef4c.cfg +++ /dev/null @@ -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 diff --git a/tecs/inp/ill1.cfg b/tecs/inp/ill1.cfg deleted file mode 100644 index b17b7aa..0000000 --- a/tecs/inp/ill1.cfg +++ /dev/null @@ -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 diff --git a/tecs/inp/ill2.cfg b/tecs/inp/ill2.cfg deleted file mode 100644 index ef366e3..0000000 --- a/tecs/inp/ill2.cfg +++ /dev/null @@ -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 diff --git a/tecs/inp/ill2p.cfg b/tecs/inp/ill2p.cfg deleted file mode 100644 index b007ec8..0000000 --- a/tecs/inp/ill2p.cfg +++ /dev/null @@ -1,2 +0,0 @@ - sensC.type=s sensC.curve=x22637 - dev="uniaxial pressure insert for ILL2" diff --git a/tecs/inp/ill3.cfg b/tecs/inp/ill3.cfg deleted file mode 100644 index 4284ad1..0000000 --- a/tecs/inp/ill3.cfg +++ /dev/null @@ -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 diff --git a/tecs/inp/ill3f.cfg b/tecs/inp/ill3f.cfg deleted file mode 100644 index a2a38dd..0000000 --- a/tecs/inp/ill3f.cfg +++ /dev/null @@ -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 diff --git a/tecs/inp/ill4.cfg b/tecs/inp/ill4.cfg deleted file mode 100644 index cfe1bbd..0000000 --- a/tecs/inp/ill4.cfg +++ /dev/null @@ -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 diff --git a/tecs/inp/ill5.cfg b/tecs/inp/ill5.cfg deleted file mode 100644 index 1e8a35d..0000000 --- a/tecs/inp/ill5.cfg +++ /dev/null @@ -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 diff --git a/tecs/inp/ill5n.cfg b/tecs/inp/ill5n.cfg deleted file mode 100644 index 9a23823..0000000 --- a/tecs/inp/ill5n.cfg +++ /dev/null @@ -1,3 +0,0 @@ - sensC.type=s sensC.curve=x09883 - sensD.type=h - dev="precoolable sample stick for maxi orange cryostat" diff --git a/tecs/inp/lsc.codes b/tecs/inp/lsc.codes deleted file mode 100644 index 443feb6..0000000 --- a/tecs/inp/lsc.codes +++ /dev/null @@ -1,31 +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 -disc 30 -resox3 99 diff --git a/tecs/inp/ma02.cfg b/tecs/inp/ma02.cfg deleted file mode 100644 index 7ca80c3..0000000 --- a/tecs/inp/ma02.cfg +++ /dev/null @@ -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 diff --git a/tecs/inp/ma09.cfg b/tecs/inp/ma09.cfg deleted file mode 100644 index 8b7f31e..0000000 --- a/tecs/inp/ma09.cfg +++ /dev/null @@ -1,8 +0,0 @@ - sensA.type=m sensA.curve=c17844 - sensB.type=t sensB.curve=cplus70 - sensC.type=s sensC.curve=x22642 - 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" diff --git a/tecs/inp/ma11.cfg b/tecs/inp/ma11.cfg deleted file mode 100644 index 60100b6..0000000 --- a/tecs/inp/ma11.cfg +++ /dev/null @@ -1,3 +0,0 @@ - sensA.type=t sensA.curve=cplus45 - dev="SANS test carbon resistors" - lscfg="dispfld 2,A,3;display 2" diff --git a/tecs/inp/mz020124.inp b/tecs/inp/mz020124.inp deleted file mode 100644 index 891eb9d..0000000 --- a/tecs/inp/mz020124.inp +++ /dev/null @@ -1,110 +0,0 @@ -sens=mz020124 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=3250 ! setpoint limit (automatic if omitted) -type=RhFe ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted) -form=loglog -!excit=300uA ! (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 -1.954519465 3.1206 -1.985957728 3.391099984 -2.017855208 3.674243588 -2.050312219 3.970801721 -2.083291299 4.281292125 -2.116752103 4.606384478 -2.150799862 4.946893604 -2.185344956 5.303354639 -2.220496025 5.676624202 -2.256160544 6.067557577 -2.292450675 6.476886834 -2.329270895 6.905479786 -2.366736998 7.354276657 -2.404750369 7.824233572 -2.443430553 8.316344412 -2.482675737 8.831617418 -2.522609344 9.371236431 -2.563126259 9.936251595 -2.604353905 10.52785303 -2.646183761 11.14740374 -2.688747379 11.79612797 -2.731932722 12.47543812 -2.775875604 13.18668703 -2.820460358 13.93153058 -2.865827198 14.71147282 -2.911856711 15.52816789 -2.957399533 16.38012579 -3.001096774 17.2515529 -3.043336677 18.12271256 -3.084537113 18.99996906 -3.125143759 19.89802618 -3.165555994 20.82438653 -3.206343152 21.78831425 -3.248029761 22.80187398 -3.291091827 23.88041394 -3.336184037 25.02255504 -3.383062335 26.2130948 -3.431310348 27.45487455 -3.481528863 28.75178258 -3.534516391 30.107979 -3.590789942 31.52786691 -3.651236801 33.01467207 -3.716464596 34.5715482 -3.787476963 36.20179764 -3.864826479 37.90887837 -3.947389668 39.69641134 -4.03663982 41.56818814 -4.135042713 43.52817906 -4.245120281 45.58054151 -4.369884919 47.72962882 -4.512425035 49.9799995 -4.672292251 52.33642688 -4.846743092 54.80390926 -5.036861394 57.3876805 -5.244329856 60.09322113 -5.470789441 62.92626996 -5.717945347 65.89283627 -5.98783742 68.99921254 -6.280872826 72.25198782 -6.597812965 75.65806167 -6.93920951 79.22465883 -7.306173816 82.95934454 -7.698923424 86.87004057 -8.118017814 90.96504202 -8.56406589 95.25303495 -9.036702813 99.74311475 -9.535643365 104.4448055 -10.06027842 109.3680801 -10.61133438 114.5233815 -11.18948246 119.9216448 -11.7953274 125.5743203 -12.42910909 131.4933983 -13.09181923 137.6914338 -13.78319816 144.1815737 -14.50373981 150.9775845 -15.25351734 158.0938814 -16.03356143 165.5455591 -16.84612427 173.3484235 -17.69253242 181.5190256 -18.57462266 190.0746963 -19.49395683 199.0335833 -20.45266947 208.4146897 -21.45210925 218.2379139 -22.49468935 228.5240925 -23.58305153 239.2950438 -24.71894892 250.5736143 -25.90955775 262.3837275 -27.15813858 274.7504342 -28.46033449 287.6999658 -29.81192363 301.25979 -31.2169163 315.4586691 -32.68812424 330.3267207 -34.22866808 345.895482 -35.84181551 362.1979764 -37.53098823 379.2687837 -39.29976921 397.1441134 -41.15191027 415.8618814 -43.09134006 435.4617906 -45.12217235 455.9854151 -47.24871481 477.4762882 - - diff --git a/tecs/inp/mz030500.inp b/tecs/inp/mz030500.inp deleted file mode 100644 index 3a7024d..0000000 --- a/tecs/inp/mz030500.inp +++ /dev/null @@ -1,126 +0,0 @@ -sens=mz030500 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=3250 ! setpoint limit (automatic if omitted) -type=RhFe ! 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=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 -2.498 4.472532903 -3 9.773124819 -3.06 10.55303764 -3.12 11.46731087 -3.18 12.38397382 -3.24 13.37176795 -3.3 14.42540969 -3.37 15.73076805 -3.44 17.12343827 -3.51 18.64642133 -3.58 20.24301705 -3.65 21.9221971 -3.72 23.69988759 -3.79 25.51904558 -3.87 27.62746099 -3.95 29.74116813 -4.03 31.80878152 -4.11 33.81739732 -4.19 35.75357133 -4.27 37.5847035 -4.36 39.53810683 -4.45 41.40171428 -4.54 43.17988888 -4.63 44.87496076 -4.72 46.49129524 -4.81 48.04370952 -4.91 49.6720703 -5.01 51.27267707 -5.11 52.82258535 -5.21 54.30211212 -5.31 55.74326127 -5.42 57.25945659 -5.53 58.73605895 -5.64 60.19158187 -5.75 61.60151532 -5.87 63.10400027 -5.99 64.58000866 -6.11 66.03690471 -6.23 67.45325536 -6.35 68.84502457 -6.48 70.32891791 -6.61 71.79267469 -6.74 73.23720062 -6.87 74.66546356 -7.01 76.18382684 -7.15 77.67731168 -7.29 79.15321097 -7.44 80.71669982 -7.59 82.26065751 -7.74 83.77920365 -7.89 85.2977498 -8.05 86.91753235 -8.21 88.50330232 -8.37 90.08781524 -8.54 91.77136022 -8.71 93.42984611 -8.88 95.08617427 -9.06 96.8399335 -9.24 98.57303396 -9.42 100.3060185 -9.61 102.1321031 -9.8 103.9440315 -10 105.8513246 -10.2 107.752616 -10.4 109.6486395 -10.61 111.6394642 -10.82 113.6247095 -11.04 115.7043276 -11.26 117.7833593 -11.49 119.9563834 -11.72 122.130388 -11.95 124.3074784 -12.19 126.5792385 -12.43 128.853444 -12.68 131.2224081 -12.93 133.5961045 -13.19 136.0654791 -13.45 138.5436461 -13.72 141.119047 -13.99 143.7001032 -14.27 146.3776573 -14.56 149.1617938 -14.85 151.9478907 -15.15 154.8374244 -15.45 157.7280848 -15.76 160.7164093 -16.08 163.8065005 -16.4 166.8996993 -16.73 170.0966977 -17.06 173.302643 -17.4 176.6125596 -17.75 180.0321832 -18.11 183.5578675 -18.47 187.0893314 -18.84 190.7241807 -19.22 194.4710294 -19.6 198.2263364 -19.99 202.0878068 -20.39 206.0543442 -20.8 210.127842 -21.22 214.3079218 -21.64 218.4924193 -22.07 222.7820044 -22.51 227.1788701 -22.96 231.6827282 -23.42 236.2894724 -23.89 241.001239 -24.37 245.8178023 -24.86 250.7437405 -25.36 255.7715377 -25.87 260.8990519 -26.39 266.1324909 -26.92 271.458145 -27.46 276.8800659 -28.01 282.4402052 -28.57 288.1037036 -29.14 293.8716111 -37.2 375.1552482 - diff --git a/tecs/inp/ori1.cfg b/tecs/inp/ori1.cfg deleted file mode 100644 index b0ecd55..0000000 --- a/tecs/inp/ori1.cfg +++ /dev/null @@ -1,7 +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=psam sensC.lim=50 - sensD.type=l sensD.curve=g25328 sensD.lim=60 - dev="orange cryostat 50 mm (Risoe)" - tlimit=310 resist=50 maxpower=50 controlmode=0 - prop=25 int=10 deriv=0 diff --git a/tecs/inp/ori2.cfg b/tecs/inp/ori2.cfg deleted file mode 100644 index 7bee7c7..0000000 --- a/tecs/inp/ori2.cfg +++ /dev/null @@ -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 diff --git a/tecs/inp/ori3.cfg b/tecs/inp/ori3.cfg deleted file mode 100644 index 069a927..0000000 --- a/tecs/inp/ori3.cfg +++ /dev/null @@ -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 diff --git a/tecs/inp/pcry.inp b/tecs/inp/pcry.inp deleted file mode 100644 index 7e7f220..0000000 --- a/tecs/inp/pcry.inp +++ /dev/null @@ -1,84 +0,0 @@ -sens=pcry -unit=Ohm -type=Pt250 -curv -0.001 10 -0.141 13 -0.164 14 -0.193 15 -0.228 16 -0.271 17 -0.321 18 -0.379 19 -0.525 21 -0.713 23 -0.823 24 -0.946 25 -1.555 29 -2.139 32 -2.587 34 -3.082 36 -3.619 38 -4.195 40 -4.807 42 -5.126 43 -5.788 45 -6.833 48 -7.56 50 -8.31 52 -8.692 53 -9.469 55 -10.261 57 -11.474 60 -11.884 61 -12.713 63 -13.971 66 -15.243 69 -16.953 73 -18.244 76 -19.107 78 -20.407 81 -21.71 84 -22.58 86 -23.886 89 -24.755 91 -26.057 94 -26.924 96 -27.789 98 -28.652 100 -29.515 102 -30.376 104 -31.236 106 -32.095 108 -32.952 110 -33.809 112 -34.664 114 -35.518 116 -36.371 118 -37.222 120 -38.073 122 -38.498 123 -39.347 125 -40.195 127 -41.041 129 -42.31 132 -43.154 134 -47.36 144 -50.708 153 -55.703 164 -59.842 174 -63.962 184 -67.654 193 -72.149 204 -75.811 213 -79.865 223 -88.335 244 -91.948 253 -95.949 263 -99.939 273 -104.315 284 -107.884 293 -112.234 304 -115.782 313 -123.667 333 - diff --git a/tecs/inp/psam.inp b/tecs/inp/psam.inp deleted file mode 100644 index 9644925..0000000 --- a/tecs/inp/psam.inp +++ /dev/null @@ -1,90 +0,0 @@ -sens=psam -unit=Ohm -type=Pt250 -curv -0.001 1 -1.806 11.014 -1.855 13.02 -1.909 14.627 -1.924 15 -2.019 16.858 -2.087 17.962 -2.122 18.462 -2.165 19.053 -2.391 21.605 -2.561 23.17 -2.68 24.154 -2.848 25.4 -3.551 29.725 -4.154 32.689 -4.656 34.85 -5.112 36.661 -5.534 38.241 -6.279 40.827 -6.933 42.954 -7.241 43.924 -7.833 45.742 -8.64 48.081 -9.402 50.233 -10.11 52.159 -10.768 53.915 -11.415 55.611 -12.021 57.17 -13.16 60.054 -13.709 61.422 -14.73 63.939 -15.735 66.413 -17.176 69.883 -18.516 73.074 -19.803 76.131 -21.014 78.997 -22.173 81.727 -23.3 84.385 -24.368 86.89 -25.426 89.382 -26.427 91.735 -27.424 94.083 -28.371 96.319 -29.323 98.565 -30.224 100.689 -31.133 102.843 -32 104.889 -32.865 106.94 -33.708 108.941 -34.537 110.912 -35.359 112.864 -36.15 114.752 -36.954 116.669 -37.73 118.519 -38.501 120.368 -39.266 122.204 -40.007 123.973 -40.756 125.779 -41.485 127.528 -42.201 129.251 -43.622 132.682 -44.32 134.373 -48.378 144.217 -52.255 153.673 -56.564 164.241 -60.698 174.433 -64.687 184.307 -68.544 193.884 -72.767 204.422 -76.379 213.474 -80.392 223.56 -84.256 233.308 -88.516 244.079 -92.107 253.192 -96.145 263.468 -99.966 273.226 -104.27 284.239 -107.917 293.61 -112.073 304.315 -115.569 313.341 -119.4 323.15 -123.24 333.15 -127.07 343.15 -130.89 353.15 -134.7 363.15 - diff --git a/tecs/inp/pt100e.inp b/tecs/inp/pt100e.inp deleted file mode 100644 index 92b2b90..0000000 --- a/tecs/inp/pt100e.inp +++ /dev/null @@ -1,51 +0,0 @@ -sens=pt100e -unit=Ohm -type=Pt500 -curv -0.01 1 -1 2 -1.7 3 -1.8 10 -1.806 11.014 -1.855 13.02 -1.909 14.627 -1.924 15 -2.019 16.858 -2.087 17.962 -2.122 18.462 -2.165 19.053 -2.391 21.605 -2.561 23.17 -2.68 24.154 -2.848 25.4 -3.405 28 -3.82 30 -4.235 32 -5.146 36 -5.65 38 -6.17 40 -6.726 42 -7.909 46 -9.924 52 -12.18 58 -15.015 65 -19.223 75 -23.525 85 -32.081 105 -46.648 140 -62.98 180 -75.044 210 -98.784 270 -116.27 315 -131.616 355 -148.652 400 -165.466 445 -182.035 490 -198.386 535 -216.256 585 -232.106 630 -247.712 675 -261.391 715 -276.566 760 -289.83 800 -293.146 810 diff --git a/tecs/inp/pt_ill.inp b/tecs/inp/pt_ill.inp deleted file mode 100644 index fe76d3f..0000000 --- a/tecs/inp/pt_ill.inp +++ /dev/null @@ -1,204 +0,0 @@ -sens=pt_ill -unit=Ohm -type=Pt250 -curv -0.02 0.867 -0.04 4.092 -0.06 6.939 -0.08 9.066 -0.10001 10.677 -0.118 11.826 -0.13601 12.777 -0.15401 13.583 -0.17201 14.282 -0.19001 14.897 -0.20801 15.448 -0.22601 15.947 -0.24401 16.403 -0.262 16.824 -0.28001 17.216 -0.29801 17.583 -0.316 17.929 -0.334 18.256 -0.352 18.566 -0.37 18.862 -0.388 19.146 -0.40601 19.418 -0.42401 19.679 -0.442 19.931 -0.46 20.175 -0.47801 20.411 -0.496 20.64 -0.51401 20.862 -0.53201 21.078 -0.55001 21.288 -0.56801 21.493 -0.586 21.693 -0.60401 21.889 -0.62201 22.08 -0.64001 22.267 -0.65801 22.45 -0.676 22.63 -0.694 22.806 -0.712 22.979 -0.73001 23.148 -0.74801 23.315 -0.76601 23.479 -0.784 23.64 -0.80201 23.799 -0.82001 23.955 -0.83801 24.109 -0.85601 24.261 -0.87401 24.41 -0.89201 24.558 -0.91001 24.703 -0.92801 24.847 -0.94601 24.988 -0.96401 25.128 -0.98201 25.266 -1.00001 25.402 -1.12858 26.332 -1.25714 27.196 -1.38572 28.005 -1.51429 28.769 -1.64287 29.494 -1.77143 30.185 -1.9 30.848 -2.02858 31.484 -2.15714 32.098 -2.28572 32.692 -2.41429 33.267 -2.54286 33.825 -2.67143 34.369 -2.8 34.899 -2.92857 35.416 -3.05714 35.922 -3.18572 36.416 -3.31429 36.902 -3.44286 37.378 -3.57143 37.845 -3.7 38.305 -3.82857 38.757 -3.95714 39.202 -4.08571 39.641 -4.21429 40.074 -4.34286 40.501 -4.47144 40.922 -4.6 41.339 -4.72857 41.75 -4.85714 42.157 -4.98571 42.56 -5.11429 42.959 -5.24287 43.353 -5.37143 43.744 -5.5 44.132 -5.62857 44.516 -5.75714 44.897 -5.88571 45.275 -6.01429 45.65 -6.14286 46.022 -6.27144 46.392 -6.40001 46.759 -6.52857 47.123 -6.65714 47.485 -6.78571 47.845 -6.9143 48.203 -7.04286 48.559 -7.17143 48.913 -7.3 49.265 -7.42857 49.615 -7.55714 49.963 -7.68571 50.31 -7.81429 50.655 -7.94287 50.998 -8.07144 51.34 -8.2 51.68 -8.32857 52.019 -8.45715 52.357 -8.58572 52.693 -8.71429 53.028 -8.84286 53.362 -8.97144 53.695 -9.1 54.026 -9.22857 54.357 -9.35715 54.686 -9.48572 55.014 -9.61429 55.342 -9.74286 55.668 -9.87144 55.993 -10 56.318 -11.2858 59.518 -12.5715 62.654 -13.8572 65.741 -15.1429 68.791 -16.4286 71.815 -17.7144 74.818 -19.0001 77.806 -20.2857 80.783 -21.5715 83.752 -22.8572 86.717 -24.143 89.68 -25.4286 92.642 -26.7144 95.604 -28.0001 98.569 -29.2857 101.537 -30.5715 104.508 -31.8572 107.484 -33.143 110.465 -34.4287 113.452 -35.7144 116.444 -37.0001 119.443 -38.2858 122.448 -39.5714 125.459 -40.8571 128.477 -42.143 131.502 -43.4287 134.535 -44.7144 137.574 -46.0001 140.621 -47.2858 143.674 -48.5714 146.735 -49.8571 149.803 -51.143 152.876 -52.4287 155.958 -53.7144 159.045 -55.0001 162.14 -56.2858 165.24 -57.5714 168.349 -58.8571 171.462 -60.143 174.582 -61.4287 177.706 -62.7144 180.839 -64.0001 183.975 -65.2857 187.117 -66.5714 190.265 -67.8572 193.419 -69.1429 196.577 -70.4287 199.74 -71.7144 202.909 -73.0001 206.081 -74.2857 209.256 -75.5714 212.438 -76.8572 215.623 -78.1429 218.811 -79.4287 222.003 -80.7144 225.199 -82.0001 228.399 -83.2857 231.6 -84.5714 234.806 -85.8572 238.014 -87.1429 241.224 -88.4287 244.438 -89.7144 247.653 -91.0001 250.87 -92.2857 254.09 -93.5714 257.311 -94.8572 260.533 -96.1429 263.757 -97.4287 266.983 -98.7144 270.209 -100.001 273.436 -105.001 285.992 -110.001 298.55 -115.001 311.098 -120.001 323.63 -125.001 336.135 diff --git a/tecs/inp/r10401.inp b/tecs/inp/r10401.inp deleted file mode 100644 index 5d4d92d..0000000 --- a/tecs/inp/r10401.inp +++ /dev/null @@ -1,80 +0,0 @@ -sens=r10401 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=3250 ! setpoint limit (automatic if omitted) -type=RhFe ! 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=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 -0.1 1 -10.96200458 3.603395939 -11.04714997 3.808389425 -11.13021051 4.011863947 -11.2073775 4.204595804 -11.36363222 4.605828285 -11.50949981 4.993322611 -11.69383035 5.504942894 -11.93243104 6.212180376 -12.18509969 7.012435913 -12.47627119 8.014698029 -12.74734121 9.034718037 -13.00782548 10.10107994 -13.23587728 11.11396694 -13.44662561 12.12006378 -13.64412098 13.1283412 -13.82350155 14.10537004 -13.99576341 15.10103607 -14.15889543 16.09725189 -14.31057818 17.07322216 -14.45655057 18.06075191 -14.5951817 19.0368576 -14.73183773 20.03655338 -14.87087365 21.09358788 -15.07781173 22.72771549 -15.26460339 24.24478149 -15.4628644 25.89118862 -15.65567767 27.49553299 -15.85444989 29.14401627 -16.08139617 30.97371197 -16.35794886 33.11646652 -16.77443694 36.13684464 -17.22711357 39.14133644 -17.71083059 42.07385445 -18.25288311 45.08248711 -18.84057851 48.0809536 -19.26707994 50.11228752 -20.3967488 55.07016945 -21.65691551 60.06259346 -23.03485099 65.08966827 -24.49958857 70.08788681 -26.03263916 75.05260086 -27.61641081 79.97705841 -29.31389895 85.09089661 -30.93957939 89.87670898 -32.71619025 95.01864243 -34.48065399 100.0529747 -38.00798124 110.0273895 -41.56033691 120.0323105 -45.104542 130.033226 -48.63416685 140.0548325 -52.12144721 150.0316315 -55.58240817 160.0153122 -59.02106315 170.0214767 -62.41786749 179.9794617 -65.80196734 189.977066 -69.16736962 199.9859848 -72.50752808 209.9737015 -75.83749417 219.9729462 -79.16022406 229.9922028 -82.45405462 239.9561462 -85.75238933 249.9529495 -89.04424414 259.9512482 -92.33610995 269.953186 -95.62668504 279.9625397 -98.90977798 289.950943 -102.1982893 299.9454956 -105.4870335 309.9390564 -107.1249122 314.9157104 -108.7501604 319.8446808 -110.735724 325.8632507 -112.0061582 329.714859 - diff --git a/tecs/inp/r10402.inp b/tecs/inp/r10402.inp deleted file mode 100644 index fd1587c..0000000 --- a/tecs/inp/r10402.inp +++ /dev/null @@ -1,80 +0,0 @@ -sens=r10402 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=3250 ! setpoint limit (automatic if omitted) -type=RhFe ! 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=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 -10.8760399 3.60362947 -10.96156416 3.808573246 -11.04405501 4.011402369 -11.12172118 4.20448184 -11.27828274 4.605803728 -11.42410062 4.99340415 -11.60857321 5.504968882 -11.84771555 6.212155819 -12.10084347 7.012536526 -12.39236716 8.014623165 -12.6648384 9.034653187 -12.92509584 10.1014185 -13.15382122 11.11374331 -13.36476997 12.1199131 -13.56275485 13.12841368 -13.74237726 14.1056633 -13.91456868 15.10070419 -14.07806907 16.09651661 -14.22988723 17.07314491 -14.37653962 18.06040382 -14.51557176 19.03698158 -14.65198532 20.0368824 -14.79137027 21.09377289 -14.99888246 22.72714233 -15.18589533 24.24513531 -15.38513597 25.89107323 -15.57862236 27.49502659 -15.7781861 29.14448071 -16.01069201 31.00509262 -16.28352089 33.10315704 -16.70616645 36.14212799 -17.16219556 39.13899994 -17.65208858 42.07397842 -18.20100239 45.08285522 -18.7978474 48.08141899 -19.22993208 50.1128273 -20.37744592 55.07047462 -21.65843739 60.06211853 -23.06152406 65.08961487 -24.55309641 70.08821106 -26.11557305 75.0525322 -27.73038954 79.97639084 -29.46248067 85.09117508 -31.12198308 89.87803268 -32.9346229 95.01881409 -34.7358574 100.0531731 -38.33871566 110.0273514 -41.96687299 120.0326347 -45.5878966 130.0335617 -49.19480258 140.0551605 -52.75888613 150.0321045 -56.29611486 160.0150681 -59.8107402 170.0214767 -63.28329598 179.9793091 -66.74330971 189.9777985 -70.18486106 199.9863586 -73.60028459 209.9743118 -77.00348012 219.9716187 -80.40250057 229.9917068 -83.77295968 239.956543 -87.14592329 249.9542999 -90.51287247 259.951004 -93.87840797 269.9521942 -97.24650837 279.9622955 -100.6056404 289.9507294 -103.9689725 299.9463196 -107.3335317 309.9401703 -109.0114567 314.9165039 -110.6735137 319.8454895 -112.7047006 325.8605194 -114.0035247 329.7149658 - - diff --git a/tecs/inp/r10403.inp b/tecs/inp/r10403.inp deleted file mode 100644 index a77f891..0000000 --- a/tecs/inp/r10403.inp +++ /dev/null @@ -1,79 +0,0 @@ -sens=r10403 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=3250 ! setpoint limit (automatic if omitted) -type=RhFe ! 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=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 -10.6589403 3.603681803 -10.74693977 3.808842421 -10.83184562 4.011125088 -10.91174656 4.204480171 -11.07008341 4.605695724 -11.22122242 4.993436098 -11.41199261 5.50510931 -11.65901085 6.211949348 -11.91981091 7.012576103 -12.2204079 8.014651299 -12.50069799 9.034644127 -12.77010674 10.10183287 -13.00552529 11.11413336 -13.22311022 12.11994553 -13.42717567 13.12845087 -13.61233701 14.10592365 -13.79031137 15.10077524 -13.95889108 16.09677029 -14.11560108 17.07359982 -14.26661806 18.05983448 -14.40984191 19.03727055 -14.5506561 20.03670979 -14.69458498 21.09279442 -14.90837715 22.72693634 -15.10083847 24.24472809 -15.30573011 25.89060211 -15.50466727 27.49477291 -15.70943846 29.14482689 -15.94295831 30.97421741 -16.22611694 33.10346222 -16.65634655 36.1368618 -17.12132175 39.14064407 -17.61812467 42.07350922 -18.17453481 45.08229637 -18.77835056 48.08135033 -19.21609154 50.11287498 -20.37406579 55.07047844 -21.66598185 60.0625267 -23.07960366 65.09007263 -24.58132513 70.08819199 -26.15302615 75.05251312 -27.77673525 79.97599792 -29.46796366 84.94778442 -31.18561739 89.8794136 -33.0060656 95.01772308 -34.81426904 100.0529938 -38.43009061 110.0272751 -42.07047262 120.0328369 -45.70143982 130.033226 -49.31827048 140.0540085 -52.89095876 150.0311432 -56.43606152 160.0155334 -59.95774205 170.0206146 -63.43579175 179.9800644 -66.90180014 189.9785233 -70.34817459 199.9858704 -73.7683642 209.9743729 -77.17653595 219.9694138 -80.57844445 229.9915466 -83.95262042 239.9578171 -87.32915214 249.9561996 -90.69928285 259.9510498 -94.06762515 269.9521942 -97.43635403 279.9628296 -100.7974683 289.9478302 -104.1636115 299.9465179 -107.5305484 309.9395905 -109.2074342 314.913208 -110.8721465 319.8458862 -112.9024567 325.8596039 -114.2030693 329.7140808 - diff --git a/tecs/inp/r10409.inp b/tecs/inp/r10409.inp deleted file mode 100644 index 18db70c..0000000 --- a/tecs/inp/r10409.inp +++ /dev/null @@ -1,79 +0,0 @@ -sens=r10409 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=3250 ! setpoint limit (automatic if omitted) -type=RhFe ! 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=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 -9.729170415 3.599108246 -9.807471838 3.803321687 -9.881845675 4.001753074 -9.957265507 4.207103188 -10.10350 4.61816441 -10.24228875 5.021928137 -10.410785 5.528922116 -10.63105014 6.237552611 -10.86503901 7.049164946 -11.13387651 8.061395715 -11.38170419 9.080734725 -11.60957717 10.0976095 -11.8195621 11.11087015 -12.01415805 12.12273009 -12.19446706 13.12911881 -12.36283488 14.13005143 -12.51995943 15.12442647 -12.66935165 16.11579786 -12.81007653 17.10486711 -12.94391933 18.09019724 -13.07237096 19.0755345 -13.1949312 20.05820485 -13.32639946 21.14015386 -13.51103315 22.72198464 -13.69095764 24.31474541 -13.87325086 25.94197347 -14.05668986 27.58107954 -14.24189955 29.21911493 -14.45529297 31.0435872 -14.71310716 33.15361727 -15.10856187 36.16515301 -15.54177718 39.16494333 -16.01885961 42.16002193 -16.5427227 45.15075969 -17.11695755 48.14860829 -17.52725932 50.1456511 -18.64965429 55.14566494 -19.89781828 60.1434804 -21.25761587 65.13728124 -22.71931573 70.14353926 -24.26164205 75.14741315 -25.87046285 80.14389681 -27.53314172 85.14013394 -29.23531558 90.13490689 -30.9691481 95.12797829 -32.72753293 100.1229978 -36.27911766 110.110687 -39.85278169 120.1148387 -43.41870181 130.1173515 -46.96443291 140.1164923 -50.48288963 150.1148961 -53.97146147 160.1096025 -57.43175462 170.1069592 -60.86523374 180.1062916 -64.27479903 190.1032814 -67.66523646 200.1075773 -71.03671919 210.1139431 -74.39215164 220.1093504 -77.73577068 230.1108131 -81.07100223 240.1174299 -84.3953144 250.1080443 -87.71790769 260.1094722 -91.03856598 270.1123165 -94.35407656 280.1091028 -97.67693531 290.1226426 -100.9949832 300.1250442 -104.3179636 310.129495 -105.9796676 315.1276046 -107.6379454 320.1110806 -109.6422158 326.1268823 -111.0285935 330.2873083 - diff --git a/tecs/inp/r10410.inp b/tecs/inp/r10410.inp deleted file mode 100644 index 2fe087b..0000000 --- a/tecs/inp/r10410.inp +++ /dev/null @@ -1,78 +0,0 @@ -sens=r10410 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=3250 ! setpoint limit (automatic if omitted) -type=RhFe ! 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=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 -12.58068823 3.598806592 -12.66306084 3.803442312 -12.7410223 4.001680131 -12.8210338 4.20709764 -12.97710152 4.618235636 -13.1230898 5.022066963 -13.29867076 5.528799323 -13.52929365 6.237803077 -13.77508522 7.048934695 -14.0576336 8.062176278 -14.31773149 9.080256293 -14.55677242 10.09779666 -14.77662013 11.11102988 -14.97981346 12.12292899 -15.16826951 13.12994855 -15.3446071 14.13025492 -15.50884301 15.12513888 -15.66392514 16.1156102 -15.81066881 17.10374642 -15.95077541 18.09019031 -16.08462175 19.07454745 -16.21359962 20.05822306 -16.35073534 21.14237772 -16.5449868 22.72232486 -16.73482941 24.31226008 -16.92775484 25.93997908 -17.12305555 27.57929224 -17.32211024 29.22035018 -17.55294293 31.04373335 -17.83386905 33.15392272 -18.26843841 36.16462578 -18.74828892 39.16600646 -19.2817418 42.16202069 -19.86905005 45.151956 -20.51666968 48.14943787 -20.98003721 50.14554243 -22.25058732 55.1451726 -23.66833689 60.14434928 -25.21554413 65.13988696 -26.87946909 70.1441475 -28.63762957 75.14621884 -30.47197022 80.14332999 -32.36866037 85.14028546 -34.31154667 90.13418258 -36.2901667 95.12906136 -38.29519638 100.1218635 -42.35015193 110.1119297 -46.42928475 120.1158606 -50.49939958 130.1172013 -54.5449155 140.1161408 -58.55936918 150.1136936 -62.54034881 160.1100822 -66.48828165 170.1071216 -70.40623874 180.1059648 -74.29591264 190.1031048 -78.16494783 200.1090007 -82.01248451 210.1129226 -85.84042483 220.1097379 -89.65721885 230.1112076 -93.46273224 240.1166241 -97.25778359 250.1091999 -101.0479148 260.1080664 -104.8374411 270.1144818 -108.6223805 280.1089581 -112.4145757 290.1237288 -116.2017584 300.122388 -119.9960341 310.13087 -121.891559 315.1259639 -123.784515 320.1104011 -126.0719231 326.1321421 -127.6521371 330.2883009 diff --git a/tecs/inp/r10411.inp b/tecs/inp/r10411.inp deleted file mode 100644 index bd076f5..0000000 --- a/tecs/inp/r10411.inp +++ /dev/null @@ -1,79 +0,0 @@ -sens=r10411 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=3250 ! setpoint limit (automatic if omitted) -type=RhFe ! 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=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 -11.15241065 3.598549137 -11.23534187 3.803801167 -11.31417869 4.001440484 -11.39446382 4.207125102 -11.55083746 4.618284438 -11.69842223 5.021909944 -11.87649662 5.528810983 -12.11219681 6.237523663 -12.36703307 7.048919689 -12.66213424 8.061683764 -12.93411426 9.080763591 -13.18400196 10.0972527 -13.41515005 11.11236792 -13.62886869 12.12261162 -13.82741367 13.12828524 -14.01251087 14.12897739 -14.18572384 15.12566897 -14.34898385 16.11534564 -14.50367713 17.10325811 -14.65146126 18.09073308 -14.79249557 19.07446221 -14.92791938 20.05810414 -15.07178961 21.14144212 -15.27497374 22.72337602 -15.47341191 24.31361868 -15.67373418 25.94066733 -15.87501014 27.58063058 -16.07999454 29.2214453 -16.31390726 31.04173729 -16.59872316 33.15457836 -17.03404068 36.16366638 -17.5114942 39.16653005 -18.03687617 42.16192419 -18.6133981 45.15116657 -19.24715751 48.1484099 -19.69888489 50.14523557 -20.9337894 55.14464977 -22.30776135 60.14418669 -23.80703205 65.14028307 -25.41612949 70.14212492 -27.11585546 75.14581757 -28.88798858 80.14199972 -30.72056809 85.14054741 -32.597439 90.13576567 -34.50920781 95.12947398 -36.4461102 100.1222304 -40.36410719 110.111688 -44.30568855 120.1163428 -48.24088591 130.117383 -52.15368827 140.1159503 -56.03751264 150.1148139 -59.88873729 160.109784 -63.70904405 170.1066634 -67.50096353 180.1053116 -71.26508067 190.1040357 -75.01105085 200.1092107 -78.73559294 210.1115566 -82.44189545 220.1104795 -86.13644857 230.110938 -89.82284715 240.1166013 -93.49682661 250.1088672 -97.16763987 260.1074244 -100.8380921 270.1118291 -104.5031782 280.1110746 -108.1752369 290.1234121 -111.8428997 300.1248295 -115.5181419 310.1320373 -117.3533456 315.1268508 -119.1870942 320.1113579 -121.4010369 326.1289334 -122.9334825 330.2865207 - diff --git a/tecs/inp/r10413.inp b/tecs/inp/r10413.inp deleted file mode 100644 index edfe1fe..0000000 --- a/tecs/inp/r10413.inp +++ /dev/null @@ -1,80 +0,0 @@ -sens=r10413 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=3250 ! setpoint limit (automatic if omitted) -type=RhFe ! 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=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 -11.42559142 3.598385454 -11.51171143 3.803268005 -11.59353158 4.00157268 -11.67688406 4.207329437 -11.82837068 4.618144037 -11.98394694 5.021858348 -12.17018175 5.528789092 -12.41496844 6.237407002 -12.67676917 7.049918401 -12.97681666 8.062010991 -13.25382567 9.080662996 -13.50835617 10.09774919 -13.74296812 11.11225719 -13.96076974 12.12325441 -14.16237372 13.12900439 -14.34991632 14.12937794 -14.52687058 15.12553459 -14.69279042 16.11656119 -14.84977516 17.10273663 -14.9998211 18.08966786 -15.14319204 19.07490412 -15.2802414 20.05761844 -15.42750157 21.13974046 -15.63309244 22.72136546 -15.8342691 24.31297152 -16.03710799 25.94238429 -16.24060934 27.57905532 -16.44705583 29.22007694 -16.68264142 31.03924792 -16.96834168 33.154185 -17.40474518 36.16469158 -17.88252873 39.167185 -18.40609557 42.1601927 -18.98205423 45.14999317 -19.61161709 48.148469 -20.06265581 50.14456657 -21.29013015 55.14342488 -22.65571481 60.14400512 -24.14456426 65.13972115 -25.74032261 70.14359461 -27.42759318 75.14666394 -29.1857745 80.14139051 -31.00465734 85.13905494 -32.86713162 90.13551272 -34.76469983 95.12921124 -36.68657447 100.122786 -40.57669938 110.1125852 -44.49072096 120.1168373 -48.39791863 130.1181727 -52.28333375 140.1163239 -56.14094126 150.1161882 -59.965605 160.1110684 -63.75889725 170.1076962 -67.5243713 180.1055757 -71.26170491 190.102184 -74.98010225 200.108561 -78.67818533 210.1126084 -82.35693215 220.1089513 -86.02412177 230.109857 -89.68288095 240.114188 -93.32885021 250.1083083 -96.97121127 260.1089139 -100.6135982 270.1128213 -104.2488495 280.1090995 -107.8915544 290.124649 -111.531171 300.1243045 -115.1764906 310.1293198 -116.9972804 315.1256513 -118.8149278 320.1110566 -121.0114513 326.1298075 -122.530488 330.2868637 - - diff --git a/tecs/inp/r3509.inp b/tecs/inp/r3509.inp deleted file mode 100644 index bc2835a..0000000 --- a/tecs/inp/r3509.inp +++ /dev/null @@ -1,69 +0,0 @@ -sens=r3509 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=RhFe ! 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=0 ! range in sensor units (if rang=0: determine range from table, if omitted: default from sensor type) -form=loglog -curv ! curve (sensor,temp/K) follows, must be ordered, but can be increasing or decreasing -1.53 1.001 -1.592 1.3 -1.654 1.7 -1.668 1.8 -1.685 1.9 -1.696 2 -1.729 2.2 -1.78 2.5 -1.85 3 -1.99 4 -2.014 4.21 -2.066 4.6 -2.116 5 -2.176 5.5 -2.234 6 -2.3 6.6 -2.362 7.2 -2.43 7.9 -2.504 8.7 -2.573 9.5 -2.645 10.4 -2.72 11.4 -2.796 12.5 -2.873 13.7 -2.95 15 -3.029 16.4 -3.11 18 -3.191 19.7 -3.277 21.6 -3.365 23.7 -3.458 26 -3.558 28.5 -3.666 31.2 -3.793 34.2 -3.941 37.5 -4.118 41.1 -4.336 45.1 -4.605 49.5 -4.93 54.3 -5.319 59.5 -5.788 65.2 -6.349 71.5 -6.904 77.348 -7.634 84.8 -8.471 93 -9.412 102 -10.453 111.8 -11.607 122.6 -12.865 134.4 -14.241 147.4 -15.729 161.6 -17.347 177.2 -19.1 194.3 -20.999 213 -23.066 233.5 -25.321 256 -27.037 273.15 -29.724 300 -32.733 330 - - diff --git a/tecs/inp/r3510.inp b/tecs/inp/r3510.inp deleted file mode 100644 index f53a160..0000000 --- a/tecs/inp/r3510.inp +++ /dev/null @@ -1,69 +0,0 @@ -sens=r3510 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=RhFe ! 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=0 ! range in sensor units (if rang=0: determine range from table, if omitted: default from sensor type) -form=loglog -curv ! curve (sensor,temp/K) follows, must be ordered, but can be increasing or decreasing -1.433 1.001 -1.515 1.3 -1.597 1.7 -1.626 1.8 -1.638 1.9 -1.65 2 -1.681 2.2 -1.728 2.5 -1.812 3 -1.962 4 -1.989 4.21 -2.04 4.6 -2.09 5 -2.151 5.5 -2.209 6 -2.274 6.6 -2.337 7.2 -2.405 7.9 -2.479 8.7 -2.547 9.5 -2.62 10.4 -2.695 11.4 -2.771 12.5 -2.848 13.7 -2.925 15 -3.005 16.4 -3.085 18 -3.167 19.7 -3.253 21.6 -3.341 23.7 -3.434 26 -3.534 28.5 -3.643 31.2 -3.769 34.2 -3.918 37.5 -4.095 41.1 -4.313 45.1 -4.582 49.5 -4.909 54.3 -5.298 59.5 -5.767 65.2 -6.33 71.5 -6.885 77.348 -7.615 84.8 -8.451 93 -9.392 102 -10.433 111.8 -11.586 122.6 -12.843 134.4 -14.219 147.4 -15.707 161.6 -17.324 177.2 -19.077 194.3 -20.975 213 -23.041 233.5 -25.296 256 -27.011 273.15 -29.697 300 -32.705 330 - - diff --git a/tecs/inp/rdr11.cfg b/tecs/inp/rdr11.cfg deleted file mode 100644 index c65f94c..0000000 --- a/tecs/inp/rdr11.cfg +++ /dev/null @@ -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" - diff --git a/tecs/inp/rdr12.cfg b/tecs/inp/rdr12.cfg deleted file mode 100644 index 5351238..0000000 --- a/tecs/inp/rdr12.cfg +++ /dev/null @@ -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" - diff --git a/tecs/inp/rhfe0734.inp b/tecs/inp/rhfe0734.inp deleted file mode 100644 index dae0435..0000000 --- a/tecs/inp/rhfe0734.inp +++ /dev/null @@ -1,124 +0,0 @@ -sens=rhfe0734 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=3250 ! setpoint limit (automatic if omitted) -type=RhFe ! 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=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 -+1.68 0.5831 -+1.73 0.8616 -+1.78 1.1426 -+1.83 1.4276 -+1.88 1.7179 -+1.93 2.0148 -+1.98 2.3195 -+2.03 2.6331 -+2.08 2.957 -+2.13 3.292 -+2.18 3.6391 -+2.23 3.9993 -+2.28 4.3734 -+2.33 4.7622 -+2.38 5.1668 -+2.43 5.5881 -+2.48 6.0273 -+2.53 6.4856 -+2.58 6.9644 -+2.63 7.465 -+2.68 7.9888 -+2.73 8.5374 -+2.78 9.1123 -+2.83 9.7149 -+2.88 10.3469 -+2.93 11.0099 -+2.98 11.7059 -+3.03 12.4366 -+3.08 13.2041 -+3.13 14.0107 -+3.18 14.8583 -+3.23 15.7491 -+3.28 16.685 -+3.33 17.6671 -+3.38 18.6961 -+3.43 19.7717 -+3.48 20.8922 -+3.53 22.0546 -+3.58 23.254 -+3.63 24.4842 -+3.68 25.7372 -+3.73 27.0041 -+3.78 28.275 -+3.83 29.5403 -+3.88 30.7913 -+3.93 32.0212 -+3.98 33.2277 -+4.03 34.4064 -+4.08 35.5549 -+4.13 36.6724 -+4.18 37.7591 -+4.23 38.8156 -+4.28 39.8428 -+4.33 40.8421 -+4.43 42.7622 -+4.53 44.5869 -+4.63 46.3269 -+4.73 47.992 -+4.83 49.5908 -+4.93 51.1309 -+5.03 52.6189 -+5.13 54.0603 -+5.23 55.4602 -+5.33 56.8226 -+5.43 58.1513 -+5.53 59.4494 -+5.63 60.7198 -+5.73 61.9649 -+5.83 63.1869 -+5.93 64.3876 -+6.03 65.5689 -+6.13 66.7323 -+6.23 67.8791 -+6.33 69.0106 -+6.43 70.1279 -+6.53 71.232 -+6.63 72.324 -+6.73 73.4046 -+6.83 74.4746 -+6.93 75.5348 -+7.03 76.5858 -+7.13 77.6282 -+7.23 78.6626 -+7.33 79.6895 -+7.43 80.7094 -+7.53 81.7228 -+7.63 82.7301 -+7.73 83.7316 -+7.83 84.7278 -+7.93 85.7189 -+8.03 86.7054 -+8.13 87.6875 -+8.23 88.6655 -+8.33 89.6396 -+9.33 99.2177 -+10.33 108.6138 -+11.33 117.9369 -+12.33 127.252 -+13.33 136.5978 -+14.33 145.9964 -+15.33 155.4592 -+16.33 164.9901 -+17.33 174.5886 -+18.33 184.251 -+19.33 193.9718 -+20.33 203.7444 -+21.33 213.5617 -+22.33 223.4166 -+23.33 233.3019 -+24.33 243.211 -+25.33 253.1376 -+26.33 263.076 -+27.33 273.0207 -+29.33 292.9108 -+31.33 312.7801 -+33.33 332.6028 - diff --git a/tecs/inp/rhfe4140.inp b/tecs/inp/rhfe4140.inp deleted file mode 100644 index 671266c..0000000 --- a/tecs/inp/rhfe4140.inp +++ /dev/null @@ -1,53 +0,0 @@ -sens=rhfe4140 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=3250 ! setpoint limit (automatic if omitted) -type=RhFe ! 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=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 -1.58190 1.468 -1.67400 1.993 -1.80593 2.791 -1.87062 3.208 -1.98346 3.979 -2.01446 4.201 -2.17064 5.409 -2.35384 7.032 -2.45031 7.993 -2.63333 10.061 -2.84964 13.002 -3.03325 16.021 -3.23588 20.015 -3.45195 24.998 -3.55119 27.449 -3.65991 30.129 -3.87224 35.144 -4.10610 40.104 -4.68439 50.174 -5.43016 60.491 -6.25613 70.218 -7.22886 80.535 -8.24755 90.660 -9.29999 100.749 -11.9067 125.232 -14.6048 150.712 -17.1906 175.593 -19.7720 200.866 -22.2457 225.394 -24.7721 250.638 -27.0084 273.062 -27.0370 273.347 -29.7624 300.665 -32.154 325 -34.638 350 -37.136 375 -39.652 400 -42.189 425 -44.747 450 -47.329 475 -49.937 500 -60.644 600 -71.825 700 -83.522 800 - - diff --git a/tecs/inp/rhfe705.inp b/tecs/inp/rhfe705.inp deleted file mode 100644 index c8f4732..0000000 --- a/tecs/inp/rhfe705.inp +++ /dev/null @@ -1,70 +0,0 @@ -sens=rhfe705 -unit=Ohm -type=RhFe -curv -1.40787 2 -1.44441 2.25 -1.48069 2.5 -1.51656 2.75 -1.55186 3 -1.58646 3.25 -1.62021 3.5 -1.653 3.75 -1.68481 4 -1.71563 4.25 -1.74544 4.5 -1.77425 4.75 -1.80202 5 -1.85445 5.5 -1.90269 6 -1.94698 6.5 -1.98773 7 -2.02532 7.5 -2.06015 8 -2.09261 8.5 -2.12367 9 -2.15513 9.5 -2.18884 10 -2.26927 11 -2.36109 12 -2.4467 13 -2.51248 14 -2.56155 15 -2.60114 16 -2.63842 17 -2.67807 18 -2.71917 19 -2.76004 20 -2.83629 22 -2.90852 24 -2.98426 26 -3.069 28 -3.16018 30 -3.2542 32 -3.35036 34 -3.44849 36 -3.54786 38 -3.64488 40 -3.87398 45 -4.19334 50 -4.5408 55 -4.91581 60 -5.3318 65 -5.73653 70 -6.15888 75 -6.64008 80 -7.21199 85 -7.80683 90 -8.35142 95 -8.87103 100 -9.93932 110 -11.0221 120 -13.1247 140 -15.2620 160 -17.4033 180 -19.4408 200 -21.6369 220 -23.6669 240 -25.7695 260 -27.7930 280 -30.8 310 diff --git a/tecs/inp/rhfe8119.inp b/tecs/inp/rhfe8119.inp deleted file mode 100644 index 5833129..0000000 --- a/tecs/inp/rhfe8119.inp +++ /dev/null @@ -1,66 +0,0 @@ -sens=rhfe8119 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=3250 ! setpoint limit (automatic if omitted) -type=RhFe ! 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=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 -1.6835 1.0 -1.7566 1.408 -1.7745 1.508 -1.7925 1.609 -1.8617 2.006 -1.9298 2.41 -1.9932 2.8 -2.0569 3.208 -2.1158 3.602 -2.1776 4.032 -2.2019 4.207 -2.2559 4.607 -2.3591 5.42 -2.4535 6.224 -2.5469 7.085 -2.6428 8.044 -2.7344 9.041 -2.8239 10.097 -2.9026 11.099 -3.0388 13.018 -3.1086 14.103 -3.2263 16.105 -3.3306 18.075 -3.4277 20.081 -3.5359 22.497 -3.6426 25.036 -3.7436 27.529 -3.8446 30.018 -3.9485 32.539 -4.0556 35.035 -4.2955 40.16 -4.8847 50.442 -5.599 60.391 -6.443 70.418 -7.3254 79.886 -8.3393 90.091 -9.3943 100.318 -12.1072 126.038 -14.6989 150.738 -17.2882 175.872 -19.8227 200.897 -22.3245 225.909 -25.0177 253.046 -27.0043 273.132 -27.033 273.422 -29.7561 300.957 -32.138 325 -34.625 350 -37.126 375 -39.645 400 -42.185 425 -44.747 450 -47.333 475 -49.944 500 -60.669 600 -71.872 700 -83.594 800 - - diff --git a/tecs/inp/rhfe8244.inp b/tecs/inp/rhfe8244.inp deleted file mode 100644 index c0d6c77..0000000 --- a/tecs/inp/rhfe8244.inp +++ /dev/null @@ -1,65 +0,0 @@ -sens=rhfe8244 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=3250 ! setpoint limit (automatic if omitted) -type=RhFe ! 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=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 -1.725 1.000 -1.8003 1.405 -1.8182 1.505 -1.8369 1.608 -1.9076 2.011 -1.9742 2.406 -2.0379 2.798 -2.1019 3.207 -2.1613 3.603 -2.2206 4.016 -2.2472 4.208 -2.3013 4.609 -2.4027 5.406 -2.496 6.2 -2.5855 7.02 -2.6865 8.027 -2.7792 9.035 -2.867 10.073 -2.9446 11.062 -3.0836 13.023 -3.148 14.022 -3.2661 16.025 -3.374 18.062 -3.4691 20.026 -3.5803 22.515 -3.6853 25.021 -3.786 27.512 -3.8865 29.992 -3.9919 32.551 -4.0991 35.048 -4.3341 40.073 -4.9331 50.537 -5.6366 60.342 -6.4825 70.406 -7.3813 80.053 -8.4119 90.424 -9.4424 100.416 -12.0995 125.632 -14.6813 150.259 -17.2466 175.171 -19.7776 200.18 -22.4707 227.132 -24.7622 250.24 -27.0121 273.003 -27.0474 273.361 -29.7123 300.333 -32.154 325 -34.638 350 -37.136 375 -39.652 400 -42.189 425 -44.747 450 -47.329 475 -49.937 500 -60.644 600 -71.825 700 -83.522 800 - diff --git a/tecs/inp/rhfe8733.inp b/tecs/inp/rhfe8733.inp deleted file mode 100644 index be0f80f..0000000 --- a/tecs/inp/rhfe8733.inp +++ /dev/null @@ -1,51 +0,0 @@ -sens=rhfe8733 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -type=RhFe ! 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 -1.5 0.3 -1.8843 1.403 -1.9039 1.512 -1.9202 1.602 -1.9943 2.027 -2.0584 2.406 -2.1234 2.807 -2.1851 3.203 -2.2447 3.602 -2.3004 3.99 -2.3296 4.201 -2.384 4.606 -2.4846 5.399 -2.579 6.204 -2.6712 7.055 -2.7701 8.05 -2.8585 9.015 -2.9456 10.045 -3.0235 11.038 -3.163 13.009 -3.2269 14.005 -3.3462 16.034 -3.4507 18.011 -3.5494 20.058 -3.6584 22.508 -3.7656 25.076 -3.8655 27.552 -3.9648 30.013 -4.0684 32.538 -4.1735 34.997 -4.4278 40.426 -5.0004 50.424 -5.7174 60.443 -6.558 70.46 -7.4811 80.374 -8.4707 90.355 -9.5417 100.762 -12.1855 125.915 -14.8417 151.328 -17.57 177.929 -19.9341 201.373 -22.4906 227.031 -25.0243 252.655 -27.0197 272.902 -27.0698 273.411 -29.6913 300.022 - diff --git a/tecs/inp/ruox.inp b/tecs/inp/ruox.inp deleted file mode 100644 index 7fb5e42..0000000 --- a/tecs/inp/ruox.inp +++ /dev/null @@ -1,68 +0,0 @@ -sens=ruox -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=2 ! setpoint limit (automatic if omitted) -type=Special ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted) -excit=10uA ! (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) -form=loglog -curv ! curve (sensor,temp/K) follows, must be ordered, but can be increasing or decreasing -230000 1 -226072 1.5 -222012 2 -210329 3 -198151 4 -187643 5 -178843 6 -171468 7 -165280 8 -160065 9 -155637 10 -151767 11 -148389 12 -145436 13 -142813 14 -140481 15 -138397 16 -136518 17 -134812 18 -133271 19 -131859 20 -130555 21 -129358 22 -128254 23 -127220 24 -126230 25 -125316 26 -124477 27 -123702 28 -122973 29 -122284 30 -121633 31 -121016 32 -120429 33 -119872 34 -119367 35 -118841 36 -118253 37 -117738 38 -117316 39 -116914 40 -113657 50 -111329 60 -109586 70 -108602 77 -108231 80 -107147 90 -106248 100 -104529 125 -103291 150 -102362 175 -101669 200 -101148 225 -100773 250 -100556 270 -100530 273 -100001 295 -100000 295.01 -50000 300 - diff --git a/tecs/inp/rx1611.inp b/tecs/inp/rx1611.inp deleted file mode 100644 index 683c1c5..0000000 --- a/tecs/inp/rx1611.inp +++ /dev/null @@ -1,89 +0,0 @@ -sens=rx1611 -unit=V ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=2 ! setpoint limit (automatic if omitted) -type=Special ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted) -excit=30uA ! (off,30nA,100nA,300nA,1uA,3uA,10uA,30uA,100uA,300uA,1mA,10mV,1mV) (if omitted: default from sensor type) -range=2 ! range in sensor units (if rang=0: determine range from table, if omitted: default from sensor type) -curv ! curve (volts, cKelvin) -0.1 1206.521654 -0.105 993.8222225 -0.1103 824.4082243 -0.1158 691.0146685 -0.1216 583.2109748 -0.1277 495.6595691 -0.1341 424.1693739 -0.1408 365.4568244 -0.1478 316.9499646 -0.1552 276.1386601 -0.163 241.7266404 -0.1712 212.626728 -0.1798 187.9352325 -0.1888 166.905356 -0.1982 148.9221064 -0.2081 133.3368629 -0.2185 119.8072354 -0.2294 108.0366429 -0.2409 97.68815706 -0.2529 88.65305941 -0.2655 80.68121887 -0.2788 73.58832758 -0.2927 67.31900363 -0.3073 61.72973563 -0.3227 56.71224548 -0.3388 52.23482387 -0.3557 48.21039972 -0.3735 44.57191657 -0.3922 41.28323672 -0.4118 38.31003269 -0.4324 35.60812694 -0.454 33.15299196 -0.4767 30.91215327 -0.5005 28.86745908 -0.5255 26.99446317 -0.5518 25.27322246 -0.5794 23.69261318 -0.6084 22.23685759 -0.6388 20.89692543 -0.6707 19.66021856 -0.7042 18.51614313 -0.7394 17.45569276 -0.7764 16.47112933 -0.8152 15.55795099 -0.856 14.70755522 -0.8988 13.91657457 -0.9437 13.17986919 -0.9909 12.49152745 -1.0404 11.84919396 -1.0924 11.24811677 -1.147 10.68535851 -1.2044 10.15734895 -1.2646 9.662651321 -1.3278 9.198237347 -1.3942 8.761545253 -1.4639 8.350940465 -1.5371 7.9643521 -1.614 7.599982053 -1.6947 7.256655057 -1.7794 6.932848325 -1.8684 6.626884532 -1.9618 6.337944626 -2.0599 6.064660729 -2.1629 5.806107119 -2.271 5.561426086 -2.3846 5.329430748 -2.5038 5.109661957 -2.629 4.901140994 -2.7605 4.703186509 -2.8985 4.515313629 -3.0434 4.33680883 -3.1956 4.16705561 -3.3554 4.005611036 -3.5232 3.851970924 -3.6994 3.705686023 -3.8844 3.566351517 -4.0786 3.433598749 -4.2825 3.307029581 -4.4966 3.18629209 -4.7214 3.071071466 -4.9575 2.961038374 - diff --git a/tecs/inp/rx1976.inp b/tecs/inp/rx1976.inp deleted file mode 100644 index 9068974..0000000 --- a/tecs/inp/rx1976.inp +++ /dev/null @@ -1,63 +0,0 @@ -sens=rx1976 -unit=mV ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=2 ! setpoint limit (automatic if omitted) -type=Special ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted) -range=0 -excit=30uA ! (off,30nA,100nA,300nA,1uA,3uA,10uA,30uA,100uA,300uA,1mA,10mV,1mV) (if omitted: default from sensor type) -curv ! curve mV,K (200 kOhm Range) -607.88 0.02 -593.99 0.021 -567.92 0.023 -543.86 0.025 -490.69 0.03 -445.36 0.035 -406.08 0.04 -371.81 0.045 -341.79 0.05 -254.67 0.07 -203.01 0.09 -170.69 0.11 -148.94 0.13 -133.29 0.15 -118.96 0.175 -108.21 0.20 -99.84 0.225 -93.09 0.25 -82.81 0.30 -75.29 0.35 -69.53 0.40 -64.95 0.45 -61.22 0.50 -55.49 0.60 -51.31 0.70 -48.11 0.80 -45.59 0.90 -43.56 1.00 -39.83 1.25 -37.29 1.50 -35.43 1.75 -34.01 2.00 -32.87 2.25 -31.94 2.50 -31.16 2.75 -30.50 3.00 -29.92 3.25 -29.42 3.50 -28.97 3.75 -28.57 4.00 -28.27 4.20 -27.45 5.00 -26.77 6.00 -25.82 8.00 -25.20 10.00 -24.60 13.00 -24.10 17.00 -23.71 22.00 -23.38 29.00 -23.15 37.00 -22.91 50.00 -22.75 67.00 -22.62 90.00 -22.51 120.00 -22.00 300.00 - diff --git a/tecs/inp/rxdil.inp b/tecs/inp/rxdil.inp deleted file mode 100644 index fd8b3f7..0000000 --- a/tecs/inp/rxdil.inp +++ /dev/null @@ -1,62 +0,0 @@ -sens=rxdil -unit=mV ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=2 ! setpoint limit (automatic if omitted) -type=Special ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted) -excit=30uA ! (off,30nA,100nA,300nA,1uA,3uA,10uA,30uA,100uA,300uA,1mA,10mV,1mV) (if omitted: default from sensor type) -range=2000 ! range in sensor units (if rang=0: determine range from table, if omitted: default from sensor type) -curv ! curve (volts, cKelvin) -607.88 0.02 -593.99 0.021 -567.92 0.023 -543.86 0.025 -490.69 0.03 -445.36 0.035 -406.08 0.04 -371.81 0.045 -341.79 0.05 -254.67 0.07 -203.01 0.09 -170.69 0.11 -148.94 0.13 -133.29 0.15 -118.96 0.175 -108.21 0.20 -99.84 0.225 -93.09 0.25 -82.81 0.30 -75.29 0.35 -69.53 0.40 -64.95 0.45 -61.22 0.50 -55.49 0.60 -51.31 0.70 -48.11 0.80 -45.59 0.90 -43.56 1.00 -39.83 1.25 -37.29 1.50 -35.43 1.75 -34.01 2.00 -32.87 2.25 -31.94 2.50 -31.16 2.75 -30.50 3.00 -29.92 3.25 -29.42 3.50 -28.97 3.75 -28.57 4.00 -28.27 4.20 -27.45 5.00 -26.77 6.00 -25.82 8.00 -25.20 10.00 -24.60 13.00 -24.10 17.00 -23.71 22.00 -23.38 29.00 -23.15 37.00 -22.91 50.00 -22.75 67.00 -22.62 90.00 -22.51 120.00 -22.00 300.00 diff --git a/tecs/inp/std1.inp b/tecs/inp/std1.inp deleted file mode 100644 index 6fe5488..0000000 --- a/tecs/inp/std1.inp +++ /dev/null @@ -1,2 +0,0 @@ -sens=std1 -curv=1 diff --git a/tecs/inp/std4.inp b/tecs/inp/std4.inp deleted file mode 100644 index 5d7aaf7..0000000 --- a/tecs/inp/std4.inp +++ /dev/null @@ -1,2 +0,0 @@ -sens=std4 -curv=4 diff --git a/tecs/inp/std6.inp b/tecs/inp/std6.inp deleted file mode 100644 index 87845e0..0000000 --- a/tecs/inp/std6.inp +++ /dev/null @@ -1,2 +0,0 @@ -sens=std6 -curv=6 diff --git a/tecs/inp/sup4t.cfg b/tecs/inp/sup4t.cfg deleted file mode 100644 index 4e9c9bf..0000000 --- a/tecs/inp/sup4t.cfg +++ /dev/null @@ -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 diff --git a/tecs/inp/tubby.cfg b/tecs/inp/tubby.cfg deleted file mode 100644 index 0c5a071..0000000 --- a/tecs/inp/tubby.cfg +++ /dev/null @@ -1,6 +0,0 @@ - sensA.type=m sensA.curve=x67 - sensB.type=t sensB.curve=std4 - sensD.type=s sensD.curve=x23167 - dev="11 T horizontal SANS cryomagnet" - tlimit=310 resist=50 maxpower=12.5 - prop=10 int=10 deriv=0 diff --git a/tecs/inp/tubby2.cfg b/tecs/inp/tubby2.cfg deleted file mode 100644 index f5bce39..0000000 --- a/tecs/inp/tubby2.cfg +++ /dev/null @@ -1,4 +0,0 @@ - sensC.type=s sensC.curve=x17627 - dev="rotatable sample stick for 11 T cryomagnet" - tlimit=310 resist=50 maxpower=12.5 - prop=10 int=10 deriv=0 diff --git a/tecs/inp/type_c.inp b/tecs/inp/type_c.inp deleted file mode 100644 index cbaee24..0000000 --- a/tecs/inp/type_c.inp +++ /dev/null @@ -1,157 +0,0 @@ -sens=type_c -unit=mV -type=TC ! kinked at 333.15 (scale=2) -curv --0.135 263.15 -0.135 283.15 -0.273 293.15 -0.412 303.15 -0.554 313.15 -0.699 323.15 -0.845 333.15 -0.994 338.15 -1.144 343.15 -1.297 348.15 -1.451 353.15 -1.607 358.15 -1.766 363.15 -1.925 368.15 -2.087 373.15 -2.25 378.15 -2.415 383.15 -2.581 388.15 -2.749 393.15 -2.919 398.15 -3.089 403.15 -3.261 408.15 -3.435 413.15 -3.609 418.15 -3.785 423.15 -3.962 428.15 -4.141 433.15 -4.32 438.15 -4.5 443.15 -4.682 448.15 -4.864 453.15 -5.047 458.15 -5.231 463.15 -5.416 468.15 -5.602 473.15 -5.788 478.15 -5.976 483.15 -6.164 488.15 -6.352 493.15 -6.541 498.15 -6.731 503.15 -6.922 508.15 -7.113 513.15 -7.304 518.15 -7.496 523.15 -7.688 528.15 -7.881 533.15 -8.074 538.15 -8.268 543.15 -8.461 548.15 -8.655 553.15 -8.85 558.15 -9.044 563.15 -9.239 568.15 -9.434 573.15 -9.629 578.15 -9.824 583.15 -10.02 588.15 -10.215 593.15 -10.411 598.15 -10.606 603.15 -10.802 608.15 -10.997 613.15 -11.193 618.15 -11.388 623.15 -11.584 628.15 -11.779 633.15 -11.974 638.15 -12.169 643.15 -12.364 648.15 -12.559 653.15 -12.753 658.15 -12.948 663.15 -13.142 668.15 -13.336 673.15 -13.53 678.15 -13.723 683.15 -13.916 688.15 -14.109 693.15 -14.302 698.15 -14.494 703.15 -14.686 708.15 -14.878 713.15 -15.069 718.15 -15.26 723.15 -15.451 728.15 -15.641 733.15 -15.831 738.15 -16.02 743.15 -16.209 748.15 -16.397 753.15 -16.585 758.15 -16.773 763.15 -16.96 768.15 -17.147 773.15 -17.333 778.15 -17.519 783.15 -17.704 788.15 -17.889 793.15 -18.074 798.15 -18.257 803.15 -18.623 813.15 -18.987 823.15 -19.349 833.15 -19.709 843.15 -20.066 853.15 -20.422 863.15 -20.775 873.15 -21.125 883.15 -21.474 893.15 -21.82 903.15 -22.163 913.15 -22.505 923.15 -22.844 933.15 -23.18 943.15 -23.514 953.15 -23.846 963.15 -24.175 973.15 -24.502 983.15 -24.827 993.15 -25.149 1003.15 -25.468 1013.15 -25.785 1023.15 -26.1 1033.15 -26.413 1043.15 -26.723 1053.15 -27.03 1063.15 -27.335 1073.15 -27.638 1083.15 -27.938 1093.15 -28.236 1103.15 -28.531 1113.15 -28.824 1123.15 -29.115 1133.15 -29.403 1143.15 -29.688 1153.15 -29.971 1163.15 -30.252 1173.15 -30.53 1183.15 -30.806 1193.15 -31.079 1203.15 -31.349 1213.15 -31.617 1223.15 -31.882 1233.15 -32.145 1243.15 -32.404 1253.15 -32.661 1263.15 -32.915 1273.15 -33.167 1283.15 -33.415 1293.15 -33.66 1303.15 - - diff --git a/tecs/inp/variox.cfg b/tecs/inp/variox.cfg deleted file mode 100644 index 043af09..0000000 --- a/tecs/inp/variox.cfg +++ /dev/null @@ -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 diff --git a/tecs/inp/x09629.inp b/tecs/inp/x09629.inp deleted file mode 100644 index 8991d33..0000000 --- a/tecs/inp/x09629.inp +++ /dev/null @@ -1,91 +0,0 @@ -sens=x09629 ! S/N of sensor -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted) -!excit=1mV ! (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 ! R Ohm vs temp K taken from CX105_X09629.TAB -119398 1.19703 -88996.1 1.30157 -68038.8 1.40772 -44561.1 1.60572 -31465.7 1.80531 -24008.1 1.99091 -18251.6 2.21197 -15485.4 2.3637 -12453.6 2.59161 -10444.3 2.80023 -9021.47 2.99586 -7846.78 3.20169 -6939.62 3.40271 -6166.87 3.61346 -5593.41 3.80386 -5070.32 4.01067 -4652.90 4.20576 -3820.51 4.71216 -3348.74 5.10062 -2893.34 5.58879 -2417.99 6.28229 -2033.69 7.07557 -1693.31 8.07788 -1448.86 9.09053 -1263.02 10.1288 -1123.84 11.1396 -1014.08 12.1481 -925.388 13.1459 -852.546 14.1343 -791.718 15.1055 -739.496 16.0780 -694.852 17.0327 -655.346 17.9951 -620.324 18.9630 -588.377 19.9540 -557.477 21.0290 -516.978 22.6596 -483.989 24.2116 -453.805 25.8564 -427.922 27.4683 -404.482 29.1244 -380.733 31.0335 -357.549 33.1816 -329.025 36.2871 -305.842 39.2933 -285.998 42.3186 -268.697 45.3678 -254.054 48.3309 -245.124 50.3304 -225.690 55.3217 -209.568 60.2852 -195.936 65.2357 -184.127 70.2031 -174.002 75.0902 -164.907 80.0684 -156.826 85.0328 -149.591 90.0104 -143.090 94.9915 -136.990 100.127 -126.663 110.094 -117.937 120.053 -110.430 130.030 -103.859 140.047 -98.1120 150.051 -93.0197 160.043 -88.4615 170.060 -84.3833 180.081 -80.6980 190.097 -77.3459 200.127 -74.3175 210.107 -71.5411 220.126 -68.9747 230.135 -66.6457 240.088 -64.4895 250.053 -62.5019 259.973 -60.6463 269.988 -58.9182 280.004 -57.3026 290.019 -55.7989 300.055 -54.3829 310.148 -53.7131 315.144 -53.0595 320.211 -52.3154 326.228 -51.8232 330.244 diff --git a/tecs/inp/x09882.inp b/tecs/inp/x09882.inp deleted file mode 100644 index fe057b4..0000000 --- a/tecs/inp/x09882.inp +++ /dev/null @@ -1,92 +0,0 @@ -sens=x09882 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! 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=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 -14797.9 1.19193 -12448.4 1.29974 -10982.6 1.38715 -8547.47 1.59428 -7041.63 1.79221 -5911 2.00599 -5115.55 2.21219 -4531.17 2.41069 -4078.98 2.6051 -3727.92 2.79063 -3402.6 2.99993 -3128.16 3.21371 -2913.34 3.41252 -2734.11 3.60403 -2569.37 3.80774 -2431.76 4.0002 -2312.38 4.1892 -2096.39 4.59514 -1922.56 4.99537 -1744.81 5.50526 -1549.77 6.22335 -1383.86 7.02472 -1222.31 8.06177 -1100.15 9.09066 -1002.21 10.1355 -924.021 11.1589 -859.364 12.1735 -804.651 13.185 -758.845 14.162 -718.001 15.1556 -681.881 16.1464 -650.369 17.1142 -621.743 18.0865 -596.067 19.0522 -572.129 20.0353 -548.69 21.0945 -516.935 22.695 -490.347 24.2048 -465.176 25.8072 -442.439 27.4145 -422.126 29.018 -401.43 30.8186 -379.561 32.9565 -352.698 35.9509 -329.394 38.968 -309.122 41.9784 -291.451 44.9523 -275.567 47.9705 -266.007 49.9734 -244.814 54.9644 -226.895 59.9372 -211.835 64.8041 -198.257 69.8265 -186.421 74.8073 -175.994 79.76 -166.615 84.7645 -158.17 89.757 -150.595 94.7278 -143.445 99.88 -131.348 109.891 -121.126 119.886 -112.336 129.879 -104.767 139.858 -98.1002 149.874 -92.2394 159.86 -87.0447 169.871 -82.4096 179.84 -78.2514 189.848 -74.5122 199.87 -71.1115 209.86 -68.0321 219.844 -65.2143 229.889 -62.6401 239.915 -60.2922 249.884 -58.1205 259.897 -56.124 269.929 -54.28 279.941 -52.5664 289.964 -50.9743 300.009 -49.4965 310.068 -48.7925 315.086 -48.1168 320.089 -47.3448 326.091 -46.8369 330.089 - diff --git a/tecs/inp/x09883.inp b/tecs/inp/x09883.inp deleted file mode 100644 index 205cbcc..0000000 --- a/tecs/inp/x09883.inp +++ /dev/null @@ -1,92 +0,0 @@ -sens=x09883 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! 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=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 -50697.2 1.19172 -40559.1 1.2997 -34512.9 1.38772 -25063.8 1.59429 -19577.5 1.79224 -15681.2 2.00579 -13072.2 2.21208 -11222.3 2.41069 -9847.35 2.6034 -8791.26 2.7906 -7846.7 3.00005 -7069.93 3.21374 -6474.44 3.41239 -5988.04 3.60402 -5544.72 3.80786 -5182.73 4.00017 -4871.97 4.1891 -4322.43 4.59508 -3890.99 4.99554 -3458.11 5.50564 -2996.38 6.22351 -2615.51 7.0249 -2254.83 8.06193 -1988.83 9.09068 -1780.29 10.1358 -1617.51 11.1589 -1484.58 12.1733 -1373.99 13.1848 -1282.45 14.1616 -1202 15.1558 -1131.5 16.1467 -1070.43 17.1145 -1015.81 18.0864 -967.127 19.0523 -922.097 20.0348 -878.301 21.0942 -819.492 22.695 -771.027 24.2035 -725.442 25.8078 -684.833 27.4152 -648.656 29.0175 -612.282 30.8184 -574.104 32.9566 -527.93 35.951 -488.247 38.9681 -454.161 41.9788 -424.745 44.9516 -398.466 47.9702 -382.78 49.9734 -348.448 54.9642 -319.762 59.9372 -295.798 64.8036 -274.497 69.8262 -256.115 74.8066 -240.064 79.7602 -225.652 84.764 -212.863 89.7568 -201.482 94.7284 -190.788 99.8804 -172.849 109.891 -157.882 119.887 -145.172 129.88 -134.301 139.858 -124.826 149.873 -116.577 159.861 -109.293 169.871 -102.863 179.841 -97.1221 189.85 -91.9646 199.871 -87.3432 209.859 -83.1778 219.842 -79.3655 229.891 -75.9226 239.917 -72.7733 249.883 -69.8839 259.896 -67.2351 269.927 -64.7933 279.942 -62.5416 289.965 -60.4496 300.008 -58.5077 310.066 -57.5961 315.084 -56.712 320.09 -55.6983 326.087 -55.0466 330.089 - diff --git a/tecs/inp/x09941.inp b/tecs/inp/x09941.inp deleted file mode 100644 index fd57ebb..0000000 --- a/tecs/inp/x09941.inp +++ /dev/null @@ -1,79 +0,0 @@ -sens=x09941 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=3250 ! setpoint limit (automatic if omitted) -type=Cernox ! 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=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 -89109.92656 3.592342734 -75927.84882 3.80771172 -66873.53337 3.992385149 -58461.84522 4.203659534 -44177.58035 4.711746931 -36572.40042 5.100198746 -29499.39651 5.611691713 -22954.09467 6.309052944 -17974.18138 7.115644217 -13888.58545 8.139806747 -11049.51828 9.232270241 -9014.528883 10.37906504 -7650.452644 11.44719648 -6625.778004 12.50353575 -5832.554093 13.54768562 -5202.695698 14.5772028 -4707.313975 15.55929899 -4291.544831 16.54255772 -3945.424009 17.49967384 -3650.35765 18.44649696 -3395.003004 19.38338852 -3166.788192 20.33590603 -2961.395028 21.30691433 -2692.155406 22.77910137 -2440.49331 24.41886806 -2236.687306 25.98587322 -2061.626067 27.54995251 -1907.050891 29.14138508 -1758.477449 30.91228008 -1606.203424 33.02730751 -1428.689702 35.99930763 -1283.046021 38.97810364 -1161.33904 41.98565865 -1059.899025 44.95008087 -972.8716648 47.94148254 -921.8402765 49.92553711 -813.9183038 54.87852478 -727.6791559 59.77289772 -657.3901952 64.61587906 -597.3237814 69.57008362 -545.9993931 74.58304977 -502.235637 79.57922745 -464.7514845 84.53449631 -431.8887078 89.51391983 -403.4046886 94.43180466 -376.4541741 99.69680786 -333.2715871 109.7288055 -298.4388825 119.7237396 -269.6344771 129.7141037 -245.6040149 139.6854935 -225.5918325 149.4456711 -207.8105273 159.5582657 -192.8477201 169.3871689 -179.54412 179.4086685 -168.028657 189.2752991 -157.8098318 199.1471634 -148.5936477 209.1398315 -140.4454005 219.0371552 -133.0699767 228.9918213 -126.4626969 238.8810654 -120.4248519 248.837532 -114.9800847 258.7176971 -109.9841984 268.6493378 -105.4154935 278.5511017 -101.2011797 288.5041351 -97.36067783 298.3769836 -93.82776671 308.21138 -92.11573271 313.2369537 -90.48969767 318.2412415 -88.57005094 324.3699188 -87.17269938 329.0235748 - diff --git a/tecs/inp/x10045.inp b/tecs/inp/x10045.inp deleted file mode 100644 index 2562584..0000000 --- a/tecs/inp/x10045.inp +++ /dev/null @@ -1,93 +0,0 @@ -sens=x10045 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! 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=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 -74663.91424 0.833452742 -60860.05098 0.94945966 -49551.87681 1.077803432 -35363.88586 1.32313617 -27025.56488 1.558155166 -21164.07675 1.807418904 -17439.43364 2.03304067 -14660.90306 2.26104489 -12674.48887 2.474474502 -11040.01571 2.699494433 -9785.229203 2.916614022 -8788.251677 3.12854605 -7989.704459 3.332865003 -7286.655618 3.552242447 -6732.86304 3.758944594 -6251.098886 3.968357998 -5847.432327 4.16875188 -5191.478606 4.561898582 -4648.86278 4.968968542 -4096.7535 5.492187484 -3531.813507 6.205857585 -3061.567702 7.009732318 -2632.586667 8.013117487 -2308.809844 9.034165571 -2050.115691 10.10054065 -1856.065086 11.11342812 -1697.939632 12.11838913 -1566.241253 13.12607813 -1456.905801 14.10203743 -1361.213594 15.09700775 -1277.653195 16.0933466 -1205.321893 17.06789303 -1140.225621 18.05500221 -1082.497021 19.03311348 -1029.299845 20.03519344 -978.7301404 21.09197235 -909.7052218 22.72586918 -853.6474417 24.24230862 -800.4013622 25.88646126 -754.2905397 27.49036598 -712.4078269 29.14169598 -670.7126389 30.97229099 -627.7691435 33.09676743 -575.1713405 36.13175392 -530.9271979 39.13507843 -493.6372768 42.07116508 -460.4204351 45.08211136 -431.344044 48.07953453 -413.5443388 50.11058044 -375.6941402 55.06404877 -343.7844255 60.05997467 -316.5557099 65.08597946 -293.3070433 70.08469391 -273.2720797 75.05005646 -255.8364317 79.95571518 -240.2177908 84.94446182 -226.3417365 89.90671921 -213.7399247 94.94441986 -202.290575 100.0309563 -182.836437 110.0102921 -166.6070332 120.016922 -152.8936908 130.0197296 -141.1122505 140.0428009 -130.9833926 150.0209808 -122.1217608 160.0074768 -114.3245474 170.0121689 -107.4602859 179.9772949 -101.3318808 189.9621048 -95.84227734 199.9853439 -90.91929929 209.9731979 -87.21012645 218.2335968 -82.43730345 229.9926758 -78.78173797 239.9560928 -75.43740052 249.9537582 -72.39056663 259.9496765 -69.58110202 269.9509277 -66.99775356 279.9595947 -64.61902665 289.9429169 -62.42460824 299.9438019 -60.37761496 309.9502869 -59.41308694 314.9428101 -58.49246424 319.9327393 -57.41458757 325.8934326 -56.75585142 329.7308502 - - diff --git a/tecs/inp/x10045m.inp b/tecs/inp/x10045m.inp deleted file mode 100644 index 4c303bb..0000000 --- a/tecs/inp/x10045m.inp +++ /dev/null @@ -1,89 +0,0 @@ -sens=x10045m -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! 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=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 -14660.90306 1.049887785 -13754.24495 1.275855927 -12674.48887 1.550459363 -11894.1154 1.75557277 -11040.01571 1.987821044 -10422.80643 2.162412567 -9785.229203 2.35233857 -8788.251677 2.6713522 -7989.704459 2.954705632 -7286.655618 3.239907747 -6732.86304 3.495353785 -6251.098886 3.744333505 -5847.432327 3.975506155 -5191.478606 4.414432834 -4648.86278 4.854857074 -4096.7535 5.407680622 -3531.813507 6.147281193 -3061.567702 6.969085764 -2632.586667 7.985907803 -2308.809844 9.015178241 -2050.115691 10.08695457 -1856.065086 11.1032285 -1697.939632 12.11052242 -1566.241253 13.11988767 -1456.905801 14.09704534 -1361.213594 15.09293905 -1277.653195 16.08998776 -1205.321893 17.06507732 -1140.225621 18.05262353 -1082.497021 19.031083 -1029.299845 20.03345265 -978.7301404 21.09197235 -909.7052218 22.72586918 -853.6474417 24.24230862 -800.4013622 25.88646126 -754.2905397 27.49036598 -712.4078269 29.14169598 -670.7126389 30.97229099 -627.7691435 33.09676743 -575.1713405 36.13175392 -530.9271979 39.13507843 -493.6372768 42.07116508 -460.4204351 45.08211136 -431.344044 48.07953453 -413.5443388 50.11058044 -375.6941402 55.06404877 -343.7844255 60.05997467 -316.5557099 65.08597946 -293.3070433 70.08469391 -273.2720797 75.05005646 -255.8364317 79.95571518 -240.2177908 84.94446182 -226.3417365 89.90671921 -213.7399247 94.94441986 -202.290575 100.0309563 -182.836437 110.0102921 -166.6070332 120.016922 -152.8936908 130.0197296 -141.1122505 140.0428009 -130.9833926 150.0209808 -122.1217608 160.0074768 -114.3245474 170.0121689 -107.4602859 179.9772949 -101.3318808 189.9621048 -95.84227734 199.9853439 -90.91929929 209.9731979 -87.21012645 218.2335968 -82.43730345 229.9926758 -78.78173797 239.9560928 -75.43740052 249.9537582 -72.39056663 259.9496765 -69.58110202 269.9509277 -66.99775356 279.9595947 -64.61902665 289.9429169 -62.42460824 299.9438019 -60.37761496 309.9502869 -59.41308694 314.9428101 -58.49246424 319.9327393 -57.41458757 325.8934326 -56.75585142 329.7308502 - - diff --git a/tecs/inp/x10409.inp b/tecs/inp/x10409.inp deleted file mode 100644 index 2c0cc55..0000000 --- a/tecs/inp/x10409.inp +++ /dev/null @@ -1,81 +0,0 @@ -sens=x10409 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=3250 ! setpoint limit (automatic if omitted) -type=Cernox ! 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=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 -32269 2.9 -20748.23736 3.603200555 -18579.47154 3.804014087 -16787.76559 4.006860971 -15312.0953 4.206260443 -12878.53597 4.621938705 -11165.60106 5.008944988 -9488.065966 5.520080328 -7822.402491 6.221029282 -6511.52182 7.015725851 -5367.730437 8.012619019 -4547.8505 9.028389454 -3941.31213 10.05083227 -3483.009321 11.05512524 -3121.047033 12.05727196 -2824.662495 13.06689167 -2585.652442 14.04817963 -2378.793212 15.05108452 -2202.553608 16.05706978 -2051.669948 17.04423904 -1920.122874 18.04127312 -1804.411269 19.02977657 -1699.495361 20.03870296 -1600.184447 21.11633015 -1470.090201 22.73399639 -1365.536983 24.24896431 -1267.256013 25.89503288 -1183.944345 27.48793411 -1109.317628 29.10398102 -1035.857301 30.92041111 -961.0568252 33.03728104 -870.4233581 36.06695747 -795.1136505 39.0746727 -732.5889862 42.01421165 -677.4377467 45.02629662 -630.0009583 48.02737236 -601.1675257 50.06132126 -540.4813148 55.02171707 -490.1353054 60.01608086 -447.7458778 65.0472908 -412.614513 69.94781113 -382.1132871 74.89925385 -355.1316233 79.93727493 -331.7406269 84.91990662 -311.1618975 89.87853622 -292.6475904 94.90999222 -275.8925548 99.9990654 -247.7818855 109.9829636 -224.5444307 119.9845352 -205.0093904 129.9849472 -188.4524514 140.0073547 -174.2845269 149.9874802 -161.9983605 159.9749832 -151.2042924 169.985466 -141.7478565 179.9493103 -133.3809171 189.9470749 -125.8860681 199.9535294 -119.1794129 209.9433517 -113.1612303 219.9225845 -107.6761902 229.9573059 -102.753304 239.9341965 -98.25500897 249.9317551 -94.14265231 259.9379425 -90.37198068 269.9463196 -86.90447594 279.9547577 -83.71326247 289.9455261 -80.77006452 299.9459534 -78.04586532 309.9586639 -76.75843584 314.9595947 -75.5204243 319.9495544 -74.1057045 325.9043579 -73.21666644 329.7353821 - - diff --git a/tecs/inp/x12532.inp b/tecs/inp/x12532.inp deleted file mode 100644 index 72a53b8..0000000 --- a/tecs/inp/x12532.inp +++ /dev/null @@ -1,92 +0,0 @@ -sens=x12532 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=Cernox ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted) -!excit=30uA ! (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 -70362.79975 1.212527454 -57354.12647 1.302272379 -46697.37477 1.403238893 -33326.70199 1.600960016 -25468.72112 1.795867503 -19944.89184 2.00802362 -16434.81178 2.204471231 -13816.34216 2.406850576 -11944.35802 2.599458814 -10404.04086 2.805486679 -9221.538007 3.00683713 -8281.992703 3.205510736 -7529.446863 3.398802876 -6866.898089 3.60289824 -6358.310835 3.787422657 -5869.022151 3.994391799 -5435.666264 4.207564354 -5048.762029 4.432380199 -4538.253606 4.784216642 -3914.242563 5.342155457 -3300.345086 6.1004107 -2852.151097 6.871144295 -2432.277393 7.865599394 -2104.024357 8.939789295 -1891.65792 9.848791122 -1709.086747 10.8249917 -1546.544011 11.9003787 -1433.74055 12.79861736 -1330.790008 13.76333618 -1236.964242 14.78599024 -1158.932854 15.77061892 -1094.433622 16.69752789 -1034.852929 17.65495396 -980.4768503 18.63900185 -931.1575654 19.63551426 -877.4284261 20.84920597 -815.0188765 22.46425533 -763.3323477 24.00939465 -714.2919854 25.68263149 -672.6664451 27.29566765 -635.4227663 28.91499805 -594.7482643 30.9173727 -558.0807072 32.97071648 -509.2143732 36.1684494 -471.6113012 39.07764816 -437.804997 42.11110878 -408.8444735 45.10894012 -382.8528407 48.18277168 -367.2296644 50.23297501 -334.2280013 55.20708084 -306.6669189 60.1606102 -282.6831175 65.24242783 -263.0523013 70.10311127 -245.7696072 75.00517273 -230.2783714 80.00709915 -216.3068241 85.11901474 -204.236498 90.08152008 -193.5017279 95.00956726 -183.0021768 100.3596878 -166.1378977 110.3379211 -151.9435045 120.3833733 -139.8754191 130.4784241 -129.680753 140.4299698 -120.6604451 150.5546036 -112.8963027 160.5837402 -106.0233471 170.6487656 -99.8972362 180.78125 -94.50981669 190.7928619 -89.64252042 200.860321 -85.26064276 210.9817581 -81.31788864 221.0397568 -77.77070909 231.033371 -74.47131628 241.2135544 -71.49486847 251.315155 -68.76514076 261.3838501 -66.26072797 271.4606934 -63.96949118 281.4693451 -61.81970992 291.6225433 -59.83227113 301.7844849 -57.99467905 311.8901367 -57.13732908 316.9467773 -56.30362245 321.9956055 -55.50368464 326.9982605 - - diff --git a/tecs/inp/x12533.inp b/tecs/inp/x12533.inp deleted file mode 100644 index 7f2a1a3..0000000 --- a/tecs/inp/x12533.inp +++ /dev/null @@ -1,90 +0,0 @@ -sens=x12533 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! 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=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 -58491.11567 1.212535322 -47949.5449 1.302323103 -39259.49409 1.40324533 -28281.43621 1.600896776 -21767.98069 1.795822322 -17155.67121 2.008253574 -14213.75553 2.204490304 -12007.63886 2.406743169 -10415.31809 2.599679828 -9105.003941 2.805752277 -8097.388389 3.006976485 -7291.357363 3.205610991 -6646.490487 3.398921728 -6076.028335 3.602926254 -5637.018504 3.787533283 -5214.064508 3.994657993 -4839.768732 4.207356453 -4501.690135 4.432101488 -4057.668994 4.784009218 -3511.923839 5.342074394 -2973.614912 6.100896835 -2579.128549 6.871365786 -2207.384439 7.865557909 -1915.850175 8.940035343 -1726.748344 9.848879814 -1563.465412 10.82483435 -1418.13084 11.9001646 -1316.964373 12.79871416 -1224.187029 13.76333618 -1139.695628 14.78597641 -1069.281285 15.77101898 -1010.884223 16.69764805 -957.2041233 17.6546526 -907.944238 18.63812733 -863.1087092 19.63531017 -814.3069506 20.84896278 -757.6393844 22.4640255 -710.4887602 24.00959301 -665.7070891 25.68195915 -627.583247 27.29504395 -593.4598081 28.91486263 -556.2805114 30.91711807 -522.5368408 32.97060394 -477.5900412 36.16845131 -442.8664029 39.07749367 -411.6814887 42.11124992 -384.9241731 45.10907555 -360.8523969 48.1827774 -346.3993674 50.23285484 -315.6773941 55.20724106 -290.0937236 60.16088295 -267.7935066 65.242836 -249.4506493 70.1031723 -233.2979124 75.00526047 -218.8083315 80.00709915 -205.717029 85.11898804 -194.3976616 90.08143997 -184.3289633 95.00944519 -174.4566698 100.3590927 -158.5832207 110.3372612 -145.2116141 120.3833885 -133.8192793 130.4760437 -124.1684502 140.4295197 -115.6706335 150.5550842 -108.2798297 160.5835495 -101.75565 170.6484222 -95.95185322 180.7810669 -90.8262136 190.7918854 -86.2172275 200.8603973 -82.03414533 210.9830551 -78.2895644 221.0397034 -74.89527823 231.0341873 -71.75384718 241.2140121 -68.9091264 251.3133316 -66.30965093 261.3838348 -63.91098586 271.4609528 -61.72845994 281.4719086 -59.67628607 291.6222687 -57.78058314 301.7855835 -56.02719573 311.8906708 -55.19537744 316.946228 -54.39166232 321.9963684 -53.62604513 326.9980164 diff --git a/tecs/inp/x12905.inp b/tecs/inp/x12905.inp deleted file mode 100644 index 41a5889..0000000 --- a/tecs/inp/x12905.inp +++ /dev/null @@ -1,157 +0,0 @@ -sens=x12905 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=Cernox ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted) -!excit=30uA ! (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 -12126.7 1.4 -10474.9 1.5 -9167.68 1.6 -8118.49 1.7 -7266.4 1.8 -6566.56 1.9 -5984.89 2 -5495.55 2.1 -5079.27 2.2 -4721.32 2.3 -4410.66 2.4 -4138.66 2.5 -3898.73 2.6 -3685.6 2.7 -3495.13 2.8 -3323.95 2.9 -3169.36 3 -3029.1 3.1 -2901.33 3.2 -2784.5 3.3 -2677.29 3.4 -2578.6 3.5 -2487.48 3.6 -2403.11 3.7 -2324.8 3.8 -2251.92 3.9 -2183.95 4 -2060.92 4.2 -1952.57 4.4 -1856.5 4.6 -1770.74 4.8 -1693.73 5 -1624.2 5.2 -1561.13 5.4 -1503.63 5.6 -1451.01 5.8 -1402.66 6 -1297.34 6.5 -1209.65 7 -1135.4 7.5 -1071.67 8 -1016.26 8.5 -967.592 9 -924.447 9.5 -885.899 10 -851.205 10.5 -819.79 11 -791.181 11.5 -764.995 12 -740.91 12.5 -718.686 13 -698.12 13.5 -678.996 14 -661.11 14.5 -644.343 15 -628.606 15.5 -613.803 16 -599.837 16.5 -586.63 17 -574.117 17.5 -562.238 18 -550.939 18.5 -540.174 19 -529.9 19.5 -520.081 20 -501.678 21 -484.734 22 -469.064 23 -454.514 24 -440.955 25 -428.28 26 -416.397 27 -405.227 28 -394.702 29 -384.763 30 -375.36 31 -366.447 32 -357.984 33 -349.935 34 -342.27 35 -334.959 36 -327.978 37 -321.303 38 -314.915 39 -308.793 40 -297.283 42 -286.654 44 -276.805 46 -267.65 48 -259.116 50 -251.14 52 -243.668 54 -236.652 56 -230.05 58 -223.825 60 -209.71 65 -197.346 70 -186.416 75 -181.699 77.35 -176.668 80 -167.922 85 -160.02 90 -152.839 95 -146.283 100 -140.272 105 -134.739 110 -129.628 115 -124.893 120 -120.493 125 -116.393 130 -112.564 135 -108.98 140 -105.619 145 -102.459 150 -99.4844 155 -96.6792 160 -94.0294 165 -91.523 170 -89.1489 175 -86.8973 180 -84.7593 185 -82.7268 190 -80.7927 195 -78.9503 200 -77.1935 205 -75.5169 210 -73.9154 215 -72.3845 220 -70.9197 225 -69.5173 230 -68.1735 235 -66.8851 240 -65.6488 245 -64.4619 250 -63.3217 255 -62.2255 260 -61.1711 265 -60.1563 270 -59.5364 273.15 -59.1791 275 -58.2376 280 -57.3299 285 -56.4544 290 -55.6095 295 -54.7938 300 -54.0058 305 -53.2442 310 -52.5078 315 -51.7955 320 -51.106 325 diff --git a/tecs/inp/x13089.inp b/tecs/inp/x13089.inp deleted file mode 100644 index 3aa0105..0000000 --- a/tecs/inp/x13089.inp +++ /dev/null @@ -1,92 +0,0 @@ -sens=x13089 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! 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=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 -23282.77032 1.201411964 -18940.37089 1.302915409 -15980.25114 1.398594966 -11836.80508 1.596837978 -9256.530986 1.797479418 -7590.003117 1.99155689 -6348.429816 2.197731075 -5461.271104 2.398754188 -4814.160875 2.590508994 -4261.59355 2.800302629 -3841.97375 3.00037014 -3502.177602 3.198451903 -3204.414778 3.408019548 -2985.156946 3.5919942 -2772.80929 3.798749503 -2606.618466 3.988047225 -2439.745949 4.205178466 -2175.91509 4.622859343 -1978.218735 5.025752554 -1778.846939 5.532288885 -1567.62827 6.240796506 -1388.105765 7.052960837 -1222.295551 8.06591284 -1097.750703 9.084500202 -1000.575337 10.10162877 -923.0118454 11.11366005 -858.7399834 12.12674717 -805.1048002 13.13159579 -759.4896453 14.13032082 -719.7374792 15.12575443 -684.8875483 16.11531839 -653.9039283 17.10483438 -626.1042046 18.0910195 -601.1725797 19.07285116 -578.4081318 20.05485689 -555.4977106 21.13791045 -525.5258216 22.72069291 -498.9067392 24.31406216 -474.5338365 25.9431995 -452.5122922 27.58075597 -432.7118898 29.21788543 -412.7786152 31.03756006 -391.8866621 33.15210641 -365.8757877 36.16130008 -343.3465339 39.16073827 -323.5020423 42.15611312 -306.0795805 45.14730855 -290.4274025 48.1496581 -280.9539983 50.14686068 -259.7524678 55.15029909 -241.6520931 60.14985227 -225.9751806 65.14270755 -212.301462 70.14672582 -200.1956819 75.14768803 -189.4641248 80.144897 -179.8519787 85.14407764 -171.177525 90.14201951 -163.2852432 95.13715956 -156.1098042 100.1338452 -143.4554918 110.1307274 -132.731907 120.1431776 -123.4890012 130.1513103 -115.4046281 140.1584345 -108.3717376 150.1663621 -102.0966968 160.1706214 -96.54502474 170.1749181 -91.55527681 180.1771922 -87.07974778 190.1795571 -83.02579701 200.1891904 -79.34465699 210.2007401 -75.99834184 220.2047128 -72.93989789 230.1996634 -70.14202598 240.1476549 -67.58874631 250.0540863 -65.21781761 260.009652 -63.01636375 270.0084065 -60.97362115 279.9977651 -59.07873602 290.0239166 -57.31555389 300.0431617 -55.67170328 310.0632294 -54.89017786 315.0699284 -54.12998781 320.0632601 -53.27391016 326.0861151 -52.68451986 330.2348667 - diff --git a/tecs/inp/x13090.inp b/tecs/inp/x13090.inp deleted file mode 100644 index d76b55d..0000000 --- a/tecs/inp/x13090.inp +++ /dev/null @@ -1,93 +0,0 @@ -sens=x13090 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! 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=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 -17567.87648 1.201366951 -14456.91319 1.302862619 -12318.44286 1.398092685 -9269.380756 1.596958259 -7344.684998 1.797326926 -6085.680579 1.99159442 -5139.052338 2.197274569 -4451.500522 2.398702837 -3949.487228 2.590664118 -3517.826085 2.799921785 -3186.625233 3.000394356 -2918.648758 3.198511655 -2682.019504 3.408070547 -2506.09826 3.592113857 -2335.93761 3.79924143 -2201.478624 3.98818411 -2066.622624 4.205386724 -1853.180966 4.622492963 -1691.598232 5.025609187 -1528.363648 5.532537741 -1354.239931 6.241173787 -1204.801541 7.052924483 -1066.439601 8.066313222 -961.6540911 9.084471548 -879.739935 10.10172926 -813.9899552 11.11426358 -759.5276654 12.12693966 -713.75932 13.13219241 -674.7297442 14.13019832 -640.6012119 15.12792955 -610.800334 16.11502493 -584.155119 17.10573197 -560.2563531 18.09046006 -538.6713548 19.07448296 -518.935928 20.05723879 -499.0815475 21.13868801 -473.0276046 22.72352506 -449.9217476 24.31285101 -428.6705654 25.9434019 -409.4784335 27.58167715 -392.1591011 29.2183984 -374.5988053 31.03853152 -356.3344353 33.15331734 -333.3134754 36.16111773 -313.4358598 39.16051532 -295.8657258 42.15603267 -280.4155859 45.14697453 -266.4453231 48.14962387 -258.0607089 50.14646139 -239.0870297 55.14961906 -222.9183156 60.14920991 -208.8952652 65.1429801 -196.5938527 70.14636425 -185.6994357 75.14756889 -176.0294407 80.14633986 -167.3142547 85.14293465 -159.4617491 90.14215397 -152.3314065 95.13894766 -145.8157304 100.1335855 -134.3188267 110.1315292 -124.5154172 120.1437255 -116.0660846 130.1527898 -108.6755652 140.1586574 -102.2012563 150.1654138 -96.45301562 160.170481 -91.31824148 170.1750129 -86.72731251 180.1773922 -82.5798662 190.1782318 -78.82235604 200.1880453 -75.40375573 210.2018025 -72.30526311 220.2043004 -69.47473293 230.2003122 -66.86851231 240.14454 -64.48339454 250.0538287 -62.2722194 260.0092416 -60.22026932 270.0083784 -58.31241678 279.9985487 -56.54399696 290.0247998 -54.89903782 300.0458261 -53.35356358 310.065352 -52.62386051 315.0655902 -51.92029427 320.0639526 -51.10076883 326.0873737 -50.55494992 330.2364089 - - diff --git a/tecs/inp/x14126.inp b/tecs/inp/x14126.inp deleted file mode 100644 index 35a7b15..0000000 --- a/tecs/inp/x14126.inp +++ /dev/null @@ -1,92 +0,0 @@ -sens=x14126 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=Cernox ! 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 -48909.42119 1.198814073 -39478.64149 1.298890646 -32655.67027 1.399317517 -23777.61131 1.598591967 -18347.05763 1.798464485 -14794.46314 1.996405533 -12106.52367 2.213300659 -10501.32121 2.39012286 -9044.163542 2.600616884 -7950.602165 2.806675147 -7123.44307 3.002098031 -6434.202788 3.2017479 -5848.208621 3.408073724 -5377.137423 3.606077897 -4973.982437 3.8049725 -4639.558689 3.995986413 -4350.82437 4.184664697 -3815.362429 4.617576588 -3422.428496 5.020661486 -3033.827203 5.527511656 -2623.779185 6.239758825 -2279.100257 7.04759816 -1963.507729 8.059801919 -1728.803623 9.078109962 -1547.561803 10.09677201 -1403.715964 11.11273188 -1286.606531 12.12167047 -1189.23653 13.12453082 -1106.547354 14.12381291 -1035.888279 15.11985926 -974.3303273 16.10972338 -920.2597131 17.09782746 -872.3103887 18.0822547 -829.1331731 19.07168714 -790.3635731 20.05645269 -751.7222399 21.14461417 -702.0199867 22.7299385 -658.3198587 24.32727919 -618.9188315 25.9641512 -583.9822824 27.61177817 -552.937056 29.24369689 -522.0009694 31.06771639 -490.2602116 33.17965602 -451.2022063 36.19065895 -418.149764 39.17224876 -389.659018 42.16193212 -364.7839704 45.16085727 -342.8982687 48.16033799 -329.7181351 50.15747817 -300.9592854 55.15264858 -276.6869612 60.15748127 -256.0938261 65.15407878 -238.3537867 70.14910661 -222.9320448 75.13908883 -209.4254498 80.13604129 -196.8107966 85.35463398 -186.5734931 90.13025157 -176.9558751 95.12590706 -168.2813076 100.1225448 -152.250726 110.7848577 -140.4725006 120.1172644 -129.7513566 130.1143951 -120.4896887 140.1175942 -112.469236 150.1152298 -105.4353025 160.1123861 -99.22042061 170.1129194 -93.70505336 180.1291118 -88.79217493 190.1268875 -84.3852042 200.1358775 -80.40399604 210.1504478 -76.80807278 220.1466991 -73.54535744 230.1453812 -70.57240888 240.1452482 -67.85190266 250.1313828 -65.34188262 260.1430643 -63.05109241 270.1389497 -60.93156052 280.1369803 -58.97479149 290.1087349 -57.15810997 300.1306211 -55.47751852 310.123022 -54.6821052 315.1323896 -53.91751058 320.1335907 -53.03187432 326.100001 -52.4592998 330.1146566 - diff --git a/tecs/inp/x14130.inp b/tecs/inp/x14130.inp deleted file mode 100644 index 6c1850f..0000000 --- a/tecs/inp/x14130.inp +++ /dev/null @@ -1,90 +0,0 @@ -sens=x14130 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -type=Cernox ! 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 -54712.84623 1.198798723 -43934.75655 1.298680177 -36145.68598 1.399140842 -26124.24812 1.598338282 -20019.7937 1.798864072 -16054.53916 1.997087653 -13082.22191 2.213840208 -11320.36815 2.389975134 -9710.445363 2.601477021 -8512.931571 2.807233166 -7612.121222 3.002608441 -6862.376758 3.2024249 -6225.652075 3.408153723 -5715.902389 3.606324617 -5280.089053 3.804946968 -4918.589025 3.996036298 -4607.035201 4.184784886 -4030.8182 4.616858111 -3608.024448 5.021396509 -3192.409828 5.528382765 -2753.884576 6.240477346 -2387.699682 7.049333293 -2052.652469 8.0607863 -1804.130589 9.078278512 -1612.202315 10.09828776 -1460.610187 11.11263828 -1337.345199 12.12196388 -1235.150445 13.12392341 -1148.598592 14.12477159 -1074.062971 15.12004292 -1009.823028 16.1097552 -952.987497 17.09840478 -902.6985387 18.08411936 -857.6926533 19.06990691 -817.1433978 20.0569545 -776.7364534 21.1466037 -724.9780754 22.72883755 -679.3006823 24.32375404 -638.3511135 25.95910253 -602.0081568 27.61171849 -569.7386681 29.24321805 -537.4810331 31.06710089 -504.504492 33.18017581 -463.9699549 36.18981414 -429.7053422 39.17308763 -400.1752242 42.16198937 -374.4503395 45.16036471 -351.7558244 48.16049583 -338.1687431 50.15638442 -308.292727 55.15315767 -283.3013008 60.15840032 -262.0374628 65.15576602 -243.7016658 70.15053822 -227.8079642 75.13845443 -213.8528405 80.13558721 -200.9878821 85.35312249 -190.4118598 90.12971562 -180.5179608 95.12598319 -171.5796501 100.1237694 -155.0837311 110.7824018 -143.0224377 120.1163016 -131.9778498 130.11536 -122.4808094 140.1167267 -114.2362018 150.1150876 -107.0314836 160.1124478 -100.674167 170.1124464 -95.02394114 180.1280123 -89.99370834 190.1285747 -85.46763974 200.138367 -81.41176772 210.1510543 -77.73092808 220.1473245 -74.39260818 230.14511 -71.34150942 240.1427862 -68.56668583 250.1299288 -66.01134763 260.143567 -63.67209493 270.1397898 -61.50727813 280.1365374 -59.50351123 290.1111445 -57.65395952 300.1320196 -55.93945627 310.1238382 -55.12054701 315.1305491 -54.33395869 320.1319831 -53.43439626 326.1011039 -52.84982047 330.1161609 - - diff --git a/tecs/inp/x14231.inp b/tecs/inp/x14231.inp deleted file mode 100644 index 5831118..0000000 --- a/tecs/inp/x14231.inp +++ /dev/null @@ -1,89 +0,0 @@ -sens=x14231 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -type=Cernox ! 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 -45346.09176 1.198717153 -36706.00173 1.298616179 -30407.09586 1.399152924 -22223.29963 1.598426911 -17175.65133 1.799308766 -13877.32694 1.997886019 -11390.09764 2.214142275 -9906.509898 2.389526577 -8539.145773 2.601747251 -7516.284525 2.807291184 -6744.498808 3.002487122 -6100.009293 3.202475086 -5551.381013 3.408289164 -5108.853651 3.606142735 -4731.042051 3.80500669 -4416.159886 3.996132283 -4143.794235 4.185137213 -3640.535495 4.616513504 -3268.12937 5.022147341 -2899.676365 5.528662912 -2512.606636 6.240495878 -2185.580383 7.048665902 -1886.592014 8.061087557 -1663.486413 9.078580603 -1490.913956 10.09831729 -1353.808309 11.11262662 -1241.978882 12.12053341 -1149.175518 13.12453255 -1070.200846 14.12385451 -1002.590927 15.11930797 -943.6033917 16.10992155 -891.7175592 17.09784756 -845.6352302 18.08488235 -804.3306007 19.07335027 -767.1307438 20.05756306 -730.1316279 21.14546834 -682.2281523 22.72983276 -640.2446923 24.32652476 -602.3359845 25.96250613 -568.6695509 27.61161933 -538.8443318 29.24410485 -508.9742411 31.06754222 -478.3257114 33.18021519 -440.5589996 36.18972271 -408.6376322 39.17322288 -381.0960781 42.16172046 -356.9619405 45.16110987 -335.7847002 48.16065735 -323.0015773 50.15751877 -295.0585709 55.15427778 -271.5202017 60.15845647 -251.4849869 65.1554738 -234.261859 70.15087616 -219.2208675 75.13817156 -206.0170192 80.13574238 -193.8353068 85.35591401 -183.8447324 90.12851069 -174.4541594 95.12557876 -165.9511715 100.1241728 -150.2884406 110.7809236 -138.8086112 120.1158899 -128.2784478 130.1156516 -119.2281279 140.1168039 -111.3536703 150.1159926 -104.4582753 160.1113105 -98.36914182 170.1119695 -92.95834383 180.1280541 -88.13033956 190.1264348 -83.79340557 200.1354211 -79.87162555 210.1502982 -76.35426251 220.1464909 -73.13678899 230.1446765 -70.20472384 240.142717 -67.52770935 250.1298551 -65.07150159 260.1424032 -62.80585804 270.1413526 -60.72207723 280.1360821 -58.80254217 290.1099663 -57.01318852 300.1296204 -55.36154863 310.1251632 -54.56232509 315.1323273 -53.81080087 320.1337028 -52.93912804 326.1023799 -52.36765678 330.1165788 - diff --git a/tecs/inp/x14667.inp b/tecs/inp/x14667.inp deleted file mode 100644 index 82854b7..0000000 --- a/tecs/inp/x14667.inp +++ /dev/null @@ -1,55 +0,0 @@ -sens=x14667 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! 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=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 -27000 1.1 -15213.49 1.407016 -13018.43 1.5035 -11293.78 1.601262 -7083.645 2.006758 -5077.505 2.408741 -3940.486 2.808387 -3226.933 3.201544 -2720.156 3.609121 -2364.470 4.004881 -2216.706 4.209672 -1979.804 4.607776 -1639.450 5.406221 -1408.674 6.202614 -1238.024 7.018838 -1075.552 8.090369 -965.5173 9.070532 -878.9260 10.05435 -811.1776 11.00538 -702.1754 13.01645 -660.2551 14.00823 -590.8182 16.03379 -537.7225 18.01233 -493.8470 20.03132 -450.0727 22.50681 -413.7147 25.02309 -383.6522 27.51456 -357.7065 30.04403 -335.9463 32.50384 -316.5779 35.01109 -283.8034 40.1232 -237.4676 50.04377 -204.4723 60.18116 -180.2791 70.24019 -160.4228 81.00268 -146.9475 90.11372 -133.9208 100.8123 -111.2495 125.8419 -95.20267 151.2575 -83.41541 176.6167 -74.72184 200.9261 -67.59927 226.0847 -61.54781 252.7727 -57.69399 273.2733 -57.65295 273.5096 -53.45707 300.0828 -49 335 - diff --git a/tecs/inp/x15430.inp b/tecs/inp/x15430.inp deleted file mode 100644 index 385fb8a..0000000 --- a/tecs/inp/x15430.inp +++ /dev/null @@ -1,91 +0,0 @@ -sens=x15430 ! S/N of sensor -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted) -!excit=1mV ! (off,30nA,100nA,300nA,1uA,3uA,10uA,30uA,100uA,300uA,1mA,10mV,1mV) (if omitted: default from sensor type) -!rang=0 ! range in sensor units (if rang=0: determine range from table, if omitted: default from sensor type) -curv ! R Ohm vs temp K taken from CX105_X15430.DAT -8.02078780541574E+04 1.19926186921276E+00 -6.14139368328991E+04 1.29972402782349E+00 -4.82836517677421E+04 1.40276064639827E+00 -3.21912379797132E+04 1.61135381317348E+00 -2.37938220702228E+04 1.80381366212765E+00 -1.83368668808541E+04 2.00210132082254E+00 -1.47093551817249E+04 2.19907621164979E+00 -1.20425511091897E+04 2.40555751614868E+00 -1.02340081043899E+04 2.59791204629072E+00 -8.79797103185852E+03 2.80007601316587E+00 -7.68449984005811E+03 3.00270014410957E+00 -6.81190352479034E+03 3.20467220705619E+00 -6.11430217307274E+03 3.40391064928415E+00 -5.52909981800335E+03 3.60679830915368E+00 -5.06890772119676E+03 3.79783445603294E+00 -4.66224216985394E+03 3.99655279403998E+00 -4.30051038279819E+03 4.20429609764068E+00 -3.72990959611631E+03 4.61322948322824E+00 -3.30423925340383E+03 5.01302380434218E+00 -2.88793616128612E+03 5.51858744997818E+00 -2.46168388158203E+03 6.22427377402779E+00 -2.11243116466543E+03 7.02891378357641E+00 -1.80166255292316E+03 8.03600374373340E+00 -1.57584121939691E+03 9.04623827036540E+00 -1.40453174441237E+03 1.00577424310194E+01 -1.27010923897593E+03 1.10668115814473E+01 -1.16198220066275E+03 1.20730868339570E+01 -1.07285927836138E+03 1.30771658552812E+01 -9.98062823789405E+02 1.40744152993626E+01 -9.33918455883933E+02 1.50716521818097E+01 -8.78714544105495E+02 1.60661956628711E+01 -8.30121639516028E+02 1.70616180705450E+01 -7.87164124625015E+02 1.80549697699059E+01 -7.48975000685355E+02 1.90496803126378E+01 -7.14504413960394E+02 2.00465571153869E+01 -6.80531377175080E+02 2.11425885798886E+01 -6.36871997728904E+02 2.27313462586452E+01 -5.98907282130007E+02 2.43184862198313E+01 -5.64277098224651E+02 2.59689940196843E+01 -5.32906382453567E+02 2.76654604567313E+01 -5.05411088706558E+02 2.93349055090444E+01 -4.78145810854197E+02 3.11932959015692E+01 -4.50500704214300E+02 3.33287076133108E+01 -4.16725007835327E+02 3.63378329309277E+01 -3.88112477749629E+02 3.93214873932549E+01 -3.63552526962929E+02 4.22872180122789E+01 -3.41984500846718E+02 4.52643831879735E+01 -3.22783959307462E+02 4.82509519578583E+01 -3.11371313723088E+02 5.02392535493845E+01 -2.85991470535089E+02 5.52428200738494E+01 -2.64473097014548E+02 6.02593807561679E+01 -2.46177718199911E+02 6.52698771847913E+01 -2.30345338068543E+02 7.02783866747736E+01 -2.16656593558811E+02 7.52745807406005E+01 -2.04478984079467E+02 8.02642735215022E+01 -1.93736962345888E+02 8.52607479669191E+01 -1.84016028908552E+02 9.02563135347960E+01 -1.75345276735820E+02 9.52494181048757E+01 -1.67462461833253E+02 1.00238329980190E+02 -1.53694422681765E+02 1.10215095998946E+02 -1.42067762519612E+02 1.20191489312268E+02 -1.32096005964589E+02 1.30190187440918E+02 -1.23479621030902E+02 1.40184818984845E+02 -1.15927821048394E+02 1.50179680073915E+02 -1.09282550856541E+02 1.60176584626478E+02 -1.03366771937276E+02 1.70169786231164E+02 -9.80907149025608E+01 1.80166121128079E+02 -9.33579550609513E+01 1.90167021816104E+02 -8.90492654370556E+01 2.00161493488610E+02 -8.51830350960010E+01 2.10158077481660E+02 -8.16514117424743E+01 2.20146267834828E+02 -7.84143472043939E+01 2.30159591256515E+02 -7.54485891468822E+01 2.40160534820618E+02 -7.27232779428802E+01 2.50145571645409E+02 -7.02094719234167E+01 2.60166495245123E+02 -6.78964625253723E+01 2.70153862870138E+02 -6.57328545738547E+01 2.80165094239621E+02 -6.37486942680804E+01 2.90153362928818E+02 -6.18860368536458E+01 3.00161984068307E+02 -6.01620283716467E+01 3.10077429820713E+02 -5.93259450809037E+01 3.15121778786237E+02 -5.85314099640211E+01 3.20129769977735E+02 -5.76085259564935E+01 3.26124000571498E+02 -5.70105489705977E+01 3.30115798315728E+02 diff --git a/tecs/inp/x15445.inp b/tecs/inp/x15445.inp deleted file mode 100644 index 9cbb21f..0000000 --- a/tecs/inp/x15445.inp +++ /dev/null @@ -1,91 +0,0 @@ -sens=x15445 ! S/N of sensor -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted) -!excit=1mV ! (off,30nA,100nA,300nA,1uA,3uA,10uA,30uA,100uA,300uA,1mA,10mV,1mV) (if omitted: default from sensor type) -!rang=0 ! range in sensor units (if rang=0: determine range from table, if omitted: default from sensor type) -curv ! R Ohm vs temp K taken CX105_X15445.DAT -1.03663692195452E+05 1.19922708241133E+00 -7.82929444598166E+04 1.29967827955901E+00 -6.07351984750061E+04 1.40260681202042E+00 -3.96062998267336E+04 1.61119714230585E+00 -2.87905530415879E+04 1.80372204472195E+00 -2.18629287361491E+04 2.00220629287984E+00 -1.73214596624174E+04 2.19907467265660E+00 -1.40290093024266E+04 2.40557354874123E+00 -1.18138083223071E+04 2.59779931792367E+00 -1.00673009204172E+04 2.80035677250285E+00 -8.73030568702768E+03 3.00316707753526E+00 -7.68811708155114E+03 3.20444385854971E+00 -6.85852994379416E+03 3.40387573963729E+00 -6.16951650668095E+03 3.60675593440543E+00 -5.62871999332660E+03 3.79796434456449E+00 -5.15518902555382E+03 3.99664717738620E+00 -4.73377323417849E+03 4.20442601784734E+00 -4.07491374476177E+03 4.61300769171663E+00 -3.58682218230114E+03 5.01286521310086E+00 -3.11375249112620E+03 5.51819357871921E+00 -2.63377261353502E+03 6.22418581699209E+00 -2.24288344490988E+03 7.02876017197527E+00 -1.89872473655448E+03 8.03607620157180E+00 -1.65119449479425E+03 9.04642125378179E+00 -1.46430968930560E+03 1.00556747968435E+01 -1.31872975081188E+03 1.10678142140491E+01 -1.20222027391186E+03 1.20727208581205E+01 -1.10652680914153E+03 1.30762219701199E+01 -1.02643987348072E+03 1.40752553682745E+01 -9.58289649414924E+02 1.50723200769265E+01 -8.99567850604689E+02 1.60663838599566E+01 -8.48273102719687E+02 1.70615918075026E+01 -8.03022326746988E+02 1.80557117632900E+01 -7.62700602137405E+02 1.90503435105753E+01 -7.26457322386649E+02 2.00464287113723E+01 -6.90802185406359E+02 2.11412082603040E+01 -6.45312859178365E+02 2.27314549957707E+01 -6.05841088000000E+02 2.43181957214012E+01 -5.69768929398171E+02 2.59653135702073E+01 -5.37201957072777E+02 2.76654664480374E+01 -5.08789616254156E+02 2.93351433139853E+01 -4.80704571750379E+02 3.11936380631194E+01 -4.52225144997964E+02 3.33288477948113E+01 -4.17622900363636E+02 3.63385022625123E+01 -3.88390801935371E+02 3.93220119994832E+01 -3.63370825739839E+02 4.22867559099253E+01 -3.41408852367983E+02 4.52647191466272E+01 -3.22004390688539E+02 4.82516736291202E+01 -3.10353754348958E+02 5.02393831202895E+01 -2.84585541150920E+02 5.52423794654486E+01 -2.62925682660567E+02 6.02604374534293E+01 -2.44502328145254E+02 6.52699594457839E+01 -2.28673177009879E+02 7.02802849324032E+01 -2.14850549747176E+02 7.52751439939228E+01 -2.02669670592098E+02 8.02655767573252E+01 -1.91843143511064E+02 8.52605866818749E+01 -1.82240574279286E+02 9.02575230820226E+01 -1.73509178707173E+02 9.52481989907832E+01 -1.65633512937257E+02 1.00239289510384E+02 -1.51913139058852E+02 1.10216010229743E+02 -1.40369221866166E+02 1.20191844011587E+02 -1.30454431928350E+02 1.30190596592163E+02 -1.21902893400545E+02 1.40185967488261E+02 -1.14427391306593E+02 1.50180736146581E+02 -1.07841715774667E+02 1.60177181332337E+02 -1.01973240130900E+02 1.70170573127481E+02 -9.67555286609950E+01 1.80166550641501E+02 -9.20634113629487E+01 1.90167814889348E+02 -8.78162976663831E+01 2.00161352186883E+02 -8.39774121618173E+01 2.10158715110274E+02 -8.04898236151079E+01 2.20148052884611E+02 -7.72984591281453E+01 2.30161425121644E+02 -7.43689257672993E+01 2.40161150062930E+02 -7.16792733556359E+01 2.50147951158957E+02 -6.92083075151281E+01 2.60166871938729E+02 -6.69102950743997E+01 2.70155334049860E+02 -6.47871629954459E+01 2.80162754990848E+02 -6.28241384839240E+01 2.90155687566990E+02 -6.09833559273582E+01 3.00159097604503E+02 -5.92841872681297E+01 3.10081971433725E+02 -5.84676060296350E+01 3.15125593820288E+02 -5.76769907896074E+01 3.20126803713554E+02 -5.67711054409776E+01 3.26125116617214E+02 -5.61835477156447E+01 3.30116348398798E+02 diff --git a/tecs/inp/x15601.inp b/tecs/inp/x15601.inp deleted file mode 100644 index eadd4c8..0000000 --- a/tecs/inp/x15601.inp +++ /dev/null @@ -1,92 +0,0 @@ -sens=x15601 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=Cernox ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted) -!excit=30uA ! (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 -13604.48856 1.20333653 -11665.64228 1.305934489 -10183.15218 1.408226731 -8087.603889 1.613824203 -6827.337287 1.797387439 -5839.358443 1.997115842 -5108.869366 2.195938254 -4522.777879 2.403898387 -4098.673363 2.595145218 -3720.440689 2.804801632 -3426.548233 3.002637615 -3172.142385 3.207165732 -2957.568114 3.410672617 -2786.502821 3.597047831 -2617.049237 3.809513862 -2480.524581 4.005539327 -2349.48735 4.216695852 -2147.062928 4.607323711 -1981.010544 4.995333731 -1807.765227 5.490941893 -1614.41075 6.197303618 -1442.842896 7.008253227 -1282.513024 8.009234903 -1158.51687 9.015276621 -1059.514129 10.02189812 -978.9929281 11.02239089 -911.3697047 12.02302081 -853.7041695 13.02573401 -804.1425469 14.02120649 -760.678927 15.02431191 -722.2727909 16.02142117 -687.9529241 17.01647479 -657.2331197 18.01294873 -629.1885823 19.01058983 -603.8472402 20.00647611 -578.3107733 21.10560491 -545.1511899 22.70233974 -515.7878041 24.29811828 -485.1881724 26.18595303 -462.4867018 27.75735284 -441.5310886 29.34718904 -422.9697905 30.90601805 -400.3383064 32.99931665 -371.0810041 36.11659889 -347.1102132 39.07861488 -325.926885 42.06094461 -306.633104 45.1643442 -290.8022656 48.02870658 -280.7987365 50.00903686 -255.2424351 55.80283614 -237.9410059 60.44038422 -221.974431 65.3859753 -207.5414614 70.51725494 -195.3814327 75.46793868 -184.462935 80.44899073 -174.85362 85.37089566 -165.9814568 90.41368923 -158.0874721 95.35853726 -150.9531904 100.2997285 -138.5925202 110.0320374 -127.3457082 120.5214065 -118.3855018 130.300157 -110.6221255 140.0255777 -103.6354754 150.0334193 -97.48505862 160.0311561 -92.01812421 170.0349327 -87.16707108 180.0358242 -82.79937075 190.03318 -78.87480219 200.0258735 -75.30320773 210.0410303 -72.08480453 220.0638022 -69.14450743 230.0603278 -66.45718355 240.0582532 -63.99049624 250.0593421 -61.7157779 260.0571313 -59.62625857 270.0603652 -57.69355583 280.0563142 -55.91116052 290.0570078 -54.24715549 300.0543043 -52.70434938 310.042649 -51.97398136 315.0441578 -51.26971605 320.0519038 -50.49959985 325.7129911 -50.13643343 328.4507039 - diff --git a/tecs/inp/x17627.inp b/tecs/inp/x17627.inp deleted file mode 100644 index 494e789..0000000 --- a/tecs/inp/x17627.inp +++ /dev/null @@ -1,59 +0,0 @@ -sens=x17627 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! 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=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 -35.5745979 325 -35.64921737 324 -36.83155035 309 -38.14081773 294 -39.59588005 279 -41.21734373 264 -43.03283913 249 -45.07544262 234 -47.38381238 219 -50.00921069 204 -53.01759216 189 -56.49239668 174 -60.54245115 159 -65.31606311 144 -71.01825549 129 -77.95428634 114 -86.59244451 99 -97.69897334 84 -112.621161 69 -125.1670452 59.5 -141.4881278 50 -152.2684756 45 -165.1657524 40 -180.929757 35 -200.7150787 30 -221.8400733 25.8 -245.4821962 22.1 -271.6376721 18.9 -299.9576897 16.2 -331.0548845 13.9 -366.2013998 11.9 -402.7263073 10.3 -444.1707955 8.9 -490.5575905 7.7 -541.1030726 6.7 -593.4580155 5.9 -652.4842006 5.2 -717.7777636 4.6 -787.6621925 4.1 -858.3412811 3.7 -948.0691174 3.3 -1033.213329 3 -1140.328556 2.7 -1228.655135 2.5 -1335.580286 2.3 -1467.87813 2.1 -1546.678327 2 -1739.40214 1.8 -2169.002237 1.5 -2372.684537 1.4 -3360.000000 1.0 - diff --git a/tecs/inp/x2060.inp b/tecs/inp/x2060.inp deleted file mode 100644 index 1198474..0000000 --- a/tecs/inp/x2060.inp +++ /dev/null @@ -1,91 +0,0 @@ -sens=x2060 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=Cernox ! 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 -68000 1.0 -44881.28899 1.2 -36817.49567 1.309 -31135.18899 1.403 -21987.20345 1.604 -16114.99662 1.8 -12258.05661 1.996 -9918.666931 2.168 -7915.149596 2.385 -6521.88091 2.604 -5617.346366 2.796 -4894.762604 3 -4329.19174 3.206 -3898.635478 3.402 -3541.829 3.6 -3258.390355 3.79 -2984.005729 4.008 -2766.634389 4.208 -2446.004452 4.583 -2155.218862 5.037 -1900.670937 5.555 -1642.521599 6.262 -1428.551021 7.074 -1234.644114 8.097 -1092.227708 9.12 -980.9691976 10.168 -894.9346698 11.189 -825.2867872 12.198 -767.6953785 13.194 -719.0106414 14.182 -677.2773451 15.159 -640.4098623 16.138 -608.3465142 17.103 -579.6429399 18.071 -553.709856 19.038 -529.6610169 20.026 -506.2778453 21.091 -474.856356 22.692 -448.7524681 24.208 -424.6284501 25.792 -402.9983074 27.367 -383.0390317 29.007 -363.2532965 30.805 -342.3719529 32.938 -320.7389826 35.453 -295.3162837 38.904 -276.640478 41.85 -260.0577328 44.825 -245.1701481 47.852 -236.2055933 49.856 -216.3050767 54.918 -199.7722596 59.894 -185.5735149 64.889 -173.2922053 69.877 -162.4378675 74.916 -153.0620054 79.837 -144.6319839 84.804 -137.0163323 89.804 -127.6014751 96.795 -120.8444611 102.471 -109.8273514 113.175 -103.8928657 119.86 -96.20883586 129.725 -89.42109592 139.773 -83.5152527 149.804 -78.34370646 159.81 -73.77685637 169.797 -69.71875787 179.768 -66.09775467 189.689 -62.84505418 199.59 -59.90371916 209.464 -57.26569688 219.289 -54.85259174 229.086 -52.65354288 238.856 -50.64578201 248.587 -48.80362619 258.316 -47.10439353 268.003 -45.54155793 277.656 -44.10190663 287.254 -42.75989139 296.854 -41.52116147 306.381 -40.92174382 311.132 -40.35810065 315.861 -39.70434603 321.478 -39.27574259 325.239 - diff --git a/tecs/inp/x22637.inp b/tecs/inp/x22637.inp deleted file mode 100644 index d5e8ff5..0000000 --- a/tecs/inp/x22637.inp +++ /dev/null @@ -1,92 +0,0 @@ -sens=x22637 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! 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=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 -18271.2735 1.201775141 -15018.14259 1.300003299 -12605.42404 1.40085118 -9394.553378 1.601518556 -7401.753356 1.800588297 -6063.804617 2.00089626 -5127.39976 2.199746754 -4427.569053 2.40054614 -3896.293416 2.600827287 -3476.895591 2.801647183 -3146.876058 2.998488632 -2870.170528 3.198498904 -2641.391928 3.39935432 -2445.764126 3.60131308 -2283.079332 3.799687432 -2141.048458 3.999064872 -2018.06725 4.197064807 -1800.707637 4.623543342 -1636.78931 5.031690261 -1474.576811 5.541711582 -1301.169012 6.258624854 -1154.402875 7.074764656 -1018.703818 8.09763414 -916.5851289 9.125836635 -836.9551696 10.15287494 -773.2778002 11.17256297 -721.0656387 12.18348114 -677.3611143 13.18806219 -639.9091774 14.18633821 -607.5672194 15.17619408 -579.1056183 16.1599519 -553.8568077 17.13925751 -531.171311 18.11776676 -510.5787006 19.09728447 -491.8443726 20.07569906 -472.9042854 21.157037 -448.191885 22.7335822 -425.987672 24.33191482 -406.1050945 25.93328988 -387.2413051 27.62506921 -370.6239395 29.27045936 -354.2813013 31.06318005 -336.7642427 33.19925181 -314.7227201 36.23889705 -296.0544997 39.22649748 -279.4366367 42.22265752 -264.8321789 45.2110573 -251.684706 48.20360607 -243.8031803 50.17443204 -225.8049714 55.20840321 -210.5182225 60.20668174 -197.2789371 65.20244007 -185.6830724 70.19302182 -175.4146329 75.18086928 -166.2653967 80.17471307 -158.0776999 85.16716708 -150.6335412 90.16538024 -143.9156408 95.15676739 -137.7605299 100.1549775 -126.9241599 110.1368995 -117.6652736 120.1389241 -109.6987039 130.1331501 -102.7274906 140.127387 -96.59503167 150.125788 -91.16813593 160.1192973 -86.31446102 170.1184308 -81.96220962 180.1316335 -78.04036796 190.1287944 -74.49414632 200.1308997 -71.25876685 210.1378263 -68.32457177 220.1329382 -65.63171779 230.1298374 -63.15928982 240.1293974 -60.88298571 250.116388 -58.78101015 260.122836 -56.8332323 270.1157907 -55.02981573 280.1134787 -53.37177817 289.993198 -51.80786848 299.9964879 -50.3335795 310.0947302 -49.64399515 315.085561 -48.97316762 320.1072636 -48.19629135 326.0931932 -47.70969706 329.9594996 - diff --git a/tecs/inp/x22642.inp b/tecs/inp/x22642.inp deleted file mode 100644 index b3cfdcf..0000000 --- a/tecs/inp/x22642.inp +++ /dev/null @@ -1,93 +0,0 @@ -sens=x22642 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! 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=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 -20949.3626 1.200558176 -17142.9063 1.2990458 -14325.67427 1.400094323 -10628.7221 1.600354686 -8328.213609 1.800458762 -6803.546799 1.999945639 -5731.873767 2.199864218 -4940.65276 2.399949312 -4330.984543 2.60132227 -3857.40887 2.802170737 -3486.514394 2.997921455 -3174.010868 3.198500507 -2915.081847 3.400102792 -2697.195239 3.601991996 -2512.764348 3.800901174 -2354.201594 3.999362758 -2216.399445 4.196865673 -1973.304717 4.622532516 -1789.847086 5.03108069 -1608.625165 5.541186582 -1414.676805 6.258439055 -1250.941706 7.075924839 -1099.630157 8.097559324 -986.1149219 9.126078494 -897.8271964 10.15106462 -826.9951282 11.17243575 -769.1549568 12.18421334 -720.7324382 13.18825545 -679.3908307 14.1861226 -643.5388053 15.17988834 -612.4155154 16.16082752 -584.6004467 17.14417399 -559.9074202 18.11842752 -537.3817655 19.09741076 -516.9993187 20.07483115 -496.4660843 21.15487823 -469.6512201 22.73421312 -445.6652682 24.33113366 -423.4131996 26.00318866 -404.1492243 27.62373651 -386.4991902 29.26893058 -368.5293039 31.12888947 -350.1577143 33.25121425 -327.4963929 36.23847414 -307.7740796 39.24203196 -290.7398659 42.2251891 -275.476593 45.24235575 -262.0314365 48.22151844 -253.8891827 50.20924761 -235.6492828 55.19975706 -220.053175 60.2093487 -206.6650459 65.20248926 -194.9585829 70.19514644 -184.611347 75.18110487 -175.4292709 80.17496236 -167.1949548 85.16653408 -159.742773 90.16306236 -152.9686861 95.15643799 -146.8111269 100.1546576 -135.9501515 110.136391 -126.6734872 120.1372263 -118.6582154 130.1321856 -111.6603199 140.125834 -105.4683055 150.1240735 -99.96697679 160.1175167 -95.05353372 170.1170899 -90.62527887 180.1296282 -86.63311615 190.1270962 -83.00203888 200.1288058 -79.69253549 210.1356682 -76.6622933 220.1314841 -73.88857675 230.1278107 -71.33370241 240.1289393 -68.9747872 250.114868 -66.78673913 260.1221042 -64.76193431 270.1158305 -62.86547048 280.1133864 -61.12969734 289.9883915 -59.48791478 299.9920827 -57.93529154 310.0938564 -57.20329528 315.0859786 -56.49582879 320.1068376 -55.68098623 326.0911299 -55.16772341 329.9601461 - - diff --git a/tecs/inp/x22643.inp b/tecs/inp/x22643.inp deleted file mode 100644 index 6810be6..0000000 --- a/tecs/inp/x22643.inp +++ /dev/null @@ -1,90 +0,0 @@ -sens=x22643 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=Cernox ! 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 -40697.08045 1.200383665 -32366.30601 1.2988459 -26383.16465 1.399640145 -18764.54287 1.600069469 -14218.36962 1.80050257 -11309.71813 1.999921521 -9310.413119 2.199675427 -7872.095589 2.400568686 -6795.33757 2.600953457 -5962.609252 2.802593743 -5323.474481 2.998229728 -4794.331253 3.198505442 -4357.913367 3.399830909 -3994.078516 3.602332232 -3691.652802 3.800667475 -3432.841672 3.998683453 -3209.821742 4.197187559 -2822.23232 4.621843846 -2532.594291 5.030985671 -2250.53672 5.540687851 -1953.269749 6.258439883 -1705.721848 7.075941677 -1481.133789 8.098835821 -1314.245602 9.126648666 -1186.533955 10.14986572 -1084.981688 11.17301858 -1002.603853 12.18417435 -934.1416119 13.19101128 -876.3895136 14.18585788 -826.5482802 15.17706002 -783.2998658 16.16022176 -744.9464033 17.14217167 -710.9439736 18.11800801 -680.1821007 19.09720393 -652.3914442 20.0747849 -624.5349218 21.15438192 -588.3443957 22.73386551 -556.1428977 24.33193314 -526.4145806 26.002926 -500.7972046 27.62437142 -477.360904 29.26865318 -453.6405139 31.12609073 -429.5001282 33.25137513 -399.9196226 36.23897961 -374.7006974 39.19177939 -352.1673551 42.22483594 -332.4688788 45.24107441 -315.216519 48.22703392 -304.713183 50.21675469 -281.5005622 55.19829595 -261.7370771 60.20969768 -244.85282 65.20275807 -230.1376412 70.19558102 -217.2143738 75.18138801 -205.731756 80.17372851 -195.465736 85.16757871 -186.2543223 90.16260766 -177.9088112 95.15600235 -170.3011786 100.1545625 -157.0005871 110.136432 -145.6465035 120.1369457 -135.8938165 130.1311705 -127.4100026 140.1258235 -119.9448724 150.1232762 -113.3502458 160.1168189 -107.4521231 170.1169615 -102.1569958 180.1293003 -97.39647105 190.1276327 -93.09014666 200.127944 -89.15387509 210.1342407 -85.58302245 220.1308113 -82.30165038 230.127 -79.28757604 240.1281036 -76.51133626 250.1159095 -73.93968659 260.1207012 -71.56220586 270.1135658 -69.34834911 280.1135234 -67.31986072 289.989674 -65.400923 299.9941845 -63.58838316 310.0938826 -62.73896639 315.0851786 -61.91140488 320.1069728 -60.95482497 326.0894131 -60.35592944 329.9615505 - diff --git a/tecs/inp/x22644.inp b/tecs/inp/x22644.inp deleted file mode 100644 index 275db6d..0000000 --- a/tecs/inp/x22644.inp +++ /dev/null @@ -1,91 +0,0 @@ -sens=x22644k -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! 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=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 -15490.92284 1.200721786 -12954.34936 1.298891069 -11076.20151 1.39943304 -8520.068684 1.599937175 -6861.930851 1.800442288 -5720.174664 2.00019607 -4893.450319 2.199969718 -4267.228514 2.400603038 -3782.811454 2.600633851 -3392.064692 2.802896079 -3088.314838 2.998094443 -2829.143213 3.198715722 -2612.128987 3.399484728 -2426.727308 3.602485184 -2270.720446 3.800490872 -2135.786463 3.998439887 -2016.497011 4.197156641 -1806.950796 4.621681363 -1647.078313 5.030523733 -1488.052584 5.540281439 -1316.419467 6.25898771 -1170.596974 7.076289652 -1035.166504 8.098257051 -932.58957 9.126725378 -852.5687804 10.14989046 -787.9348812 11.1730348 -735.021783 12.18383727 -690.2662946 13.19332605 -652.4786656 14.18572326 -619.4583612 15.17662749 -590.5019897 16.16073706 -564.7767246 17.14074973 -541.6403519 18.11815111 -520.7037071 19.09726974 -501.6387006 20.07459081 -482.4285499 21.15478955 -457.2366045 22.73367042 -434.7225473 24.3324661 -413.7720569 26.00456745 -395.5849007 27.6242651 -378.8673435 29.26937996 -361.8337601 31.1270676 -344.3419371 33.25128091 -322.7895815 36.23921994 -304.3358536 39.19190152 -287.5609455 42.22413357 -272.9208287 45.23979471 -260.0010408 48.23143543 -252.1127299 50.22289595 -234.5726345 55.19735291 -219.515172 60.20938313 -206.5074101 65.20351886 -195.1473491 70.19674071 -185.0886532 75.18080073 -176.0899553 80.17225392 -168.0303614 85.16939558 -160.7208948 90.16147891 -154.1269009 95.15586553 -148.0544602 100.1540934 -137.4049343 110.1362537 -128.24325 120.1370202 -120.3276383 130.13073 -113.3847137 140.1252385 -107.2580994 150.1234354 -101.7952486 160.1165839 -96.90661397 170.1168663 -92.49554787 180.1290119 -88.51495284 190.1274068 -84.89564499 200.1278156 -81.58162485 210.1345051 -78.55077213 220.1302898 -75.7862976 230.1260865 -73.21691146 240.1285934 -70.85353186 250.1146862 -68.6579939 260.1210378 -66.6252623 270.1122296 -64.72753475 280.1125128 -62.9861357 289.9881766 -61.34094329 299.992933 -59.78554947 310.0918565 -59.04516028 315.0849843 -58.33273711 320.106081 -57.5088645 326.0894698 -56.9937258 329.9611435 diff --git a/tecs/inp/x23167.inp b/tecs/inp/x23167.inp deleted file mode 100644 index 2679a43..0000000 --- a/tecs/inp/x23167.inp +++ /dev/null @@ -1,93 +0,0 @@ -sens=x23167 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! 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=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 -13256 1.2667 -12339.6 1.3079 -10612.8 1.39837 -7934.84 1.60472 -6312.15 1.80457 -5224.59 2.00258 -4433.62 2.2052 -3863.64 2.40137 -3426.28 2.59562 -3067.44 2.79823 -2778.05 3.00127 -2541.71 3.20258 -2346.56 3.40243 -2184.08 3.59835 -2042.33 3.79824 -1918.02 4.00071 -1813.42 4.19502 -1694.48 4.45245 -1537 4.86219 -1381.08 5.37833 -1215.82 6.10426 -1077.33 6.92914 -950.998 7.9563 -856.643 8.98452 -783.22 10.0107 -724.578 11.0289 -676.273 12.0438 -635.753 13.0532 -601.137 14.0575 -571.214 15.0536 -544.709 16.0521 -521.305 17.0418 -500.196 18.0334 -481.084 19.0239 -463.678 20.0156 -446.061 21.113 -423.091 22.7127 -402.738 24.3079 -384.836 25.8768 -368.433 27.4697 -353.481 29.0617 -338.199 30.8555 -322.143 32.9398 -301.914 35.9259 -284.313 38.9125 -268.731 41.9037 -254.904 44.8993 -242.513 47.8951 -234.929 49.9002 -218.03 54.9006 -203.575 59.8998 -191.007 64.8988 -179.981 69.9006 -170.203 74.9064 -161.499 79.9104 -153.673 84.9088 -146.601 89.9149 -140.162 94.9156 -134.278 99.9209 -123.944 109.916 -115.077 119.911 -107.406 129.936 -100.731 139.921 -94.837 149.926 -89.5989 159.934 -84.9318 169.936 -80.7333 179.94 -76.9532 189.936 -73.4975 200.03 -70.4028 209.958 -67.5519 219.963 -64.9471 229.952 -62.5757 239.834 -60.3399 249.974 -58.2975 259.981 -56.4271 269.906 -54.6748 279.898 -53.0525 289.876 -51.5345 299.863 -50.1175 309.88 -49.465 314.737 -48.6236 321.219 -47.6911 328.739 -47.0917 333.74 - - diff --git a/tecs/inp/x24506.inp b/tecs/inp/x24506.inp deleted file mode 100644 index a1f9161..0000000 --- a/tecs/inp/x24506.inp +++ /dev/null @@ -1,92 +0,0 @@ -sens=x24506 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! 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=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 -19268.81299 1.203132044 -15988.04386 1.303857052 -13566.54215 1.402030678 -10243.19932 1.601888887 -8134.292037 1.803798062 -6746.85603 1.999044471 -5702.253839 2.205960091 -4983.821262 2.397173365 -4403.141857 2.595654544 -3927.751689 2.8016119 -3559.813757 2.999462194 -3262.793275 3.194307942 -2994.957662 3.403767784 -2781.772177 3.60147407 -2599.977578 3.797968133 -2434.783052 4.003600074 -2300.250245 4.194131586 -2049.480323 4.628205525 -1860.226486 5.039219527 -1688.994948 5.503198119 -1489.501802 6.19708145 -1331.975694 6.915892862 -1165.987553 7.926817183 -1041.245148 8.938735462 -944.0649791 9.947593381 -866.0653267 10.94840287 -801.7814871 11.94882804 -747.4756795 12.94795075 -701.1868301 13.94712368 -661.0722017 14.94301187 -625.7591056 15.9426341 -594.4989405 16.93930437 -566.5092705 17.93828753 -541.2722135 18.93904446 -518.3207266 19.94215642 -495.3646603 21.0537636 -465.5788563 22.67392604 -439.2508664 24.30347965 -416.3304337 25.9065248 -395.9496162 27.50607791 -377.6984907 29.09411524 -359.2355844 30.8775603 -340.081641 32.94894203 -316.0619719 35.92019875 -295.47926 38.89758748 -277.4319333 41.89049517 -261.4512412 44.90209998 -247.3730123 47.92599291 -238.7112077 49.95521855 -219.8294133 55.01767396 -203.767392 60.11225849 -190.3283808 65.10837357 -178.5337098 70.13699411 -168.2447998 75.16468223 -159.131346 80.1789729 -151.0552683 85.18924189 -143.7333266 90.19958571 -137.1671351 95.20842634 -131.1872847 100.2149656 -120.7557448 110.2089779 -111.926522 120.1979462 -104.3242104 130.2076795 -97.75251312 140.1804214 -91.9832616 150.1599848 -86.89677329 160.1476145 -82.35212364 170.1262403 -78.29519329 180.1139973 -74.65337852 190.0908422 -71.35636785 200.0908858 -68.35265459 210.0774018 -65.62382183 220.0825998 -63.1274985 230.0704903 -60.84286108 240.0905455 -58.73780843 250.0935493 -56.79306615 260.0989924 -54.99712606 270.1077013 -53.34068806 280.0892052 -51.79011752 290.1195942 -50.36440152 300.043781 -49.027488 310.035648 -48.39763591 314.9962369 -47.6297072 321.2613963 -46.74933639 328.7765688 -46.18820427 333.7714114 - diff --git a/tecs/inp/x29630.inp b/tecs/inp/x29630.inp deleted file mode 100644 index 2f9e530..0000000 --- a/tecs/inp/x29630.inp +++ /dev/null @@ -1,54 +0,0 @@ -sens=x29630 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! 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=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 -48169.55684 1.4156 -39885.13082 1.5093 -33567.18472 1.6042 -18364.12385 2.025 -12342.47911 2.4072 -8837.044892 2.8225 -6892.748828 3.2075 -5551.237926 3.6128 -4511.413877 4.0785 -4292.582418 4.2035 -3718.163227 4.5988 -2896.451846 5.4278 -2394.808056 6.2113 -2036.162241 7.0161 -1689.6744 8.1367 -1470.891066 9.1364 -1295.118698 10.2046 -1167.106277 11.2029 -986.8745682 13.092 -917.2628875 14.0398 -797.0667942 16.1077 -708.1149979 18.1232 -638.1213707 20.1642 -572.8689276 22.5405 -516.7157547 25.102 -473.3055661 27.5305 -434.3482604 30.1509 -403.209548 32.6337 -377.515195 35.0112 -329.2506256 40.5518 -268.6438857 50.546 -227.6556026 60.5653 -198.3103954 70.4865 -174.8129501 81.0062 -158.1702861 90.4686 -143.4637897 100.7613 -117.0960187 126.0159 -99.40357853 150.7981 -86.65511265 175.2525 -76.27183281 201.6172 -68.46032724 227.2484 -62.66842138 250.8951 -58.17674094 273.0018 -58.08212813 273.5107 -53.61355351 300.0167 -49 330 - diff --git a/tecs/inp/x29746.inp b/tecs/inp/x29746.inp deleted file mode 100644 index 7537ae2..0000000 --- a/tecs/inp/x29746.inp +++ /dev/null @@ -1,55 +0,0 @@ -sens=x29746 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! 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=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 -49333.99112 1.4116 -40387.72213 1.5146 -34106.41201 1.6114 -19665.68338 2.0075 -13089.00524 2.4137 -9648.784253 2.8112 -7540.340823 3.2138 -6185.056903 3.6051 -5157.829585 4.0308 -4828.585225 4.2045 -4206.629648 4.6054 -3333.444448 5.4221 -2771.772271 6.2256 -2352.775098 7.0895 -2020.773552 8.0461 -1766.784452 9.0416 -1561.889887 10.1022 -1409.284365 11.112 -1193.773279 13.0209 -1100.352113 14.1043 -963.5767971 16.1061 -860.437102 18.0749 -776.8800497 20.0802 -696.4273278 22.4982 -628.8912647 25.0358 -574.5343399 27.5292 -529.1929279 30.0186 -490.2369315 32.5414 -457.1533064 35.0344 -401.8032932 40.1605 -324.0503704 50.4402 -273.4616415 60.4027 -236.7071199 70.4182 -210.2098946 79.8848 -187.6771203 90.0922 -169.5349149 100.3197 -136.4565509 126.0394 -114.9441142 150.7499 -99.12060202 175.8608 -87.23339294 200.8987 -78.00312012 225.9038 -70.09231157 253.0469 -65.28864108 273.1334 -65.2239137 273.4244 -59.74857798 300.9599 -54.5 330 - - diff --git a/tecs/inp/x31254.inp b/tecs/inp/x31254.inp deleted file mode 100644 index aa4d401..0000000 --- a/tecs/inp/x31254.inp +++ /dev/null @@ -1,88 +0,0 @@ -sens=x31254 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -type=Cernox ! 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 -52347.11499 1.209999291 -42271.82728 1.30181012 -35185.81163 1.391206683 -24457.13878 1.603713185 -18634.59743 1.801228992 -14728.00679 2.005946839 -12170.87795 2.200918388 -10323.55353 2.394086422 -8866.282769 2.598839433 -7780.734748 2.797896739 -6945.471525 2.99104283 -6259.560038 3.187196075 -5660.111445 3.396607069 -5184.653488 3.596583563 -4761.864024 3.807950828 -4431.482698 4.001245348 -4116.444266 4.214711767 -3859.296011 4.418476535 -3424.959981 4.830595781 -3006.125698 5.350731526 -2571.075199 6.083930567 -2216.474077 6.914999071 -1901.60927 7.947469564 -1671.428165 8.985353543 -1495.691975 10.02431926 -1358.335177 11.04995526 -1246.779832 12.0689424 -1154.608581 13.08005493 -1076.886162 14.08475097 -1010.562768 15.07982915 -952.7152338 16.07575904 -902.0417435 17.0630006 -856.8631492 18.05229681 -816.4195908 19.04057786 -779.7421237 20.02710193 -743.1649234 21.12206865 -695.739151 22.7181486 -654.2089136 24.31993581 -617.6629647 25.92154758 -584.8117234 27.54013387 -555.348725 29.15933421 -525.8750985 30.96666619 -495.4990377 33.06225035 -457.9256098 36.05607535 -425.8173983 39.04464177 -398.0726057 42.03406128 -373.8206374 45.02461512 -352.3791581 48.01746595 -339.3680963 50.01933837 -310.896345 55.01431022 -286.9674979 60.01022035 -266.5912722 65.00764183 -248.924222 70.00936406 -233.524196 75.01602078 -219.9661819 80.01539475 -207.9129974 85.01097718 -197.1500267 90.01414022 -187.4488393 95.01052134 -178.672813 100.0097913 -163.2602032 110.093534 -150.5589056 119.9896691 -139.5949517 130.0131237 -130.1269767 139.9943891 -121.8684469 149.9901986 -114.610524 159.9908725 -108.1779125 169.9798973 -102.4573322 179.9742653 -97.33483438 189.9604564 -92.70819751 199.9652726 -88.52790337 209.964409 -84.74072667 219.9603524 -81.28151655 229.946308 -78.10992665 239.9592886 -75.20995643 249.9549619 -72.53536869 259.9550268 -70.07430293 269.9541612 -67.79773092 279.932554 -65.68546584 289.9492522 -63.74325054 299.8635787 -61.91925396 309.8417766 -61.05986271 314.7929166 -60.01513245 321.0655121 -58.8228076 328.5661356 -58.06224787 333.5550606 diff --git a/tecs/inp/x31317.inp b/tecs/inp/x31317.inp deleted file mode 100644 index caa2cf4..0000000 --- a/tecs/inp/x31317.inp +++ /dev/null @@ -1,88 +0,0 @@ -sens=x31317 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -type=Cernox ! 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 -82645.04651 1.199380518 -64126.00275 1.298983307 -51197.62425 1.399889713 -35263.77563 1.599540201 -26071.85628 1.797932254 -20118.18057 2.000494957 -16184.30878 2.199612368 -13417.51113 2.396242026 -11336.19482 2.597685984 -9769.236133 2.798075327 -8542.396095 2.999811154 -7577.740269 3.199405252 -6783.94807 3.401293259 -6134.21376 3.60175609 -5595.138081 3.799990474 -5135.595311 3.999180846 -4722.036217 4.209088273 -4356.418748 4.428235084 -3796.164938 4.838048719 -3259.105741 5.357779456 -2713.664592 6.092663717 -2278.316934 6.925028047 -1901.991682 7.956841317 -1633.666957 8.995301998 -1433.16295 10.03364726 -1279.198931 11.06286955 -1156.850467 12.08271225 -1057.711346 13.09383104 -975.50515 14.09917436 -906.596783 15.09314923 -847.2113197 16.09044568 -795.908983 17.07738271 -751.0174567 18.06444332 -711.0889145 19.0547303 -675.517752 20.04142352 -640.2913637 21.13482803 -595.5434204 22.7292068 -556.6423386 24.34286391 -522.4661562 25.97762332 -492.3172681 27.61724859 -465.9268054 29.25216279 -439.8213293 31.07297084 -413.3367955 33.17772797 -381.0835156 36.18239178 -353.9509338 39.17571067 -330.7912817 42.16657397 -310.7531539 45.15650283 -293.2348398 48.14493538 -282.5396344 50.14678658 -259.6461174 55.14071271 -240.4021871 60.13470811 -224.1399926 65.13058811 -210.1565506 70.12923843 -197.886053 75.13416903 -187.1786009 80.13334701 -177.6977592 85.12760009 -169.1654064 90.12489881 -161.5066917 95.12039842 -154.5680394 100.1094 -142.4110889 110.1959462 -132.3162883 120.0890848 -123.5403647 130.1085056 -115.978895 140.0869674 -109.3201532 150.0813152 -103.4273849 160.0791163 -98.21872475 170.0680089 -93.52573862 180.0600124 -89.31975297 190.0431993 -85.50532224 200.0455259 -82.03548657 210.0395283 -78.86033603 220.0375806 -75.97035375 230.0197551 -73.30910046 240.031542 -70.85269921 250.0256842 -68.58839825 260.0246538 -66.48302149 270.0214982 -64.53311922 279.9987828 -62.71281686 290.0170467 -61.03721363 299.9243403 -59.4596642 309.9000623 -58.71737263 314.854573 -57.79864904 321.1185813 -56.76395577 328.6205713 -56.10178078 333.6085882 diff --git a/tecs/inp/x31318.inp b/tecs/inp/x31318.inp deleted file mode 100644 index c027a24..0000000 --- a/tecs/inp/x31318.inp +++ /dev/null @@ -1,88 +0,0 @@ -sens=x31318 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -type=Cernox ! 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 -68901.47634 1.199185718 -54081.43382 1.301378052 -44005.8983 1.400855368 -31187.09197 1.600104575 -23697.51082 1.796223603 -18691.53476 1.998912916 -15098.13673 2.214764615 -12937.92316 2.394879788 -11104.32496 2.597481119 -9702.020108 2.799417332 -8571.764655 3.007900004 -7715.245921 3.204730142 -7031.171555 3.395432764 -6415.995354 3.600310422 -5919.918489 3.796294884 -5521.041358 3.979304182 -5061.977975 4.225638666 -4483.494755 4.611529181 -4008.941635 5.011672166 -3540.482956 5.517897684 -3048.232196 6.227571851 -2639.041604 7.034029338 -2267.062828 8.04634519 -1992.349055 9.063490939 -1781.077523 10.07962894 -1613.777322 11.09297079 -1477.714539 12.10127778 -1364.847951 13.10538917 -1269.40033 14.10586867 -1187.915923 15.10110419 -1116.842934 16.09644 -1054.406923 17.08897197 -998.9541992 18.08039699 -949.4166726 19.07003328 -904.6361826 20.06329727 -860.1500223 21.15779035 -803.3540132 22.74255345 -753.5774083 24.33493529 -707.5990554 26.00820405 -666.0030406 27.73113987 -629.7822557 29.41826033 -594.0696375 31.28900292 -557.8293186 33.43443556 -513.9414868 36.45280188 -476.9204972 39.44297129 -445.1743299 42.41080319 -417.3985464 45.38871698 -392.8015178 48.37451803 -378.0766669 50.36156313 -345.5000095 55.36269868 -318.0662466 60.37737512 -294.8204914 65.38853846 -274.8213431 70.39783353 -257.4057119 75.39383335 -242.0920638 80.38431773 -228.5592609 85.37796285 -216.4206187 90.36779573 -205.5124009 95.35751232 -195.6841096 100.3408723 -178.4243274 110.418124 -164.1832093 120.299264 -151.9310153 130.2957426 -141.3698714 140.2839856 -132.1704573 150.2704162 -124.0745392 160.2586005 -116.9306289 170.2448579 -110.5690206 180.2362745 -104.8731694 190.2324162 -99.73109029 200.2311703 -95.09898824 210.2236387 -90.88713924 220.2126668 -87.05478879 230.2263582 -83.55342163 240.230668 -80.3412173 250.2191886 -77.3826322 260.2320041 -74.66405151 270.217955 -72.14039561 280.2343633 -69.80262604 290.2226393 -67.62829511 300.2359035 -65.61243834 310.2333849 -64.65254205 315.2372397 -63.7257676 320.2384933 -62.65699711 326.2391757 -61.97081919 330.2296647 diff --git a/tecs/inp/x31319.inp b/tecs/inp/x31319.inp deleted file mode 100644 index f7e580d..0000000 --- a/tecs/inp/x31319.inp +++ /dev/null @@ -1,88 +0,0 @@ -sens=x31319 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -type=Cernox ! 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 -74612.85388 1.199177409 -58386.64483 1.301570868 -47328.18302 1.401206711 -33389.0605 1.600154454 -25251.51975 1.796271028 -19853.36353 1.998863704 -15981.8145 2.214728702 -13665.706 2.394652313 -11700.25482 2.597328594 -10204.96249 2.799452766 -8999.267151 3.008040376 -8088.007617 3.204904214 -7362.583739 3.395151541 -6710.552988 3.60021517 -6184.67101 3.796167475 -5763.34408 3.979268794 -5276.812602 4.225676067 -4667.424115 4.611364746 -4167.683873 5.011155404 -3674.774425 5.517561186 -3157.987056 6.227548652 -2729.915028 7.034245052 -2341.355814 8.046491772 -2054.717537 9.062851416 -1834.926721 10.07966189 -1660.652671 11.0923442 -1519.296938 12.10112585 -1401.938347 13.10508252 -1303.328587 14.10512148 -1218.753407 15.10217752 -1145.141221 16.09542672 -1080.513994 17.08885726 -1023.309896 18.08008347 -972.2475024 19.07019839 -925.9029508 20.06410171 -880.2406599 21.15634949 -821.4824985 22.74172478 -770.14506 24.33439044 -722.8942371 26.00827627 -680.0805518 27.7284403 -642.7703852 29.41766295 -606.0615251 31.28938151 -568.9244923 33.43505211 -523.8324484 36.4529057 -485.8292366 39.44344431 -453.2665031 42.41063217 -424.8057062 45.38852269 -399.6584609 48.37524014 -384.5766683 50.36139685 -351.2093935 55.3629944 -323.213084 60.37757918 -299.3923578 65.38969589 -279.0132967 70.39838662 -261.2082978 75.39322701 -245.6297306 80.38595885 -231.8122076 85.37788855 -219.4789035 90.36686926 -208.3645562 95.35916614 -198.3370301 100.3408302 -180.7734707 110.4173909 -166.3000853 120.2994698 -153.8525668 130.2950154 -143.0942507 140.2842564 -133.7598728 150.2699244 -125.5466639 160.2576112 -118.2904307 170.2441348 -111.8322938 180.2364885 -106.0430206 190.2335043 -100.8394115 200.2312462 -96.13350443 210.2240529 -91.8833451 220.2130353 -87.98821748 230.2262285 -84.42619095 240.2301713 -81.17492859 250.2168459 -78.17915716 260.2310834 -75.42211632 270.2179533 -72.86331817 280.232442 -70.49932305 290.2234447 -68.30021534 300.2353677 -66.26123623 310.2307031 -65.29062152 315.2350135 -64.35142033 320.2376337 -63.26816822 326.2381502 -62.57752995 330.2274114 diff --git a/tecs/inp/x31320.inp b/tecs/inp/x31320.inp deleted file mode 100644 index e78dac7..0000000 --- a/tecs/inp/x31320.inp +++ /dev/null @@ -1,88 +0,0 @@ -sens=x31320 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -type=Cernox ! 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 -47776.06056 1.199198167 -38163.67518 1.301472419 -31462.01446 1.401578934 -22867.30445 1.600174737 -17697.07994 1.796230622 -14182.80361 1.998798661 -11617.60705 2.214605381 -10056.90064 2.394447642 -8712.755603 2.597195799 -7678.576958 2.799911201 -6834.550554 3.00837786 -6192.465252 3.204905043 -5676.11641 3.395031492 -5209.047198 3.59990882 -4827.729216 3.796295623 -4522.101468 3.979050186 -4166.431185 4.22562774 -3716.657781 4.611304774 -3344.330169 5.011333094 -2973.764799 5.517810502 -2581.937354 6.227539629 -2252.390468 7.033583311 -1950.507339 8.046393956 -1725.790311 9.063358337 -1551.509204 10.07960146 -1412.701018 11.09193531 -1299.294377 12.10118071 -1204.799867 13.10469862 -1124.697768 14.10500889 -1055.675914 15.1010893 -995.514503 16.09535821 -942.4314655 17.08844874 -895.1286184 18.07983805 -852.7719486 19.06994856 -814.4203936 20.06368569 -776.3126368 21.15603198 -727.265171 22.74213598 -684.1599545 24.33415231 -644.3060313 26.00826302 -608.0233319 27.73096739 -576.4101078 29.41725959 -545.0375944 31.28963752 -513.2734832 33.43510408 -474.5962591 36.45331663 -441.7886635 39.44333088 -413.5929949 42.41036091 -388.8059905 45.38900958 -366.8842513 48.375086 -353.6729778 50.36091314 -324.3639224 55.36349998 -299.7346427 60.37700251 -278.6812151 65.38867621 -260.4951447 70.39844562 -244.6978711 75.39355044 -230.695818 80.38512344 -218.2759105 85.37795287 -207.1516012 90.36681168 -197.1868792 95.35837347 -188.1040758 100.3395941 -172.1578547 110.4183281 -158.9748754 120.2996678 -147.5815278 130.2952362 -137.727079 140.2841253 -129.1185112 150.2692389 -121.5389602 160.2577876 -114.8296799 170.2444285 -108.8287854 180.2368407 -103.4425159 190.2327769 -98.60578681 200.2304708 -94.21141942 210.2236698 -90.23553062 220.2125551 -86.58030888 230.2277661 -83.25574143 240.23083 -80.20227544 250.2180352 -77.3855594 260.2317977 -74.79145382 270.2193909 -72.38321253 280.2336986 -70.14799547 290.2229491 -68.07617245 300.2372723 -66.14304515 310.2322127 -65.22236663 315.2374946 -64.33962721 320.2386422 -63.3164124 326.2368582 -62.65607917 330.2299146 diff --git a/tecs/inp/x33924.inp b/tecs/inp/x33924.inp deleted file mode 100644 index 683818d..0000000 --- a/tecs/inp/x33924.inp +++ /dev/null @@ -1,91 +0,0 @@ -sens=x33924 ! S/N of sensor -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted) -!excit=1mV ! (off,30nA,100nA,300nA,1uA,3uA,10uA,30uA,100uA,300uA,1mA,10mV,1mV) (if omitted: default from sensor type) -!rang=0 ! range in sensor units (if rang=0: determine range from table, if omitted: default from sensor type) -curv ! R Ohm vs temp K -24544.50448 1.204688484 -20388.98451 1.299816848 -17074.34169 1.402716142 -12826.18794 1.600292593 -10134.65956 1.800477834 -8327.779483 2.000302893 -7042.867666 2.200152591 -6093.097817 2.399365105 -5365.432085 2.598855046 -4794.564445 2.797898026 -4334.508815 2.997461714 -3950.656072 3.200609731 -3638.188824 3.39930838 -3374.47855 3.597334429 -3141.224597 3.80201604 -2946.424115 3.999938386 -2782.431438 4.189664734 -2456.690144 4.653569119 -2235.489455 5.053489456 -2014.643985 5.554126028 -1776.815597 6.254371891 -1572.348929 7.05721402 -1382.376483 8.060082443 -1238.884866 9.064627059 -1126.083215 10.07177161 -1034.091919 11.08939964 -958.4997243 12.10117282 -895.1242435 13.10619965 -840.9064124 14.10796478 -793.9165441 15.1070989 -752.9065661 16.09648317 -716.4383121 17.08526451 -683.8577333 18.07317657 -654.407636 19.06032305 -627.7206809 20.04571127 -601.0710634 21.12668511 -565.9196553 22.72932023 -534.5220205 24.35489871 -506.120047 26.01663076 -480.897947 27.66889609 -458.3291362 29.31363009 -435.5818783 31.15122583 -412.0720052 33.28204306 -382.9759833 36.30288379 -358.0205352 39.31175412 -336.3436344 42.31006008 -317.2806783 45.30545705 -300.3446311 48.30399399 -290.1143785 50.29774935 -267.3892167 55.29778277 -248.1675904 60.2838604 -231.6393583 65.27495072 -217.28002 70.26929896 -204.6474971 75.26288067 -193.4535226 80.25333613 -183.4691212 85.24771825 -174.4992708 90.23969149 -166.3845133 95.2314448 -158.9980449 100.2350258 -146.0817862 110.2414656 -135.1571407 120.2217655 -125.7709957 130.2102291 -117.6218968 140.1979516 -110.4749621 150.1922249 -104.1682428 160.1928584 -98.55714149 170.1932857 -93.54097433 180.1963612 -89.03712993 190.1964608 -84.96770359 200.1868646 -81.27001313 210.183685 -77.90967378 220.1878592 -74.84532819 230.1778095 -72.03259224 240.161126 -69.43976573 250.168513 -67.05870384 260.1610728 -64.85341513 270.167037 -62.81393608 280.160649 -60.91437964 290.1703537 -59.15551208 300.1590455 -57.51331019 310.1585222 -56.7314869 315.155938 -55.97810594 320.1542011 -55.10662662 326.1395035 -54.54366027 330.1323684 diff --git a/tecs/inp/x34504.inp b/tecs/inp/x34504.inp deleted file mode 100644 index 7ef14fa..0000000 --- a/tecs/inp/x34504.inp +++ /dev/null @@ -1,90 +0,0 @@ -sens=x34504 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -type=Cernox ! 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 -333333 0.5 -100000 0.75 -28882.0923 1.205179561 -23865.74936 1.299725613 -19858.79852 1.402719693 -14783.03028 1.599960878 -11589.31223 1.800208908 -9458.897652 2.000163551 -7954.742817 2.200450813 -6853.540893 2.399235292 -6012.84751 2.598500585 -5355.016118 2.797532309 -4827.270276 2.996862941 -4387.640482 3.200272164 -4030.70704 3.399086038 -3729.734749 3.597599975 -3465.717001 3.801839064 -3245.026051 3.999767781 -3059.441174 4.189773672 -2692.805337 4.652992407 -2444.105313 5.053285046 -2197.082637 5.553764897 -1931.543552 6.254568629 -1704.432291 7.0569441 -1493.543355 8.062810707 -1335.450138 9.066699368 -1211.183301 10.07445608 -1110.628723 11.08962744 -1027.908066 12.09991307 -958.3411643 13.11002873 -899.3758734 14.10891913 -848.1468583 15.10758173 -803.4991329 16.09668594 -763.9883799 17.08482201 -728.5741231 18.07231477 -696.6018209 19.06047155 -667.7123606 20.04544062 -638.8319321 21.1277073 -600.8751742 22.72880574 -566.9942974 24.35523284 -536.3562528 26.0175818 -509.1605446 27.66980913 -484.909939 29.31433768 -460.4763696 31.15179351 -435.1872009 33.28212858 -404.0098605 36.30318484 -377.2983079 39.31237437 -354.1149168 42.31076825 -333.7636508 45.30513568 -315.7027185 48.30493112 -304.7748299 50.29789203 -280.6090057 55.29428726 -260.1052849 60.2941666 -242.5774007 65.27739775 -227.3249772 70.27151551 -213.9411567 75.26560067 -202.1017636 80.25448009 -191.5109979 85.25502764 -182.0329408 90.24231337 -173.4619591 95.2379186 -165.6764884 100.2361157 -152.0590315 110.2399506 -140.5432728 120.2281683 -130.6758211 130.2146285 -122.1064707 140.1999649 -114.607754 150.194711 -107.994615 160.1950751 -102.1093903 170.1969391 -96.85674876 180.2003599 -92.14155315 190.1984933 -87.88849828 200.1893336 -84.02856384 210.1838884 -80.5217462 220.1871995 -77.30967185 230.1794145 -74.37805157 240.1629216 -71.67777384 250.1700905 -69.19310447 260.161542 -66.89505431 270.1686429 -64.77103652 280.1603754 -62.79518008 290.173339 -60.96043448 300.1602153 -59.24969634 310.1622996 -58.43946892 315.1581116 -57.66002691 320.1564564 -56.752544 326.1400655 -56.16615205 330.1333658 diff --git a/tecs/inp/x34524.inp b/tecs/inp/x34524.inp deleted file mode 100644 index 235671a..0000000 --- a/tecs/inp/x34524.inp +++ /dev/null @@ -1,91 +0,0 @@ -sens=x34524 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -type=Cernox ! 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 -99999 0.68 -40000 0.88 -17215.93962 1.205295969 -14521.37915 1.299733871 -12319.11911 1.402779774 -9454.896601 1.600032404 -7598.346312 1.800196392 -6330.032795 2.000032414 -5411.546403 2.200808063 -4731.68224 2.399060827 -4203.530993 2.598110035 -3784.498457 2.796865059 -3443.969237 2.99612014 -3156.973225 3.199816299 -2922.173318 3.398635951 -2722.281567 3.597642108 -2545.709869 3.801815977 -2396.88267 4.000052958 -2271.456182 4.189935697 -2020.589228 4.653079366 -1848.633263 5.052762277 -1675.857504 5.55421233 -1488.519977 6.254401219 -1325.936773 7.057533074 -1173.27962 8.063786974 -1057.644526 9.067110709 -965.8424101 10.07607088 -891.0917002 11.08933433 -828.9593829 12.10016134 -776.6068896 13.10779227 -731.7911757 14.109062 -692.7365625 15.10794319 -658.5809498 16.09621744 -628.1485126 17.084668 -600.8203826 18.07166324 -575.9730603 19.06340776 -553.567368 20.04567144 -531.0351393 21.12926153 -501.2770034 22.72898826 -474.6422784 24.35497568 -450.4468571 26.01658794 -428.8799893 27.66913806 -409.5635895 29.31379357 -390.0418192 31.15137983 -369.8116497 33.28046253 -344.6737689 36.30335577 -323.0318853 39.31201515 -304.1801684 42.31104272 -287.5711406 45.30720204 -272.7791869 48.3045292 -263.8285843 50.29948692 -243.8926897 55.2950049 -226.9346392 60.29015594 -212.3451788 65.27841425 -199.6159144 70.2717248 -188.4052218 75.26717849 -178.4591553 80.25815622 -169.5231014 85.25633753 -161.5425591 90.24313862 -154.2638176 95.2397577 -147.663884 100.2366503 -136.0509697 110.2402522 -126.2011533 120.2293967 -117.7249476 130.2148824 -110.3457042 140.2023135 -103.8683814 150.1959848 -98.13045934 160.1967387 -93.02138075 170.1983816 -88.44298865 180.2012072 -84.32937456 190.2008479 -80.60851279 200.1906827 -77.22587458 210.185097 -74.1428084 220.1878946 -71.32342554 230.1814228 -68.7488481 240.1635748 -66.3635527 250.1717646 -64.17014374 260.1621017 -62.14144711 270.1686416 -60.25925014 280.1626459 -58.51217694 290.1729849 -56.88955768 300.1615843 -55.37137096 310.1620324 -54.65078747 315.1590028 -53.95707038 320.1551975 -53.15728488 326.1398446 -52.63526772 330.1343953 - diff --git a/tecs/inp/x34525.inp b/tecs/inp/x34525.inp deleted file mode 100644 index 987c2e9..0000000 --- a/tecs/inp/x34525.inp +++ /dev/null @@ -1,90 +0,0 @@ -sens=x34525 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -type=Cernox ! 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 -99999 0.5 -40000 0.72 -12863.47731 1.20533226 -10977.69216 1.29971648 -9417.264444 1.402769013 -7356.88973 1.600060215 -5995.899896 1.800209773 -5053.600115 2.000027246 -4361.922657 2.200868582 -3845.644121 2.399027638 -3440.318215 2.597993293 -3116.786533 2.796772093 -2851.862884 2.995930484 -2626.724273 3.199845935 -2442.041232 3.39873864 -2283.819233 3.597672461 -2143.671768 3.801851519 -2024.881159 3.999995088 -1924.157975 4.189943914 -1722.293242 4.653004494 -1582.968966 5.053311288 -1442.164067 5.554047021 -1288.369889 6.254676798 -1153.984421 7.057685077 -1026.836916 8.064072126 -930.1130521 9.066937055 -852.8229116 10.0764522 -789.5862115 11.08914207 -736.7546525 12.10125298 -692.1855391 13.10782998 -653.8330198 14.10888184 -620.341151 15.10748286 -591.0012057 16.09588211 -564.7305496 17.08467918 -541.1125238 18.07217677 -519.5967243 19.06365092 -500.1814879 20.04563525 -480.5766976 21.12940609 -454.6842507 22.72881734 -431.377762 24.35528384 -410.1649911 26.01739864 -391.2576228 27.66889881 -374.247106 29.31371758 -357.0118762 31.15190546 -339.1328149 33.28074829 -316.8289359 36.30320089 -297.5953135 39.31156325 -280.7895809 42.31149349 -265.9437689 45.3074115 -252.6729754 48.30399119 -244.6424501 50.29917293 -226.7174619 55.29523346 -211.4199685 60.28958825 -198.2014926 65.27860768 -186.6591056 70.27141438 -176.4659796 75.26708282 -167.3893777 80.25886738 -159.252992 85.25596857 -151.9323384 90.24334893 -145.2718871 95.23947718 -139.1970801 100.2366261 -128.5028722 110.240012 -119.4070961 120.2297394 -111.5588655 130.214951 -104.706856 140.2028623 -98.67712719 150.1961873 -93.33310996 160.1969795 -88.55378668 170.1989567 -84.27616044 180.2008387 -80.4152437 190.2012209 -76.91949115 200.1906303 -73.74256477 210.1853396 -70.84047507 220.1871823 -68.18441602 230.1811406 -65.74732999 240.1638392 -63.49378993 250.1719691 -61.41835204 260.1632129 -59.49819527 270.168475 -57.71287252 280.1618879 -56.05436837 290.1723521 -54.50714254 300.1613929 -53.06716058 310.1635816 -52.38204022 315.1589924 -51.72183234 320.1562515 -50.95507814 326.1396526 -50.46042863 330.1326674 diff --git a/tecs/inp/x34526.inp b/tecs/inp/x34526.inp deleted file mode 100644 index c711f7b..0000000 --- a/tecs/inp/x34526.inp +++ /dev/null @@ -1,90 +0,0 @@ -sens=x34526 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -type=Cernox ! 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 -99999 0.8 -40000 1.08 -29936.76247 1.205352238 -24709.97232 1.299731653 -20527.66798 1.402780903 -15241.45373 1.600076119 -11927.73412 1.800229012 -9723.955117 1.999995964 -8162.040676 2.200865255 -7028.594633 2.398958125 -6161.119099 2.59796122 -5483.50624 2.796519769 -4939.839186 2.995724648 -4485.084947 3.19985058 -4118.312143 3.398660742 -3808.16989 3.597696376 -3537.249799 3.801824168 -3309.964308 3.999986096 -3120.030313 4.189713635 -2743.854737 4.653200231 -2489.477496 5.053361846 -2236.317928 5.554035262 -1964.765668 6.254960563 -1732.342776 7.05782143 -1516.845787 8.064144213 -1355.718769 9.066965968 -1229.090897 10.07675638 -1126.706168 11.08898074 -1042.259318 12.10202644 -971.8453664 13.10763431 -911.5732254 14.10858572 -859.4313605 15.10755675 -814.1128899 16.09592158 -773.8338241 17.08508741 -737.8404392 18.07225012 -705.2766109 19.06379328 -676.0274915 20.0456077 -646.7241762 21.12880968 -608.0862576 22.72984359 -573.7108365 24.35508048 -542.5856877 26.01631055 -515.0402449 27.66857719 -490.4176664 29.31354539 -465.5926866 31.15248681 -439.9677876 33.28114138 -408.3326049 36.30350091 -381.2333927 39.31152372 -357.7222034 42.31149297 -337.0855121 45.30789424 -318.8160799 48.30417339 -307.7122247 50.29930204 -283.2137476 55.2954785 -262.473556 60.28854211 -244.6980608 65.27868441 -229.2357451 70.27168093 -215.679746 75.26721388 -203.6772173 80.25883886 -192.9802804 85.25603888 -183.3908024 90.24342986 -174.7064575 95.23927432 -166.8183318 100.23624 -153.0313647 110.2402989 -141.3884697 120.22952 -131.4040699 130.2149238 -122.735783 140.2035618 -115.1541351 150.1964705 -108.4652414 160.1974156 -102.5223956 170.1990541 -97.21172384 180.2004362 -92.44082428 190.2000503 -88.14556508 200.1904155 -84.24421194 210.1862411 -80.69572542 220.1873893 -77.45606866 230.1809456 -74.49526177 240.1630708 -71.76287079 250.1723463 -69.25572618 260.1632497 -66.93237967 270.1691371 -64.78656798 280.1611951 -62.78799465 290.1734124 -60.93683899 300.1623427 -59.20808959 310.163499 -58.38871932 315.1606319 -57.59908444 320.1551948 -56.68320144 326.1390933 -56.09636496 330.1333497 diff --git a/tecs/inp/x37342.inp b/tecs/inp/x37342.inp deleted file mode 100644 index 1a5ce80..0000000 --- a/tecs/inp/x37342.inp +++ /dev/null @@ -1,88 +0,0 @@ -sens=x37342 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -type=Cernox ! 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 -5415.493374 1.206752613 -4747.986725 1.299090896 -4180.676443 1.399849988 -3373.518006 1.600691945 -2833.112672 1.800317833 -2446.259346 1.999351695 -2155.746629 2.19904102 -1930.936718 2.398457238 -1750.825962 2.599780609 -1603.999702 2.802110593 -1486.56402 2.997456677 -1384.241772 3.199426263 -1298.306853 3.398382823 -1223.094888 3.599951554 -1157.673728 3.8005973 -1100.91193 3.998225773 -1051.451368 4.191612886 -965.0359425 4.591180816 -893.1152109 4.996417888 -819.8481588 5.503743652 -739.352187 6.210638537 -668.5319342 7.020777422 -600.8417719 8.032881997 -548.6714557 9.041711926 -506.9104706 10.04721234 -472.1997804 11.06281225 -443.2149916 12.07199761 -418.4514779 13.08021171 -396.9793756 14.08524473 -378.2961725 15.08105001 -361.6388231 16.0776196 -346.7520949 17.06826977 -333.3229963 18.05892179 -321.1295517 19.04743552 -309.9544517 20.03626438 -298.6946745 21.12616944 -283.8478521 22.71800965 -270.6691904 24.31285067 -258.6727612 25.93298422 -247.768787 27.56451225 -237.9641129 29.18601637 -227.9254232 31.0030598 -217.4183451 33.11826043 -204.2665322 36.12296457 -192.8157725 39.12772964 -182.8064699 42.11247422 -173.8963947 45.11153437 -165.9188961 48.10303508 -161.0350302 50.10484635 -150.1755882 55.10098825 -140.8655317 60.1034188 -132.7853527 65.09901632 -125.6860893 70.10437511 -119.3985515 75.09806481 -113.7930326 80.09501075 -108.7413724 85.09261262 -104.1727159 90.08703311 -99.9981164 95.0899334 -96.18604309 100.0922684 -89.46221937 110.0771918 -83.68245162 120.0790457 -78.66179354 130.0741289 -74.25609722 140.0697789 -70.3608622 150.0655921 -66.89165633 160.0683035 -63.77569002 170.0708132 -60.96786868 180.0736291 -58.42889208 190.0695589 -56.12020923 200.0788513 -54.00696273 210.0877227 -52.07877723 220.0849127 -50.30351224 230.0812 -48.6691464 240.0969195 -47.15854869 250.0896564 -45.76003996 260.0992008 -44.46302665 270.0979475 -43.2586392 280.1084345 -42.13569868 290.1197964 -41.08823336 300.1322266 -40.1061292 310.1430744 -39.63806835 315.1577652 -39.18737989 320.1617401 -38.66500317 326.1611063 -38.32671309 330.1678422 diff --git a/tecs/inp/x37346.inp b/tecs/inp/x37346.inp deleted file mode 100644 index fd63189..0000000 --- a/tecs/inp/x37346.inp +++ /dev/null @@ -1,88 +0,0 @@ -sens=x37346 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -type=Cernox ! 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 -1976.784871 1.206868208 -1789.357045 1.29910956 -1623.598312 1.399829728 -1376.943235 1.600682367 -1202.922899 1.800218421 -1072.854429 1.999359328 -971.6816439 2.199013893 -891.0343229 2.398349934 -824.5804594 2.599758134 -769.2084602 2.802189598 -724.0169028 2.997521915 -683.9414168 3.199362498 -649.6944837 3.398338997 -619.2829636 3.599901484 -592.4934601 3.800585658 -568.91858 3.998274195 -548.1988515 4.191520857 -511.3207173 4.591416301 -480.0994172 4.996645076 -447.7052961 5.503831359 -411.3997054 6.210932759 -378.7054625 7.020640523 -346.7634731 8.033380233 -321.6360921 9.042073285 -301.1808217 10.04770239 -283.9448891 11.06296541 -269.3184883 12.07201154 -256.6735798 13.0801988 -245.630938 14.08532095 -235.9068829 15.08031446 -227.1467855 16.07754937 -219.2854498 17.06887521 -212.1123582 18.05925945 -205.5606 19.04763718 -199.5055587 20.03639205 -193.3672587 21.12646064 -185.2369533 22.71812022 -177.9155379 24.31298111 -171.1990357 25.93368543 -165.0517753 27.56488875 -159.4613693 29.18602801 -153.7319457 31.00282121 -147.6633858 33.11882201 -139.9827866 36.12397249 -133.2387386 39.12763525 -127.2827692 42.11258687 -121.9162945 45.11099883 -117.0922134 48.10385061 -114.1140088 50.10506205 -107.4450238 55.10133071 -101.6686949 60.10332248 -96.60311371 65.09908372 -92.1078183 70.10440069 -88.10487284 75.09877026 -84.49953504 80.09490857 -81.23342616 85.09291599 -78.25677185 90.08711052 -75.52865596 95.09021775 -73.00482398 100.0918862 -68.53237199 110.0772099 -64.64664752 120.0790936 -61.23873719 130.0745096 -58.22613822 140.0696374 -55.53799558 150.0659629 -53.12466939 160.0680131 -50.94642602 170.0712268 -48.97135712 180.0748498 -47.17207959 190.0700854 -45.52495895 200.0789463 -44.01361105 210.0877304 -42.6248401 220.0843037 -41.34625697 230.0815437 -40.15899378 240.0955939 -39.06102816 250.0897281 -38.03939608 260.0978307 -37.08936918 270.0989519 -36.20281317 280.1053756 -35.37594228 290.1196531 -34.60059255 300.1328077 -33.87116658 310.1482353 -33.52546443 315.1545815 -33.1905672 320.1622943 -32.80264842 326.1651962 -32.55010406 330.167843 diff --git a/tecs/inp/x38604.inp b/tecs/inp/x38604.inp deleted file mode 100644 index fe9c812..0000000 --- a/tecs/inp/x38604.inp +++ /dev/null @@ -1,91 +0,0 @@ -sens=x38604 ! S/N of sensor -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted) -!excit=1mV ! (off,30nA,100nA,300nA,1uA,3uA,10uA,30uA,100uA,300uA,1mA,10mV,1mV) (if omitted: default from sensor type) -!rang=0 ! range in sensor units (if rang=0: determine range from table, if omitted: default from sensor type) -curv ! R Ohm vs temp K -20412.46386 1.20156719 -16860.20606 1.300302394 -14206.29133 1.400156017 -10633.56121 1.600120723 -8406.167574 1.800112844 -6918.352774 1.99972441 -5850.895981 2.201559744 -5069.838597 2.400629364 -4461.387484 2.60256272 -3986.471662 2.80351442 -3606.722449 3.003201331 -3300.718438 3.198657564 -3037.819815 3.399937307 -2818.763343 3.598351289 -2628.712788 3.799225495 -2465.867828 3.998603972 -2321.258711 4.201211048 -2075.527643 4.619816788 -1887.875976 5.021544652 -1701.844495 5.521269477 -1501.439148 6.223302018 -1329.043444 7.034212629 -1169.547277 8.040539291 -1049.886271 9.046693569 -956.3076605 10.05234973 -880.0127515 11.06857718 -817.3965588 12.07728365 -764.714201 13.08311877 -719.740466 14.08602025 -680.9115009 15.08223458 -646.8629683 16.07310415 -616.7225982 17.06283961 -589.7505702 18.05011292 -565.376056 19.03905573 -543.2341322 20.02734526 -521.1420718 21.11245219 -492.1927074 22.70786968 -466.7200773 24.30075015 -444.0273202 25.89807467 -423.5133521 27.50688551 -405.1019135 29.10870327 -386.3572801 30.91864112 -366.8638012 33.02239447 -342.5502763 36.02500279 -321.7070362 39.01618225 -303.470571 42.01458869 -287.434302 45.00920339 -273.1480073 48.01221373 -264.469519 50.01346007 -245.2823612 55.01068434 -228.9876412 60.01089012 -214.9336014 65.01141017 -202.7070782 70.01099979 -191.9239911 75.00634629 -182.3575066 80.00259085 -173.8041831 84.99943465 -166.0773404 89.99212138 -159.0671861 94.99411182 -152.6734392 99.99826535 -141.4308445 110.002616 -131.8571802 119.9963004 -123.5771834 129.990347 -116.3486814 139.9877493 -109.9756229 149.9838087 -104.3129902 159.9887737 -99.23561636 169.9961821 -94.67666818 179.9982237 -90.56330163 189.9978526 -86.81888041 199.9894891 -83.41295629 209.9978469 -80.28422905 220.0037705 -77.42146178 229.9988311 -74.79006811 239.9999779 -72.34626786 250.0105629 -70.09506174 259.9982974 -67.99754598 270.0147417 -66.05217741 280.0050937 -64.23514763 290.025808 -62.54174861 300.0249605 -60.95513586 310.0390022 -60.19851967 315.0460851 -59.46511146 320.0491529 -58.62156062 326.0484808 -58.06956208 330.0726156 diff --git a/tecs/inp/x38622.inp b/tecs/inp/x38622.inp deleted file mode 100644 index b8fbd03..0000000 --- a/tecs/inp/x38622.inp +++ /dev/null @@ -1,94 +0,0 @@ -sens=x38622 ! S/N of sensor -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted) -!excit=1mV ! (off,30nA,100nA,300nA,1uA,3uA,10uA,30uA,100uA,300uA,1mA,10mV,1mV) (if omitted: default from sensor type) -!rang=0 ! range in sensor units (if rang=0: determine range from table, if omitted: default from sensor type) -curv ! R Ohm vs temp K -300000 0.5 -50000 0.8 -25000 1 -15453.30114 1.201390483 -12933.98712 1.300214311 -11034.4649 1.399887714 -8424.025493 1.600041142 -6765.520271 1.800251849 -5641.414912 1.9995488 -4825.596882 2.200686253 -4218.310807 2.400271552 -3741.288325 2.602866026 -3366.108822 2.803777221 -3065.896093 3.002383061 -2820.775914 3.198131733 -2607.99059 3.400368026 -2431.721514 3.597583192 -2276.702132 3.798907035 -2143.807566 3.998131437 -2024.837736 4.20125159 -1821.670244 4.621000206 -1666.056816 5.022185848 -1510.041822 5.52315617 -1341.463446 6.225737889 -1195.120579 7.036711748 -1058.871933 8.042940617 -955.8898376 9.048163535 -874.7352885 10.05559249 -808.5212229 11.0671681 -753.6211919 12.0770092 -707.2526538 13.08351477 -667.6086193 14.08654991 -633.2789651 15.08019912 -603.1052751 16.0724308 -576.1655167 17.06299644 -552.0576188 18.04961444 -530.2431413 19.03935964 -510.3861991 20.02705871 -490.4830005 21.11310453 -464.3747951 22.70620002 -441.2997254 24.30035606 -420.6898026 25.89717613 -402.0656484 27.50700789 -385.2466189 29.10810008 -368.1127672 30.91706208 -350.2386088 33.02231247 -327.8701799 36.028182 -308.6263414 39.0147806 -291.739001 42.01198266 -276.8073376 45.00927648 -263.4709735 48.01345304 -255.3943899 50.012299 -237.4349811 55.01187706 -222.1325912 60.01176014 -208.9067335 65.00854426 -197.3466096 70.01094832 -187.1416471 75.00711548 -178.0650634 80.00343132 -169.90989 85.00099444 -162.5472513 89.99602198 -155.8646577 94.99314896 -149.7520628 99.99940478 -138.9729204 110.0040869 -129.7653271 119.9984141 -121.7887435 129.9915381 -114.7969181 139.9865 -108.6268904 149.9876441 -103.1235556 159.9916643 -98.19129551 169.9975333 -93.75197322 180.0004201 -89.72897538 189.9992774 -86.0728896 199.9904115 -82.73482086 209.9989221 -79.68074532 220.0043206 -76.87013076 229.9988719 -74.27775917 240.0013253 -71.87883432 250.0103348 -69.66047872 259.9988441 -67.5938408 270.0150322 -65.6760198 280.0038708 -63.87931678 290.0129751 -62.20342806 300.0258092 -60.63184876 310.0414238 -59.88468604 315.0473514 -59.16030428 320.0518899 -58.31898067 326.0515678 -57.77086996 330.0746148 diff --git a/tecs/inp/x40188.inp b/tecs/inp/x40188.inp deleted file mode 100644 index 42bb00b..0000000 --- a/tecs/inp/x40188.inp +++ /dev/null @@ -1,91 +0,0 @@ -sens=x40188 ! S/N of sensor -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted) -!excit=1mV ! (off,30nA,100nA,300nA,1uA,3uA,10uA,30uA,100uA,300uA,1mA,10mV,1mV) (if omitted: default from sensor type) -!rang=0 ! range in sensor units (if rang=0: determine range from table, if omitted: default from sensor type) -curv ! R Ohm vs temp K -10462.91955 1.206635152 -8974.502112 1.30029511 -7747.980015 1.401139015 -6062.20743 1.600639649 -4962.79579 1.800502563 -4200.914173 1.999917288 -3633.446321 2.20354039 -3211.799506 2.402805921 -2887.263332 2.598104712 -2620.881342 2.797345247 -2398.551353 3.001233389 -2217.027433 3.201520724 -2058.540551 3.409323788 -1929.639525 3.607148504 -1815.49335 3.809424314 -1727.151467 3.987691686 -1632.231758 4.203983687 -1471.915898 4.648154268 -1355.910456 5.047971611 -1238.358199 5.548631426 -1110.026155 6.24980331 -997.4370658 7.056663428 -890.9549559 8.067039886 -809.938991 9.071371924 -745.1914158 10.08057096 -692.1648627 11.09241081 -647.9654801 12.10248436 -610.4273954 13.11063973 -578.0749228 14.11478886 -550.0645488 15.10724305 -525.1100025 16.10210735 -502.959179 17.08857814 -482.9611922 18.07591937 -464.8017468 19.06177134 -448.2094572 20.04891373 -431.4683285 21.13695075 -409.5604327 22.71801927 -389.7710854 24.32961735 -371.9591952 25.95043929 -355.770266 27.58587213 -341.1896493 29.20941257 -326.320331 31.03649945 -310.8145273 33.15262383 -291.3622934 36.16308841 -274.5095016 39.15879132 -259.6764734 42.16003287 -246.5268606 45.15600757 -234.7717768 48.15592299 -227.6297636 50.14461018 -211.632099 55.14324822 -197.9236764 60.14470542 -186.060592 65.1357733 -175.6458849 70.13511412 -166.4329113 75.12821909 -158.2109297 80.12024513 -150.8216663 85.11708767 -144.1365607 90.11031559 -138.0583199 95.10510171 -132.4894167 100.1096345 -122.6752872 110.0997968 -114.2750813 120.1003868 -107.0051393 130.0921869 -100.6297303 140.0914321 -95.00450444 150.0848981 -90.00103925 160.0857667 -85.523374 170.0848037 -81.49711559 180.0832634 -77.85746374 190.0724539 -74.54398366 200.0800677 -71.52999539 210.0822512 -68.77095991 220.0747082 -66.24009616 230.0681616 -63.90665977 240.0777178 -61.75992367 250.0685213 -59.77018951 260.070832 -57.92308575 270.0682251 -56.21115163 280.0687088 -54.61181749 290.0701741 -53.11794082 300.0730231 -51.72613191 310.0727086 -51.0609983 315.0774127 -50.4201932 320.0714867 -49.67881399 326.0537885 -49.20460912 330.0332773 diff --git a/tecs/inp/x50830.inp b/tecs/inp/x50830.inp deleted file mode 100644 index b9f12c9..0000000 --- a/tecs/inp/x50830.inp +++ /dev/null @@ -1,92 +0,0 @@ -sens=x50830 ! S/N of sensor -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted) -!excit=1mV ! (off,30nA,100nA,300nA,1uA,3uA,10uA,30uA,100uA,300uA,1mA,10mV,1mV) (if omitted: default from sensor type) -!rang=0 ! range in sensor units (if rang=0: determine range from table, if omitted: default from sensor type) -curv ! R Ohm vs temp K -99999 0.9 -42325.9311 1.199487384 -33961.46768 1.302072845 -28261.10113 1.399076716 -20578.16875 1.599462867 -15915.71214 1.801028389 -12884.4546 2.000346353 -10766.68476 2.200107561 -9213.766018 2.399940869 -8036.654088 2.601201022 -7130.457408 2.800094624 -6420.072985 2.995762243 -5817.149305 3.199584103 -5327.192789 3.400909663 -4920.418078 3.599897643 -4571.361943 3.800310976 -4271.587746 4.000853435 -4017.665399 4.195961797 -3587.844966 4.599001125 -3240.674403 5.011103122 -2899.180158 5.528795438 -2539.634608 6.250804161 -2249.209893 7.038801156 -1973.639959 8.05265711 -1767.058631 9.074910412 -1607.596161 10.09006898 -1478.450864 11.11609095 -1373.189829 12.13260177 -1285.026905 13.14454012 -1210.264126 14.14759271 -1145.901044 15.13989052 -1089.306567 16.13162079 -1039.128561 17.11748302 -994.3333056 18.10120692 -953.8671113 19.08314476 -916.8012304 20.06787662 -879.6863841 21.15291684 -830.9872625 22.74381678 -787.1760804 24.36410109 -747.2036626 26.03131501 -711.4411401 27.68711958 -679.4262772 29.33105456 -647.1526158 31.17299538 -613.6130785 33.30302933 -571.8447359 36.32648062 -535.8694027 39.33146561 -504.254955 42.33586813 -476.4451941 45.32925387 -451.586926 48.33026391 -436.4789489 50.32176568 -402.8821475 55.31349671 -374.1981095 60.31009994 -349.3515675 65.30678838 -327.685341 70.29947884 -308.6024281 75.28817282 -291.6051756 80.27907423 -276.4111752 85.27049953 -262.6599901 90.26996023 -250.2011361 95.2640345 -238.8776644 100.2675341 -219.0092123 110.2499713 -202.0851886 120.2515897 -187.5285197 130.2568925 -174.8957677 140.2445848 -163.7851663 150.2451988 -153.9702607 160.2498061 -145.2291671 170.2689753 -137.4288875 180.2603652 -130.4022927 190.2576954 -124.0550693 200.2687831 -118.2882573 210.2861065 -113.0499728 220.2894661 -108.2708047 230.2804543 -103.88222 240.2775328 -99.87321765 250.2551252 -96.15653425 260.2505238 -92.71991945 270.2592115 -89.53751845 280.2674314 -86.58094408 290.284565 -83.83312149 300.3056377 -81.26525924 310.3172654 -80.04910977 315.3351745 -78.8720517 320.3442881 -77.52092254 326.3407791 -76.63515624 330.3581799 diff --git a/tecs/inp/x50903.inp b/tecs/inp/x50903.inp deleted file mode 100644 index de6df57..0000000 --- a/tecs/inp/x50903.inp +++ /dev/null @@ -1,92 +0,0 @@ -sens=x50903 ! S/N of sensor -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted) -!excit=1mV ! (off,30nA,100nA,300nA,1uA,3uA,10uA,30uA,100uA,300uA,1mA,10mV,1mV) (if omitted: default from sensor type) -!rang=0 ! range in sensor units (if rang=0: determine range from table, if omitted: default from sensor type) -curv ! R Ohm vs temp K -99999 0.95 -45110.85765 1.199643593 -36095.99336 1.302033086 -29973.77725 1.399026421 -21736.77714 1.599456548 -16755.81832 1.801070918 -13526.12746 2.000686747 -11280.5273 2.199994398 -9632.180069 2.40016421 -8390.956774 2.600833419 -7433.77208 2.79983446 -6680.163912 2.99605527 -6046.378595 3.199919149 -5531.865699 3.401016618 -5104.481921 3.600019247 -4738.399169 3.800378246 -4423.888653 4.000812256 -4158.194066 4.19598106 -3709.099389 4.59918838 -3344.874937 5.011263052 -2988.5091 5.528413931 -2614.303015 6.250827653 -2312.280826 7.038986198 -2026.172014 8.052889631 -1811.771851 9.07507427 -1646.683511 10.09050085 -1513.015778 11.11640263 -1404.17633 12.13239565 -1313.313015 13.14496558 -1236.028373 14.14772205 -1169.594247 15.14029792 -1111.206079 16.13149876 -1059.664026 17.11658562 -1013.481955 18.10082281 -971.7370926 19.08304593 -933.7028395 20.06763452 -895.5295918 21.15329476 -845.442377 22.74433939 -800.4722859 24.36401627 -759.3202325 26.03161483 -722.7382049 27.68720806 -690.006325 29.33100831 -656.860715 31.1731005 -622.5299221 33.30304293 -579.8203614 36.32663473 -542.9220654 39.3312073 -510.6718542 42.33587441 -482.2584585 45.32910598 -456.8604321 48.33081991 -441.4675946 50.32157393 -407.232794 55.31398311 -377.943805 60.31049131 -352.6797551 65.30742465 -330.6155872 70.29972616 -311.2148217 75.28845922 -293.9521202 80.27958845 -278.4768091 85.26989001 -264.5507672 90.27028454 -251.9213988 95.26417171 -240.4265728 100.2678364 -220.2753209 110.250348 -203.1344026 120.2527687 -188.3923365 130.2571455 -175.6190746 140.2450706 -164.3829973 150.24572 -154.4723694 160.2500657 -145.6476402 170.2686084 -137.779898 180.2606798 -130.7060254 190.2580229 -124.2974384 200.2694677 -118.4973794 210.2867157 -113.2180062 220.2893424 -108.4115072 230.2811482 -103.9943547 240.2772685 -99.95502122 250.2565643 -96.21189556 260.250154 -92.76142442 270.2605178 -89.55896091 280.2687079 -86.59483364 290.2852112 -83.8267592 300.3069472 -81.26288124 310.3181833 -80.03617123 315.335506 -78.85752784 320.3458591 -77.49519743 326.3415919 -76.61198586 330.3579172 diff --git a/tecs/inp/x50921.inp b/tecs/inp/x50921.inp deleted file mode 100644 index bf56474..0000000 --- a/tecs/inp/x50921.inp +++ /dev/null @@ -1,92 +0,0 @@ -sens=x50921 ! S/N of sensor -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted) -!excit=1mV ! (off,30nA,100nA,300nA,1uA,3uA,10uA,30uA,100uA,300uA,1mA,10mV,1mV) (if omitted: default from sensor type) -!rang=0 ! range in sensor units (if rang=0: determine range from table, if omitted: default from sensor type) -curv ! R Ohm vs temp K -99999 0.7 -24381.68536 1.200530127 -20066.21388 1.301576002 -16998.19646 1.398747381 -12754.65044 1.599488289 -10102.68126 1.80088276 -8326.150331 2.000944072 -7062.982388 2.20066988 -6124.047494 2.400332015 -5402.528629 2.600424795 -4831.110959 2.8019663 -4385.342692 2.996647929 -4003.287341 3.199648541 -3689.853299 3.400194149 -3425.997105 3.599539007 -3197.529294 3.800985665 -3000.569769 4.00146099 -2833.475587 4.196185677 -2547.828689 4.599849452 -2314.453939 5.011802927 -2083.025492 5.528142156 -1837.096731 6.251177387 -1636.195422 7.039348025 -1443.473322 8.055363714 -1298.041956 9.076850624 -1184.720045 10.09393174 -1092.959094 11.11566556 -1017.360011 12.13224829 -953.7455641 13.14508168 -899.696473 14.14729537 -852.8536983 15.14043704 -811.5544918 16.13240008 -775.0516688 17.11676395 -742.1496329 18.10084633 -712.3855762 19.08289531 -685.2253315 20.06826412 -657.8131126 21.15472343 -621.9875346 22.74196047 -589.5829624 24.36232959 -559.8462269 26.03225261 -533.3989126 27.68902721 -509.6607141 29.33112114 -485.6088518 31.17386188 -460.6486521 33.30387239 -429.483169 36.33135455 -402.6589194 39.33285837 -379.0588236 42.33600603 -358.2710973 45.33082809 -339.6504362 48.33351081 -328.3677613 50.3248865 -303.2300517 55.32246728 -281.7530305 60.31636608 -263.2099173 65.30989429 -247.0010898 70.30282722 -232.6950607 75.29433068 -220.0023387 80.2826538 -208.6064449 85.27772994 -198.3485625 90.27380839 -189.0206069 95.27712656 -180.5494586 100.2730626 -165.6912906 110.25738 -153.049323 120.2582664 -142.166264 130.2579287 -132.7202702 140.2496328 -124.4260425 150.2513751 -117.0999084 160.2557079 -110.5776461 170.2662076 -104.749634 180.266942 -99.51230072 190.2633018 -94.77631 200.2764392 -90.48537684 210.2912153 -86.58773356 220.2953423 -83.02546019 230.2860215 -79.76718091 240.2775527 -76.78211818 250.2567077 -74.01912237 260.2511453 -71.46938927 270.2633832 -69.10027596 280.2704291 -66.91063953 290.2897401 -64.87976531 300.3081481 -62.98549013 310.3200327 -62.08237117 315.3384494 -61.21210631 320.3411371 -60.21347273 326.3395507 -59.55844814 330.3570928 diff --git a/tecs/inp/x50923.inp b/tecs/inp/x50923.inp deleted file mode 100644 index 608d948..0000000 --- a/tecs/inp/x50923.inp +++ /dev/null @@ -1,92 +0,0 @@ -sens=x50923 ! S/N of sensor -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted) -!excit=1mV ! (off,30nA,100nA,300nA,1uA,3uA,10uA,30uA,100uA,300uA,1mA,10mV,1mV) (if omitted: default from sensor type) -!rang=0 ! range in sensor units (if rang=0: determine range from table, if omitted: default from sensor type) -curv ! R Ohm vs temp K -99999 0.4 -7248.809631 1.200267972 -6258.740902 1.301591801 -5527.384509 1.398686518 -4446.161743 1.599449998 -3723.023155 1.800890284 -3210.782591 2.000970817 -2828.117025 2.200740076 -2533.523953 2.400018873 -2297.327334 2.600496679 -2105.568301 2.801898776 -1951.776246 2.996741874 -1816.770384 3.200041578 -1704.059184 3.399957937 -1606.830979 3.599735722 -1521.468083 3.800862338 -1446.594707 4.001408074 -1382.125135 4.196232967 -1269.482892 4.599015289 -1175.495787 5.011312303 -1079.987405 5.528780643 -975.642713 6.25105491 -888.1577639 7.03948402 -801.8620133 8.055950867 -735.1418405 9.076868576 -682.0143144 10.09400013 -638.129801 11.11567941 -601.4499692 12.13249458 -570.1578708 13.14519607 -543.1850887 14.14717948 -519.6006373 15.14036704 -498.590896 16.13245866 -479.7627487 17.11685977 -462.721404 18.10129365 -447.1564 19.08414654 -432.8293149 20.06772516 -418.3067008 21.15459093 -399.05579 22.74250541 -381.4878205 24.36410311 -365.210327 26.03137819 -350.5721766 27.69031625 -337.356323 29.33150174 -323.7907785 31.17443724 -309.6083138 33.30435491 -291.7121777 36.33078353 -276.12593 39.33196571 -262.2529585 42.33650403 -249.8892906 45.33098533 -238.7457203 48.33414261 -231.9459378 50.32526213 -216.6140593 55.32184289 -203.3687311 60.31660115 -191.7920407 65.31041458 -181.5792033 70.30289116 -172.4820804 75.29476931 -164.3347976 80.28284852 -156.9393461 85.27760834 -150.2438242 90.27424609 -144.1131134 95.27691004 -138.5145808 100.273632 -128.5734277 110.2576662 -120.0103516 120.2582904 -112.5697002 130.2583296 -106.0334184 140.2497729 -100.2448292 150.2515397 -95.0812019 160.2564769 -90.45461704 170.266668 -86.28914977 180.2665477 -82.51176371 190.2636569 -79.08087444 200.2771329 -75.94729693 210.2906245 -73.08805784 220.2950756 -70.46111243 230.2846187 -68.04978165 240.2776214 -65.81809927 250.2569389 -63.7576621 260.2519835 -61.83937868 270.2626823 -60.05730192 280.2713434 -58.40268078 290.2887518 -56.85970982 300.3084894 -55.40930045 310.3216597 -54.72263874 315.3381208 -54.0654889 320.3410691 -53.29642059 326.3406068 -52.79431658 330.3568507 diff --git a/tecs/inp/x51079.inp b/tecs/inp/x51079.inp deleted file mode 100644 index 41a83fe..0000000 --- a/tecs/inp/x51079.inp +++ /dev/null @@ -1,93 +0,0 @@ -sens=x51079 ! S/N of sensor -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen -!tlim=325 ! setpoint limit (automatic if omitted) -type=cernox ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted) -!excit=1mV ! (off,30nA,100nA,300nA,1uA,3uA,10uA,30uA,100uA,300uA,1mA,10mV,1mV) (if omitted: default from sensor type) -!rang=0 ! range in sensor units (if rang=0: determine range from table, if omitted: default from sensor type) -curv ! R Ohm vs temp K -99999 0.8 -31701.69844 1.200195255 -25738.71476 1.301618313 -21571.67977 1.398690075 -15891.1039 1.599499641 -12410.99715 1.800875208 -10112.58367 2.000968638 -8496.169733 2.200773915 -7309.656013 2.399808017 -6402.483411 2.600462327 -5690.003603 2.801844837 -5136.862611 2.996682891 -4665.002926 3.200247791 -4280.961041 3.400163413 -3958.252426 3.599755531 -3680.528472 3.800539765 -3441.06649 4.001425435 -3238.31911 4.196146786 -2893.456507 4.599588592 -2613.723169 5.011481517 -2337.239974 5.52813085 -2044.30306 6.250970179 -1806.218601 7.039710316 -1578.881203 8.055699319 -1408.468344 9.076240806 -1276.029252 10.09425483 -1169.067858 11.11578211 -1081.44118 12.13218542 -1008.008552 13.1450495 -945.8212165 14.14700851 -892.2692849 15.14020243 -845.2617719 16.13153323 -803.7296029 17.11644948 -766.5875111 18.10125511 -733.0778135 19.08426455 -702.6489945 20.06744332 -672.159389 21.15497261 -632.373206 22.74340595 -596.6893239 24.36380967 -564.2535699 26.03241673 -535.471919 27.68995055 -509.8750464 29.33217742 -484.1015765 31.17438659 -457.5017098 33.30489899 -424.6397749 36.33014378 -396.584378 39.33169969 -372.148834 42.33638839 -350.6948309 45.33121943 -331.6671633 48.33508495 -320.2098688 50.32463714 -294.7682423 55.32123004 -273.239756 60.31725762 -254.7420604 65.31065948 -238.6978597 70.30346054 -224.6121816 75.29487951 -212.1574889 80.28329022 -201.0312674 85.27779755 -191.0399377 90.27431131 -181.9952632 95.27585149 -173.8023756 100.2734621 -159.4657538 110.258 -147.3158402 120.2583265 -136.9062108 130.2582897 -127.8737887 140.2505131 -119.969622 150.2515166 -112.9882587 160.2567323 -106.7780007 170.2671874 -101.2407568 180.2663663 -96.26213132 190.263439 -91.75658195 200.2777425 -87.67287463 210.2922551 -83.96709649 220.2954809 -80.57531707 230.2846665 -77.46893249 240.2777945 -74.62151152 250.2567026 -71.98960132 260.2531344 -69.55733263 270.2636242 -67.30146229 280.2699561 -65.20343205 290.2893868 -63.25912535 300.3100494 -61.43804857 310.3216216 -60.57422692 315.3367602 -59.73845799 320.3412944 -58.77799488 326.3400677 -58.15808766 330.3579491 - diff --git a/tecs/inp/z030114.inp b/tecs/inp/z030114.inp deleted file mode 100644 index 6c36195..0000000 --- a/tecs/inp/z030114.inp +++ /dev/null @@ -1,67 +0,0 @@ -sens=z030114 -unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically -!tlim=3250 ! 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=0 ! range in sensor units (if rang=0: determine range from table, if omitted: default from sensor type) -form=loglog -curv ! curve (sensor,temp/K) follows, must be ordered, but can be increasing or decreasing -7648.1 1.4745 -7197.9 1.5035 -6260.3 1.6022 -5522.5 1.7084 -4949.6 1.8062 -4464.5 1.8998 -3972.3 2.0088 -3247 2.211 -2731.2 2.4097 -2339.2 2.6156 -2058.7 2.8087 -1831 3.0063 -1562.9 3.3066 -1360 3.6039 -1152.1 4.0042 -1020.9 4.3323 -917.19 4.6551 -825.64 5.0141 -722.6 5.5186 -644.91 6.0149 -531.85 7.0282 -455.52 8.0262 -399.1 9.0341 -357.79 10.002 -286.16 12.501 -242.7 14.958 -211.27 17.569 -189.13 20.119 -169.22 23.232 -153.02 26.642 -139.23 30.499 -129.38 34.113 -121.06 37.908 -113.89 41.867 -108.04 46.054 -103.24 49.949 -97.819 55.114 -93.356 60.074 -89.546 64.945 -86.122 69.922 -83.087 74.929 -80.293 80.139 -75.959 89.602 -72.171 99.514 -68.786 109.9 -65.991 119.82 -61.366 139.58 -57.467 160.28 -54.38 180 -51.734 199.9 -49.442 219.83 -47.343 239.72 -45.471 260.1 -43.772 280.4 -42.983 290.42 -42.303 299.51 -41.908 305.15 -36 450 - diff --git a/tecs/instr_hosts.c b/tecs/instr_hosts.c deleted file mode 100644 index 8465d1a..0000000 --- a/tecs/instr_hosts.c +++ /dev/null @@ -1,214 +0,0 @@ -#include -#include -#include -#include -#include "instr_hosts.h" - -static char *getItem(char *line, char *name, char *value, int value_len) { - char find[32]; - char *found, *sp, *result; - int l; - - snprintf(find, sizeof find, "%s=%s", name, value); - found = strstr(line, find); - if (found && *value != '\0' && found[strlen(find)] > ' ' && found[strlen(find)] != '.') { - /* when value is given, it must be complete, (a dot or a space terminates the value) */ - found = NULL; - } - if (found) { - found += strlen(name)+1; - if (value_len == 0) { - result = found; - } else { - sp = strchr(found, ' '); - if (sp && sp < found + value_len) { - l = sp - found; - } else { - l = strlen(found); - } - if (l < value_len) { - strncpy(value, found, l); - value[l] = '\0'; - result = value; - } else { - value[0] = '\0'; - result = NULL; - } - } - } else { - if (value_len > 0) { - *value = '\0'; - } - result = NULL; - } - return result; -} - -void scanHostList(void (*func)(char *)) { - int i; - FILE *fil, *lfil; - char *hostlist; - char localhostlist[512]; - char line[512], lline[512]; - int dirty; - - hostlist = getenv("InstrumentHostList"); - if (!hostlist) { - hostlist="/afs/psi.ch/project/sinq/common/lib/sea/hostlist"; - } - fil = fopen(hostlist, "r"); - snprintf(localhostlist, sizeof localhostlist, "%s/.six/hostlist", getenv("HOME")); - lfil = fopen(localhostlist, "r"); - dirty = 0; - if (fil) { - if (!lfil) dirty = 1; - } else { - if (!lfil) return; - fil = lfil; - lfil = NULL; - } - while (NULL != fgets(line, sizeof line, fil)) { - if (!dirty && lfil - && (fgets(lline, sizeof lline, lfil) == NULL - || strcmp(line, lline) != 0)) { - dirty = 1; - } - if (line[0] != '#') { - func(line); - } - } - if (fil) fclose(fil); - if (lfil) fclose(lfil); - if (dirty) { - fil = fopen(hostlist, "r"); - if (fil) { - lfil = fopen(localhostlist, "w"); - if (lfil) { - while( EOF != (i = getc(fil)) ) { /* copy file to local file */ - putc(i, lfil); - } - fclose(lfil); - } - fclose(fil); - } - } -} - -static char *service; -static char *crit; -static char *input; -static int finished; -static int home; -static char hostport[128]; -static char *instr; -static int instr_len; -static char *host; -static int host_len; -static int port; - -void findCrit(char *line) { - char *colon; - int i; - - if (getItem(line, crit, input, 0) != NULL) { - hostport[0]='\0'; - if (getItem(line, service, hostport, sizeof hostport) != NULL) { - instr[0] = '\0'; - if (finished == 0) { - getItem(line, "instr", instr, instr_len); - } - colon = strchr(hostport, ':'); - if (colon) { - i = atoi(colon+1); - if (i > 0) { - *colon='\0'; - if (finished == 0) { - snprintf(host, host_len, "%s", hostport); - port = i; - } - finished++; - if (getItem(line, "host", getenv("HOST"), 0) != NULL) { - home = 1; - } - } - } - } - } -} - -int InstrHost(char *serviceArg, char *inputArg, char *instrArg, int instr_lenArg, - char *hostArg, int host_lenArg, int *portArg) { - service = serviceArg; - input = inputArg; - instr = instrArg; - instr_len = instr_lenArg; - host = hostArg; - host_len = host_lenArg; - port = 0; - home = 0; - finished = 0; - - if (input == NULL || input[0] <= ' ') { - crit = "host"; - input = getenv("HOST"); - } else { - crit = "instr"; - } - - scanHostList(findCrit); - - *portArg = port; - return home * finished; -} - -static char *list; -static int list_len; - -void listInstr(char *line) { - int l; - *list='\0'; - if (getItem(line, service, "", 0) && - getItem(line, "instr", list, list_len)) { - l = strlen(list); - list += l; - list_len -= l; - } else if (line[0] > ' ') { - return; - } - if (list_len > 0) { - *list = ' '; - list++; - list_len--; - } -} - -void InstrList(char *serviceArg, char *listArg, int list_lenArg) { - service = serviceArg; - list = listArg; - list_len = list_lenArg; - scanHostList(listInstr); - if (list > listArg) list--; /* remove trailing blank */ - *list = '\0'; -} - -#ifdef MYC_FORTRAN -/* compile only when fortran c interface stuff is defined */ - -#include "myc_fortran.h" - -int F_FUN(instr_host)(F_CHAR(service), F_CHAR(input), F_CHAR(instr), F_CHAR(host), int *port - , int service_len, int input_len, int instr_len, int host_len) { - char buf[256], in[256], ho[256], sv[256]; - int iRet; - - STR_TO_C(sv, service); - STR_TO_C(buf, input); - iRet=InstrHost(sv, buf, in, sizeof(in), ho, sizeof(ho), port); - if (*port>0) { - STR_TO_F(instr, in); - STR_TO_F(host, ho); - } - return iRet; -} - -#endif diff --git a/tecs/instr_hosts.h b/tecs/instr_hosts.h deleted file mode 100644 index 1acb0fa..0000000 --- a/tecs/instr_hosts.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _INSTR_HOSTS_H_ -#define _INSTR_HOSTS_H_ - -int InstrHost(char *service, char *input, char *instr, int instr_len, - char *host, int host_len, int *port); -/* service (in) is a service name (tecs, sics, sea) - input (in) may be a host or instrument name - instr (out) is the instrument name - host (out) is the host name - port (out) is the port name - the return value is 1, called from a computer related to the instrument, - 0 else -*/ - -void InstrList(char *service, char *list, int list_len); -/* get an instrument list supporting named service, separated with blanks */ - -#endif /* _INSTR_HOSTS_H_ */ diff --git a/tecs/keep_running.c b/tecs/keep_running.c deleted file mode 100644 index d4264ad..0000000 --- a/tecs/keep_running.c +++ /dev/null @@ -1,50 +0,0 @@ -#include -#include -#include -#include -#include - -#define MAX_CNT 10 -#define MIN_PERIOD 3600 - -int main(int argc, char *argv[]) { - int cnt, dif; - time_t tim1, tim2; - pid_t pid; - int status; - - if (argc<2) return 0; - cnt = MAX_CNT; - while (cnt > 0) { - time(&tim1); - pid=vfork(); - if (pid == 0) { - execvp(argv[1], argv+1); - printf("%s\n", argv[1]); - perror("execvp"); - exit(1); - } - waitpid(pid, &status, 0); - if (status==512) { /* kill */ - return 0; - } - if (status==256) { /* restart */ - cnt = MAX_CNT; - } - time(&tim2); - dif = (int) difftime(tim2, tim1); - cnt += dif / MIN_PERIOD; - if (cnt > MAX_CNT) cnt = MAX_CNT; - cnt--; - if (dif < MIN_PERIOD) { - printf("Status=%d. Died after %d sec", status, dif); - } else { - printf("Status=%d. Died after %f hours", status, dif/3600.); - } - if (cnt > 0) { - printf(" - %d tries left - retry ...\n", cnt); - } - } - printf(" - too many restarts\n"); - return -1; -} diff --git a/tecs/killtecs b/tecs/killtecs deleted file mode 100755 index feb0121..0000000 --- a/tecs/killtecs +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/tcsh -if ("$1" == "") then - set ini="tecs.ini" -else - set ini="tecs_$1.ini" -endif -cd ~/tecs -if (! -e $ini) then - echo ~/tecs/$ini not found - echo "" - set all=(tecs*.ini) - echo "Usage:" - echo "" - if ("$all" == "tecs.ini") then - echo " killtecs" - else - echo " killtecs " - echo "" - echo "where is one of" - echo "" - echo ${all:as/tecs_//:as/.ini//} - endif - exit -endif -set nums=`ps x | grep "TecsServer $ini" | grep -v grep | cut -b 0-6` -if ("$nums" == "") then - echo "TecsServer $1 is not running" -else - kill -9 $nums - echo "TecsServer $1 killed (processes $nums)" -endif - diff --git a/tecs/macosx_def b/tecs/macosx_def deleted file mode 100644 index 12232cb..0000000 --- a/tecs/macosx_def +++ /dev/null @@ -1,7 +0,0 @@ -#DFORTIFY= -DFORTIFY -#FORTIFYOBJ= fortify.o strdup.o - -MFLAGS=-f makefile_macosx$(DUMMY) - -#HDFROOT= - diff --git a/tecs/make_crv b/tecs/make_crv deleted file mode 100644 index a444b97..0000000 --- a/tecs/make_crv +++ /dev/null @@ -1,665 +0,0 @@ - -$(CFGDIR)c020415.crv: ccrv inp/c020415.inp - $Q -p$(CFGDIR) - -$(CFGDIR)c030307.crv: ccrv inp/c030307.inp - $Q -p$(CFGDIR) - -$(CFGDIR)c030311.crv: ccrv inp/c030311.inp - $Q -p$(CFGDIR) - -$(CFGDIR)c12900.crv: ccrv inp/c12900.inp - $Q -p$(CFGDIR) - -$(CFGDIR)c17844.crv: ccrv inp/c17844.inp - $Q -p$(CFGDIR) - -$(CFGDIR)c_1.crv: ccrv inp/c_1.inp - $Q -p$(CFGDIR) - -$(CFGDIR)c1.crv: ccrv inp/c1.inp - $Q -p$(CFGDIR) - -$(CFGDIR)c_2.crv: ccrv inp/c_2.inp - $Q -p$(CFGDIR) - -$(CFGDIR)c2.crv: ccrv inp/c2.inp - $Q -p$(CFGDIR) - -$(CFGDIR)c_3.crv: ccrv inp/c_3.inp - $Q -p$(CFGDIR) - -$(CFGDIR)c_4.crv: ccrv inp/c_4.inp - $Q -p$(CFGDIR) - -$(CFGDIR)c9r1al.crv: ccrv inp/c9r1al.inp - $Q -p$(CFGDIR) - -$(CFGDIR)c9r2ol.crv: ccrv inp/c9r2ol.inp - $Q -p$(CFGDIR) - -$(CFGDIR)c9r3tc.crv: ccrv inp/c9r3tc.inp - $Q -p$(CFGDIR) - -$(CFGDIR)c9r4bc.crv: ccrv inp/c9r4bc.inp - $Q -p$(CFGDIR) - -$(CFGDIR)cab505.crv: ccrv inp/cab505.inp - $Q -p$(CFGDIR) - -$(CFGDIR)c_ab.crv: ccrv inp/c_ab.inp - $Q -p$(CFGDIR) - -$(CFGDIR)ccs130.crv: ccrv inp/ccs130.inp - $Q -p$(CFGDIR) - -$(CFGDIR)c_ill.crv: ccrv inp/c_ill.inp - $Q -p$(CFGDIR) - -$(CFGDIR)cma02.crv: ccrv inp/cma02.inp - $Q -p$(CFGDIR) - -$(CFGDIR)cma11.crv: ccrv inp/cma11.inp - $Q -p$(CFGDIR) - -$(CFGDIR)cma11r1al.crv: ccrv inp/cma11r1al.inp - $Q -p$(CFGDIR) - -$(CFGDIR)cma11r2ol.crv: ccrv inp/cma11r2ol.inp - $Q -p$(CFGDIR) - -$(CFGDIR)cma11r3lc.crv: ccrv inp/cma11r3lc.inp - $Q -p$(CFGDIR) - -$(CFGDIR)cma11r4rc.crv: ccrv inp/cma11r4rc.inp - $Q -p$(CFGDIR) - -$(CFGDIR)cma6.crv: ccrv inp/cma6.inp - $Q -p$(CFGDIR) - -$(CFGDIR)cma7.crv: ccrv inp/cma7.inp - $Q -p$(CFGDIR) - -$(CFGDIR)cplus45.crv: ccrv inp/cplus45.inp - $Q -p$(CFGDIR) - -$(CFGDIR)cplus70.crv: ccrv inp/cplus70.inp - $Q -p$(CFGDIR) - -$(CFGDIR)cs405.crv: ccrv inp/cs405.inp - $Q -p$(CFGDIR) - -$(CFGDIR)c_t.crv: ccrv inp/c_t.inp - $Q -p$(CFGDIR) - -$(CFGDIR)d69874.crv: ccrv inp/d69874.inp - $Q -p$(CFGDIR) - -$(CFGDIR)ds3b.crv: ccrv inp/ds3b.inp - $Q -p$(CFGDIR) - -$(CFGDIR)dt-470.crv: ccrv inp/dt-470.inp - $Q -p$(CFGDIR) - -$(CFGDIR)g24741.crv: ccrv inp/g24741.inp - $Q -p$(CFGDIR) - -$(CFGDIR)g25328.crv: ccrv inp/g25328.inp - $Q -p$(CFGDIR) - -$(CFGDIR)g25550.crv: ccrv inp/g25550.inp - $Q -p$(CFGDIR) - -$(CFGDIR)g26550.crv: ccrv inp/g26550.inp - $Q -p$(CFGDIR) - -$(CFGDIR)g26552.crv: ccrv inp/g26552.inp - $Q -p$(CFGDIR) - -$(CFGDIR)gemark.crv: ccrv inp/gemark.inp - $Q -p$(CFGDIR) - -$(CFGDIR)ln2a.crv: ccrv inp/ln2a.inp - $Q -p$(CFGDIR) - -$(CFGDIR)ln2b.crv: ccrv inp/ln2b.inp - $Q -p$(CFGDIR) - -$(CFGDIR)ln2.crv: ccrv inp/ln2.inp - $Q -p$(CFGDIR) - -$(CFGDIR)mz020124.crv: ccrv inp/mz020124.inp - $Q -p$(CFGDIR) - -$(CFGDIR)mz030500.crv: ccrv inp/mz030500.inp - $Q -p$(CFGDIR) - -$(CFGDIR)pcry.crv: ccrv inp/pcry.inp - $Q -p$(CFGDIR) - -$(CFGDIR)psam.crv: ccrv inp/psam.inp - $Q -p$(CFGDIR) - -$(CFGDIR)pt100e.crv: ccrv inp/pt100e.inp - $Q -p$(CFGDIR) - -$(CFGDIR)pt_ill.crv: ccrv inp/pt_ill.inp - $Q -p$(CFGDIR) - -$(CFGDIR)r10401.crv: ccrv inp/r10401.inp - $Q -p$(CFGDIR) - -$(CFGDIR)r10402.crv: ccrv inp/r10402.inp - $Q -p$(CFGDIR) - -$(CFGDIR)r10403.crv: ccrv inp/r10403.inp - $Q -p$(CFGDIR) - -$(CFGDIR)r10409.crv: ccrv inp/r10409.inp - $Q -p$(CFGDIR) - -$(CFGDIR)r10410.crv: ccrv inp/r10410.inp - $Q -p$(CFGDIR) - -$(CFGDIR)r10411.crv: ccrv inp/r10411.inp - $Q -p$(CFGDIR) - -$(CFGDIR)r10413.crv: ccrv inp/r10413.inp - $Q -p$(CFGDIR) - -$(CFGDIR)r3509.crv: ccrv inp/r3509.inp - $Q -p$(CFGDIR) - -$(CFGDIR)r3510.crv: ccrv inp/r3510.inp - $Q -p$(CFGDIR) - -$(CFGDIR)rhfe0734.crv: ccrv inp/rhfe0734.inp - $Q -p$(CFGDIR) - -$(CFGDIR)rhfe4140.crv: ccrv inp/rhfe4140.inp - $Q -p$(CFGDIR) - -$(CFGDIR)rhfe705.crv: ccrv inp/rhfe705.inp - $Q -p$(CFGDIR) - -$(CFGDIR)rhfe8119.crv: ccrv inp/rhfe8119.inp - $Q -p$(CFGDIR) - -$(CFGDIR)rhfe8244.crv: ccrv inp/rhfe8244.inp - $Q -p$(CFGDIR) - -$(CFGDIR)rhfe8733.crv: ccrv inp/rhfe8733.inp - $Q -p$(CFGDIR) - -$(CFGDIR)ruox.crv: ccrv inp/ruox.inp - $Q -p$(CFGDIR) - -$(CFGDIR)rx1611.crv: ccrv inp/rx1611.inp - $Q -p$(CFGDIR) - -$(CFGDIR)rx1976.crv: ccrv inp/rx1976.inp - $Q -p$(CFGDIR) - -$(CFGDIR)rxdil.crv: ccrv inp/rxdil.inp - $Q -p$(CFGDIR) - -$(CFGDIR)std1.crv: ccrv inp/std1.inp - $Q -p$(CFGDIR) - -$(CFGDIR)std4.crv: ccrv inp/std4.inp - $Q -p$(CFGDIR) - -$(CFGDIR)std6.crv: ccrv inp/std6.inp - $Q -p$(CFGDIR) - -$(CFGDIR)type_c.crv: ccrv inp/type_c.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x09629.crv: ccrv inp/x09629.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x09882.crv: ccrv inp/x09882.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x09883.crv: ccrv inp/x09883.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x09941.crv: ccrv inp/x09941.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x10045.crv: ccrv inp/x10045.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x10045m.crv: ccrv inp/x10045m.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x10409.crv: ccrv inp/x10409.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x12532.crv: ccrv inp/x12532.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x12533.crv: ccrv inp/x12533.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x12905.crv: ccrv inp/x12905.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x13089.crv: ccrv inp/x13089.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x13090.crv: ccrv inp/x13090.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x14126.crv: ccrv inp/x14126.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x14130.crv: ccrv inp/x14130.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x14231.crv: ccrv inp/x14231.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x14667.crv: ccrv inp/x14667.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x15430.crv: ccrv inp/x15430.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x15445.crv: ccrv inp/x15445.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x15601.crv: ccrv inp/x15601.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x17627.crv: ccrv inp/x17627.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x2060.crv: ccrv inp/x2060.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x22637.crv: ccrv inp/x22637.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x22642.crv: ccrv inp/x22642.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x22643.crv: ccrv inp/x22643.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x22644.crv: ccrv inp/x22644.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x22644k.crv: ccrv inp/x22644k.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x23167.crv: ccrv inp/x23167.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x24506.crv: ccrv inp/x24506.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x29630.crv: ccrv inp/x29630.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x29746.crv: ccrv inp/x29746.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x31254.crv: ccrv inp/x31254.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x31317.crv: ccrv inp/x31317.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x31318.crv: ccrv inp/x31318.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x31319.crv: ccrv inp/x31319.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x31320.crv: ccrv inp/x31320.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x33924.crv: ccrv inp/x33924.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x34504.crv: ccrv inp/x34504.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x34524.crv: ccrv inp/x34524.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x34525.crv: ccrv inp/x34525.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x34526.crv: ccrv inp/x34526.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x37342.crv: ccrv inp/x37342.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x37346.crv: ccrv inp/x37346.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x38604.crv: ccrv inp/x38604.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x38622.crv: ccrv inp/x38622.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x40188.crv: ccrv inp/x40188.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x48581.crv: ccrv inp/x48581.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x50830.crv: ccrv inp/x50830.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x50903.crv: ccrv inp/x50903.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x50921.crv: ccrv inp/x50921.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x50923.crv: ccrv inp/x50923.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x50991.crv: ccrv inp/x50991.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x51079.crv: ccrv inp/x51079.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x55606.crv: ccrv inp/x55606.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x55918.crv: ccrv inp/x55918.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x58599.crv: ccrv inp/x58599.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x58600.crv: ccrv inp/x58600.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x68061.crv: ccrv inp/x68061.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x68258.crv: ccrv inp/x68258.inp - $Q -p$(CFGDIR) - -$(CFGDIR)x68433.crv: ccrv inp/x68433.inp - $Q -p$(CFGDIR) - -$(CFGDIR)z030114.crv: ccrv inp/z030114.inp - $Q -p$(CFGDIR) - -all_crv: dev.list \ - $(CFGDIR)c020415.crv \ - $(CFGDIR)c030307.crv \ - $(CFGDIR)c030311.crv \ - $(CFGDIR)c12900.crv \ - $(CFGDIR)c17844.crv \ - $(CFGDIR)c_1.crv \ - $(CFGDIR)c1.crv \ - $(CFGDIR)c_2.crv \ - $(CFGDIR)c2.crv \ - $(CFGDIR)c_3.crv \ - $(CFGDIR)c_4.crv \ - $(CFGDIR)c9r1al.crv \ - $(CFGDIR)c9r2ol.crv \ - $(CFGDIR)c9r3tc.crv \ - $(CFGDIR)c9r4bc.crv \ - $(CFGDIR)cab505.crv \ - $(CFGDIR)c_ab.crv \ - $(CFGDIR)ccs130.crv \ - $(CFGDIR)c_ill.crv \ - $(CFGDIR)cma02.crv \ - $(CFGDIR)cma11.crv \ - $(CFGDIR)cma11r1al.crv \ - $(CFGDIR)cma11r2ol.crv \ - $(CFGDIR)cma11r3lc.crv \ - $(CFGDIR)cma11r4rc.crv \ - $(CFGDIR)cma6.crv \ - $(CFGDIR)cma7.crv \ - $(CFGDIR)cplus45.crv \ - $(CFGDIR)cplus70.crv \ - $(CFGDIR)cs405.crv \ - $(CFGDIR)c_t.crv \ - $(CFGDIR)d69874.crv \ - $(CFGDIR)ds3b.crv \ - $(CFGDIR)dt-470.crv \ - $(CFGDIR)g24741.crv \ - $(CFGDIR)g25328.crv \ - $(CFGDIR)g25550.crv \ - $(CFGDIR)g26550.crv \ - $(CFGDIR)g26552.crv \ - $(CFGDIR)gemark.crv \ - $(CFGDIR)ln2a.crv \ - $(CFGDIR)ln2b.crv \ - $(CFGDIR)ln2.crv \ - $(CFGDIR)mz020124.crv \ - $(CFGDIR)mz030500.crv \ - $(CFGDIR)pcry.crv \ - $(CFGDIR)psam.crv \ - $(CFGDIR)pt100e.crv \ - $(CFGDIR)pt_ill.crv \ - $(CFGDIR)r10401.crv \ - $(CFGDIR)r10402.crv \ - $(CFGDIR)r10403.crv \ - $(CFGDIR)r10409.crv \ - $(CFGDIR)r10410.crv \ - $(CFGDIR)r10411.crv \ - $(CFGDIR)r10413.crv \ - $(CFGDIR)r3509.crv \ - $(CFGDIR)r3510.crv \ - $(CFGDIR)rhfe0734.crv \ - $(CFGDIR)rhfe4140.crv \ - $(CFGDIR)rhfe705.crv \ - $(CFGDIR)rhfe8119.crv \ - $(CFGDIR)rhfe8244.crv \ - $(CFGDIR)rhfe8733.crv \ - $(CFGDIR)ruox.crv \ - $(CFGDIR)rx1611.crv \ - $(CFGDIR)rx1976.crv \ - $(CFGDIR)rxdil.crv \ - $(CFGDIR)std1.crv \ - $(CFGDIR)std4.crv \ - $(CFGDIR)std6.crv \ - $(CFGDIR)type_c.crv \ - $(CFGDIR)x09629.crv \ - $(CFGDIR)x09882.crv \ - $(CFGDIR)x09883.crv \ - $(CFGDIR)x09941.crv \ - $(CFGDIR)x10045.crv \ - $(CFGDIR)x10045m.crv \ - $(CFGDIR)x10409.crv \ - $(CFGDIR)x12532.crv \ - $(CFGDIR)x12533.crv \ - $(CFGDIR)x12905.crv \ - $(CFGDIR)x13089.crv \ - $(CFGDIR)x13090.crv \ - $(CFGDIR)x14126.crv \ - $(CFGDIR)x14130.crv \ - $(CFGDIR)x14231.crv \ - $(CFGDIR)x14667.crv \ - $(CFGDIR)x15430.crv \ - $(CFGDIR)x15445.crv \ - $(CFGDIR)x15601.crv \ - $(CFGDIR)x17627.crv \ - $(CFGDIR)x2060.crv \ - $(CFGDIR)x22637.crv \ - $(CFGDIR)x22642.crv \ - $(CFGDIR)x22643.crv \ - $(CFGDIR)x22644.crv \ - $(CFGDIR)x22644k.crv \ - $(CFGDIR)x23167.crv \ - $(CFGDIR)x24506.crv \ - $(CFGDIR)x29630.crv \ - $(CFGDIR)x29746.crv \ - $(CFGDIR)x31254.crv \ - $(CFGDIR)x31317.crv \ - $(CFGDIR)x31318.crv \ - $(CFGDIR)x31319.crv \ - $(CFGDIR)x31320.crv \ - $(CFGDIR)x33924.crv \ - $(CFGDIR)x34504.crv \ - $(CFGDIR)x34524.crv \ - $(CFGDIR)x34525.crv \ - $(CFGDIR)x34526.crv \ - $(CFGDIR)x37342.crv \ - $(CFGDIR)x37346.crv \ - $(CFGDIR)x38604.crv \ - $(CFGDIR)x38622.crv \ - $(CFGDIR)x40188.crv \ - $(CFGDIR)x48581.crv \ - $(CFGDIR)x50830.crv \ - $(CFGDIR)x50903.crv \ - $(CFGDIR)x50921.crv \ - $(CFGDIR)x50923.crv \ - $(CFGDIR)x50991.crv \ - $(CFGDIR)x51079.crv \ - $(CFGDIR)x55606.crv \ - $(CFGDIR)x55918.crv \ - $(CFGDIR)x58599.crv \ - $(CFGDIR)x58600.crv \ - $(CFGDIR)x68061.crv \ - $(CFGDIR)x68258.crv \ - $(CFGDIR)x68433.crv \ - $(CFGDIR)z030114.crv \ - -ALLINP= \ -inp/c020415.inp \ -inp/c030307.inp \ -inp/c030311.inp \ -inp/c12900.inp \ -inp/c17844.inp \ -inp/c_1.inp \ -inp/c1.inp \ -inp/c_2.inp \ -inp/c2.inp \ -inp/c_3.inp \ -inp/c_4.inp \ -inp/c9r1al.inp \ -inp/c9r2ol.inp \ -inp/c9r3tc.inp \ -inp/c9r4bc.inp \ -inp/cab505.inp \ -inp/c_ab.inp \ -inp/ccs130.inp \ -inp/c_ill.inp \ -inp/cma02.inp \ -inp/cma11.inp \ -inp/cma11r1al.inp \ -inp/cma11r2ol.inp \ -inp/cma11r3lc.inp \ -inp/cma11r4rc.inp \ -inp/cma6.inp \ -inp/cma7.inp \ -inp/cplus45.inp \ -inp/cplus70.inp \ -inp/cs405.inp \ -inp/c_t.inp \ -inp/d69874.inp \ -inp/ds3b.inp \ -inp/dt-470.inp \ -inp/g24741.inp \ -inp/g25328.inp \ -inp/g25550.inp \ -inp/g26550.inp \ -inp/g26552.inp \ -inp/gemark.inp \ -inp/ln2a.inp \ -inp/ln2b.inp \ -inp/ln2.inp \ -inp/mz020124.inp \ -inp/mz030500.inp \ -inp/pcry.inp \ -inp/psam.inp \ -inp/pt100e.inp \ -inp/pt_ill.inp \ -inp/r10401.inp \ -inp/r10402.inp \ -inp/r10403.inp \ -inp/r10409.inp \ -inp/r10410.inp \ -inp/r10411.inp \ -inp/r10413.inp \ -inp/r3509.inp \ -inp/r3510.inp \ -inp/rhfe0734.inp \ -inp/rhfe4140.inp \ -inp/rhfe705.inp \ -inp/rhfe8119.inp \ -inp/rhfe8244.inp \ -inp/rhfe8733.inp \ -inp/ruox.inp \ -inp/rx1611.inp \ -inp/rx1976.inp \ -inp/rxdil.inp \ -inp/std1.inp \ -inp/std4.inp \ -inp/std6.inp \ -inp/type_c.inp \ -inp/x09629.inp \ -inp/x09882.inp \ -inp/x09883.inp \ -inp/x09941.inp \ -inp/x10045.inp \ -inp/x10045m.inp \ -inp/x10409.inp \ -inp/x12532.inp \ -inp/x12533.inp \ -inp/x12905.inp \ -inp/x13089.inp \ -inp/x13090.inp \ -inp/x14126.inp \ -inp/x14130.inp \ -inp/x14231.inp \ -inp/x14667.inp \ -inp/x15430.inp \ -inp/x15445.inp \ -inp/x15601.inp \ -inp/x17627.inp \ -inp/x2060.inp \ -inp/x22637.inp \ -inp/x22642.inp \ -inp/x22643.inp \ -inp/x22644.inp \ -inp/x22644k.inp \ -inp/x23167.inp \ -inp/x24506.inp \ -inp/x29630.inp \ -inp/x29746.inp \ -inp/x31254.inp \ -inp/x31317.inp \ -inp/x31318.inp \ -inp/x31319.inp \ -inp/x31320.inp \ -inp/x33924.inp \ -inp/x34504.inp \ -inp/x34524.inp \ -inp/x34525.inp \ -inp/x34526.inp \ -inp/x37342.inp \ -inp/x37346.inp \ -inp/x38604.inp \ -inp/x38622.inp \ -inp/x40188.inp \ -inp/x48581.inp \ -inp/x50830.inp \ -inp/x50903.inp \ -inp/x50921.inp \ -inp/x50923.inp \ -inp/x50991.inp \ -inp/x51079.inp \ -inp/x55606.inp \ -inp/x55918.inp \ -inp/x58599.inp \ -inp/x58600.inp \ -inp/x68061.inp \ -inp/x68258.inp \ -inp/x68433.inp \ -inp/z030114.inp \ - diff --git a/tecs/make_crv.tcsh b/tecs/make_crv.tcsh deleted file mode 100755 index 494eac0..0000000 --- a/tecs/make_crv.tcsh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/tcsh -set src=${1:h} -set files=($src/*.inp) -echo " " >! make_crv -set cfg="" -foreach file ($files) - set sens=${file:t:s/.inp//} - echo '$(CFGDIR)'"$sens.crv: ccrv inp/$sens.inp" >> make_crv - echo ' $Q -p$(CFGDIR)' >> make_crv - echo '' >> make_crv -end -echo "all_crv: dev.list \" >> make_crv -foreach file ($files) - set sens=${file:t:s/.inp//} - echo ' $(CFGDIR)'"$sens.crv \" >> make_crv -end -echo '' >> make_crv -echo "ALLINP= \" >> make_crv -foreach file ($files) - set sens=${file:t:s/.inp//} - echo "inp/$sens.inp \" >> make_crv -end -echo '' >> make_crv - diff --git a/tecs/make_gen b/tecs/make_gen deleted file mode 100644 index 4c6dacf..0000000 --- a/tecs/make_gen +++ /dev/null @@ -1,87 +0,0 @@ -#--------------------------------------------------------------------------- -# Makefile (sytem independent part) for the TECS Client library and TecsServer -# included in a machine-specific makefile -# -# Markus Zolliker, March 2003 -#-------------------------------------------------------------------------- - -.SUFFIXES: -.SUFFIXES: .o .c .f - -LIBR_OBJ =coc_util.o myc_err.o myc_str.o myc_buf.o myc_time.o -SERV_OBJ =tecs.o coc_server.o tecs_lsc.o tecs_serial.o coc_logfile.o \ - tecs_data.o tecs_logger.o uselect.o $(LIBR_OBJ) -CLI_OBJ =tecs_cli.o coc_client.o $(LIBR_OBJ) -TCLI_OBJ =sys_getenv.o sys_env.o myc_tmp.o sys_cmdpar.o \ - sys_date.o sys_wait.o sys_lun.o sys_rdline.o uselect.o \ - sys_get_key.o sys_unix.o sys_open$(SYS_OPEN).o \ - $(CLI_OBJ) -TECLI_OBJ =tecs_client.o tecs_plot.o str.o instr_hosts.o \ - $(TCLI_OBJ) - -HARDSUPLIB = ../hardsup/libhlib.a - -OBJ = $(SERV_OBJ) $(TECLI_OBJ) - -libtecsl.a: $(CLI_OBJ) - rm -f $@ - $(AR) $(ARFLAGS) $@ $Q - ranlib libtecsl.a - -all: libtecsl.a TecsServer TecsClient keep_running six - -CFGDIR=/afs/psi.ch/project/sinq/common/lib/tecs/cfg/ - --include make_crv - -make_crv: make_crv.tcsh inp/lsc.codes $(ALLINP) - make_crv.tcsh inp/lsc.codes - -dev.list: - make_list.tcsh $(CFGDIR)*.cfg > $@ - cp $@ $(CFGDIR) - -# use target all_crv to make all curves in inp directory - -TecsServer: $(SERV_OBJ) $(HARDSUPLIB) $(FORTIFYOBJ) - $(CC) $(CFLAGS) -o $@ $Q -lm - -lsc331: lsc331.o coc_server.o tecs_lsc.o tecs_serial.o coc_logfile.o \ - $(LIBR_OBJ) $(HARDSUPLIB) $(FORTIFYOBJ) - $(CC) $(CFLAGS) -o $@ $Q -lm - -TecsClient: $(TECLI_OBJ) $(FORTIFYOBJ) pg_plus/libpgplus.a - $(FC) -o $@ $Q $(PGLIB) $(RDLIB) - -instr_hosts.o: instr_hosts.c - $(CC) $(CFLAGS) -DMYC_FORTRAN -c $Q - -$(HARDSUPLIB): - cd ../hardsup; make $(MFLAGS) libhlib.a - -# -- for tascom -- -libtecs.so: tecs_c.c $(CLI_OBJ) $(FORTIFYOBJ) - $(CC) $(CFLAGS) -shared -o $@ $Q - -ccrv: conv.f sys_cmdpar.o str.o cvt.o - $(FC) $(FFLAGS) -o ccrv $Q - -# -- needs special include -tecs_serial.o: tecs_serial.c - $(CC) $(CFLAGS) -I../hardsup -c $Q - -keep_running: keep_running.c - $(CC) $(CFLAGS) -o $@ $Q $(FORTIFYOBJ) - -six: six.c term.o sys_select.o libtecsl.a instr_hosts.o uselect.o - $(CC) $(CFLAGS) -o $@ $Q $(FORTIFYOBJ) - -rexstart: rstart.c myc_str.o myc_err.o instr_hosts.o - $(CC) $(CFLAGS) -o $@ $Q $(FORTIFYOBJ) - @ echo "$(PWD)/rstart" - -pg_plus/libpgplus.a: - cd pg_plus; make $(MFLAGS) - -clean: - rm -f *.o *.a *.d six keep_running TecsServer TecsClient diff --git a/tecs/make_list.tcsh b/tecs/make_list.tcsh deleted file mode 100755 index afd984d..0000000 --- a/tecs/make_list.tcsh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/tcsh -printf "\n\n" -foreach file ($*) - set nam=${file:t:s/.cfg//} - set def="`grep "dev=" $file`" - alias def "set $def" - if ("$def" != "") then - def - printf "%-10s %s\n" $nam "$dev" - endif -end diff --git a/tecs/makefile b/tecs/makefile deleted file mode 100644 index 03dfa3a..0000000 --- a/tecs/makefile +++ /dev/null @@ -1,21 +0,0 @@ -# M. Zolliker 03.2005 - -%: usage - @echo - -%.o: usage - @echo - -default: usage - -usage: - @ echo "" - @ echo "Usage:" - @ echo "" - @ echo " make -f makefile_xxx [target]" - @ echo "" - @ echo ' where makefile_xxx is one of' - @ echo "" - @ ls -1 makefile_* | pr -t -o 4 - - diff --git a/tecs/makefile_alpha b/tecs/makefile_alpha deleted file mode 100644 index 6ea743a..0000000 --- a/tecs/makefile_alpha +++ /dev/null @@ -1,36 +0,0 @@ -#--------------------------------------------------------------------------- -# Makefile for the TECS Client library and TecsServer -# machine-dependent part for Tru64 Unix -# -# Markus Zolliker, March 2003 -#-------------------------------------------------------------------------- - -include ../../alpha_def - -CC = cc -FC = f77 -CFLAGS = -std1 -g -warnprotos $(DFORTIFY) -FFLAGS = -u -g -ARFLAGS = cr - -# -- system dependent routines -SYS_OPEN = _alpha - -# -- PGPLOT library additions -PGLIB = -L/usr/X11R6/lib -lX11 - -# -- readline library -RDLIB =-lreadline -ltermcap - -# -- the following macros are used as a replacement for some automatic variables -# due to different make versions. -# This is for Tru64 standard make. -# -# list of prerequisites including paths for VPATH -Q=$> - -# Fortran/C source file name -F=$*.f -C=$*.c - -include make_gen diff --git a/tecs/makefile_linux b/tecs/makefile_linux deleted file mode 100644 index fd7acc8..0000000 --- a/tecs/makefile_linux +++ /dev/null @@ -1,43 +0,0 @@ -#--------------------------------------------------------------------------- -# Makefile options for the TECS Client library and TecsServer -# machine-dependent part for Redhat Linux with AFS at PSI -# -# Markus Zolliker, March 2003 -#-------------------------------------------------------------------------- - -include $(SICSROOT)/sics/linux_def - -SICS=.. - -CC = gcc -FC = g77 -CFLAGS = -DLINUX -g $(DFORTIFY) -I$(SICSROOT)/sics -I. -Wall -Wno-missing-braces -MMD -FFLAGS = -Wimplicit -g -ARFLAGS = cr - -# -- system dependent routines - -# -- PGPLOT library additions -PGLIB = -L/usr/X11R6/lib -lX11 - -# -- library for ASYNSRV -HARDSUPLIB=../hardsup/libhlib.a - -# -- readline library -RDLIB =-lreadline -ltermcap - -# -- the following macros are used as a replacement for some automatic variables -# due to different make versions. -# This is for GNU make. -# -# list of prerequisites including paths for VPATH -Q=$^ - -# Fortran/C source file name -F=$< -C=$< - -include make_gen - --include $(OBJ:.o=.d) - diff --git a/tecs/makefile_macosx b/tecs/makefile_macosx deleted file mode 100644 index be96310..0000000 --- a/tecs/makefile_macosx +++ /dev/null @@ -1,39 +0,0 @@ -#--------------------------------------------------------------------------- -# Makefile options for the TECS Client library and TecsServer -# machine-dependent part for Redhat Linux with AFS at PSI -# -# Markus Zolliker, March 2003 -#-------------------------------------------------------------------------- - -include macosx_def - -CC = clang -FC = g77 -CFLAGS = -DLINUX -I.. -I../.. -g $(DFORTIFY) -FFLAGS = -Wimplicit -g -ARFLAGS = cr - -# -- system dependent routines - -# -- PGPLOT library additions -PGLIB = -L/usr/X11R6/lib -lX11 -L/sw/lib -lpng \ - -Wl,-framework -Wl,Foundation -Wl,-framework -Wl,AppKit -lcc_dynamic - -# -- library for ASYNSRV -HARDSUPLIB=../hardsup/libhlib.a - -# -- readline library -RDLIB =-lreadline - -# -- the following macros are used as a replacement for some automatic variables -# due to different make versions. -# This is for GNU make. -# -# list of prerequisites including paths for VPATH -Q=$^ - -# Fortran/C source file name -F=$< -C=$< - -include make_gen diff --git a/tecs/makefile_slinux b/tecs/makefile_slinux deleted file mode 100644 index 50c3c46..0000000 --- a/tecs/makefile_slinux +++ /dev/null @@ -1,40 +0,0 @@ -#--------------------------------------------------------------------------- -# Makefile options for the TECS Client library and TecsServer -# machine-dependent part for Redhat Linux with AFS at PSI -# -# Markus Zolliker, March 2003 -#-------------------------------------------------------------------------- - -include ../../sllinux_def - -SICS=.. - -CC = gcc -FC = g77 -CFLAGS = -DLINUX -g $(DFORTIFY) -I../.. -I.. -I. -Wall -Wno-missing-braces -FFLAGS = -Wimplicit -g -ARFLAGS = cr - -# -- system dependent routines - -# -- PGPLOT library additions -PGLIB = -L/usr/X11R6/lib -lX11 - -# -- library for ASYNSRV -HARDSUPLIB=../hardsup/libhlib.a - -# -- readline library -RDLIB =-lreadline -ltermcap - -# -- the following macros are used as a replacement for some automatic variables -# due to different make versions. -# This is for GNU make. -# -# list of prerequisites including paths for VPATH -Q=$^ - -# Fortran/C source file name -F=$< -C=$< - -include make_gen diff --git a/tecs/myc_buf.c b/tecs/myc_buf.c deleted file mode 100644 index c3f5767..0000000 --- a/tecs/myc_buf.c +++ /dev/null @@ -1,319 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "myc_err.h" -#include "myc_str.h" -#include "myc_buf.h" - -char *StrNGet(StrBuf *buf, char *result, int reslen, int sep) { - char *b, *f, *e, quote; - int l; - - if (buf->rdpos < 0 || buf->rdpos >= buf->dsize || buf->buf==NULL) - ERR_MSG("buffer corrupt"); - b=buf->buf + buf->rdpos; - if (*b=='"' || *b=='\'') { /* take string within quotes (single or double) */ - quote=*b; b++; - f=strchr(b, quote); - if (f==NULL) - ERR_MSG("missing '""'"); - l=f-b; - if (sep == StrNONE) { - buf->rdpos=f - buf->buf + 1; - buf->seen = 0; - } else { - e=strchr(f+1, sep); - if (e==NULL) { - buf->rdpos = f - buf->buf + 1 + strlen(f+1); - buf->seen=0; - } else { - buf->rdpos = e - buf->buf + 1; - buf->seen=1; - } - } - } else { - f=strchr(b, sep); - if (f==NULL) { - l=strlen(b); - f=b+l; - buf->rdpos+=l; - buf->seen=0; - } else { - l=f-b; - buf->rdpos+=l+1; - buf->seen=1; - } - } - if (result==NULL) { - if (reslen==-1) { /* special case for StrGetBuf */ - return(f); - } - *f='\0'; - return(b); - } else { - if (l>=reslen) l=reslen-1; /* ERR_MSG("result too short"); */ - strncpy(result, b, l); - result[l]='\0'; - return(result); - } - OnError: - buf->rdpos=buf->dsize; /* illegal value */ - return(NULL); -} - -int StrGetBuf(StrBuf *buf, StrBuf *res, int sep) { - char *b, *f; - - b = buf->buf + buf->rdpos; - ERR_P(f=StrNGet(buf, NULL, -1, sep)); - res->buf = b; - res->wrpos = f-b; - res->rdpos = 0; - res->dsize = f-b; - return(0); - OnError: - buf->rdpos=buf->dsize; /* illegal value */ - return(-1); -} - -int StrGetInt(StrBuf *buf, int *res, int sep) { - char num[32]; - int i, l, p; - - p=buf->rdpos; - ERR_P(StrGet(buf, num, sep)); - i=sscanf(num, "%d%n", res, &l); - if (i==0) - ERR_MSG("illegal number"); - if (sep==StrNONE) { - buf->rdpos=p+l; - } - return(0); - OnError: - buf->rdpos=buf->dsize; /* illegal value */ - return(0); -} - -int StrGetFloat(StrBuf *buf, float *res, int sep) { - char num[32]; - int i, l, p; - - p=buf->rdpos; - ERR_P(StrGet(buf, num, sep)); - if (num[0]=='N' && num[1]=='a' && num[2]=='N') { - l=3; - *res = MYC_NAN; - } else { - i=sscanf(num, "%f%n", res, &l); - if (i==0) { - ERR_MSG("illegal number"); - } - } - if (sep==StrNONE) { - buf->rdpos=p+l; - } - return(0); - OnError: - buf->rdpos=buf->dsize; /* illegal value */ - return(-1); -} - -int StrGetEnd(StrBuf *buf) { - if (buf->buf!=NULL) { - if (buf->rdpos < 0 || buf->rdpos >= buf->dsize) - ERR_MSG("buffer corrupt"); - if (buf->rdpos != buf->wrpos) - ERR_MSG("superflous content in buffer"); - } - return(0); - OnError: - return(-1); -} - -int StrPut(StrBuf *buf, const char *str, int sep) { - int l, pos; - char quote; - - pos=buf->wrpos; - if (pos < 0 || pos >= buf->dsize || buf->buf==NULL) - ERR_MSG("buffer corrupt"); - l=strlen(str); - quote='\0'; - if (sep>0) { - if (strchr(str, sep)!=NULL) { - if (strchr(str, '"')!=NULL) { - quote='"'; l+=2; - } - if (strchr(str, '\'')!=NULL) { - if (quote!='\0') - ERR_MSG("str must not contain separator and both kind of quotes"); - quote='\''; l+=2; - } - } - } - if (pos+l >= buf->dsize) { - ERR_MSG("buffer too short"); - } - if (quote!='\0') { - buf->buf[pos]=quote; pos++; - strcpy(buf->buf + pos, str); - buf->buf[pos]=quote; pos++; - } else { - strcpy(buf->buf + pos, str); - } - pos+=l; - if (sep!=StrNONE) { - buf->buf[pos]=sep; - pos++; - } else { - buf->buf[pos]='\0'; - } - buf->wrpos=pos; - return(0); - OnError: - buf->wrpos=-1; - return(-1); -} - -int StrPutInt(StrBuf *buf, int val, int sep) { - char num[32]; - - sprintf(num, "%d", val); - ERR_I(StrPut(buf, num, sep)); - return(0); - OnError: - return(-1); -} - -int StrPutFloat(StrBuf *buf, float val, int sep) { - char num[32]; - - if (val == MYC_NAN) { - ERR_I(StrPut(buf, "NaN", sep)); - } else { - sprintf(num, "%g", val); - ERR_I(StrPut(buf, num, sep)); - } - return(0); - OnError: - return(-1); -} - -void StrReset(StrBuf *buf) { - buf->rdpos=0; -} - -void StrClear(StrBuf *buf) { - buf->rdpos=0; - buf->wrpos=0; -} - -void StrNLink(StrBuf *buf, char *str, int length) { - int l; - buf->buf=str; - buf->rdpos=0; - l=strlen(str); - if (lwrpos=l; - buf->dsize=buf->wrpos; -} - -#define TWO_23 8388608 -#define EXP_OFFS 128 - -void flt_to_char4(double f, char buf[4]) { - double m; - int e; - long res; - - m = frexp(f, &e); - e += EXP_OFFS; - if (e < 0 || m == 0) { - res = 0; m = 0; - } else { - if (e > 255) { - res = 255 * TWO_23 + (TWO_23 - 1); /* max. representable number */ - } else { - res = (long)(0.5 + (fabs(m * 2) - 1.0) * TWO_23); - /* here we may think about the case, where m is just a little less than 1.0: - the mantissa part overflows to bit23, but, the result would be o.k., since this - just increases the exponent by one, and the mantissa bits get all zero. - but what happens when e is already 255 ? the next line handles this */ - if (res == TWO_23 && e == 255) res--; - res += e * TWO_23; - } - } - buf[0] = res % 256; res = res / 256; - buf[1] = res % 256; res = res / 256; - buf[2] = res % 256; res = res / 256; - if (m < 0) { - buf[3] = res - 128; - } else { - buf[3] = res; - } -} - -double flt_from_char4(char buf[4]) { - long i, b0, b1, b2, b3; - - b0=buf[0]; if (b0<0) b0+=256; - b1=buf[1]; if (b1<0) b1+=256; - b2=buf[2]; if (b2<0) b2+=256; - b3=buf[3]; if (b3<0) b3+=256; - if (b3>=128) { - i=(b3-128)*(256*65536)+b2*65536+b1*256+b0; - if (i==0) return 0.0; - return -ldexp((i % TWO_23)*1.0/(TWO_23)*0.5+0.5, i/TWO_23-EXP_OFFS); - } else { - i=b3*(256*65536)+b2*65536+b1*256+b0; - if (i==0) return 0.0; - return ldexp((i % TWO_23)*1.0/(TWO_23)*0.5+0.5, i/TWO_23-EXP_OFFS); - } -} - -int StrPutArray(StrBuf *buf, float val[], int size) { - int i, pos; - char *b; - - pos=buf->wrpos; - if (pos < 0 || pos >= buf->dsize || buf->buf==NULL) - ERR_MSG("buffer corrupt"); - if (pos+4*size >= buf->dsize) - ERR_MSG("buffer too short"); - b=buf->buf+pos; - flt_to_char4((float)size, b); - b+=4; - for (i=0; iwrpos=b - buf->buf; - return(0); - OnError: - buf->wrpos=-1; - return(-1); -} - -int StrGetArray(StrBuf *buf, float val[], int maxsize) { - int size, i; - char *b; - double gg; - - if (buf->rdpos < 0 || buf->rdpos >= buf->dsize || buf->buf==NULL) - ERR_MSG("buffer corrupt"); - b=buf->buf + buf->rdpos; - size=flt_from_char4(b); b+=4; - buf->rdpos+=4*(size+1); - if (maxsizerdpos=buf->dsize; /* illegal value */ - return(-1); -} diff --git a/tecs/myc_buf.h b/tecs/myc_buf.h deleted file mode 100644 index 853022e..0000000 --- a/tecs/myc_buf.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef _STR_BUF_H_ -#define _STR_BUF_H_ - -/* - This module is used to write and read from character strings - It is a simplified, safe replacement for sprintf/sscanf. - - DeclStrBuf(buf, size) declares and initializes a buffer of a given size. - Use this macro in the declaration part of a function. -*/ -typedef struct { char *buf; int dsize, rdpos, wrpos, seen; } StrBuf; - -#define DeclStrBuf(BUF,SIZ) static char STR__##BUF[SIZ]; StrBuf BUF={STR__##BUF,SIZ} - -/*------------------------------------------------------------------------ - Write content to the buffer, and add separator sep, if sep!=StrNONE -*/ -#define StrNONE -1 -int StrPut(StrBuf *buf, const char *str, int sep); -int StrPutInt(StrBuf *buf, int val, int sep); -int StrPutFloat(StrBuf *buf, float val, int sep); -int StrPutArray(StrBuf *buf, float val[], int size); - -/*------------------------------------------------------------------------ - Read from the buffer until separator sep. - Use the StrGet macro if the result is a fixed size. - Special case sep=StrNONE: - - StrGet reads until the end of the buffer or until the end of a quoted string - - StrGetInt and StrGetFloat read until the end of a legal number -*/ -char *StrNGet(StrBuf *buf, char *result, int reslen, int sep); -#define StrGet(BUF,RES,SEP) StrNGet(BUF,RES,sizeof(RES),SEP) -int StrGetInt(StrBuf *buf, int *res, int sep); -int StrGetFloat(StrBuf *buf, float *res, int sep); -int StrGetArray(StrBuf *buf, float val[], int maxsize); -#define StrEnd(BUF) ((BUF)->rdpos>=(BUF)->wrpos) - -/*------------------------------------------------------------------------ - reset the buffer to read from the beginning -*/ -void StrReset(StrBuf *buf); - -/*------------------------------------------------------------------------ - Clear the buffer -*/ -void StrClear(StrBuf *buf); - -/*------------------------------------------------------------------------ - Verify that the end is reached -*/ - int StrGetEnd(StrBuf *buf); - -/*------------------------------------------------------------------------ - Link the buffer to a string. The buffer length is set to - sizeof(STR) or strlen(STR), whichever is greater -*/ -#define StrLink(BUF, STR) StrNLink(BUF, STR, sizeof(STR)) -void StrNLink(StrBuf *buf, char *str, int size); - -#endif /* _STR_BUF_H_ */ diff --git a/tecs/myc_err.c b/tecs/myc_err.c deleted file mode 100644 index 0eb7bcc..0000000 --- a/tecs/myc_err.c +++ /dev/null @@ -1,137 +0,0 @@ -#include -#include -#include - -#include "myc_fortran.h" -#include "myc_str.h" -#include "myc_err.h" - -#define SLEN 64 -#define MLEN 64 - -static char *txt[SLEN]; -static int sp=0; -static int stack_empty=1; - -int ErrCode; -char *ErrMessage=NULL; -void (*outrtn)(void *, char *)=NULL; -void *outarg; - -void ErrTxt(char *text, int systemError) -{ - if (systemError) { - stack_empty = 0; - sp=0; ErrCode=errno; ErrMessage=strerror(errno); - } - if (stack_empty && sp>0) { - sp=0; - stack_empty=0; - } - if (sp -#include - -/* ErrHDL Error handling utilities - ------------------------------- - Makes code more readable by hiding annoying error condition checks. - -Macros and routines: - - Spelling in uppercase indicates, that it the program flow - may be modified (jump to OnError label or program exit). - - - ERR_x - - Usage Error condition Error message taken from - ----------------------------------------------------------------------------------------- - ERR_SI(res=routine1(...)) res<0 errno - ERR_SP(ptr=routine2(...)) ptr==NULL errno - ERR_I(res=routine3(...)) res<0 stored by routine3 using errhdl mechanism - ERR_P(ptr=routine4(...)) ptr==NULL stored by routine4 using errhdl mechanism - - The result assignment "res=" or "ptr=" is optional. - - Description: - The routine routineX is called. - If the result indicates an error, the source text is saved and the - program continues at the OnError label. - The error message and the source code of the calling instructions is - saved for a later call to ErrShow or ErrExit. - - ERR_EXIT("program_name") - - Show error and exit program. - - ERR_MSG("message") - - Signals an error condition. If "message" is replaced by a variable, - take care that it is not modified until ErrShow is called. - - ERR_COD(cod) - - Signals an error condition as code from errno.h - - ErrShow("program_name") - - Show actual error message with traceback information to stdout - or a file fil - -Global Variables (read only) - - int ErrCode - - actual error message code - = errno for system errors or - = -1 for custom errors signaled by ERRMSG - - char *ErrMessage - - actual error message -*/ - -#define ERR_SI(R) { if(0>(R)) { ErrTxt(#R,1); goto OnError; }; } -#define ERR_SP(R) { if(NULL==(R)) { ErrTxt(#R,1); goto OnError; }; } -#define ERR_I(R) { if(0>(R)) { ErrTxt(#R,0); goto OnError; }; } -#define ERR_P(R) { if(NULL==(R)) { ErrTxt(#R,0); goto OnError; }; } -#define ERR_MSG(R) { ErrMsg(R); goto OnError; } -#define ERR_COD(R) { ErrCod(R); goto OnError; } - -void ErrTxt(char *text, int systemError); -void ErrMsg(char *msg); -void ErrCod(int code); -void ErrShow(char *text); /* write out error message with stack info */ -void ErrShort(char *msg); /* write out short error message */ -void ERR_EXIT(char *text); -void ErrSetOutRtn(void (*rtn)(void *,char *), void *arg); -void ErrSetOutFile(FILE *file); - -extern int ErrCode; -extern char *ErrMessage; - -#endif /* _ERR_HANDLING_H_ */ diff --git a/tecs/myc_fortran.h b/tecs/myc_fortran.h deleted file mode 100755 index 3210c1a..0000000 --- a/tecs/myc_fortran.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef _SYS_UTIL_H_ -#define _SYS_UTIL_H_ - -#include "myc_str.h" -/* - - fortran interface stuff - - declare fortran character arguments as F_CHAR(arg) - and at at the end for each character argument add - int _len to the argument list - - Use macros STR_TO_C and STR_TO_F to convert from Fortran character strings - to C character arrays and vice versa. - -*/ - - -#if defined __VMS - -typedef struct { short size, dummy; char *text; } SysVmsChar; - -#define F_CHAR(VAR) SysVmsChar *VAR -#define F_DCHAR(VAR,LEN) static char VAR##_str[LEN]; SysVmsChar VAR##_desc={LEN,270,&VAR##_str[0]}; SysVmsChar *VAR=&VAR##_desc -#define F_CLEN(VAR) -#define F_ALEN(VAR) -#define F_LEN(VAR) VAR->size -#define STR_TO_C(DST,SRC) str_ntrim(DST, SRC->text, sizeof(DST), SRC->size) -#define STR_TO_F(DST,SRC) str_npad(DST->text, SRC, DST->size) -#define F_FUN(A) A - - -#elif defined __alpha || defined __unix || defined __GNUC__ - -#define F_CHAR(VAR) char *VAR -#define F_DCHAR(VAR,LEN) char VAR[LEN]; int VAR##_len=LEN -#define F_CLEN(VAR) ,int VAR##_len -#define F_ALEN(VAR) ,VAR##_len -#define F_LEN(VAR) VAR##_len -#define STR_TO_C(DST,SRC) str_ntrim(DST, SRC, sizeof(DST), SRC##_len) -#define STR_TO_F(DST,SRC) str_npad(DST, SRC, DST##_len) - -#ifdef __alpha -#define F_FUN(A) A##_ -#elif defined __GNUC__ -#define F_FUN(A) A##__ -#else -#define F_FUN(A) A##__ -#endif - -#else - -#error "other machines are not supported" - -#endif - -#endif /* _SYS_UTIL_H_ */ diff --git a/tecs/myc_mem.h b/tecs/myc_mem.h deleted file mode 100644 index c734f2e..0000000 --- a/tecs/myc_mem.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef _MEM_UTIL_H_ -#define _MEM_UTIL_H_ - -#include -#include - -#ifdef FORTIFY -#include "fortify.h" -#endif - -/* ------------------------------------------------------------ - these macros help for safer dynamic memory - you may change these macros if you want to log dynamic memory access - -*/ - -#define NEW(PTR,TYP) {TYP _0_={0}; ERR_SP(PTR=malloc(sizeof(*PTR))); *PTR=_0_; } -/* - allocates and initializes an object of type TYP and make PTR point to it - TYP must be defined with an appropriate typedef declaration, and - INIT(TYP) must follow the declaration to initialize a dummy initializer - object. -*/ - -#define NEW_STR(TO,FROM) {ERR_SP(TO=malloc(strlen(FROM)+1)); strcpy(TO,FROM); } - -#define MALLOC(SIZE) malloc(SIZE) -#define FREE(PTR) { free(PTR); PTR=NULL; } - -#endif /* _MEM_UTIL_H_ */ diff --git a/tecs/myc_str.c b/tecs/myc_str.c deleted file mode 100644 index 06c4be4..0000000 --- a/tecs/myc_str.c +++ /dev/null @@ -1,252 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include "myc_err.h" -#include "myc_str.h" -#include "myc_mem.h" - -char *str_splitx(char *str, char sep, char *list[], int *n) { - int i; - char *s, *e; - - s=str; - for (i=0; i<*n; i++) { - list[i]=s; - e=strchr(s, sep); - if (e==NULL) { *n=i+1; return(NULL); } - s=e+1; - e--; - while (e>str && *e==' ') e--; /* trim sequence */ - e[1]='\0'; - } - return(s); -} - -char *str_split1(char *str, char sep) { - char *s, *e; - - e=strchr(str, sep); - if (e==NULL) { - s=NULL; - e=str+strlen(str); - } else { - s=e+1; - } - e--; - while (e>str && *e==' ') e--; /* trim sequence */ - e[1]='\0'; - return(s); -} - -int str_ntrim(char *dest, const char *src, int ldest, int lsrc) { - int i; - - if (lsrc>=ldest) lsrc=ldest-1; - if (dest!=src) strncpy(dest, src, lsrc); - dest[lsrc]='\0'; - i=strlen(dest)-1; - while (i>=0 && dest[i]==' ') i--; /* trim sequence */ - i++; - dest[i]='\0'; - return(i); -} - -int str_npad(char *dest, const char *src, int ldest) { - int i, lsrc; - - lsrc=strlen(src); - if (lsrc>=ldest) { - if (dest!=src) strncpy(dest, src, ldest); - lsrc=ldest; - } else { - if (dest!=src) strcpy(dest, src); - for (i=lsrc; i=dstlen) { - str_copy(dst, src); - } else { - strncpy(dst, src, i); - dst[i]='\0'; - } - return(s); -} - -char *str_read_until(FILE *fil, char *term, char *buf, char *end) { - char fmt[24]; - int i, l, siz; - char ch; - - siz=end-buf-1; - if (siz<1) return(NULL); - sprintf(fmt, "%s%d[^%s%s", "%", siz, term, "]%n%c"); - i=fscanf(fil, fmt, buf, &l, &ch); - if (i<0) { /* eof */ - buf[0]='\0'; - return(&buf[0]); - } else if (i==0) { /* fscanf returns 0 if first char is terminator */ - buf[0]=fgetc(fil); - return(&buf[0]); - } else if (i==1) { /* terminator not found -> read until eof */ - buf[l]='\0'; - return(&buf[l]); - } else { - buf[l]=ch; - if (l==siz && NULL==strchr(term, ch)) return(NULL); - return(&buf[l]); - } -} - -char *str_read_file(char *file) { - FILE *fil; - char *str, *s, *e, *p, *q; - int i, size; - struct stat statbuf; - - i=stat(file, &statbuf); - if (i<0) ERR_MSG("file not found"); - size=statbuf.st_size+4; - ERR_SP(str=MALLOC(size)); - e=&str[size-1]; - ERR_SP(fil=fopen(file, "r")); - s=str; - while (1) { - p=str_read_until(fil, "!", s, e); - if (p==NULL) break; - if (*p=='!') { - q=str_read_until(fil, "\n", p, e); - if (q==NULL) { p=NULL; break; } - s=p; *s='\n'; s++; - } else { - assert(*p=='\0'); - break; - } - } - ERR_SI(fclose(fil)); - assert(strlen(str)reslen) ERR_MSG("result buffer too short"); - strncpy(r, p, l); - r+=l; reslen-=l; - if (ln>reslen) ERR_MSG("result buffer too short"); - strncpy(r, new, reslen); - r+=ln; reslen-=ln; - p=s+lo; - s=strstr(p, old); - } - l=strlen(p); - if (l>reslen) ERR_MSG("result buffer too short"); - strncpy(r, p, l); - r+=l; - *r='\0'; - return(r-result); - OnError: - result[0]='\0'; - return(-1); -} - -void str_nupcase(char *dst, const char *src, int dstlen) { - dstlen--; /* space for trailing nul */ - while (*src!='\0' && dstlen>0) { - *dst=toupper((int)*src); - dst++; src++; - dstlen--; - } - *dst='\0'; -} - -void str_nlowcase(char *dst, const char *src, int dstlen) { - dstlen--; /* space for trailing nul */ - while (*src!='\0' && dstlen>0) { - *dst=tolower((int)*src); - dst++; src++; - dstlen--; - } - *dst='\0'; -} - -#ifndef __GNUC__ -int strcasecmp(const char *str1, const char *str2) { - int i; - char ch1, ch2; - ch1=tolower(*(str1++)); ch2=tolower(*(str2++)); - i=1; - while (ch1!='\0' && ch2!='\0' && ch1==ch2) { - ch1=tolower(*(str1++)); ch2=tolower(*(str2++)); i++; - } - if (ch1ch2) { - return(i); - } - return(0); -} -#endif - -int str_ncpy(char *dst, const char *src, int maxdest) { - strncpy(dst, src, maxdest); - if (dst[maxdest-1]!='\0') { - dst[maxdest-1]='\0'; - ERR_MSG("destination string too short"); - } - return(0); - OnError: return(-1); -} - -int str_ncat(char *dst, const char *src, int maxdest) { - dst[maxdest-1]='\0'; - strncat(dst, src, maxdest-strlen(dst)-1); - if (dst[maxdest-1]!='\0') { - dst[maxdest-1]='\0'; - ERR_MSG("destination string too short"); - } - return(0); - OnError: return(-1); -} diff --git a/tecs/myc_str.h b/tecs/myc_str.h deleted file mode 100644 index 95bdbfa..0000000 --- a/tecs/myc_str.h +++ /dev/null @@ -1,122 +0,0 @@ -#ifndef _MYC_STR_H_ -#define _MYC_STR_H_ - -#define MYC_NAN (-1.125/1024./1024./1024.) - -/* - use these macros if DST is a fixed length character array -*/ - -#define str_trim(DST,SRC,L) str_ntrim(DST,SRC,sizeof(DST),L) -#define str_pad(DST,SRC) str_npad(DST,SRC,sizeof(DST)) -#define str_split(DST,SRC,SEP) str_nsplit(DST,SRC,SEP,sizeof(DST)) -#define str_substitute(DST,SRC,OLD,NEW) str_nsubstitute(DST,SRC,OLD,NEW,sizeof(DST)) -#define str_upcase(DST,SRC) str_nupcase(DST,SRC,sizeof(DST)) -#define str_lowcase(DST,SRC) str_nlowcase(DST,SRC,sizeof(DST)) -#define str_copy(DST,SRC) str_ncpy(DST,SRC,sizeof(DST)) -#define str_append(DST,SRC) str_ncat(DST,SRC,sizeof(DST)) - - -char *str_split1(char *str, char separator); -/* - trims text before separator in *str and returns - a pointer to the first character after separator -*/ - -char *str_splitx(char *str, char sep, char *list[], int *n); -/* - split string into *n strings using separator sep. - spaces at the end of the elements are trimmed - attention: *str is modified ('\0' placed at the end of the elements) - - if *n separators are found, result points to string after *n-th separator - else result is NULL - *n contains number of elements stored in list -*/ - -int str_ntrim(char *dest, const char *src, int ldest, int lsrc); -/* - copy characters 0 to lsrc-1 from src to dest (max ldest chars). -*/ - -int str_npad(char *dest, const char *src, int ldest); -/* - copy src to dest and fill with spaces (fortran string format) -*/ - -char *str_nsplit(char *dst, const char *src, char sep, int dstlen); -/* - returns a pointer to the text after the separator sep in *src - and copies the text before the separator to *dst - when *src does not contain the separator sep - NULL is returned, and *dst is a copy of *src -*/ - -char *str_read_file(char *file); -/* - return one string containing the contents of file *file - comments separated by '!' are omitted. The caller must - free the result after use. -*/ - -void str_replace_char(char *str, char ch, char rep); -/* - replace all occurences of character ch by character rep in string *str -*/ - -int str_nsubstitute(char *result, char *str, char *old, char *new, int reslen); -/* - replace every instance of old in str by new. - the result must not overlap - if the result would be longer than reslen, the result is en empty string - and the return value is -1; - else the return value is the length of the result. - return one string containing the contents of file *file - the contents are treated in the following way: - - #0,#1,...#n is replaced by the corresponding argument *args[n] (n=0..nargs-1, nargs<10) - - at the end of each line spaces and comments separated by ! are trimmed -*/ - -void str_nupcase(char *dst, const char *src, int dstlen); -/* - convert *str to uppercase -*/ - -void str_nlowcase(char *dst, const char *src, int dstlen); -/* - convert *str to lowercase -*/ - -#ifdef __VMS_VER -#if __VMS_VER<70000000 - -int strcasecmp(const char *str1, const char *str2); -/* - compare *str1 with *str2 - the comparison is not case sensitive - if result=0: strings are equal - else - result>0 <==> *str1>*str2 - first different character is at position abs(result)-1 -*/ - -#else -#include -#endif /* __VMS_VER<70000000 */ -#else -#include -#endif /* __VMS_VER */ - -int str_ncpy(char *dst, const char *src, int maxdest); -/* - copy *src to *dest, maximal maxdest characters, - it is guaranteed, that dst contains '\0' -*/ - -int str_ncat(char *dst, const char *src, int maxdest); -/* - append *src to *dest, maximal maxdest characters, - it is guaranteed, that dst contains '\0' -*/ - -#endif /* _MYC_STR_H_ */ diff --git a/tecs/myc_time.c b/tecs/myc_time.c deleted file mode 100644 index ee62645..0000000 --- a/tecs/myc_time.c +++ /dev/null @@ -1,128 +0,0 @@ -#include -#include -#include -#if __VMS -#include -#endif -#include "myc_fortran.h" -#include "myc_time.h" - - -static time_t my_base=0; - -void initBase(void) { - struct tm tim; - time_t now; - - time(&now); - tim = *localtime(&now); - tim.tm_year = MYC_TIME_BASE / 10000 - 1900; - tim.tm_mon = (MYC_TIME_BASE % 10000) / 100 - 1; - tim.tm_mday = MYC_TIME_BASE % 100; - tim.tm_hour = 12; - tim.tm_min = 0; - tim.tm_sec = 0; -/* take daylight saving time flag and gmt offset from today */ - my_base=mktime(&tim) - 12*3600; - assert(tim.tm_wday == 1); /* time base must be a monday */ -} - -int mycNow(void) { - time_t now; - - if (my_base == 0) initBase(); - time(&now); - return (int)(now-my_base); -} - -time_t mycUnixTime(int myTime) { - return myTime+my_base; -} - -int mycMsecSince(int since) { -#if __VMS - struct timeb now; -#else - struct timeval now; -#endif - int msec; - - if (my_base == 0) initBase(); -#if __VMS - ftime(&now); - msec = (now.time - my_base) % (24*3600) * 1000 + now.millitm - since; -#else - gettimeofday(&now, NULL); - msec = (now.tv_sec - my_base) % (24*3600) * 1000 + now.tv_usec/1000 - since; -#endif - if (msec < 0) msec+=24*3600000; - return msec; -} - -int mycDate(int time) { - struct tm tim; - time_t t; - - if (my_base == 0) initBase(); - t = time + my_base; - tim=*localtime(&t); - return (tim.tm_year + 1900) * 10000 + (tim.tm_mon + 1) * 100 + tim.tm_mday; -} - -int mycTime(int date) { - struct tm tim; - time_t now; - int y, m, d; - - if (my_base == 0) initBase(); - time(&now); - tim=*localtime(&now); - tim.tm_hour=0; - tim.tm_min=0; - tim.tm_sec=0; - if (date != 0) { - d = date % 100; - date = date / 100; - m = date % 100; - y = date / 100; - if (y == 0) { - if (m == 0) { - if (d > tim.tm_mday) { - if (tim.tm_mon == 0) { /* jan */ - tim.tm_mon=11; /* dec */ - tim.tm_year--; - } else { - tim.tm_mon--; /* last month */ - } - } - } else { - tim.tm_mon = m - 1; - } - } else { - tim.tm_year = y - 1900; - if (m == 0) { - if (d == 0) { - tim.tm_mon = 0; - } - } else { - tim.tm_mon = m - 1; - } - } - if (d == 0) d = 1; - tim.tm_mday = d; - } - return (int)(mktime(&tim)-my_base); -} - - -/* fortran routines -------------------------------------------------- -*/ - -#ifdef F_CHAR -/* compile only when fortran c interface stuff is defined */ - -int F_FUN(myc_now)(void) { return mycNow(); } -int F_FUN(myc_date)(int *time) { return mycDate(*time); } -int F_FUN(myc_time)(int *date) { return mycTime(*date); } - -#endif diff --git a/tecs/myc_time.h b/tecs/myc_time.h deleted file mode 100644 index 1dc1e74..0000000 --- a/tecs/myc_time.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef _MYC_TIME_H_ -#define _MYC_TIME_H_ - -#define MYC_TIME_BASE 20010101 - -int mycNow(void); -/* - return seconds since a Monday specified by MYC_TIME_BASE - mycNow() % (24*3600) is always 0 at 00:00 even in daylight saving time -*/ - -int mycMsecSince(int since); -/* - mycMsecSince(0) return milliseconds since midnight - mycMsecSince(x) return milliseconds since x (x is time since midnight) -*/ - -int mycDate(int time); -/* - return year * 10000 + month * 100 + day_of_month of a time obtained by mycNow - year > 1900 - 1 <= month <= 12 - 1 <= day_of_month <= 31 -*/ - -int mycTime(int date); -/* - does the inverse of MycDate. Chooses the last possible date not later than today, - if day, month or year is undefined (zero) -*/ - -time_t mycUnixTime(int myTime); - -/* the following subroutines are to be called from FORTRAN - -integer function myc_now() -real function myc_date(time) -integer function myc_time(date) - -integer time -real date - -*/ - -#endif /* _MYC_TIME_H_ */ diff --git a/tecs/myc_tmp.c b/tecs/myc_tmp.c deleted file mode 100644 index bde4397..0000000 --- a/tecs/myc_tmp.c +++ /dev/null @@ -1,96 +0,0 @@ -#include -#include -#include -#include -#include "myc_fortran.h" -#include "myc_mem.h" -#include "myc_err.h" -#include "myc_str.h" - -int MycTmpName(char *result, const char *name, int reslen) { - char tmp[128]; - char *u; - - if (strlen(name)+64 > sizeof(tmp)) - ERR_MSG("destination string too short"); /* do not accept too long names */ - u=getenv("USER"); - if (u==NULL) - ERR_MSG("USER undefined"); - sprintf(tmp, "/tmp/%s_%s.%d", name, u, getpid()); - ERR_I(str_ncpy(result, tmp, reslen)); - return 0; - OnError: - return -1; -} - -int MycCleanTmp(void) { - time_t tim; - static time_t last=0; - char file[128], line[1024], fullid[16]; - char *sess=NULL, *files=NULL; - char *list, *id, *nxt, *nextline; - int i; - - time(&tim); - if (tim < last+3600) return 0; /* do not clean up before an hour after last time */ - last=tim; - file[0]='\0'; - ERR_I(MycTmpName(file, ".cleanup", sizeof(file))); - unlink(file); - /* make a list of used session and process id's */ - sprintf(line, "ps -U $USER -o pid,sess > %s", file); - system(line); - ERR_P(sess=str_read_file(file)); - unlink(file); - for (i=0; i<2; i++) { - if (i==0) { - sprintf(line, - "find /tmp/. ! -name . -prune -name \".*_$USER.*\" > %s", file); - } else { - sprintf(line, - "find /tmp/. ! -name . -prune -name \"*_$USER.*\" -mtime +7 > %s", file); - } - system(line); - ERR_P(files=str_read_file(file)); - unlink(file); - str_replace_char(sess, '\n', ' '); - list=files; - while (*list != '\0') { - nextline=str_split1(list, '\n'); - id=NULL; - nxt=list; - while (nxt != NULL) { /* find last dot */ - id=nxt+1; - nxt=strchr(nxt+1, '.'); - } - if (id!=NULL) { /* file contains a dot */ - sprintf(fullid, " %.12s ", id); - if (strstr(sess, fullid)==NULL) { - unlink(list); - } - } - list=nextline; - } - FREE(files); files=NULL; - } - FREE(sess); sess=NULL; - return 0; - OnError: - if (file[0] != '\0') unlink(file); - if (sess!=NULL) FREE(sess); - if (files!=NULL) FREE(files); - return -1; -} - -void F_FUN(sys_temp_name) ( F_CHAR(name), F_CHAR(path) F_CLEN(name) F_CLEN(path)) { - char nam[128]; - char pat[1024]; - - STR_TO_C(nam, name); - MycTmpName(pat, nam, sizeof(pat)); - STR_TO_F(path, pat); -} - -void F_FUN(sys_clean_tmp) (void) { - MycCleanTmp(); -} diff --git a/tecs/myc_tmp.h b/tecs/myc_tmp.h deleted file mode 100644 index c9e1e38..0000000 --- a/tecs/myc_tmp.h +++ /dev/null @@ -1,9 +0,0 @@ -int MycTmpName(char *result, const char *name, int reslen); -/* generate a temporary filename containing 'name'. - * the filename is stored in 'result' with less than 'reslen' characters. - */ - -int MycCleanTmp(void); -/* deletes temporary files from closed sessions. files not beginning with a - * dot will be kept at least for 7 days (if the system does not delete then) - */ diff --git a/tecs/pg_plus/grtermio.c b/tecs/pg_plus/grtermio.c deleted file mode 100644 index 7dcb4e2..0000000 --- a/tecs/pg_plus/grtermio.c +++ /dev/null @@ -1,226 +0,0 @@ -/* Support routines for terminal I/O. This module defines the following - Fortran-callable routines: GROTER, GRCTER, GRWTER, GRPTER. */ - -#include -#include -#include -#include -#include -#include -#include - -#ifdef PG_PPU -#define GROTER groter_ -#define GRWTER grwter_ -#define GRCTER grcter_ -#define GRPTER grpter_ -#define GRKTER grkter_ -#define GRETER greter_ -#else -#define GROTER groter -#define GRWTER grwter -#define GRCTER grcter -#define GRPTER grpter -#define GRKTER grkter -#define GRETER greter -#endif - -/* Open a channel to the device specified by 'cdev'. - * - * cdev I The name of the device to be opened - * ldev I Number of valid characters in cdev - * groter O The open channel number (-1 indicates an error) - */ -int GROTER(cdev, ldev, cdev_len) - char *cdev; int *ldev; - int cdev_len; -{ - int fd; /* The returned file descriptor */ - char name[64]; /* A copy of the given terminal device name */ -/* - * Make a copy of the given file if there is sufficient room in name[]. - */ - if(*ldev <= sizeof(name)-1) { - strncpy(name, cdev, *ldev); - name[*ldev] = '\0'; - } else { - fprintf(stderr, "groter: Terminal file name too long.\n"); - return -1; - }; -/* - * Open the terminal. - */ - if((fd = open(name, 2)) == -1) { - perror(name); - return -1; - }; - return fd; -} - - -/* Close a previously opened channel. - * - * fd I The channel number to be closed - */ -void GRCTER(fd) - int *fd; -{ - close(*fd); - return; -} - -/* Write lbuf bytes from cbuf to the channel fd. Data is written without - * any formating. - * - * fd I The channel number - * cbuf I Character array of data to be written - * lbuf I/O The number of bytes to write, set to zero on return - */ -void GRWTER(fd, cbuf, lbuf, cbuf_len) - int *fd; char *cbuf; int *lbuf; int cbuf_len; -{ - int nwritten = write (*fd, cbuf, *lbuf); - if (nwritten != *lbuf) - perror("Error writing to graphics device"); - *lbuf = 0; - return; -} - -/* Write prompt string on terminal and then read response. This version - * will try to read lbuf characters. - * - * fd I The channel number - * cprom I An optional prompt string - * lprom I Number of valid characters in cprom - * cbuf O Character array of data read - * lbuf I/O The number of bytes to read, on return number read - */ -void GRPTER(fd, cprom, lprom, cbuf, lbuf, cprom_len, cbuf_len) - int *fd; char *cprom; int *lprom; char *cbuf; int *lbuf; - int cprom_len; int cbuf_len; -{ - char *buff = cbuf; /* C pointer to FORTRAN string */ - int ndone=0; /* The number of characters read */ - struct termios term; /* Terminal mode flags */ -/* - * Get the current set of terminal mode flags. - */ - if(tcgetattr(*fd, &term)==0) { - struct termios saveterm; /* Saved terminal attributes */ - int ntry; /* The number of characters still to be read */ - int nread; /* The number of characters read in one iteration */ -/* - * Save the existing terminal mode flags to be restored later. - */ - saveterm = term; -/* - * Enable raw single character input. - */ - term.c_lflag &= ~ICANON; - term.c_cc[VMIN] = 1; -/* - * Install the new terminal flags after first waiting for all pending - * output to be delivered to the terminal and after discarding any - * lingering input. - */ - tcsetattr(*fd, TCSAFLUSH, &term); -/* - * Prompt for input. - */ - if(*lprom>0) write(*fd, cprom, *lprom); -/* - * Read up to 'ntry' characters from the terminal. - */ - ndone = 0; - ntry = *lbuf; - do { - nread = read(*fd, &buff[ndone], ntry); - ndone += nread; - ntry -= nread; - } while(nread>0 && ntry>0); -/* - * Restore the previous terminal mode flags. - */ - tcsetattr(*fd, TCSAFLUSH, &saveterm); - }; - *lbuf=ndone; - return; -} - - -static struct termios saved_attr; -static struct termios term; /* Terminal mode flags */ -static int saved_fd=-1; -static int exit_handler=1; -/* - * Restore the previous terminal mode. - */ -void GRETER(void) { - if (saved_fd >= 0) { - tcsetattr(saved_fd, TCSAFLUSH, &saved_attr); - saved_fd = -1; - }; - return; -} - - -/* Read one character from the terminal (with timeout), - * and set terminal to no canonical, no echo mode. - * - * fd I The channel number - * tmo I Timeout in tenths of a second - * cbuf O Character array of data read - */ -void GRKTER(fd, tmo, cbuf, cbuf_len) - int *fd; int *tmo; char *cbuf; int cbuf_len; -{ - int nread; -/* - * Get the current set of terminal mode flags. - */ - *cbuf='\0'; - if (*fd != saved_fd) { - if (saved_fd >= 0) { - tcsetattr(saved_fd, TCSAFLUSH, &saved_attr); - saved_fd = -1; - } - if(tcgetattr(*fd, &term)!=0) return; -/* - * Save the existing terminal mode flags to be restored later. - */ - saved_attr = term; -/* - * Enable raw single character input. - */ - term.c_lflag &= ~(ICANON) & ~(ECHO); - term.c_cc[VMIN] = 1; - term.c_cc[VTIME] = 0; -/* - * Install the new terminal flags after first waiting for all pending - * output to be delivered to the terminal and after discarding any - * lingering input. - */ - tcsetattr(*fd, TCSAFLUSH, &term); - if (exit_handler) { - atexit(GRETER); - exit_handler=0; - } - saved_fd = *fd; - } - if (*tmo != 0) { - term.c_cc[VMIN] = (*tmo == 0); - term.c_cc[VTIME] = *tmo; - tcsetattr(*fd, TCSANOW, &term); - } -/* - * Read one character from the terminal. - */ - nread = read(*fd, cbuf, 1); - if (nread!=1) *cbuf='\0'; - if (*tmo != 0) { - term.c_cc[VMIN] = 1; - term.c_cc[VTIME] = 0; - tcsetattr(*fd, TCSANOW, &term); - } - return; -} diff --git a/tecs/pg_plus/make_gen b/tecs/pg_plus/make_gen deleted file mode 100644 index c2af1d1..0000000 --- a/tecs/pg_plus/make_gen +++ /dev/null @@ -1,13 +0,0 @@ -# Makefile for modifications to PGPLOT allowing for -# timeout on cursor input for the devices VMAC, XWINDOW and XSERVE - -.SUFFIXES: -.SUFFIXES: .o .c .f - -OBJ= pgqinf.o pgband.o ttdriv.o xwdriv.o grtermio.o vtdriv.o - -all: $(OBJ) - rm -f libpgplus.a - cp $(ORIG)/libpgplot.a libpgplus.a - $(AR) $(ARFLAGS) libpgplus.a *.o - ranlib libpgplus.a diff --git a/tecs/pg_plus/makefile b/tecs/pg_plus/makefile deleted file mode 100644 index 03dfa3a..0000000 --- a/tecs/pg_plus/makefile +++ /dev/null @@ -1,21 +0,0 @@ -# M. Zolliker 03.2005 - -%: usage - @echo - -%.o: usage - @echo - -default: usage - -usage: - @ echo "" - @ echo "Usage:" - @ echo "" - @ echo " make -f makefile_xxx [target]" - @ echo "" - @ echo ' where makefile_xxx is one of' - @ echo "" - @ ls -1 makefile_* | pr -t -o 4 - - diff --git a/tecs/pg_plus/makefile_alpha b/tecs/pg_plus/makefile_alpha deleted file mode 100644 index c7b5b0a..0000000 --- a/tecs/pg_plus/makefile_alpha +++ /dev/null @@ -1,9 +0,0 @@ -# Makefile for modifications to PGPLOT allowing for -# timeout on cursor input for the devices VMAC, XWINDOW and XSERVE - -ORIG=/afs/psi.ch/project/sinq/tru64/distsrc/pgplot - -FFLAGS=-g -Wimplicit -Wall -g -I$(ORIG) -CFLAGS=-g -DPG_PPU -I. -I/usr/X11R6/include - -include make_gen diff --git a/tecs/pg_plus/makefile_linux b/tecs/pg_plus/makefile_linux deleted file mode 100644 index a19696a..0000000 --- a/tecs/pg_plus/makefile_linux +++ /dev/null @@ -1,10 +0,0 @@ -# Makefile for modifications to PGPLOT allowing for -# timeout on cursor input for the devices VMAC, XWINDOW and XSERVE - -PGROOT=/afs/psi.ch/project/sinq/sl6 -ORIG=$(PGROOT)/lib - -FFLAGS=-g -Wimplicit -Wall -g -I$(PGROOT)/include -CFLAGS=-g -DPG_PPU -I. -I/usr/X11R6/include - -include make_gen diff --git a/tecs/pg_plus/makefile_macosx b/tecs/pg_plus/makefile_macosx deleted file mode 100644 index 257fa22..0000000 --- a/tecs/pg_plus/makefile_macosx +++ /dev/null @@ -1,9 +0,0 @@ -# Makefile for modifications to PGPLOT allowing for -# timeout on cursor input for the devices VMAC, XWINDOW and XSERVE - -ORIG=/sw/lib/pgplot/ - -FFLAGS=-g -Wimplicit -Wall -g -I$(ORIG) -CFLAGS=-g -DPG_PPU -I. -I/usr/X11R6/include - -include make_gen diff --git a/tecs/pg_plus/pgband.f b/tecs/pg_plus/pgband.f deleted file mode 100644 index fc4b57f..0000000 --- a/tecs/pg_plus/pgband.f +++ /dev/null @@ -1,104 +0,0 @@ -C*PGBAND -- read cursor position, with anchor -C%int cpgband(int mode, int posn, float xref, float yref, float *x,\ -C% float *y, char *ch_scalar); -C+ - INTEGER FUNCTION PGBAND (MODE, POSN, XREF, YREF, X, Y, CH) - INTEGER MODE, POSN - REAL XREF, YREF, X, Y - CHARACTER*(*) CH -C -C Read the cursor position and a character typed by the user. -C The position is returned in world coordinates. PGBAND positions -C the cursor at the position specified (if POSN=1), allows the user to -C move the cursor using the mouse or arrow keys or whatever is available -C on the device. When he has positioned the cursor, the user types a -C single character on the keyboard; PGBAND then returns this -C character and the new cursor position (in world coordinates). -C -C Some interactive devices offer a selection of cursor types, -C implemented as thin lines that move with the cursor, but without -C erasing underlying graphics. Of these types, some extend between -C a stationary anchor-point at XREF,YREF, and the position of the -C cursor, while others simply follow the cursor without changing shape -C or size. The cursor type is specified with one of the following MODE -C values. Cursor types that are not supported by a given device, are -C treated as MODE=0. -C -C -- If MODE=0, the anchor point is ignored and the routine behaves -C like PGCURS. -C -- If MODE=1, a straight line is drawn joining the anchor point -C and the cursor position. -C -- If MODE=2, a hollow rectangle is extended as the cursor is moved, -C with one vertex at the anchor point and the opposite vertex at the -C current cursor position; the edges of the rectangle are horizontal -C and vertical. -C -- If MODE=3, two horizontal lines are extended across the width of -C the display, one drawn through the anchor point and the other -C through the moving cursor position. This could be used to select -C a Y-axis range when one end of the range is known. -C -- If MODE=4, two vertical lines are extended over the height of -C the display, one drawn through the anchor point and the other -C through the moving cursor position. This could be used to select an -C X-axis range when one end of the range is known. -C -- If MODE=5, a horizontal line is extended through the cursor -C position over the width of the display. This could be used to select -C an X-axis value such as the start of an X-axis range. The anchor point -C is ignored. -C -- If MODE=6, a vertical line is extended through the cursor -C position over the height of the display. This could be used to select -C a Y-axis value such as the start of a Y-axis range. The anchor point -C is ignored. -C -- If MODE=7, a cross-hair, centered on the cursor, is extended over -C the width and height of the display. The anchor point is ignored. -C -- If MODE<0, the routine behaves like PGCURS, but if the user does -C nothing until a time of -MODE seconds has expired, the routine returns -C with CH=CHAR(0) -C -C Returns: -C PGBAND : 1 if the call was successful; 0 if the device -C has no cursor or some other error occurs. -C Arguments: -C MODE (input) : display mode (0, 1, ..7: see above). -C POSN (input) : if POSN=1, PGBAND attempts to place the cursor -C at point (X,Y); if POSN=0, it leaves the cursor -C at its current position. (On some devices this -C request may be ignored.) -C XREF (input) : the world x-coordinate of the anchor point. -C YREF (input) : the world y-coordinate of the anchor point. -C X (in/out) : the world x-coordinate of the cursor. -C Y (in/out) : the world y-coordinate of the cursor. -C CH (output) : the character typed by the user; if the device has -C no cursor or if some other error occurs, the value -C CHAR(0) [ASCII NUL character] is returned. -C -C Note: The cursor coordinates (X,Y) may be changed by PGBAND even if -C the device has no cursor or if the user does not move the cursor. -C Under these circumstances, the position returned in (X,Y) is that of -C the pixel nearest to the requested position. -C-- -C 7-Sep-1994 - new routine [TJP]. -C 27-Aug-2001 - timeout mode [M.Z.] -C----------------------------------------------------------------------- - INCLUDE 'pgplot.inc' - INTEGER GRCURS, I, J, IREF, JREF - LOGICAL PGNOTO -C - IF (PGNOTO('PGBAND')) THEN - CH = CHAR(0) - PGBAND = 0 - RETURN - END IF - IF (MODE.GT.7) CALL GRWARN( - : 'Invalid MODE argument in PGBAND') - IF (POSN.LT.0 .OR. POSN.GT.1) CALL GRWARN( - : 'Invalid POSN argument in PGBAND') -C - I = NINT(PGXORG(PGID) + X*PGXSCL(PGID)) - J = NINT(PGYORG(PGID) + Y*PGYSCL(PGID)) - IREF = NINT(PGXORG(PGID) + XREF*PGXSCL(PGID)) - JREF = NINT(PGYORG(PGID) + YREF*PGYSCL(PGID)) - PGBAND = GRCURS(PGID,I,J,IREF,JREF,MODE,POSN,CH) - X = (I - PGXORG(PGID))/PGXSCL(PGID) - Y = (J - PGYORG(PGID))/PGYSCL(PGID) - CALL GRTERM - END diff --git a/tecs/pg_plus/pgqinf.f b/tecs/pg_plus/pgqinf.f deleted file mode 100644 index 067d7c1..0000000 --- a/tecs/pg_plus/pgqinf.f +++ /dev/null @@ -1,162 +0,0 @@ -C*PGQINF -- inquire PGPLOT general information -C%void cpgqinf(const char *item, char *value, int *value_length); -C+ - SUBROUTINE PGQINF (ITEM, VALUE, LENGTH) - CHARACTER*(*) ITEM, VALUE - INTEGER LENGTH -C -C This routine can be used to obtain miscellaneous information about -C the PGPLOT environment. Input is a character string defining the -C information required, and output is a character string containing the -C requested information. -C -C The following item codes are accepted (note that the strings must -C match exactly, except for case, but only the first 8 characters are -C significant). For items marked *, PGPLOT must be in the OPEN state -C for the inquiry to succeed. If the inquiry is unsuccessful, either -C because the item code is not recognized or because the information -C is not available, a question mark ('?') is returned. -C -C 'VERSION' - version of PGPLOT software in use. -C 'STATE' - status of PGPLOT ('OPEN' if a graphics device -C is open for output, 'CLOSED' otherwise). -C 'USER' - the username associated with the calling program. -C 'NOW' - current date and time (e.g., '17-FEB-1986 10:04'). -C 'DEVICE' * - current PGPLOT device or file. -C 'FILE' * - current PGPLOT device or file. -C 'TYPE' * - device-type of the current PGPLOT device. -C 'DEV/TYPE' * - current PGPLOT device and type, in a form which -C is acceptable as an argument for PGBEG. -C 'HARDCOPY' * - is the current device a hardcopy device? ('YES' or -C 'NO'). -C 'TERMINAL' * - is the current device the user's interactive -C terminal? ('YES' or 'NO'). -C 'CURSOR' * - does the current device have a graphics cursor? -C ('YES' or 'NO'). -C 'SCROLL' * - does current device have rectangle-scroll -C capability ('YES' or 'NO'); see PGSCRL. -C -C Arguments: -C ITEM (input) : character string defining the information to -C be returned; see above for a list of possible -C values. -C VALUE (output) : returns a character-string containing the -C requested information, truncated to the length -C of the supplied string or padded on the right with -C spaces if necessary. -C LENGTH (output): the number of characters returned in VALUE -C (excluding trailing blanks). -C-- -C 18-Feb-1988 - [TJP]. -C 30-Aug-1988 - remove pseudo logical use of IER. -C 12-Mar-1992 - change comments for clarity. -C 17-Apr-1995 - clean up some zero-length string problems [TJP]. -C 7-Jul-1995 - get cursor information directly from driver [TJP]. -C 24-Feb-1997 - add SCROLL request. -C----------------------------------------------------------------------- - INCLUDE 'pgplot.inc' - INTEGER IER, L1, GRTRIM - LOGICAL INTER, SAME - CHARACTER*8 TEST - CHARACTER*64 DEV1 -C -C Initialize PGPLOT if necessary. -C - CALL PGINIT -C - CALL GRTOUP(TEST,ITEM) - IF (TEST.EQ.'USER') THEN - CALL GRUSER(VALUE, LENGTH) - IER = 1 - ELSE IF (TEST.EQ.'NOW') THEN - CALL GRDATE(VALUE, LENGTH) - IER = 1 - ELSE IF (TEST.EQ.'VERSION') THEN - VALUE = 'v5.2.2+' - LENGTH = 7 - IER = 1 - ELSE IF (TEST.EQ.'STATE') THEN - IF (PGID.LT.1 .OR. PGID.GT.PGMAXD) THEN - VALUE = 'CLOSED' - LENGTH = 6 - ELSE IF (PGDEVS(PGID).EQ.0) THEN - VALUE = 'CLOSED' - LENGTH = 6 - ELSE - VALUE = 'OPEN' - LENGTH = 4 - END IF - IER = 1 - ELSE IF (PGID.LT.1 .OR. PGID.GT.PGMAXD) THEN - IER = 0 - ELSE IF (PGDEVS(PGID).EQ.0) THEN - IER = 0 - ELSE IF (TEST.EQ.'DEV/TYPE') THEN - CALL GRQDT(VALUE) - LENGTH = GRTRIM(VALUE) - IER = 0 - IF (LENGTH.GT.0) IER = 1 - ELSE IF (TEST.EQ.'DEVICE' .OR. TEST.EQ.'FILE') THEN - CALL GRQDEV(VALUE, LENGTH) - IER = 1 - ELSE IF (TEST.EQ.'TERMINAL') THEN - CALL GRQDEV(DEV1, L1) - IF (L1.GE.1) THEN - CALL GRTTER(DEV1(1:L1), SAME) - ELSE - SAME = .FALSE. - END IF - IF (SAME) THEN - VALUE = 'YES' - LENGTH = 3 - ELSE - VALUE = 'NO' - LENGTH = 2 - END IF - IER = 1 - ELSE IF (TEST.EQ.'TYPE') THEN - CALL GRQTYP(VALUE,INTER) - LENGTH = GRTRIM(VALUE) - IER = 0 - IF (LENGTH.GT.0) IER = 1 - ELSE IF (TEST.EQ.'HARDCOPY') THEN - CALL GRQTYP(VALUE,INTER) - IF (INTER) THEN - VALUE = 'NO' - LENGTH = 2 - ELSE - VALUE = 'YES' - LENGTH = 3 - END IF - IER = 1 - ELSE IF (TEST.EQ.'CURSOR') THEN - CALL GRQCAP(DEV1) - IF (DEV1(2:2).EQ.'N') THEN - VALUE = 'NO' - LENGTH = 2 - ELSE - VALUE = 'YES' - LENGTH = 3 - END IF - IER = 1 - ELSE IF (TEST.EQ.'SCROLL') THEN - CALL GRQCAP(DEV1) - IF (DEV1(11:11).NE.'S') THEN - VALUE = 'NO' - LENGTH = 2 - ELSE - VALUE = 'YES' - LENGTH = 3 - END IF - IER = 1 - ELSE - IER = 0 - END IF - IF (IER.NE.1) THEN - VALUE = '?' - LENGTH = 1 - ELSE IF (LENGTH.LT.1) THEN - LENGTH = 1 - VALUE = ' ' - END IF - END diff --git a/tecs/pg_plus/ttdriv.f b/tecs/pg_plus/ttdriv.f deleted file mode 100644 index 452860c..0000000 --- a/tecs/pg_plus/ttdriv.f +++ /dev/null @@ -1,1410 +0,0 @@ -C*TTDRIV -- PGPLOT Tektronix terminal drivers -C+ - SUBROUTINE TTDRIV (IFUNC, RBUF, NBUF, CHR, LCHR, MODE) - INTEGER IFUNC, NBUF, LCHR, MODE - REAL RBUF(*) - CHARACTER*(*) CHR -C -C PGPLOT driver for Tektronix terminals and emulators. -C -C 1993 Jan 18 - T. J. Pearson. -C 1993 Jun 24 - L. Staveley-Smith, minor alteration of -C flush-buffer for better /tek -C compatibility. Also added MODE 7 for -C Visual 603's and MODE 8 for IBM-PCs -C running as remote terminals using -C Kermit version 3 (for DOS). -C 1994 Dec 19 - TJP: better XTERM support. -C 1994 Dec 29 - TJP: and Tek4100 support (MODE 9). -C 1996 Apr 18 - TJP: prevent concurrent access. -C 1998 Mar 09 - M. Zolliker: new MODE 10 for VersaTerm-PRO for Macintosh -C -C Supported device: -C 1. Tektronix 4006/4010 storage-tube terminal; can be used with -C emulators, but the options below take advantage of features not -C present in the basic Tektronix terminal. -C 2. GraphOn Corporation 200-series terminals. These emulate a -C Tektronix-4010 with enhancements (selective erase, rectangle fill, -C switch between Tek and VT100 modes). -C 3. Digital Engineering, Inc., Retrographics modified VT100 -C terminal (VT640). -C 4. IRAF GTERM Tektronix terminal emulator, with color extensions. -C 5. Xterm window on an X-window server. Emulates a Tektronix-4014, -C with extensions (switch between Tek and VT100 windows). -C 6. ZSTEM 240 and ZSTEM 4014 terminal emulators for the IBM PC and -C clones. ZSTEM supports Tektronix 4014 emulation and the 4105 color -C escape sequences. ZSTEM can be obtained from: KEA Systems Ltd., -C 2150 West Broadway, Suite 412, Vancouver, British Columbia, Canada, -C V6K 4L9. -C 7.Visual-603 and 630 terminals. These are VT100/220 compatible -C terminals with Tektronix 4010/4014 emulation (Visual Technology -C Incorporated, 1703 Middlesex Street, Lowell, Mass 01851). The -C Visual 630 has the capability of displaying dual text and graphics. -C This feature is not used in this driver. Graphics mode is entered -C automatically when the graph is drawn but only exited when PGPAGE -C or PGEND is called. Therefore, for multiple plots interspersed -C with text I/O, use PGPAGE at the end of each plot. This will prompt -C for a carriage return before switching. If this is not done, -C intervening text will appear on the graphics screen. Graphics mode -C can be entered and exited from the setup menu, or by SHIFT-PF1. -C Graphics extensions include rectangle fill, selective erase and -C switch between Tek and VT100 modes. -C 8.IBM PC's and compatibles running MS-Kermit 3 as a terminal emulator. -C The video board is assumed to have sufficient memory to retain the -C graphics image in memory when switched to text. This will be true -C for VGA and EGA, but some early PCs might not be able to do this. -C If Kermit is using full VGA resolution (ie SET TERMINAL GRAPHICS -C VGA), there is not usually enough memory to store the full 480 -C vertical lines, so the bottom few lines may disappear. Tektronix -C enhancements include selective erase, colours, rectangle fill, and -C switching between text and graphics mode. The cursor may be -C operated with the mouse. Tested with Kermit version 3.1. -C 9.Tektronix 4100 series color terminals (and emulators) -C 10.Versaterm-PRO for Macintosh (Tek 4105 emulation). -C -C Device type codes: -C 1. /TEK4010 Tektronix-4010 terminal -C 2. /GF GraphOn terminal -C 3. /RETRO Retrographics VT640 terminal -C 4. /GTERM GTERM terminal emulator -C 5. /XTERM XTERM terminal emulator -C 6. /ZSTEM ZSTEM terminal emulator -C 7. /V603 Visual V603 terminal -C 8. /KRM3 Kermit 3 on IBM-PC -C 9. /TK4100 Tektronix 4100 series terminals -C 10. /VMAC VersaTerm-PRO for Macintosh -C -C Default device name: the logged-in terminal -C /dev/tty (UNIX) -C TT: (VMS) -C -C Default view surface dimensions: -C Depends on monitor; nominally 8in (horizontal) by 6in (vertical). -C -C Resolution: -C A standard Tektronix terminal displays a screen of 1024 pixels -C (horizontal) by 780 pixels (vertical), with a nominal resolution -C of 130 pixels per inch. The actual resolution may be less. -C -C Color capability: -C /TEK4010, /XTERM: none; only color index 1 is available; selective -C erase is not possible. Requests to draw in color index 0 are -C ignored. -C /GF, /RETRO, /V603: color indices 0 (erase, black) and 1 (bright: -C usually white, green or amber) are supported. It is not -C possible to change color representation. -C /GTERM: color indices 0 to 15 are available and default to the -C standard PGPLOT colors. The color representation can be changed. -C /ZSTEM: color indices 0 to 7 are available and default to the -C indicated in the ZSTEM setup menu (which default to the standard -C PGPLOT colors). The color representation cannot be changed. -C /KRM3: color indices 0 to 7 are the standard PGPLOT colors. Indices -C 8 to 14 are also available, but are BRIGHT versions of 1 to 7, -C and thus non-standard. Color representation can't be changed. -C /TK4100: color indices 0-15. -C /VMAC: color indices 0 to 15 are available and default to the -C standard PGPLOT colors. The color representation of the indices -C 2 to 15 can be changed. -C -C Input capability: -C Depending on the emulation, the graphics cursor may be a pointer, -C a small cross, or a crosshair across the entire screen. The user -C positions the cursor using thumbwheels, mouse, trackball, or the -C arrow keys on the keyboard. The user indicates that the cursor has -C been positioned by typing any printable ASCII character on the -C keyboard. Most control characters (eg, ^C) are intercepted by the -C operating system and cannot be used. -C -C File format: -C Binary byte stream. Under Unix, the output may be directed to -C a file; under VMS, this is not possible: the output device must -C be a terminal. -C -C Obtaining hardcopy: -C -C Environment variables: -C None. -C-- -C Implementation Notes: -C -C Standard Tektronix codes: -C graph mode: [GS]=char(29) -C alpha mode: [US]=char(31) -C The emulators provide various extensions to basic Tektronix -C operation, using the following codes: -C [SOH]=char(1), [STX]=char(2), [ETX]=char(3), -C [DLE]=char(16), [CAN]=char(24), [ESC]=char(27) -C -C Enter Tektronix mode (from VT100 mode): -C graphon: automatic on receipt of [GS] -C gterm: [GS] -C tek: not available -C retro: automatic on receipt of [GS] -C xterm: [ESC][?38h -C zstem: [ESC][?38h -C v603: [GS] -C krm3: [ESC][?38h -C Return to VT100 mode (from Tektronix mode): -C graphon: [CAN] -C gterm: [CAN] -C tek: not available -C xterm: [ESC][ETX] -C zstem: [CAN] -C v603: [CAN][ESC][?38l -C krm3: [ESC][?38l -C Rectangle fill: -C graphon: draw the diagonal in special rectangle mode, -C entered with [ESC][STX], exit with [ESC][ETX] -C v603: bottom corner and rectangle width -C krm3: bottom corner and rectangle width -C vmac: use panel boundary commands [ESC]LP and [ESC]LE -C Color index zero (erase): -C graphon select erase: [ESC][DLE] -C graphon unselect erase: [ESC][SOH] -C retro,v603 select erase: [ESC]/1d -C retro,v603 unselect erase: [ESC]/0d -C krm3, select erase: [ESC][0;30m -C krm3, unselect erase: [ESC][0;37m -C----------------------------------------------------------------------- - INTEGER NDEVS - PARAMETER (NDEVS=10) - INTEGER CAN, ESC, GS, US - PARAMETER (CAN=24, ESC=27, GS=29, US=31) -C - CHARACTER*48 DEVICE(NDEVS) - SAVE DEVICE - CHARACTER*80 TEXT - CHARACTER*32 CTMP, CADD, CSCR(4)*4 - CHARACTER*500 CBUF - SAVE CBUF - INTEGER I, J, INTEN, I0, J0, I1, J1, LADD, LTMP, ICH, IER - INTEGER XSIZE(NDEVS), YSIZE(NDEVS), MAXCI(NDEVS), I4014(NDEVS) - SAVE XSIZE, YSIZE, MAXCI, I4014 - INTEGER ICHAN, LASTI, LASTJ, NPAGE, ICI, LBUF, STATE - SAVE ICHAN, LASTI, LASTJ, NPAGE, ICI, LBUF, STATE - INTEGER GROTER - INTEGER IBUF(4), ITOT - LOGICAL APPEND - SAVE APPEND - REAL XRESLN(NDEVS), YRESLN(NDEVS) - SAVE XRESLN, YRESLN - REAL HUE,SAT,LIG - LOGICAL SEFCOL - SAVE SEFCOL -C - INTEGER IRGB(3,0:15), TKRGB(3,0:15) -C - DATA DEVICE(1) /'TEK4010 (Tektronix 4010 terminal)'/ - DATA DEVICE(2) /'GF (GraphOn Tek terminal emulator)'/ - DATA DEVICE(3) /'RETRO (Retrographics VT640 Tek emulator)'/ - DATA DEVICE(4) /'GTERM (Color gterm terminal emulator)'/ - DATA DEVICE(5) /'XTERM (XTERM Tek terminal emulator)'/ - DATA DEVICE(6) /'ZSTEM (ZSTEM Tek terminal emulator)'/ - DATA DEVICE(7) /'V603 (Visual 603 terminal)'/ - DATA DEVICE(8) /'KRM3 (Kermit 3 IBM-PC terminal emulator)'/ - DATA DEVICE(9) /'TK4100 (Tektronix 4100 terminals)'/ - DATA DEVICE(10) /'VMAC (VersaTerm-PRO for Mac, Tek 4105)'/ -C TEK GF RET GTER XTER ZSTE V603 KRM3 TK41 VMAC - DATA XSIZE /1023,1023,1023,1023,1023,1023,1023,1023,1023,1023/ - DATA YSIZE / 779, 779, 779, 779, 779, 779, 779, 779, 779, 779/ - DATA MAXCI / 1, 1, 1, 15, 1, 7, 1, 14, 15, 15/ - DATA XRESLN/130.,128.,128.,130.,128.,130.,115.,110.,100.,128./ - DATA YRESLN/130.,130.,130.,130.,130.,130.,115.,110.,100.,128./ - DATA I4014/ 0, 0, 0, 0, 1, 1, 0, 0, 1, 1/ - DATA IRGB / 0, 0, 0, 255,255,255, 255, 0, 0, 0,255, 0, - 1 0, 0,255, 0,255,255, 255, 0,255, 255,255, 0, - 2 255,128, 0, 128,255, 0, 0,255,128, 0,128,255, - 3 128, 0,255, 255, 0,128, 085,085,085, 170,170,170/ - DATA TKRGB/ 0, 0, 0, 100,100,100, 100, 0, 0, 0,100, 0, - 1 0, 0,100, 0,100,100, 100, 0,100, 100,100, 0, - 2 100, 50, 0, 50,100, 0, 0,100, 50, 0, 50,100, - 3 50, 0,100, 100, 0, 50, 33, 33, 33, 67, 67, 67/ - DATA STATE/0/ -C----------------------------------------------------------------------- -C - IF (MODE.LT.1 .OR. MODE.GT.NDEVS) CALL GRWARN('Error in GRTT00') - GOTO( 10, 20, 30, 40, 50, 60, 70, 80, 90,100, - 1 110,120,130,140,150,160,170,180,900,900, - 2 210,900,900,240), IFUNC -C -- Ignore unimplemented function - 900 RETURN -C -C--- IFUNC = 1, Return device name.------------------------------------- -C - 10 CONTINUE - CHR = DEVICE(MODE) - LCHR = LEN(DEVICE(MODE)) - RETURN -C -C--- IFUNC = 2, Return physical min and max for plot device, and range -C of color indices.--------------------------------------- -C - 20 CONTINUE - RBUF(1) = 0 - RBUF(2) = XSIZE(MODE) - RBUF(3) = 0 - RBUF(4) = YSIZE(MODE) - RBUF(5) = 0 - RBUF(6) = MAXCI(MODE) - NBUF = 6 - RETURN -C -C--- IFUNC = 3, Return device resolution. ------------------------------ -C - 30 CONTINUE - RBUF(1) = XRESLN(MODE) - RBUF(2) = YRESLN(MODE) - RBUF(3) = 1 - NBUF = 3 - RETURN -C -C--- IFUNC = 4, Return misc device info. ------------------------------- -C (This device is Interactive, Cursor, No dashed lines, No areafill, -C No thick lines, No markers; some varieties have rectangle fill) -C - 40 CONTINUE - CHR = 'ICNNNNNNNN' - IF (MODE.EQ.2 .OR. MODE.EQ.7 .OR. MODE.EQ.8) CHR(6:6) = 'R' - IF (MODE.EQ.10) THEN -C -- VMAC: rect. fill and wait before closing graph window - CHR(6:6) = 'R' - CHR(8:8) = 'V' - ENDIF - LCHR = 10 - RETURN -C -C--- IFUNC = 5, Return default file name. ------------------------------ -C - 50 CONTINUE - CALL GRTRML(CHR,LCHR) - RETURN -C -C--- IFUNC = 6, Return default physical size of plot. ------------------ -C - 60 CONTINUE - RBUF(1) = 0 - RBUF(2) = XSIZE(MODE) - RBUF(3) = 0 - RBUF(4) = YSIZE(MODE) - NBUF = 4 - RETURN -C -C--- IFUNC = 7, Return misc defaults. ---------------------------------- -C - 70 CONTINUE - RBUF(1) = 2.0 - NBUF = 1 - RETURN -C -C--- IFUNC = 8, Select plot. ------------------------------------------- -C - 80 CONTINUE -C -- do nothing - RETURN -C -C--- IFUNC = 9, Open workstation. -------------------------------------- -C - 90 CONTINUE -C -- check for concurrent access - IF (STATE.EQ.1) THEN - CALL GRWARN('a PGPLOT Tektronix device is already open') - RBUF(1) = 0 - RBUF(2) = 0 - RETURN - END IF - APPEND = RBUF(3) .NE. 0.0 - RBUF(1) = 0.0 - NBUF = 2 - ICHAN = GROTER(CHR, LCHR) - IF (ICHAN .LT. 0) THEN - TEXT = 'Cannot open output device for plot type '// - : DEVICE(MODE) - CALL GRWARN(TEXT) - RBUF(2) = 0.0 - RETURN - ELSE - STATE = 1 - RBUF(2) = 1.0 - END IF - LASTI = -1 - LASTJ = -1 - ICI = 1 - NPAGE = 0 - LBUF = 0 - IF (.NOT.APPEND) THEN - IF ( MODE.EQ.4 ) THEN -C -- load gterm default color table. - DO 91 I=0,15 - CTMP(1:6) = CHAR(GS)//CHAR(ESC)//'TG14' - LTMP = 6 - CALL GRTT05(I, CADD, LADD) - CTMP(LTMP+1:LTMP+LADD) = CADD(:LADD) - LTMP = LTMP + LADD -C -- red - CALL GRTT05(IRGB(1,I), CADD, LADD) - CTMP(LTMP+1:LTMP+LADD) = CADD(:LADD) - LTMP = LTMP + LADD -C -- green - CALL GRTT05(IRGB(2,I), CADD, LADD) - CTMP(LTMP+1:LTMP+LADD) = CADD(:LADD) - LTMP = LTMP + LADD -C -- blue - CALL GRTT05(IRGB(3,I), CADD, LADD) - CTMP(LTMP+1:LTMP+LADD) = CADD(:LADD) - LTMP = LTMP + LADD - CTMP(LTMP+1:LTMP+1) = CHAR(US) - LTMP = LTMP + 1 - CALL GRTT02(ICHAN, MODE, CTMP, LTMP, CBUF, LBUF) - 91 CONTINUE - CALL GRTT02(ICHAN, MODE, CHAR(CAN), 1, CBUF, LBUF) - ELSE IF (MODE.EQ.10) THEN -C -- VMAC: put into Tek 4105 mode - CTMP(1:5)=CHAR(ESC)//'%!1'//CHAR(GS) - CALL GRTT02(ICHAN, MODE, CTMP, 5, CBUF, LBUF) - SEFCOL = .TRUE. -C -- set default color representation (only indices 2 to 15 - DO 92,I=2,15 - CALL GRXHLS(IRGB(1,I)/255.,IRGB(2,I)/255.,IRGB(3,I)/255. - : ,HUE,LIG,SAT) - CALL GRTT06(I, NINT(HUE), NINT(LIG*100), NINT(SAT*100) - : , CTMP, LTMP) - CALL GRTT02(ICHAN, MODE, CTMP, LTMP, CBUF, LBUF) -92 CONTINUE - END IF - END IF - RETURN -C -C--- IFUNC=10, Close workstation. -------------------------------------- -C - 100 CONTINUE - IF ( MODE.EQ.6 ) THEN -C -- For zstem switch back to alpha mode at the last possible -C moment. - LTMP = 1 - CALL GRWTER(ICHAN, CHAR(CAN), LTMP) - ELSE IF ( MODE.EQ.7 ) THEN -C -- For v603 switch back to alpha mode at the last possible -C moment. - CTMP(1:7) = CHAR(CAN)//CHAR(ESC)//CHAR(91)//CHAR(63)// - : CHAR(51)//CHAR(56)//CHAR(108) - LTMP=7 - CALL GRWTER(ICHAN, CTMP, LTMP) - ELSE IF (MODE.EQ.10) THEN -C -- VMAC: put into VT100 Mode without window resize - CTMP(1:5)=CHAR(GS)//CHAR(ESC)//'%!7' - LTMP=5 - CALL GRWTER(ICHAN, CTMP, LTMP) - END IF - CALL GRCTER(ICHAN) - STATE = 0 - RETURN -C -C--- IFUNC=11, Begin picture. ------------------------------------------ -C - 110 CONTINUE - NPAGE = NPAGE+1 - LASTI = -1 - IF (.NOT.APPEND) THEN - IF (MODE.EQ.5 .OR. MODE.EQ.6 .OR. MODE. EQ.8) THEN -C -- xterm, zstem, krm3: select Tek mode, erase screen - CTMP(1:1) = CHAR(ESC) - CTMP(2:2) = CHAR(12) - CALL GRTT02(ICHAN, MODE, CTMP, 2, CBUF, LBUF) - ELSE IF (MODE.EQ.7) THEN -C -- V603: select Tek mode - CTMP(1:1) = CHAR(GS) - CTMP(2:2) = CHAR(ESC) - CTMP(3:3) = CHAR(12) - CALL GRTT02(ICHAN, MODE, CTMP, 3, CBUF, LBUF) - ELSE -C -- erase graphics screen - CTMP(1:1) = CHAR(GS) - CTMP(2:2) = CHAR(ESC) - CTMP(3:3) = CHAR(12) - CTMP(4:4) = CHAR(CAN) - CALL GRTT02(ICHAN, MODE, CTMP, 4, CBUF, LBUF) - IF (MODE.EQ.10) THEN -C -- clear type ahead buffer (for cursor) - CALL GRTT03(ICHAN, -3, I0, J0, ICH, IER) -C -- fill screen with background color - CTMP=CHAR(ESC)//'MP0'//CHAR(ESC)//'LP' - : //CHAR(32)//CHAR(96)//CHAR(32)//CHAR(64)//'0' - LTMP=12 - CALL GRTT02(ICHAN, MODE, CTMP, LTMP, CBUF, LBUF) - LASTI=0 - LASTJ=0 - CALL GRTT01(ICHAN, MODE, I4014(MODE), LASTI, LASTJ, - : 0, 4095, 4095, 4095, CBUF, LBUF) - CALL GRTT01(ICHAN, MODE, I4014(MODE), LASTI, LASTJ, - : 4095, 4095, 4095, 0, CBUF, LBUF) - CTMP=CHAR(ESC)//'LE' - LTMP=3 - CALL GRTT02(ICHAN, MODE, CTMP, LTMP, CBUF, LBUF) - END IF - END IF - ELSE IF (MODE.EQ.8) THEN -C -- krm3: enter graph mode without deleting screen - CTMP(1:1) = CHAR(ESC) - CTMP(2:2) = CHAR(91) - CTMP(3:3) = CHAR(63) - CTMP(4:4) = CHAR(51) - CTMP(5:5) = CHAR(56) - CTMP(6:6) = CHAR(104) - CALL GRTT02(ICHAN, MODE, CTMP, 6, CBUF, LBUF) - ELSE IF (MODE.EQ.9) THEN -C -- TK4100: put device in graphics mode, erase screen - CTMP(1:1) = CHAR(ESC) - CTMP(2:4) = '%!0' - CTMP(5:5) = CHAR(ESC) - CTMP(6:6) = CHAR(12) - CALL GRTT02(ICHAN, MODE, CTMP, 6, CBUF, LBUF) - CTMP(1:1) = CHAR(ESC) - CTMP(2:6) = 'RU1;4' - CALL GRTT02(ICHAN, MODE, CTMP, 6, CBUF, LBUF) -C -- set default color representation - DO 111 I=0,15 - CTMP(1:5) = CHAR(ESC)//'TG14' - LTMP = 5 - CALL GRTT05(I, CADD, LADD) - CTMP(LTMP+1:LTMP+LADD) = CADD(:LADD) - LTMP = LTMP + LADD -C -- red - CALL GRTT05(TKRGB(1,I), CADD, LADD) - CTMP(LTMP+1:LTMP+LADD) = CADD(:LADD) - LTMP = LTMP + LADD -C -- green - CALL GRTT05(TKRGB(2,I), CADD, LADD) - CTMP(LTMP+1:LTMP+LADD) = CADD(:LADD) - LTMP = LTMP + LADD -C -- blue - CALL GRTT05(TKRGB(3,I), CADD, LADD) - CTMP(LTMP+1:LTMP+LADD) = CADD(:LADD) - LTMP = LTMP + LADD - CALL GRTT02(ICHAN, MODE, CTMP, LTMP, CBUF, LBUF) - 111 CONTINUE -C -- set color index 1 - CTMP(1:1) = CHAR(ESC) - CTMP(2:4) = 'ML1' - CALL GRTT02(ICHAN, MODE, CTMP, 4, CBUF, LBUF) - END IF - RETURN -C -C--- IFUNC=12, Draw line. ---------------------------------------------- -C (omitted for color 0 on devices without selective erase) -C - 120 CONTINUE - IF (ICI.EQ.0 .AND. (MODE.EQ.1 .OR. MODE.EQ.5)) RETURN - IF ( I4014(MODE).EQ.0 ) THEN - I0 = NINT(RBUF(1)) - J0 = NINT(RBUF(2)) - I1 = NINT(RBUF(3)) - J1 = NINT(RBUF(4)) - ELSE - I0 = NINT(4.*RBUF(1)) - J0 = NINT(4.*RBUF(2)) - I1 = NINT(4.*RBUF(3)) - J1 = NINT(4.*RBUF(4)) - END IF - CALL GRTT01(ICHAN, MODE, I4014(MODE), LASTI, LASTJ, - : I0, J0, I1, J1, CBUF, LBUF) - RETURN -C -C--- IFUNC=13, Draw dot. ----------------------------------------------- -C (omitted for color 0 on devices without selective erase) -C - 130 CONTINUE - IF (ICI.EQ.0 .AND. (MODE.EQ.1 .OR. MODE.EQ.5)) RETURN - IF ( I4014(MODE).EQ.0 ) THEN - I0 = NINT(RBUF(1)) - J0 = NINT(RBUF(2)) - ELSE - I0 = NINT(4.*RBUF(1)) - J0 = NINT(4.*RBUF(2)) - END IF - CALL GRTT01(ICHAN, MODE, I4014(MODE), LASTI, LASTJ, - : I0, J0, I0, J0, CBUF, LBUF) - RETURN -C -C--- IFUNC=14, End picture. -------------------------------------------- -C - 140 CONTINUE - IF (MODE.EQ.7) THEN -C -- V603: enter alphanumerics and unset graphics - CTMP(1:7) = CHAR(CAN)//CHAR(ESC)//CHAR(91)//CHAR(63)// - : CHAR(51)//CHAR(56)//CHAR(108) - LTMP=7 - CALL GRWTER(ICHAN, CTMP, LTMP) - ELSE IF (MODE.EQ.8) THEN -C -- krm3: enter alphanumerics and unset graphics - CTMP(1:6) = CHAR(ESC)//CHAR(91)//CHAR(63)// - : CHAR(51)//CHAR(56)//CHAR(108) - LTMP=6 - CALL GRWTER(ICHAN, CTMP, LTMP) - ELSE IF (MODE.EQ.9 .OR. MODE.EQ.10) THEN -C -- TK4100, VMAC: return to text mode - CTMP(1:1) = CHAR(ESC) - CTMP(2:4) = '%!1' - LTMP=4 - CALL GRWTER(ICHAN, CTMP, LTMP) - IF (MODE .EQ. 10) THEN -C -- flush type ahead buffer - CALL GRTT03(ICHAN, -2, I0, J0, ICH, IER) - CALL GRETER - END IF - END IF - RETURN -C -C--- IFUNC=15, Select color index. ------------------------------------- -C - 150 CONTINUE - ICI = RBUF(1) - IF (ICI.LT.0 .OR. ICI.GT.MAXCI(MODE)) THEN - ICI = 1 - RBUF(1) = ICI - END IF - LASTI = -1 - IF (MODE.EQ.2) THEN -C -- GraphOn - CTMP(1:1) = CHAR(GS) - CTMP(2:2) = CHAR(ESC) - CTMP(3:3) = CHAR(1) - IF (ICI.EQ.0) CTMP(3:3) = CHAR(16) - CALL GRTT02(ICHAN, MODE, CTMP, 3, CBUF, LBUF) - ELSE IF (MODE.EQ.3 .OR. MODE.EQ.7) THEN -C -- Retrographics, V603 - CTMP(1:1) = CHAR(GS) - CTMP(2:2) = CHAR(ESC) - CTMP(3:3) = CHAR(47) - CTMP(4:4) = CHAR(49-ICI) - CTMP(5:5) = CHAR(100) - CALL GRTT02(ICHAN, MODE, CTMP, 5, CBUF, LBUF) - ELSE IF ( MODE.EQ.4 .OR. MODE.EQ.6 .OR. MODE.EQ.10) THEN -C -- gterm and zstem, VMAC - CTMP(1:4) = CHAR(GS)//CHAR(ESC)//'ML' - CALL GRTT02(ICHAN, MODE, CTMP, 4, CBUF, LBUF) - CALL GRTT05(ICI, CTMP, LTMP) - CALL GRTT02(ICHAN, MODE, CTMP, LTMP, CBUF, LBUF) - SEFCOL=.TRUE. - ELSE IF (MODE.EQ.9) THEN -C -- TK4100 - CTMP(1:3) = CHAR(ESC)//'ML' - CALL GRTT02(ICHAN, MODE, CTMP, 3, CBUF, LBUF) - CALL GRTT05(ICI, CTMP, LTMP) - CALL GRTT02(ICHAN, MODE, CTMP, LTMP, CBUF, LBUF) - ELSE IF( MODE.EQ.8) THEN -C -- krm3: all attributes off - CTMP(1:1) = CHAR(27) - CTMP(2:2) = CHAR(91) - CTMP(3:3) = CHAR(48) - CTMP(4:4) = CHAR(59) -C -C Load color definitions (8-14 are bold versions of 1-7, so are not the -C standard PGPLOT ones) -C - IF ( ICI.EQ.0 ) I=0 - IF ( ICI.EQ.1 .OR. ICI.EQ.8) I=7 - IF ( ICI.EQ.2 .OR. ICI.EQ.9) I=1 - IF ( ICI.EQ.3 .OR. ICI.EQ.10) I=2 - IF ( ICI.EQ.4 .OR. ICI.EQ.11) I=4 - IF ( ICI.EQ.5 .OR. ICI.EQ.12) I=6 - IF ( ICI.EQ.6 .OR. ICI.EQ.13) I=5 - IF ( ICI.EQ.7 .OR. ICI.EQ.14) I=3 - CTMP(5:5) = CHAR(51) - CTMP(6:6) = CHAR(48+I) - IF (ICI.GT.7) THEN - CTMP(7:7) = CHAR(59) - CTMP(8:8) = CHAR(49) - CTMP(9:9) = CHAR(109) - CALL GRTT02(ICHAN, MODE, CTMP, 9, CBUF, LBUF) - ELSE - CTMP(7:7) = CHAR(109) - CALL GRTT02(ICHAN, MODE, CTMP, 7, CBUF, LBUF) - END IF - END IF - RETURN -C -C--- IFUNC=16, Flush buffer. ------------------------------------------- -C - 160 CONTINUE - IF (MODE.EQ.1 .OR. MODE.GT.5) THEN -C -- tek4010, zstem, v603, krm3, or tk4100 - CTMP(1:6) = CHAR(GS)//CHAR(55)//CHAR(127)//CHAR(32)// - : CHAR(64)//CHAR(US) - CALL GRTT02(ICHAN, MODE, CTMP, 6, CBUF, LBUF) - ELSE IF (MODE.EQ.5) THEN -C -- xterm - CTMP(1:3) = CHAR(US)//CHAR(ESC)//CHAR(3) - CALL GRTT02(ICHAN, MODE, CTMP, 3, CBUF, LBUF) - ELSE - CTMP(1:8) = CHAR(GS)//CHAR(55)//CHAR(127)//CHAR(32)// - : CHAR(64)//CHAR(3)//CHAR(CAN)//CHAR(US) - CALL GRTT02(ICHAN, MODE, CTMP, 8, CBUF, LBUF) - END IF - CALL GRWTER(ICHAN, CBUF, LBUF) - LASTI = -1 - RETURN -C -C--- IFUNC=17, Read cursor. -------------------------------------------- -C - 170 CONTINUE -C -- flush buffer - CALL GRWTER(ICHAN, CBUF, LBUF) - LASTI = -1 - IF ( MODE.EQ.5 .OR. MODE.EQ.6 ) THEN -C -- xterm and zstem make sure terminal is in Tektronix mode. - LTMP = 6 - CALL GRWTER(ICHAN, CHAR(ESC)//'[?38h', LTMP) - END IF -C -- initial cursor position - I0 = NINT(RBUF(1)) - J0 = NINT(RBUF(2)) -C -- timeout mode - IF (MODE .EQ. 10) THEN - I1 = -NINT(RBUF(5)) - IF (I1 .LT. 0) I1=0 - ELSE - I1 = -1 - END IF -C -- read cursor - CALL GRTT03(ICHAN, I1, I0, J0, ICH, IER) -C -- on XTERM, map mouse button clicks onto A, D, X. - IF (MODE.EQ.5) THEN - IF (ICH.EQ.236) THEN - ICH = ICHAR('a') - ELSE IF (ICH.EQ.237) THEN - ICH = ICHAR('d') - ELSE IF (ICH.EQ.242) THEN - ICH = ICHAR('x') - ELSE IF (ICH.EQ.204) THEN - ICH = ICHAR('A') - ELSE IF (ICH.EQ.205) THEN - ICH = ICHAR('D') - ELSE IF (ICH.EQ.210) THEN - ICH = ICHAR('X') - END IF - END IF -C -- return result - IF (IER.EQ.0) THEN - RBUF(1) = I0 - RBUF(2) = J0 - CHR(1:1) = CHAR(ICH) - ELSE - CHR(1:1) = CHAR(0) - END IF - NBUF = 2 - LCHR = 1 - RETURN -C -C--- IFUNC=18, Erase alpha screen. ------------------------------------- -C - 180 CONTINUE - IF (MODE.EQ.2 .OR. MODE.EQ.3) THEN -C -- GraphOn, Retrographics: return to VT100 mode and -C issue VT100 erase-screen command - CTMP(1:8) = CHAR(GS)//CHAR(55)//CHAR(127)//CHAR(32)// - : CHAR(64)//CHAR(3)//CHAR(CAN)//CHAR(US) - CALL GRTT02(ICHAN, MODE, CTMP, 8, CBUF, LBUF) - CTMP(1:7) = CHAR(ESC)//'[2J'//CHAR(ESC)//'[H' - CALL GRTT02(ICHAN, MODE, CTMP, 7, CBUF, LBUF) - LASTI = -1 - END IF - RETURN -C -C--- IFUNC=21, Set color representation. ------------------------------- -C - 210 CONTINUE - IF (MODE.EQ.4) THEN -C -- gterm - I = RBUF(1) - CTMP(1:6) = CHAR(GS)//CHAR(ESC)//'TG14' - LTMP = 6 - CALL GRTT05(I, CADD, LADD) - CTMP(LTMP+1:LTMP+LADD) = CADD(:LADD) - LTMP = LTMP + LADD -C -- red - INTEN = RBUF(2)*255.0 - CALL GRTT05(INTEN, CADD, LADD) - CTMP(LTMP+1:LTMP+LADD) = CADD(:LADD) - LTMP = LTMP + LADD -C -- green - INTEN = RBUF(3)*255.0 - CALL GRTT05(INTEN, CADD, LADD) - CTMP(LTMP+1:LTMP+LADD) = CADD(:LADD) - LTMP = LTMP + LADD -C -- blue - INTEN = RBUF(4)*255.0 - CALL GRTT05(INTEN, CADD, LADD) - CTMP(LTMP+1:LTMP+LADD) = CADD(:LADD) - LTMP = LTMP + LADD -C - CTMP(LTMP+1:LTMP+2) = CHAR(US)//CHAR(CAN) - LTMP = LTMP + 2 - CALL GRTT02(ICHAN, MODE, CTMP, LTMP, CBUF, LBUF) - CALL GRWTER(ICHAN, CBUF, LBUF) - LASTI = -1 - ELSE IF (MODE.EQ.9) THEN -C -- TK4100 - I = RBUF(1) - CTMP(1:5) = CHAR(ESC)//'TG14' - LTMP = 5 - CALL GRTT05(I, CADD, LADD) - CTMP(LTMP+1:LTMP+LADD) = CADD(:LADD) - LTMP = LTMP + LADD -C -- red - INTEN = RBUF(2)*100.0 - CALL GRTT05(INTEN, CADD, LADD) - CTMP(LTMP+1:LTMP+LADD) = CADD(:LADD) - LTMP = LTMP + LADD -C -- green - INTEN = RBUF(3)*100.0 - CALL GRTT05(INTEN, CADD, LADD) - CTMP(LTMP+1:LTMP+LADD) = CADD(:LADD) - LTMP = LTMP + LADD -C -- blue - INTEN = RBUF(4)*100.0 - CALL GRTT05(INTEN, CADD, LADD) - CTMP(LTMP+1:LTMP+LADD) = CADD(:LADD) - LTMP = LTMP + LADD - CALL GRTT02(ICHAN, MODE, CTMP, LTMP, CBUF, LBUF) - CALL GRWTER(ICHAN, CBUF, LBUF) - LASTI = -1 - ELSE IF (MODE.EQ.10) THEN -C -- Only color indices >1 are treated (confusion with "Black Screen" option in VersaTerm) - IF (NINT(RBUF(1)) .GT. 1) THEN - CTMP(1:1)=CHAR(GS) - CALL GRTT02(ICHAN, MODE, CTMP, 1, CBUF, LBUF) - CALL GRXHLS(RBUF(2), RBUF(3), RBUF(4), HUE, LIG, SAT) - CALL GRTT06(NINT(RBUF(1)) - : , NINT(HUE), NINT(LIG*100), NINT(SAT*100), CTMP, LTMP) - CALL GRTT02(ICHAN, MODE, CTMP, LTMP, CBUF, LBUF) - CALL GRWTER(ICHAN, CBUF, LBUF) - END IF - LASTI = -1 - END IF - RETURN -C -C--- IFUNC=24, Rectangle fill. ----------------------------------------- -C - 240 CONTINUE - IF ( I4014(MODE).EQ.0 ) THEN - I0 = NINT(RBUF(1)) - J0 = NINT(RBUF(2)) - I1 = NINT(RBUF(3)) - J1 = NINT(RBUF(4)) - ELSE - I0 = NINT(4.*RBUF(1)) - J0 = NINT(4.*RBUF(2)) - I1 = NINT(4.*RBUF(3)) - J1 = NINT(4.*RBUF(4)) - END IF - IF (MODE.EQ.2) THEN -C -- GraphOn -C -- enter rectangle mode - CALL GRTT02(ICHAN, MODE, CHAR(GS)//CHAR(ESC)//CHAR(2), 3, - : CBUF, LBUF) -C -- draw rectangle - CALL GRTT01(ICHAN, MODE, I4014(MODE), LASTI, LASTJ, - : I0, J0, I1, J1, CBUF, LBUF) -C -- exit rectangle mode - CALL GRTT02(ICHAN, MODE, CHAR(ESC)//CHAR(3), 2, CBUF, LBUF) - ELSE IF (MODE.EQ.7 .OR. MODE.EQ.8) THEN -C -- v603, krm3: needs bottom left corner and rectangle -C dimensions - IBUF(1)=I0+1 - IBUF(2)=J0+1 - IBUF(3)=I1+1 - IBUF(4)=J1+1 - DO 241 I=1,4 - IF (IBUF(I) .LT. 1) IBUF(I)=1 - IF (IBUF(I) .GT. 1056) IBUF(I)=1056 - 241 CONTINUE - IBUF(3)=IBUF(3)-IBUF(1) - IBUF(4)=IBUF(4)-IBUF(2) - ITOT=0 - DO 244 I=1,4 - WRITE (CSCR(I)(1:4), '(I4)') IBUF(I) - IBUF(I)=1 - DO 242 J=1,4 - IF (CSCR(I)(J:J) .NE. ' ') THEN - GOTO 243 - END IF - IBUF(I)=IBUF(I)+1 - 242 CONTINUE - 243 CONTINUE - ITOT=ITOT+5-IBUF(I) - 244 CONTINUE - CTMP(1:8+ITOT)= - : CHAR(ESC)//CHAR(47)//CSCR(1)(IBUF(1):4)//CHAR(59)// - : CSCR(2)(IBUF(2):4)//CHAR(59)//CSCR(3)(IBUF(3):4)// - : CHAR(59)//CSCR(4)(IBUF(4):4)//CHAR(59)//CHAR(49)// - : CHAR(121) - CALL GRTT02(ICHAN, MODE, CTMP, 8+ITOT, CBUF, LBUF) - ELSE IF (MODE.EQ.10) THEN -C -- VMAC: use polygon fill commands - IF (SEFCOL) THEN -C set fill color - SEFCOL=.FALSE. - CTMP(1:3) = CHAR(ESC)//'MP' - CALL GRTT02(ICHAN, MODE, CTMP, 3, CBUF, LBUF) - CALL GRTT05(-ICI, CTMP, LTMP) - CALL GRTT02(ICHAN, MODE, CTMP, LTMP, CBUF, LBUF) - ENDIF -C send "start polygon fill" - CTMP(1:3) = CHAR(ESC)//'LP' - LTMP=3 -C make lasti,lastj different from i0,j0 in each bit - LASTI=4095-I0 - LASTJ=4095-J0 -C send first coordinate - CALL GRTT04(I4014(MODE), LASTI, LASTJ, I0, J0, CTMP, LTMP) - LASTI=I0 - LASTJ=J0 -C '0' means: boundary has the same color as fill area - CTMP(LTMP+1:LTMP+1)='0' - LTMP=LTMP+1 - CALL GRTT02(ICHAN, MODE, CTMP, LTMP, CBUF, LBUF) -C further edges: - CALL GRTT01(ICHAN, MODE, I4014(MODE), LASTI, LASTJ, - : I0, J1, I1, J1, CBUF, LBUF) - CALL GRTT01(ICHAN, MODE, I4014(MODE), LASTI, LASTJ, - : I1, J1, I1, J0, CBUF, LBUF) -C send "end polygon fill" - CTMP(1:3)=CHAR(ESC)//'LE' - CALL GRTT02(ICHAN, MODE, CTMP, 3, CBUF, LBUF) - END IF - RETURN -C----------------------------------------------------------------------- - END -C*GRTT01 -- PGPLOT Tektronix driver, draw line segment -C+ - SUBROUTINE GRTT01(ICHAN, MODE, I4014, LASTI, LASTJ, I0, J0, - : I1, J1, CBUF, LBUF) - INTEGER ICHAN, MODE, I4014, LASTI, LASTJ, I0, J0, I1, J1, LBUF - CHARACTER CBUF*(*) -C -C This routine draws a line from (I0, J0) to (I1, J1). If LASTI>=0 -C assume that the cursor is at the position is at (LASTI, LASTJ). -C For this case, a minimum length move is done from (LASTI, LASTJ) to -C the nearer point. Of course, if (LASTI, LASTJ) and the nearer point -C are the same, then no bytes of positioning data are generated and -C sent to the terminal. If LASTI<0 then a move is done with the -C coordinate fully specified. In both cases the line end point -C is specified using the fewest number of bytes allowed by the protocol. -C Upon return, LASTI,LASTJ will contain the current cursor position. -C If I4014=0 then 10 bit (4010) coordinates are generated, for I4014=1, -C full 12 bit Tektronix (4014 and higher) coordinates are generated. -C Note: The 'delete' character (127) can occur in LOY or EXTRA byte; -C it can be replaced by escape-? if desired. -C -C Arguments: -C ICHAN (in) : passed to GRTT02 if called. -C MODE (in) : passed to GRTT02 if called. -C I4014 (in) : =0 generate 4010 coords, =1 generate 4014. -C LASTI,LASTJ (in/out) : current position -C I0, J0 (in/out) : device coordinates of the starting point. -C I1, J1 (in/out) : device coordinates of the end point. -C CBUF (in/out) : buffer for instruction. -C LBUF (in/out) : Number of valid characters in CBUF. -C -C 1993-Feb-02 - Created from GRZS01 - [AFT] -C----------------------------------------------------------------------- - INTEGER GS - PARAMETER (GS = 29) - INTEGER MASKLX, MASKHX - PARAMETER (MASKLX = 64, MASKHX = 32) - INTEGER MASKLY, MASKHY - PARAMETER (MASKLY = 96, MASKHY = 32) - INTEGER MASKEX - PARAMETER (MASKEX = 96) -C - CHARACTER CTMP*12 - INTEGER ID0, ID1, IFLUSH, ITMP - INTEGER IEX, ILOX, IHIX, ILOY, IHIY, LTMP -C -C If it is possible for this routine to generate enough data to fill -C the buffer, and thus cause it to be flushed to the terminal, then we -C force the write to take place now. This will ensure that terminal -C is in the correct state for the following commands. - IF ( LBUF+11.GE.LEN(CBUF) ) THEN - CALL GRWTER(ICHAN, CBUF, LBUF) - IFLUSH = 1 - ELSE - IFLUSH = 0 - END IF -C - LTMP = 0 - IF(LASTI.LT.0) THEN -C Last position is invalid, therefore do a dark vector move with all -C coordinates specified. - LTMP=LTMP+1 - CTMP(LTMP:LTMP)=CHAR(GS) - IF ( I4014.EQ.0 ) THEN - IHIY = J0/32 - ILOY = MOD(J0, 32) - IHIX = I0/32 - ILOX = MOD(I0, 32) - CTMP(LTMP+1:LTMP+4) = - : CHAR( MASKHY + IHIY )// - : CHAR( MASKLY + ILOY )// - : CHAR( MASKHX + IHIX )// - : CHAR( MASKLX + ILOX ) - LTMP = LTMP + 4 - ELSE - IHIY = J0/128 - ILOY = MOD(J0/4, 32) - IHIX = I0/128 - ILOX = MOD(I0/4, 32) - IEX = 4*MOD(J0, 4) + MOD(I0, 4) - CTMP(LTMP+1:LTMP+5) = - : CHAR( MASKHY + IHIY )// - : CHAR( MASKEX + IEX )// - : CHAR( MASKLY + ILOY )// - : CHAR( MASKHX + IHIX )// - : CHAR( MASKLX + ILOX ) - LTMP = LTMP + 5 - END IF - ELSE -C Last position is valid, move pen to nearest end point of line. - ID0=ABS(LASTI-I0)+ABS(LASTJ-J0) - ID1=ABS(LASTI-I1)+ABS(LASTJ-J1) - IF(ID1.LT.ID0) THEN -C Swap coordinates to minimize 'pen motion'. For optimized coordinates -C this can reduce the amount of I/O to the the terminal. - ITMP=I0 - I0=I1 - I1=ITMP - ITMP=J0 - J0=J1 - J1=ITMP - ITMP=ID0 - ID0=ID1 - ID1=ITMP - END IF - IF(ID0.NE.0 .OR. ID1.NE.0) THEN -C Position has changed, so do a move operation. - LTMP=LTMP+1 - CTMP(LTMP:LTMP)=CHAR(GS) - CALL GRTT04(I4014,LASTI,LASTJ,I0,J0,CTMP,LTMP) - ELSE - IF(IFLUSH.NE.0) THEN -C The position is valid, but the buffer was flushed, so terminal may -C no longer be in graph mode. Therefore, send GS and followed by a -C zero length dark move (i.e., just resend LOX coordinate). - IF ( I4014.EQ.0 ) THEN - ILOX = MOD(I0, 32) - ELSE - ILOX = MOD(I0/4, 32) - END IF - CTMP(LTMP+1:LTMP+2)=CHAR(GS)//CHAR(MASKLX+ILOX) - LTMP=LTMP+2 - END IF - END IF - END IF -C -C Terminal is now in graph mode, and the `pen' has been positioned. -C Do an optimized draw. - CALL GRTT04(I4014,I0,J0,I1,J1,CTMP,LTMP) - CALL GRTT02(ICHAN, MODE, CTMP, LTMP, CBUF, LBUF) -C -C Remember current position. - LASTI=I1 - LASTJ=J1 - RETURN -C - END -C*GRTT02 -- PGPLOT Tektronix driver, transfer data to buffer -C+ - SUBROUTINE GRTT02 (ICHAN, MODE, CADD, LADD, CBUF, LBUF) - INTEGER ICHAN, MODE, LADD, LBUF - CHARACTER CADD*(*), CBUF*(*) -C -C Arguments: -C ICHAN (input) : channel number for output (when buffer is full). -C MODE (input) : emulation type. -C CADD (input) : text to add to buffer. -C LADD (input) : number of characters to transfer. -C CBUF (input) : output buffer. -C LBUF (in/out) : number of valid characters in CBUF. -C -C Subroutines called: -C GRWTER -C----------------------------------------------------------------------- - IF (LBUF+LADD.GE.LEN(CBUF) ) THEN - CALL GRWTER(ICHAN, CBUF, LBUF) - END IF -C - IF ( LADD.GT.0 ) THEN - IF ( LBUF.EQ.0 ) THEN - IF ( MODE.EQ.5 .OR. MODE.EQ.6 ) THEN - CBUF(1:6) = CHAR(27)//'[?38h' - LBUF = 6 - END IF - END IF - CBUF(LBUF+1:LBUF+LADD) = CADD(1:LADD) - LBUF = LBUF + LADD - END IF -C----------------------------------------------------------------------- - END -d subroutine put_it(ch) -d character ch*(*) -d character logbuf*1000/'|'/ -d integer pos/1/ -d integer i,j -c -d do i=1,len(ch) -d if (ch(i:i) .ge. ' ') then -d logbuf(pos+1:pos+1)=ch(i:i) -d pos=pos+1 -d else -d logbuf(pos+1:pos+2)='^'//char(ichar(ch(1:1))+64) -d pos=pos+2 -d endif -d enddo -d return -c -d entry prt_it -d if (pos .gt. 1) then -d j=1 -d do i=2,pos -d if (logbuf(i:i) .eq. '|') then -d print *,logbuf(j:i) -d j=i -d end if -d enddo -d print *,logbuf(j:i) -d print * -d end if -d pos=1 -d end - -C*GRTT03 -- PGPLOT Tektronix driver, cursor routine -C+ - SUBROUTINE GRTT03 (ICHAN, ITMO, IX, IY, IC, IER) - INTEGER ICHAN, ITMO, IX, IY, IC, IER -C -C Arguments: -C ICHAN (input) : channel for output to device. -C ITMO (input) : timeout/sec for VMAC or -1 for other devices -C -2 for clearing type-ahead buffer (on begin picture) -C IX, IY (in/out) : initial/final coordinates of cursor (device -C coordinates). -C IC (output) : character code. -C IER (output) : error status (0 is OK). -C -C----------------------------------------------------------------------- - - CHARACTER CBUF*16, CPROM*10, CNEXT*1 - INTEGER I1, I2, LBUF, I, ITRM, IWARN - LOGICAL FLUSH/.TRUE./ - SAVE LBUF, CBUF, ITRM, IWARN, FLUSH - DATA LBUF/0/, ITRM/10/, IWARN/0/ - - IF (ITMO .EQ. -3) THEN -C -- flush next time - FLUSH=.TRUE. - LBUF=0 - RETURN - END IF - IF (ITMO .EQ. -2) THEN -C -- flush type-ahead buffer now -1 CALL GRKTER(ICHAN, 1, CBUF(1:1)) - IF (CBUF(1:1) .NE. CHAR(0)) GOTO 1 -d call prt_it - LBUF=0 - RETURN - ENDIF - IF (LBUF .GT. 5 .OR. LBUF .EQ. 1) THEN - IC=ICHAR(CBUF(1:1)) -d call put_it('[pop:') -d call put_it(cbuf(1:1)) -d call put_it(']|') - IF (LBUF .GT. 1) CBUF(1:LBUF-1)=CBUF(2:LBUF) - LBUF=LBUF-1 - RETURN - END IF - CNEXT=CHAR(0) - IF (LBUF .LT. 5) THEN -C -C Position cursor (by drawing a dark vector). -C - CPROM(1:1) = CHAR(29) - CPROM(2:2) = CHAR(32+(IY/32)) - CPROM(3:3) = CHAR(96+MOD(IY,32)) - CPROM(4:4) = CHAR(32+(IX/32)) - CPROM(5:5) = CHAR(64+MOD(IX,32)) - CPROM(6:6) = CHAR(27) - CPROM(7:7) = CHAR(47) - CPROM(8:8) = CHAR(102) - CPROM(9:9) = CHAR(27) - CPROM(10:10) = CHAR(26) - IF (ITMO .LT. 0) THEN - -C -- non-VMAC modes: Do a read with prompt. - LBUF = 5 - CALL GRPTER(ICHAN, CPROM, 10, CBUF, LBUF) -C -- must read at least 5 characters. - IF (LBUF.LT.5) GOTO 90 - - ELSE - -C -- VMAC mode: read key in type-ahead buffer -10 CALL GRKTER(ICHAN, 1, CBUF(1:1)) - IF (CBUF(1:1) .GE. ' ' .AND. .NOT. FLUSH) GOTO 60 -C -- flush control characters - IF (CBUF(1:1) .NE. CHAR(0)) GOTO 10 - FLUSH=.FALSE. - LBUF=10 - CALL GRWTER(ICHAN, CPROM, LBUF) -d call put_it('\') -C -- first character with specified timeout - CALL GRKTER(ICHAN, ITMO*10, CBUF(1:1)) - IF (CBUF(1:1) .EQ. CHAR(0)) THEN -d call put_it('[tmo]|') -C -- Send LF (quit GIN mode) - LBUF=1 - CPROM=CHAR(10) - CALL GRWTER(ICHAN, CPROM, LBUF) - CALL GRKTER(ICHAN, 5, CBUF(1:1)) - IF (CBUF(1:1) .EQ. CHAR(0)) GOTO 90 - END IF -d call put_it(cbuf(1:1)) - DO 20,I=2,5 - CALL GRKTER(ICHAN, 50, CBUF(I:I)) -d call put_it(cbuf(i:i)) - IF (CBUF(I:I) .LT. ' ') THEN -C -- error or key in type-ahead buffer - IF (I .EQ. 2) GOTO 60 -d call put_it('[err]|') - GOTO 90 - END IF -20 CONTINUE - LBUF=6 -30 CALL GRKTER(ICHAN, ITRM, CBUF(LBUF:LBUF)) -d call put_it(cbuf(lbuf:lbuf)) - IF (CBUF(LBUF:LBUF).GE.' '.AND.CBUF(LBUF:LBUF).LT.'@') THEN - IF (CBUF(1:1) .LT. ' ') THEN -C -- typed ahead control chars ignored - CBUF(1:LBUF-1)=CBUF(2:LBUF) - ELSE IF (LBUF .LT. LEN(CBUF)) THEN - LBUF=LBUF+1 - ELSE -C -- throw away some typed ahead chars - CBUF(LBUF-5:LBUF-1)=CBUF(LBUF-4:) - END IF - GOTO 30 - END IF -C -C no GIN-terminator seen: reduce time out, else increase timeout -C - IF (CBUF(LBUF:LBUF) .EQ. CHAR(0)) THEN - ITRM=(ITRM+5)/2 - IF (ITRM .LE. 7 .AND. IWARN .EQ. 0) THEN - IWARN=1 - I=2 - CALL GRWTER(ICHAN, CHAR(27)//CHAR(12), I) - CALL GRTT07(ICHAN,3 - :,'Please make sure that the following values are set') - CALL GRTT07(ICHAN,2 - :,'in VersaTerm Menu Emulation/GraphicInput...') - CALL GRTT07(ICHAN,1 - :,'Mouse Click: A, GIN Terminator ^M') - CALL GRKTER(ICHAN, 0, CBUF(LBUF:LBUF)) - END IF - ELSE - ITRM=MIN(ITRM*2,50) - END IF - - IF (CBUF(LBUF:LBUF) .GE. '@') THEN - CNEXT=CBUF(LBUF:LBUF) - END IF - LBUF=LBUF-1 - IF (LBUF .GT. 5) THEN -C -C There were characters typed while sending GIN, return them -C -d call put_it('[1st:') -d call put_it(cbuf(1:1)) -d call put_it(']|') - IC=ICHAR(CBUF(1:1)) - CBUF(1:LBUF-1)=CBUF(2:LBUF) - LBUF=LBUF-1 - RETURN - END IF - ENDIF - ENDIF -C -C Decode coordinates. -C -50 IC = ICHAR( CBUF(1:1) ) - I1 = MOD( ICHAR(CBUF(2:2)), 32 ) - I2 = MOD( ICHAR(CBUF(3:3)), 32 ) - IX = I1*32 + I2 - I1 = MOD( ICHAR(CBUF(4:4)), 32 ) - I2 = MOD( ICHAR(CBUF(5:5)), 32 ) - IY = I1*32 + I2 - IF (CNEXT .NE. CHAR(0)) THEN - CBUF(1:1)=CNEXT - LBUF = 1 - ELSE - LBUF = 0 - ENDIF - IER = 0 -d call put_it('[cor]|') - RETURN -C -C Return key only leaving coordinates untouched -C -60 IC = ICHAR(CBUF(1:1)) -d call put_it(cbuf(1:1)) -d call put_it('[t]|') - LBUF=0 - IER = 0 - RETURN -C -C An error occured -C -90 LBUF = 0 - IER = 1 - RETURN -C----------------------------------------------------------------------- - END -C*GRTT04 -- PGPLOT Tektronix driver, encode coordinate pair, optimize -C+ - SUBROUTINE GRTT04(I4014, LASTI, LASTJ, I0, J0, CTMP, LTMP) - INTEGER I4014, LASTI, LASTJ, I0, J0, LTMP - CHARACTER CTMP*(*) -C -C Assume cursor is at position LASTI, LASTJ and that the light or -C dark vector condition has been correctly set. Add up to 5 characters -C to CTMP to draw a vector to I0, J0. The minimum number of characters -C are encoded to obtain the motion. -C----------------------------------------------------------------------- - INTEGER MASKLX, MASKHX - PARAMETER (MASKLX = 64, MASKHX = 32) - INTEGER MASKLY, MASKHY - PARAMETER (MASKLY = 96, MASKHY = 32) - INTEGER MASKEX - PARAMETER (MASKEX=96) -C - INTEGER IEX, ILOX, IHIX, ILOY, IHIY - INTEGER LEX, LLOX, LHIX, LLOY, LHIY -C - IF ( I4014.EQ.0 ) THEN - LHIY = LASTJ/32 - LLOY = MOD(LASTJ, 32) - LHIX = LASTI/32 - LLOX = MOD(LASTI, 32) - LEX = 0 - IHIY = J0/32 - ILOY = MOD(J0, 32) - IHIX = I0/32 - ILOX = MOD(I0, 32) - IEX = 0 - ELSE - LHIY = LASTJ/128 - LLOY = MOD(LASTJ/4, 32) - LHIX = LASTI/128 - LLOX = MOD(LASTI/4, 32) - LEX = 4*MOD(LASTJ, 4) + MOD(LASTI, 4) - IHIY = J0/128 - ILOY = MOD(J0/4, 32) - IHIX = I0/128 - ILOX = MOD(I0/4, 32) - IEX = 4*MOD(J0, 4) + MOD(I0, 4) - END IF -C - IF(IHIY.NE.LHIY) THEN - LTMP=LTMP+1 - CTMP(LTMP:LTMP) = CHAR(32+IHIY) - END IF -C Note, for 4010 mode, IEX=LEX (by definition) - IF(IEX.NE.LEX) THEN - LTMP=LTMP+1 - CTMP(LTMP:LTMP) = CHAR(96+IEX) - END IF - IF(IEX.NE.LEX .OR. ILOY.NE.LLOY .OR. IHIX.NE.LHIX) THEN - LTMP=LTMP+1 - CTMP(LTMP:LTMP) = CHAR(96+ILOY) - END IF - IF(IHIX.NE.LHIX) THEN - LTMP=LTMP+1 - CTMP(LTMP:LTMP) = CHAR(32+IHIX) - END IF - LTMP=LTMP+1 - CTMP(LTMP:LTMP) = CHAR(64+ILOX) - RETURN - END -C*GRTT05 -- PGPLOT Tektronix 4100 driver, encode integer -C+ - SUBROUTINE GRTT05(I, C, NC) - INTEGER I - CHARACTER*(*) C - INTEGER NC -C -C Encode integer in host syntax. Input integer I; output encoded string -C C, containing NC characters (1, 2, or 3). This version encodes -C integers up to 1023, which fit in two characters. -C----------------------------------------------------------------------- - INTEGER J -C - J = IABS(I) - IF (J.LT.16) THEN - IF (I.LT.0) THEN - C(1:1) = CHAR(J+32) - ELSE - C(1:1) = CHAR(J+48) - END IF - NC = 1 - ELSE - C(1:1) = CHAR(J/16+64) - IF (I.LT.0) THEN - C(2:2) = CHAR(MOD(J,16)+32) - ELSE - C(2:2) = CHAR(MOD(J,16)+48) - END IF - NC = 2 - END IF -C - END -C*GRTT06 -- PGPLOT Tektronix 4100 driver, encode color definition -C+ - SUBROUTINE GRTT06(IDX, I1, I2, I3, C, NC) - INTEGER ESC, GS, US - PARAMETER (ESC=27, GS=29, US=31) - INTEGER IDX, I1, I2, I3 - CHARACTER*(*) C - INTEGER NC -C -C Encode color definition, Color index IDX, I1,I2,I3 are the 3 integer -C color components (definiton is device-dependent). -C output encoded string containing NC characters (max 20). -C----------------------------------------------------------------------- - INTEGER L -C - C(1:5) = CHAR(ESC)//'TG14' - NC=5 - CALL GRTT05(IDX, C(NC+1:NC+3), L) - NC=NC+L - CALL GRTT05(I1, C(NC+1:NC+3), L) - NC=NC+L - CALL GRTT05(I2, C(NC+1:NC+3), L) - NC=NC+L - CALL GRTT05(I3, C(NC+1:NC+3), L) - NC=NC+L - END -C*GRTT07 -- PGPLOT Tektronix 4100 driver, write out warning for VersaTerm -C+ - SUBROUTINE GRTT07(ICHAN, ILINE, WARN) - INTEGER ICHAN, ILINE - CHARACTER WBUF*9, WARN*(*) - INTEGER I,L,LBUF - - LBUF=5 - CALL GRWTER(ICHAN, CHAR(29)//CHAR(32+ILINE)//'a!A', LBUF) - DO I=1,LEN(WARN),9 - WBUF=WARN(I:) - L=MIN(9,LEN(WARN)-I+1) - LBUF=L+4 - CALL GRWTER(ICHAN,CHAR(27)//'LT'//CHAR(L+48)//WBUF,LBUF) - ENDDO - END diff --git a/tecs/pg_plus/vtdriv.f b/tecs/pg_plus/vtdriv.f deleted file mode 100644 index 5d8cd72..0000000 --- a/tecs/pg_plus/vtdriv.f +++ /dev/null @@ -1,518 +0,0 @@ -C*VTDRIV -- PGPLOT Regis (VT125) driver -C+ - SUBROUTINE VTDRIV (IFUNC, RBUF, NBUF, CHR, LCHR) - INTEGER IFUNC, NBUF, LCHR - REAL RBUF(*) - CHARACTER*(*) CHR -C -C PGPLOT driver for Regis devices. -C -C Version 1.1 - 1987 Aug 17 - add cursor (TJP). -C Version 1.3 - 1988 Mar 23 - add rectangle fill. -C Version 1.4 - 1991 Nov 6 - standardization (TJP). -C Version 1.5 - 1993 May 26 - more standardization (TJP). -C Version 1.6 - 1993 Jun 4 - add SAVE statements, use GRxTER routines (AFT) -C -C Supported devices: Digital Equipment Corporation VT125, VT240, or -C VT241 terminal; other REGIS devices may also work. -C -C Device type code: /VT125. -C -C Default file name: TT:PGPLOT.VTPLOT. This usually means the -C terminal you are logged in to (logical name TT), but the plot can be -C sent to another terminal by giving the device name, eg, TTC0:/VT, or -C it can be saved in a file by specifying a file name, eg, -C CITSCR:[TJP]XPLOT/VT (in this case a disk name must be included as -C part of the file name). -C -C Default view surface dimensions: Depends on monitor. -C -C Resolution: The default view surface is 768 (horizontal) x -C 460 (vertical) pixels. On most Regis devices, the resolution is -C degraded in the vertical direction giving only 230 distinguishable -C raster lines. (There are actually 240 raster lines, but 10 are reserved -C for a line of text.) -C -C Color capability: Color indices 0--3 are supported. By default, -C color index 0 is black (the background color). Color indices 1--3 -C are white, red, and green on color monitors, or white, dark grey, and -C light grey on monochrome monitors. The color representation of all -C the color indices can be changed, although only a finite number of -C different colors can be obtained (see the manual for the terminal). -C -C Input capability: The graphics cursor is a blinking -C diamond-crosshair. The user positions the cursor using the arrow keys -C and PF1--PF4 keys on his keyboard [Note: NOT the keyboard of -C the terminal on which he is plotting, if that is different.] -C The arrow keys move the cursor in the appropriate direction; the size -C of the step for each keystroke is controlled by the PF1--PF4 keys: PF1 -C -> 1 pixel, PF2 -> 4 pixels, PF3 -> 16 pixels, PF4 -> 64 pixels. [The -C VT240 terminal has a built-in capability to position the cursor, but -C PGPLOT does not use this as it is not available on the VT125.] The -C user indicates that the cursor has been positioned by typing any -C character other than an arrow or PF1-PF4 key [control characters, eg, -C control-C, and other special characters should be avoided, as they -C may be intercepted by the operating system]. -C -C File format: A REGIS plot file is formatted in records of 80 -C characters or less, and has no carriage-control attributes. The -C records are grouped into ``buffers,'' each of which begins with -C Pp to put the terminal into graphics mode and ends with \ -C to put it back into text mode. The terminal is in graphics mode only -C while a buffer is being transmitted, so a user's program can write to -C the terminal at any time (in text mode) without worrying if it might -C be in graphics mode. Everything between the escape sequences is -C REGIS: see the VT125 or VT240 manual for an explanation. PGPLOT -C attempts to minimize the number of characters in the REGIS commands, -C but REGIS is not a very efficient format. It does have the great -C advantage, though, that it can easily be examined with an editor. -C The file may also contain characters outside the Pp ... \ -C delimiters, eg, escape sequences to erase the text screen and home -C the cursor. -C -C The following escape sequences are used: -C -C [2J Erase entire screen (text) -C [H Move cursor to home position -C Pp Enter REGIS graphics mode -C \ Leave REGIS graphics mode -C -C PGPLOT uses a very limited subset of the REGIS commands supported -C by the VT125 and VT240. The following list summarizes the REGIS -C commands presently used. -C -C Initialization: the following standard commands are used to initialize -C the device every time a new frame is started; most of these restore a -C VT125 or VT240 to its default state, but the screen addressing mode is -C nonstandard. -C -C ; resynchronize -C W(R) replace mode writing -C W(I3) color index 1 -C W(F3) both bit planes -C W(M1) unit multiplier -C W(N0) negative off -C W(P1) pattern 1 -C W(P(M2)) pattern multiplier 2 -C W(S0) shading off -C S(E) erase screen -C S(G1) select graphics plane [Rainbow REGIS] -C S(A[0,479][767,0]) screen addressing, origin at bottom left -C S(I0) background dark -C S(S1) scale 1 -C S(M0(L0)(AL0)) output map section 0 (black) -C S(M1(L30)(AH120L50S100)) output map section 1 (red/dim grey) -C S(M2(L59)(AH240L50S100)) output map section 2 (green/light grey) -C S(M3(L100)(AL100)) output map section 3 (white) -C -C Drawing lines: the P and V commands are used with absolute -C coordinates, relative coordinates, and pixel vectors. The (B) -C S), (E), and (W) modifiers are not used. Coordinates -C which do not change are omitted. -C -C P[x,y] move to position, eg P[499,0] -C V[x,y] draw vector to position, eg -C V[][767][,479][0][,0] -C -C Line attributes: the line style and line color attributes are -C specified with W commands, eg -C -C W(P2) line style 2 -C W(I2) intensity (color index) 2 -C -C and S commands are used to change the output map. The PGPLOT color -C indices 0, 1, 2, 3 correspond to output map sections 0, 3, 1, 2. -C -C Obtaining hardcopy: A hardcopy of the plot can be obtained -C using a printer attached to the VT125/VT240 terminal (see the -C instruction manual for the terminal). A plot stored in disk file -C can be displayed by issuing a TYPE command (eg, TYPE PGPLOT.VTPLOT) -C on a VT125 or VT240. -C----------------------------------------------------------------------- - CHARACTER*(*) TYPE, DEFNAM - PARAMETER (TYPE='VT125 (DEC VT125 and other REGIS terminals)') - PARAMETER (DEFNAM='PGPLOT.VTPLOT') -C - CHARACTER*(*) VTINIT - PARAMETER (VTINIT=';W(RI3F3M1N0P1P(M2)S0)S(E)'// - 1 'S(G1A[0,479][767,0]I0S1)'// - 2 'S(M0(L0)(AL0))'// - 3 'S(M3(L100)(AL100))'// - 4 'S(M1(L30)(AH120L50S100))'// - 5 'S(M2(L59)(AH240L50S100))') - CHARACTER*(*) CURSOR, VTERAS, VTHOME - PARAMETER (CURSOR='[24;1f') - PARAMETER (VTERAS='[2J') - PARAMETER (VTHOME='[H') - INTEGER BUFSIZ - PARAMETER (BUFSIZ=500) -C - INTEGER IER, I0, J0, I1, J1, L, LASTI, LASTJ, UNIT - SAVE LASTI, LASTJ, UNIT - INTEGER CI, NPTS, L1, L2, BUFLEV - SAVE NPTS, BUFLEV - INTEGER MONO, IR, IG, IB, ICH, ICX, ICY, LTMP - INTEGER VTCODE(0:3) - SAVE VTCODE - INTEGER GROTER - LOGICAL APPEND - SAVE APPEND - REAL CH, CL, CS - CHARACTER*(BUFSIZ) BUFFER - SAVE BUFFER - CHARACTER*80 CTEMP - CHARACTER*64 INSTR - CHARACTER*20 INSTR1,INSTR2 - CHARACTER*2 PIX(0:22) - SAVE PIX - DATA PIX /'V5','V4','V3',7*' ','V6',' ','V2',7*' ','V7', - 1 'V0','V1'/ - DATA VTCODE / 0, 3, 1, 2 / -C----------------------------------------------------------------------- -C - GOTO( 10, 20, 30, 40, 50, 60, 70, 80, 90,100,110,120, - : 130,140,150,160,170,180,190,200,210,220,230,240), IFUNC - 900 WRITE (CTEMP,901) IFUNC - 901 FORMAT('VTDRIV: Unimplemented function:',I10) - CALL GRWARN(CTEMP) - NBUF = -1 - RETURN -C -C--- IFUNC = 1, Return device name.------------------------------------- -C - 10 CHR = TYPE - LCHR = LEN(TYPE) - RETURN -C -C--- IFUNC = 2, Return physical min and max for plot device, and range -C of color indices.--------------------------------------- -C - 20 RBUF(1) = 0 - RBUF(2) = 767 - RBUF(3) = 0 - RBUF(4) = 479 - RBUF(5) = 0 - RBUF(6) = 3 - NBUF = 6 - RETURN -C -C--- IFUNC = 3, Return device resolution. ------------------------------ -C - 30 RBUF(1) = 100.0 - RBUF(2) = 100.0 - RBUF(3) = 1 - NBUF = 3 - RETURN -C -C--- IFUNC = 4, Return misc device info. ------------------------------- -C (This device is Interactive, Cursor, No dashed lines, No area fill, -C No thick lines, Rectangle fill) -C - 40 CHR = 'ICNNNRNNNN' - LCHR = 10 - RETURN -C -C--- IFUNC = 5, Return default file name. ------------------------------ -C - 50 CALL GRTRML(CHR, LCHR) - RETURN -C -C--- IFUNC = 6, Return default physical size of plot. ------------------ -C - 60 RBUF(1) = 0 - RBUF(2) = 767 - RBUF(3) = 0 - RBUF(4) = 459 - NBUF = 4 - RETURN -C -C--- IFUNC = 7, Return misc defaults. ---------------------------------- -C - 70 RBUF(1) = 1 - NBUF = 1 - RETURN -C -C--- IFUNC = 8, Select plot. ------------------------------------------- -C - 80 CONTINUE - RETURN -C -C--- IFUNC = 9, Open workstation. -------------------------------------- -C - 90 CONTINUE - APPEND = RBUF(3).NE.0.0 - RBUF(1) = UNIT - IER = GROTER(CHR, LCHR) - IF (IER.LT.0) THEN - LTMP = MIN(LEN(CTEMP), 34+LCHR) - CTEMP = 'Unable to access graphics device: '//CHR(:LCHR) - CALL GRWARN(CTEMP(1:LTMP)) - RBUF(2) = 0 - ELSE - UNIT = IER - RBUF(1) = IER - RBUF(2) = 1 - NBUF = 2 - END IF - BUFLEV = 0 - LASTI = -1 - LASTJ = -1 - NPTS = 0 - RETURN -C -C--- IFUNC=10, Close workstation. -------------------------------------- -C - 100 CONTINUE -C -- reposition cursor - LTMP = 1 + LEN(CURSOR) - CALL GRWTER(UNIT, CHAR(27)//CURSOR, LTMP) - CALL GRCTER(UNIT) - RETURN -C -C--- IFUNC=11, Begin picture. ------------------------------------------ -C - 110 CONTINUE -C -- erase alpha screen and home cursor - LTMP = 2 + LEN(VTERAS) + LEN(VTHOME) - CALL GRWTER(UNIT, CHAR(27)//VTERAS//CHAR(27)//VTHOME, LTMP) -C -- erase and initialize graphics screen - IF (.NOT.APPEND) CALL GRVT02(VTINIT, BUFFER, BUFLEV, UNIT) - RETURN -C -C--- IFUNC=12, Draw line. ---------------------------------------------- -C - 120 CONTINUE - I0 = NINT(RBUF(1)) - J0 = NINT(RBUF(2)) - I1 = NINT(RBUF(3)) - J1 = NINT(RBUF(4)) - IF (I0.NE.LASTI .OR. J0.NE.LASTJ) THEN - CALL GRFAO('P[#,#]',L,INSTR,I0,J0,0,0) - CALL GRVT02(INSTR(1:L), BUFFER, BUFLEV, UNIT) - CALL GRVT02('V[]', BUFFER, BUFLEV, UNIT) - END IF - IF (I1.EQ.I0 .AND. J1.EQ.J0) THEN - CONTINUE - ELSE IF (ABS(I1-I0).LE.1 .AND. ABS(J1-J0).LE.1) THEN - L = 10*(I1-I0+1) + (J1-J0+1) - CALL GRVT02(PIX(L), BUFFER, BUFLEV, UNIT) - ELSE - IF (I1.EQ.I0) THEN - INSTR1 = 'V[' - L1 = 2 - ELSE IF (ABS(I1-I0).GE.100) THEN - CALL GRFAO('V[#',L1,INSTR1,I1,0,0,0) - ELSE IF (I1.GT.I0) THEN - CALL GRFAO('V[+#',L1,INSTR1,I1-I0,0,0,0) - ELSE - CALL GRFAO('V[#',L1,INSTR1,I1-I0,0,0,0) - END IF - IF (J1.EQ.J0) THEN - INSTR2 = ']' - L2 = 1 - ELSE IF (ABS(J1-J0).GE.100) THEN - CALL GRFAO(',#]',L2,INSTR2,J1,0,0,0) - ELSE IF (J1.GT.J0) THEN - CALL GRFAO(',+#]',L2,INSTR2,J1-J0,0,0,0) - ELSE - CALL GRFAO(',#]',L2,INSTR2,J1-J0,0,0,0) - END IF - CALL GRVT02(INSTR1(1:L1)//INSTR2(1:L2), - 1 BUFFER, BUFLEV, UNIT) - END IF - LASTI = I1 - LASTJ = J1 - RETURN -C -C--- IFUNC=13, Draw dot. ----------------------------------------------- -C - 130 CONTINUE - I1 = NINT(RBUF(1)) - J1 = NINT(RBUF(2)) - IF (I1.NE.LASTI .OR. J1.NE.LASTJ) THEN - CALL GRFAO('P[#,#]V[]',L,INSTR,I1,J1,0,0) - CALL GRVT02(INSTR(1:L), BUFFER, BUFLEV, UNIT) - END IF - LASTI = I1 - LASTJ = J1 - RETURN -C -C--- IFUNC=14, End picture. -------------------------------------------- -C - 140 CONTINUE -C -- flush - CALL GRVT03(BUFFER, UNIT, BUFLEV) -C -- home cursor - LTMP = 1 + LEN(VTHOME) - CALL GRWTER(UNIT, CHAR(27)//VTHOME, LTMP) - RETURN -C -C--- IFUNC=15, Select color index. ------------------------------------- -C - 150 CONTINUE - CI = NINT(RBUF(1)) - IF (CI.GT.3 .OR. CI.LT.0) CI = 1 - CALL GRFAO('W(I#)',L,INSTR,VTCODE(CI),0,0,0) - CALL GRVT02(INSTR(1:L), BUFFER, BUFLEV, UNIT) - LASTI = -1 - RETURN -C -C--- IFUNC=16, Flush buffer. ------------------------------------------- -C - 160 CONTINUE -C -- flush buffer - CALL GRVT03(BUFFER, UNIT, BUFLEV) - RETURN -C -C--- IFUNC=17, Read cursor. -------------------------------------------- -C RBUF(1) in/out : cursor x coordinate. -C RBUF(2) in/out : cursor y coordinate. -C CHR(1:1) output : keystroke. -C - 170 CONTINUE -C -- flush buffer - CALL GRVT03(BUFFER, UNIT, BUFLEV) - ICX = NINT(RBUF(1)) - ICY = NINT(RBUF(2)) - 171 ICX = MAX(0,MIN(767,ICX)) - ICY = MAX(0,MIN(459,ICY)) -C -- position graphics cursor - WRITE (INSTR,111) CHAR(27),ICX,ICY - 111 FORMAT(A,'PpP[', I4 ,',', I4 ,']') - LTMP = 15 - CALL GRWTER(UNIT, INSTR, LTMP) - CALL GRGETC(ICH) -C - IF (ICH.LT.0) THEN - CALL GRMCUR(ICH, ICX, ICY) - GOTO 171 - END IF -C -- back to text mode - LTMP=2 - CALL GRWTER(UNIT,CHAR(27)//CHAR(92),LTMP) - RBUF(1) = ICX - RBUF(2) = ICY - CHR = CHAR(ICH) - LASTI = -1 - NBUF = 2 - LCHR = 1 - RETURN -C -C--- IFUNC=18, Erase alpha screen. ------------------------------------- -C - 180 CONTINUE -C -- flush - CALL GRVT03(BUFFER, UNIT, BUFLEV) -C -- erase alpha screen and home cursor - LTMP = 2 + LEN(VTERAS) + LEN(VTHOME) - CALL GRWTER(UNIT, CHAR(27)//VTERAS//CHAR(27)//VTHOME, LTMP) - RETURN -C -C--- IFUNC=19, Set line style. ----------------------------------------- -C (Not implemented: should not be called.) -C - 190 GOTO 900 -C -C--- IFUNC=20, Polygon fill. ------------------------------------------- -C (Not implemented: should not be called.) -C - 200 GOTO 900 -C -C--- IFUNC=21, Set color representation. ------------------------------- -C - 210 CONTINUE - CI = RBUF(1) - MONO = NINT(30.*RBUF(2) + 59.*RBUF(3) + 11.*RBUF(4)) -C -- convertRGB to hue, lightness, saturation - CALL GRXHLS(RBUF(2),RBUF(3),RBUF(4),CH,CL,CS) - IR = NINT(CH) - IG = NINT(100.*CL) - IB = NINT(100.*CS) - CALL GRFAO('S(M#(L#)',L,INSTR, VTCODE(CI), MONO, 0, 0) - CALL GRVT02(INSTR(1:L), BUFFER, BUFLEV, UNIT) - CALL GRFAO('(AH#L#S#))',L,INSTR, IR, IG, IB, 0) - CALL GRVT02(INSTR(1:L), BUFFER, BUFLEV, UNIT) - RETURN -C -C--- IFUNC=22, Set line width. ----------------------------------------- -C (Not implemented: should not be called.) -C - 220 GOTO 900 -C -C--- IFUNC=23, Escape. ------------------------------------------------- -C - 230 CONTINUE -C -- flush - CALL GRVT03(BUFFER, UNIT, BUFLEV) -C -- write string - CALL GRWTER(UNIT, CHR, LCHR) - LASTI = -1 - RETURN -C -C--- IFUNC=24, Rectangle fill. ----------------------------------------- -C - 240 CONTINUE - I0 = NINT(RBUF(1)) - J0 = NINT(RBUF(2)) - I1 = NINT(RBUF(3)) - J1 = NINT(RBUF(4)) -C -- move to top left and turn shading on - CALL GRFAO('W(S1[,#])P[#,#]V[]', L, INSTR, J0, I0, J1, 0) - CALL GRVT02(INSTR(1:L), BUFFER, BUFLEV, UNIT) -C -- draw to top right and turn shading off - CALL GRFAO('V[#,#]W(S0)', L, INSTR, I1, J1, 0, 0) - CALL GRVT02(INSTR(1:L), BUFFER, BUFLEV, UNIT) - LASTI = -1 - RETURN -C----------------------------------------------------------------------- - END -C*GRVT02 -- PGPLOT Regis (VT125) driver, transfer data to buffer -C+ - SUBROUTINE GRVT02 (INSTR, BUFFER, HWM, UNIT) - INTEGER HWM, UNIT - CHARACTER*(*) INSTR, BUFFER -C -C Arguments: -C INSTR (input) : text of instruction (bytes). -C BUFFER (in/out) : output buffer. -C HWM (in/out) : number of bytes used in BUFFER. -C UNIT (input) : channel number for output (when buffer is full). -C -C Subroutines called: -C GRVT03 -C----------------------------------------------------------------------- - INTEGER BUFSIZ, N -C----------------------------------------------------------------------- - BUFSIZ = LEN(BUFFER) - N = LEN(INSTR) - IF (HWM+N.GE.BUFSIZ) CALL GRVT03(BUFFER, UNIT, HWM) - BUFFER(HWM+1:HWM+N) = INSTR(1:N) - HWM = HWM+N -C----------------------------------------------------------------------- - END -C*GRVT03 -- PGPLOT Regis (VT125) driver, copy buffer to device -C+ - SUBROUTINE GRVT03 (BUFFER, UNIT, N) - CHARACTER*(*) BUFFER - INTEGER UNIT, N -C -C Arguments: -C BUFFER (input) address of buffer to be output -C UNIT (input) channel number for output -C N (input) number of bytes to transfer -C (output) set to zero -C----------------------------------------------------------------------- -C Note: CHAR(27) = escape, CHAR(92) = backslash. -C----------------------------------------------------------------------- - INTEGER LTMP -C--- - IF (N.GE.1) THEN - LTMP = 3 - CALL GRWTER(UNIT, CHAR(27)//'Pp', LTMP) - CALL GRWTER(UNIT, BUFFER, N) - LTMP = 2 - CALL GRWTER(UNIT, CHAR(27)//CHAR(92), LTMP) - END IF - N = 0 -C----------------------------------------------------------------------- - END diff --git a/tecs/pg_plus/xwdriv.c b/tecs/pg_plus/xwdriv.c deleted file mode 100644 index 733e2ee..0000000 --- a/tecs/pg_plus/xwdriv.c +++ /dev/null @@ -1,4515 +0,0 @@ -/*....................................................................... - * PGPLOT driver for workstations running X Windows. - * Version 1.0 - 1989 Nov 06 - A. L. Fey - * Version 3.0 - 1994 Nov 06 - M. C. Shepherd (mcs@astro.caltech.edu). - * Re-write. Visible changes include: - * 1. Corrected expose-event handling. - * 2. The driver now runs a window server, - * so that if requested, windows - * persist for re-use by later programs. - * 3. Support for gray-scale and truecolor visuals. - * 4. Support for private color maps. - * 5. Support for window-resizing by the user. - * 6. New X-resources: pgxwin.geometry, - * pgxwin.iconize, pgxwin.minColors, - * pgxwin.maxColors, pgxwin.visual, - * pgxwin.acceptQuit, pgxwin.crosshair. - * 7. "rubber-band" cursor options for use with - * pgband(). - * 8. Corrected selective event handling. - * 9. Fixed input focus code so that iconizing - * doesn't kill the program. - * 10. Arranged for the window manager to ignore - * the delete-window option unless the - * pgxwin.acceptQuit resource is assigned a - * truth value. - * 11. Added XErrorEvent handling to prevent program - * crashes. - * 12. Cursor warps are defered until the cursor - * enters the /xw window, and can be turned - * off entirely with the appropriate argument - * to PGBAND(). - * 13. Colormap updates are now buffered. - * 14. Support for multiple open devices. - * 15. The cursor can now be moved with the - * keyboard arrow keys. - * Version 3.0+ - 2003 Mar 19 - M.Zolliker - * It is now possible to specify a timeout - * for xw_read_cursor - * - * - * Scope: This driver should work with all unix workstations running - * X Windows (Version 11). It also works on VMS and OpenVMS - * workstations running X. - * Color: Visual color maps of types, PsuedoColor, StaticColor, GrayScale - * and StaticGray are supported. Where insufficient colors are - * available in the default colormap, a private colormap is - * requested. If this fails, the device is treated as - * monochrome. - * Cursor: The cursor is controlled by a mouse or equivalent. Buttons - * 1 2 3 are mapped to characters A D X. The cursor can also - * be moved horizontally and vertically with the arrow keys. - * Each press of an arrow key moves the cursor one pixel. This - * can be increased to 10 pixels by pressing the shift key. - * Size: The initial size and position of the window number #, - * is determined with the following heirachy of specifications, - * missing details at each level are supplied by those below. - * - * 1. X-resource: pgxwin.win#.geometry: WIDTHxHEIGHT+X+Y - * 2. X-resource: pgxwin.Win.geometry: WIDTHxHEIGHT+X+Y - * 3. Environment variable: PGPLOT_XW_WIDTH [fractional display width] - * 4. #define's: XW_DEF_WIDTH, XW_DEF_HEIGHT, XW_DEF_ASPECT - * - * There are too many other configuration options to document here, but - * complete documentation of the driver is available over the WEB at URL: - * - * http://astro.caltech.edu/~tjp/xwdriv.html - * - */ - -/* - * Certain symbols in fcntl.h may not get defined - * unless the _POSIX_SOURCE feature-test macro is set. - */ - -/* - * Allow xwdriv to be calleable by FORTRAN using the two commonest - * calling conventions. Both conventions append length arguments for - * each FORTRAN string at the end of the argument list, and convert the - * name to lower-case, but one post-pends an underscore to the function - * name (PG_PPU) while the other doesn't. Note the VMS is handled - * separately below. For other calling conventions you must write a - * C wrapper routine to call xwdriv() or xwdriv_(). - */ -#ifdef PG_PPU -#define XWDRIV xwdriv_ -#else -#define XWDRIV xwdriv -#endif - -#include -#include -#include -#ifndef convex -#include -#endif - -/* - * VAX VMS includes etc.. - */ -#ifdef VMS -#include /* sleep() is prototyped here */ -#include /* access() is prototyped here */ -#include -#include -#include -#include -#include - -typedef struct dsc$descriptor_s VMS_string; - -#define VMS_STRING(dsc, string) \ - dsc.dsc$w_length = strlen(string); \ - dsc.dsc$b_dtype = DSC$K_DTYPE_T; \ - dsc.dsc$b_class = DSC$K_CLASS_S; \ - dsc.dsc$a_pointer = string; - -static int vms_define_command(char *file, char *command); -static int vms_spawn_nowait(char *command); -#endif - -#ifndef VMS -#include -#include -#endif - -/* X-Window include files */ - -#include -#include -#include -#include -#include - -/* - * Record the client/server protocol revision implemented herein. - */ -#define PGXWIN_REVISION 0 - -/* - * Allow the pgplot /xw server name to be changed by compile - * time pre-definition of PGXWIN_SERVER. If pgxwin_server is modified in - * such a way as to become incompatible with an earlier version of xwdriv.c, - * its name should be changed by postfixing a small increasing integer - * to the name of the executable. New and old pgplot programs can then - * coexist as long as both versions of the server are - * retained. In order not to clutter up system directories, don't change - * this name unless absolutely necessary. This is also the name given to - * the server selection atom, so be sure that it remains valid for this - * purpose. - */ -#ifndef PGXWIN_SERVER -#define PGXWIN_SERVER "pgxwin_server" -#endif - -#define NCOLORS 16 /* Number of pre-defined PGPLOT colors */ -#define XW_IMAGE_LEN 1280 /* Length of the line-of-pixels buffer */ -#define COLORMULT 65535 /* Normalized color intensity multiplier */ - -#define XW_IDENT "PGPLOT /xw" /* Name to prefix messages to user */ -#define XW_DEF_ASPECT (8.5/11.0) /* Default aspect (height/width) of window */ -#define XW_DEF_WIDTH 867 /* Default width (pixels) */ -#define XW_DEF_HEIGHT ((int) XW_DEF_WIDTH * XW_DEF_ASPECT) - /* Default height (pixels) */ -#define XW_SERVER_TIMEOUT 10 /* Max time to allow for server startup */ - -/* - * Define equivalence values for the XParseGeometry bitmask bits, using - * values agreed upon by xwdriv.c and pgxwin_server.c, for use in - * communicating geometries between client and server. - */ -#define XW_WidthValue 1 -#define XW_HeightValue 2 -#define XW_XValue 4 -#define XW_YValue 8 -#define XW_XNegative 16 -#define XW_YNegative 32 - -/* - * Enumerate the supported window close-down modes. - */ -#define XW_DELETE 1 -#define XW_PERSIST 2 -#define XW_ICONIZE 3 - -/* - * Enumerate property-data formats, named after the internal types that - * are used to communicate them with XChangeProperty() and - * XGetWindowProperty(). - */ -#define XW_CHAR_PROP 8 -#define XW_SHORT_PROP 16 -#define XW_LONG_PROP 32 - -/* - * Set the degree to which holding down the shift-key speeds up cursor - * motion when an arrow key is held down. - */ -#define ARROW_KEY_VELOCITY 10 - -/* - * The following macro must enclose all function prototype arguments. - * This allows pre-ANSI compilers to compile this code, by discarding - * the prototype arguments if __STDC__ is not set. - */ -#ifdef __STDC__ -#define ARGS(args) args -#else -#define ARGS(args) () -#endif - -/* A container used to record the geometry of the X-window */ - -typedef struct { - Atom geom_atom; /* Client/server geometry transaction atom */ - int x,y; /* Locus of top left corner of window (pixels) */ - unsigned int width; /* Width of window (pixels) */ - unsigned int height; /* Height of window (pixels) */ - int xpix_per_inch; /* Number of pixels per inch along X */ - int ypix_per_inch; /* Number of pixels per inch along Y */ - int xmargin; /* X-axis 1/4" margin in pixels */ - int ymargin; /* Y-axis 1/4" margin in pixels */ - int xmin,xmax; /* Min/max X-axis pixels excluding 1/4" margins */ - int ymin,ymax; /* Min/max X-axis pixels excluding 1/4" margins */ -} XWgeom; - -/* - * Declare a colormap descriptor. - */ -typedef struct { - XVisualInfo *vi; /* The visual info descriptor for the colormap */ - Colormap cmap; /* Colormap ID */ - int ncol; /* The number of colors available. ci = [0...ncol-1] */ - int monochrome; /* True we have to use a monochrome screen */ - unsigned long *pixel; /* 'ncol' colormap pixel indexes. */ - XColor *xcolor; /* 'ncol' colormap color representations */ - int initialized; /* True after the first call to xw_init_colors() */ - int nbuff; /* The number of buffered color representation updates */ - int sbuff; /* The index of the first buffered color representation */ -} XWcolor; - -/* - * Declare a polygon descriptor. - */ -typedef struct { - XPoint *points; /* Temporary array of polygon vertexes */ - int npoint; /* Number of points in polygon */ - int ndone; /* The number of points received so far */ -} XWpoly; - -/* - * Declare a container used to record the extent of the rectangular - * pixmap area that has been modified since the last xw_flush(). - */ -typedef struct { - int modified; /* True if 'pixmap' has been modified since last update */ - int xmin,xmax; /* X-axis extent of modified region (pixels) */ - int ymin,ymax; /* Y-axis extent of modified region (pixels) */ -} XWupdate; - -/* - * Declare a container to encapsulate the buffers needed to - * draw a line of pixels. - */ -typedef struct { - XImage *xi; /* Line of pixels Xlib image object */ -} XWimage; - -/* - * Declare a container used to hold event state information. - */ -typedef struct { - long mask; /* Current event mask */ - int no_buttons; /* True after failure to acquire ButtonPressMask */ -} XWevent; - -/* - * Declare a function type, instances of which are to be called to flush - * buffered opcodes, and return 0 if OK, or 1 on error. - */ -struct XWdev; -typedef int (*Flush_Opcode_fn) ARGS((struct XWdev *xw)); - -/* - * The following container is used to retain state information for /xw - * connections. - */ -typedef struct XWdev { - Display *display; /* Display descriptor */ - Window parent; /* The ID of the parent window */ - Window window; /* Window ID */ - Window client; /* Client communication window */ - Window server; /* Server communication window */ - Atom server_atom; /* Server selection atom */ - Atom client_data; /* Client data property atom */ - int protocol; /* Client/server communication protocol to use */ - int number; /* PGPLOT window number */ - int screen; /* The screen in which the window is displayed */ - int disposition; /* Close-down mode: XW_PERSIST, XW_ICONIZE, XW_DELETE */ - int bad_device; /* Set to 1 by xw_bad_device() after fatal errors. */ - int last_error; /* The last error code trapped by xw_error() */ - Pixmap pixmap; /* Pixmap ID */ - Cursor norm_cursor;/* ID of normal cursor */ - Cursor live_cursor;/* ID of active cursor */ - int crosshair; /* Show intersecting line cursor if true */ - XWpoly poly; /* Polygon-fill accumulation descriptor */ - XWcolor color; /* Colormap descriptor */ - XWgeom geom; /* The size and position of the window */ - XWupdate update; /* Descriptor of un-drawn area of pixmap */ - XWevent event; /* Event state container */ - XWimage image; /* Line of pixels container */ - XGCValues gcv; /* Publicly visible contents of 'gc' */ - GC gc; /* Graphical context descriptor */ - int last_opcode; /* Index of last opcode */ - int nofocus; /* set to 1 after a timeout in xw_read_cursor M.Z. */ - Flush_Opcode_fn flush_opcode_fn; /* Function to flush a buffered opcode */ - struct XWdev *next;/* Pointer to next /xw device in list */ -} XWdev; - -/* Create an alias for the standard X error handling function type */ - -typedef int (*Xerrorfn) ARGS((Display *, XErrorEvent *)); - -/* Private method functions that operate on XWdev descriptors */ - -static XWdev *new_XWdev ARGS((char *display, int mode)); -static XWdev *del_XWdev ARGS((XWdev *xw, int partial)); -static int xw_bad_device ARGS((XWdev *xw)); - -static int xw_ok ARGS((XWdev *xw)); -static int xw_set_rgb ARGS((XWdev *xw, int ci, float red, float green, float blue)); -static int xw_get_visual ARGS((XWdev *xw)); -static int xw_init_colors ARGS((XWdev *xw)); -static Window xw_get_window ARGS((XWdev *xw)); -static Pixmap xw_get_pixmap ARGS((XWdev *xw)); -static int xw_get_cursors ARGS((XWdev *xw)); -static int xw_get_image ARGS((XWdev *xw, int npix)); -static Window xw_get_server ARGS((XWdev *xw)); -static int xw_query_server ARGS((XWdev *xw, XEvent *event)); -static int xw_set_cursor ARGS((XWdev *xw, int norm)); -static int xw_clear ARGS((XWdev *xw)); -static int xw_set_ci ARGS((XWdev *xw, int ci)); -static void xw_mark_modified ARGS((XWdev *xw, int x, int y, int diameter)); -static int xw_flush ARGS((XWdev *xw)); -static void xw_XPoint_to_xy ARGS((XWdev *xw, XPoint *xp, float *xy)); -static void xw_xy_to_XPoint ARGS((XWdev *xw, float *xy, XPoint *xp)); -static float xw_xcolor_to_rgb ARGS((unsigned short urgb)); -static int xw_rgb_to_xcolor ARGS((float rgb)); - -static int xw_next_page ARGS((XWdev *xw, unsigned int width, unsigned int height)); -static int xw_image_line ARGS((XWdev *xw, XPoint *start, float *cells, int ncell)); -static int xw_read_cursor ARGS((XWdev *xw, int mode, int posn, XPoint *ref, - XPoint *pos, char *key)); -static int xw_shift_cursor ARGS((XWdev *xw, KeySym keysym, \ - unsigned int modifiers)); -static int xw_expose ARGS((XWdev *xw, XEvent *event)); -static int xw_new_geom ARGS((XWdev *xw, int x, int y, unsigned int width, - unsigned int height,int mask)); -static int xw_error ARGS((Display *display, XErrorEvent *event)); -static int xw_locate_cursor ARGS((XWdev *xw, XPoint *pos, int warp, XPoint *loc)); -static int xw_next_event ARGS((XWdev *xw, XEvent *event)); -static int xw_next_event_tmo ARGS((XWdev *xw, XEvent *event, int tmo_10)); /*M.Z.*/ -static int xw_check_window_event ARGS((XWdev *xw, Window window, - long event_mask, XEvent *event)); -static unsigned long xw_get_data ARGS((XWdev *xw, char *data, int form, unsigned long n)); -static XVisualInfo *xw_visual_info ARGS((Display *display, int screen, - Visual *visual)); -static void xw_limit_pcoords ARGS((XWdev *xw, XPoint *coord)); -static void xw_scroll_rect ARGS((XWdev *xw, float *rbuf)); - -/* Container for rubber-band cursor resources and status */ - -typedef struct { - int line_width; /* Rubber-band line width */ - int mode; /* Cursor mode 1=line, 2=rectangle */ - XPoint ref; /* Reference vertex of cursor */ - XPoint end; /* End point of cursor */ -} Band; - -static Band *xw_new_Band ARGS((XWdev *xw, int mode, XPoint *ref)); -static int xw_draw_cursor ARGS((XWdev *xw, Band *bc, XPoint *end)); -static int xw_erase_cursor ARGS((XWdev *xw, Band *bc)); -static int xw_end_cursor ARGS((XWdev *xw, Band *bc, int status)); -static Band *xw_del_Band ARGS((XWdev *xw, Band *bc)); -static int xw_bound_cursor ARGS((XWdev *xw, XPoint *xp)); -static int xw_cursor_line ARGS((XWdev *xw, int xa, int ya, int xb, int yb)); -static int xw_add_events ARGS((XWdev *xw, long events)); -static int xw_rem_events ARGS((XWdev *xw, long events)); - -/* Functions used to flush buffered opcodes */ - -static int xw_update_colors ARGS((XWdev *xw)); - -/* - * Declare the head of the list of open XW device descriptors. - * This has to have file scope to allow the X error handler to get at it. - */ - -static XWdev *device_list = NULL; - -static XWdev *xw_insert_device ARGS((XWdev *xw)); -static XWdev *xw_select_device ARGS((int number)); -static XWdev *xw_remove_device ARGS((XWdev *xw)); -static char *find_exe ARGS((char *path, char *program)); -static int xw_nint ARGS((float f)); - -/*....................................................................... - * This is the only external entry point to the /xw device driver. - * It is called by PGPLOT to open, perform operations on, return - * information about and close /xw windows. - * - * Input: - * ifunc int * The PGPLOT operation code to be executed. - * Input/output: - * rbuf float * A general buffer for input/output of float values. - * nbuf int * Where relevant this is used to return the number of - * elements in rbuf[]. Also used on input to specify - * number of pixels in the line-of-pixels primitive. - * chr char * A general buffer for string I/O. - * lchr int * Where relevant this is used to send and return the - * number of significant characters in chr. - * Input: - * mode int * The value of *mode specifies the disposition of - * the device: - * 1 - /XWINDOW => non-persistent window. - * 2 - /XSERVE => persistent window. - * len int Added to the call line by the FORTRAN compiler. - * This contains the declared size of chr[]. - */ -#ifdef VMS -void xwdriv(ifunc, rbuf, nbuf, chrdsc, lchr, mode) - int *ifunc; - float rbuf[]; - int *nbuf; - struct dsc$descriptor_s *chrdsc; /* VMS FORTRAN string descriptor */ - int *lchr; - int *mode; -{ - int len = chrdsc->dsc$w_length; - char *chr = chrdsc->dsc$a_pointer; -#else -void XWDRIV(ifunc, rbuf, nbuf, chr, lchr, mode, len) - int *ifunc, *nbuf, *lchr, *mode; - int len; - float rbuf[]; - char *chr; -{ -#endif - static XWdev *xw = NULL; /* The descriptor of the currently selected device */ - int i; -/* - * If there is a buffered opcode and the latest opcode is not the same - * as the last opcode, call the given flush function for the - * buffered opcode. - */ - if(xw && !xw->bad_device) { - if(xw->last_opcode != *ifunc) { - if(xw->flush_opcode_fn != (Flush_Opcode_fn) 0) { - (*xw->flush_opcode_fn)(xw); - xw->flush_opcode_fn = (Flush_Opcode_fn) 0; - }; -/* - * Record the current opcode for next time. - */ - xw->last_opcode = *ifunc; - }; - }; - -/* Branch on opcode. */ - - switch(*ifunc) { - -/*--- IFUNC=1, Return device name ---------------------------------------*/ - - case 1: - { - char *dev_name; - switch(*mode) { /* Locate the name used to select the given mode */ - case 1: default: - dev_name = "XWINDOW (X window window@node:display.screen/xw)"; - break; - case 2: - dev_name = "XSERVE (A /XWINDOW window that persists for re-use)"; - break; - }; - strncpy(chr, dev_name, len); - *lchr = strlen(dev_name); - for(i = *lchr; i < len; i++) - chr[i] = ' '; - }; - break; - -/*--- IFUNC=2, Return physical min and max for plot device, and range - of color indices -----------------------------------------*/ - case 2: - rbuf[0] = 0.0; - rbuf[1] = -1.0; /* Report no effective max plot width */ - rbuf[2] = 0.0; - rbuf[3] = -1.0; /* Report no effective max plot height */ - rbuf[4] = 0.0; - rbuf[5] = (xw && !xw->bad_device) ? xw->color.ncol-1 : 1; - *nbuf = 6; - break; - -/*--- IFUNC=3, Return device resolution ---------------------------------*/ - - case 3: - if(xw_ok(xw)) { - rbuf[0] = xw->geom.xpix_per_inch; - rbuf[1] = xw->geom.ypix_per_inch; - } else { - rbuf[0] = 1.0; - rbuf[1] = 1.0; - }; - rbuf[2] = 1.0; /* Device coordinates per pixel */ - *nbuf = 3; - break; - -/*--- IFUNC=4, Return misc device info ----------------------------------*/ - - case 4: - chr[0] = 'I'; /* Interactive device */ - chr[1] = 'C'; /* Cursor is available */ - chr[2] = 'N'; /* No dashed lines */ - chr[3] = 'A'; /* Area fill available */ - chr[4] = 'T'; /* Thick lines */ - chr[5] = 'R'; /* Rectangle fill available */ - chr[6] = 'P'; /* Line of pixels available */ -/* - * Tell PGPLOT to prompt on PGEND only if the window goes away. - */ - chr[7] = xw && xw->disposition==XW_PERSIST ? 'N':'V'; - chr[8] = 'Y'; /* Can return color representation */ - chr[9] = 'N'; /* Not used */ - chr[10]= 'S'; /* Area-scroll available */ - *lchr = 11; - break; - -/*--- IFUNC=5, Return default file name ---------------------------------*/ - - case 5: - chr[0] = '\0'; /* Default name is "" */ - *lchr = 0; - break; - -/*--- IFUNC=6, Return default physical size of plot ---------------------*/ - - case 6: - if(xw && !xw->bad_device) { /* Return the size of the current window */ - XWindowAttributes attr; - XGetWindowAttributes(xw->display, xw->window, &attr); - if(!xw->bad_device) { - rbuf[0] = 0.0; - rbuf[1] = (float) (attr.width - 2 * xw->geom.xmargin); - rbuf[2] = 0.0; - rbuf[3] = (float) (attr.height - 2 * xw->geom.ymargin); - } else { - rbuf[0] = 0.0; - rbuf[1] = (float) xw->geom.width; - rbuf[2] = 0.0; - rbuf[3] = (float) xw->geom.height; - }; - } else { - rbuf[0] = 0.0; - rbuf[1] = XW_DEF_WIDTH; - rbuf[2] = 0.0; - rbuf[3] = XW_DEF_HEIGHT; - }; - *nbuf = 4; - break; - -/*--- IFUNC=7, Return misc defaults -------------------------------------*/ - - case 7: - rbuf[0] = 1.0; - *nbuf = 1; - break; - -/*--- IFUNC=8, Select plot ----------------------------------------------*/ - - case 8: - xw = xw_select_device((int)(rbuf[1]+0.5)); - break; - -/*--- IFUNC=9, Open workstation -----------------------------------------*/ - - case 9: -/* - * Assign the returned device unit number and success indicator. - * Assume failure to open until the workstation is open. - */ - rbuf[0] = rbuf[1] = 0.0; - *nbuf = 2; -/* - * Prepare the display name. - */ - if(*lchr >= len) { - fprintf(stderr, "%s: Display name too long.\n", XW_IDENT); - return; - } else { - chr[*lchr] = '\0'; - }; -/* - * Connect to the server and create the window. - */ - xw = new_XWdev(chr, *mode); - if(xw==NULL) - return; -/* - * Insert the device in the list of open devices. - */ - xw_insert_device(xw); - rbuf[0] = xw->number; /* Number used to select this device */ - rbuf[1] = 1.0; - *nbuf = 2; - break; - -/*--- IFUNC=10, Close workstation ---------------------------------------*/ - - case 10: -/* - * Remove the device from the list of open devices and delete it. - */ - xw_remove_device(xw); - xw = del_XWdev(xw,0); - break; - -/*--- IFUNC=11, Begin picture -------------------------------------------*/ - - case 11: - if(xw_ok(xw)) { -/* - * Convert the passed max X and Y coordinates into the total width of the - * new window. Add 1/4" margins to the requested area. - */ - unsigned int width = (int) (rbuf[0] + 0.5) + 2 * xw->geom.xmargin; - unsigned int height = (int) (rbuf[1] + 0.5) + 2 * xw->geom.ymargin; -/* - * Re-size the window if required. - */ - xw_next_page(xw, width, height); - }; - break; - -/*--- IFUNC=12, Draw line -----------------------------------------------*/ - - case 12: - if(xw_ok(xw) && xw->pixmap!=None) { - XPoint start; - XPoint end; - xw_xy_to_XPoint(xw, &rbuf[0], &start); - xw_xy_to_XPoint(xw, &rbuf[2], &end); - XDrawLine(xw->display, xw->pixmap, xw->gc, start.x,start.y, end.x,end.y); - xw_mark_modified(xw, start.x, start.y, xw->gcv.line_width); - xw_mark_modified(xw, end.x, end.y, xw->gcv.line_width); - }; - break; - -/*--- IFUNC=13, Draw dot ------------------------------------------------*/ - - case 13: - if(xw_ok(xw) && xw->pixmap!=None) { - XPoint xp; - int radius = xw->gcv.line_width/2; - xw_xy_to_XPoint(xw, rbuf, &xp); - if(radius < 1) { - XDrawPoint(xw->display, xw->pixmap, xw->gc, xp.x, xp.y); - } else { - unsigned int diameter = radius*2; - int x = xp.x - radius; - int y = xp.y - radius; - XFillArc(xw->display, xw->pixmap, xw->gc, x, y, diameter, diameter, - 0, 23040); - }; - xw_mark_modified(xw, xp.x, xp.y, xw->gcv.line_width); - }; - break; - -/*--- IFUNC=14, End picture ---------------------------------------------*/ - - case 14: - break; - -/*--- IFUNC=15, Select color index --------------------------------------*/ - - case 15: - if(xw_ok(xw)) - xw_set_ci(xw, (int) (rbuf[0] + 0.5)); - break; - -/*--- IFUNC=16, Flush buffer. -------------------------------------------*/ - - case 16: - if(xw_ok(xw)) - xw_flush(xw); - break; - -/*--- IFUNC=17, Read cursor. --------------------------------------------*/ - - case 17: - if(xw_ok(xw)) { - XPoint ref; /* Reference cursor coordinates */ - XPoint pos; /* Input/Output cursor coordinates */ - int mode = 0; /* Cursor band mode */ - int posn = 1; /* True to position the cursor */ - xw_xy_to_XPoint(xw, rbuf, &pos); - xw_xy_to_XPoint(xw, &rbuf[2], &ref); - mode = (int)(rbuf[4]+0.5); - if (rbuf[4]<0.0) mode--; /* M.Z. */ - posn = (int)(rbuf[5]+0.5) > 0; - if(xw_read_cursor(xw, mode, posn, &ref, &pos, chr)==0) - xw_XPoint_to_xy(xw, &pos, rbuf); - else - *chr = '\0'; - } else { - *chr = '\0'; - }; - *lchr = 1; - *nbuf = 2; - break; - -/*--- IFUNC=18, Erase alpha screen. -------------------------------------*/ - /* (Not implemented: no alpha screen) */ - case 18: - break; - -/*--- IFUNC=19, Set line style. -----------------------------------------*/ - /* (Not implemented: should not be called) */ - case 19: - break; - -/*--- IFUNC=20, Polygon fill. -------------------------------------------*/ - - case 20: - if(xw_ok(xw) && xw->pixmap != None) { -/* - * The first call specifies just the number of vertixes in the polygon. - */ - if(xw->poly.npoint == 0) { - xw->poly.npoint = (int) (rbuf[0] + 0.5); - xw->poly.points = (XPoint *) malloc(sizeof(XPoint) * xw->poly.npoint); - if(xw->poly.points == NULL) - fprintf(stderr, "%s: Insufficient memory for polygon points.\n", - XW_IDENT); - xw->poly.ndone = 0; -/* - * The next xw->poly.npoint calls specify the vertexes of the polygon. - */ - } else { -/* - * Ignore the points if the above malloc() failed. - */ - if(xw->poly.points) { - XPoint *xp = &xw->poly.points[xw->poly.ndone]; - xw_xy_to_XPoint(xw, rbuf, xp); - xw_mark_modified(xw, xp->x, xp->y, 1); - }; -/* - * Maintain the count of the number of points, even if no memory for the - * points is available. Thus we can just ignore all calls until - * xw->poly.ndone == xw->poly.npoint. - */ - xw->poly.ndone++; -/* - * On the last call display the filled polygon and release the memory used - * to store its vertexes. - */ - if(xw->poly.ndone >= xw->poly.npoint) { - if(xw->poly.points) { - XFillPolygon(xw->display, xw->pixmap, xw->gc, xw->poly.points, - xw->poly.npoint, Complex, CoordModeOrigin); - free((char *)xw->poly.points); - xw->poly.points = NULL; - }; - xw->poly.npoint = 0; - }; - }; - }; - break; - -/*--- IFUNC=21, Set color representation. -------------------------------*/ - - case 21: - if(xw_ok(xw)) { - if(!xw->color.initialized) - xw_init_colors(xw); - xw_set_rgb(xw, (int)(rbuf[0]+0.5), rbuf[1],rbuf[2],rbuf[3]); - }; - break; - -/*--- IFUNC=22, Set line width. -----------------------------------------*/ - - case 22: -/* - * The line width is provided in multiples of 0.005 inches. - */ - if(xw_ok(xw)) { - xw->gcv.line_width = (int)(rbuf[0]*0.005 * xw->geom.xpix_per_inch); - XChangeGC(xw->display, xw->gc, (unsigned long) GCLineWidth, &xw->gcv); - }; - break; - -/*--- IFUNC=23, Escape --------------------------------------------------*/ - /* (Not implemented: ignored) */ - case 23: - break; - -/*--- IFUNC=24, Rectangle Fill. -----------------------------------------*/ - - case 24: - if(xw_ok(xw) && xw->pixmap != None) { - XPoint blc; - XPoint trc; - xw_xy_to_XPoint(xw, &rbuf[0], &blc); - xw_xy_to_XPoint(xw, &rbuf[2], &trc); - XFillRectangle(xw->display, xw->pixmap, xw->gc, blc.x, trc.y, - (unsigned)(trc.x-blc.x+1), (unsigned)(blc.y-trc.y+1)); - xw_mark_modified(xw, blc.x, blc.y, 1); - xw_mark_modified(xw, trc.x, trc.y, 1); - }; - break; - -/*--- IFUNC=25, ---------------------------------------------------------*/ - /* (Not implemented: ignored) */ - case 25: - break; - -/*--- IFUNC=26, Line of pixels ------------------------------------------*/ - - case 26: - if(xw_ok(xw)) { - XPoint start; - xw_xy_to_XPoint(xw, rbuf, &start); - xw_image_line(xw, &start, &rbuf[2], *nbuf - 2); - }; - break; - -/*--- IFUNC=29, Query color representation ------------------------------*/ - case 29: - if(xw_ok(xw)) { - int ci = (int) (rbuf[0] + 0.5); - if(!xw->color.initialized) - xw_init_colors(xw); - rbuf[1] = xw_xcolor_to_rgb(xw->color.xcolor[ci].red); - rbuf[2] = xw_xcolor_to_rgb(xw->color.xcolor[ci].green); - rbuf[3] = xw_xcolor_to_rgb(xw->color.xcolor[ci].blue); - } else { - rbuf[1] = rbuf[2] = rbuf[3] = 0; - }; - *nbuf = 4; - break; - -/*--- IFUNC=30, Scroll rectangle ----------------------------------------*/ - case 30: - xw_scroll_rect(xw, rbuf); - break; - -/*--- IFUNC=?, ----------------------------------------------------------*/ - - default: - fprintf(stderr, "%s: Ignoring unimplemented opcode=%d.\n",XW_IDENT, *ifunc); - *nbuf = -1; - break; - }; -/* - * After a server error, close the connection to the display and set all - * server resources to 'None'. This both prevents calls on bad resources - * and by deleting the client communication window, tells the server to - * close the connection if the server hasn't already died. - */ - if(xw && xw->bad_device && xw->display) - del_XWdev(xw, 1); - return; -} - -/*....................................................................... - * Assign a given RGB color representation to a given color index. - * - * Input: - * xw XWdev * The /xw device descriptor. - * ci int The color index to assign the color to. Out of range - * indexes are quietly ignored. - * red float The fractional red brightness 0..1. - * green float The fractional green brightness 0..1. - * blue float The fractional blue brightness 0..1. - * Output: - * return int 0 - OK. - * 1 - Error. - */ -#ifdef __STDC__ -static int xw_set_rgb(XWdev *xw, int ci, float red, float green, float blue) -#else -static int xw_set_rgb(xw, ci, red, green, blue) - XWdev *xw; int ci; float red; float green; float blue; -#endif -{ - float gray; /* Gray-scale intensity */ - XColor *xc; /* The descriptor of the new color */ -/* - * Device error? - */ - if(xw->bad_device) - return 1; -/* - * Limit RGB values to be between 0 and 1. - */ - if(red < 0.0) red = 0.0; - if(green < 0.0) green = 0.0; - if(blue < 0.0) blue = 0.0; - if(red > 1.0) red = 1.0; - if(green > 1.0) green = 1.0; - if(blue > 1.0) blue = 1.0; -/* - * Color index in range? - */ - if(!xw->color.monochrome && ci >= 0 && ci < xw->color.ncol) { -/* - * Get the color representation descriptor. - */ - xc = &xw->color.xcolor[ci]; -/* - * Get the pixel to be assigned the new color representation. - */ - xc->pixel = xw->color.pixel[ci]; - xc->flags = DoRed | DoGreen | DoBlue; - xc->pad = 0; -/* - * Determine the appropriate RGB values for the type of colormap. - */ - switch(xw->color.vi->class) { - case PseudoColor: - case StaticColor: - case DirectColor: - case TrueColor: - xc->red = xw_rgb_to_xcolor(red); - xc->green = xw_rgb_to_xcolor(green); - xc->blue = xw_rgb_to_xcolor(blue); - break; - case GrayScale: - case StaticGray: -/* - * For gray-scale colormaps the red,green and blue intensities must all be - * equal. Weight the colors so that what is brightest to the eye, is also - * brighter in grayscale, and so that different colors of equal intensity - * appear different in grayscale. Note that the 3 weights must add up to 1.0. - * The black and white TV standard says to use 0.3*R+0.59*G+0.11*B. - * Unfortunately blue pretty much dissapears in this scheme. The following - * is a compromise between making all colors visible and making different - * colors look different in grayscale. - */ - gray = 0.35*red + 0.40*green + 0.25*blue; - xc->red = xc->green = xc->blue = xw_rgb_to_xcolor(gray); - break; - }; -/* - * Update the recorded range of color indexes whose color representations - * have been changed since the last call to xw_update_colors(). - */ - if(xw->color.nbuff<=0) { - xw->color.sbuff = ci; - xw->color.nbuff = 1; - } else if(ci < xw->color.sbuff) { - xw->color.nbuff += xw->color.sbuff - ci; - xw->color.sbuff = ci; - } else if(ci > xw->color.sbuff + xw->color.nbuff-1) { - xw->color.nbuff = ci - xw->color.sbuff + 1; - }; -/* - * Register xw_update_colors() to be called to flush the colors to the - * window. - */ - xw->flush_opcode_fn = (Flush_Opcode_fn) xw_update_colors; - }; - return 0; -} - -/*....................................................................... - * Map floating point color intenisties between 0.0 and 1.0 to XColor - * intensities between 0 to 65535. Numbers outside of this range are - * limited to the nearest of the two limits. - * - * Input: - * rgb float The PGPLOT normalized intensity to be converted. - * Output: - * return unsigned short The equivalent XColor RGB intensity. - */ -#ifdef __STDC__ -static int xw_rgb_to_xcolor(float rgb) -#else -static int xw_rgb_to_xcolor(rgb) - float rgb; -#endif -{ - long lrgb; /* Use to check output before casting to unsigned short */ -/* - * Check for limiting input values. - */ - if(rgb < 0.0) - return 0; - if(rgb > 1.0) - return COLORMULT; -/* - * Form the xcolor intensity in a long int so that its range can be checked - * before casting to unsigned short. - */ - lrgb = rgb * COLORMULT + 0.5; - return lrgb > COLORMULT ? COLORMULT : lrgb; -} - -/*....................................................................... - * Map XColor intensities between 0 and 65535 to floating point color - * intenisties between 0.0 and 1.0. Numbers outside of this range are - * limited to the nearest of the two limits. - * - * Input: - * unsigned short The equivalent XColor RGB intensity. - * Output: - * return float The PGPLOT normalized intensity to be converted. - */ -#ifdef __STDC__ -static float xw_xcolor_to_rgb(unsigned short urgb) -#else -static float xw_xcolor_to_rgb(urgb) - unsigned short urgb; -#endif -{ - float rgb; /* The output value */ - rgb = (float) urgb / (float) COLORMULT; -/* - * Check for limiting input values. - */ - if(rgb < 0.0) - return 0.0; - if(rgb > 1.0) - return 1.0; - return rgb; -} - -/*....................................................................... - * Flush color-representation changes made by xw_set_rgb() to the /xw - * window. This updates the window colormap. If color index 0 is changed - * then the background color is also updated. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * If xw->color.nbuff > 0 { - * For(ci=xw->color.sbuff; cicolor.sbuff + xw->color.nbuff; ci++) { - * xw->color.pixel[ci] = Color pixel to be changed. - * xw->color.xcolor[ci]= Requested color representation. - * }; - * }; - * Output: - * If xw->color.nbuff > 0 { - * For(ci=xw->color.sbuff; cicolor.sbuff + xw->color.nbuff; ci++) { - * xw->color.pixel[ci] = New color pixel if the colormap is readonly. - * xw->color.xcolor[ci]= Actual color representation installed. - * }; - * }; - * return int 0 - OK. - * 1 - Error. - */ -#ifdef __STDC__ -static int xw_update_colors(XWdev *xw) -#else -static int xw_update_colors(xw) - XWdev *xw; -#endif -{ - int bad_colors = 0; /* The number of failed color assignments */ - int i; -/* - * Device error? - */ - if(xw->bad_device) - return 1; -/* - * Are there any colors to be updated? - */ - if(!xw->color.monochrome && xw->color.nbuff > 0) { - XColor *xc = &xw->color.xcolor[xw->color.sbuff]; - unsigned long *pixel = &xw->color.pixel[xw->color.sbuff]; - int nbuff = xw->color.nbuff; -/* - * Install the colors in the color map. - */ - switch(xw->color.vi->class) { - case PseudoColor: - case GrayScale: - case DirectColor: - XStoreColors(xw->display, xw->color.cmap, xc, nbuff); - break; - case StaticColor: - case StaticGray: - case TrueColor: - for(i=0; ibad_device; i++) { - if(XAllocColor(xw->display, xw->color.cmap, &xc[i])) { - if(xw->color.initialized) - XFreeColors(xw->display, xw->color.cmap, &pixel[i], 1, (long)0); - pixel[i] = xc[i].pixel; - } else { - bad_colors++; - }; - }; - break; - }; -/* - * Device error? - */ - if(xw->bad_device) - return 1; -/* - * Update the background color? - */ - if(xw->color.sbuff == 0) - XSetWindowBackground(xw->display, xw->window, pixel[0]); -/* - * Did any of the color assignments fail? - */ - if(bad_colors > 0) { - fprintf(stderr, - "%s: Error setting the color representations of %d colors.\n", - XW_IDENT, bad_colors); - }; - }; -/* - * Reset buffer pointers. - */ - xw->color.nbuff = 0; - xw->color.sbuff = 0; - return xw->bad_device!=0; -} - -/*....................................................................... - * Set up the visual and colormap for the /xw window. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * Output: - * xw->color.vi The info descriptor of the visual to be used. - * xw->color.cmap The ID of the colormap to use. - * xw->color.ncol The number of colors available. - * xw->color.pixel[0..ncol] The color cell pixel indexes. - * xw->color.xcolor[0..ncol]The color pixel definitions. - * xw->color.monochrome If true, use black and white instead of the above - * values. - * xw->color.nbuff The number of buffered color representations. - * xw->color.sbuff The index of the first buffered color rep. - * - * return int 0 - OK. - * 1 - Error. - */ -#ifdef __STDC__ -static int xw_get_visual(XWdev *xw) -#else -static int xw_get_visual(xw) - XWdev *xw; -#endif -{ - XEvent event; /* Descriptor of XClientMessage communication descriptor */ - XWindowAttributes attr; -/* - * Device error? - */ - if(xw->bad_device) - return 1; -/* - * Assume that we have a monochrome display until proven otherwise. - */ - xw->color.monochrome = 1; - xw->color.ncol = 2; - xw->color.nbuff = 0; /* No color representations buffered yet */ - xw->color.sbuff = 0; -/* - * Inquire the current visual details of the window. - */ - if(!XGetWindowAttributes(xw->display, xw->window, &attr)) { - fprintf(stderr, - "%s: (xw_get_visual) Error getting attributes for window 0x%lx.\n", - XW_IDENT, (unsigned long) xw->window); - return 1; - }; - xw->color.vi = xw_visual_info(xw->display, xw->screen, attr.visual); - xw->color.cmap = attr.colormap; - if(xw->color.vi == NULL || xw->color.cmap == None) - return 1; -/* - * Ask the server for other colormap details. - */ - event.xclient.message_type = XA_COLORMAP; - if(xw_query_server(xw, &event)) - return 1; - xw->color.monochrome = event.xclient.data.l[0] == None; - xw->color.ncol = event.xclient.data.l[1]; -/* - * Allocate memory for the array of color pixels and color pixel - * representations. - */ - if(xw->color.ncol > 0) { - xw->color.pixel = (unsigned long *) malloc(sizeof(unsigned long) * - xw->color.ncol); - xw->color.xcolor = (XColor *) malloc(sizeof(XColor) * xw->color.ncol); - if(xw->color.pixel==NULL || xw->color.xcolor==NULL) - xw->color.ncol = 0; - }; -/* - * If we got a colormap, wait for the array of 'ncol' color-cell pixel - * indexes to be placed in the PGXWIN_CLIENT_DATA property on the - * client communication window, then read it and delete the property. - */ - if(!xw->color.monochrome) { - xw->color.ncol = xw_get_data(xw, (char *) &xw->color.pixel[0], - XW_LONG_PROP, (unsigned long) xw->color.ncol); - if(xw->color.ncol==0) - xw->color.monochrome = 1; - }; - return 0; -} - -/*....................................................................... - * Initialize the color representations in the color table. - * xw_get_visual() must have been called prior to calling this function, - * so that we have a visual and colormap to define the colors in. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * Output: - * xw->color.xcolor[0..ncol] The color pixel definitions. - * return int 0 - OK. - * 1 - Error. - */ -#ifdef __STDC__ -static int xw_init_colors(XWdev *xw) -#else -static int xw_init_colors(xw) - XWdev *xw; -#endif -{ -/* - * Define the standard PGPLOT line colors (RGB). - */ - static float ctable[NCOLORS][3] = { - {0.0,0.0,0.0}, {1.0,1.0,1.0}, {1.0,0.0,0.0}, {0.0,1.0,0.0}, - {0.0,0.0,1.0}, {0.0,1.0,1.0}, {1.0,0.0,1.0}, {1.0,1.0,0.0}, - {1.0,0.5,0.0}, {0.5,1.0,0.0}, {0.0,1.0,0.5}, {0.0,0.5,1.0}, - {0.5,0.0,1.0}, {1.0,0.0,0.5}, {0.333,0.333,0.333}, - {0.667,0.667,0.667} - }; - int i; -/* - * Initialize the color-table with the standard PGPLOT line colors. - */ - if(!xw->color.monochrome) { - int ncol = (NCOLORS < xw->color.ncol) ? NCOLORS : xw->color.ncol; - for(i=0; icolor.ncol; i++) { - float grey = (float)(i-NCOLORS) / (float)(xw->color.ncol-1-NCOLORS); - if(xw_set_rgb(xw, i, grey, grey, grey)) - return 1; - }; - }; -/* - * Flush the new color definitions to the display. - */ - if(xw_update_colors(xw)) - return 1; -/* - * Record the new colormap state. - */ - xw->color.initialized = 1; -/* - * Start with the foreground color set to white. - */ - if(xw_set_ci(xw, 1)) - return 1; - return 0; -} - -/*....................................................................... - * Get a new PGPLOT window from the server. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * Output: - * xw->window The new window ID. - * return Window The window ID, or 'None' on error. - */ -#ifdef __STDC__ -static Window xw_get_window(XWdev *xw) -#else -static Window xw_get_window(xw) - XWdev *xw; -#endif -{ - XEvent event; /* Descriptor of XClientMessage communication descriptor */ - int number; /* The requested window number */ -/* - * Device error? - */ - if(xw->bad_device) - return None; -/* - * Keep a record of the window number that was requested. - */ - number = xw->number; -/* - * Ask the server for other colormap details. - */ - event.xclient.message_type = XA_WINDOW; - event.xclient.data.l[0] = PGXWIN_REVISION; - event.xclient.data.l[1] = xw->number; - event.xclient.data.l[2] = xw->screen; - event.xclient.data.l[3] = xw->disposition; - if(xw_query_server(xw, &event)) - return None; - xw->protocol = event.xclient.data.l[0]; - xw->number = event.xclient.data.l[1]; - xw->window = event.xclient.data.l[2]; - xw->disposition = event.xclient.data.l[3]; -/* - * Did the server refuse to give us the requested window? - */ - if(xw->window == None) { - if(number != 0) - fprintf(stderr, "%s: Window %d is unavailable.\n", XW_IDENT, number); - else - fprintf(stderr, "%s: Failed to acquire a PGPLOT window.\n", XW_IDENT); - }; - return xw->window; -} - -/*....................................................................... - * Get a new pixmap from the server. This should be called whenever a - * new page is started. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * Output: - * xw->pixmap The new pixmap ID. - * return Pixmap The pixmap ID, or 'None' on error. - */ -#ifdef __STDC__ -static Pixmap xw_get_pixmap(XWdev *xw) -#else -static Pixmap xw_get_pixmap(xw) - XWdev *xw; -#endif -{ - XEvent event; /* Descriptor of XClientMessage communication descriptor */ -/* - * Device error? - */ - if(xw->bad_device) - return None; -/* - * Ask the server for other colormap details. - */ - event.xclient.message_type = XA_PIXMAP; - event.xclient.data.l[0] = xw->color.monochrome ? BlackPixel(xw->display, xw->screen) : xw->color.pixel[0]; - if(xw_query_server(xw, &event)) - return 1; - xw->pixmap = event.xclient.data.l[0]; -/* - * Did the server fail to give us the requested pixmap? - */ - if(xw->pixmap == None) - fprintf(stderr, "%s: Failed to allocate pixmap.\n", XW_IDENT); - return xw->pixmap; -} - -/*....................................................................... - * Get the IDs of the normal and active cursors. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * Output: - * xw->norm_cursor The ID of the idle cursor. - * xw->live_cursor The ID of the live cursor. - * return int 0 - OK. - * 1 - Error. - */ -#ifdef __STDC__ -static int xw_get_cursors(XWdev *xw) -#else -static int xw_get_cursors(xw) - XWdev *xw; -#endif -{ - XEvent event; /* Descriptor of XClientMessage communication descriptor */ -/* - * Device error? - */ - if(xw->bad_device) - return 1; -/* - * Ask the server for other colormap details. - */ - event.xclient.message_type = XA_CURSOR; - if(xw_query_server(xw, &event)) - return 1; - xw->norm_cursor = event.xclient.data.l[0]; - xw->live_cursor = event.xclient.data.l[1]; - xw->crosshair = event.xclient.data.l[2]; - return xw->bad_device!=0; -} - -/*....................................................................... - * Agree upon a window geometry with the PGPLOT /xw server. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. Only the display - * and screen members are required. - * mask int A bit mask to specify which values have been provided - * and how they should be interpretted. The mask is the - * union of the following: - * WidthValue - Use the given width value. - * HeightValue - Use the given height value. - * XValue - Use the given value of 'x'. - * YValue - Use the given value of 'y'. - * XNegative - x is wrt the right of the display. - * YNegative - y is wrt the left of the display. - * x int The left edge of the window. - * y int The top edge of the window. - * width unsigned The width of the window. - * height unsigned The height of the window. - * Output: - * xw->geom XWgeom The new window geometry. - * return int 0 - OK. - * 1 - Error. - */ -#ifdef __STDC__ -static int xw_new_geom(XWdev *xw, int x, int y, unsigned int width, - unsigned int height, int mask) -#else -static int xw_new_geom(xw, x, y, width, height, mask) - XWdev *xw; int x; int y; unsigned int width; unsigned int height; int mask; -#endif -{ - XEvent event; /* Descriptor of XClientMessage communication descriptor */ - unsigned int d_pix_width; /* Display width in pixels */ - unsigned int d_pix_height; /* Display height in pixels */ - unsigned int d_mm_width; /* Display width in mm */ - unsigned int d_mm_height; /* DIsplay height in mm */ - int xw_mask=0; /* PGXWIN communication version of 'mask' */ -/* - * Device error? - */ - if(xw->bad_device) - return 1; -/* - * Get the PGXWIN_GEOMETRY transaction atom. - */ - if(xw->geom.geom_atom == None) - xw->geom.geom_atom = XInternAtom(xw->display, "PGXWIN_GEOMETRY", False); -/* - * Translate the local bitmask values to a PGXWIN defined bitmask for - * communication, since different Xlibs may define the XParseGeometry - * bitmask values differently. They will be translated back in the server. - */ - if(mask & WidthValue) - xw_mask |= XW_WidthValue; - if(mask & HeightValue) - xw_mask |= XW_HeightValue; - if(mask & XValue) - xw_mask |= XW_XValue; - if(mask & YValue) - xw_mask |= XW_YValue; - if(mask & XNegative) - xw_mask |= XW_XNegative; - if(mask & YNegative) - xw_mask |= XW_YNegative; -/* - * Send geometry prefences to the server and receive the resulting - * geometry. - */ - event.xclient.message_type = xw->geom.geom_atom; - event.xclient.data.l[0] = x; - event.xclient.data.l[1] = y; - event.xclient.data.l[2] = width; - event.xclient.data.l[3] = height; - event.xclient.data.l[4] = xw_mask; - if(xw_query_server(xw, &event)) - return 1; -/* - * Record the geometry that the server sent. - */ - xw->geom.x = event.xclient.data.l[0]; - xw->geom.y = event.xclient.data.l[1]; - xw->geom.width = event.xclient.data.l[2]; - xw->geom.height = event.xclient.data.l[3]; -/* - * Determine the current display width and height in mm and pixels. - */ - d_pix_width = DisplayWidth(xw->display, xw->screen); - d_mm_width = DisplayWidthMM(xw->display, xw->screen); - d_pix_height = DisplayHeight(xw->display, xw->screen); - d_mm_height = DisplayHeightMM(xw->display, xw->screen); -/* - * Determine the device resolution in pixels per inch. - */ - xw->geom.xpix_per_inch = 25.4 * ((double)d_pix_width / (double)d_mm_width); - xw->geom.ypix_per_inch = 25.4 * ((double)d_pix_height / (double)d_mm_height); -/* - * Determine the number of pixels needed to form a 1/4" margin around the - * the plot area. - */ - xw->geom.xmargin = (int) (0.25 * xw->geom.xpix_per_inch + 0.5); - xw->geom.ymargin = (int) (0.25 * xw->geom.ypix_per_inch + 0.5); -/* - * Determine the pixel indexes that enclose an area bounded by 1/4" margins. - */ - xw->geom.xmin = xw->geom.xmargin; - xw->geom.xmax = xw->geom.width - xw->geom.xmargin; - xw->geom.ymin = xw->geom.ymargin; - xw->geom.ymax = xw->geom.height - xw->geom.ymargin; - return 0; -} - -/*....................................................................... - * Instate the given cursor type. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * norm int If norm!=0 instate the normal idle cursor. - * If norm==0 instate the active cursor. - * Output: - * return int 0 - OK. - * 1 - Error. - */ -#ifdef __STDC__ -static int xw_set_cursor(XWdev *xw, int norm) -#else -static int xw_set_cursor(xw, norm) - XWdev *xw; int norm; -#endif -{ - Cursor cursor; /* The ID of the cursor to be instated */ -/* - * Device error? - */ - if(xw->bad_device) - return 1; -/* - * Get the cursor ID and color to use. - */ - cursor = norm ? xw->norm_cursor : xw->live_cursor; -/* - * Register the cursor to the window. - */ - XDefineCursor(xw->display, xw->window, cursor); - if(xw->bad_device) - return 1; - XFlush(xw->display); - return xw->bad_device!=0; -} - -/*....................................................................... - * Clear the window and pixmap to start a new page. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * Output: - * return int 0 - OK. - * 1 - Error. - */ -#ifdef __STDC__ -static int xw_clear(XWdev *xw) -#else -static int xw_clear(xw) - XWdev *xw; -#endif -{ - unsigned long fg; /* Saved foreground color */ -/* - * Device error? - */ - if(xw->bad_device) - return 1; -/* - * We are about to change the current foreground color, so save the - * current value to be re-instated shortly. - */ - fg = xw->gcv.foreground; -/* - * Clear the pixmap by drawing an opaque rectangle over it in the background - * color. - */ - xw_set_ci(xw, 0); - if(xw->pixmap != None) { - XFillRectangle(xw->display, xw->pixmap, xw->gc, 0, 0, - xw->geom.width, xw->geom.height); - if(xw->bad_device) - return 1; - }; -/* - * Re-instate the foreground color. - */ - xw->gcv.foreground = fg; - XSetForeground(xw->display, xw->gc, xw->gcv.foreground); - if(xw->bad_device) - return 1; -/* - * Mark the pixmap as unmodified. - */ - xw->update.modified = 0; -/* - * Clear the window itself. - */ - XClearWindow(xw->display, xw->window); - if(xw->bad_device) - return 1; - XFlush(xw->display); - if(xw->bad_device) - return 1; - return 0; -} - -/*....................................................................... - * Set the foreground color. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * ci int The PGPLOT color index to instate as the foreground - * color. - * Output: - * return int 0 - OK. - * 1 - Error. - */ -#ifdef __STDC__ -static int xw_set_ci(XWdev *xw, int ci) -#else -static int xw_set_ci(xw, ci) - XWdev *xw; int ci; -#endif -{ -/* - * Device error? - */ - if(xw->bad_device) - return 1; -/* - * Assign white to out-of range color indexes. - */ - if(ci < 0 || ci >= xw->color.ncol) - ci = 1; -/* - * Determine the color pixel associated with the given color index. - */ - if(xw->color.monochrome) { - xw->gcv.foreground = ci==1 ? WhitePixel(xw->display, xw->screen) : - BlackPixel(xw->display, xw->screen); - } else { - xw->gcv.foreground = xw->color.pixel[ci]; - }; -/* - * Instate the new foreground color. - */ - XSetForeground(xw->display, xw->gc, xw->gcv.foreground); - if(xw->bad_device) - return 1; - return 0; -} - -/*....................................................................... - * Update the vertices of the rectangular area that has been modified - * since the last time the window was updated from the pixmap. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * x int The x-axis pixel index that the rectangular update area - * must be extended to include. - * y int The y-axis pixel index that the rectangular update area - * must be extended to include. - * diameter int The diameter of the locus in pixels. For line or - * point drawing operations this is usually the line width. - */ -#ifdef __STDC__ -static void xw_mark_modified(XWdev *xw, int x, int y, int diameter) -#else -static void xw_mark_modified(xw, x, y, diameter) - XWdev *xw; int x; int y; int diameter; -#endif -{ - int radius = diameter/2; -/* - * Expand the current rectangle to include point (x,y). - */ - if(xw->update.modified) { - if(x - radius < xw->update.xmin) - xw->update.xmin = x - radius; - if(x + radius > xw->update.xmax) - xw->update.xmax = x + radius; - if(y - radius < xw->update.ymin) - xw->update.ymin = y - radius; - if(y + radius > xw->update.ymax) - xw->update.ymax = y + radius; - } else { - xw->update.xmin = x - radius; - xw->update.xmax = x + radius; - xw->update.ymin = y - radius; - xw->update.ymax = y + radius; - xw->update.modified = 1; - }; - return; -} - -/*....................................................................... - * Flush changes to the pixmap to the window. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * Output: - * return int 0 - OK. - * 1 - Error. - */ -#ifdef __STDC__ -static int xw_flush(XWdev *xw) -#else -static int xw_flush(xw) - XWdev *xw; -#endif -{ - if(xw->bad_device) - return 1; -/* - * Flush buffered opcodes if necessary. - */ - if(xw->flush_opcode_fn != (Flush_Opcode_fn) 0) { - (*xw->flush_opcode_fn)(xw); - xw->flush_opcode_fn = (Flush_Opcode_fn) 0; - if(xw->bad_device) - return 1; - }; -/* - * Copy the modified rectangular area of the pixmap to the /xw window. - */ - if(xw->update.modified) { -/* - * Enforce bounds on the area to be updated. - */ - if(xw->update.xmin < 0) - xw->update.xmin = 0; - if(xw->update.ymin < 0) - xw->update.ymin = 0; - if(xw->update.xmax > xw->geom.width - 1) - xw->update.xmax = xw->geom.width - 1; - if(xw->update.ymax > xw->geom.height - 1) - xw->update.ymax = xw->geom.height - 1; -/* - * Copy the area to be updated from the pixmap to the window. - */ - if(xw->pixmap != None && !xw->bad_device) { - XCopyArea(xw->display, xw->pixmap, xw->window, xw->gc, - xw->update.xmin, xw->update.ymin, - (unsigned) (xw->update.xmax - xw->update.xmin + 1), - (unsigned) (xw->update.ymax - xw->update.ymin + 1), - xw->update.xmin, xw->update.ymin); - if(xw->bad_device) - return 1; - }; - xw->update.modified = 0; - }; - XFlush(xw->display); - if(xw->bad_device) - return 1; - return 0; -} - -/*....................................................................... - * Open a /xw window and return an initialized /xw PGPLOT device descriptor. - * - * Input: - * display char * A '\0' terminated string containing the name of - * the display. - * mode int The type of window to open. - * 1 - None-persistent window. - * 2 - Persistent window. - * Output: - * return XWdev * THe PGPLOT /xw device descriptor, or NULL on error. - */ -#ifdef __STDC__ -static XWdev *new_XWdev(char *display, int mode) -#else -static XWdev *new_XWdev(display, mode) - char *display; int mode; -#endif -{ - XWdev *xw; /* The descriptor to be returned */ -/* - * Allocate the descriptor. - */ - xw = (XWdev *) malloc(sizeof(XWdev)); - if(xw==NULL) - return del_XWdev(xw,0); -/* - * Initialize all members of the descriptor at least to the point at which - * the descriptor can safely be sent to del_XWdev(xw,0). All pointers must - * be assigned NULL and XIDs assigned None, so that del_XWdev() knows what - * hasn't been allocated yet. - */ - xw->display = NULL; - xw->parent = None; - xw->window = None; - xw->client = None; - xw->server = None; - xw->number = 0; - xw->screen = 0; - xw->disposition = mode==2 ? XW_PERSIST : XW_DELETE; - xw->bad_device = 0; - xw->last_error = 0; - xw->pixmap = None; - xw->color.cmap = None; - xw->norm_cursor = None; - xw->live_cursor = None; - xw->crosshair = 0; - xw->poly.points = NULL; - xw->poly.ndone = xw->poly.npoint = 0; - xw->gc = NULL; - xw->color.vi = NULL; - xw->color.cmap = None; - xw->color.ncol = 0; - xw->color.monochrome = 1; - xw->color.pixel = NULL; - xw->color.xcolor = NULL; - xw->color.initialized = 0; - xw->color.nbuff = 0; - xw->color.sbuff = 0; - xw->geom.geom_atom = None; - xw->update.modified = 0; - xw->event.mask = NoEventMask; - xw->event.no_buttons = 0; - xw->image.xi = NULL; - xw->last_opcode = 0; - xw->nofocus = 0; /* M.Z */ - xw->flush_opcode_fn = (Flush_Opcode_fn) 0; -/* - * See if the device name is prefixed with a window number. - * The device name is encoded as [window@][display] | [window]. - * Leave the trailing display name in display. - */ - { - char *endp; - long number = strtol(display, &endp, 10); - switch(*endp) { - case '@': - display = endp+1; - xw->number = number; - break; - case '\0': - display = endp; - xw->number = number; - break; - }; - }; -/* - * Treat -ve window numbers as equivalent to 0. - */ - if(xw->number < 0) - xw->number = 0; -/* - * Open a connection to the X display server. - */ - xw->display = XOpenDisplay(display); - if(xw->display==NULL) { - fprintf(stderr, "%s: cannot connect to X server [%s]\n", XW_IDENT, - XDisplayName(display)); - return del_XWdev(xw,0); - }; -/* - * Install an error handler for non-fatal errors. If we don't do this then - * Xlib will do its own error handling, which includes killing the program. - */ - XSetErrorHandler(xw_error); -/* - * Get the index of the screen cited in the display string. - */ - xw->screen = DefaultScreen(xw->display); -/* - * Also record the parent window ID. - */ - xw->parent = RootWindow(xw->display, xw->screen); -/* - * Create a simple window for communication with the server. - */ - xw->client = XCreateSimpleWindow(xw->display, xw->parent, - 0, 0, (unsigned)1, (unsigned)1, (unsigned)1, - BlackPixel(xw->display, xw->screen), - BlackPixel(xw->display, xw->screen)); - if(xw->client == None || xw->bad_device) { - fprintf(stderr, "%s: Unable to create window.\n", XW_IDENT); - return del_XWdev(xw,0); - }; -/* - * We want notice of changes of the PGXWIN_CLIENT_DATA property. - */ - XSelectInput(xw->display, xw->client, (long) PropertyChangeMask); - if(xw->bad_device) - return del_XWdev(xw,0); -/* - * Get the server selection atom and the client data transfer atom. - */ - xw->server_atom = XInternAtom(xw->display, PGXWIN_SERVER, False); - if(xw->bad_device) - return del_XWdev(xw,0); - xw->client_data = XInternAtom(xw->display, "PGXWIN_CLIENT_DATA", False); - if(xw->bad_device) - return del_XWdev(xw,0); -/* - * Get the server window ID. - */ - if(xw_get_server(xw) == None) - return del_XWdev(xw,0); -/* - * Get a new PGPLOT window. - */ - if(xw_get_window(xw) == None) - return del_XWdev(xw,0); -/* - * We want to know if the PGPLOT window gets destroyed. - */ - if(xw_add_events(xw, (long) StructureNotifyMask)) - return del_XWdev(xw,0); -/* - * Get the visual and colormap of the window. - */ - if(xw_get_visual(xw)) - return del_XWdev(xw,0); -/* - * Set/get the current geometry for the window. - */ - if(xw_new_geom(xw, 0,0, 0,0, 0)) - return del_XWdev(xw,0); -/* - * Get the IDs of the normal and active cursors. - */ - if(xw_get_cursors(xw)) - return del_XWdev(xw,0); -/* - * Instate the normal cursor for the window. - */ - if(xw_set_cursor(xw, 1)) - return del_XWdev(xw,0); -/* - * Create and initialize a graphical context descriptor. This is where - * Line widths, line styles, fill styles, plot color etc.. are - * recorded. - */ - xw->gcv.line_width = 1; - xw->gcv.cap_style = CapRound; - xw->gcv.join_style = JoinRound; - xw->gcv.fill_rule = EvenOddRule; - xw->gcv.graphics_exposures = False; - xw->gcv.foreground = WhitePixel(xw->display, xw->screen); - xw->gc = XCreateGC(xw->display, xw->window, (unsigned long) (GCLineWidth | - GCCapStyle | GCJoinStyle | GCFillRule | GCGraphicsExposures | - GCForeground), &xw->gcv); - if(xw->gc==NULL || xw->bad_device) { - fprintf(stderr, "%s: Failed to allocate graphical context.\n", XW_IDENT); - return del_XWdev(xw,0); - }; -/* - * Allocate the buffers that will be used to compose a line - * of pixels. - */ - if(xw_get_image(xw, XW_IMAGE_LEN)) - return del_XWdev(xw,0); -/* - * Return the initialized descriptor for use. - */ - return xw; -} - -/*....................................................................... - * Delete a PGPLOT /xw device and its descriptor. - * - * Input: - * xw XWdev * The descriptor of the device to be deleted. - * partial int 0 - Normal deletion - delete everything. - * 1 - Close the display connection and mark all - * resources as deleted but don't delete the - * container - also set xw->bad_device==1. - * Output: - * return XWdev * Allways NULL. Use like xw = del_XWdev(xw,0); - */ -#ifdef __STDC__ -static XWdev *del_XWdev(XWdev *xw, int partial) -#else -static XWdev *del_XWdev(xw, partial) - XWdev *xw; int partial; -#endif -{ - if(xw) { -/* - * Mark the device as unusable as the first operation so that if - * any X errors are generated during cleanup, they are not reported. - */ - xw->bad_device = 1; -/* - * Delete the graphical context descriptor. - */ - if(xw->gc) - XFreeGC(xw->display, xw->gc); - xw->gc = NULL; -/* - * Delete the image buffers. - */ - if(xw->image.xi) - XDestroyImage(xw->image.xi); - xw->image.xi = NULL; -/* - * Check for un-freed polygon points. - */ - if(xw->poly.points) - free((char *)xw->poly.points); - xw->poly.points = NULL; -/* - * Zap the arrays of color pixels and color pixel definitions. - */ - if(xw->color.pixel) - free((char *)xw->color.pixel); - if(xw->color.xcolor) - free((char *)xw->color.xcolor); -/* - * Discard the visual info descriptor. - */ - if(xw->color.vi) - XFree((char *)xw->color.vi); -/* - * Close the connection to the display server - this will also delete - * all X-resources. - */ - if(xw->display != NULL) { -/* - * Explicitly clear the local event mask for the PGPLOT /xw window in case - * XCloseDisplay fails to do this. - */ - if(xw->window != None) - XSelectInput(xw->display, xw->window, (long) NoEventMask); - XCloseDisplay(xw->display); - xw->display = NULL; - }; -/* - * Mark effected resources as deleted. - */ - xw->client = xw->server = xw->window = xw->parent = None; - xw->server_atom = xw->client_data = None; - xw->pixmap = xw->norm_cursor = xw->live_cursor = None; - xw->flush_opcode_fn = (Flush_Opcode_fn) 0; - xw->update.modified = 0; -/* - * Delete the descriptor if required. - */ - if(!partial) { - free((char *)xw); - xw = NULL; - }; - }; - return xw; -} - -/*....................................................................... - * Before using a given /xw device descriptor call this function to check - * that it is usable. If it isn't, 0 will be returned and you should not - * attempt to use the descriptor. If the descriptor is NULL an error - * message will be presented. - * - * Input: - * xw XWdev * The device descriptor to be checked. - * Output: - * return int 1 - Descriptor OK. - * 0 - Error - don't use /xw. - */ -#ifdef __STDC__ -static int xw_ok(XWdev *xw) -#else -static int xw_ok(xw) - XWdev *xw; -#endif -{ - if(xw==NULL) { - fprintf(stderr, "%s: Device not open.\n", XW_IDENT); - return 0; - }; -/* - * If the window is marked as unusable, it must have been set that way - * after an error was detected. Assume that the error must already - * have been reported. - */ - if(xw->bad_device) - return 0; - return 1; -} - -/*....................................................................... - * Present the active cursor, wait for the user to press a button or - * keyboard key, then retrack the active cursor and return the cursor - * position and key pressed. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * mode int 0 - No rubber banding. - * 1 - Maintain a rectangle outline with opposing - * vertexes at (xin,yin) and the cursor. - * 2 - Maintain a line between (xin,yin) and the cursor. - * negative: -mode = timeout in deciSec - * posn int 0 - Don't attempt to position the cursor. - * 1 - Do try to pre-position the cursor. - * ref XPoint * The reference position of the cursor (can be the same - * as 'pos'). - * Input/Output: - * pos XPoint * The start position of the cursor. On output this is the - * selected position of the cursor. - * Output: - * key char * If key!=NULL, the selection key will be assigned to - * the caller's variable pointed to by key. - * return int 0 - OK. - * 1 - Error. - */ -#ifdef __STDC__ -static int xw_read_cursor(XWdev *xw, int mode, int posn, XPoint *ref, - XPoint *pos, char *key) -#else -static int xw_read_cursor(xw, mode, posn, ref, pos, key) - XWdev *xw; int mode; int posn; XPoint *ref; XPoint *pos; char *key; -#endif -{ - int finished = 0; /* True when cursor succesfully read */ - XEvent event; /* The latest event */ - XPoint last; /* Last recorded position of cursor */ - Band *bc=NULL; /* Band-cursor descriptor */ - int warped=0; /* Zero until the cursor has been positioned */ - int tmo_10=0; -/* - * Device error? - */ - if(xw->bad_device) - return 1; -/* - * Ensure that the input positions are within the pixmap and window bounds. - */ - if(xw_bound_cursor(xw, ref) || xw_bound_cursor(xw, pos)) - return 1; -/* - * Present the active cursor. - */ - if(xw_set_cursor(xw, 0)) - return xw_end_cursor(xw, bc, 1); -/* - * Make sure that the window is up to date. - */ - if(xw_flush(xw)) - return xw_end_cursor(xw, bc, 1); -/* - * get timeout - */ - tmo_10=0; /* M.Z */ - if (mode<0) { - tmo_10=-mode*10; - } -/* - * De-iconify and bring the window to the foreground. - */ - if (xw->nofocus) { /* M.Z. */ - XMapWindow(xw->display, xw->window); - } else { - XMapRaised(xw->display, xw->window); - } - if(xw->bad_device) - return xw_end_cursor(xw, bc, 1); - XSync(xw->display, False); - if(xw->bad_device) - return xw_end_cursor(xw, bc, 1); -/* - * Set up for modes that maintain elastic lines following the cursor. - */ - if((bc=xw_new_Band(xw, mode, ref))==NULL) - return xw_end_cursor(xw, bc, 1); -/* - * If the cursor is in the window, locate its position, - * after warping if requested. - */ - if(xw_locate_cursor(xw, pos, posn, &last)) { - warped = 1; -/* - * Draw the cursor. - */ - if(xw->bad_device || xw_bound_cursor(xw, &last) || - xw_draw_cursor(xw, bc, &last)) - return xw_end_cursor(xw, bc, 1); - }; -/* - * Discard un-handled ButtonPress, KeyPress and MotionNotify events. - */ - /* removed M.Z. - if (xw->nofocus) { - while(xw_check_window_event(xw, xw->window, (long) - (ButtonPressMask | PointerMotionMask), &event)); - } else { - while(xw_check_window_event(xw, xw->window, (long) - (ButtonPressMask | KeyPressMask | PointerMotionMask), &event)); - } - */ - if(xw->bad_device) - return xw_end_cursor(xw, bc, 1); - xw->nofocus=0; /* M.Z. */ -/* - * Loop for cursor events. - */ - while(!finished) { -/* - * Handle the next selected event. - */ - if(xw_next_event_tmo(xw, &event, tmo_10)) /* M.Z */ - return xw_end_cursor(xw, bc, 1); - switch(event.type) { - case 0: /* time out M.Z.*/ - xw->nofocus=1; - return xw_end_cursor(xw, bc, 1); - case Expose: - if(xw_expose(xw, &event)) - return xw_end_cursor(xw, bc, 1); - break; - case ButtonPress: -/* - * Return the position at which the cursor was selected. - */ - pos->x = event.xbutton.x; - pos->y = event.xbutton.y; -/* - * Return the key alias of the button that selected the cursor. - */ - if(key) { - switch(event.xbutton.button) { - case Button1: - *key = 'A'; - break; - case Button2: - *key = 'D'; - break; - default: - *key = 'X'; - break; - }; - }; - finished = 1; - break; - case KeyPress: - { - char buffer[10]; /* Buffer to read key definition into */ - KeySym keysym; /* Key code of pressed keyboard key */ - int nret; /* The number of characters in buffer[] */ -/* - * Get the ASCII encoding associated with the key. - */ - nret = XLookupString((XKeyEvent *)&event, buffer, - (int) (sizeof(buffer)/sizeof(char)), &keysym, NULL); - if(xw->bad_device) - return xw_end_cursor(xw, bc, 1); -/* - * Ignore modifier keys and all but single character keys. - */ - if(nret==1 && (keysym < XK_Shift_L || keysym > XK_Hyper_R)) { - pos->x = event.xkey.x; - pos->y = event.xkey.y; - if(key) - *key = buffer[0]; - finished = 1; - }; -/* - * Check for arrow keys. - */ - switch(keysym) { -#ifdef XK_KP_Left - case XK_KP_Left: -#endif - case XK_Left: -#ifdef XK_KP_Right - case XK_KP_Right: -#endif - case XK_Right: -#ifdef XK_KP_Up - case XK_KP_Up: -#endif - case XK_Up: -#ifdef XK_KP_Down - case XK_KP_Down: -#endif - case XK_Down: - if(xw_shift_cursor(xw, keysym, event.xkey.state)) - return xw_end_cursor(xw, bc, 1); - break; - }; - }; - break; - case EnterNotify: -/* - * The cursor may still be drawn if a button was pressed when the - * cursor was last moved out of the window. The resulting - * passive grab will have continued to deliver motion events to - * the PGPLOT window. - */ - if(xw_erase_cursor(xw, bc)) - return xw_end_cursor(xw, bc, 1); -/* - * If the cursor is in the window, locate its position. If this is - * the first time that the cursor has been in the window and warping - * has been requested, this also inolves pre-positioning the cursor - * and setting input focus. - */ - if(xw_locate_cursor(xw, pos, posn && !warped, &last)) { - warped = 1; -/* - * Draw the cursor. - */ - if(xw->bad_device || xw_bound_cursor(xw, &last) || - xw_draw_cursor(xw, bc, &last)) - return xw_end_cursor(xw, bc, 1); - }; - break; - case LeaveNotify: - if(xw_erase_cursor(xw, bc)) - return xw_end_cursor(xw, bc, 1); - break; - case MotionNotify: -/* - * Discard all but the last MotionNotify event. - */ - while(xw_check_window_event(xw, xw->window, (long)(PointerMotionMask), - &event)); - - if(xw->bad_device || xw_erase_cursor(xw, bc)) - return xw_end_cursor(xw, bc, 1); - last.x = event.xmotion.x; - last.y = event.xmotion.y; - if(xw_bound_cursor(xw, &last) || xw_draw_cursor(xw, bc, &last)) - return xw_end_cursor(xw, bc, 1); - break; - default: - break; - }; - }; -/* - * Clean up. - */ - return xw_end_cursor(xw, bc, xw->bad_device!=0); -} - -/*....................................................................... - * This is a private function of xw_read_cursor(). If the user has just - * pressed one of the keyboard or keypad arrow keys, it moves the cursor - * by one pixel in the corresponding direction. If one of the shift keys - * is also held down, then the cursor is moved by ARROW_KEY_VELOCITY - * pixels instead of one. If the resulting shift would move the cursor - * out of the bounds of the pgplot window pixmap, then the motion is - * aborted. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * keysym KeySym The key symbol returned by XLookupString() wrt - * the arrow-button key-press. - * modifiers unsigned The Event::xkey.state key-modifier mask - * associated with the key-press. - * Output: - * return int 0 - OK. - * 1 - Error. - */ -#ifdef __STDC__ -static int xw_shift_cursor(XWdev *xw, KeySym keysym, unsigned int modifiers) -#else -static int xw_shift_cursor(xw, keysym, modifiers) - XWdev *xw; KeySym keysym; unsigned int modifiers; -#endif -{ - Window p_child; /* The child window that contains the pointer */ - int p_win_x, p_win_y; /* The pointer coordinates wrt xw->window */ - int p_root_x, p_root_y; /* The pointer coordinates wrt the root window */ - Window p_root_win; /* The root window that contains the cursor */ - unsigned int p_mask; /* The bit-mask of button states etc.. */ - int dx=0; /* The amount to move the cursor in X */ - int dy=0; /* The amount to move the cursor in Y */ -/* - * Determine the current position of the cursor. - */ - XQueryPointer(xw->display, xw->window, &p_root_win, &p_child, - &p_root_x, &p_root_y, &p_win_x, &p_win_y, &p_mask); - if(xw->bad_device) - return 1; -/* - * Work out the position increments in x and y. - */ - switch(keysym) { -#ifdef XK_KP_Left - case XK_KP_Left: -#endif - case XK_Left: - dx = -1; - break; -#ifdef XK_KP_Right - case XK_KP_Right: -#endif - case XK_Right: - dx = 1; - break; -#ifdef XK_KP_Up - case XK_KP_Up: -#endif - case XK_Up: - dy = -1; - break; -#ifdef XK_KP_Down - case XK_KP_Down: -#endif - case XK_Down: - dy = 1; - break; - default: - return 0; - break; - }; -/* - * If one of the shift keys is held down, increase the size of the - * move to ARROW_KEY_VELOCITY pixels in the specified direction. - */ - if(modifiers & ShiftMask) { - dx *= ARROW_KEY_VELOCITY; - dy *= ARROW_KEY_VELOCITY; - }; -/* - * Determine the final position of the pointer wrt the top left corner - * of the window. - */ - p_win_x += dx; - p_win_y += dy; -/* - * Abort the shift operation if the final position lies outside of the - * bounds of the pgplot window pixmap. Note that this simple test doesn't - * take account of the fact that another window may lie over the pgplot - * window, or that the window may have been resized to a smaller size - * than the pixmap. To do this properly one would have to perform the - * move, then check for LeaveNotify events and put the cursor back if - * one was detected. This would be hard to code without breaking - * xw_read_cursor() which also wants LeaveNotify events, would be - * slower to operate and would be unavoidably subject to race conditions. - */ - if(p_win_x < 0 || p_win_x >= xw->geom.width || - p_win_y < 0 || p_win_y >= xw->geom.height) - return 0; -/* - * Move the cursor to the new location. - */ - XWarpPointer(xw->display, None, xw->window, 0, 0, 0, 0, p_win_x, p_win_y); - if(xw->bad_device) - return 1; - return 0; -} - -/*....................................................................... - * Private return function of xw_read_cursor(). - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * bc Band * The cursor banding descriptor to be deleted. - * status int Required xw_read_cursor() return status. - * Output: - * return int The value of 'status'. - */ -#ifdef __STDC__ -static int xw_end_cursor(XWdev *xw, Band *bc, int status) -#else -static int xw_end_cursor(xw, bc, status) - XWdev *xw; Band *bc; int status; -#endif -{ - if(bc) { - if(xw_erase_cursor(xw, bc)) - status=1; - if(xw_flush(xw)) - status=1; - bc = xw_del_Band(xw, bc); - }; - if(xw_set_cursor(xw,1)) - status=1; - return status; -} - -/*....................................................................... - * Convert from the coordinates sent by PGPLOT in rbuf[...] to an - * X-windows point in the coordinate system of the window. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * xy float [2] Array of two floats containing PGPLOT coordinates - * arranged as x followed by y. - * Output: - * xp XPoint * The converted coordinates will be assigned to xp->x - * and xp->y. - */ -#ifdef __STDC__ -static void xw_xy_to_XPoint(XWdev *xw, float *xy, XPoint *xp) -#else -static void xw_xy_to_XPoint(xw, xy, xp) - XWdev *xw; float *xy; XPoint *xp; -#endif -{ - xp->x = xw->geom.xmin + (int)(xy[0] + 0.5); - xp->y = xw->geom.ymax - (int)(xy[1] + 0.5); -} - -/*....................................................................... - * Convert from window pixel coordinates to PGPLOT coordinates, in a - * form that can be returned to PGPLOT via rbuf[...]. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * xp XPoint * The window pixel-coordinates to be converted. - * Output: - * xy float [2] Output array of two floats in which to place the - * PGPLOT coordinates, arranged as x followed by y. - */ -#ifdef __STDC__ -static void xw_XPoint_to_xy(XWdev *xw, XPoint *xp, float *xy) -#else -static void xw_XPoint_to_xy(xw, xp, xy) - XWdev *xw; XPoint *xp; float *xy; -#endif -{ - xy[0] = (float) (xp->x - xw->geom.xmin); - xy[1] = (float) (xw->geom.ymax - xp->y); -} - -/*....................................................................... - * Start a new page by clearing and possibly re-sizing the given /xw - * window and its pixmap. If the current size of the window is equal - * to the requested new size, then only the window clearing operation - * will be performed. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor of the window to be - * resized. - * width unsigned The new width for the re-sized window (pixels). - * height unsigned The new height for the re-sized window (pixels). - * Output: - * return int 0 - OK. - * 1 - Error. - */ -#ifdef __STDC__ -static int xw_next_page(XWdev *xw, unsigned int width, unsigned int height) -#else -static int xw_next_page(xw, width, height) - XWdev *xw; unsigned int width; unsigned int height; -#endif -{ - int need_resize; /* True if the current pixmap size needs to be changed */ -/* - * Device error? - */ - if(xw->bad_device) - return 1; -/* - * Does the pixmap need to be resized? - */ - need_resize = width != xw->geom.width || height != xw->geom.height; -/* - * Establish the new geometry with the server. - */ - if(need_resize) { - if(xw_new_geom(xw, 0,0, width,height, (WidthValue|HeightValue))) - return 1; - }; -/* - * Reset the colormap color representations if necessary. - */ - if(!xw->color.initialized && xw_init_colors(xw)) - return 1; -/* - * Allocate a new pixmap? - */ - if(xw->pixmap==None || need_resize) { - xw_get_pixmap(xw); - if(xw->bad_device) - return 1; -/* - * If a new pixmap is not required, simply clear the window and pixmap. - */ - } else { - if(xw_clear(xw)) - return 1; -/* - * Also ensure that the window has the same size as the pixmap. - */ - XResizeWindow(xw->display, xw->window, xw->geom.width, xw->geom.height); - }; - return 0; -} - -/*....................................................................... - * Draw a horizontal line of pixels at a given location, from a float - * array of PGPLOT color indexes. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * start XPoint * The position to start the line at. - * cells float * An array of ncell pixel PGPLOT color indexes. - * ncell int The number of cells in cells[]. - * Output: - * return int 0 - OK. - * 1 - Error. - */ -#ifdef __STDC__ -static int xw_image_line(XWdev *xw, XPoint *start, float *cells, int ncell) -#else -static int xw_image_line(xw, start, cells, ncell) - XWdev *xw; XPoint *start; float *cells; int ncell; -#endif -{ - int ndone; /* The number of pixels drawn so far */ - int i; -/* - * Device error? - */ - if(xw->bad_device) - return 1; -/* - * Quietly ignore the call if we don't have a pixmap. - */ - if(xw->pixmap != None) { -/* - * Draw up to xw->image.npix pixels at a time. This is the size of the - * xw->image.buff[] buffer. - */ - for(ndone=0; !xw->bad_device && ndonecolor.vi->depth == 8) { - for(i=0; iimage.xi->data[i] = xw->color.pixel[(int)(cells[ndone+i] + 0.5)]; - } else { - for(i=0; iimage.xi, i, 0, - xw->color.pixel[(int) (cells[ndone+i] + 0.5)]); - }; - }; -/* - * Display the image. - */ - XPutImage(xw->display, xw->pixmap, xw->gc, xw->image.xi, 0, 0, - start->x+ndone, start->y, (unsigned) nimage, (unsigned) 1); - }; -/* - * Extend the region to be updated on the next flush. - */ - xw_mark_modified(xw, start->x, start->y, 1); - xw_mark_modified(xw, start->x + ncell - 1, start->y, 1); - }; - if(xw->bad_device) - return 1; - return 0; -} - -/*....................................................................... - * Call this function when an Expose event is received. It will then - * re-draw the exposed region from the xw->pixmap. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * event XEvent * The expose event. - * Output: - * return int 0 - OK. - * 1 - Error. - */ -#ifdef __STDC__ -static int xw_expose(XWdev *xw, XEvent *event) -#else -static int xw_expose(xw, event) - XWdev *xw; XEvent *event; -#endif -{ -/* - * Device error? - */ - if(xw->bad_device) - return 1; - if(event->type == Expose && xw->pixmap != None) { - XCopyArea(xw->display, xw->pixmap, xw->window, xw->gc, - event->xexpose.x, event->xexpose.y, - (unsigned) event->xexpose.width, (unsigned) event->xexpose.height, - event->xexpose.x, event->xexpose.y); - if(xw->bad_device) - return 1; - XFlush(xw->display); - if(xw->bad_device) - return 1; - }; - return 0; -} - -/*....................................................................... - * Set up for a band cursor and return its descriptor. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * mode int 0 - No band cursor. - * 1 - Line between reference position and cursor. - * 2 - Rectangle drawn with opposite corners at reference - * and cursor position. - * ref XPoint * The reference position. - * Output: - * return Band * A pointer to a static internal container of cursor - * resources. Call xw_del_Band() to release these resources - * and return the event mask to normal. - */ -#ifdef __STDC__ -static Band *xw_new_Band(XWdev *xw, int mode, XPoint *ref) -#else -static Band *xw_new_Band(xw, mode, ref) - XWdev *xw; int mode; XPoint *ref; -#endif -{ - static Band band; /* Return container */ - long event_mask=0; /* Bit map of events to be caught */ -/* - * Device error? - */ - if(xw->bad_device) - return NULL; -/* - * Initialize values at least to the point at which xw_del_Band() can - * safely be called. - */ - band.line_width = xw->gcv.line_width; - band.mode = mode; - band.ref = *ref; - band.end = *ref; -/* - * All cursor types require us to catch the following events. - */ - event_mask = ExposureMask | KeyPressMask | ButtonPressMask | - EnterWindowMask | LeaveWindowMask; -/* - * Set up for a band cursor? - */ - if(band.mode > 0 || xw->crosshair) { /* M.Z. */ -/* - * Arrange for the band cursor to be drawn with a line width of 0. - */ - if(band.line_width != 0) { - XGCValues attr; - band.line_width = attr.line_width = 0; - XChangeGC(xw->display, xw->gc, (unsigned long) GCLineWidth, &attr); - if(xw->bad_device) - return NULL; - }; -/* - * Select for cursor motion events along with the normal events. - */ - event_mask |= PointerMotionMask; - }; -/* - * Register the additional event types that are now to be caught. - */ - if(xw_add_events(xw, event_mask)) - return NULL; - return &band; -} - -/*....................................................................... - * Release band cursor resources and return the window event mask to - * its normal state. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * bc Band * The band-cursor descriptor. - * Output: - * return Band * Always NULL. - */ -#ifdef __STDC__ -static Band *xw_del_Band(XWdev *xw, Band *bc) -#else -static Band *xw_del_Band(xw, bc) - XWdev *xw; Band *bc; -#endif -{ -/* - * Prevent the event buffer from overflowing by removing superflous events - * from the set of those to be caught. - */ - xw_rem_events(xw, (long) (ExposureMask | KeyPressMask | ButtonPressMask | - EnterWindowMask | LeaveWindowMask | - PointerMotionMask)); -/* - * If the line width was changed for rubber banding, re-instate the - * original line width. - */ - if(bc->line_width != xw->gcv.line_width) - XChangeGC(xw->display, xw->gc, (unsigned long) GCLineWidth, &xw->gcv); - return NULL; -} - -/*....................................................................... - * Trim a coordinate to lie within the current pixmap and window area. - * This prevents the cursor being displayed or returned for a position - * outside the currently visible window and pixmap areas. - * - * Input: - * xp XPoint * The point to be limited. - * Output: - * return int 0 - OK. - * 1 - Error. - */ -#ifdef __STDC__ -static int xw_bound_cursor(XWdev *xw, XPoint *xp) -#else -static int xw_bound_cursor(xw, xp) - XWdev *xw; XPoint *xp; -#endif -{ - XWindowAttributes attr; /* Current window attributes */ - int xmax, ymax; /* Max usable X and Y coordinates */ -/* - * Device error? - */ - if(xw->bad_device) - return 1; -/* - * Get the current window dimensions. - */ - XGetWindowAttributes(xw->display, xw->window, &attr); - if(xw->bad_device) - return 1; -/* - * With NorthWest pixmap gravity, coordinates 0,0 are always visible at the - * top left corner of the plot. - */ - if(xp->x < 0) - xp->x = 0; - if(xp->y < 0) - xp->y = 0; -/* - * Determine the max X and Y coordinates that fall both within the pixmap and - * the window. - */ - xmax = ((xw->geom.width < attr.width) ? xw->geom.width : attr.width) - 1; - ymax = ((xw->geom.height < attr.height) ? xw->geom.height : attr.height) - 1; -/* - * Limit the coordinates to the above range. - */ - if(xp->x > xmax) - xp->x = xmax; - if(xp->y > ymax) - xp->y = ymax; - return 0; -} - -/*....................................................................... - * Draw the current cursor. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * bc Band * A cursor descriptor returned by xw_new_band(). - * end XPoint * The current cursor position. - * Output: - * return int 0 - OK. - * 1 - Error. - */ -#ifdef __STDC__ -static int xw_draw_cursor(XWdev *xw, Band *bc, XPoint *end) -#else -static int xw_draw_cursor(xw, bc, end) - XWdev *xw; Band *bc; XPoint *end; -#endif -{ -/* - * Device error? - */ - if(xw->bad_device) - return 1; -/* - * Store the new end point. - */ - bc->end = *end; -/* - * Draw the cursor. - */ - switch(bc->mode) { - case 0: default: - if(xw->gc!=NULL && xw->crosshair) { - XDrawLine(xw->display, xw->window, xw->gc, 0, bc->end.y, - (int)xw->geom.width-1, bc->end.y); - if(xw->bad_device) - return 1; - XDrawLine(xw->display, xw->window, xw->gc, bc->end.x, 0, - bc->end.x, (int)xw->geom.height-1); - }; - break; - case 1: - XDrawLine(xw->display, xw->window, xw->gc, bc->ref.x, bc->ref.y, - bc->end.x, bc->end.y); - break; - case 2: /* Draw a rectangle */ - { - int x = bc->ref.x < bc->end.x ? bc->ref.x : bc->end.x; - int y = bc->ref.y < bc->end.y ? bc->ref.y : bc->end.y; - unsigned int width = (unsigned int) abs(bc->ref.x - bc->end.x); - unsigned int height = (unsigned int) abs(bc->ref.y - bc->end.y); - XDrawRectangle(xw->display, xw->window, xw->gc, x, y, width, height); - }; - break; - case 3: /* Two horizontal lines */ - XDrawLine(xw->display, xw->window, xw->gc, 0, bc->end.y, - (int)xw->geom.width-1, bc->end.y); - if(xw->bad_device) - return 1; - XDrawLine(xw->display, xw->window, xw->gc, 0, bc->ref.y, - (int)xw->geom.width-1, bc->ref.y); - break; - case 4: /* Two vertical lines */ - XDrawLine(xw->display, xw->window, xw->gc, bc->end.x, 0, - bc->end.x, (int)xw->geom.height-1); - if(xw->bad_device) - return 1; - XDrawLine(xw->display, xw->window, xw->gc, bc->ref.x, 0, - bc->ref.x, (int)xw->geom.height-1); - break; - case 5: /* One horizontal line through the cursor */ - XDrawLine(xw->display, xw->window, xw->gc, 0, bc->end.y, - (int)xw->geom.width-1, bc->end.y); - break; - case 6: /* One vertical line through the cursor */ - XDrawLine(xw->display, xw->window, xw->gc, bc->end.x, 0, - bc->end.x, (int)xw->geom.height-1); - break; - case 7: /* Cross hair */ - XDrawLine(xw->display, xw->window, xw->gc, 0, bc->end.y, - (int)xw->geom.width-1, bc->end.y); - if(xw->bad_device) - return 1; - XDrawLine(xw->display, xw->window, xw->gc, bc->end.x, 0, - bc->end.x, (int)xw->geom.height-1); - break; - }; - if(xw->bad_device) - return 1; - XFlush(xw->display); - if(xw->bad_device) - return 1; - return 0; -} - -/*....................................................................... - * Erase a previously drawn cursor. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * bc Band * A cursor descriptor returned by xw_new_band(). - * Output: - * return int 0 - OK. - * 1 - Error. - */ -#ifdef __STDC__ -static int xw_erase_cursor(XWdev *xw, Band *bc) -#else -static int xw_erase_cursor(xw, bc) - XWdev *xw; Band *bc; -#endif -{ -/* - * Device error? - */ - if(xw->bad_device) - return 1; -/* - * Erase the cursor. - */ - switch(bc->mode) { - case 0: default: - if(xw->crosshair) { - if(xw_cursor_line(xw, 0, bc->end.y, (int)xw->geom.width-1,bc->end.y) || - xw_cursor_line(xw, bc->end.x, 0, bc->end.x, (int)xw->geom.height-1)) - return 1; - }; - break; - case 1: /* Line cursor */ - if(xw_cursor_line(xw, bc->ref.x, bc->ref.y, bc->end.x, bc->end.y)) - return 1; - break; - case 2: /* Rectangle cursor */ - if(xw_cursor_line(xw, bc->ref.x, bc->ref.y, bc->ref.x, bc->end.y) || - xw_cursor_line(xw, bc->ref.x, bc->end.y, bc->end.x, bc->end.y) || - xw_cursor_line(xw, bc->end.x, bc->end.y, bc->end.x, bc->ref.y) || - xw_cursor_line(xw, bc->end.x, bc->ref.y, bc->ref.x, bc->ref.y)) - return 1; - break; - case 3: /* Two horizontal lines */ - if(xw_cursor_line(xw, 0, bc->end.y, (int)xw->geom.width-1,bc->end.y) || - xw_cursor_line(xw, 0, bc->ref.y, (int)xw->geom.width-1,bc->ref.y)) - return 1; - break; - case 4: /* Two vertical lines */ - if(xw_cursor_line(xw, bc->end.x, 0, bc->end.x, (int)xw->geom.height-1) || - xw_cursor_line(xw, bc->ref.x, 0, bc->ref.x, (int)xw->geom.height-1)) - return 1; - break; - case 5: /* One horizontal line through the cursor */ - if(xw_cursor_line(xw, 0, bc->end.y, (int)xw->geom.width-1,bc->end.y)) - return 1; - break; - case 6: /* One vertical line through the cursor */ - if(xw_cursor_line(xw, bc->end.x, 0, bc->end.x, (int)xw->geom.height-1)) - return 1; - break; - case 7: /* Cross hair */ - if(xw_cursor_line(xw, 0, bc->end.y, (int)xw->geom.width-1,bc->end.y) || - xw_cursor_line(xw, bc->end.x, 0, bc->end.x, (int)xw->geom.height-1)) - return 1; - break; - }; - return 0; -} - -/*....................................................................... - * Restore the pixels under a given line. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * xa, ya int The start pixel of the line. - * xb, yb int The end pixel of the line. - * Output: - * return int 0 - OK. - * 1 - Error. - */ -#ifdef __STDC__ -static int xw_cursor_line(XWdev *xw, int xa, int ya, int xb, int yb) -#else -static int xw_cursor_line(xw, xa, ya, xb, yb) - XWdev *xw; int xa; int ya; int xb; int yb; -#endif -{ - int xlen = xb - xa; /* X-axis displacement of line */ - int ylen = yb - ya; /* Y-axis displacement of line */ - int xmin,xmax; /* Min/max X-axis end points */ - int ymin,ymax; /* Min/max Y-axis end points */ -#define PIXINC 51 -/* - * Device error? - */ - if(xw->bad_device) - return 1; -/* - * Silently ignore the call if a pixmap is not available. - */ - if(xw->pixmap != None) { -/* - * Get sorted versions of xa and xb. - */ - if(xlen > 0) { - xmin = xa; - xmax = xb; - } else { - xmin = xb; - xmax = xa; - }; -/* - * Get sorted versions of ya and yb. - */ - if(ylen > 0) { - ymin = ya; - ymax = yb; - } else { - ymin = yb; - ymax = ya; - }; -/* - * Vertical line? - */ - if(xlen==0) { - XCopyArea(xw->display, xw->pixmap, xw->window, xw->gc, xmin, ymin, - (unsigned) 1, (unsigned) (ymax-ymin+1), xmin, ymin); - } -/* - * Horizontal line? - */ - else if(ylen==0) { - XCopyArea(xw->display, xw->pixmap, xw->window, xw->gc, xmin, ymin, - (unsigned) (xmax-xmin+1), (unsigned) 1, xmin, ymin); - } -/* - * Diagonal line encompasing fewer x-axis lines that y-axis lines? - */ - else if(abs(xlen) <= abs(ylen)) { - int x; /* The X coordinate of the line of pixels being drawn */ - int y1,y2; /* The start and end Y coordinates of the pixel line */ - double yperx = (double) ylen / (double) xlen; - double yhalf = 0.5 * yperx; /* Y-step over half a pixel */ - double ydelt = (PIXINC+0.5) * yperx; /* Y-step over PIXINC+0.5 pixels */ - double ylo = yperx > 0 ? yhalf : -ydelt; - double yhi = yperx > 0 ? ydelt : -yhalf; -/* - * Draw the block of pixels that encompases the line between X-axis - * pixels the outer edges of pixels x -> x+PIXINC, for each consecutive - * block of PIXINC pixels along X. - */ - for(x=xmin; x <= xmax; x += PIXINC+1) { - double ycent = ya + (x - xa) * yperx; - y1 = (int)(ycent - ylo); /* Note round-down semantics */ - y2 = (int)(ycent + yhi+0.5);/* Note round-up semantics */ - XCopyArea(xw->display, xw->pixmap, xw->window, xw->gc, - x, y1, (unsigned) (PIXINC+1), (unsigned) (y2-y1+1), x, y1); - }; -/* - * Diagonal line encompasing fewer y-axis lines that x-axis lines? - */ - } else { - int y; /* The Y coordinate of the line of pixels being drawn */ - int x1,x2; /* The start and end X coordinates of the pixel line */ - double xpery = (double) xlen / (double) ylen; - double xhalf = 0.5 * xpery; /* X-step over half a pixel */ - double xdelt = (PIXINC+0.5) * xpery; /* X-step over PIXINC+0.5 pixels */ - double xlo = xpery > 0 ? xhalf : -xdelt; - double xhi = xpery > 0 ? xdelt : -xhalf; -/* - * Draw the block of pixels that encompases the line between Y-axis - * pixels the outer edges of pixels y -> y+PIXINC, for each consecutive - * block of PIXINC pixels along Y. - */ - for(y=ymin; y <= ymax; y += PIXINC+1) { - double xcent = xa + (y - ya) * xpery; - x1 = (int)(xcent - xlo); /* Note round-down semantics */ - x2 = (int)(xcent + xhi+0.5);/* Note round-up semantics */ - XCopyArea(xw->display, xw->pixmap, xw->window, xw->gc, - x1, y, (unsigned) (x2-x1+1), (unsigned) (PIXINC+1), x1, y); - }; - }; - }; -/* - * Check for device errors. - */ - if(xw->bad_device) - return 1; - return 0; -} - -/*....................................................................... - * Add to the set of events to be caught. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * events long The bit mask of events to be added to those already - * being selected. - * Output: - * return int 0 - OK. - * 1 - Error. - */ -#ifdef __STDC__ -static int xw_add_events(XWdev *xw, long events) -#else -static int xw_add_events(xw, events) - XWdev *xw; long events; -#endif -{ -/* - * Device error? - */ - if(xw->bad_device) - return 1; -/* - * Get the union of the new events with the current event mask. - */ - xw->event.mask |= events; -/* - * Register the modified selection with the server. - */ - XSync(xw->display, False); - if(xw->bad_device) - return 1; - xw->last_error = 0; - XSelectInput(xw->display, xw->window, xw->event.mask); - if(xw->bad_device) - return 1; -/* - * Force the new selections through to the server and check for access - * errors that indicate that ButtonPress's are currently selected by - * another client. - */ - XSync(xw->display, False); - if(xw->bad_device) - return 1; - if(xw->last_error == BadAccess) { -/* - * Only one client can select ButtonPress events. If another client - * already has them selected, then the above XSelectInputs() will have - * generated an error and the event mask will not have been installed. - */ - if(xw->event.mask & ButtonPressMask) { - if(!xw->event.no_buttons) { - fprintf(stderr, - "%s: Failed to acquire pointer buttons - use keys A,D,X.\n", - XW_IDENT); - }; - xw->event.no_buttons = 1; - }; -/* - * Retry, but with the events that could have caused the BadAccess removed. - */ - xw->event.mask &= ~(SubstructureRedirectMask | ResizeRedirectMask | - ButtonPressMask); - XSelectInput(xw->display, xw->window, xw->event.mask); - if(xw->bad_device) - return 1; - XSync(xw->display, False); - if(xw->bad_device) - return 1; - }; -/* - * Have we successfully acquired ButtonPress events? - */ - if(xw->event.mask & ButtonPressMask) - xw->event.no_buttons = 0; - return 0; -} - -/*....................................................................... - * Remove selected events from the set of events to be caught. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * events long The bit mask of events to be removed from the set - * being selected. - * Output: - * return int 0 - OK. - * 1 - Error. - */ -#ifdef __STDC__ -static int xw_rem_events(XWdev *xw, long events) -#else -static int xw_rem_events(xw, events) - XWdev *xw; long events; -#endif -{ -/* - * Device error? - */ - if(xw->bad_device) - return 1; -/* - * Clear the bits in our current event mask that correspond to the events - * to be removed. - */ - xw->event.mask &= ~events; -/* - * Register the modified selection with the server. - */ - XSelectInput(xw->display, xw->window, xw->event.mask); - if(xw->bad_device) - return 1; - XSync(xw->display, False); - if(xw->bad_device) - return 1; - return 0; -} - -/*....................................................................... - * This function is called by X whenever a non-fatal error occurs - * on a given display connection. - * - * Input: - * display Display * The display connection on which the error occured. - * event XErrorEvent * The descriptor of the error event. - * Output: - * return int The return value is not specified by Xlib, so - * we will simply return 0. - */ -#ifdef __STDC__ -static int xw_error(Display *display, XErrorEvent *event) -#else -static int xw_error(display, event) - Display *display; XErrorEvent *event; -#endif -{ - char errtxt[81]; /* Buffer to receive error message in */ - XWdev *xw; -/* - * Find the device that is the source of the error. - */ - for(xw=device_list; xw!=NULL && xw->display!=display; xw = xw->next); -/* - * If a device was located, check if the error implies that server resources - * have become unusable for that device. - */ - if(xw && !xw->bad_device) { - xw->last_error = event->error_code; - switch(event->error_code) { - case BadAtom: case BadColor: case BadCursor: case BadDrawable: - case BadGC: case BadIDChoice: case BadPixmap: case BadWindow: -/* - * Get a message describing the error. - */ - XGetErrorText(display, (int)event->error_code,errtxt,(int)sizeof(errtxt)); - fprintf(stderr, "%s: XErrorEvent: %s\n", XW_IDENT, errtxt); -/* - * Report the operation that caused it. These opcode numbers are listed in - * . - */ - fprintf(stderr, "%s: Major opcode of failed request: %d\n", XW_IDENT, - (int) event->request_code); -/* - * Report the loss of the window and mark the device as unusable. - */ - xw_bad_device(xw); - break; - }; - }; - return 0; -} - -/*....................................................................... - * If a PGPLOT /xw server has not already been started, start one. - * Return the ID of the server communication window. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * Output: - * return Window The XID of the server communication window, or None - * on error. - */ -#ifdef __STDC__ -static Window xw_get_server(XWdev *xw) -#else -static Window xw_get_server(xw) - XWdev *xw; -#endif -{ - int i; -/* - * See if a server has already been started. - */ - xw->server = XGetSelectionOwner(xw->display, xw->server_atom); -/* - * Start a new server if necessary. - */ - if(xw->server == None) { - char *exe=NULL; /* The name of the pgxwin_server executable */ - char *command=NULL; /* The command-line string used to run it */ - char *display_string; /* The display-name string */ - unsigned long slen; /* Length of command line excluding '\0' */ - int waserr = 0; /* Set to true if an error occurs */ -/* - * Describe the format of the command line. - */ -#ifdef VMS - char *format = "%s -display %s"; -#else - char *format = "%s -display %s display); -/* - * Locate the server program. - */ -#ifdef VMS - if((exe=find_exe("PGPLOT_DIR", PGXWIN_SERVER))==NULL) { - fprintf(stderr,"%s: Failed to find \"pgplot_dir:%s.exe\".\n", - XW_IDENT, PGXWIN_SERVER); - return None; - }; -#else - if((exe=find_exe(getenv("PGPLOT_DIR"), PGXWIN_SERVER))==NULL && - (exe=find_exe(getenv("PATH"), PGXWIN_SERVER))==NULL) { - fprintf(stderr, - "%s: Couldn't find program \"%s\" in the directory named\n", - XW_IDENT, PGXWIN_SERVER); - fprintf(stderr, - "%s: in your PGPLOT_DIR environment variable, or in any directory\n", - XW_IDENT); - fprintf(stderr, - "%s: listed in your PATH environment variable.\n",XW_IDENT); - return None; - }; -#endif -/* - * Make it possible to determine which server is being started. - */ - if(getenv("PGPLOT_XW_DEBUG")) - printf("Starting %s.\n", exe); -/* - * Determine the length of the comand-line string required, as defined by: - * sprintf(command, format, PGXWIN_SERVER, display_string) - */ - slen = strlen(format) + strlen(exe) + strlen(display_string); - command = (char *) malloc(sizeof(char) * (slen + 1)); - if(command==NULL) { - fprintf(stderr, "%s: Insufficient memory to run %s.\n", XW_IDENT, exe); - waserr = 1; - } else { -/* - * Compile the command-line string. - */ - sprintf(command, format, exe, display_string); -/* - * Spawn the server. - */ -#ifdef VMS - waserr = vms_spawn_nowait(command); -#else -/* - * Stipulate that the existing socket connection to the server be closed - * on the following exec(). This prevents the child from holding the - * connection open when the parent terminates. - */ - fcntl(ConnectionNumber(xw->display), F_SETFD, 1); -/* - * Run the server. - */ - system(command); -#endif - }; -/* - * Release the malloc'd command line string. - */ - if(command) - free(command); -/* - * Check once per second for up to XW_SERVER_TIMEOUT seconds for the - * server to start. - */ - if(!waserr) { - for(i=0; xw->server==None && iserver = XGetSelectionOwner(xw->display, xw->server_atom); - }; -/* - * Contact with server not acheived? - */ - if(xw->server == None) { - fprintf(stderr, "%s: Timed out waiting for program %s to start\n", - XW_IDENT, exe); - }; - }; -/* - * Discard the string that contained the name of the server executable. - */ - if(exe) - free(exe); - }; - return xw->server; -} - -/*....................................................................... - * Send a ClientMessage query to the server and read its reply. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * Input/Output: - * event XEvent * The input ClientMessage event. - * On input set: - * event.xclient.message_type = Type of message. - * event.xclient.data.l[0..4] = Message data. - * On output: - * event.xclient.data.l[0..4] = Reply data. - * Output: - * return int 0 - OK. - * 1 - Error. - */ -#ifdef __STDC__ -static int xw_query_server(XWdev *xw, XEvent *event) -#else -static int xw_query_server(xw, event) - XWdev *xw; XEvent *event; -#endif -{ -/* - * Device error? - */ - if(xw->bad_device) - return 1; -/* - * Initialize the generic parts of the event descriptor. - */ - event->type = ClientMessage; - event->xclient.window = xw->client; - event->xclient.format = 32; - if(!XSendEvent(xw->display, xw->server, False, (long)0, event) || - xw->bad_device) { - fprintf(stderr, "%s: Error talking to PGPLOT /xw server.\n", XW_IDENT); - return 1; - }; - XFlush(xw->display); - if(xw->bad_device) - return 1; -/* - * Read the server's reply. - */ - do { - if(xw_next_event(xw, event)) - return 1; - } while(event->type != ClientMessage || event->xclient.window != xw->client); -/* - * A returned message type of None denotes an error. - */ - if(event->xclient.message_type == None) - return 1; - return 0; -} - -/*....................................................................... - * Front end to XNextEvent() to get the next event from the X server, - * while checking for DestroyNotify events on the PGPLOT window. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * Input/Output: - * event XEvent * The event structure for the returned event. - * Output: - * return int 0 - OK. - * 1 - The PGPLOT window has been destroyed. - */ -#ifdef __STDC__ -static int xw_next_event(XWdev *xw, XEvent *event) -#else -static int xw_next_event(xw, event) - XWdev *xw; XEvent *event; -#endif -{ -/* - * Check that we still have a window. - */ - if(xw->bad_device) - return 1; -/* - * Wait for the next event. - */ - XNextEvent(xw->display, event); - switch(event->type) { - case DestroyNotify: - if(event->xdestroywindow.window == xw->window) - return xw_bad_device(xw); - }; - return 0; -} - -/*....................................................................... - * like xw_next_event (see above), but with timeout in deciSecs (M.Z.) - */ -#ifdef __STDC__ -static int xw_next_event_tmo(XWdev *xw, XEvent *event, int tmo_10) -#else -static int xw_next_event_tmo(xw, event, tmo_10) - XWdev *xw; XEvent *event; int tmo_10; -#endif -{ - int tim; -/* - * Check that we still have a window. - */ - if(xw->bad_device) - return 1; -/* - * Wait for the next event. - */ - if (tmo_10 > 0) { - tim=tmo_10; - while (tim>0 && !XPending(xw->display)) { -#ifdef VMS - float f=0.1; lib$wait(&f); -#else - usleep(100000); -#endif - tim--; - } - if (!XPending(xw->display)) { - event->type=0; - return 0; - } - } - return xw_next_event(xw, event); -} - -/*....................................................................... - * Front end to XCheckWindowEvent() to check and return for the next event - * that matches the given event_mask, without blocking if no matching event - * is there and while also checking for DestroyNotify events on said window. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * window Window The window on which to watch for events. - * event_mask long The bit mask of event types wanted. - * Input/Output: - * event XEvent * The event structure for the returned event. - * Output: - * return int 0 - No matching event. - * 1 - Got an event that matches the mask. - */ -#ifdef __STDC__ -static int xw_check_window_event(XWdev *xw, Window window, long event_mask, - XEvent *event) -#else -static int xw_check_window_event(xw, window, event_mask, event) - XWdev *xw; Window window; long event_mask; XEvent *event; -#endif -{ - int want_structure = 0; /* True if the caller selects StructureNotifyMask */ -/* - * Check that we still have a window. - */ - if(xw->bad_device) - return 1; -/* - * Did the user also want StructureNotifyMask events? - */ - want_structure = event_mask & StructureNotifyMask; -/* - * We also want DestroyNotify events. - */ - event_mask |= StructureNotifyMask; -/* - * Wait for the next event. - */ - while(XCheckWindowEvent(xw->display, window, event_mask, event)==True) { - switch(event->type) { - case DestroyNotify: - if(window == xw->window) { /* Have we lost the plot window? */ - xw_bad_device(xw); - return want_structure; - } else if(want_structure) { - return 1; - }; - break; - case CirculateNotify: - case ConfigureNotify: - if(want_structure) /* Ignore unselected StructureNotifyMask events */ - return 1; - break; - default: - return 1; /* One of the requested events was found */ - }; - }; - return 0; -} - -/*....................................................................... - * Insert a new PGPLOT /xw device descriptor onto the list of open - * devices. The descriptor is inserted such that the list is maintained - * in order of window number xw->number. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor to be inserted. - * Output: - * return XWdev * The same as the input. - */ -#ifdef __STDC__ -static XWdev *xw_insert_device(XWdev *xw) -#else -static XWdev *xw_insert_device(xw) - XWdev *xw; -#endif -{ - XWdev *prev; /* Pointer to previous device in list */ - XWdev *next; /* Pointer to next device in list */ -/* - * Find the correct position for the device in the device list. - */ - prev = NULL; - next = device_list; - while(next && next->number > xw->number) { - prev = next; - next = next->next; - }; -/* - * Insert the device between 'prev' and 'next'. - */ - xw->next = next; - if(prev==NULL) - device_list = xw; - else - prev->next = xw; - return xw; -} - -/*....................................................................... - * Remove a given PGPLOT /xw device descriptor from the list of open - * devices. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor to be removed. - * Output: - * return XWdev * The removed descriptor. - */ -#ifdef __STDC__ -static XWdev *xw_remove_device(XWdev *xw) -#else -static XWdev *xw_remove_device(xw) - XWdev *xw; -#endif -{ - XWdev *prev; /* Pointer to previous device in list */ - XWdev *next; /* Pointer to next device in list */ -/* - * Find the position of the device in the device list. - */ - prev = NULL; - next = device_list; - while(next && next!=xw) { - prev = next; - next = next->next; - }; -/* - * Relink around the window if it was found. - */ - if(next) { - if(prev==NULL) - device_list = next->next; - else - prev->next = next->next; - }; -/* - * The descriptor is no longer in a list. - */ - xw->next = NULL; - return xw; -} - -/*....................................................................... - * Select a given device by its PGPLOT window number: xw->number. - * - * Input: - * number int The device number to search for. - * Output: - * return XWdev * The descriptor of the located device, or NULL - * on error. - */ -#ifdef __STDC__ -static XWdev *xw_select_device(int number) -#else -static XWdev *xw_select_device(number) - int number; -#endif -{ -/* - * Search for the cited device. - */ - XWdev *xw = device_list; - while(xw && xw->number != number) - xw = xw->next; - if(xw==NULL || xw->number!=number) { - fprintf(stderr, "%s: No such device (%d).\n", XW_IDENT, number); - return NULL; - }; - return xw; -} - -/*....................................................................... - * Wait for data to become available on the xw->client_data property - * and read it into the given buffer, after performing any necessary - * data-type conversions between different sized integers. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * data char * The buffer to return the data in, cast to (char *). - * form int The format for the property. Recognised values and - * the data types used to accept them in data[] are: - * XW_CHAR_PROP - (char) - * XW_SHORT_PROP - (short) - * XW_LONG_PROP - (long) - * n unsigned long The number of items to be returned in data[]. - * Output: - * return unsigned long The number of items read, or 0 on error. - */ -#ifdef __STDC__ -static unsigned long xw_get_data(XWdev *xw, char *data, int form, - unsigned long n) -#else -static unsigned long xw_get_data(xw, data, form, n) - XWdev *xw; char *data; int form; unsigned long n; -#endif -{ - XEvent event; /* Used to check for property-notify events */ - unsigned long ndone; /* The number of items read so far */ - unsigned long nread; /* The number of items read in the latest iteration */ - Atom ret_type; /* Returned data-type */ - int ret_form; /* Returned data-format */ - unsigned long nret; /* Number of elements returned */ - unsigned long nleft; /* Number of bytes unread */ - unsigned char *prop; /* Property value */ - unsigned long size; /* Size of property data element */ -/* - * Device error? - */ - if(xw->bad_device) - return 0; -/* - * The property data returned by XGetWindowProperty is arranged as an array of - * (char) if form=8, (short) if form=16, and (long) if form=32, - * irrespective of the sizes of these types. Get the size of one such - * element in bytes. - */ - switch(form) { - case XW_CHAR_PROP: - size = sizeof(char); - break; - case XW_SHORT_PROP: - size = sizeof(short); - break; - case XW_LONG_PROP: - size = sizeof(long); - break; - default: - fprintf(stderr, "%s: Unkown property format: %d\n", XW_IDENT, form); - xw_bad_device(xw); - return 0; - break; - }; -/* - * The property data may not appear in one go, so it may take a - * few iterations to get all the data. The server signals completion - * by sending a 0-length property. - */ - ndone = nread = 0; - do { -/* - * Wait for the property to be updated. - */ - do { - if(xw_next_event(xw, &event)) - return 0; - } while(!(event.type == PropertyNotify && - event.xproperty.window == xw->client && - event.xproperty.atom == xw->client_data && - event.xproperty.state == PropertyNewValue)); -/* - * Determine the format of the data stored in the property but defer - * reading the data, by asking for 0 items. - */ - if(XGetWindowProperty(xw->display, xw->client, xw->client_data, - (long)0, (long)0, False, AnyPropertyType, &ret_type, - &ret_form, &nret, &nleft, &prop) != Success) { - fprintf(stderr, "%s: Error reading property.\n", XW_IDENT); - xw_bad_device(xw); - return 0; - } else { -/* - * Delete the copied 0-length (+1 byte Xlib added padding) property value. - */ - XFree((char *) prop); -/* - * Make sure that the property has the expected type. - */ - if(ret_form != form) { - fprintf(stderr, "%s: Inconsistent property format.\n", XW_IDENT); - xw_bad_device(xw); - return 0; - }; -/* - * Since XGetWindowProperty requires one to specify the amount to be - * read in multiples of 4 8-bit bytes, round-up 'nleft' to the nearest - * 4-byte multiple >= nleft. - */ - nleft = 4 * ((nleft+3)/4); - if(nleft > 0) { -/* - * Read the property value. - */ - if(XGetWindowProperty(xw->display, xw->client, xw->client_data, (long)0, - (long)nleft/4, False, ret_type, &ret_type, - &ret_form, &nread, &nleft, &prop) != Success) { - fprintf(stderr, "%s: Error reading property.\n", XW_IDENT); - xw_bad_device(xw); - return 0; - } else { -/* - * Accumulate up to n items in the output data array. - */ - if(ndone < n) { - unsigned long ncopy = (ndone+nread<=n) ? nread : (n-ndone); - unsigned long icopy; - for(icopy=0; icopy < ncopy*size; icopy++) - data[ndone*size+icopy] = ((char *)prop)[icopy]; - ndone += ncopy; - }; -/* - * Delete the property data buffer. - */ - XFree((char *)prop); - }; - } else { - nread = 0; /* 0-length property detected. */ - }; -/* - * Delete the property, both to release resources and to signal completion - * to the server. - */ - XDeleteProperty(xw->display, xw->client, xw->client_data); - }; -/* - * The server signals that there is no more data to be read by sending - * a zero-length property. Don't stop reading until this has been - * detected, even if all expected data have been read. - */ - } while(nread>0); -/* - * Nothing read? - */ - if(n!=0 && ndone==0) { - fprintf(stderr, "%s: Failed to read property data.\n", XW_IDENT); - del_XWdev(xw,1); - }; - return ndone; -} - -/*....................................................................... - * After a fatal error has occured, this function should be called to - * mark the specified device as unusable. It emits an error message - * and sets xw->bad_device=1. - * - * Input: - * xw XWdev * The descriptor of the device on which the error - * occurred. - * Output: - * xw->bad_device This flag is set to 1. - * return int Allways 1 (intended as a boolean to say that the - * device is unusable). This can be used as the return - * value for functions that use 1 to denote an error - * return. eg. - * if(error_occurred) - * return xw_bad_device(xw); - */ -#ifdef __STDC__ -static int xw_bad_device(XWdev *xw) -#else -static int xw_bad_device(xw) - XWdev *xw; -#endif -{ -/* - * Only report an error if this is the first time that this function - * has been called on this device. - */ - if(xw && !xw->bad_device) { - fprintf(stderr, "%s: Lost PGPLOT window %d.\n", XW_IDENT, xw->number); - xw->bad_device = 1; - }; - return 1; -} - -/*....................................................................... - * If the cursor is within the plot window, warp it to a given position. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * pos XPoint * The location to warp the pointer to if 'warp' is true - * and the cursor is in the window. - * warp int If true, and the cursor is in the window, warp the - * cursor to position 'pos'. - * Output: - * loc XPoint * The located position of the cursor, if it is in - * the window. - * return int 0 - Cursor not in window - 'loc' is unchanged. - * 1 - Cursor is in window - 'loc' records the position. - */ -#ifdef __STDC__ -static int xw_locate_cursor(XWdev *xw, XPoint *pos, int warp, XPoint *loc) -#else -static int xw_locate_cursor(xw, pos, warp, loc) - XWdev *xw; XPoint *pos; int warp; XPoint *loc; -#endif -{ - XWindowAttributes attr; /* Current window attributes */ - Window p_child; /* The child of /xw (None) containing the pointer */ - int p_win_x, p_win_y; /* The pointer coordinates in xw->window */ - int p_root_x, p_root_y; /* The pointer coordinates in the root window */ - Window p_root_win; /* The root window containing the cursor */ - unsigned int p_mask; /* Bit mask of button states etc.. */ - int inwindow=0; /* True if the cursor is in the window */ -/* - * Device error? - */ - if(xw->bad_device) - return 0; -/* - * Query the current state of the window. - */ - XSync(xw->display, False); - if(xw->bad_device) - return 0; - XGetWindowAttributes(xw->display, xw->window, &attr); - if(xw->bad_device) - return 0; -/* - * Determine the current position of the pointer. - */ - XQueryPointer(xw->display, xw->window, &p_root_win, &p_child, - &p_root_x, &p_root_y, &p_win_x, &p_win_y, &p_mask); - if(xw->bad_device) - return 0; -/* - * Is the cursor within the bounds of the window? - */ - inwindow = ((attr.map_state != IsUnmapped) && - (p_win_x >= 0 && p_win_x < attr.width) && - (p_win_y >= 0 && p_win_y < attr.height)); - if(inwindow) { -/* - * Warp the cursor? - */ - if(warp) { - XWarpPointer(xw->display, None, xw->window, 0, 0, 0, 0, pos->x, pos->y); - if(xw->bad_device) - return 0; - loc->x = pos->x; - loc->y = pos->y; -/* - * Return the current position of the cursor without warping. - */ - } else { - loc->x = p_win_x; - loc->y = p_win_y; - }; - }; - return inwindow; -} - -#ifdef VMS -/*....................................................................... - * Define a given executable as a DCL foreign command. This has to be - * done before the program can be run with command-line arguments. - * - * Input: - * file char * The full file name of the executable. - * command char * The name to give the command that invokes 'file'. - * Output: - * return int 0 - OK. - * 1 - Error. - */ -static int vms_define_command(char *file, char *command) -{ - VMS_string value_dsc; /* Foreign command string */ - VMS_string symbol_dsc; /* Symbol name for foreign command */ - long table = LIB$K_CLI_LOCAL_SYM; /* Table to add symbol to */ - char *value = NULL; /* Dynamically allocated symbol value string */ - int waserr = 0; /* True after error */ -/* - * Compose a VMS symbol value to use to define 'command' as a foreign - * command that takes C-style arguments. - */ - if((value = (char *) malloc(1+strlen(file)+1))==NULL) { - fprintf(stderr, "%s: Insufficient memory to define command for: %s.\n", - XW_IDENT, file); - waserr = 1; - } else { - sprintf(value, "$%s", file); - VMS_STRING(value_dsc, value) - VMS_STRING(symbol_dsc, command) -/* - * Register the symbol value to symbol 'command'. - */ - lib$set_symbol(&symbol_dsc, &value_dsc, &table); - }; -/* - * Release resources. - */ - if(value) - free((char *)value); - return waserr != 0; -} - -/*....................................................................... - * Run a PGPLOT program on a VAX VMS machine in the background, with - * sys$input redirected from NL: so that the child process does not - * get sent its parent's signals. - * Unfortunately system() can't be used. For some unknown reason - * system("spawn/nowait/sys$input=nl: command_line") - * doesn't appear to do anything. It doesn't even produce an error - * message to say why. If the nowait qualifier is removed it works fine, - * but that is not what is wanted. - * - * Input: - * command char * The command line. - * Output: - * return int 0 - No error detected. - * 1 - Definate error detected. - */ -static int vms_spawn_nowait(char *command) -{ - VMS_string comm_dsc; /* VMS string descriptor for 'command'. */ - VMS_string sysinp; /* VMS string descriptor of SYS$INPUT string */ - long flags = CLI$M_NOKEYPAD | CLI$M_NOWAIT; -/* - * Construct VMS descriptors of C strings. - */ - VMS_STRING(comm_dsc, command) - VMS_STRING(sysinp, "NL:") - if(lib$spawn(&comm_dsc,&sysinp,0,&flags,0,0,0,0,0,0,0) != SS$_NORMAL) { - fprintf(stderr, "%s: Unable to execute command line: %s\n", XW_IDENT, - command); - return 1; - }; - return 0; -} -#endif - -/*....................................................................... - * Locate an executable by searching for it in a list of directories. - * The list of directories is a string containing directory paths - * separated by ':'s (',' under VMS). If the first or last character - * in the path is one of these terminators, or if two of these terminators - * are adjacent in the path, then the current directory is included in - * the search. Each directory in the path is searched in order and the - * first match is returned. - * - * Note that these semantics are identical to the UNIX Bourne-shell - * treatment of the PATH environment variable. - * - * In order that getenv() can be used directly as an argument to this - * function without invoking error messages when getenv() returns - * NULL, either or both of the 'path' and 'program' arguments can be - * NULL. In this case find_exe() quietly returns NULL as though it had - * searched for the executable and failed to find it. - * - * Input: - * program char * The name of the program to be located. - * In the case of this being NULL, find_exe() will - * quietly abort and return NULL. This allows one - * to use getenv() without worrying about the NULL - * return case. - * path char * A colon-separated (comma-separated under VMS), - * '\0' terminated list of directory paths to search - * for the program in. - * Output: - * return char * The full name of the executable, or NULL if not - * found. The returned pointer is malloc()d - * memory and should be free()d by the caller when - * no longer required. - */ -#ifdef __STDC__ -static char *find_exe(char *path, char *program) -#else -static char *find_exe(path, program) - char *path; char *program; -#endif -{ - char *dir; /* Pointer to start of directory in 'path' */ - char *buf=NULL; /* A buffer used to compile file names in */ - int buflen=0; /* The size of the dynamic buffer in char's */ - int prog_len; /* Length of program name */ - int dirlen; /* Length of directory name pointed to by 'dir' */ - int path_len; /* Length of latest path name */ -#ifdef VMS - char *exe = ".exe";/* VMS executable extension */ - char *sep = ""; /* VMS directory/file separator (overriden below) */ - int term = ','; /* Directory separator in path (in addition to '\0') */ -#else - char *exe = ""; /* UNIX doesn't add extensions */ - char *sep = "/"; /* UNIX directory/file separator */ - int term = ':'; /* Directory separator in path (in addition to '\0') */ -#endif -/* - * No path or executable? - */ - if(path==NULL || program==NULL) - return NULL; -/* - * Allocate memory for the filename buffer. - */ - buflen = strlen(program) + 40; - buf = (char *) malloc(sizeof(char) * (buflen+1)); - if(buf==NULL) { - fprintf(stderr, "%s: Insufficient memory to locate program: %s\n", - XW_IDENT, program); - return buf; - }; -/* - * Determine the length of the program name. - */ - prog_len = strlen(program); -/* - * Seek the program in each 'term' separated path name. - */ - do { -/* - * Maintain a pointer to the start of the directory path. - */ - dir = path; -/* - * Find the directory terminator. - */ - while(*path && *path != term) - path++; -/* - * Record the path length. - */ - dirlen = path - dir; -/* - * Skip the trailing terminator unless at the end of the path. - */ - if(*path) - path++; -/* - * Under VMS a separator is not required if the directory is given - * explicitly rather than with logical variables. - */ -#ifdef VMS - sep = dirlen>0 && dir[dirlen-1]==']' ? "" : ":"; -#endif -/* - * Combine the directory and command file name into a full program - * name. - */ - path_len = dirlen + strlen(sep) + prog_len + strlen(exe) ; - if(path_len > buflen) { - char *new_buf = realloc(buf, (path_len+1) * sizeof(char)); - if(new_buf==NULL) { - fprintf(stderr, "%s: Insufficient memory to locate program: %s\n", - XW_IDENT, program); - free(buf); - return buf; - }; - buf = new_buf; - }; - sprintf(buf, "%.*s%s%s%s", dirlen, dir, dirlen==0 ? "":sep, program, exe); -/* - * See if the executable file exists. - */ -#ifndef X_OK -#define X_OK 1 -#endif -#ifndef R_OK -#define R_OK 4 -#endif -#ifdef VMS - if(access(buf, X_OK)==0 || access(buf, R_OK)==0) { - if(vms_define_command(buf, program)) /* Define a foreign VMS command */ - break; - strcpy(buf, program); - return buf; - }; -#else - if(access(buf, X_OK)==0) - return buf; -#endif - } while(*path); -/* - * Executable file not found. - */ - free(buf); - return NULL; -} - -/*....................................................................... - * Return a dynamically allocated visual info structure for a given - * visual. This is simply a more convenient interface to XGetVisualInfo() - * and XVisualIDFromVisual(). - * - * Input: - * display Display * The display connection to which the visual - * belongs. - * screen int The screen to which the visual belongs. - * visual Visual * The visual for which information is required. - * Output: - * return XVisualInfo * The required information descriptor, or NULL - * on error. - */ -#ifdef __STDC__ -static XVisualInfo *xw_visual_info(Display *display, int screen, Visual *visual) -#else -static XVisualInfo *xw_visual_info(display, screen, visual) - Display *display; int screen; Visual *visual; -#endif -{ - XVisualInfo *vi=NULL; /* The return descriptor */ - XVisualInfo template; /* The search template */ - int nret = 0; /* The number of descriptors returned */ -/* - * Using the visual ID and the screen should unambiguously select the - * information for the specified visual. - */ - template.visualid = XVisualIDFromVisual(visual); - template.screen = screen; - vi = XGetVisualInfo(display, (long)(VisualIDMask | VisualScreenMask), - &template, &nret); - if(vi == NULL || nret < 1) { - fprintf(stderr, - "%s: Error getting visual information for visual ID 0x%lx, screen %d.\n", - XW_IDENT, (unsigned long)template.visualid, screen); - vi = NULL; - }; - return vi; -} - -/*....................................................................... - * Allocate the contents of xw->image. This contains buffers used to - * construct and dispatch line-of-pixel images to the display. - * - * Note that xw_get_visual() must have been called before this function. - * - * Input: - * xw XWdev * The PGPLOT /xw device descriptor. - * npix int The length of the buffer in pixels. - * Output: - * return int 0 - OK. - * 1 - Error. - */ -#ifdef __STDC__ -static int xw_get_image(XWdev *xw, int npix) -#else -static int xw_get_image(xw, npix) - XWdev *xw; int npix; -#endif -{ -/* - * Create the X image that we use to compose lines of pixels with given - * colors. - */ - xw->image.xi = XCreateImage(xw->display, xw->color.vi->visual, - (unsigned)xw->color.vi->depth, ZPixmap, 0, - NULL, (unsigned)npix, 1, 32, 0); - if(xw->image.xi==NULL) { - fprintf(stderr, "%s: Failed to allocate XImage container.\n", XW_IDENT); - return 1; - }; -/* - * Allocate the image buffer. - */ - xw->image.xi->data = malloc((size_t) xw->image.xi->bytes_per_line); - if(!xw->image.xi->data) { - fprintf(stderr, "%s: Failed to allocate image buffer.\n", XW_IDENT); - return 1; - }; - return 0; -} - -/*....................................................................... - * Limit pixmap coordinates to lie within the pixmap area. - * - * Input: - * xw XWdev * The PGPLOT window context. - * Input/Output: - * coord XPoint * The coordinates to be modified. - */ -#ifdef __STDC__ -static void xw_limit_pcoords(XWdev *xw, XPoint *coord) -#else -static void xw_limit_pcoords(xw, coord) - XWdev *xw; XPoint *coord; -#endif -{ - if(xw->pixmap != None) { - if(coord->x >= xw->geom.width) - coord->x = xw->geom.width - 1; - if(coord->y >= xw->geom.height) - coord->y = xw->geom.height - 1; - if(coord->x < 0) - coord->x = 0; - if(coord->y < 0) - coord->y = 0; - }; - return; -} - -/*....................................................................... - * Return the nearest integer to a given floating point number. - * - * Input: - * f float The floating point number to be rounded. - * Output: - * return int The nearest integer to f. - */ -#ifdef __STDC__ -static int xw_nint(float f) -#else -static int xw_nint(f) - float f; -#endif -{ - return (int) (f >= 0.0 ? (f + 0.5) : (f - 0.5)); -} - -/*....................................................................... - * Scroll a rectanglular area vertically and/or horizontally. - * - * Input: - * xw XWdev * The PGPLOT window context. - * rbuf float * The array of float arguments sent by the PGPLOT - * GREXEC() subroutine. - */ -#ifdef __STDC__ -static void xw_scroll_rect(XWdev *xw, float *rbuf) -#else -static void xw_scroll_rect(xw, rbuf) - XWdev *xw; float *rbuf; -#endif -{ - if(!xw->bad_device && xw->pixmap != None) { - XPoint blc, trc; /* The bottom left and top right rectangle corners */ - XPoint blc_orig, trc_orig; /* The vertices of the rectangle to be copied */ - XPoint blc_dest, trc_dest; /* The vertices of the destination of the copy */ - int dx, dy; /* The amounts to scroll right and down */ - unsigned long fg; /* The foreground color to be reinstated */ -/* - * Convert the rectangle vertices from PGPLOT coordinates to X coordinates. - */ - xw_xy_to_XPoint(xw, &rbuf[0], &blc); - xw_xy_to_XPoint(xw, &rbuf[2], &trc); -/* - * Get the scroll offsets in X coordinates. - */ - dx = xw_nint(rbuf[4]); - dy = xw_nint(-rbuf[5]); -/* - * Selected parts of the pixmap will need to be erased by drawing an - * opaque rectangle over them in the background color. Set the foreground - * color to equal the background. Keep a record of the previous foreground - * color, so that it can be re-instated. - */ - fg = xw->gcv.foreground; - XSetForeground(xw->display, xw->gc, xw->color.pixel[0]); -/* - * If either scroll extent exceeds the length of the associated - * axis, then fill the area with the background color. - */ - if(abs(dx) > trc.x - blc.x || abs(dy) > blc.y - trc.y) { - XFillRectangle(xw->display, xw->pixmap, xw->gc, blc.x, trc.y, - (unsigned)(trc.x-blc.x+1), (unsigned)(blc.y-trc.y+1)); -/* - * Scroll within the rectangle by copying the area that is to be preserved - * to a new location shifted appropriately in X and/or Y. Then clear the - * vacated areas. - */ - } else { -/* - * Calculate the vertices of the source and destination rectangles to - * be copied. - */ - blc_orig = blc_dest = blc; - trc_orig = trc_dest = trc; - if(dx > 0) { - trc_orig.x = trc.x - dx; - blc_dest.x = blc.x + dx; - } else if(dx < 0) { - blc_orig.x = blc.x - dx; - trc_dest.x = trc.x + dx; - }; - if(dy > 0) { - blc_orig.y = blc.y - dy; - trc_dest.y = trc.y + dy; - } else if(dy < 0) { - trc_orig.y = trc.y - dy; - blc_dest.y = blc.y + dy; - }; -/* - * Constrain the coordinates to lie within the pixmap. - */ - xw_limit_pcoords(xw, &blc_orig); - xw_limit_pcoords(xw, &blc_dest); - xw_limit_pcoords(xw, &trc_orig); - xw_limit_pcoords(xw, &trc_dest); -/* - * Scroll the rectangle to its shifted location. - */ - XCopyArea(xw->display, xw->pixmap, xw->pixmap, xw->gc, - blc_orig.x, trc_orig.y, - trc_orig.x - blc_orig.x + 1, - blc_orig.y - trc_orig.y + 1, - blc_dest.x, trc_dest.y); -/* - * Clear the vacated area to the left or right of the copied area. - */ - if(dx > 0) { - XFillRectangle(xw->display, xw->pixmap, xw->gc, - blc.x, trc.y, - (unsigned) dx, - (unsigned) (blc.y - trc.y + 1)); - } else if(dx < 0) { - XFillRectangle(xw->display, xw->pixmap, xw->gc, - trc_dest.x, trc.y, - (unsigned) (-dx), - (unsigned) (blc.y - trc.y + 1)); - }; -/* - * Clear the vacated area above or below the copied area. - */ - if(dy > 0) { - XFillRectangle(xw->display, xw->pixmap, xw->gc, - blc.x, trc.y, - (unsigned) (trc.x - blc.x + 1), - (unsigned) dy); - } else if(dy < 0) { - XFillRectangle(xw->display, xw->pixmap, xw->gc, - blc.x, blc_dest.y, - (unsigned) (trc.x - blc.x + 1), - (unsigned) (-dy)); - }; - }; -/* - * Record the extent of the modified part of the pixmap. - */ - xw_mark_modified(xw, blc.x, blc.y, 1); - xw_mark_modified(xw, trc.x, trc.y, 1); -/* - * Re-instate the original foreground color. - */ - XSetForeground(xw->display, xw->gc, fg); - }; - return; -} diff --git a/tecs/rstart.c b/tecs/rstart.c deleted file mode 100644 index 956696b..0000000 --- a/tecs/rstart.c +++ /dev/null @@ -1,83 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include "myc_str.h" -#include "instr_hosts.h" - -int rexec(char **host, int port, char *user, char *passwd, char *command, int *err_file_desc); - -char *secure_arg(char *cmd, int size, char *arg) { - int i; -/* make sure that argument is a harmless identifier and no hacker code */ - for (i=0; i -#include -#include -#include -#include -#include -#include -#include -#include -#include "term.h" -#include "coc_util.h" -#include "myc_err.h" -#include "myc_str.h" -#include "instr_hosts.h" - -typedef enum { NORMAL, SPY, CLIENT, NMODE } Mode; - -#define MAXMSG 8192 - -static char *clcname="six", *servername="sics"; -static int clclen=3; -static char host[128]; -static char instr[32]; -static int sock[2]; /* main socket and spy socket */ -static int level=0; /* undefined level */ -static int deflevel=0; -static int remember=1; -static int hidecom=1; -static char user1[32]=""; -static char pswd1[32]=""; -static char user2[32]=""; -static char pswd2[32]=""; -static char status[MAXMSG]="Busy"; -static int busy[2]; -static int port; -static char msg0[MAXMSG]; -static char msg1[MAXMSG]; /* contains messages for main and spy */ -static int pos0 = 0; -static int pos1 = 0; -static char *prefix[NMODE+1]={"", "| ", "# ", ""}; -static int newline[NMODE+1]={1,1,1,1}; -static char *sim=""; - -static char *pw=NULL; -static char *us=""; - -void Put(Mode mode, char *text) { - char chr; - - while (*text) { - if (newline[mode]) { - fputs("\033[0m", stdout); - fputs(prefix[mode], stdout); - newline[mode] = 0; - if (strncmp(text, "ERROR:", 6) == 0) { - fputs("\033[31;1m", stdout); - } - } - chr = *text; text++; - fputc(chr, stdout); - if (chr == '\r' || chr == '\n') { - newline[mode] = 1; - } - } - fflush(stdout); -} - -void PutC(char *text) { - Put(CLIENT, text); -} - -void PutClear(void) { - Put(NMODE, ""); -} - -void UsageNote(void) { - PutC(" (for usage type: "); - PutC(clcname); - PutC(" help)\n"); -} - -void Usage(int cmds_only) { - if (!cmds_only) { - PutC(" \n "); - PutC(clcname); - PutC( - " commandline options:\n" - " -x login as spy\n" - " -u login as user\n" - " -m login as manager\n" - " help show this help text\n" - " -a or a ask always for username/password, forget passwords\n" - " -c or c use background color instead of # and |\n" - " -s or s simulation mode (on some instruments)\n" - " connect to the server for instr\n" - " -h connect to a server on a different host\n" - " -p connect to a server on a different port\n" - " -n do only a minimal login (no check of instrument)\n" - " no option login with default privilege\n" - ); - } - PutC( - "\n" - " Special commands treated by "); - PutC(clcname); PutC(" (these are no "); PutC(servername); PutC(" commands!)\n" - "\n" - " quit return to unix prompt\n" - " exit return to unix prompt\n" - " stop interrupt driving\n" - " "); PutC(clcname); - PutC(" help show this help text\n" - " "); PutC(clcname); - PutC(" def stop define a key for stop command\n" - " "); PutC(clcname); - PutC(" save save stop key and connection (host/port/access)\n" - " + increase privilege\n" - " - decrease privilege\n" - "\n" - " The "); PutC(servername); - PutC(" status is shown, if it is not 'Eager to execute commands'.\n" - " A shown status does not prohibit to enter commands.\n" - "\n" - " When "); PutC(servername); - PutC(" is busy, a vertical bar '|' is shown at the left of the line.\n" - " You may then enter more commands, but only under Spy privilege.\n" - " All messages from the client are prefixed with a hash symbol '#'.\n" - "\n" - " Markus Zolliker, Aug. 2005\n" - "\n" - ); - Put(-1, ""); /* clear colors */ -} - -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; -} - -char* readWrite(int tmo, int skip, char *find) { - int lbuf, go, n, shortTmo, l, socket; - Mode idx; - char *msg, *p, *q; - char chr; - static char result[MAXMSG]; - int hide; - static int laststat=0, laststatlen=0; -/* - * read from registered sockets and write to stdout until a key pressed, - * a timeout occurred (tmo [msec]), or a TRANSACTIONFINISHED message - * received. Handle also status and TRANSACTIONSTART messages. - * - * skip=0: skip response that does not match - * skip=1: skip all responses - * skip=2: skip all responses, quit on match - * - * if the response starts with the contents of find - * the second part of the line is returned - * if the response contain the contents of find, but not at the beginning - * "1" is returned - * if the text is not found, or find=NULL, an empty line is returned - */ - n=0; - go=0; - shortTmo = 0; - str_copy(result, ""); - socket=term_wait_socket(0, tmo); - while (socket > 0) { - idx = (socket == sock[1]); - ERR_SI(lbuf=recv(socket, &chr, 1, 0)); - if (lbuf==0) return "0"; - while (lbuf>0) { - if (chr == '\n') break; - if (idx) { - if (chr != '\r' && pos1 < MAXMSG-1) { /* cut lines longer than MAXMSG */ - msg1[pos1]=chr; - pos1++; - } - } else { - if (chr != '\r' && pos0 < MAXMSG-1) { /* cut lines longer than MAXMSG */ - msg0[pos0]=chr; - pos0++; - } - } - socket=term_wait_socket(0, tmo); - if (socket <= 0) break; - idx = (socket == sock[1]); - ERR_SI(lbuf=recv(socket, &chr, 1, 0)); - } - hide=0; - if (idx) { /* spy mode */ - msg1[pos1] = '\0'; - pos1 = 0; - msg = msg1; - if (!busy[1]) { /* skip spy messages if not busy (they will be doubled) */ - hide = 1; - } - } else { - msg0[pos0] = '\0'; - pos0 = 0; - msg = msg0; - } -/* printf("[%s]\n", msg); */ - if (strncmp(msg, "TRANSACTIONSTART", 16) == 0) { - busy[idx] = 1; - hide = 1; - } else if (strncmp(msg, "TRANSACTIONFINISHED", 19) == 0) { - busy[idx] = 0; - if (skip != 2) go = 1; - shortTmo = 1; - hide = 1; - } else if (idx == 0 && strncmp(msg, "status = ", 9) == 0) { - strcpy(status, msg+9); - l = strlen(msg); - if (status[0] == 'E') { - } else if (laststat!=status[0] || laststatlen != l) { - laststat = status[0]; - laststatlen = l; - } - hide = 1; - } - if (idx == 0 && find != NULL) { - p=strstr(msg, find); - - if (p!=NULL) { /* copy message to result */ - if (p==msg) { - str_copy(result, msg+strlen(find)); - q=strchr(result,'\r'); - if (q != NULL) *q='\0'; - } else { - str_copy(result, "1"); - } - hide=1; - if (skip == 2) go = 1; - } - } - if (hidecom && (skip || hide)) { /* skip text */ - n+=strlen(msg); - } else { - term_clear(); - Put(idx, msg); - if (chr == '\n') { - Put(idx, "\033[K\n"); - } - } - if (go) break; - socket = term_wait_socket(0, shortTmo?100:tmo); - shortTmo = 0; - } - fflush(stdout); - if (result==NULL) laststat=0; - return result; - OnError: return NULL; -} - -void PrintCmd(char *buf, int mode) { - Put(mode, "\r\033[K\n"); - Put(mode, "\033[1;34m>> "); - Put(mode, buf); - Put(mode, "\033[K\033[0m\n"); -} - -int sendCmd(int socket, char *cmd) { - int l; - char buf[256]; - - snprintf(buf, sizeof buf, "fulltransact %s\n", cmd); - ERR_SI(l=send(socket, buf, strlen(buf), 0)); - return l; - OnError: return -1; -} - -int scramble(char *buf) { - int i, n, cnt, chr; - int x; -/* Scrambles a string. Twice scramble gives original. - It does never convert a plain char to a ctrl char - and all standard ascii-codes to special chars and vice versa. - returns the number of special chars on output -*/ - - n=strlen(buf); - x=23; - cnt=0; - for (i=0; i 0) scramble(buf); -} - -void putscrambled(char *buf, FILE *fil) { - char cvt[256]; - str_copy(cvt, buf); - scramble(cvt); - fprintf(fil, "%s\n", cvt); -} - -int setrights(int gotolevel) { - char *p; - char prefhead[128], buf[128]; - FILE *fil; - int ask; - static char user[32]=""; - static char pswd[32]=""; - int savepw; - - if (pw == NULL) pw=pswd; - str_copy(prefhead, clcname); - str_append(prefhead, "."); - str_append(prefhead, instr); - - if (remember) { - fil=term_open_pref(0, prefhead, "r"); - if (fil != NULL) { - term_fgets(buf, sizeof(buf), fil); - getscrambled(user1, sizeof(user1), fil); - getscrambled(pswd1, sizeof(pswd1), fil); - getscrambled(user2, sizeof(user2), fil); - getscrambled(pswd2, sizeof(pswd2), fil); - fclose(fil); - } - if (deflevel==0) { - deflevel=buf[0]-'0'; - if (deflevel<1 || deflevel>3) deflevel=2; - } - } else { - deflevel=2; - } - if (gotolevel == 0) gotolevel = deflevel; - if (deflevel == 0) deflevel = 3; - if (level != gotolevel) { - if (gotolevel==1) { - if (user1[0]=='\0') { - if (strcmp(clcname, "six") == 0) { - str_copy(user1, "lnsmanager"); - } else { - str_copy(user2, servername); - str_append(user2, "manager"); - } - } - us=user1; - pw=pswd1; - } else if (gotolevel==2) { - if (user2[0]=='\0') { - if (strcmp(clcname, "six") == 0) { - str_copy(user2, instr); - str_lowcase(user2, user2); - str_append(user2, "user"); - } else { - str_copy(user2, servername); - str_append(user2, "user"); - } - } - us=user2; - pw=pswd2; - } else if (gotolevel==3) { - us="Spy"; - pw="007"; - } - ask=1; - savepw = 1; - if (us[0]!='\0' && pw[0]!='\0' && remember) { - sprintf(buf, "config rights %s %s", us, pw); - ERR_I(sendCmd(sock[0], buf)); - ERR_P(p=readWrite(12000,0,"Acknowledged")); - PutC("."); - if (*p=='\0') { - if (0==strcmp(us, user1)) { - user1[0]='\0'; - pswd1[0]='\0'; - } - if (0==strcmp(us, user2)) { - user2[0]='\0'; - pswd2[0]='\0'; - } - } else { - ask=0; - savepw = 0; - } - } - if (ask) { - PutC("\r"); - PutC(servername); - PutC(" username"); - if (us[0]!='\0') { - PutC(" ["); - PutC(us); - PutC("]"); - } - PutC(": "); - term_fgets(user, sizeof(user), stdin); - newline[CLIENT]=1; - if (0==strcmp(user, "quit")) return 1; - if (0==strcmp(user, "exit")) return 1; - if (user[0]=='\0') { - str_copy(user, us); - } - PutC("password: "); - term_fgets(pswd, sizeof(pswd), stdin); - newline[CLIENT]=1; - if (0==strcmp(pswd, "quit")) return 1; - if (0==strcmp(pswd, "exit")) return 1; - if (pswd[0]!='\0') { - sprintf(buf, "config rights %s %s", user, pswd); - ERR_I(sendCmd(sock[0], buf)); - ERR_P(p=readWrite(12000,0,"Acknowledged")); - if (*p=='\0') { /* no success */ - gotolevel=3; - if (0==strcmp(user, user1)) { - user1[0]='\0'; - pswd1[0]='\0'; - } - if (0==strcmp(user, user2)) { - user2[0]='\0'; - pswd2[0]='\0'; - } - pw=NULL; - } else { /* success */ - if (0==strcmp(user, user1)) { - str_copy(pswd1, pswd); - } - if (0==strcmp(user, user2)) { - str_copy(pswd2, pswd); - } - us=user; - pw=pswd; - } - } else { - gotolevel=3; - } - } - level=3; - ERR_I(sendCmd(sock[0], "config myrights")); - ERR_P(p=readWrite(12000,1,"UserRights = ")); - PutC("."); - if (*p!='\0') { - level=*p-'0'; - } - if (level==3) { - us="Spy"; - } - } - if (pw!=NULL && savepw) { - if (level==1) { - str_copy(user1, us); - str_copy(pswd1, pw); - if (0==strcmp(user1, user2)) { - user2[0]='\0'; - pswd2[0]='\0'; - } - } else if (level==2) { - str_copy(user2, us); - str_copy(pswd2, pw); - if (0==strcmp(user2, user1)) { - user1[0]='\0'; - pswd1[0]='\0'; - } - } - } - fil=term_open_pref(0, prefhead, "w"); - if (fil!=NULL) { - fprintf(fil, "%d\n", deflevel); - if (remember) { - putscrambled(user1, fil); - putscrambled(pswd1, fil); - putscrambled(user2, fil); - putscrambled(pswd2, fil); - } - fclose(fil); - } - return 0; - OnError: return -1; -} - -int SavePrefs(void) { - char prefhead[128], name[128]; - FILE *fil; - - ERR_SI(gethostname(name, sizeof name)); /* get ip name of this host */ - str_copy(prefhead, clcname); - str_append(prefhead, "_"); - str_append(prefhead, sim); - str_append(prefhead, name); - - ERR_SP(fil=term_open_pref(0, prefhead, "w")); - fprintf(fil, "keys\n"); - term_save_keys(fil, PutC); - fclose(fil); - return 0; - OnError: return -1; -} - -int LoadPrefs(void) { - char prefhead[128], name[128], line[128]; - FILE *fil; - - ERR_SI(gethostname(name, sizeof name)); /* get ip name of this host */ - str_copy(prefhead, clcname); - str_append(prefhead, "_"); - str_append(prefhead, sim); - str_append(prefhead, name); - fil=term_open_pref(0, prefhead, "r"); - if (fil) { - while (term_fgets(line, sizeof(line), fil)) { - if (0 == strcmp(line, "keys")) { - term_load_keys(fil, PutC); - } - } - fclose(fil); - } - return 0; - OnError: return -1; -} - -int Connect(void) { - int sock; - struct sockaddr_in sadr; - char *p; - - ERR_I(CocCreateSockAdr(&sadr, host, port)); - ERR_SI(sock=socket(AF_INET, SOCK_STREAM, 0)); - term_reg_socket(sock); - ERR_SI(connect(sock, (struct sockaddr *)&sadr, sizeof(sadr))); - ERR_SI(send(sock, "Spy 007\n", 8, 0)); - ERR_P(p=readWrite(12000,2,"Login O")); - if (*p!='K') { /* looking for the 'K' of 'Login OK' */ - PutC("rejected\n"); - return 0; - } - return sock; - OnError: return -1; -} - -int main (int argc, char *argv[]) { - struct hostent *ent; - int iret, pos; - fd_set mask; - int i, j, gotolevel, sicslogin; - int home; - int savehist = 0; - char buf[512], lbuf[16]; - char stdPrompt[128]="", prompt[256]=""; - char *p; - char *bar; - char *pnam[4]={"0", "MANAGER", "user", "spy"}; - char *hostArg; - char *subcmd; - char *service; - - atexit(term_off); - port=-1; - home=0; - sicslogin=1; - deflevel=0; - gotolevel=0; - hostArg=NULL; - sock[1]=0; /* do not yet connect 2nd connection */ - for (i=1; i=argc) { - PutC("missing host"); - UsageNote(); return 0; - } - hostArg = argv[i]; - } else if (0==strcmp(argv[i], "-p")) { - i++; - if (i>=argc) { - PutC("missing port"); - UsageNote(); return 0; - } - port=atoi(argv[i]); - if (port == 0) { - PutC("illegal port"); - UsageNote(); return 0; - } - } else if (0==strcmp(argv[i], "-n")) { - sicslogin=0; - } else { - if (strlen(argv[i])>=32) { - PutC("argument too long"); - UsageNote(); return 0; - } else if (argv[i][0] == '-') { - PutC("unknown option: "); - PutC(argv[i]); - UsageNote(); return 0; - } else if (argv[i][1] == '\0' && isdigit(argv[i][0])) { - port = atoi(argv[i]); - } else { - hostArg = argv[i]; - } - } - } - if (*sim != '\0') { - service = "simsics"; - } else { - service = servername; - } - home = InstrHost(service, hostArg, instr, sizeof instr - , host, sizeof host, &port); - ent = gethostbyname(host); - if (!ent) { - if (hostArg == NULL || hostArg[0] <= ' ') { - snprintf(host, sizeof host, "%s", getenv("HOST")); - hostArg = host; - } - PutC(service); - PutC(" on "); - PutC(hostArg); - PutC(" not found in InstrumentHostList\n"); - p=getenv("InstrumentHostList"); - if (p) { - PutC("("); - PutC(p); - PutC(")\n"); - } - return 0; - } - snprintf(host, sizeof host, "%s", ent->h_name); - LoadPrefs(); - - PutC( "---------------------------------------------------\n"); - if (strcmp(clcname, "six") == 0) { - PutC("six, a fast sics commandline client (doc: six help)\n"); - if (port == -1) { - if (*sim == '\0') { - port = 2911; - } else { - port = 2927; - } - home = 1; - } - } else if (strcmp(clcname, "seacmd") == 0) { - PutC("seacmd, a sea commandline client (doc: seacmd help)\n"); - if (port == -1) { - port = 8641; - } else if (port > 0 && port < 9) { - port += 8640; - } - home = 1; - } else { - PutC("graphcmd, a graph commandline client (doc: graphcmd help)\n"); - if (port == -1) { - port = 8741; - } else if (port > 0 && port < 9) { - port += 8740; - } - home = 1; - } - PutC( "---------------------------------------------------\n"); - PutC("."); - ERR_I(sock[0]=Connect()); - PutC("."); - if (sock[0] == 0) return 0; - if (sicslogin) { - - ERR_I(sendCmd(sock[0], "Instrument")); - ERR_P(p=readWrite(12000,0,"Instrument = ")); - PutC("."); - str_copy(instr, p); - if (*instr=='\0') { - PutC("can not detect instrument\n"); - return 0; - } - str_lowcase(instr,instr); - p=strchr(instr,' '); - if (p!=NULL) *p='\0'; - if (0==strcmp(instr,"SANS-II")) { - str_copy(instr, "SANS2"); - } - if (!home) { - deflevel = 3; - gotolevel = 3; - } - ERR_I(i=setrights(gotolevel)); - PutC("."); - PutC("\rlogged in to "); PutC(servername); PutC(" as "); - PutC(pnam[level]); - PutC(" on "); - PutC(instr); - PutC("\n"); - - sprintf(stdPrompt, "%s[%s] ", clcname, instr); - - ERR_I(sendCmd(sock[0], "status interest")); - ERR_P(readWrite(12000,0,"OK")); - - ERR_I(sendCmd(sock[0], "status")); - ERR_P(readWrite(12000,0,NULL)); - - term_read_hist(clcname, instr); - } else { - sprintf(stdPrompt, "%s[%s] ", clcname, host); - status[0]='E'; status[1]='\0'; - term_read_hist(clcname, host); - } - - iret=1; - buf[0]='\0'; - pos=0; - - savehist = 1; - - while (1) { - if (busy[0]) { - bar = prefix[SPY]; - } else { - bar = prefix[NORMAL]; - } - if (status[0] == 'E') { /* Eager to ... */ - sprintf(prompt, "%s%s", bar, stdPrompt); - } else { - sprintf(prompt, "%s%s(%s) ", bar, stdPrompt, status); - } - FD_ZERO(&mask); - FD_SET(sock[0], &mask); - iret=term_get_line(buf, sizeof(buf)-2, &pos, prompt, &mask); - if (iret==STDIN_FILENO) { /* input line terminated */ - str_lowcase(lbuf, buf); - if (0==strcmp(lbuf,"quit") || 0==strcmp(lbuf,"exit")) { - PrintCmd(buf, CLIENT); - break; - } - p=""; - if (0==strcmp(lbuf,"stop")) { - PrintCmd(buf, CLIENT); - ERR_SI(send(sock[0], "INT1712 3\n", 10, 0)); - buf[0]='\0'; - } else if (0==strcmp(buf, "-") || - 0==strcmp(buf, "--") || - 0==strcmp(buf, "+") || - 0==strcmp(buf, "++")) { - PrintCmd(buf, CLIENT); - if (level == 0) { - gotolevel = 3; - } else { - gotolevel = level; - } - if (buf[0]=='-') { - if (gotolevel<3) gotolevel++; - } else { - if (gotolevel>1) gotolevel--; - } - if (strlen(buf)==2) { - deflevel=gotolevel; - } - term_off(); - j = level; - ERR_I(i=setrights(gotolevel)); /* level might be changed */ - if (j!=level) { - PutC("\rswitched to "); - } else { - PutC("\rremain at "); - } - PutC(pnam[level]); - PutC(" privilege\n"); - buf[0]='\0'; - } else if (0==strncmp(buf, "help ", 5) && 0==strcmp(buf+5, clcname)) { - PrintCmd(buf, CLIENT); - Usage(1); - buf[0]='\0'; - } else if (0==strncmp(buf, clcname, clclen) && buf[clclen] == ' ') { - subcmd = buf + clclen; - while (*subcmd <= ' ' && *subcmd != 0) { - subcmd++; - } - if (0==strcmp(subcmd, "help")) { - PrintCmd(buf, CLIENT); - Usage(0); - buf[0]='\0'; - } else if (0==strncmp(subcmd, "def ", 4)) { - PrintCmd(buf, CLIENT); - term_define_key(subcmd+4, 0); - buf[0]='\0'; - } else if (0==strcmp(subcmd, "def")) { - PrintCmd(buf, CLIENT); - term_define_key("", 0); - buf[0]='\0'; - } else if (0==strcmp(subcmd, "save")) { - PrintCmd(buf, CLIENT); - PutC("defaults for next calls to "); - PutC(clcname); PutC(":\n"); - ERR_I(SavePrefs()); - if (level == 0) { - gotolevel = 3; - } else { - gotolevel = level; - } - deflevel = gotolevel; - ERR_I(setrights(gotolevel)); - PutC(" login as "); - PutC(us); - PutC(" with "); - PutC(pnam[level]); - PutC(" privilege\n"); - buf[0]='\0'; - } else { - PrintCmd(buf, CLIENT); - PutC("ERROR: unknown command\n"); - buf[0]='\0'; - } - } else if (buf[0] == '\0') { /* empty command */ - PrintCmd(buf, CLIENT); - ERR_P(p=readWrite(200,0,NULL)); /* just wait a little */ - } - if (buf[0] != '\0') { - if (busy[0]) { - if (!sock[1]) { - ERR_I(sock[1] = Connect()); - if (!sock[1]) { - PutC("spy connection rejected\n"); - } - } - if (busy[1]) { - /* print in red bold */ - PrintCmd(buf, CLIENT); - PutC("\033[1;31mBUSY (already 2 commands pending)\033[0m\n"); - buf[0]='\0'; - } else if (sock[1]) { - PrintCmd(buf, SPY); - ERR_I(sendCmd(sock[1], buf)); - } else { - PrintCmd(buf, CLIENT); - buf[0]='\0'; - } - } else { - PrintCmd(buf, NORMAL); - ERR_I(sendCmd(sock[0], buf)); - } - } - if (buf[0] != '\0') { - ERR_P(p=readWrite(500,0,NULL)); - } - buf[0]='\0'; - pos=0; - } else if (iret>0) { /* something arrived from sockets */ - if (iret == sock[0] || iret == sock[1]) { - ERR_P(p=readWrite(500,0,NULL)); - } - } else if (iret<0) { - ERR_MSG("term_get_line failed"); - } - if (strcmp(p, "0") == 0) { - term_clear(); - PutC("\nconnection lost\n"); - goto SaveHist; - } - } - if (savehist) term_save_hist(1); /* save history without last line */ - goto Bye; - - OnError: - ErrShow("end"); - SaveHist: - if (savehist) term_save_hist(0); /* save history with last line */ - Bye: - term_off(); - if (stdPrompt[0]) { - PutC("\nexit "); - PutC(stdPrompt); - PutC("\n"); - PutClear(); /* clear colors */ - } - return 0; -} diff --git a/tecs/startecs b/tecs/startecs deleted file mode 100755 index 75864c6..0000000 --- a/tecs/startecs +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/tcsh -if ("$1" == "") then - set ini="tecs.ini" -else - set ini="tecs_$1.ini" -endif -cd ~/tecs -if (! -e $ini) then - echo ~/tecs/$ini not found - echo "" - set all=(tecs*.ini) - echo "Usage:" - echo "" - if ("$all" == "tecs.ini") then - echo " startecs" - else - echo " startecs " - echo "" - echo "where is one of" - echo "" - echo ${all:as/tecs_//:as/.ini//} - endif - exit -endif -ps waux | grep "TecsServer $ini" | grep -v grep > /dev/null -if ($?) then - set nam=${ini:s/.ini//} - ./keep_running ./TecsServer $ini -b ~/tecs/cfg/ -d ~/tecs/log/ -n $nam & -else - echo "TecsServer is running" -endif - diff --git a/tecs/str.f b/tecs/str.f deleted file mode 100644 index 59afed8..0000000 --- a/tecs/str.f +++ /dev/null @@ -1,378 +0,0 @@ -!! string handling -!! - subroutine STR_TRIM(RETSTR, STR, RETLEN) !! -!! -!! if RETSTR=STR then RETSTR is not touched -!! -!! Arguments: - character*(*) STR, RETSTR !! in,out - integer RETLEN !! out - integer i - - i=len(str) - if (str(1:1) .gt. ' ') then -10 if (str(i:i) .le. ' ') then - i=i-1 - goto 10 - endif - else -20 if (str(i:i) .le. ' ') then - if (i .gt. 1) then - i=i-1 - goto 20 - endif - endif - endif - retlen=min(len(retstr),i) - if (retstr .ne. str) then ! avoid copy to retstr if equal - retstr=str(1:i) - endif - end - -!! - subroutine STR_UPCASE(RETSTR, STR) !! -!! -!! Arguments: - character STR*(*), RETSTR*(*) !! in,out - integer i, ch - - retstr=str - do i=1,len(retstr) - ch=ichar(retstr(i:i)) - if (ch .ge. ichar('a') .and. ch .le. ichar('z')) then - retstr(i:i)=char(ch-(ichar('a')-ichar('A'))) - endif - enddo - end - -!! - subroutine STR_LOWCASE(RETSTR, STR) !! -!! -!! Arguments: - character STR*(*), RETSTR*(*) !! in,out - integer i, ch - - retstr=str - do i=1,len(retstr) - ch=ichar(retstr(i:i)) - if (ch .ge. ichar('A') .and. ch .le. ichar('Z')) then - retstr(i:i)=char(ch+(ichar('a')-ichar('A'))) - endif - enddo - end - -!! - subroutine STR_APPEND(str, length, add) !! -!! - implicit none - - character*(*) str, add !! - integer length !! - - if (len(add)+length .gt. len(str)) then - if (length .lt. len(str)) then - str(length+1:)=add - length=len(str) - endif - else - str(length+1:length+len(add))=add - length=length+len(add) - endif - end - -!! - integer function STR_CMP(str1, str2) !! -!! -!! if strings are equal: return 0 -!! else return position of first different character - - character str1*(*), str2*(*) !! - - integer i - - do i=0,min(len(str1),len(str2))-1 - if (str1(i+1:i+1) .ne. str2(i+1:i+1)) then - str_cmp=i+1 - return - endif - enddo - do i=len(str1),len(str2)-1 - if (str2(i+1:i+1) .ne. ' ') then - str_cmp=i+1 - return - endif - enddo - do i=len(str2),len(str1)-1 - if (str1(i+1:i+1) .ne. ' ') then - str_cmp=i+1 - return - endif - enddo - str_cmp=0 - return - end - -!! - subroutine STR_FIRST_NONBLANK(STR, POS) !! -!! -!! Arguments: - character*(*) STR !! in - integer POS !! out - integer i - - do i=1,len(str) - if (str(i:i) .gt. ' ') then - pos=i - return - endif - enddo - pos=0 - end - -!! - subroutine STR_SPLIT(STR, DELIM, START, ENDE) !! -!! -!! split string into sequences separated by DELIM -!! for the first sequence set ENDE=0 and START=0 (or START=n for other start position n+1) -!! result: end of list: ENDE=-1 -!! empty sequence: START=ENDE+1 -!! normal sequence: STR(START:ENDE) without delimiter -!! -!! if ENDE has not a legal value, nothing happens - - character STR*(*), DELIM*(*) !! (in) string, delimiter - integer START, ENDE !! (in/out) start/end position - - integer i - - if (ende .lt. 0 .or. ende .ge. len(str) .or. start .lt. 0) then - ende=-1 - RETURN - endif - if (ende .ne. 0) start=ende+len(delim) - if (start .ge. len(str)) then - if (start .gt. len(str)) then - ende=-1 - RETURN - endif - i=0 - else - i=index(str(start+1:), delim) - endif - if (i .eq. 0) then - ende=len(str) - else - ende=start+i-1 - endif - start=start+1 - end - -!! - subroutine STR_GET_ELEM(STR, POS, ELEM) !! -!! -!! reads next element ELEM from string STR(POS:). Elements are separated by -!! spaces combined with one control-char (assume tab) or one comma. -!! return ' ' when STR(POS:) contains only whitespace or when pos is to high -!! - character STR*(*) !! (in) input string - character ELEM*(*) !! (out) element read - integer POS !! (in/out) read position - - integer start - - -1 if (pos .gt. len(str)) then - elem=' ' - RETURN - endif - if (str(pos:pos) .eq. ' ') then - pos=pos+1 - goto 1 - endif - start=pos -2 if (str(pos:pos) .gt. ' ' .and. str(pos:pos) .ne. ',') then - pos=pos+1 - if (pos .le. len(str)) then - goto 2 - endif - pos=pos-1 - endif - if (str(pos:pos) .eq. ',' .or. str(pos:pos) .lt. ' ') then - if (start .eq. pos) then - elem=str(start:pos) - else - elem=str(start:pos-1) - endif - pos=pos+1 - RETURN - endif - elem=str(start:pos-1) - if (str(pos:) .eq. ' ') RETURN -3 if (str(pos:pos) .eq. ' ') then - pos=pos+1 - if (pos .gt. len(str)) stop 'STR_GET_ELEM: assertion failed' - goto 3 - endif - if (str(pos:pos) .eq. ',' .or. str(pos:pos) .lt. ' ') then - pos=pos+1 - endif - end - -!! - integer function STR_FIND_ELEM(STR, ELEM) !! -!! -!! find column index of element ELEM (case insensitive) -!! only the first 64 chars of each element are checked -!! 0 is returned when not found -!! - character STR*(*), ELEM*(*) - character ups*64, upe*64 - integer pos, idx - - pos=1 - call str_upcase(upe, elem) - idx=0 - - call str_get_elem(str, pos, ups) - do while (ups .ne. ' ') - idx=idx+1 - call str_upcase(ups, ups) - if (ups .eq. upe) then - str_find_elem=idx - RETURN - endif - call str_get_elem(str, pos, ups) - enddo - str_find_elem=0 - RETURN - end - -!! - subroutine STR_SUBSTITUTE(RESULT, STR, OLD, NEW) !! -!! -!! replace all occurences of substring OLD in STR by NEW -!! special case: if NEW=CHAR(0) then a null length string is replaced -!! - character RESULT*(*), STR*(*) !! (out), (in) strings (must either be equal or not overlap) - character OLD*(*), NEW*(*) !! substrings (in) - - integer i,j,k - - i=0 - j=index(str, old)-1 - if (len(new) .eq. 1 .and. new(1:1) .eq. char(0)) then - k=0 - do while (j .ge. 0) - if (j .gt. 0) result(k+1:k+j)=str(i+1:i+j) - i=i+j+len(old) - k=k+j - if (i .ge. len(str)) then - if (k .lt. len(result)) result(k+1:)=' ' - RETURN - endif - j=index(str(i+1:), old)-1 - enddo - if (k .lt. len(result)) result(k+1:)=str(i+1:) - elseif (len(old) .ge. len(new)) then - k=0 - do while (j .ge. 0) - if (j .gt. 0) result(k+1:k+j)=str(i+1:i+j) - i=i+j+len(old) - k=k+j - result(k+1:k+len(new))=new - k=k+len(new) - if (i .ge. len(str)) then - if (k .lt. len(result)) result(k+1:)=' ' - RETURN - endif - j=index(str(i+1:), old)-1 - enddo - if (k .lt. len(result)) result(k+1:)=str(i+1:) - else - result=str - do while (j .ne. 0) - i=i+j - result(i+1:)=new//result(i+len(old)+1:) - i=i+len(new) - if (i .ge. len(str)) RETURN - j=index(str(i+1:), old)-1 - enddo - endif - end - - subroutine STR_CRC(CRC,BUF) !! -!! -!! Computes a 16-bit Cyclic Redundancy Check for an character string BUF. -!! Before the first call CRC should be intitalized (i.e. to 0) - -!! between subsequent call it should left untouched. - - integer CRC !! (in/out) CRC code - character BUF*(*) !! characters - - - integer init,ireg,i,j,icrctb(0:255),ichr,ib1,ib2,ib3 - character*1 creg(4) - save icrctb,init,ib1,ib2,ib3 - equivalence (creg,ireg) ! used to get at the 4 bytes in an integer. - data init /0/ - - integer crc1, crc2 - - if (init.eq.0) then ! initialize tables? - init=1 - ireg=256*(256*ichar('3')+ichar('2'))+ichar('1') - do j=1,4 ! figure out which component of creg addresses which byte of ireg. - if (creg(j).eq.'1') ib1=j - if (creg(j).eq.'2') ib2=j - if (creg(j).eq.'3') ib3=j - enddo - do j=0,255 ! create CRCs of all characters. - ireg=j*256 - - do i=1,8 ! Here is where 8 one-bit shifts, and some XORs with the generator polynomial, are done. - ichr=ichar(creg(ib2)) - ireg=ireg+ireg - creg(ib3)=char(0) - if(ichr.gt.127)ireg=ieor(ireg,4129) - enddo - - icrctb(j)=ireg - enddo - endif - ireg=crc - crc1=ichar(creg(ib1)) - crc2=ichar(creg(ib2)) - - do j=1,len(buf) ! Main loop over the characters - ireg=icrctb(ieor(ichar(buf(j:j)),crc2)) - crc2=ieor(ichar(creg(ib2)),crc1) - crc1=ichar(creg(ib1)) - enddo - creg(ib1)=char(crc1) - creg(ib2)=char(crc2) - crc=ireg - return - end - -!! - subroutine STR_CRC_COMP(CRC, CHR) !! -!! -!! encode CRC (16 bit) as 3 characters in CHR -!! - integer CRC !! (in) - character CHR*3 !! (out) - - integer n,j - character*41 cs/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$+-&_'/ - - if (crc .lt. 0 .or. crc .gt. 65535) stop 'STR_CRC_COMP: illegal CRC' - n=crc - j=mod(n,41) - chr(1:1)=cs(j+1:j+1) - n=n/41 - j=mod(n,41) - chr(2:2)=cs(j+1:j+1) - j=n/41 - chr(3:3)=cs(j+1:j+1) - end - diff --git a/tecs/strings.f90 b/tecs/strings.f90 deleted file mode 100644 index ba956d0..0000000 --- a/tecs/strings.f90 +++ /dev/null @@ -1,492 +0,0 @@ -MODULE Strings !! - -!! string handling - -CONTAINS - -!! - subroutine STR_TRIM(RETSTR, STR, RETLEN) !! -!! -!! if RETSTR=STR then RETSTR is not touched -!! - character*(*) STR, RETSTR !! in,out - integer RETLEN !! out - integer i - - i=len(str) - if (str(1:1) .gt. ' ') then -10 if (str(i:i) .le. ' ') then - i=i-1 - goto 10 - endif - else -20 if (str(i:i) .le. ' ') then - if (i .gt. 1) then - i=i-1 - goto 20 - endif - endif - endif - retlen=i - if (retstr .ne. str) then ! avoid copy to retstr if equal - retstr=str(1:i) - endif - end subroutine - -!! - subroutine STR_UPCASE(RETSTR, STR) !! -!! - character STR*(*), RETSTR*(*) !! in,out - integer i, ch - - retstr=str - do i=1,len(retstr) - ch=ichar(retstr(i:i)) - if (ch .ge. ichar('a') .and. ch .le. ichar('z')) then - retstr(i:i)=char(ch-(ichar('a')-ichar('A'))) - endif - enddo - end subroutine - -!! - subroutine STR_LOWCASE(RETSTR, STR) !! -!! - character STR*(*), RETSTR*(*) !! in,out - integer i, ch - - retstr=str - do i=1,len(retstr) - ch=ichar(retstr(i:i)) - if (ch .ge. ichar('A') .and. ch .le. ichar('Z')) then - retstr(i:i)=char(ch+(ichar('a')-ichar('A'))) - endif - enddo - end subroutine - -!! - subroutine STR_APPEND(STR, LENGTH, ADD) !! -!! -!! append ADD to STR(1:LENGTH) -!! when STR too short, it is truncated -!! - character*(*) str !! (in/out) - character*(*) add !! (in) - integer length !! (in/out) - - if (len(add)+length .gt. len(str)) then - if (length .lt. len(str)) then - str(length+1:)=add - length=len(str) - endif - else - str(length+1:length+len(add))=add - length=length+len(add) - endif - end subroutine - -!! - integer function STR_CMP(str1, str2) !! -!! -!! if strings are equal: return 0 -!! else return position of first different character -!! - character STR1*(*), STR2*(*) !! (in) strings to comapre - - integer i - - do i=0,min(len(str1),len(str2))-1 - if (str1(i+1:i+1) .ne. str2(i+1:i+1)) then - str_cmp=i+1 - return - endif - enddo - do i=len(str1),len(str2)-1 - if (str2(i+1:i+1) .ne. ' ') then - str_cmp=i+1 - return - endif - enddo - do i=len(str2),len(str1)-1 - if (str1(i+1:i+1) .ne. ' ') then - str_cmp=i+1 - return - endif - enddo - str_cmp=0 - return - end function - -!! - subroutine STR_FIRST_NONBLANK(STR, POS) !! -!! -!! Arguments: - character*(*) STR !! in - integer POS !! out - integer i - - do i=1,len(str) - if (str(i:i) .gt. ' ') then - pos=i - return - endif - enddo - pos=0 - end subroutine - -!! - subroutine STR_SUBSTITUTE(RESULT, STR, OLD, NEW) !! -!! -!! replace all occurences of substring OLD in STR by NEW -!! special case: if NEW=CHAR(0) then a null length string is replaced -!! - character RESULT*(*), STR*(*) !! (out), (in) strings (must either be equal or not overlap) - character OLD*(*), NEW*(*) !! substrings (in) - - integer i,j,k - - i=0 - j=index(str, old)-1 - if (len(new) .eq. 1 .and. new(1:1) .eq. char(0)) then - k=0 - do while (j .ge. 0) - if (j .gt. 0) result(k+1:k+j)=str(i+1:i+j) - i=i+j+len(old) - k=k+j - if (i .ge. len(str)) then - if (k .lt. len(result)) result(k+1:)=' ' - RETURN - endif - j=index(str(i+1:), old)-1 - enddo - if (k .lt. len(result)) result(k+1:)=str(i+1:) - elseif (len(old) .ge. len(new)) then - k=0 - do while (j .ge. 0) - if (j .gt. 0) result(k+1:k+j)=str(i+1:i+j) - i=i+j+len(old) - k=k+j - result(k+1:k+len(new))=new - k=k+len(new) - if (i .ge. len(str)) then - if (k .lt. len(result)) result(k+1:)=' ' - RETURN - endif - j=index(str(i+1:), old)-1 - enddo - if (k .lt. len(result)) result(k+1:)=str(i+1:) - else - result=str - do while (j .ne. 0) - i=i+j - result(i+1:)=new//result(i+len(old)+1:) - i=i+len(new) - if (i .ge. len(str)) RETURN - j=index(str(i+1:), old)-1 - enddo - endif - end subroutine - -!! - subroutine STR_SPLIT(STR, DELIM, START, END) !! -!! -!! split string into sequences separated by DELIM -!! for the first sequence set END=0 and START=0 (or START=n for other start position n+1) -!! result: end of list: END=0, START=0 -!! empty sequence: START=END+1 -!! normal sequence: STR(START:END) without delimiter -!! - character STR*(*), DELIM*(*) !! (in) string, delimiter - integer START, END !! (in/out) start/end position - - integer i - - if (end .eq. len(str)) then - start=0 - end=0 - RETURN - endif - if (end .ne. 0) start=end+len(delim) - i=index(str(start+1:), delim) - if (i .eq. 0) then - end=len(str) - else - end=start+i-1 - endif - start=start+1 - end subroutine - -!! - subroutine STR_FMT_REAL(RESULT, RESLEN, X, WIDTH, FIXLEN, DIGITS, TRUNC) !! -!! -!! Convert X to RESULT -!! -!! The number is converted using Fortran format F.. -!! 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) -!! - -!! 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 - - 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 - - - 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(fixbuf, 101, err=14) x -101 format (F.) - -! 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' .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(expbuf(1:bufmax-4), 102, err=19) mantissa -102 format (F.) - - 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. (overhd .gt. 0 .or. trc)) - 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(expbuf(el+1:el+le), 103) exponent -103 format('E',I) - el=el+le - endif - - -! Compare - - l=fl-f0 - if (l .gt. wid .and. & - & (edig .gt. digf .or. & - & edig .eq. digf .and. l .gt. el-e0 .or. & - & 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 - - subroutine STR_CRC(CRC,BUF) !! -!! -!! Computes a 16-bit Cyclic Redundancy Check for an character string BUF. -!! In the first call CRC should be intitalized - -!! between subsequent call it should be untouched. - - integer CRC !! (in/out) CRC code - character BUF*(*) !! characters - - - integer init,ireg,i,j,icrctb(0:255),ichr,ib1,ib2,ib3 - character*1 creg(4) - save icrctb,init,ib1,ib2,ib3 - equivalence (creg,ireg) ! used to get at the 4 bytes in an integer. - data init /0/ - - integer crc1, crc2 - - if (init.eq.0) then ! initialize tables? - init=1 - ireg=256*(256*ichar('3')+ichar('2'))+ichar('1') - do j=1,4 ! figure out which component of creg addresses which byte of ireg. - if (creg(j).eq.'1') ib1=j - if (creg(j).eq.'2') ib2=j - if (creg(j).eq.'3') ib3=j - enddo - do j=0,255 ! create CRCs of all characters. - ireg=j*256 - - do i=1,8 ! Here is where 8 one-bit shifts, and some XORs with the generator polynomial, are done. - ichr=ichar(creg(ib2)) - ireg=ireg+ireg - creg(ib3)=char(0) - if(ichr.gt.127)ireg=ieor(ireg,4129) - enddo - - icrctb(j)=ireg - enddo - endif - ireg=crc - crc1=ichar(creg(ib1)) - crc2=ichar(creg(ib2)) - - do j=1,len(buf) ! Main loop over the characters - ireg=icrctb(ieor(ichar(buf(j:j)),crc2)) - crc2=ieor(ichar(creg(ib2)),crc1) - crc1=ichar(creg(ib1)) - enddo - creg(ib1)=char(crc1) - creg(ib2)=char(crc2) - crc=ireg - return - end subroutine - -!! - subroutine STR_CRC_COMP(CRC, CHR) !! -!! -!! encode CRC (16 bit) as 3 characters in CHR -!! - integer CRC !! (in) - character CHR*3 !! (out) - - integer n,j - character*41 cs/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$+-&_'/ - - if (crc .lt. 0 .or. crc .gt. 65535) stop 'STR_CRC_COMP: illegal CRC' - n=crc - j=mod(n,41) - chr(1:1)=cs(j+1:j+1) - n=n/41 - j=mod(n,41) - chr(2:2)=cs(j+1:j+1) - j=n/41 - chr(3:3)=cs(j+1:j+1) - end subroutine - -end module diff --git a/tecs/sys_cmdpar.f b/tecs/sys_cmdpar.f deleted file mode 100755 index 71dea08..0000000 --- a/tecs/sys_cmdpar.f +++ /dev/null @@ -1,24 +0,0 @@ -!!----------------------------------------------------------------------------- -!! - subroutine SYS_GET_CMDPAR(STR, L) !! -!! --------------------------------- -!! - character*(*) STR !! - integer L !! - - integer i,iargc - - l=0 - str=' ' - do i=1,iargc() - if (l .lt. len(str)) then - call getarg(i, str(l+1:)) - call str_trim(str, str, l) - l=l+1 - endif - enddo - if (l .gt. 0) then - if (str(1:l) .eq. ' ') l=0 - if (str(l:l) .eq. ' ') l=l-1 - endif - end diff --git a/tecs/sys_date.f b/tecs/sys_date.f deleted file mode 100755 index b92a876..0000000 --- a/tecs/sys_date.f +++ /dev/null @@ -1,18 +0,0 @@ -!!----------------------------------------------------------------------------- -!! - subroutine SYS_DATE(YEAR, MONTH, DAY) !! -!! ------------------------------------- -!! -!! get actual date -!! - integer YEAR, MONTH, DAY !! 4-Digits year, month and day - - integer tarray(9) - external time - integer time - - call ltime(time(), tarray) - day=tarray(4) - month=tarray(5)+1 ! tarray(5): months since january (0-11)! - year=tarray(6)+1900 ! tarray(6): years since 1900, no y2k problem - end diff --git a/tecs/sys_env.c b/tecs/sys_env.c deleted file mode 100755 index 6a8d2ef..0000000 --- a/tecs/sys_env.c +++ /dev/null @@ -1,179 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "myc_tmp.h" -#include "myc_str.h" -#include "myc_fortran.h" - -#define ENAM_LEN 128 -#define EVAL_LEN 1024 - -int lnblnk_(const char *str, int len); -#ifdef __alpha - int setenv(char *p1, char *p2, int ow); -#endif - -typedef struct _EnvList { struct _EnvList *next; char *name; char *value; } EnvList; -static EnvList *envlist; -static char tmpfil[128]; -static char senv_id[16]; -static char *empty=""; -static int loaded=0; -static int dirty=0; - -EnvList *sys_findenv(char *name) { - EnvList *p; - for (p=envlist; p!=NULL; p=p->next) { - if (0==strcmp(name, p->name)) { - return p; - } - } - return NULL; -} - -int F_FUN(sys_loadenv)(void) { - FILE *fil; - char buf[ENAM_LEN+EVAL_LEN+10]; - char old[EVAL_LEN], userid[32]; - char *nam, *val, *pold, *u, *ret, *v; - int l; - EnvList *p; - - if (!loaded) { - loaded=-1; /* assume failure */ - /* u=cuserid(userid); */ - u=getenv("USER"); - if (u==NULL) { - strcpy(userid, "Anonymous"); - } else { - strncpy(userid, u, sizeof(userid)); - } - val=getenv("senv_id"); - if (val==NULL) { - sprintf(senv_id, "%d", getppid()); - } else { - strcpy(senv_id, val); - } - sprintf(tmpfil, "/tmp/.senv_%s.%s", userid, senv_id); - fil=fopen(tmpfil, "r"); - if (fil==NULL) { - loaded=1; - return 1; - } - while (1) { - - ret=fgets(buf, sizeof(buf), fil); - if (!ret || buf[0]=='#') break; - l=strlen(buf); - if (l<10 || buf[l-1]!='\n') return -1; - buf[l-1]='\0'; - buf[6]='\0'; - if (0!=strcmp(buf, "setenv")) return -1; - nam=buf+7; - val=strchr(nam, ' '); - if (val==NULL) return -1; - *val='\0'; val++; - if (*val=='"') { - if (buf[l-2]!='"') return -1; - buf[l-2]='\0'; - val++; - } - - ret=fgets(old, sizeof(old), fil); - if (!ret) break; - l=strlen(old); - if (l==0 || old[0]!='#' || old[l-1]!='\n') return -1; - old[l-1]='\0'; - pold=old+1; - - v=getenv(nam); - if (v==NULL) v=empty; - if (0==strcmp(v,pold)) { /* take value from file only if env. variable not changed in the meantime */ - p = malloc(sizeof(*p)); if (p == NULL) goto senv; - if (NULL==(p->name = strdup(nam))) goto senv; - if (NULL==(p->value = strdup(v))) goto senv; - p->next = envlist; - envlist=p; - senv: - setenv(nam, val, 1); - } - } - if (0>fclose(fil)) return -1; - loaded=1; - } - return loaded; -} - -int F_FUN(sys_setenv)(char *enam, char *eval, int snam, int sval) { - int lnam, lval; - char *v, nam[ENAM_LEN], val[EVAL_LEN]; - EnvList *p=NULL; - - lnam = lnblnk_(enam,snam); - if (lnam>=sizeof(nam)) lnam=sizeof(nam)-1; - strncpy(nam,enam,lnam); nam[lnam] = '\0'; - - lval = lnblnk_(eval,sval); - if (lval>=sizeof(val)) lval=sizeof(val)-1; - strncpy(val,eval,lval); val[lval] = '\0'; - - if (loaded>0) { - v=getenv(nam); - if (v == NULL) v=empty; - if (!dirty) { - dirty = 0 != strcmp(val,v); - } - p=sys_findenv(nam); - if (p==NULL) { - p = malloc(sizeof(*p)); if (p == NULL) goto senv; - if (NULL==(p->name = strdup(nam))) goto senv; - if (NULL==(p->value = strdup(v))) goto senv; - p->next = envlist; - envlist=p; - } - } - senv: - return setenv(nam, val, 1); -} - -int F_FUN(sys_saveenv)(void) { - FILE *fil; - char *v; - EnvList *p; - - if (F_FUN(sys_loadenv)()<0 || !dirty) return loaded; - - fil=fopen(tmpfil, "w"); - if (fil==NULL) return -1; - - for (p=envlist; p!=NULL; p=p->next) { - v=getenv(p->name); - if (0!=strcmp(v, p->value)) { - if (0>fputs("setenv ", fil)) return -1; - if (0>fputs(p->name, fil)) return -1; - if (0>fputs(" \"", fil)) return -1; - if (0>fputs(v, fil)) return -1; - if (0>fputs("\"\n#", fil)) return -1; - if (0>fputs(p->value, fil)) return -1; - if (0>fputs("\n", fil)) return -1; - } - } - if (0>fputs("#\nif ($$ == ", fil)) return -1; - if (0>fputs(senv_id, fil)) return -1; - if (0>fputs(") then\n /bin/rm ", fil)) return -1; - if (0>fputs(tmpfil, fil)) return -1; -/* - if (0>fputs("\n echo \"#\" > ", fil)) return -1; - if (0>fputs(tmpfil, fil)) return -1; -*/ - if (0>fputs("\nendif\n", fil)) return -1; - if (0>fclose(fil)) return -1; - dirty=0; - return 0; -} diff --git a/tecs/sys_get_key.f b/tecs/sys_get_key.f deleted file mode 100644 index 8ae3911..0000000 --- a/tecs/sys_get_key.f +++ /dev/null @@ -1,52 +0,0 @@ -!!----------------------------------------------------------------------------- -!! - subroutine SYS_GET_KEY(KEY, TMO) !! -!! -!! read for keyboard with timeout, without echo -!! - character KEY*1 !! - integer TMO !! timeout in seconds (<100) - - character esc*1, csi*1, ss3*1 - - esc=char(27) - csi=char(155) - ss3=char(143) - - call sys_get_raw_key(key, tmo) -1 if (key .eq. esc) then - call sys_get_raw_key(key, tmo) - if (key .eq. 'O') then - key=ss3 - goto 1 - elseif (key .eq. '[') then - key=csi - goto 1 - endif - elseif (key .eq. csi) then - call sys_get_raw_key(key, tmo) - do while (key .ge. '0' .and. key .le. '9') - call sys_get_raw_key(key, tmo) - enddo - key=' ' - elseif (key .eq. ss3) then - call sys_get_raw_key(key, tmo) - if (key .eq. 'm') then - key='-' - elseif (key .eq. 'l') then - key='+' - elseif (key .eq. 'n') then - key='.' - elseif (key .eq. 'M') then - key=char(13) - elseif (key .eq. 'S') then - key='*' - elseif (key .eq. 'R') then - key='/' - elseif (key .eq. 'Q') then - key='=' - else - key=' ' - endif - endif - end diff --git a/tecs/sys_getenv.f b/tecs/sys_getenv.f deleted file mode 100755 index ca1243a..0000000 --- a/tecs/sys_getenv.f +++ /dev/null @@ -1,75 +0,0 @@ -!!------------------------------------------------------------------------------ -!! - subroutine SYS_GETENV(NAME, VALUE) !! -!! ================================== -!! -!! Get environment variable NAME -!! try all uppercase also - - implicit none -!! Arguments: - character*(*) NAME !! logical name - character*(*) VALUE !! result - - integer l - character nam*128 - - call sys_loadenv - call str_trim(nam, name, l) - call getenv(nam(1:l), value) - if (value .ne. ' ') RETURN - if (nam(1:1) .ge. 'a') then - call str_upcase(nam(1:l), nam(1:l)) - else - call str_lowcase(nam(1:l), nam(1:l)) - endif - call getenv(nam(1:l), value) - end - -!!------------------------------------------------------------------------------ -!! - subroutine SYS_GETENV_IDX(NAME, VALUE, IDX) !! -!! =========================================== -!! -!! Get environment variable NAME, only list element IDX (start with 0) -!! (separated by comma) - - implicit none -!! Arguments: - character*(*) NAME !! logical name - character*(*) VALUE !! result - integer IDX !! index - - integer l,pos,j,i - character nam*128, list*1024 - - call str_trim(nam, name, l) - call getenv(nam(1:l), list) - if (list .eq. ' ') then - if (nam(1:1) .ge. 'a') then - call str_upcase(nam(1:l), nam(1:l)) - else - call str_lowcase(nam(1:l), nam(1:l)) - endif - call getenv(nam(1:l), list) - endif - pos=0 - do i=1,idx - j=index(list(pos+1:), ',') - if (j .eq. 0) then - value=' ' - RETURN - endif - pos=pos+j - enddo - j=index(list(pos+1:), ',') - if (j .eq. 1) then - value=' ' - RETURN - endif - if (j .le. 0) then - value=list(pos+1:) - else - value=list(pos+1:pos+j-1) - endif - end diff --git a/tecs/sys_lun.f b/tecs/sys_lun.f deleted file mode 100755 index 48dfb7a..0000000 --- a/tecs/sys_lun.f +++ /dev/null @@ -1,44 +0,0 @@ -!!----------------------------------------------------------------------------- -!! - subroutine SYS_GET_LUN(LUN) !! -!! -!! allocate logical unit number -!! - integer LUN !! out - - logical*1 act(50:100) - common/syslun/act - data act/51*.false./ - - integer l - - l=50 - do while (l .lt. 99 .and. act(l)) - l=l+1 - enddo - if (l .eq. 100) stop 'SYS_GET_LUN: no more luns available' - lun=l - act(l)=.true. - end - - -!!----------------------------------------------------------------------------- -!! - subroutine SYS_FREE_LUN(LUN) !! -!! -!! deallocate logical unit number -!! - integer LUN !! in - - logical*1 act(50:100) - common/syslun/act - - if (lun .lt. 50 .or. lun .gt. 99) then - stop 'SYS_FREE_LUN: illegal lun' - endif - if (act(lun)) then - act(lun)=.false. - else - stop 'SYS_FREE_LUN: lun already free' - endif - end diff --git a/tecs/sys_open.f b/tecs/sys_open.f deleted file mode 100755 index 9ccf0a9..0000000 --- a/tecs/sys_open.f +++ /dev/null @@ -1,55 +0,0 @@ -!!----------------------------------------------------------------------------- -!! - subroutine SYS_OPEN(LUN, FILE, ACCESS, IOSTAT) !! -!! ============================================== -!! -!! ACCESS='r': open file for read -!! ACCESS='w': open or create file for write (on vms: new version, on unix: overwrite) -!! ACCESS='wo': overwrite existing file (do not make a new version) -!! ACCESS='wn': keep old file (on unix systems, a tilde '~' is appended to the name) -!! ACCESS='a': open or create file for append - - integer LUN !! (in) logical unit number - character FILE*(*) !! (in) filename - character ACCESS*(*) !! (in) access mode - integer IOSTAT !! (out) status - - character acc*2 - character amnt*128 - integer i,j,l,ios - real s - - call str_upcase(acc, access) - - if (acc .eq. 'R') then - open(lun, name=file, iostat=iostat, status='old') - if (iostat .eq. 0) RETURN ! success - l=0 - i=1 - do while (i .ne. 0) - l=l+i - i=index(file(l+1:),'/') - enddo - if (l .eq. 1) RETURN ! no directory given - open(lun, name=file(1:l-1), iostat=ios, status='old') - if (ios .eq. 0) then - close(lun) - RETURN ! directory exists -> already mounted - endif - call sys_getenv('dat_automount', amnt) - if (amnt .eq. ' ') RETURN - call sys_cmd(amnt) !try to mount - open(lun, name=file, iostat=iostat, status='old') - else if (acc .eq. 'W' .or. acc .eq. 'WO') then - open(lun, name=file, iostat=iostat, status='unknown') - else if (acc .eq. 'WN') then - ! rename to be done - open(lun, name=file, iostat=iostat, status='unknown') - else if (acc .eq. 'A') then - open(lun, name=file, iostat=iostat, status='unknown' - 1, access='append') - else - print *,'unknown access mode: ',acc - stop 'error in SYS_OPEN' - endif - end diff --git a/tecs/sys_open_alpha.f b/tecs/sys_open_alpha.f deleted file mode 100755 index 185db86..0000000 --- a/tecs/sys_open_alpha.f +++ /dev/null @@ -1,54 +0,0 @@ -!!----------------------------------------------------------------------------- -!! - subroutine SYS_OPEN(LUN, FILE, ACCESS, IOSTAT) !! -!! ============================================== -!! -!! ACCESS='r': open file for read -!! ACCESS='w': open or create file for write (on vms: new version, on unix: overwrite) -!! ACCESS='wo': overwrite existing file (do not make a new version) -!! ACCESS='wn': keep old file (on unix systems, a tilde '~' is appended to the name) -!! ACCESS='a': open or create file for append - - integer LUN !! (in) logical unit number - character FILE*(*) !! (in) filename - character ACCESS*(*) !! (in) access mode - integer IOSTAT !! (out) status - - character acc*2 - character amnt*128 - integer i,j,l,ios - - call str_upcase(acc, access) - - if (acc .eq. 'R') then - open(lun, name=file, iostat=iostat, status='old', readonly) - if (iostat .eq. 0) RETURN - l=0 - i=1 - do while (i .ne. 0) - l=l+i - i=index(file(l+1:),'/') - enddo - if (l .eq. 1) RETURN ! no directory given - open(lun, name=file(1:l-1), iostat=ios, status='old') - if (ios .eq. 0) then - close(lun) - RETURN ! directory exists -> already mounted - endif - call sys_getenv('dat_automount', amnt) - if (amnt .eq. ' ') RETURN - call sys_cmd(amnt) !try to mount - open(lun, name=file, iostat=iostat, status='old', readonly) - else if (acc .eq. 'W' .or. acc .eq. 'WO') then - open(lun, name=file, iostat=iostat, status='unknown') - else if (acc .eq. 'WN') then - ! rename to be done - open(lun, name=file, iostat=iostat, status='unknown') - else if (acc .eq. 'A') then - open(lun, name=file, iostat=iostat, status='unknown' - 1, access='append') - else - print *,'unknown access mode: ',acc - stop 'error in SYS_OPEN' - endif - end diff --git a/tecs/sys_rdline.c b/tecs/sys_rdline.c deleted file mode 100755 index ebe6548..0000000 --- a/tecs/sys_rdline.c +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include -#include -#include -#include "myc_str.h" -#include "myc_fortran.h" - -static char *last_line = NULL; - -char *readline (char *prompt); -void add_history(const char *line); - -void F_FUN(sys_rd_line)(F_CHAR(cmd), int *retlen, F_CHAR(prompt) F_CLEN(cmd) F_CLEN(prompt)) -{ - char *line_read; - char p0[64], p[64]; - - STR_TO_C(p0, prompt); - str_copy(p, "\n"); - str_append(p, p0); - if (strlen(p0) < F_LEN(prompt)) { - str_append(p, " "); - } - if (last_line == NULL) { last_line =malloc(1); last_line[0] = '\0';}; - - line_read = readline(p); - - if (line_read) - { - if (*line_read && strcmp(last_line, line_read)!=0) - add_history (line_read); - free (last_line); - STR_TO_F(cmd, line_read); - *retlen=strlen(line_read); - last_line = line_read; - if (*retlen>F_LEN(cmd)) *retlen=F_LEN(cmd); - } else { - *retlen=-1; - } -} diff --git a/tecs/sys_select.c b/tecs/sys_select.c deleted file mode 100644 index 4f85571..0000000 --- a/tecs/sys_select.c +++ /dev/null @@ -1,106 +0,0 @@ -#include -#include -#include -#include -#include "uselect.h" - -static int lastFd=-1; -static struct termios atts; -static int echo=1; - -void sys_keys_on(void) { - int iret; - - struct termios attr; - if (echo) { - iret=tcgetattr(STDIN_FILENO,&attr); - atts=attr; /* save term. attr. */ - if (iret!=0) { perror("***\n");} - attr.c_lflag &= ~(ICANON) & ~(ECHO); /* canonical mode off, echo off */ - attr.c_cc[VMIN]=0; - attr.c_cc[VTIME]=1; /* 0.1 sec */ - iret= tcsetattr(STDIN_FILENO,TCSANOW,&attr); - if (iret!=0) {perror("***\n");} - echo=0; - } -} - -void sys_keys_off(void) { - int iret; - - if (!echo) { - iret=tcsetattr(STDIN_FILENO,TCSANOW,&atts); /* restore term. attributes */ - if (iret!=0) {perror("***\n");}; - echo=1; - } -} - -static int getChar(void) { - unsigned char c; - int rt; - - rt = read(STDIN_FILENO, &c, 1); - if (rt<=0) { - return EOF; - } else { - return c; - } -} - -int sys_select_or_key(fd_set *mask, int msecTmo, int *key) { - int fd, iret, fd1, chr; - struct timeval tmo, tmo0={0,0}; - fd_set rmask; - - sys_keys_on(); - rmask=*mask; - iret=uselect(FD_SETSIZE, &rmask, NULL, NULL, &tmo0); - if (iret<0) { - FD_ZERO(&rmask); - perror("error in select"); - } - fd1=STDIN_FILENO; - /* chr=fgetc(stdin); */ - chr = getChar(); - if (chr == EOF && iret==0) { /* */ - rmask=*mask; - FD_SET(STDIN_FILENO, &rmask); - if (msecTmo>=0) { - if (msecTmo>100) { /* reduce 100 ms for the 1 tenth second in fgetc */ - msecTmo=msecTmo-100; - } else { - msecTmo=1; - } - tmo.tv_sec=msecTmo / 1000; - tmo.tv_usec=(msecTmo%1000)*1000; - iret=uselect(FD_SETSIZE, &rmask, NULL, NULL, &tmo); - } else { - iret=uselect(FD_SETSIZE, &rmask, NULL, NULL, NULL); - } - if (iret<0) { - FD_ZERO(&rmask); - perror("error in select"); - } - if (FD_ISSET(STDIN_FILENO, &rmask)) { - chr = getChar(); - /* chr=fgetc(stdin); */ - } - FD_CLR(STDIN_FILENO, &rmask); - } - if (chr==EOF) { - chr=0; - fd1=-1; - for (fd=1; fdlastFd) { - fd1=fd; break; - } - } - } - } - *mask=rmask; - *key=chr; - return(fd1); -} diff --git a/tecs/sys_select.h b/tecs/sys_select.h deleted file mode 100644 index 051350d..0000000 --- a/tecs/sys_select.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef SYS_SELECT_H_ -#define SYS_SELECT_H_ - -#include - -int sys_select_or_key(fd_set *mask, int msecTmo, int *key); -/* - wait for read event on sockets included in mask or from keyboard or a timeout - result is negative for timeout, - STDIN_FILENO for a key pressed, - else socket number - switches the terminal to no-echo no-canonical -*/ - -void sys_keys_off(void); -/* - switch back terminal to normal state -*/ - -#endif /* SYS_SELECT_H_ */ diff --git a/tecs/sys_unix.c b/tecs/sys_unix.c deleted file mode 100755 index b53d956..0000000 --- a/tecs/sys_unix.c +++ /dev/null @@ -1,134 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "myc_tmp.h" -#include "myc_str.h" -#include "myc_fortran.h" - -void usleep_(int *usec) { usleep(*usec); } -int F_FUN(getppid)(void) { return getppid(); } -int lnblnk_(const char *str, int len); - -void F_FUN(sys_check_system)(F_CHAR(code) F_CLEN(code)) { -#if defined __alpha - STR_TO_F(code, "TRU64"); -#elif defined __GNUC__ - STR_TO_F(code, "GNU"); -#else - "sys_check_system: unsupported machine" -#endif -} - -void F_FUN(sys_realpath)(F_CHAR(rpath), int *reslen, - F_CHAR(path) F_CLEN(rpath) F_CLEN(path)) { - char p[PATH_MAX], rp[PATH_MAX], *pt; - - STR_TO_C(p, path); - pt=realpath(p, rp); - if (pt==NULL) str_copy(rp, p); - *reslen=strlen(rp); - STR_TO_F(rpath, rp); -} - -void F_FUN(sys_cmd)(char *command, int clen) { - int rc, l; - char *p; - - l = lnblnk_(command, clen); - p = malloc((unsigned) l+1); if( p == NULL ) return; - strncpy(p,command,l); p[l] = '\0'; - rc = system(p); - free(p); -} - -static struct termios atts; - -void F_FUN(sys_rd_tmo)(char *prompt, char *result, int *reslen, int p_len, int r_len) { - struct termios attr; - int ires, i, ntmo, chr; - - ires=tcgetattr(STDIN_FILENO,&attr); - atts=attr; /* save term. attr. */ - if (ires!=0) { - perror("error in terinq/tcgetattr "); - (*reslen)=0; - *result='\0'; - return; - } - attr.c_lflag &= ~(ICANON) & ~(ECHO); /* canonical mode off, echo off */ - attr.c_cc[VMIN]=0; - ires= tcsetattr(STDIN_FILENO,TCSANOW,&attr); - if (ires!=0) {perror("error in terinq/tcsetattr ");} - - do { chr=fgetc(stdin); } while (chr!=EOF); - - for (i=0; i0)) - { usleep(10000); /* wait 10 ms */ - chr=fgetc(stdin); - ntmo--; - }; - if (chr==EOF) break; - if (chr==10) {ntmo=10;} else {ntmo=100;}; /* wait 0.1 sec after LF, 1 sec else */ - }; - result[(*reslen)++]=(char)chr; - if (chr==24) {(*reslen)=0;}; /* ctrl-X purges buffer */ - }; - if (result[(*reslen)-1]==10) {(*reslen)--;}; /* strip trailing LF */ - - ires=tcsetattr(STDIN_FILENO,TCSANOW,&atts); /* restore term. attributes */ - clearerr(stdin); - if (ires!=0) { - perror("error in terinq/tcsetattr "); - } -} - -void F_FUN(sys_get_raw_key)(char *key, int *tmo, int k_len) -{ - struct termios attr; - int ires, ntmo, chr; - - ires=tcgetattr(STDIN_FILENO,&attr); - atts=attr; /* save term. attr. */ - if (ires!=0) {perror("***\n");} - attr.c_lflag &= ~(ICANON) & ~(ECHO); /* canonical mode off, echo off */ - attr.c_cc[VMIN]=0; - ires= tcsetattr(STDIN_FILENO,TCSANOW,&attr); - if (ires!=0) {perror("***\n");} - - ntmo=*tmo*100; - chr=fgetc(stdin); - if (chr==EOF) { - while ((chr==EOF) & (ntmo>0)) { - usleep(10000); /* wait 10 ms */ - chr=fgetc(stdin); - ntmo--; - } - } - if (chr==EOF) chr=0; - - *key=chr; - - ires=tcsetattr(STDIN_FILENO,TCSANOW,&atts); /* restore term. attributes */ - if (ires!=0) {perror("***\n");}; -} - diff --git a/tecs/sys_wait.f b/tecs/sys_wait.f deleted file mode 100755 index ee5bdeb..0000000 --- a/tecs/sys_wait.f +++ /dev/null @@ -1,20 +0,0 @@ -!!----------------------------------------------------------------------------- -!! - subroutine SYS_WAIT(SECONDS) !! -!! ============================ -!! wait for SECONDS - real SECONDS !! resolution should be better than 0.1 sec. - - real tim, del - - tim=secnds(0.0) -1 del=seconds-secnds(tim) - if (del .ge. 0.999) then - call sleep(int(del)) - goto 1 - endif - if (del .gt. 0) then - call usleep(int(del*1E6)) - goto 1 - endif - end diff --git a/tecs/tecs.bld b/tecs/tecs.bld deleted file mode 100644 index 0c098d0..0000000 --- a/tecs/tecs.bld +++ /dev/null @@ -1,4 +0,0 @@ -f90 -c -g tecs_plot.f90 -f77 -o tecs -g tecs_client.f tecs_for.f sys_aunix_c.c \ - tecs_plot.o sys_aunix.f -L. -ltecsl -L/data/lnslib/lib -lpgplot \ - -so_archive -lreadline -ltermcap -lX11 -lXm diff --git a/tecs/tecs.c b/tecs/tecs.c deleted file mode 100644 index 6c2e833..0000000 --- a/tecs/tecs.c +++ /dev/null @@ -1,3693 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "myc_mem.h" -#include "myc_err.h" -#include "coc_util.h" -#include "coc_server.h" -#include "coc_logfile.h" -#include "myc_str.h" -#include "myc_time.h" -#include "tecs_lsc.h" -#include "tecs_data.h" -#include "logger.h" - -/* --- non ANSI signal --- */ -#ifndef SIGPIPE -#define SIGPIPE 13 -#endif - -#define TABLE_FILE "tecs.cfg" -#define DEV_LIST "dev.list" -#define LSC_CODES "lsc.codes" -#define LOGLIFETIME 24*3600 - -#define CELSIUS 2 - -static SerChannel *ser=NULL; -static char binDir[256]=""; -static char logDir[256]=""; -static char loggerDir[256]=""; -static int logIt=0, use_stdout=0; -static char serverId[32]="tecs"; -static int msecTmo=5000; -static char host[64]=""; -static char starthost[64]=""; -static int port=9753; - -typedef struct { - char ch[4]; - float t, t0, t1, t2, min, max, band; /* temperatures */ - float scale; /* scale for extreme ranges */ - float kink; /* for T > kink values are scaled - kink > RT for thermocouples going to more than 1500 K */ - float lim; /* precise range limit (used when two sensors are present) */ - float alarm; - int customAlarm; - int stat1, stat2; /* reading status summary */ - int present; /* 0: sensor inactive, 1: sensor configured, -1: sensor parameters read */ - int readStat; /* reading status */ - int dispfld; - char curve[32]; /* name of curve file */ - char type[4]; - char dispfmt; - char typ; -} SensorT; - -enum Sensors { A, B, C, D, N_SENSORS }; - -static SensorT - sensA={"A"}, - sensB={"B"}, - sensC={"C"}, - sensD={"D"}, - *sensors[N_SENSORS]={&sensA, &sensB, &sensC, &sensD}, - *ctlSens=NULL, /* control sensor */ - *heliumSens=NULL, - *auxSens=NULL, - *testSens=NULL, - *test2Sens=NULL, - *sens=&sensA; - -typedef struct { - SensorT *sensor1, *sensor2; - float temp; /* weighted temperature */ - float t1, t2; /* minimum and maximum temperatures since ... */ -} Testpoint; - -static Testpoint /* C standard guarantees initialization to zero */ - cryo, /* data for heat exchanger, or the only sensors */ - samp, /* data for sensors on sample stick */ - *tpoints[2]={&cryo, &samp}, - *tpoint=&cryo; - -typedef struct _Plug { - SensorT *sensor1, *sensor2; - int devcmd; /* 1: device configured by command, 0: by cabling code */ - int code, code1, code2; /* device code, buffers for device code */ - int codChanged; /* code has changed */ - int codDefined; /* code is not yet confirmed */ - char device[16]; /* device name */ - char descr[80]; -} Plug; - -static Plug - plug0={&sensA, &sensB }, /* data for sensors on plug0 */ - plug1={&sensC, &sensD }, /* data for sensors on plug1 */ - *plugs[2]={&plug0, &plug1}, - *plug=&plug0; - -static float - set, /* set T */ - setH, /* set T on heat exchanger */ - set2, /* set T of second loop in two loop mode */ - htr, power=DATA_UNDEF, /* heater current percentage, heater power */ - power2=DATA_UNDEF, /* heater2 power */ - tLimit, /* temperature limit */ - tMaxLimit, /* maximal temperature limit */ - maxPowerFlt, /* max. Power */ - maxCurrent, /* maxCurrent (not really reached for resist > 25 Ohm */ - powFact=1, /* power factor (for external power supplies) */ - resist=10, /* heater resistance */ - empty, full, /* empty/full value for helium level */ - prop, integ, deriv, /* pid */ - int2=1200.0, /* integration time (sec) for doublecontrol */ - tShift=0, /* setpoint shift */ - maxShift=10, /* maximal shift for doublecontrol */ - propUp=0.5, /* upper limit coefficient (doublecontrol) */ - propDown=0.8, /* lower limit coefficient (doublecontrol) */ - tm=DATA_UNDEF, /* main temperature */ - ts=DATA_UNDEF, /* sample temperature */ - tx=DATA_UNDEF, /* controlled temperature */ - tr=DATA_UNDEF, /* set temperature (read back) */ - te=DATA_UNDEF, /* test temperature */ - tk=DATA_UNDEF, /* test temperature 2 */ - he=DATA_UNDEF, /* helium level value */ - aux=DATA_UNDEF, /* auxiliary value */ - scanChan=DATA_UNDEF, /* scan channel */ - ramp=0, - slope=0, - smooth=0, - fbuf, /* float buffer */ - r1, r2, /* temporary values */ - still=0, - linearPower=0, /* normally 0. Maximum power when loop=2 and the power linear to the output */ - shiftUp, shiftLow, /* upper and lower limit of tShift correction */ - maxpower2=1.0, - stickhtron=5.0, /* switch stick heater on when sample is more than this value below main */ - stickhtroff=0.0, /* switch stick heater off when sample is less than this value below main */ - state, - mout; - -static int - logPeriod=5, /* data logging period (sec.) */ - period=5000, /* default read interval (msec.) */ - logTime, /* next logging time */ - settingsFlag, /* settings to be done */ - saveTime, /* time for a CRVSAV command */ - noResp=1, /* no response */ - quit, /* quit server */ - controlMode=0, /* obsolete (now controlSensor/doubleControl) 0: control on heater, 1: control on sample, 2: 2nd loop for difference heater-sample */ - doubleControl=0, - manual=0, - remoteMode, /* 1: local, 2: remote */ - local, /* 0: remote, 1: local */ - maxfld, /* last used display field */ - busy, /* busy after CRVSAV */ - relay, relay0, /* relay status */ - num, /* curve number */ - key, /* key status */ - serialNo=340000, /* initialize with a valid, but not existing value */ - lscVersion, /* firmware version date yyyymmdd */ - readTemp, /* client requested readTemp */ - cod1, cod2, out1, out2, /* codes read from digital input/output */ - iRange, iAmp, /* max. range and max. current code */ - jRange, /* range code, jRange=iRange if controller did not switch off */ - ibuf, /* temporary int. buffer */ - htrst, htrst0, /* heater status */ - loop=1, /* active loop */ - twoloops=0, /* two active loops */ - touched, /* user touched keys */ - tim0, /* msec Time */ - per, /* effective period */ - mmInt, mmTime, /* interval and time for next min-max logging */ - alarmListSize=0, - keepT=0, /* keep control over power-up */ - swRangeOn=60, /* when not happen several times within less than 60 sec. delay, - switch heater range on when controller switched it off */ - initMaxPower=0, /* set MaxPower for the first time */ - unit=1, /* 1: Kelvin, 2: Celsius */ - autoconfig=0, /* automatic configuration 1: inside tecs, 0: done by SEA */ - lockAlarm, - stickhtr=-1, /* -1, no stick heater, 1: use stick heater in parallel */ - parallelhtr=0, /* is parallel heater active ? */ - ramping=0, /* setpoint is ramping */ - cntError; - -static int tim, rdTim; /* actual time, read Time */ - -static int decod[8]={21,20,17,16,5,4,1,0}; /* for code conversion */ - -static char - statusBuf[132], /* phase status */ - error[128], /* error message */ - status[1000], /* status summary */ - pid[128], /* PID summary */ - device[64], /* concatenated device names */ - buf1[256], buf2[256], buf3[256], buf4[256], /* buffers for temporary use */ - head[64], /* curve header */ - intype[64], /* input configuration */ - chan[4], /* actual channel */ - alarmStatus[20], /* alarm status */ - config[256], /* special configuration commands */ - helium[80], /* helium level status */ - heUnits[4], /* helium level units */ - alarmChannels[N_SENSORS], - alarmHistory[N_SENSORS], - swap[4], - controlSensor[4], /* '0': main two, '1': sample two, or any of "slmntkabcd" */ - dev[80], - devHelp[10000], - update[32], /* update script option */ - lscfg[256], /* lsc commands for configuration */ - devname0[64], /* name of plugs from codes */ - devname1[64], - maxPower[128], - controlChannel[4]="A"; - -static char - *alarmList[N_SENSORS], /* enabled alarms */ - *cache=NULL, /* curve list cache */ - *logfile=""; - -static int logMask=LOG_MAIN; - -static float gradata[COC_RES_LEN/4-100]; -static char grapar[128]; -static int* grasize; - -static char ttp[80]; /* temperature, target and power */ - -typedef struct { - char cmd[COC_CMD_LEN]; - int logstart; - long int logpos; - char logline[COC_RES_LEN]; -} ClientData; - -/* -static ClientData clInit; -static ClientData *clData=&clInit; -*/ - -static ClientData *clData; - -void ignore_forever(int signo) { - signal(signo,ignore_forever); -} - -int IdleHdl(int tmo, int fd) { - int iRet; - - iRet=CocHandleRequests(tmo, fd); - if (iRet<0) logfileShowErr("CocHandleRequests"); - return iRet; -} - -void *SetClientData(void *data) { - ClientData *cl; - if (data==NULL) { - NEW(cl, ClientData); - return cl; - } - clData = data; - return NULL; - OnError: - return NULL; -} - -void ConcatDevice(void) { - str_copy(device, plug0.device); - if (0!=strcmp(plug0.device, plug1.device) && (plug1.device[0]!='\0' || plug1.devcmd)) { - str_append(device, "/"); - str_append(device, plug1.device); - } - if (device[0]=='\0') return; -} - -int PutPermanentData(FILE *fil) { - char buf[256]; - char *d1, *d2; - - if (plug0.devcmd) { - d1="*"; - } else { - d1=""; - } - if (plug1.devcmd) { - d2="*"; - } else { - d2=""; - } - sprintf(buf, "%s%s/%s%s/%d/%d\n", d1, plug0.device, d2, plug1.device, plug0.code, plug1.code); - ERR_SI(fputs(buf, fil)); - return 0; - OnError: return -1; -} - -int InstalCurve(SensorT *sensor, char *devArg) { -/* - install sensor -*/ - char nam[32], buf[256], chead[64], nbuf[256], lbuf[16]; - char *crv, *entry, *points, *start, - *s, /* start of found entry */ - *e, /* cache part after found entry */ - *t; - int i, n; - char used[61]; - FILE *fil; - - sens=sensor; - str_copy(chan, sens->ch); - ERR_P(LscCmd(ser, "FILTER [chan]:1,64,10")); - sens->present=0; - if (sens->typ=='x' || sens->typ=='h' || sens->typ=='f') { - if (chan[0]>='C') { - ERR_P(LscCmd(ser, "INTYPE [chan]:0,1,2,1,13;INSET [chan],1")); /* 7.5 V Range */ - } else { - ERR_P(LscCmd(ser, "INTYPE [chan]:0,1,2,1,12;INSET [chan],1")); /* 5 V Range */ - } - if (sens->typ=='f') { - ERR_P(LscCmd(ser, "MNMX [chan]:1,4;INCRV [chan]:0")); - } else { - ERR_P(LscCmd(ser, "MNMX [chan]:1,3;INCRV [chan]:0")); - } - if (settingsFlag==0) sens->present=1; - return 0; - } - - fil=NULL; - crv=NULL; - e=NULL; - - sprintf(nam, "%s_%c", devArg, sens->typ); - logfileOut(LOG_MAIN+LOG_STAT, "install curve %s\n", nam); - - /* read curve file */ - str_copy(nbuf, binDir); - if (sensor->curve[0]=='\0') { /* old style file name */ - str_append(nbuf, nam); - } else { - str_append(nbuf, sensor->curve); - } - str_append(nbuf, ".crv"); - - ERR_P(crv=str_read_file(nbuf)); - - t=str_split(chead, crv, '\n'); - if (t==NULL) { - points=NULL; - } else { - points=str_split(intype, t, '\n'); - } - if (points==NULL) ERR_MSG("illegal curve file"); - if (cache==NULL) { ERR_SP(cache=MALLOC(1)); *cache='\0'; } /* create empty cache if undefined */ - - start=strchr(cache, '\n'); /* skip permanent data */ - if (start==NULL) { start=cache; } else { start++; } - - if (points[0]=='$') { /* standard curve */ - - points++; num=atoi(points); - if (num>20) ERR_MSG("illegal standard curve number"); - - ERR_P(LscCmd(ser, "CRVHDR?[num]>head")); - - } else { - - if (sensor->curve[0]!='\0') { - strcpy(buf, ","); - str_append(buf, sensor->curve); - str_append(buf, " "); - str_upcase(buf, buf); - } else { - strcpy(buf, ":"); - str_append(buf, nam); - str_append(buf, " "); - str_upcase(buf, buf); - } - - entry=strstr(start, buf); - if (entry==NULL) { /* sensor not found in cache */ - entry=start; - for (i = 60; i > 20; i--) { - used[i]=0; - } - n=40; num=0; - while (entry!=NULL && n>0) { - i=0; - sscanf(entry, "%d", &i); - if (i>20 && i<=60) { num=i; s=entry; used[i]=1; n--; } - entry=strchr(entry, '\n'); - if (entry !=NULL) entry++; - } - if (n>0) { - for (num=60;num>20;num--) { - if (used[num]==0) break; - } - s=NULL; - e=NULL; - } else { - e=strchr(s, '\n'); - if (e!=NULL) { *e='\0'; e++; } - if (s>start) { s--; *s='\0'; } - } - head[0]='\0'; - } else { - s=entry; entry++; - while (s>start && *s!='\n') s--; - if (s>start) { *s='\0'; s++; } - num=0; - sscanf(s, "%d", &num); - if (num<21 || num>60) ERR_MSG("illegal curve number"); - - ERR_P(LscCmd(ser, "CRVHDR?[num]>head")); - - e=strchr(entry, '\n'); - if (e!=NULL) { *e='\0'; e++; } - } - } - - if (num > 20 && strlen(chead) > 10) { /* replace name by a more meaningful */ - for (i=0; i<10 && i20) i=12; /* check only from 12th character (CRC) for user curves */ - if (head[0]!='\0' && LscEqPar(head+i, chead+i)) { /* header matches: select sensor type and curve */ - - if (i>0 && !LscEqPar(head, chead)) { /* name does not match */ - str_upcase(head, chead); - ERR_P(LscCmd(ser, "CRVHDR [num]:[head]")); - } - ERR_P(LscCmd(ser, "INTYPE?[chan]>buf1;INCRV?[chan]>buf2;INSET?[chan]>buf3")); - if (!LscEqPar(buf1, intype) || atoi(buf2)!=num || buf3[0]!='1') { - ERR_P(LscCmd(ser, "ANALOG 2:0,3;INSET [chan],1")); - if (chan[1]<='1') ERR_P(LscCmd(ser, "RANGE:0;INTYPE [chan]:[intype]")); - ERR_P(LscCmd(ser, "INCRV [chan]:[num];MNMX [chan]:1,[unit]")); - logfileOut(LOG_MAIN, "curve %d on channel %s selected\n", num, chan); - } else { - logfileOut(LOG_MAIN, "curve %d on channel %s is already selected\n", num, chan); - } - - } else { /* header does not match -> download */ - - logfileOut(LOG_MAIN, "%s\n%s\n", head, chead); - if (num<=20) ERR_MSG("standard curve does not match"); - if (busy) ERR_MSG("busy"); - logfileOut(LOG_MAIN+LOG_STAT, "download curve %d\n", num); - ERR_P(LscCmd(ser, "ANALOG 2:0,3;INSET [chan],1")); - /* select sensor type first */ - if (chan[1]<='1') ERR_P(LscCmd(ser, "RANGE:0;INTYPE [chan]:[intype]")); - - n=3; - do { /* try to delete curve 3 times */ - ERR_P(LscCmd(ser, "CRVDEL [num];CRVHDR?[num]>buf1,")); - buf1[4]='\0'; - i=strcmp(buf1, "User"); - n--; - } while (i!=0 && n!=0); - if (i!=0) ERR_MSG("can not delete curve"); - - /* store header, but without name (curve format must be determined before loading points) */ - t=strchr(chead, ','); - if (t==NULL) ERR_MSG("illegal header"); - str_copy(buf2, t); - ERR_P(LscCmd(ser, "CRVHDR [num]:[buf2]")); - - sprintf(lbuf, "CRVPT %d", num); - i=0; - do { /* download curve */ - t=str_split(nbuf, points, '\n'); - if (nbuf[0]!='\0') { - ERR_I(str_substitute(buf, nbuf, "#0", lbuf)); - if (lscVersion<20030000 || strstr(buf,":0,0")==NULL) { - ERR_P(LscCmd(ser, buf)); - } else { - logfileOut(LOG_MAIN, "skip %s\n", buf); - } - i++; - sprintf(statusBuf, "downloading curve %d at line %d", num, i); - } - points=t; - } while (t!=NULL); - - /* write header, select curve */ - str_upcase(head, chead); - ERR_P(LscCmd(ser, "CRVHDR [num]:[head];INCRV [chan]:[num];MNMX [chan]:1,[unit]")); - logfileOut(LOG_MAIN, "curve %d selected on channel %s\n", num, chan); - saveTime = (tim/3600/24 + 1) * 3600*24; /* save at midnight GMT */ - } - FREE(crv); crv=NULL; - - if (sens->scale != 1.0 || sens->kink != 0.0) { /* scaling for display */ - fbuf = sens->kink * (1.0 - sens->scale); - ERR_P(LscCmd(ser, "LINEAR [chan]:1,[sens.scale],[unit],1,[fbuf]")); - } - if (settingsFlag==0) sens->present=1; - /* - if (num<=20) return 0; - */ - /* standard curve, do not touch cache */ - - /* rewrite cache with actual entry at beginning */ - str_copy(nbuf, logDir); - str_append(nbuf, "lsc.tmp"); - fil=fopen(nbuf, "w+"); - if (fil==NULL) ERR_SP(fil=fopen(nbuf, "w")); - ERR_I(PutPermanentData(fil)); - if (num>20) { /* write actual entry */ - sprintf(buf, "%d:%s", num, head); - ERR_SI(fputs(buf, fil)); - } - if (start!=s) { /* write content before replaced entry */ - if (num>20) { - ERR_SI(fputs("\n", fil)); - } - ERR_SI(fputs(start, fil)); - } - if (e!=NULL) { /* write content after replaced entry */ - ERR_SI(fputs("\n", fil)); - ERR_SI(fputs(e, fil)); - } - ERR_SI(fputc('\0', fil)); - ERR_SI(fputc('\n', fil)); - ERR_SI(fclose(fil)); - str_copy(buf, logDir); - sprintf(lbuf, "lsc.%d", serialNo); - str_append(buf, lbuf); - rename(nbuf, buf); /* rename to permanent version */ - fil=NULL; - FREE(cache); - /* re-read it */ - ERR_P(cache=str_read_file(buf)); - - /* for vms: */ - str_append(buf, ";-1"); - remove(buf); /* remove old version */ - buf[strlen(buf)-2]='\0'; /* strip off "-1" */ - rename(buf, buf); /* lower version number */ - - return 0; - - OnError: - if (crv!=NULL) FREE(crv); - if (fil!=NULL) fclose(fil); - return -1; -} - -void InitSensor(SensorT *s) { - s->t=DATA_UNDEF; - s->scale=1; - s->kink=0; - s->lim=0; - s->alarm=0; - s->customAlarm=0; - s->present=0; - s->curve[0]='\0'; - s->type[0]='\0'; - s->dispfld=0; -} - -int PrepInput(char *label) { - char *t; - char nam[16], typ; - char buf[256]; - int i, j; - SensorT *s; - char *cfg; - - if (label[0]=='\'') { - str_copy(nam, label+1); - nam[strlen(nam)-1]='\0'; /* strip off quote */ - } else { - str_copy(nam, label); - } -again: - str_copy(buf, binDir); - str_append(buf, nam); - str_append(buf, ".cfg"); - cfg=str_read_file(buf); - if (cfg==NULL) { - logfileOut(LOG_MAIN, "%s not found\n", buf); - ERR_MSG("device not found"); - } - if (cfg && *cfg=='@') { /* alias */ - t=strchr(cfg,'\n'); - if (t) *t='\0'; - str_copy(nam, cfg+1); - str_copy(plug->device, nam); - FREE(cfg); - goto again; - } - if (plug==&plug0) { - InitSensor(&sensA); - InitSensor(&sensB); - slope=0; - ramp=0; - controlMode=0; - doubleControl=0; - controlSensor[0]='0'; - linearPower=0; - powFact=1; - config[0]='\0'; - lscfg[0]='\0'; - tLimit=0; - tMaxLimit=0; - keepT=0; - swRangeOn=60; - loop=1; - twoloops=0; - initMaxPower=1; - resist=10; - unit=1; - empty=0; - full = -1; - stickhtr = -1; - } else { - InitSensor(&sensC); - if (strcasecmp(nam, "none") == 0) { - /* exception: he sensor is not cleared when stick is none */ - if (full < 0 || sensB.type[0]=='\0' || sensD.type[0] != 'h') { - InitSensor(&sensD); - } - } else { - empty = 0; - full = -1; - InitSensor(&sensD); - } - } - - dev[0]='\0'; - str_copy(heUnits, "%"); - - ERR_P(CocReadVars(cfg, '\0')); - if (loop!=2) loop=1; - - if (plug==&plug0) { - j=0; - } else { - j=2; - } - str_copy(plug->descr, dev); - if (tLimit==0.0) { - if (tMaxLimit==0.0) { - tLimit=310; - tMaxLimit=350; - } else { - tLimit=tMaxLimit-10; - } - } else if (tMaxLimit==0.0) { - tMaxLimit=tLimit+10; - } else if (tLimit>tMaxLimit) { - tLimit=tMaxLimit; - } - maxPowerFlt=25; - sscanf(maxPower, "%f", &maxPowerFlt); - - for (i=j; itype[0]; - if (typ=='_') typ='\0'; - if (NULL==strchr("mnslhxftk", typ)) ERR_MSG("unknown channel type code"); - if (typ!='\0') { - s->present=-1; - } - s->typ=typ; - s->band=10; - if (s->scale==0.0) s->scale=1.0; - if ((s->alarm==0.0 && typ=='m') || typ=='s') { - s->alarm=tMaxLimit; - s->customAlarm=0; - } else { - s->customAlarm=1; - } - } - - if (!plug->devcmd) { /* set device name */ - str_copy(plug->device, nam); - ConcatDevice(); - } - if (cfg) { - FREE(cfg); - } - return 0; -OnError: - if (cfg) { - FREE(cfg); - } - return -1; -} - -int LoadCache(void) { - int i, j, k; - char *res; - char buf[256], nbuf[256], lbuf[16]; - char *bufi[4]; - FILE *fil; - - fil=NULL; - sprintf(lbuf, "lsc.%d", serialNo); - str_copy(nbuf, logDir); - str_append(nbuf, lbuf); - ERR_SP(fil=fopen(nbuf, "w")); - ERR_I(PutPermanentData(fil)); - bufi[0]=buf1; - bufi[1]=buf2; - bufi[2]=buf3; - bufi[3]=buf4; - for (i=60; i>21; i-=4) { - sprintf(buf, "CRVHDR?%d>buf1;CRVHDR?%d>buf2;CRVHDR?%d>buf3;CRVHDR?%d>buf4", i, i-1, i-2, i-3); - ERR_P(LscCmd(ser, buf)); - k=0; - for (j=i; j>i-4; j--) { - res=bufi[k]; k++; - if (res[1]=='s') { i=0; break;} /* s of "User", must be an empty slot, lowercase letters are not programmable */ - sprintf(buf, "%d:", j); - ERR_SI(fputs(buf, fil)); - ERR_SI(fputs(res, fil)); - ERR_SI(fputs("\n", fil)); - } - } - ERR_SI(fclose(fil)); - /* re-read cache */ - ERR_P(cache=str_read_file(nbuf)); - return 0; - OnError: - if (fil!=NULL) fclose(fil); - return -1; -} - -float TrueScale(SensorT *s, float val) { - float tval; - if (s==NULL) { - return val; - } else { - if (val > s->kink) { - tval = (val - s->kink) * s->scale + s->kink; - } else { - tval = val; - } - return tval; - } -} - -float FakeScale(SensorT *s, float val) { - float fval; - if (s==NULL) { - return val; - } else { - if (val > s->kink) { - fval = (val - s->kink) / s->scale + s->kink; - } else { - fval = val; - } - return fval; - } -} - -float WeightedAverage(float tH, float tL, Testpoint *t) { - float p,q, tLow, tHigh; - SensorT *s1, *s2; - - if (tH==DATA_UNDEF) tH=0.0; - if (tL==DATA_UNDEF) tL=0.0; - s1=t->sensor1; - s2=t->sensor2; - tH = TrueScale(s1, tH); - tL = TrueScale(s2, tL); - if (tH!=0.0) { - if (tL!=0.0) { - tLow=s1->lim; - tHigh=s2->lim; - if (tL<=tLow) { - return tL; - } else if (tHsensor1; - s2=tpoint->sensor2; - tpoint->t1 = WeightedAverage(s1->min, s2->min, tpoint); - tpoint->t2 = WeightedAverage(s1->max, s2->max, tpoint); - if (fabsf(tpoint->t1 - tpoint->temp) < fabsf(tpoint->t2 - tpoint->temp)) { - tbuf = tpoint->t1; - tpoint->t1 = tpoint->t2; - tpoint->t2 = tbuf; - } - s1->min=0; - s1->max=0; - s2->min=0; - s2->max=0; - } - - if (cryo.t1!=DATA_UNDEF) { - sprintf(buf1, " Tm %.5g _ %.5g", cryo.t1, cryo.t2); - str_append(buf, buf1); - } - if (cryo.sensor1!=samp.sensor1 && samp.t1!=DATA_UNDEF) { - sprintf(buf1, " Ts %.5g _ %.5g", samp.t1, samp.t2); - str_append(buf, buf1); - } - if (tr!=DATA_UNDEF) { - sprintf(buf1, " Tr %.5g", tr); - str_append(buf, buf1); - } - if (te!=DATA_UNDEF) { - sprintf(buf1, " Te %.5g", te); - str_append(buf, buf1); - } - if (tk!=DATA_UNDEF) { - sprintf(buf1, " Tk %.5g", tk); - str_append(buf, buf1); - } - } else { - return; - } - if (power!=DATA_UNDEF) { - sprintf(buf1, " P %.4g", power); - str_append(buf, buf1); - } - if (he!=DATA_UNDEF) { - sprintf(buf1, " He %.4g", he); - str_append(buf, buf1); - } - if (aux!=DATA_UNDEF) { - sprintf(buf1, " Aux %.5g", aux); - str_append(buf, buf1); - } - if (new==2) { - mmTime=mmTime+30; - first=1; - } else { - if (first==0) { - logfileOut(LOG_MAIN, "%s\n", buf); - } else { - first=0; - } - if (new) { - mmInt=30; - } else { - mmInt=60; - } - mmTime=((tim+mmInt/2)/mmInt+1)*mmInt-logPeriod; - } -} - -SensorT *findSensor(char txt) { - int i; - SensorT *s; - - s = NULL; - txt = tolower(txt); - if (strchr("01slmntkabcde", txt) != 0) { - for (i=0; i<4; i++) { - if (txt == tolower(sensors[i]->ch[0]) - || txt == sensors[i]->typ) { - s = sensors[i]; - } - } - } - return s; -} - -void SetCtlSens(void) { - SensorT *s; - - if (controlSensor[0] == '1') { - tShift=0; - if (ctlSens==NULL) { - ctlSens=samp.sensor1; - } else if (ctlSens==samp.sensor1) { - if (set < ctlSens->lim) { - ctlSens=samp.sensor2; - } - } else if (ctlSens==samp.sensor2) { - if (set > ctlSens->lim) { - ctlSens=samp.sensor1; - } - } else { - ctlSens=samp.sensor1; - } - if (controlMode != 2) { - controlMode = 1; - } - } else if (controlSensor[0] == '0') { - if (!doubleControl) { - tShift=0; - } - if (ctlSens==NULL) { - ctlSens=cryo.sensor1; - } else if (ctlSens==cryo.sensor1) { - if (set < ctlSens->lim) { - ctlSens=cryo.sensor2; - } - } else if (ctlSens==cryo.sensor2) { - if (set > ctlSens->lim) { - ctlSens=cryo.sensor1; - } - } else { - ctlSens=cryo.sensor1; - } - if (controlMode != 2) { - controlMode = 0; - } - } else { - s = findSensor(controlSensor[0]); - if (s) { - ctlSens = s; - if (controlMode != 2) { - if (s->typ == 's' || s->typ == 'l') { - controlMode = 1; - } else { - controlMode = 0; - } - } - } else { - ctlSens = cryo.sensor1; /* should always be defined */ - if (controlMode != 2) { - controlMode = 0; - } - } - } -} - - -int ReadTemp(void) { - char buf[256], typ, *err, dispfmt; - int i, doit, stat; - int tfill, dfill; - static time_t lastRead=0; - float hlev; - SensorT *s; - - readTemp=0; - - doit=0; - lastRead = 0; - for (i=0; i<4; i++) { - s=sensors[i]; - s->stat1=0; - s->stat2=0; - if (s->present) { - if (doit) ERR_P(LscCmd(ser, buf)); - if (i<4) { - str_substitute(buf - , "KRDG?#>sens#.t0;MDAT?#>sens#.t1,sens#.t2;MDATST?#>sens#.stat1,sens#.stat2" - , "#", s->ch); - } else { - str_substitute(buf - , "KRDG?#>sens#.t1;RDGST?#>sens#.stat1;DIOST?>,sens#.stat2" - , "#", s->ch); - } - if (s->typ=='h' || s->typ=='x') { - buf[0]='S'; /* change KRDG to SRDG */ - typ='S'; - } else if (s->typ=='f') { - buf[0]='L'; /* change KRDG to LDAT */ - buf[1]='D'; - buf[2]='A'; - buf[3]='T'; - } else if (unit == CELSIUS) { - buf[0]='C'; /* change KRDG to CRDG */ - } - doit=1; - } - } - if (doit) { - if (ramp!=0) { - str_append(buf, ";SETP?[loop]>fbuf;RAMPST?[loop]>ramping"); - } else { - ramping = 0; - } - str_append(buf, ";MNMXRST"); - ERR_P(LscCmd(ser, buf)); - SetCtlSens(); - if (manual) { - tr=DATA_UNDEF; - } else if (ramp!=0) { - tr=TrueScale(ctlSens, fbuf); - } else { - tr=TrueScale(ctlSens, setH); - } - if (tr==0) tr=DATA_UNDEF; - } - - /* check for reading errors, determine legal value */ - for (i=0; i<4; i++) { - s=sensors[i]; - if (s->present) { - - if (i>=4) { - if (s->stat2==i-4) { /* ignore reading, if channel was active (may be noisy) */ - s->t1 = s->t; - } - s->t2 = s->t1; - s->stat2 = s->stat1; - } - if (set != 63.0 && - (s->t1 == 63.0 || s->t2 == 63.0 || s->t0 == 63.0)) { - /* probably noisy values */ - logfileOut(LOG_MAIN, "magic %s: %g %g %g\n", s->ch, s->t1, s->t2, s->t0); - } - - stat=(s->stat1 & s->stat2) & (255-3); /* ignore "old reading" and "invalid reading", error must be on min & max */ - if (stat > s->readStat || (stat==0 && s->readStat>0)) { - err=LscReadStat(stat); - if (*err=='\0') { - logfileOut(LOG_MAIN, "reading o.k. %s\n", s->ch); - } else { - logfileOut(LOG_MAIN, "%s %s\n", err, s->ch); - } - s->readStat=stat; - } - if (stat==0) { - - if (s->typ=='h') { - hlev = s->t1; /* take minimum only */ - if (full!=empty) { - hlev=(hlev-empty)/(full-empty); - if (hlev<1.0 && hlev>0.0) { - he=hlev*100.0; - s->t=he; - tfill = tim % (24*3600) / 60; /* min since midnight */ - dfill = mycDate(tim) % 10000; /* fill date without year */ - sprintf(helium, "%.3g %s (%02d.%02d., %02d:%02d)", he, heUnits - , dfill % 100, dfill / 100, tfill / 60, tfill % 60); - } - } - } else if (s->t2 - s->t1 <= s->band*2) { /* normal case */ - s->t = (s->t1 + s->t2) * 0.5; /* mean of min and max */ - s->band = s->band/2; - } else { - if (s->t1 < 0.8 * s->t2) { - /* probably noisy values */ - logfileOut(LOG_MAIN, "min/max %s: %g %g\n", s->ch, s->t1, s->t2); - } - s->t=s->t0; - s->t1 = s->t; - s->t2 = s->t; - } - if (s->t1 < s->min || s->min==0.0) s->min = s->t1; - if (s->t2 > s->max) s->max = s->t2; - if (s->max - s->min > s->band) { - s->band = s->max - s->min; - } - if (s->scale > 1.0 && s->kink != 0) { - if (s->t > s->kink) { - dispfmt='4'; - } else if (unit == CELSIUS) { - dispfmt='2'; - } else { - dispfmt='1'; - } - if (dispfmt != s->dispfmt) { /* change display format */ - s->dispfmt = dispfmt; - sprintf(buf, "DISPFLD %d,%s,%c", s->dispfld, s->ch, dispfmt); - ERR_P(LscCmd(ser, buf)); - } - } - } else { - s->t=DATA_UNDEF; - } - } else { - s->t=DATA_UNDEF; - } - } - - rdTim=mycNow(); - - tm=DATA_UNDEF; - ts=DATA_UNDEF; - if (cryo.sensor1!=NULL) { - cryo.temp=WeightedAverage(cryo.sensor1->t, cryo.sensor2->t, &cryo); - samp.temp=WeightedAverage(samp.sensor1->t, samp.sensor2->t, &samp); - tm=cryo.temp; - if (samp.sensor1!=cryo.sensor1) { - ts=samp.temp; - } - if (samp.temp==DATA_UNDEF) { - samp.temp=cryo.temp; - } - } else { - tm=(rdTim % 3600) * 1.0e-4; - ts=(rdTim % 60) * 60.0e-4+0.5; - } - if (doubleControl) { - tx=ts; - } else if (ctlSens) { - tx=TrueScale(ctlSens, ctlSens->t); - } - if (auxSens != NULL) { - aux=TrueScale(auxSens, auxSens->t); - } else { - aux=DATA_UNDEF; - } - if (testSens != NULL) { - te=TrueScale(testSens, testSens->t); - } else { - te=DATA_UNDEF; - } - if (test2Sens != NULL) { - tk=TrueScale(test2Sens, test2Sens->t); - } else { - tk=DATA_UNDEF; - } - if (heliumSens == NULL) { - he=DATA_UNDEF; - } - return 0; - OnError: return -1; -} - -float Percent2Power(float percent) { - float curr; - - if (linearPower > 0) { - return percent/100*linearPower; - } - curr=maxCurrent*percent/100; - if (linearPower < 0) { - return curr*sqrt(resist)*powFact; - } - return curr*curr*resist*powFact; -} - -float Power2Percent(float power) { - if (linearPower > 0) { - return power/linearPower*100; - } - if (linearPower < 0) { - return power/powFact/sqrt(resist)/maxCurrent*100; - } - return sqrt(power/powFact/resist)/maxCurrent*100; -} - -int ReadHeater(int full) { - static time_t lastOff=0; - static int cntOff=3; - time_t now; - - power2 = DATA_UNDEF; - if (loop==1) { - if (full) { - if (relay) { - ERR_P(LscCmd(ser, "HTRST?>htrst")); - htr=0; - } else { - if (twoloops) { - ERR_P(LscCmd(ser, "HTR?>htr;HTRST?>htrst;RELAYST?1>relay;RANGE?>ibuf;AOUT?2>fbuf")); - power2 = fbuf*fbuf*1e-4*maxpower2; - } else { - ERR_P(LscCmd(ser, "HTR?>htr;HTRST?>htrst;RELAYST?1>relay;RANGE?>ibuf")); - } - if (jRange!=0 && ibuf==0) { - if (swRangeOn) { - time(&now); - if (lastOff > 0) { - if (now > lastOff + swRangeOn * 2) { - if (cntOff < 3) cntOff++; - } else if (now < lastOff + swRangeOn) { - cntOff--; - } - } - lastOff = now; - if (cntOff > 0) { - logfileOut(LOG_MAIN, "controller switched heater off - switch on again (%d more tries)\n", cntOff-1); - ERR_P(LscCmd(ser, "RANGE:[jRange]")); - } else { - logfileOut(LOG_MAIN, "controller switched heater off definitely (happened to often)\n"); - jRange=0; - } - } else { - logfileOut(LOG_MAIN, "controller switched heater off\n"); - jRange=0; - } - } - } - } else { - ERR_P(LscCmd(ser, "HTR?>htr")); - } - } else { - ERR_P(LscCmd(ser, "AOUT?2>htr")); - htrst=0; - } - if (htr == 0 && set == 0 && manual == 0) { - power=DATA_UNDEF; - } else { - power=Percent2Power(htr); - if (power>maxPowerFlt) power=maxPowerFlt; - } - return 0; - OnError: return -1; -} - -int SetTemp(int switchOn) { - int showSet; - float tc; - float tLim; - - if (set<0 || set>tLimit) { - set=0; - logfileOut(LOG_MAIN, "set point not within (0 ... %g), reset to 0\n", tLimit); - } - if (switchOn) { - ERR_I(ReadTemp()); - LogMinMax(switchOn); - } - SetCtlSens(); - if (ctlSens==NULL) return 0; - - str_copy(chan, ctlSens->ch); - if (!doubleControl) { - tShift=0.0; - } - tLim = (tLimit+tMaxLimit)*0.5; - if (set+tShift <= 0) { /* set + tShift must not be negative */ - tShift = -0.999 * set; - } else if (set + tShift > tLim) { /* prevent limit overshoot */ - tShift = tLim - set; - } - setH=FakeScale(ctlSens, set+tShift); - if (setH > FakeScale(ctlSens, tLim)) setH=FakeScale(ctlSens, tLim); - if (switchOn) { - /* switch off other loop */ - if (loop==1) { - if (twoloops==0) { - ERR_P(LscCmd(ser, "CSET 2:[chan],[unit],0,0")); - } - } else { - ERR_P(LscCmd(ser, "CSET 1:[chan],[unit],0,0")); - } - if (ramp > 0 && set != 0) { - /* start ramp from actual temperature */ - ERR_P(LscCmd(ser, "CSET?[loop]>,,cod1;SETP?[loop]>fbuf")); - if (loop == 1 && cod1 != 0) { - ERR_P(LscCmd(ser, "RANGE?>cod1")); - } /* cod1 == 0 --> heater is off */ - tr=TrueScale(ctlSens, fbuf); - tc=TrueScale(ctlSens, ctlSens->t); - if (cod1 == 0 || fabsf(tc - tr) >= 0.1 * tc) { - fbuf = ctlSens->t; - tr = TrueScale(ctlSens, fbuf); - ERR_P(LscCmd(ser, "SETP [loop],[fbuf];RAMP [loop],0,0;SETP [loop],[fbuf]")); - if (twoloops) { - ERR_P(LscCmd(ser, "SETP 2,[fbuf];RAMP 2,0,0;SETP 2,[fbuf]")); - } - } - } - } - if (set==0) { - mout=0; - ERR_P(LscCmd(ser, "CSET [loop]:[chan],[unit],1,[keepT];MOUT [loop],0")); - if (twoloops) { - ERR_P(LscCmd(ser, "CSET 2:C,[unit],1,[keepT];MOUT 2,0")); - } - if (loop==1) { - ERR_P(LscCmd(ser, "RANGE:0")); - jRange=0; - if (twoloops) { - ERR_P(LscCmd(ser, "ANALOG 2:0,0")); - } - } else { - ERR_P(LscCmd(ser, "ANALOG 2:0,0")); - } - setH=0; - } else if (switchOn) { /* switch on also when bad heater message and no alarms: || (htrst>=5 && !relay)) */ - ERR_P(LscCmd(ser, "CSET [loop]:[chan],[unit],1,[keepT]")); - if (loop==1) { - ERR_P(LscCmd(ser, "RANGE:[iRange]")); - jRange=iRange; - if (twoloops) { - ERR_P(LscCmd(ser, "ANALOG 2:0,3")); - } - } else { - ERR_P(LscCmd(ser, "ANALOG 2:0,3")); - } - } else { - ERR_P(LscCmd(ser, "CSET?[loop]>,buf1,")); - if (buf1[0] != ('0' + unit)) { - ERR_P(LscCmd(ser, "CSET [loop]:[chan],[unit]")); - } - } - showSet=(0!=strcmp(ctlSens->ch, controlChannel) || switchOn); - str_copy(controlChannel, ctlSens->ch); - if (ramp==0 || set==0) { - ERR_P(LscCmd(ser, "RAMP?[loop]>buf1,")); - if (buf1[0] != '0') { - ERR_P(LscCmd(ser, "RAMP [loop]:0,[ramp]")); - if (twoloops) { - ERR_P(LscCmd(ser, "RAMP 2:0,[ramp]")); - } - } - ERR_P(LscCmd(ser, "SETP?[loop]>fbuf")); - if (fabsf(setH-fbuf) >= (fbuf+setH)*1.0e-5) { - ERR_P(LscCmd(ser, "SETP [loop]:[setH]")); - if (!doubleControl && !showSet) { - logfileOut(LOG_MAIN, "set %g (on %s) (was changed %g -> %g)\n", set, ctlSens->ch, fbuf, setH); - } - } else { - setH=fbuf; - } - if (twoloops) { - ERR_P(LscCmd(ser, "SETP 2:[set2]")); - } - tr=TrueScale(ctlSens, setH); - if (showSet) { - logfileOut(LOG_MAIN, "set %g (on %s)\n", set, ctlSens->ch); - } - } else { - if (ramp < 0) ramp=-ramp; - if (ramp < 0.1) ramp=0.1; - if (showSet) { - fbuf = ramp; - } else { - ERR_P(LscCmd(ser, "SETP?[loop]>fbuf")); - if (fabs(fbuf-setH) >= ramp*smooth) { - fbuf=ramp; - } else { - fbuf=sqrt(fabs(fbuf-setH)*ramp/smooth); - } - } - fbuf = fbuf / ctlSens->scale; - if (fbuf<0.1) fbuf=0.1; - ERR_P(LscCmd(ser, "RAMP [loop]:1,[fbuf];SETP [loop],[setH]")); - if (twoloops) { - ERR_P(LscCmd(ser, "RAMP 2:1,[fbuf];SETP 2,[set2]")); - } - ERR_P(LscCmd(ser, "SETP?[loop]>fbuf")); - tr=TrueScale(ctlSens, fbuf); - if (showSet) { - logfileOut(LOG_MAIN, "set %g (on %s) %g K/min, starting from %g\n", set, ctlSens->ch, ramp, tr); - } - } - if (tr==0) tr=DATA_UNDEF; - if (showSet) { - /* relay=0; */ - ERR_I(ReadHeater(1)); - } - return 0; - OnError: return -1; -} - -void CalcMaxPower(void) { - int i, j; - struct { - float p; - int iAmp, iRange; - } low, high, *best; - float pa, pr, p, plim; - float h, maxAt; - char warning[128]; - - iAmp=1; iRange=0; - maxCurrent=0; - if (maxPowerFlt>0) { - if (resist<1) resist=10; - maxCurrent = 1; /* must be 1 for Power2Percent */ - h=Power2Percent(maxPowerFlt)/100; - p=h*h*resist; /* power before amplifier */ - plim=3025/resist; - /* power limited by 55 V output. U*U/R=55*55/R */ - if (p>plim) p=plim; - pa=resist*4; /* max. maxPower R*I*I (I=2 A) */ - low.p = 0; - low.iRange = 0; - high.p = resist*6; - high.iRange = 0; - for (i=4; i>0; i--) { - pr=pa; - for (j=5; j>0; j--) { - if (pr > p) { - if (pr < high.p) { - high.p = pr; - high.iAmp = i; - high.iRange = j; - } - } else { - if (pr > low.p) { - low.p = pr; - low.iAmp = i; - low.iRange = j; - } - } - pr=pr/10; - } - pa=pa/4; - } - if (high.iRange == 0) { - best = &low; - if (low.iRange == 0) { - return; - } - } else if (low.iRange == 0) { - best = &high; - } else if (p > low.p*1.1) { - best = &high; - } else { - best = &low; - } - warning[0]='\0'; - maxAt = 100; - if (best->p > plim) { - maxAt = sqrt(plim/best->p)*100; - maxPowerFlt=Percent2Power(100*sqrt(plim/resist)); - } else { - maxPowerFlt=Percent2Power(100*sqrt(best->p/resist)); - } - snprintf(maxPower, sizeof maxPower, "%.5g", maxPowerFlt); - if (best->p > p * 1.01) { - if (low.iRange != 0) { - snprintf(warning, sizeof warning, - "next lower value: %.4g", - Percent2Power(100*sqrt(low.p/resist))); - } else { - snprintf(warning, sizeof warning, - "rounded up to minimal value"); - } - } else if (best->p < p * 0.99) { - if (high.p > plim) high.p = plim; - if (high.p < resist * 5) { - snprintf(warning, sizeof warning, - "next higher value: %.4g", - Percent2Power(100*sqrt(high.p/resist))); - } else { - snprintf(warning, sizeof warning, - "rounded down to maximal value"); - } - } else if (p < h*h*resist * 0.99) { - snprintf(warning, sizeof warning, - "rounded down to maximal value"); - } - if (maxAt < 99.0) { - str_append(maxPower, " ("); - if (warning[0] != '\0') { - str_append(maxPower, warning); - str_append(maxPower, ", "); - } - snprintf(warning, sizeof warning, - "maximum power already at %.1f %%", - maxAt); - str_append(maxPower, warning); - str_append(maxPower, ")"); - } else if (warning[0]!='\0') { - str_append(maxPower, " ("); - str_append(maxPower, warning); - str_append(maxPower, ")"); - } - maxCurrent=sqrt(best->p/resist); - iRange = best->iRange; - iAmp = best->iAmp; - assert(maxCurrent>0); - } -} - -int PutFloat(StrBuf *buf, int prec, float f) { - char num[32], fmt[32]; - - if (f == DATA_UNDEF) { - return StrPut(buf, "NaN", StrNONE); - } else { - sprintf(fmt, "%%.%dg", prec); - sprintf(num, fmt, f); - return StrPut(buf, num, StrNONE); - } -} - -int PidSumHdl(int mode, void *base, int fd) { - StrBuf buf; - - StrLink(&buf, pid); - StrClear(&buf); - ERR_I(PutFloat(&buf, 5, prop)); - ERR_I(StrPut(&buf, " ", StrNONE)); - ERR_I(PutFloat(&buf, 5, integ)); - ERR_I(StrPut(&buf, " ", StrNONE)); - ERR_I(PutFloat(&buf, 4, deriv)); - ERR_I(StrPut(&buf, " /", ' ')); - ERR_I(PutFloat(&buf, 4, prop*maxCurrent*resist/600)); - ERR_I(StrPut(&buf, " A/K,", ' ')); - if (integ == 0.0) { - ERR_I(StrPut(&buf, " inf,", ' ')); - } else { - ERR_I(PutFloat(&buf, 4, 1000.0/integ)); - ERR_I(StrPut(&buf, " sec,", ' ')); - } - ERR_I(PutFloat(&buf, 4, deriv)); - ERR_I(StrPut(&buf, " sec/maxCurrent", ' ')); - if (maxCurrent>0.5) { - ERR_I(PutFloat(&buf, 4, maxCurrent)); - ERR_I(StrPut(&buf, " A", StrNONE)); - } else { - ERR_I(PutFloat(&buf, 4, maxCurrent*1000)); - ERR_I(StrPut(&buf, " mA", StrNONE)); - } - return 0; - OnError: - return -1; -} - -int SetMaxPower(void) { - /* static float p0; */ - static float lastCurrent, limCurrent, pold; - /* float plim; */ - - if (loop == 1) { - if (initMaxPower) { - ERR_P(LscCmd(ser, "CLIMIT?1>,,,iAmp,iRange")); - pold=0; - } else { - iRange=0; - } - if (iRange>0) { - lastCurrent=pow(2.0,iAmp-3)*pow(sqrt(10.0),iRange-5); - /* - p0=resist*pow(4.0,iAmp)*pow(10.0,iRange)/6.4e6*powFact; - plim=2500/resist*powFact; - pold=p0; - if (pold>plim) pold=plim; - */ - if (resist<1) resist=10; - limCurrent=50/resist; /* 50 V max. */ - if (limCurrent > lastCurrent) limCurrent=lastCurrent; - pold=limCurrent*limCurrent*resist; - } - CalcMaxPower(); - } else if (linearPower != 0) { - maxCurrent = 1; - maxPowerFlt = linearPower; - } else { - maxCurrent=10/resist; /* 10 V max. */ - if (maxCurrent>0.1) { - limCurrent=0.1; /* 0.1 A max. */ - } else { - limCurrent=maxCurrent; - } - maxPowerFlt=limCurrent*limCurrent*resist; - } - logfileOut(LOG_MAIN, "maxPower changed from %g to %g\n", pold, maxPowerFlt); - if (manual) { - cod1=3; - } else { - cod1=1; - } - ERR_P(LscCmd(ser, "CDISP 1:[loop],[resist],1;MOUT [loop]:0;CMODE [loop]:[cod1]")); - if (twoloops) { - ERR_P(LscCmd(ser, "CDISP 2:3,[resist],1;MOUT 2:0;CMODE 2:[cod1]")); - } - mout=0; - jRange=0; - if (slope<0) slope=-slope; - if (slope!=0 && slope<0.1) slope=0.1; - SetCtlSens(); - fbuf=FakeScale(ctlSens, (tLimit + tMaxLimit)*0.5); - if (loop==1) { - PidSumHdl(COC_RD, NULL, 0); - if (!initMaxPower && lastCurrent != maxCurrent && lastCurrent != 0) { - logfileOut(LOG_MAIN, "pid: %s\nlast %f max %f\n", pid, lastCurrent, maxCurrent); - prop=prop*lastCurrent/maxCurrent; - } - ERR_P(LscCmd(ser, "CLIMIT 1:[fbuf],[slope],0,[iAmp],[iRange];PID [loop],[prop]")); - if (twoloops) { - ERR_P(LscCmd(ser, "CLIMIT 2:[fbuf],[slope],0")); - } - } else { - ERR_P(LscCmd(ser, "CLIMIT 2:[fbuf],[slope],0")); - } - initMaxPower=0; - lastCurrent=maxCurrent; - pold=maxPowerFlt; - PidSumHdl(COC_RD, NULL, 0); - logfileOut(LOG_MAIN, "pid: %s\n", pid); - return 0; - OnError: return -1; -} - -int ConfigAlarms(float genLimit) { - int i, k; - SensorT *s; - - ERR_P(LscCmd(ser, "RELAY 1:1;BEEP:0")); - relay=0; - k=0; - for (i=0;i<4;i++) { - s=sensors[i]; - str_copy(buf1, s->ch); - if (s->customAlarm==0 && genLimit>0.0) s->alarm=genLimit; - if (s->present==1 && s->alarm>0) { - r1=FakeScale(s, s->alarm); - ERR_P(LscCmd(ser, "ALARM [buf1]:1,[unit],[r1],0,1,1")); - alarmList[k]=s->ch; - k++; - } else if (i != 4) { /* do not switch off A0 alarm */ - ERR_P(LscCmd(ser, "ALARM [buf1]:0")); /* switch off unused alarms */ - } - } - alarmListSize=k; - return 0; - OnError: return -1; -} - -int LoadFromLsc(void) { - ERR_P(LscCmd(ser, "PID?[loop]>prop,integ,deriv")); - ERR_P(LscCmd(ser, "RAMP?[loop]>,ramp")); - if (ctlSens != NULL) { - ramp *= ctlSens->scale; - } - ERR_P(LscCmd(ser, "ANALOG?1>,,,,,,fbuf")); - still=fbuf; - return 0; - OnError: return -1; -} - -int DisplayFmt(SensorT *s, SensorT *fields[], int *dispfld) { - if (s==NULL || s->present<=0 || s->typ=='h' || *dispfld>4) return 0; - if (s->typ == 'x') { - s->dispfmt='3'; - } else if (s->typ == 'f') { - s->dispfmt='4'; - } else { - if (s->scale == 1.0 || s->kink > 0.0) { - s->dispfmt='0' + unit; - } else { - s->dispfmt='4'; - } - } - s->dispfld=*dispfld; - fields[*dispfld]=s; - *dispfld=*dispfld+1; - /* logfileOut(LOG_MAIN, "display %d %c\n", *dispfld, s->dispfmt); */ - return 1; -} - -void AssignTypes(void) { - int i; - char typ; - SensorT *s; - - cryo.sensor1=NULL; - cryo.sensor2=NULL; - samp.sensor1=NULL; - samp.sensor2=NULL; - heliumSens=NULL; - auxSens=NULL; - testSens=NULL; - test2Sens=NULL; - for (i=0; i<4; i++) { - s=sensors[i]; - if (s->present==1) { - typ=s->typ; - if ('m'==typ) { - if (cryo.sensor2==NULL) cryo.sensor2=s; - cryo.sensor1=s; - } else if ('n'==typ) { - if (cryo.sensor1==NULL) cryo.sensor1=s; - cryo.sensor2=s; - } else if ('s'==typ) { - if (samp.sensor2==NULL) samp.sensor2=s; - samp.sensor1=s; - } else if ('l'==typ) { - if (samp.sensor1==NULL) samp.sensor1=s; - samp.sensor2=s; - } else if ('h'==typ) { - heliumSens=s; - } else if ('x'==typ || 'f'==typ) { - auxSens=s; - } else if ('t'==typ) { - testSens=s; - } else if ('k'==typ) { - test2Sens=s; - } - s->band=10; - } - } - if (cryo.sensor1==NULL) { - if (samp.sensor1==NULL) { - if (testSens==NULL) { - cryo.sensor1=test2Sens; - } else { - cryo.sensor1=testSens; - } - } else { - cryo.sensor1=samp.sensor1; - } - cryo.sensor2=cryo.sensor1; - } - if (samp.sensor1==NULL) { - samp.sensor1=cryo.sensor1; - samp.sensor2=cryo.sensor2; - } -} - -int Settings(void) { - char buf[256]; - SensorT *s; - SensorT *fields[8]; - char *cfg, *p; - int i,k,l; - - if (remoteMode!=2) { - remoteMode=2; /* set to remote mode */ - local=0; - ERR_I(LoadFromLsc()); - ERR_P(LscCmd(ser, "MODE:[remoteMode]")); - } else { - ERR_P(LscCmd(ser, "PID [loop],[prop],[integ],[deriv]")); - } - for (i=0; i<4; i++) { - s=sensors[i]; - if (i<4) { - plug=plugs[i/2]; - } else { - plug=&plug0; - } - if (s->present < 0) { - if (settingsFlag) return 0; - ERR_I(InstalCurve(s, plug->device)); - } - } - - AssignTypes(); - - if (settingsFlag) return 0; - - s=cryo.sensor1; - if (s!=NULL) { - ERR_I(SetMaxPower()); - } - - if (settingsFlag) return 0; - - str_copy(statusBuf, "alarms"); - ERR_I(ConfigAlarms(0.0)); - - if (settingsFlag) return 0; - - str_copy(statusBuf, "display"); - - /* display */ - k=1; - - DisplayFmt(cryo.sensor1, fields, &k); - if (samp.sensor1 != cryo.sensor1) { - DisplayFmt(samp.sensor1, fields, &k); - } - if (cryo.sensor2 != cryo.sensor1) { - DisplayFmt(cryo.sensor2, fields, &k); - } - if (samp.sensor2 != samp.sensor1 && samp.sensor2 != cryo.sensor2) { - DisplayFmt(samp.sensor2, fields, &k); - } - DisplayFmt(testSens, fields, &k); - DisplayFmt(test2Sens, fields, &k); - DisplayFmt(auxSens, fields, &k); - maxfld=k-1; - - /* fields 5-8 standard raw data */ - ERR_P(LscCmd(ser, "DISPFLD 5,A,3;DISPFLD 6,C,3;DISPFLD 7,B,3;DISPFLD 8,D,3")); - if (maxfld==0) { /* show raw data */ - ERR_P(LscCmd(ser, "DISPFLD 1,A,3;DISPFLD 2,C,3;DISPFLD 3,B,3;DISPFLD 4,D,3;DISPLAY:4")); - } else { - l=0; - for (k=1; k<=maxfld; k++) { - assert(l<128); - sprintf(buf+l, "DISPFLD %d,%s,%c;", k, fields[k]->ch, fields[k]->dispfmt); - l=strlen(buf); - } - str_append(buf, "DISPLAY:[maxfld]"); - ERR_P(LscCmd(ser, buf)); - } - if (config[0] != '\0') { /* obsolete */ - str_copy(buf, binDir); - str_append(buf, config); - cfg=str_read_file(buf); - if (cfg != NULL) { - logfileOut(LOG_MAIN, "load %s\n", config); - p=cfg; - while (p!=NULL) { - p=str_split(buf, p, '\n'); - ERR_P(LscCmd(ser, buf)); - } - FREE(cfg); - } - } - if (lscfg[0] != '\0') { - ERR_P(LscCmd(ser, lscfg)); - } - - if (settingsFlag) return 0; - str_copy(statusBuf, "reading temperatures"); - - if (cryo.sensor1!=NULL) { - ERR_I(SetTemp(2)); - } else { - ERR_I(ReadTemp()); - } - logTime=(rdTim / logPeriod + 2) * logPeriod; /* wait before logging "dirty" temperatures */ - return 0; - OnError: - return -1; -} - -int ConfigByCode(int plugNr) { - char buf[256], nam[16]; - int c1, c2; - char *p; - FILE *fil; - - plug=plugs[plugNr]; - if (autoconfig) { - str_copy(plug->device,""); - } - plug->devcmd=0; - ConcatDevice(); - if (plug->code==0) { - if (autoconfig) { - logfileOut(LOG_MAIN ,"reset inputs on plug%d\n", plugNr); - plug->sensor1->present=0; - plug->sensor2->present=0; - settingsFlag=1; - } else { - if (plugNr == 0) { - str_copy(devname0, "none"); - } else { - str_copy(devname1, "none"); - } - } - } else { - str_copy(buf, binDir); - str_append(buf, LSC_CODES); - ERR_SP(fil=fopen(buf, "r")); - p=fgets(buf, sizeof(buf), fil); - c1=0; c2=0; - while (p!=NULL && plug->code != c1 && plug->code != c2) { - if (*p != '#') { - c1=0; c2=0; - sscanf(buf, "%15s %d %d", nam, &c1, &c2); - } - p=fgets(buf, sizeof(buf), fil); - } - fclose(fil); - if (plug->code != c1 && plug->code != c2) { - logfileOut(LOG_MAIN+LOG_STAT ,"unknown code %d on plug%d\n", plug->code, plugNr); - return 0; - } else { - if (autoconfig) { - logfileOut(LOG_MAIN+LOG_STAT ,"configure plug%d for %s (code %d)\n", plugNr, nam, plug->code); - str_copy(buf, "'"); - str_append(buf, nam); - str_append(buf, "'"); - ERR_I(PrepInput(buf)); - settingsFlag=1; - } else { - logfileOut(LOG_MAIN+LOG_STAT ,"%s on plug%d (code %d)\n", nam, plugNr, plug->code); - if (plugNr == 0) { - str_copy(devname0, nam); - } else { - str_copy(devname1, nam); - } - } - } - } - return 0; - OnError: return -1; -} - -int ConfigByName(int plugNr) { - char buf[20]; - - plug=plugs[plugNr]; - plug->devcmd=1; - logfileOut(LOG_MAIN+LOG_STAT ,"configure plug%d for %s\n", plugNr, plug->device); - plug->sensor1->present=0; - plug->sensor2->present=0; - sprintf(buf, "'%s'", plug->device); - ERR_I(PrepInput(buf)); - settingsFlag=1; - return 0; - OnError: - plug->device[0]='\0'; - ConcatDevice(); - return -1; -} - -#define HISTSIZE 65 - -typedef struct { - int init; - float vals[HISTSIZE]; - float fore; - float weight; - float err; -} Hist; - -/* -static Hist fore, mFore; -*/ - -float forecast(Hist *h, float value, int tim, int nmax) { - int i, n, stp, ne; - float d1, d2, d, vmean, vsig, val, val1, fact, fact1; - float emean, esig, errLin, valLin; - - if (h->init == 0) { /* put a start value */ - h->init = 1; - for (i=0; ivals[i] = value; - } - h->err = value; - return value; - } - for (i=HISTSIZE-1; i>0; i--) { - h->vals[i] = h->vals[i-1]; - } - h->vals[0] = value; - h->err = value; - h->fore = 0; - errLin = value; - valLin = value; - for (stp = 1; stp*4 < HISTSIZE; stp *= 2) { - vmean = 0; - vsig = 0; - n = 0; - val1 = 0; - emean = 0; - esig = 0; - ne = 0; - for (i = 0; i < stp*nmax && i + 2 * stp < HISTSIZE; i += stp) { - d1 = h->vals[i+stp] - h->vals[i]; - d2 = h->vals[i+2*stp] - h->vals[i+stp]; - if (fabs(d2) > fabsf(d1) && d1 * d2 >= 0 && n >= 0) { - /* exponential extrapolation */ - fact = d1 / d2; - val = h->vals[i] - d1 * fact / (1 - fact); - if (n == 0) { - fact1 = fact; - val1 = val; - } - n++; - d = val - vmean; - vmean += d / n; - vsig += d * (val - vmean); - } else { - n = -1; /* exponential interpolation not possible */ - } - /* linear extrapolation */ - val = h->vals[i] - 2 * d1 * tim / stp; - ne++; - d = val - emean; - emean += d / ne; - esig += d * (val - emean); - val = h->vals[i]; - ne++; - d = val - emean; - emean += d / ne; - esig += d * (val - emean); - } - if (n > 1) { - vsig = sqrt(vsig / (n - 1)); - if (vsig < h->err) { - h->err = vsig; - h->fore = val1; - if (fact1 > 0.9) { - h->weight = (1 - fact1) / stp; - } else { - h->weight = 1 - pow(fact1, 1.0/stp); - } - } - } - esig = sqrt(esig / (ne - 1)); - if (esig < errLin) { - errLin = esig; - valLin = emean; - } - } - h->init = 1; - if (h->fore == 0) { - h->fore = valLin; - h->err = errLin; - h->init = -1; - h->weight = 1.0 / tim; - } - return h->fore; -} - -#define MAXTIMES 16 - -typedef struct { - int init; - int ntimes; - float period; - float mn[MAXTIMES]; - float mx[MAXTIMES]; - float upper; - float lower; -} Stat; - -static Stat mStat, sStat; - -void statInit(Stat *s, float mn, float mx) { - int i; - assert(mx >= mn); - for (i=1; i < MAXTIMES; i++) { - s->mn[i] = mn; - s->mx[i] = mx; - } -} - -void statCrop(Stat *s, float mn, float mx) { - int i; - float d; - - if (mn > s->upper) { - d = mn - s->upper; - for (i=1; i < MAXTIMES; i++) { - s->mx[i] += d; - } - } - if (mx < s->lower) { - d = mx - s->lower; - for (i=1; i < MAXTIMES; i++) { - s->mn[i] += d; - } - } -} - -void statBegin(Stat *s, float period, float value) { - s->ntimes = 0; - s->period = period; - s->mn[0] = value; - s->mx[0] = value; - if (s->init == 0) { /* put a start value */ - s->init = 1; - statInit(s, value*0.9, value*1.1); - } - s->lower = 0; - s->upper = 0; -} - -int statTime(Stat *s, float tim1, float tim2) { - float w1, w2, dif, mn, mx; - int i; - - i = s->ntimes; - assert(tim1 <= tim2); - assert(i < MAXTIMES-1); - - mn = s->mn[s->ntimes]; - mx = s->mx[s->ntimes]; - s->ntimes++; - i = s->ntimes; - s->upper = s->mx[i]; - s->lower = s->mn[i]; - if (tim1 <= 0) { - w1 = 1; - } else { - w1 = 1 - exp(-s->period / tim1); - } - if (tim2 <= 0) { - w2 = 1; - } else { - w2 = 1 - exp(-s->period / tim2); - } - dif = mx - s->mx[i]; - if (dif > 0) { - s->mx[i] += w1 * dif; - } else { - s->mx[i] += w2 * dif; - } - dif = mn - s->mn[i]; - if (dif < 0) { - s->mn[i] += w1 * dif; - } else { - s->mn[i] += w2 * dif; - } - return i; -} - -void statEnd(Stat *s) { - int i; - i = s->ntimes; - if (s->upper < s->mx[i]) { - s->upper = s->mx[i]; - } - if (s->lower > s->mn[i]) { - s->lower = s->mn[i]; - } -} - -typedef struct { - float slope; - float last; - float mx; - int wasmax; - time_t lastTim; -} Slope; - - -void maxSlope(Slope *s, float value) { - float d; - if (rdTim <= s->lastTim + per*0.0015) { - return; - } - s->wasmax = 0; - if (s->slope < 0) { - s->last = value; - s->lastTim = rdTim; - s->slope = 0; - } else { - d = (value - s->last) / (rdTim - s->lastTim); - s->slope = d; - if (fabsf(d) > s->mx) { - s->mx = fabsf(d); - s->wasmax = 1; - } - } - s->last = value; - s->lastTim = rdTim; -} - -static Slope slopeS, slopeU, slopeL; - -int PeriodicTask(void) { - char buf[256], lbuf[16]; - char *next, *alms; - int i, k, cnt; - float t, htr0, mstep, fdif, d, dif2, ml; - - static time_t finTime; - static int lastIntTim; - static float dif=0; - static float oldSet=0; - static float oldShift=0; - -/* - static float shiftTarget=0; -*/ - if (stickhtr < 0) { - ERR_P(LscCmd(ser, "DIOST?>cod1,out1;DOUT 3,29;BUSY?>busy")); - } else { - if (parallelhtr) { - out1 = 2; - } else { - out1 = 0; - } - if (stickhtr > 1) { - out1 |= stickhtr; - } - ERR_P(LscCmd(ser, "DOUT 3,[out1];BUSY?>busy")); - } - if ((plug0.codDefined && plug1.codDefined)) { - per=period; /* no timeout on above command and codes are defined: normal period */ - if (per>logPeriod*1000) per=logPeriod*1000; - } - if (noResp) { /* there was no response on an earlier command, or we are initializing */ - k=serialNo; /* check serial number */ - ERR_P(LscCmd(ser, "*IDN?>buf1,buf2,buf3,buf4")); - - /* decode firmware version date */ - i=0; - sscanf(buf4, "%d", &i); - i=i/100+(i%100+2000)*10000; - if (i>20900000) i-=1000000; /* 90..99 --> 1990-1999 */ - lscVersion=i; - - sscanf(buf3, "%d", &serialNo); - if (0!=strcmp(buf1, "LSCI") || 0!=strcmp(buf2, "MODEL340")) return 0; - if (k!=serialNo) { /* controller exchanged or we are initializing */ - logfileOut(LOG_MAIN, "serialNo: %d (was %d)\n", serialNo, k); - if (serialNo < 340000 || serialNo > 349999) { - serialNo=k; - } else if (k < 340000 || k > 349999) { - k=serialNo; - } - } - if (k!=serialNo) { /* controller exchanged or we are initializing */ - logfileOut(LOG_MAIN, "controller connected\n"); - set=0; - - /* reload curve cache: */ - if (cache!=NULL) FREE(cache); - sprintf(lbuf, "lsc.%d", serialNo); - str_copy(buf, logDir); - str_append(buf, lbuf); - cache=str_read_file(buf); - if (cache==NULL && 0==strcmp(ErrMessage, "file not found")) ERR_I(LoadCache()); - - /* get device names and last codes separated by '/' */ - str_split(buf, cache, '\n'); /* read 1 line */ - plug1.device[0]='\0'; - plug0.code=0; - plug1.code=0; - next=str_split(buf1, buf, '/'); - if (next!=NULL) { - next=str_split(buf2, next, '/'); - if (next!=NULL) { - next=str_split(buf3, next, '/'); - plug0.code=atoi(buf3); - plug0.codChanged=1; - if (next!=NULL) { - next=str_split(buf3, next, '\n'); - plug1.code=atoi(buf3); - plug1.codChanged=1; - } - } - } - if (buf1[0]=='*') { - str_copy(plug0.device, buf1+1); - plug0.codChanged=0; - ConfigByName(0); - if (autoconfig == 0) { - str_copy(devname0, plug0.device); - } - } else { - if (plug0.code!=0) str_copy(plug0.device, buf1); - plug0.devcmd=0; - if (autoconfig == 0) { - ConfigByName(0); - str_copy(devname0, plug0.device); - } - } - if (buf2[0]=='*') { - str_copy(plug1.device, buf2+1); - plug1.codChanged=0; - ConfigByName(1); - /* if (autoconfig == 0) ConfigByCode(1); */ - } else { - if (plug1.code!=0) str_copy(plug1.device, buf2); - plug1.devcmd=0; - if (autoconfig == 0) { - ConfigByName(1); - str_copy(devname1, plug1.device); - } - } - ConcatDevice(); - - settingsFlag=1; - } - noResp=0; - } - - ERR_I(ReadHeater(1)); - - if (alarmListSize!=0) { - buf[0]='\0'; - for (k=0;k=logTime) { - ERR_I(DataPutAll(NULL, rdTim)); - logTime=(rdTim / logPeriod + 1) * logPeriod; - if (rdTim>mmTime && (cryo.sensor1 != NULL)) LogMinMax(0); - } - if (set!=0 && remoteMode==2) { - t=ctlSens->t; - if (htr == 0.0 && mout < 0) { - mstep=0.2; - while (htr == 0 && mout < 0) { - mstep *= 2; - mout += mstep; - ERR_P(LscCmd(ser, "MOUT [loop],[mout]")); - ERR_I(ReadHeater(0)); - } - cnt=10; - while (htr >= 0.2 && cnt > 0) { - mout -= htr - 0.1; - htr0=htr; - if (mout > 0) mout=0; - ERR_P(LscCmd(ser, "MOUT [loop],[mout]")); - while (htr == htr0 && cnt > 0) { - ERR_I(ReadHeater(0)); - cnt--; - } - } - logfileOut(LOG_MAIN, "adjusted mout=%.2f\n", mout); - } - if (htr == 100.0 && mout > 0) { - mstep = 0.2; - while (htr == 100.0 && mout > 0) { - mstep *= 2; - mout -= mstep; - ERR_P(LscCmd(ser, "MOUT [loop],[mout]")); - ERR_I(ReadHeater(0)); - } - cnt=10; - while (htr <= 99.8 && cnt > 0) { - mout += 99.9 - htr; - htr0=htr; - if (mout < 0) mout=0; - ERR_P(LscCmd(ser, "MOUT [loop],[mout]")); - while (htr == htr0 && cnt > 0) { - ERR_I(ReadHeater(0)); - cnt--; - } - } - logfileOut(LOG_MAIN, "adjusted mout=%.2f\n", mout); - } - fdif=FakeScale(ctlSens, tr)-t; - fbuf=htr-mout-prop/6*fdif; /* value of integrator (assume deriv=0) */ - if ((fbuf > 99.8 && mout < 0 && fdif > 0) || - (fbuf < 0.2 && mout > 0 && fdif < 0)) { /* probably integrator overflow */ - if (lastIntTim > 0) { - mout += fdif*prop*integ/3000*(rdTim-lastIntTim); /* use mout for integral */ - if (mout < -100) mout=-100; - if (mout > 100) mout=100; - ERR_P(LscCmd(ser, "MOUT [loop],[mout]")); - } else { - logfileOut(LOG_MAIN, "possible integrator overflow, mout=%.2f\n", mout); - } - lastIntTim=rdTim; - } else { - if (lastIntTim>0) { - logfileOut(LOG_MAIN, "end integrator overflow mout=%.2f\n", mout); - lastIntTim=0; - } - } - ml = set/100; - if (ml == 0) ml = 1; - - statBegin(&mStat, per*0.001, TrueScale(ctlSens, ctlSens->t)); - statTime(&mStat, 10, 20); - statTime(&mStat, int2/16, int2/2); - statTime(&mStat, int2/1.5, int2+10); - statEnd(&mStat); - - statBegin(&sStat, per*0.001, samp.temp); - statTime(&sStat, 10, 20); - statEnd(&sStat); - - maxSlope(&slopeS, samp.temp); - maxSlope(&slopeU, mStat.upper); - maxSlope(&slopeL, mStat.lower); - - /* statBegin(&sStat, maxShift*0.01, per*0.001, samp.temp); */ - - d = set - samp.temp; - shiftLow = mStat.lower - sStat.upper; - shiftUp = mStat.upper - sStat.lower; - if (cryo.sensor1!=samp.sensor1 && doubleControl) { - dif2 = d - dif; - if (oldSet == 0) oldSet = samp.temp; - if (oldSet != set || fabsf(d) > 50*ml) { - if (oldSet != set) { - float f = fabsf((oldSet - set)/ (oldSet + set)); - oldShift *= exp(-f*f*25); - tShift = oldShift; - statCrop(&mStat, sStat.lower+tShift, sStat.upper+tShift); - state = 1; - } else { - state = 0; - } - finTime = rdTim + int2 + 30; - slopeS.mx = -1; - slopeU.mx = -1; - slopeL.mx = -1; - } - if (ramping) { - /* do not change tShift when ramping */ - } else if (rdTim < finTime) { - if (slopeS.wasmax) { - finTime = rdTim + int2 + 30; - } - if (fabs(slopeS.slope) > slopeS.mx * 0.2 - && finTime < rdTim + per * 0.0035) { - finTime = rdTim + per * 0.0035; - } - if (d > 0) { - tShift = oldShift + propUp * d; - } else { - tShift = oldShift + propDown * d; - } - } else { - if (state != 2) { - /* tShift = oldShift; */ - state = 2; - statCrop(&mStat, sStat.lower+tShift, sStat.upper+tShift); - } else { - if (shiftLow > tShift) { - tShift = shiftLow; - oldShift = tShift; - } else if (shiftUp < tShift) { - tShift = shiftUp; - oldShift = tShift; - } - } - } - if (tShift > ml * maxShift) { - tShift = ml * maxShift; - } else if (tShift < -ml * maxShift) { - tShift = - ml * maxShift; - } - dif = d; - ERR_I(SetTemp(0)); - } else { - ERR_I(SetTemp(0)); - } - } else { - oldShift = 0; - } - oldSet = set; - - if (stickhtr < 0) { - ERR_P(LscCmd(ser, "KEYST?>key;DIOST?>cod2,out2;DOUT 3,30")); - } else { - ERR_P(LscCmd(ser, "KEYST?>key")); - if (stickhtr == 1) { - d = set - samp.temp; - if (parallelhtr) { - if (d < stickhtroff) { - parallelhtr = 0; - } - } else if (d > stickhtron) { - parallelhtr=1; - } - } - } - if (busy==0) { - if (stickhtr < 0) { - if (out1!=30) { - ERR_P(LscCmd(ser, "DOUT:3,30")); - ERR_P(LscCmd(ser, "DIOST?>cod1,out1")); - } - if (out2!=29) { - ERR_P(LscCmd(ser, "DOUT:3,29")); - ERR_P(LscCmd(ser, "DIOST?>cod2,out2;DOUT 3,30")); - } - } else { - out1=0; - out2=0; - } - - if (out1==30 && out2==29) { - /* code conversion */ - plug0.code1=3*decod[cod2 % 8] ^ 2*decod[cod1 % 8]; /* ^ is exclusive OR */ - plug1.code1=-(3*decod[cod2 / 8] ^ 2*decod[cod1 / 8]); - for (i=0; i<2; i++) { - plug=plugs[i]; - if (plug->code1!=plug->code) { /* code has changed -> wait for a confirmation */ - if (plug->code1!=plug->code2) { - plug->code2=plug->code1; - } else { - plug->code=plug->code1; - plug->codChanged=1; - } - } else { - plug->code2=plug->code; - if (plug->codChanged) { /* code change confirmed */ - plug->codChanged=0; - if (plug->code1==0) { - logfileOut(LOG_MAIN, "plug%d unplugged\n", i); - str_copy(plug->descr,"unplugged"); - } else { - logfileOut(LOG_MAIN, "plugged %d on plug%d\n", plug->code1, i); - } - set=0; - ERR_I(ConfigByCode(i)); - } - plug->codDefined=1; - } - } - } - } - - if (key!=0) { - ERR_P(LscCmd(ser, "MODE?>remoteMode")); - local = (remoteMode == 1); - if (!touched) { - touched=1; - logfileOut(LOG_MAIN ,"user touched keys\n"); - } - if (remoteMode==2) { - logfileOut(LOG_MAIN ,"user switched to remote\n"); - touched=0; - ERR_I(LoadFromLsc()); - if (doubleControl) { - ERR_P(LscCmd(ser, "RANGE?>iRange")); - if (iRange==0) set=0; - } else { - ERR_P(LscCmd(ser, "RAMP?[loop]>,ramp")); - ERR_P(LscCmd(ser, "RANGE?>iRange;CSET?[loop]>,cod1,;SETP?[loop]>fbuf")); - if (ctlSens!=NULL) { - set=TrueScale(ctlSens,fbuf); - } else { - set=0; - } - if (cod1!=1) { - set=0; - logfileOut(LOG_MAIN, "set point was not in K, set to 0\n"); - } - } - settingsFlag=1; - jRange=iRange; - } - } - - if (saveTime!=0 && tim>saveTime) { - ERR_P(LscCmd(ser, "CRVSAV;BUSY?>busy")); - while (!busy) { - IdleHdl(200, 0); /* wait 200 ms */ - ERR_P(LscCmd(ser, "BUSY?>busy")); - } - saveTime=0; - } - return 0; - OnError: return -1; -} - -int DeviceHdl(int mode, void *base, int fd) { - char *t; - int do0, do1; - - if (mode==COC_WR) { - set=0; - t=strchr(device, '/'); - if (t==NULL) { - if (0==strcmp(device, "0") || 0==strcasecmp(device, "auto")) { - ERR_I(ConfigByCode(0)); - ERR_I(ConfigByCode(1)); - } else { - str_copy(plug0.device, device); - str_copy(plug1.device, device); - ERR_I(ConfigByName(0)); - ERR_I(ConfigByName(1)); - } - } else { - do0=0; - do1=0; - if (t!=device) { - *t='\0'; - str_copy(plug0.device, device); - *t='/'; - do0=1; - } - t++; - if (*t!='\0') { - str_copy(plug1.device, t); - do1=1; - } - if (do0) ERR_I(ConfigByName(0)); - if (do1) ERR_I(ConfigByName(1)); - } - ConcatDevice(); - } - return 0; - OnError: return -1; -} - -int PidHdl(int mode, void *base, int fd) { - char oldpid[128]; - - if (mode==COC_WR) { - return COC_DWR; - } else if (mode==COC_DWR) { - assert(sizeof oldpid == sizeof pid); - strcpy(oldpid, pid); - PidSumHdl(COC_RD, base, fd); - if (strcmp(oldpid, pid) != 0) { - ERR_P(LscCmd(ser,"PID [loop]:[prop],[integ],[deriv]")); - logfileOut(LOG_MAIN, "pid: %s\n", pid); - } - } - return 0; - OnError: return -1; -} - -int AlarmHdl(int mode, void *base, int fd) { - if (mode==COC_WR) { - return COC_DWR; - } else if (mode==COC_DWR) { - ERR_I(ConfigAlarms(0.0)); - } - return 0; - OnError: return -1; -} - -int TLimitHdl(int mode, void *base, int fd) { - if (mode==COC_WR) { - if (tLimit>tMaxLimit) tLimit=tMaxLimit; - return COC_DWR; - } else if (mode==COC_DWR) { - ERR_I(ConfigAlarms(tLimit)); - ERR_I(SetMaxPower()); - } - return 0; - OnError: return -1; -} - -int SwapHdl(int mode, void *base, int fd) { - static char swp; - static SensorT *s1, *s2; - - if (mode==COC_WR) { - if (strlen(swap) != 2) ERR_MSG("must be 2 letters"); - str_lowcase(swap, swap); - s1 = findSensor(swap[0]); - s2 = findSensor(swap[1]); - if (s1 == NULL || s2 == NULL) { - ERR_MSG("no such sensor(s)"); - } - if (s1 == s2) { - return 0; - } - return COC_DWR; - } else if (mode==COC_DWR) { - swp = s1->typ; - s2->typ = s1->typ; - s1->typ = swp; - AssignTypes(); - } - return 0; - OnError: return -1; -} - -int SetPower(float setpower) { - float htr1, htr0; - int cnt; - - logfileOut(LOG_MAIN,"SetPower\n"); - if (setpower<0) return 0; - if (setpower>maxPowerFlt) setpower=maxPowerFlt; - if (setpower<0) setpower=0; - mout=Power2Percent(setpower); - if (mout>100) mout=100; - if (!manual && set == 0 && setpower > 0) { - ERR_P(LscCmd(ser, "RANGE:[iRange]")); - manual=1; - } - ERR_P(LscCmd(ser, "CMODE [loop]:3;MOUT [loop],[mout]")); /* set to open loop */ - if (manual) return 0; - ERR_I(ReadHeater(0)); - ERR_P(LscCmd(ser, "RANGE:0")); - htr0=htr; - ERR_P(LscCmd(ser, "CMODE [loop]:1")); /* pid control*/ - ERR_P(LscCmd(ser, "RANGE:[iRange]")); - ERR_I(ReadHeater(0)); - cnt=20; - htr1=htr; - while (htr1==htr && cnt>0) { /* wait for heater change */ - ERR_I(ReadHeater(0)); - cnt--; - } - if (htr != htr0) { - mout=0; - cnt=10; - while (cnt>0) { - mout+=htr0-htr; - if (mout > 100) mout=100; - if (mout < -100) mout =-100; - ERR_P(LscCmd(ser, "MOUT [loop],[mout]")); - ERR_I(ReadHeater(0)); - cnt--; - } - } - power=Percent2Power(htr); - logfileOut(LOG_MAIN, "power: %5f (tried %5f), mout %.1f\n", power, setpower, mout); - return 0; - OnError: return -1; -} - -int AlarmReset(void) { - if (relay) { - ERR_P(LscCmd(ser, "RELAY 1:2,1")); - if (alarmHistory[0]=='\0') { - str_copy(alarmHistory, "X"); - } - } else { - alarmHistory[0]='\0'; - alarmStatus[0]='\0'; - ERR_P(LscCmd(ser, "ALMRST;RELAY 1:1")); - logfileOut(LOG_MAIN, "reset alarms\n"); - relay0=0; - lockAlarm=0; - } - OnError: return -1; -} - -int SetHdl(int mode, void *base, int fd) { - if (mode==COC_WR) { - if (remoteMode!=2) { - ERR_MSG("controller is in local mode, enter 'remote' first"); - } - if (relay && set!=0) { - if (alarmChannels[0]!='\0') { - ERR_MSG("alarm is active, set prohibited"); - } else { - ERR_MSG("alarm was active, enter 'reset' first"); - } - } else if (set<=0) { - set=0; - } else if (set>tLimit) { - set=0; - ERR_MSG("set point too high"); - } - return COC_DWR; - } else if (mode==COC_DWR) { - if (manual) { - manual=0; - mout=0; - ERR_P(LscCmd(ser, "CMODE [loop],1;MOUT [loop],0")); - } - if (cryo.sensor1!=NULL && remoteMode==2) { - ERR_I(SetTemp(1)); - } - } - return 0; - OnError: return -1; -} - -int ControlModeHdl(int mode, void *base, int fd) { - if (mode==COC_WR) { - if (controlMode == 1) { - controlSensor[0]='1'; - } else { - controlSensor[0]='0'; - } - if (controlMode >= 2) { - doubleControl = 1; - controlMode = 2; - } else { - doubleControl = 0; - if (controlMode < 0) { - controlMode = 0; - } - } - } - return SetHdl(mode, base, fd); -} - -int MaxPowerHdl(int mode, void *base, int fd) { - static float setpower; - if (mode==COC_WR) { - if (loop!=1) return COC_DWR; - setpower=power; - sscanf(maxPower, "%f", &maxPowerFlt); - CalcMaxPower(); - if (remoteMode!=2) { - ERR_MSG("controller is in local mode, enter 'remote' first"); - } else if (relay) { - if (alarmChannels[0]!='\0') { - ERR_MSG("alarm is active, maxPower prohibited"); - } else { - ERR_MSG("alarm was active, enter 'reset' first"); - } - } - return COC_DWR; - } else if (mode==COC_DWR && remoteMode==2) { - ERR_I(SetMaxPower()); - if (maxCurrent>0 && loop==1) { - ERR_I(SetPower(setpower)); - } - } - return 0; - OnError: return -1; -} - -int PowerHdl(int mode, void *base, int fd) { - static float setpower=0; - float htr1, diff; - if (mode==COC_WR) { - if (power>maxPowerFlt) power=maxPowerFlt; - htr1=Power2Percent(power); - diff=htr1-htr; - if (mout+diff>100) { - diff=100-mout; - htr+=diff; - power=Percent2Power(htr); - } else if (mout+diff<-100) { - diff=-100-mout; - htr+=diff; - power=Percent2Power(htr); - } - if (power<0) power=0; - setpower=power; - return COC_DWR; - } else if (mode==COC_DWR && maxCurrent>0) { - ERR_I(SetPower(setpower)); - } - return 0; - OnError: return -1; -} - -int ManualHdl(int mode, void *base, int fd) { - if (mode == COC_DWR && maxCurrent>0) { - if (manual == 0 && ctlSens != NULL) { - set=TrueScale(ctlSens, ctlSens->t); - } - } - return PowerHdl(mode, base, fd); -} - -int MoutHdl(int mode, void *base, int fd) { - if (mode==COC_WR) { - return COC_DWR; - } else if (mode==COC_DWR) { - ERR_P(LscCmd(ser, "MOUT [loop],[mout]")); - } - return 0; - OnError: return -1; -} - - -int StillHdl(int mode, void *base, int fd) { - if (mode==COC_WR) { - return COC_DWR; - } else if (mode==COC_DWR) { - fbuf=still; - ERR_P(LscCmd(ser,"ANALOG 1:1,2,,,,,[fbuf]")); - } - return 0; - OnError: return -1; -} - -int SendHdl(int mode, void *base, int fd) { - char *res; - ClientData *data; - - if (mode==COC_WR) { - return COC_DRD; - } else if (mode==COC_DRD) { - data=base; - if (NULL!=strchr(data->cmd, '>') || NULL!=strchr(data->cmd, '[')) - ERR_MSG("no variables allowed"); - ERR_P(res=LscCmd(ser, data->cmd)); - str_copy(data->cmd, res); - } - return 0; - OnError: return -1; -} - -int LogHdl(int mode, void *base, int fd) { - ClientData *data; - - if (mode==COC_RD) { - data=base; - if (data->logstart != 0) { - data->logpos = logfilePos(data->logstart); - data->logstart = 0; - } - data->logpos=logfileGetLines(data->logpos, 25, data->logline, sizeof(data->logline)); - } - return 0; -} - -int PltHdl(int mode, void *base, int fd) { - if (mode==COC_RD) { - ERR_MSG("Tecs client version not up to date"); - } - return 0; - OnError: return -1; -} - -int GraHdl(int mode, void *base, int fd) { - int l; - char names[64]; - long startTime, endTime, step; - - if (mode==COC_RD) { - ERR_SI(sscanf(grapar, "%ld %ld %ld %n", &startTime, &endTime, &step, &l)-2); - str_copy(names, grapar+l); - ERR_I(l=DataGetMult(names, startTime, endTime, step, 30, gradata, sizeof(gradata)/sizeof(float))); - assert(l*sizeof(float)present!=1) return 0; - ERR_I(StrPut(buf, "\n ", ' ')); - ERR_I(StrPut(buf, s->ch, ':')); - ERR_I(StrPut(buf, "", ' ')); - if (s->readStat==0) { - if (s->t==0) { - ERR_I(StrPut(buf, "not yet read", StrNONE)); - } else { - ERR_I(StrPut(buf, name, '=')); - ERR_I(PutFloat(buf, 5, TrueScale(s, s->t))); - ERR_I(StrPut(buf, " ", StrNONE)); - ERR_I(StrPut(buf, units, StrNONE)); - } - } else { - ERR_I(StrPut(buf, LscReadStat(s->readStat), StrNONE)); - } - if (s==ctlSens && !manual) { - ERR_I(StrPut(buf, ", setpoint", '=')); - if (tr==DATA_UNDEF) { - ERR_I(PutFloat(buf, 5, 0.0)); - } else { - ERR_I(PutFloat(buf, 5, tr)); - } - ERR_I(StrPut(buf, " ", StrNONE)); - ERR_I(StrPut(buf, units, StrNONE)); - } - if (s->lim > 0 && lim!=0) { - ERR_I(StrPut(buf, ", for T", lim)); - ERR_I(PutFloat(buf, 5, s->lim)); - } - return 0; - OnError: return -1; -} - -int ErrorHdl(int mode, void *base, int fd) { - error[0]='\0'; - if (noResp==3) { - snprintf(error, sizeof(error), "no connection or controller switched off"); - } else if (statusBuf[0] != '\0') { - snprintf(error, sizeof(error), "configuring: %s", statusBuf); - } else if (device[0] == '\0') { - snprintf(error, sizeof(error), "no device selected"); - } - return 0; -} - -int StatusHdl(int mode, void *base, int fd) { - int i; - StrBuf buf; - float tM, tS; - char pendAct[256]; - char *p; - - readTemp=1; - StrLink(&buf, status); - StrClear(&buf); - ERR_I(StrPut(&buf, "\n", StrNONE)); - ErrorHdl(mode, base, fd); - if (error[0] != '\0') { - ERR_I(StrPut(&buf, error, StrNONE)); - goto EndStatus; - } - CocShowHandlers(pendAct, sizeof(pendAct)); - if (pendAct[0]!='\0') { - if (mode==COC_RD) { - return COC_DRD; - } else { - ERR_I(StrPut(&buf, "pending action(s):", ' ')); - ERR_I(StrPut(&buf, pendAct, StrNONE)); - goto EndStatus; - } - } - if (remoteMode==1) { - ERR_I(StrPut(&buf, "LOCAL mode, enter 'remote' to enable remote control", '\n')); - } - ERR_I(StrPut(&buf, "device:", ' ')); - p=strchr(device, '/'); - if (p!=NULL) { - *p='\0'; - ERR_I(StrPut(&buf, device, ' ')); - *p='/'; p++; - } else { - ERR_I(StrPut(&buf, device, ' ')); - } - ERR_I(StrPut(&buf, plug0.descr, StrNONE)); - if (plug0.devcmd) { - ERR_I(StrPut(&buf, " ", '*')); - } - if (p!=NULL) { - ERR_I(StrPut(&buf, "\n ", ' ')); - ERR_I(StrPut(&buf, p, ' ')); - ERR_I(StrPut(&buf, plug1.descr, StrNONE)); - if (plug1.devcmd) { - ERR_I(StrPut(&buf, " ", '*')); - } - } - if (set==0) { - ERR_I(StrPut(&buf, "\nheater off,",' ')); - } else { - if (manual) { - ERR_I(StrPut(&buf, "\nmanual power,", ' ')); - } else { - ERR_I(StrPut(&buf, "\ntarget", '=')); - ERR_I(PutFloat(&buf, 5, set)); - if (ramp==0 || tr==TrueScale(ctlSens, setH)) { - ERR_I(StrPut(&buf, " K,", ' ')); - } else { - ERR_I(StrPut(&buf, " K ramping at", ' ')); - ERR_I(PutFloat(&buf, 4, ramp)); - ERR_I(StrPut(&buf, " K/min,", ' ')); - } - } - } - if (relay) { - if (alarmChannels[0]!='\0') { - ERR_I(StrPut(&buf, "alarm on channel",' ')); - ERR_I(StrPut(&buf, alarmChannels, StrNONE)); - } else if (alarmHistory[0]!='\0') { - ERR_I(StrPut(&buf, "alarm was on channel", ' ')); - ERR_I(StrPut(&buf, alarmHistory, ',')); - ERR_I(StrPut(&buf, " (enter 'reset' to confirm)", StrNONE)); - } else { - ERR_I(StrPut(&buf, "alarm",' ')); - } - } else if (htrst!=0) { - ERR_I(StrPut(&buf, LscHtrStat(htrst), StrNONE)); - } else { - if (power!=DATA_UNDEF) { - ERR_I(StrPut(&buf, "htr power", '=')); - if (power>=0.5) { - ERR_I(PutFloat(&buf, 3, power)); - ERR_I(StrPut(&buf, " W, htr current", '=')); - } else { - ERR_I(PutFloat(&buf, 3, power*1000)); - ERR_I(StrPut(&buf, " mW, htr current", '=')); - } - ERR_I(PutFloat(&buf, 4, htr)); - ERR_I(StrPut(&buf, "% ", '(')); - ERR_I(PutFloat(&buf, 4, sqrt(power/resist))); - ERR_I(StrPut(&buf, " A", ')')); - } else { - ERR_I(StrPut(&buf, "set=0", StrNONE)); - } - } - tM=0; tS=0; - if (cryo.sensor1!=NULL) { - if (cryo.sensor1!=samp.sensor1) { - ERR_I(StrPut(&buf, "\nheat exchanger", ':')); - if (cryo.sensor2!=cryo.sensor1) { - ERR_I(StrPut(&buf, " T", '=')); - ERR_I(PutFloat(&buf, 4, cryo.temp)); - ERR_I(StrPut(&buf, " ", 'K')); - ERR_I(ShowSensor(&buf, cryo.sensor1, "T", "K", '>')); - } - ERR_I(ShowSensor(&buf, cryo.sensor2, "T", "K", '<')); - ERR_I(StrPut(&buf, "\nsample:", ' ')); - } - if (samp.sensor2!=samp.sensor1) { - ERR_I(StrPut(&buf, " T", '=')); - ERR_I(PutFloat(&buf, 4, samp.temp)); - ERR_I(StrPut(&buf, " ", 'K')); - ERR_I(ShowSensor(&buf, samp.sensor1, "T", "K", '>')); - } - ERR_I(ShowSensor(&buf, samp.sensor2, "T", "K", '<')); - } - if (testSens!=NULL || test2Sens!=NULL) { - ERR_I(StrPut(&buf, "\ntest", ':')); - } - if (testSens!=NULL) { - ERR_I(ShowSensor(&buf, testSens, "T", "K", 0)); - } - if (test2Sens!=NULL) { - ERR_I(ShowSensor(&buf, test2Sens, "T", "K", 0)); - } - for (i=5; i<4; i++) { - ERR_I(ShowSensor(&buf, sensors[i], "T", "K", 0)); - } - if (auxSens!=NULL) { - ERR_I(StrPut(&buf, "\nauxilliary", ':')); - ERR_I(ShowSensor(&buf, auxSens, "U", "V", 0)); - } - if (heliumSens!=NULL) { - ERR_I(StrPut(&buf, "\nhelium:", ' ')); - ERR_I(StrPut(&buf, helium, StrNONE)); - } - if (still!=0) { - ERR_I(StrPut(&buf, "\nstill:", ' ')); - ERR_I(PutFloat(&buf, 1, still)); - ERR_I(StrPut(&buf, " mW", ' ')); - } -EndStatus: - ERR_I(StrPut(&buf, "", '\0')); - return 0; - OnError: - return -1; -} - -int DevHelpHdl(int mode, void *base, int fd) { - char nbuf[256]; - char *list; - - str_copy(nbuf, binDir); - str_append(nbuf, DEV_LIST); - ERR_P(list=str_read_file(nbuf)); - str_copy(devHelp, list); - FREE(list); - return 0; - OnError: return -1; -} - -int UpdateHdl(int mode, void *base, int fd) { - char cmd[128]; - if (mode==COC_WR) { - return COC_DRD; - } else if (mode==COC_DRD) { - str_copy(cmd, "tecsinstall "); - str_lowcase(update, update); - str_append(cmd, update); - str_append(cmd, " "); - if (NULL==strstr(" cfg server sync ", cmd+11)) { - str_copy(update, "unknown"); - } else { - system(cmd); - } - } - return 0; -} - -int RemoteHdl(int mode, void *base, int fd) { - if (mode==COC_WR) { - return COC_DWR; - } else if (mode==COC_DWR) { - ERR_P(LscCmd(ser, "MODE:[remoteMode]")); - } - return 0; - OnError: return -1; -} - -int LocalHdl(int mode, void *base, int fd) { - if (mode==COC_RD) { - local = (remoteMode == 1); - return 0; - } else if (mode==COC_WR) { - remoteMode = 1 + (local == 0); - return RemoteHdl(mode, base, fd); - } else if (mode==COC_DWR) { - return RemoteHdl(mode, base, fd); - } - return 0; -} - -int RelayHdl(int mode, void *base, int fd) { - if (mode==COC_WR) { - if (alarmChannels[0]!='\0') ERR_MSG("alarm is still active"); - return COC_DWR; - } else if (mode==COC_DWR) { - ERR_I(AlarmReset()); - set = 0; - } - return 0; - OnError: return -1; -} - -int TmoHdl(int mode, void *base, int fd) { - if (mode==COC_WR) { - ERR_I(SerSetTmo(ser, msecTmo)); - } - return 0; - OnError: return -1; -} - -int LogfileHdl(int mode, void *base, int fd) { - char buf[256]; - if (mode==COC_WR) { - logfileClose(); - str_copy(buf, logDir); - str_append(buf, serverId); - logfile=logfileInit(buf, logIt, use_stdout, logIt && use_stdout); - CocDefStr(logfile, COC_RDONLY); - } - return 0; -} - -int ExecuteRequest(void) { - if (readTemp) ERR_I(ReadTemp()); - ERR_I(CocCallHandlers()); - while (settingsFlag==1) { - settingsFlag=0; - ERR_I(Settings()); - } - statusBuf[0]='\0'; - return 0; - OnError: - return -1; -} - -int MainBody(void) { - int iret, tdif; - - logfileWrite(logMask); - - while (!quit) { - tdif = per - mycMsecSince(tim0); - if (tdif<0) { tim = mycNow(); break; } /* timeout */ - ERR_I(iret=CocHandleRequests(tdif, 0)); - tim=mycNow(); - if (iret==0) { /* timeout */ - break; - } - if (ser!=NULL) { - ERR_I(ExecuteRequest()); - } - logfileWrite(logMask); - } - tdif = mycMsecSince(tim0); - if (tdif>60000 && cntError < 2) { - logfileOut(LOG_MAIN ,"%d seconds lost\n", tdif/1000); - } - tim0 = mycMsecSince(0)/period*period; - - if (ser!=NULL) { - ERR_I(PeriodicTask()); - ERR_I(ExecuteRequest()); - } - - return 0; - OnError: - if (0==strcmp(ErrMessage, "timeout")) { - if (noResp==2) { /* this is the second time we have no response */ - per=1000; /* 1 sec */ - cryo.temp=0; - samp.temp=0; - noResp=3; - } else if (noResp < 2) { - logfileShowErr("no response"); - logfileOut(LOG_ALL ,"no response\n"); - noResp=2; - per=100; /* try again soon */ - } - return 0; - } - return -1; -} - -int main(int argc, char *argv[]) { - int i, iret; - char *inistr; - char buf[256], opt; - - signal(SIGPIPE, ignore_forever); - -#define RD COC_RDONLY -#define RW COC_RDWR -#define RA COC_RDWRALL - - CocDefStruct(cryo, Testpoint); - CocDefStruct(samp, Testpoint); - - CocDefPtr(tpoint, Testpoint); - CocFltFld(Testpoint, temp, RD); - CocFltFld(Testpoint, t1, RD); - CocFltFld(Testpoint, t2, RD); - - CocDefStruct(sensA, SensorT); - CocDefStruct(sensB, SensorT); - CocDefStruct(sensC, SensorT); - CocDefStruct(sensD, SensorT); - - CocDefPtr(sens, SensorT); - CocFltFld(SensorT, t, RD); - CocFltFld(SensorT, t0, RD); - CocFltFld(SensorT, t1, RD); - CocFltFld(SensorT, t2, RD); - CocFltFld(SensorT, lim, RW); - CocFltFld(SensorT, scale, RD); - CocFltFld(SensorT, kink, RD); - CocFltFld(SensorT, alarm, RW); CocHdl(AlarmHdl); - CocIntFld(SensorT, readStat, RD); - CocIntFld(SensorT, stat1, RD); - CocIntFld(SensorT, stat2, RD); - CocIntFld(SensorT, dispfld, RD); - CocStrFld(SensorT, ch, RD); - CocStrFld(SensorT, curve, RD); - CocStrFld(SensorT, type, RD); - - CocDefStr(maxPower, RW); CocHdl(MaxPowerHdl); - CocDefFlt(maxPowerFlt, RD); - CocDefFlt(slope, RW); CocHdl(MaxPowerHdl); - CocDefFlt(prop, RW); CocHdl(PidHdl); - CocDefFlt(integ, RW); CocHdl(PidHdl); - CocDefFlt(deriv, RW); CocHdl(PidHdl); - CocDefFlt(set, RW); CocHdl(SetHdl); - CocDefFlt(set2, RW); CocHdl(SetHdl); - CocDefFlt(ramp, RW); CocHdl(SetHdl); - CocDefFlt(still, RW); CocHdl(StillHdl); - CocDefFlt(power, RW); CocHdl(PowerHdl); - CocDefFlt(power2, RD); - CocDefFlt(mout, RW); CocHdl(MoutHdl); - CocDefFlt(tLimit, RW); CocHdl(TLimitHdl); - CocDefFlt(tMaxLimit, RD); - CocDefFlt(maxCurrent, RD); - CocDefFlt(smooth, RW); - CocDefFlt(powFact, RW); - CocDefFlt(resist, RD); - CocDefFlt(htr, RD); - CocDefFlt(setH, RD); - CocDefFlt(full, RW); - CocDefFlt(empty, RW); - CocDefFlt(int2, RW); - CocDefFlt(propUp, RW); - CocDefFlt(propDown, RW); - CocDefFlt(maxShift, RW); - CocDefFlt(tm, RD); - CocDefFlt(ts, RD); - CocDefFlt(tr, RD); - CocDefFlt(tx, RD); - CocDefFlt(te, RD); - CocDefFlt(tk, RD); - CocDefFlt(aux, RD); - CocDefFlt(he, RD); - CocDefFlt(fbuf, RD); - CocDefFlt(r1, RD); - CocDefFlt(r2, RD); - CocDefFlt(tShift, RW); - CocDefFlt(linearPower, RW); - CocDefFlt(maxpower2, RW); - CocDefFlt(scanChan, RW); - - CocDefFlt(shiftUp, RW); - CocDefFlt(shiftLow, RW); - CocDefFlt(state, RW); - - CocDefPtr(clData, ClientData); - CocStrFld(ClientData, cmd, RW); CocHdl(SendHdl); - CocIntFld(ClientData, logstart, RA); - CocStrFld(ClientData, logline, RA); CocHdl(LogHdl); - - CocAlias(send, clData.cmd); - CocAlias(logstart, clData.logstart); - CocAlias(logline, clData.logline); - - CocDefStr(device, RW); CocHdl(DeviceHdl); - CocDefStr(buf1, RD); - CocDefStr(buf2, RD); - CocDefStr(buf3, RD); - CocDefStr(buf4, RD); - CocDefStr(head, RD); - CocDefStr(chan, RD); - CocDefStr(helium, RD); - CocDefStr(heUnits, RD); - CocDefStr(intype, RD); - CocDefStr(error, RD); CocHdl(ErrorHdl); - CocDefStr(status, RD); CocHdl(StatusHdl); - CocDefStr(pid, RD); CocHdl(PidSumHdl); - CocDefStr(config, RD); - CocDefStr(swap, RW); CocHdl(SwapHdl); - CocDefStr(dev, RD); - CocDefStr(devHelp, RD); CocHdl(DevHelpHdl); - CocDefStr(update, RW); CocHdl(UpdateHdl); - CocDefStr(lscfg, RD); - CocDefStr(ttp, RD); - CocDefStr(alarmChannels, RD); - CocDefStr(alarmHistory, RD); - - CocDefInt(cod1, RD); - CocDefInt(cod2, RD); - CocDefInt(out1, RD); - CocDefInt(out2, RD); - CocDefInt(num, RD); - CocDefInt(key, RD); - CocDefInt(maxfld, RD); - CocDefInt(iAmp, RD); - CocDefInt(iRange, RD); - CocDefInt(jRange, RD); - CocDefInt(remoteMode, RW); CocHdl(RemoteHdl); - CocDefInt(local, RW); CocHdl(LocalHdl); - CocDefInt(relay, RW); CocHdl(RelayHdl); - CocDefInt(manual, RW); CocHdl(ManualHdl); - CocDefInt(htrst, RD); - CocDefInt(loop, RW); - CocDefInt(twoloops, RW); - CocDefInt(rdTim, RD); - CocDefInt(tim0, RD); - CocDefInt(ibuf, RD); - CocDefInt(autoconfig, RW); - CocDefInt(ramping, RD); - - CocDefInt(logMask, RW); - CocDefInt(logPeriod, RW); - CocDefInt(readTemp, RW); - CocDefInt(controlMode, RW); CocHdl(ControlModeHdl); - CocDefInt(busy, RD); - CocDefInt(serialNo, RD); - CocDefInt(quit, RW); - CocDefInt(stickhtr, RW); - CocDefInt(parallelhtr, RW); - CocDefFlt(stickhtron, RW); - CocDefFlt(stickhtroff, RW); - CocDefInt(keepT, RW); - CocDefInt(swRangeOn, RW); - CocDefInt(doubleControl, RW); - CocDefInt(unit, RW); - - CocDefStr(controlSensor, RW); CocHdl(SetHdl); - - CocDefStr(grapar, RA); - CocDefArr(gradata, RD); CocHdl(GraHdl); grasize=CocSizePtr(); - - CocDefStr(devname0, RW); - CocDefStr(devname1, RW); - CocAlias(tempX,cryo.temp); - CocAlias(tempP,samp.temp); - CocAlias(Ta,sensA.t); - CocAlias(Tb,sensB.t); - CocAlias(Tc,sensC.t); - CocAlias(Td,sensD.t); - CocAlias(P,power); - CocAlias(tempC, set); - CocAlias(int,integ); - - CocDefInt(msecTmo, RW); CocHdl(TmoHdl); - CocDefStr(host, RW); - CocDefInt(port, RD); - CocDefInt(use_stdout, RW); CocHdl(LogfileHdl); - CocDefStr(serverId, RW); CocHdl(LogfileHdl); - CocDefInt(logIt, RW); CocHdl(LogfileHdl); - CocDefStr(logDir, RW); CocHdl(LogfileHdl); - CocDefStr(loggerDir, RW); - CocDefStr(binDir, RW); - - logfileOut(LOG_MAIN ,"%s ", argv[0]); - for (i=1;i0 && host[0]!='\0' && port!=0 && msecTmo>0); - - str_copy(statusBuf, "starting up"); - logfileStatusBuf(statusBuf); - - if (logDir[0] == '/') { - str_copy(buf, logDir); - } else { - getcwd(buf, sizeof buf); - str_append(buf, "/"); - ERR_I(str_append(buf, logDir)); - } - ERR_I(str_append(buf, "tecs")); - logfile=logfileInit(buf, logIt, use_stdout, logIt && use_stdout); - - if (loggerDir[0] != '\0') { - if (loggerDir[0] == '/') { - str_copy(buf, loggerDir); - } else { - getcwd(buf, sizeof buf); - str_append(buf, "/"); - ERR_I(str_append(buf, loggerDir)); - } - str_copy(loggerDir, buf); - LoggerSetDir(loggerDir); - } - - CocDefStr(logfile, RD); - logfileOut(LOG_MAIN ,"\n"); - logfileWrite(logMask); - - ERR_I(CocInitServer(SetClientData, port)); - - ser=SerOpen(host, msecTmo, IdleHdl); - if (ser==NULL) { - str_copy(statusBuf, "can not connect to serial port server or terminal server"); - logfileShowErr("error in SerOpen"); - } - ERR_I(iret=CocHandleRequests(100, 0)); - tim0=mycMsecSince(0)/period*period; - tim=mycNow(); - - ERR_P(DataCreateSet(NULL, "Tm", &tm, logPeriod, LOGLIFETIME, tim)); - ERR_P(DataCreateSet(NULL, "Ts", &ts, logPeriod, LOGLIFETIME, tim)); - ERR_P(DataCreateSet(NULL, "Tr", &tr, logPeriod, LOGLIFETIME, tim)); - ERR_P(DataCreateSet(NULL, "Te", &te, logPeriod, LOGLIFETIME, tim)); - ERR_P(DataCreateSet(NULL, "Tk", &tk, logPeriod, LOGLIFETIME, tim)); - ERR_P(DataCreateSet(NULL, "He", &he, logPeriod, LOGLIFETIME, tim)); - ERR_P(DataCreateSet(NULL, "Aux", &aux, logPeriod, LOGLIFETIME, tim)); - ERR_P(DataCreateSet(NULL, "P", &power, logPeriod, LOGLIFETIME, tim)); - ERR_P(DataCreateSet(NULL, "power2", &power2, logPeriod, LOGLIFETIME, tim)); - ERR_P(DataCreateSet(NULL, "ScanChan", &scanChan, logPeriod, LOGLIFETIME, tim)); - DataUndef(0); - ERR_P(DataCreateSet(NULL, "Set", &set, logPeriod, LOGLIFETIME, tim)); - ERR_P(DataCreateSet(NULL, "Set2", &set2, logPeriod, LOGLIFETIME, tim)); - ERR_P(DataCreateSet(NULL, "shiftUp", &shiftUp, logPeriod, LOGLIFETIME, tim)); - ERR_P(DataCreateSet(NULL, "shiftLow", &shiftLow, logPeriod, LOGLIFETIME, tim)); - ERR_P(DataCreateSet(NULL, "state", &state, logPeriod, LOGLIFETIME, tim)); - DataUndef(DATA_UNDEF); - ERR_P(DataCreateSet(NULL, "tShift", &tShift, logPeriod, LOGLIFETIME, tim)); - ERR_P(DataCreateSet(NULL, "prop", &prop, logPeriod, LOGLIFETIME, tim)); - ERR_P(DataCreateSet(NULL, "int", &integ, logPeriod, LOGLIFETIME, tim)); - ERR_P(DataCreateSet(NULL, "deriv", &deriv, logPeriod, LOGLIFETIME, tim)); - - remoteMode=2; - local = 0; - prop=50; - integ=20; - deriv=0; - if (ser!=NULL) { - LscCmd(ser, "MODE?>remoteMode"); - LoadFromLsc(); - } - per=1; /* advance fast when initializing */ - cntError=0; - while (!quit) { - iret=MainBody(); - if (ser!=NULL && 0!=strcmp(host, ser->host)) { - SerClose(ser); - ser=NULL; - noResp=1; - } - if (iret<0 || ser==NULL) { - cntError++; - ser=SerCheck(ser); - if (0==strcmp(ErrMessage, "asynsrv error")) { - if (ser!=NULL) SerClose(ser); - ser=NULL; - noResp=1; - } - if (cntError<4) { - if (iret<0) { - logfileShowErr("error in TecsServer/MainBody"); - } else { - logfileShowErr("error in SerOpen"); - } - } else if (cntError==4) { - logfileOut(LOG_MAIN, "--- too many errors: skip messages ---\n"); - } - if (ser==NULL) { - CocHandleRequests(msecTmo, 0); - if (strcmp(host, "start") == 0) { - str_copy(host, starthost); - } - ser=SerOpen(host, msecTmo, IdleHdl); - if (ser==NULL) { - str_copy(statusBuf, "can not connect to serial port server or terminal server"); - } else { - LscCmd(ser, "MODE?>remoteMode"); - LoadFromLsc(); - } - } - } else { - if (cntError>0) { - if (cntError>4) { - cntError=4; - } - cntError--; - } - } - } - LogMinMax(0); - logfileWrite(logMask); - if (quit==1) { - ERR_MSG("restart by quit command"); - } else { - ERR_MSG("killed by quit command"); - } - OnError: - printf("TecsServer exited: %s\n", ErrMessage); - logfileShowErr("exit TecsServer"); - if (ser!=NULL) SerClose(ser); - CocCloseServer(); - logfileClose(); - return quit; -} diff --git a/tecs/tecs.tcl b/tecs/tecs.tcl deleted file mode 100644 index b819df8..0000000 --- a/tecs/tecs.tcl +++ /dev/null @@ -1,25 +0,0 @@ -#------------------------------------------------------------------------ -# tecs: a script to turn on and off temperature via tecs -# -# M. Zolliker, Jun 00 -#------------------------------------------------------------------------ - -ServerOption TecsPort 9753 - -#--------- some code to do proper initialization if necessary -set ret [catch {tecs} msg] -if {$ret != 0} { - Publish tecs User -} - -proc tecs { { arg1 "on"} { arg2 ""} { arg3 ""} } { - if {[string compare $arg1 "off"]==0 } { - evfactory del temperature - return "removed temperature" - } elseif {[string compare $arg1 "on"]==0 } { - evfactory new temperature tecs - return "installed temperature via TECS" - } else { - temperature $arg1 $arg2 $arg3 - } -} diff --git a/tecs/tecs_c.c b/tecs/tecs_c.c deleted file mode 100644 index d10ea1e..0000000 --- a/tecs/tecs_c.c +++ /dev/null @@ -1,82 +0,0 @@ -#include -#include -#include -#include "myc_err.h" -#include "myc_str.h" -#include "myc_time.h" -#include "myc_mem.h" -#include "tecs_cli.h" -#include "tecs_c.h" - -static pTecsClient conn=NULL; -static char response[COC_RES_LEN]; -static char *rwCode="rwacs"; -static char *rdCode="rdacs"; - -char *TecsCmd(char *cmd) { - char nbuf[64], *p, pbuf[4]; - int iret=-1, l; - - p=strchr(cmd, ' '); - if (p==NULL) { - str_copy(nbuf, cmd); - } else { - l=p-cmd; - if (l>=sizeof(nbuf)) l=sizeof(nbuf)-1; - strncpy(nbuf, cmd, l+1); - nbuf[l]='\0'; - while (*p>'\0' && *p<=' ') p++; - if (*p=='\0') p=NULL; - } - if (p==NULL) { - CocReset(conn); - ERR_I(CocGetStr(conn, nbuf, pbuf, sizeof(pbuf))); - ERR_I(CocDoIt(conn, response, sizeof(response))); - } else { - CocReset(conn); - ERR_I(CocPutStr(conn, nbuf, p)); - ERR_I(CocDoIt(conn, response, sizeof(response))); - } - return response; - OnError: return ErrMessage; -} - -char *TecsGet3(float *tset, float *texch, float *tsamp) { - ERR_I(TeccGet3(conn, tset, texch, tsamp)); - return NULL; - OnError: return ErrMessage; -} - -char *TecsSet(float temp) { - ERR_I(TeccSet(conn, temp)); - return NULL; - OnError: return ErrMessage; -} - -char *TecsInit(char *host, int port) { - int iret; - if (conn!=NULL) TeccClose(conn); - NEW(conn, CocConn); - if (host==NULL || *host=='\0') { - ERR_I(iret=CocInitClient(conn, "", port, rwCode, 0, "")); - } else { - ERR_I(iret=CocInitClient(conn, host, port, rdCode, 0, "")); - } - if (iret==1) ErrShort("TECS_INIT: can not connect to TecsServer"); - return NULL; - OnError: - FREE(conn); - return ErrMessage; -} - -int TecsIsOpen(void) { - return(conn!=NULL); -} - -void TecsClose(void) { - if (conn!=NULL) { - TeccClose(conn); - conn=NULL; - } -} - diff --git a/tecs/tecs_c.h b/tecs/tecs_c.h deleted file mode 100644 index 92a06dc..0000000 --- a/tecs/tecs_c.h +++ /dev/null @@ -1,8 +0,0 @@ -/* prototypes for TASCOM */ - -char *TecsCmd(char *cmd); -char *TecsGet3(float *tset, float *texch, float *tsamp); -char *TecsSet(float temp); -char *TecsInit(char *host, int port); -int TecsIsOpen(void); -void TecsClose(void); diff --git a/tecs/tecs_cli.c b/tecs/tecs_cli.c deleted file mode 100644 index 469b404..0000000 --- a/tecs/tecs_cli.c +++ /dev/null @@ -1,380 +0,0 @@ -#include -#include -#include -#include -#include "myc_mem.h" -#include "myc_err.h" -#include "myc_str.h" -#include "myc_time.h" -#include "myc_fortran.h" -#include "coc_util.h" -#include "tecs_cli.h" -#include "tecs_data.h" - -static char response[COC_RES_LEN]; -static char *rwCode="rwacs"; -static char *rdCode="rdacs"; - -pTecsClient TeccStart(char *startcmd, char *host, int port) { - CocConn *conn; - int iret; - -/* called by tecs client -> set write access later by function tecs_rights */ - - NEW(conn, CocConn); - ERR_I(iret=CocInitClient(conn, host, port, rdCode, 0, startcmd)); - if (iret==1) ErrShort("TECS_INIT: can not connect to TecsServer"); - return((pTecsClient)conn); - OnError: - if (conn!=NULL) FREE(conn); - return NULL; -} - -pTecsClient TeccInit(char *startcmd, int port) { - CocConn *conn=NULL; - int iret; - -/* called by sics server -> always read and write */ - - NEW(conn, CocConn); - if (startcmd[0]=='#') { /* obsolete */ - ERR_I(iret=CocInitClient(conn, startcmd+1, port, rwCode, 0, "")); - } else { - ERR_I(iret=CocInitClient(conn, "", port, rwCode, 0, startcmd)); - } - if (iret==1) ErrShort("TECS_INIT: can not connect to TecsServer"); - return((pTecsClient)conn); - OnError: - if (conn!=NULL) FREE(conn); - return(NULL); -} - -int TeccGet3(pTecsClient conn, float *tC, float *tX, float *tP) { - int iret; - - CocReset(conn); - ERR_I(CocGetFloat(conn, "set", tC)); - ERR_I(CocGetFloat(conn, "tempX", tX)); - ERR_I(CocGetFloat(conn, "tempP", tP)); - ERR_I(CocPutInt(conn, "readTemp", 1)); - ERR_I(iret=CocDoIt(conn, response, sizeof(response))); - if (iret) ERR_MSG(response); - return 0; - OnError: return(-1); -} - -int TeccGet(pTecsClient conn, float *temp) { - int iret; - - CocReset(conn); - ERR_I(CocGetFloat(conn, "tempP", temp)); - ERR_I(CocPutInt(conn, "readTemp", 1)); - ERR_I(iret=CocDoIt(conn, response, sizeof(response))); - if (iret) ERR_MSG(response); - return 0; - OnError: return(-1); -} - -int TeccGetX(pTecsClient conn, float *tC, float *tP, float *tDif) { - int iret; - float tx; - - CocReset(conn); - CocReset(conn); - ERR_I(CocGetFloat(conn, "set", tC)); - ERR_I(CocGetFloat(conn, "tx", &tx)); - ERR_I(CocGetFloat(conn, "tempP", tP)); - ERR_I(CocPutInt(conn, "readTemp", 1)); - ERR_I(iret=CocDoIt(conn, response, sizeof(response))); - *tDif = *tC - tx; - if (iret) ERR_MSG(response); - return 0; - OnError: return(-1); -} - -int TeccGetMult(pTecsClient conn, int argc, char *argv[], void (* outfunc)(char *, void *), void *arg) { - OutFunc f; - int iret, i; - - f.func = outfunc; - f.arg = arg; - CocReset(conn); - for (i=0; i0) return iret; - CocReset(conn); - ERR_I(CocPutInt(conn, "quit", 1+kill)); - ERR_I(iret=CocDoIt(conn, response, sizeof(response))); - if (iret) ERR_MSG(response); - cnt=50; - while (iret==0 && cnt>0) { - CocDelay(100); - ERR_I(iret=CocCheck(conn)); - cnt--; - } - if (iret==0) ERR_MSG("Does not quit within 5 seconds"); - return 0; - OnError: - return(-1); -} - -int TeccSend(pTecsClient conn, char *cmd, char *reply, int replyLen) { - return(CocSetGetN(conn, "send", cmd, reply, replyLen)); -} - -void TeccClose(pTecsClient conn) { - if (conn!=NULL) { - CocCloseClient(conn); - FREE(conn); - } -} - -/* fortran wrappers -------------------------------------------------- - - reduced functionality: - connection is static, so only one connection at a time may be opened - -*/ - -#ifdef F_CHAR -/* compile only when fortran c interface stuff is defined */ - - -static pTecsClient conn=NULL; - -int F_FUN(tecs_set_par)(F_CHAR(name), F_CHAR(par), int *show, int name_len, int par_len) { - char nbuf[64], pbuf[COC_CMD_LEN]; - - STR_TO_C(nbuf, name); - STR_TO_C(pbuf, par); - - CocReset(conn); - ERR_I(CocPutStr(conn, nbuf, pbuf)); - ERR_I(CocDoIt(conn, response, sizeof(response))); - if (*show) { - printf("%s", response); - } - return 0; - OnError: return(-1); -} - -int F_FUN(tecs_get_par)(F_CHAR(name), F_CHAR(par), int *show, int name_len, int par_len) { - char *b, nbuf[64], pbuf[COC_RES_LEN]; - - STR_TO_C(nbuf, name); - CocReset(conn); - ERR_I(CocGetStr(conn, nbuf, pbuf, sizeof(pbuf))); - ERR_I(CocDoIt(conn, response, sizeof(response))); - if (*show==2) { - b=response; - } else { - b=strchr(response,'='); - if (b==NULL) { - b=response; - } else { - b++; - } - } - if (*show) { - printf("%s", b); - } - return(STR_TO_F(par, pbuf)); - OnError: return(-1); -} - -int F_FUN(tecs_get_mult)(F_CHAR(names), int *time, int *nvalues, float values[], int names_len) { - char nbuf[64]; - char *nams, nam[32]; - int i; - - STR_TO_C(nbuf, names); - CocReset(conn); - - ERR_I(CocGetInt(conn, "rdTim", time)); - i=0; - nams=nbuf; - while (nams!=NULL && i < *nvalues) { - nams=str_split(nam, nams, ' '); - if (nam[0]!='\0') { - values[i]=DATA_UNDEF; - CocGetFloat(conn, nam, values+i); - i++; - } - } - - ERR_I(CocDoIt(conn, response, sizeof(response))); - return 0; - OnError: return(-1); -} - -int F_FUN(tecs_init)(F_CHAR(startcmd), int *port, int startcmd_len) { - char sbuf[132]; - - STR_TO_C(sbuf, startcmd); - ERR_P(conn=TeccInit(sbuf, *port)); - return 0; - OnError: return(-1); -} - -int F_FUN(tecs_start)(F_CHAR(startcmd), F_CHAR(host), int *port, int startcmd_len, int host_len) { - char sbuf[132], hbuf[64]; - - STR_TO_C(sbuf, startcmd); - STR_TO_C(hbuf, host); - ERR_P(conn=TeccStart(sbuf, hbuf, *port)); - if (conn->fd<0) return 1; - return 0; - OnError: return(-1); -} - -int F_FUN(tecs_rights)(int write) { - if (write) { - ERR_I(CocSendMagic(conn, rwCode)); - } else { - ERR_I(CocSendMagic(conn, rdCode)); - } - return 0; - OnError: return(-1); -} - -int F_FUN(tecs_get)(float *temp) { - ERR_I(TeccGet(conn, temp)); - return 0; - OnError: return(-1); -} - -int F_FUN(tecs_get3)(float *t1, float *t2, float *t3) { - ERR_I(TeccGet3(conn, t1, t2, t3)); - return 0; - OnError: return(-1); -} - -int F_FUN(tecs_set)(float *temp) { - ERR_I(TeccSet(conn, *temp)); - return 0; - OnError: return(-1); -} - -int F_FUN(tecs_is_open)(void) { - return(conn!=NULL); -} - -void F_FUN(tecs_close)(void) { - TeccClose(conn); - conn=NULL; -} - -int F_FUN(tecs_quit_server)(int *kill) { - int iret; - - ERR_I(iret=TeccQuitServer(conn, *kill)); - return(iret); - OnError: return(-1); -} - -int F_FUN(tecs_watch_log)(F_CHAR(list), int list_len) { - char buf[16]; - STR_TO_C(buf, list); - ERR_I(CocWatchLog(conn, buf)); - return 0; - OnError: return(-1); -} - -int F_FUN(tecs_get_data)(F_CHAR(names), int *startTime, int *endTime, int *step, int *tbase - , float xdata[], float ydata[], int *maxLen, int *width - , int retLen[], int names_len) { - char nam[64]; - char str[128]; - float offset, fact, *py, data[COC_RES_LEN/4-100]; - int i, j, k, l, iret; - - if (*endTime - *startTime > *step * (*maxLen-1)) { - printf("maxLen too small\n"); - } - STR_TO_C(nam, names); - if (*step <= 0) { - *step = 60; - } - sprintf(str, "%d %d %d %s", *startTime, *endTime, *step, nam); - - CocReset(conn); - ERR_I(CocPutStr(conn, "grapar", str)); - ERR_I(CocGetArray(conn, "gradata", data, sizeof(data)/sizeof(float))); - ERR_I(iret=CocDoIt(conn, response, sizeof(response))); - if (iret) ERR_MSG(response); - py=data; - for (i=0; i < *width; i++) { - l=*py; py++; - if (l>0) { - fact = (float)(*endTime - *startTime) / l; - } - offset = *startTime - *tbase; - k = i * *maxLen; - for (j=0; j 0) tim.tm_mon=m-1; - t=mktime(&tim); - if (t > now) { - tim.tm_year--; - t=mktime(&tim); - } - return t; -} -*/ -#endif diff --git a/tecs/tecs_cli.h b/tecs/tecs_cli.h deleted file mode 100644 index c70f373..0000000 --- a/tecs/tecs_cli.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef _TECS_CLI_H_ -#define _TECS_CLI_H_ - -#include "coc_client.h" -/* - tecs_cli.h: tecs client interface routines - - M. Zolliker March 2000 -*/ - -typedef CocConn *pTecsClient; - - -pTecsClient TeccInit(char *server, int port); -/* init tecs client (connect to server) */ - -int TeccGet(pTecsClient conn, float *temp); -/* get temperature */ - -int TeccGetX(pTecsClient conn, float *tC, float *tP, float *tDif); -/* get controlled temperature */ - -int TeccGet3(pTecsClient conn, float *tSet, float *tExch, float *tSamp); -/* get temperatures */ - -int TeccGetMult(pTecsClient conn, int argc, char *argv[], void (* outfunc)(char *, void *), void *arg); -/* get multiple values */ - -int TeccSet(pTecsClient conn, float temp); -/* set temperature */ - -int TeccSend(pTecsClient conn, char *cmd, char *reply, int replyLen); -/* send a command transparently to the controller - replyLen is the maximal length of reply */ - -void TeccClose(pTecsClient conn); -/* close connection and free ressources */ - -int TeccQuitServer(pTecsClient conn, int kill); -/* quit the server process, kill = 0: restart if possible */ - -/* Fortran interface: - - integer function TECS_INIT(STARTCMD, PORT) - open server connection - logical function TECS_IS_OPEN () - check if tecs is open - integer function TECS_GET3(SET_T, REG_T, SAM_T) - read 3 temperatures - integer function TECS_WAIT() - wait for end of configuration - integer function TECS_SET (TEMP) - set temperature target - integer function TECS_GET (TEMP) - get sample temperature - integer function TECS_QUIT_SERVER () - force server to quit - integer function TECS_GET_PAR (NAME, PAR) - get parameter - integer function TECS_SET_PAR (NAME, PAR) - set parameter - integer function TECS_SEND (CMND, REPLY) - send command to LakeShore - subroutine TECS_CLOSE - close connection to tecs - - character*(*) STARTCMD - command to start server (no restart if empty) - integer PORT - port number - real SET_T,REG_T,SAM_T - set-temperature, regulation temperature, sample temperature - real TEMP - temperature - character*(*) NAME - parameter name - character*(*) PAR - parameter value - character*(*) CMND - raw command - character*(*) REPLY - reply to command - - integer return values are error codes (negative means error, like in most C system routines) -*/ - -#endif /* _TECS_CLI_H_ */ diff --git a/tecs/tecs_client.f b/tecs/tecs_client.f deleted file mode 100644 index 36b05c5..0000000 --- a/tecs/tecs_client.f +++ /dev/null @@ -1,379 +0,0 @@ - program tecs_client - - character device*32, start*80, line*80, cmd*16, par*80, response*1024 - character inst*64, host*64, user*1, pcod*1 - integer i,j,k,iret,l,port - integer maxfiles - real wait - parameter (maxfiles=10) - integer nfiles/0/, mfiles/0/, idx, luns(0:maxfiles-1) - character cmdpar*128 - character prompt*32/'tecs[] '/ - integer promptlen/7/ - logical oneCommand - character logarg*4/'25'/ - character defcmd*8/'status'/ - integer rwacs/0/ - -! functions - integer tecs_get_par, tecs_quit_server, tecs_set_par, tecs_watch_log - integer tecs_get, tecs_rights, show_log, instr_host, tecs_start - - call sys_loadenv - call sys_getenv('CHOOSER_GDEV', line) - if (line .ne. ' ') then - call sys_setenv('PGPLOT_DEV', '/'//line) - endif - - call sys_get_cmdpar(line, l) - - if (l .ne. 0) then - oneCommand=.true. - if (l .eq. 1 .and. - 1 line(1:1) .gt. '0' .and. line(1:1) .le. '9') then - port=9750+(ichar(line(1:1))-ichar('0')) - inst=line - host=' ' - oneCommand=.false. - else - rwacs=instr_host('tecs', line, inst, host, port) - endif - else -! call sys_getenv('HOST', line) - rwacs=instr_host('tecs', line, inst, host, port) - oneCommand=.false. - endif - - - call sys_getenv('TECS_START', start) - if (port .gt. 0) then - if (port .eq. 1) port=9753 - call str_trim(start, start, k) - call str_trim(inst, inst, i) - if (start .ne. ' ') then - start=start(1:k)//' '//inst(1:i) - endif - iret=tecs_start(start, host, port) - oneCommand=.false. - prompt='tecs['//inst(1:i)//'] ' - promptlen=i+7 - else - iret=tecs_start(start, ' ', 9753) - endif - if (iret .ne. 0) goto 90 - - if (oneCommand) goto 11 - - line='tecs' - line(52-i:64)='connected to '//inst(1:i) - print '(x,64(''-''))' - print '(x,a)',line(1:64) - print '(x,64(''-''))' - print '(33x,a)','type help for a list of commands' - print * - - if (rwacs .ne. 0) then - iret=tecs_rights(1) - endif - - l=0 -1 if (oneCommand) goto 99 - if (nfiles .gt. 0) then - read(luns(idx), '(a)', err=22,end=22) line - call str_trim(line, line, l) - print '(x,2a)', prompt(1:promptlen),line(1:max(1,l)) - else - call sys_rd_line(line, l, prompt(1:promptlen)) - if (l .lt. 0) goto 99 - endif - if (line(1:1) .eq. '@') then - nfiles=nfiles+1 - idx=mod(nfiles, maxfiles) - if (nfiles .gt. mfiles+maxfiles) then ! close files which are too much nested - close(luns(idx)) - mfiles=nfiles-maxfiles - else - call sys_get_lun(luns(idx)) - endif - call sys_open(luns(idx), line(2:), 'R', i) - if (i .ne. 0) then - print *,'error opening ',line(2:) - close(luns(idx)) - call sys_free_lun(luns(idx)) - nfiles=nfiles-1 - idx=mod(nfiles, maxfiles) - endif - goto 1 - endif -11 l=l+1 - line(l:l)=' ' - cmd=' ' - k=0 - do j=1,l - if (k .gt. 0 .and. line(j:j) .eq. '=') line(j:j)=' ' - if (line(j:j) .gt. ' ') then - k=k+1 - cmd(k:k)=line(j:j) - if (cmd(k:k) .ge. 'A' .and. cmd(k:k) .le. 'Z') then ! set to lowercase - cmd(k:k)=char(ichar(cmd(k:k))+32) - endif - elseif (k .gt. 0) then ! end of command - par=' ' - do i=j,l - if (line(i:i) .gt. ' ') then - par=line(i:l) - goto 3 ! command with parameter - endif - enddo - goto 2 ! parameterless command - endif - enddo - - if (k .ne. 0) then - print *,'command too long' - goto 1 - endif - - ! empty command - -12 cmd=defcmd - -2 continue ! parameterless command - - defcmd='status' - - if (cmd .eq. 'kill') then - iret=tecs_quit_server(1) - if (iret .lt. 0) goto 19 - if (iret .gt. 0) then - print *,'tecs server is not running' - endif - else if (cmd .eq. 'restart') then - iret=tecs_quit_server(0) - if (iret .lt. 0) goto 19 - if (iret .gt. 0) then - print *,'tecs server is not running' - endif - else if (cmd .eq. 'remote') then - iret=tecs_set_par('remoteMode', '2', 2) - if (iret .lt. 0) goto 19 - else if (cmd .eq. 'reset') then - iret=tecs_set_par('relay', '0', 2) - if (iret .lt. 0) goto 19 - elseif (cmd .eq. 'rwacs') then - iret=tecs_rights(1) - if (iret .lt. 0) goto 19 - elseif (cmd .eq. 'exit' .or. cmd .eq. 'quit') then - goto 99 - elseif (cmd .eq. 'status') then - iret=tecs_get_par('status', response, 1) - if (iret .lt. 0) goto 19 - elseif (cmd .eq. 'on' .or. cmd .eq. 'off') then - l=0 - goto 11 - elseif (cmd .eq. 'plot') then - call tecs_plot(' ') - elseif (cmd .eq. 'help') then - print * - print *,'tecs client commands (can not be used from SICS)' - print * - print *,' show summary' - print *,'plot chart for temperature' - print *,'log show last n lines of logfile' - print *,'remote set to remote mode' - print *,'reset reset alarms' - print *,'kill shut down TecsServer' - print *,'restart restart TecsServer' - print *,'exit, quit exit tecs client' - print * - print *,'commands/parameters:' - print * - print *,' From tecs: show parameter' - print *,' set parameter' - print * - print *,' From SICS: tt show parameter' - print *,' tt set parameter' - print * - print *,'changeable parameters:' - print * - print *,'set temperature set-point' - print *,'device temperature device' - print *,'controlMode control on: 0: heat exchanger, ' - 1 ,'1: sample, 2: second loop' - print *,'maxPower heater max. power' - print *,'ramp ramp in K/min. (0: no ramp)' - print *,'prop PID gain' - print *,'int PID integration time: 1000/int sec' - print *,'deriv PID derivation term' - print *,'maxShift maximum (set-tempH) for controlMode=2' - print *,'int2 integration time (sec) for controlMode=2' - print *,'tLimit temperature limit' -! print *,'remoteMode 1: local, 2: remote' - print *,'send direct command to LSC340' - print * - print *,'read only parameters:' - print * - print *,'Tm main temperature' - print *,'Ts sample temperature' - print *,'Tr set-point on regulation' - print *,'helium helium level' - print *,'htr heater current percentage' - print *,'resist heater resistance' - print *,'logfile name of the logfile' - print * - print *,'Ta,Tb,Tc,Td values of channels A,B,C,D' - print * - print *,'devhelp list available temperature devices' - print * - elseif (cmd .eq. 'log') then - if (line(1:l) .eq. ' ') then - print '(x,a)' - 1 ,char(27)//'[A'//char(13)//char(27)//'[K'//char(27)//'[2A' - endif - if (show_log(logarg) .le. 0) then - logarg='25' - print *,'-------- end of logfile --------' - goto 12 - endif - defcmd='log' - logarg=' ' - elseif (cmd .eq. 'watch') then - iret=tecs_watch_log('M') - if (iret .lt. 0) goto 19 - else - iret=tecs_get_par(cmd, response, 2) - if (iret .lt. 0) goto 19 - if (oneCommand .and. response .eq. ' ') goto 92 - endif - goto 1 - -3 continue ! command with parameter - - defcmd='status' - - if (cmd .eq. 'log') then - if (show_log(par) .gt. 0) then - defcmd='log' - endif - logarg=' ' - elseif (cmd .eq. 'plot') then - call str_lowcase(par, par) - call str_upcase(par(1:1), par(1:1)) - call tecs_plot(par) - elseif (cmd .eq. 'watch') then - iret=tecs_watch_log(par) - if (iret .lt. 0) goto 19 - elseif (cmd .eq. 'wait') then - read(par, *, err=17,end=17) wait - call sys_wait(wait*60.0) -17 continue - else - iret=tecs_set_par(cmd, par, 2) - if (iret .lt. 0) goto 19 - if (oneCommand .and. par .eq. ' ') goto 92 - endif - goto 1 - -19 if (iret .eq. -2) then - call tecs_write_msg(6) - if (oneCommand) goto 90 - else - call tecs_write_error(6) - endif - goto 1 - -22 continue ! end of file - close(luns(idx)) - call sys_free_lun(luns(idx)) - nfiles=nfiles-1 - if (nfiles .lt. mfiles) then - print *,'too many files nested' - mfiles=0 - nfiles=0 - endif - idx=mod(nfiles,maxfiles) - goto 1 - -90 call tecs_write_error(6) -92 call exit(40) ! Abort - -91 if (iret .lt. 0) then - call tecs_write_error(6) - endif -99 end - - - integer function show_log(lines) - - character*(*) lines - - integer i,l - character str*8192 - -! functions - integer tecs_get_par, tecs_set_par - - if (lines .ne. ' ') then - l=tecs_set_par('logstart', lines, 0) - print *,'line: ',lines - print * - endif - - show_log=tecs_get_par('logline', str, 1) - end - - - subroutine TECS_WRITE_ERROR(IOLUN) !! -!! ================================== -!! -!! write out error message of last error and stack info -!! - implicit none - - integer IOLUN !! logical unit for output - - external tecs_err_routine - - call err_set_outrtn(tecs_err_routine, iolun) - call err_show('Error in TECS') - end - - - subroutine TECS_WRITE_MSG(IOLUN) !! -!! ================================ -!! -!! write out error message of last error without stack info -!! - implicit none - - integer IOLUN !! logical unit for output - - external tecs_err_routine - - call err_set_outrtn(tecs_err_routine, iolun) - call err_short - end - - - SUBROUTINE TECS_ERR_ROUTINE (LUN, TEXT) -! ======================================= -! -! routine called from C -! - implicit none -c-------------------------------------------------------------- -c Define the dummy arguments - byte text(128) - integer lun -c-------------------------------------------------------------- - integer i, j -c-------------------------------------------------------------- - do i=1,128 - if (text(i) .eq. 0) then - write(lun, '(x,128a1)') (text(j), j=1,i-1) - return - endif - enddo -! no terminating ASCII NUL found - write(lun, *) 'error in TECS_ERR_ROUTINE: illegal error text' - end diff --git a/tecs/tecs_data.c b/tecs/tecs_data.c deleted file mode 100644 index 97d4fb2..0000000 --- a/tecs/tecs_data.c +++ /dev/null @@ -1,597 +0,0 @@ -#include -#include -#include -#include -#include "myc_mem.h" -#include "myc_str.h" -#include "myc_err.h" -#include "myc_time.h" -#include "coc_logfile.h" -#include "tecs_data.h" -#include "logger.h" - -#define RUN_SIZE 1024 -#define SET_LEN 1024 - -typedef struct { - int tmin, tmax, tlim; - float dmin, dmax; - int reset; -} Summary; - -typedef struct Run { - struct Run *next; - int size, step; - int startTime, endTime; - float data[RUN_SIZE]; -} Run; - -typedef struct Set { - DataSet set; - struct Set *next; - int nRuns; - int step, lifetime; - int start, end; - float *var; - float undef; - Run *runs; - Summary sum; - Logger *log; -} Set; - -typedef struct { - Set *head; -} Base; - -typedef struct { - Base *base; - int tim, from, to; - int stdStep; -} ScanData; - -static Base database; - -static float undef_value = DATA_UNDEF; /* additonal undef value */ - -void DataUndef(float undef) { - undef_value = undef; -} - -void InsSum(Summary *sum, int t, float d) { - if (sum->tmin == 0) { - sum->tmin = t; - sum->tmax = t; - sum->dmin = d; - sum->dmax = d; - } else { - if (d <= sum->dmin) { - sum->dmin = d; - sum->tmin = t; - } else if (d >= sum->dmax) { - sum->dmax = d; - sum->tmax = t; - } - } -} - -void ResetSum(Summary *sum) { - sum->reset = 1; - sum->tmin = 0; - sum->dmin = DATA_UNDEF; - sum->dmax = DATA_UNDEF; -} - -void PutSum(Summary *sum, float *data) { - if (sum->tmin == 0) { - data[1] = sum->dmin; - data[0] = sum->dmax; - } else if (sum->tmin > sum->tmax) { - data[1] = sum->dmin; - data[0] = sum->dmax; - sum->dmin = sum->dmax; - } else if (sum->tmin < sum->tmax) { - data[1] = sum->dmax; - data[0] = sum->dmin; - sum->dmax = sum->dmin; - } else { - data[1] = sum->dmin; - data[0] = sum->dmax; - } - sum->tmin = 0; - if (sum->reset) { - sum->dmin = DATA_UNDEF; - sum->dmax = DATA_UNDEF; - sum->reset = 0; - } -} - -Set *FindSet(Base *base, char *name) { - Set *s; - int total; - - total=0; - s = base->head; - while (s!=NULL && 0!=strcasecmp(name, s->set.name)) { - s = s->next; - } - return s; -} - -Set *CreateSet(Base *base, char *name, float *var, int step, int lifetime, int start) { - Set *s; - char *nam; - - s = FindSet(base, name); - if (s != NULL) ERR_MSG("dataset exists"); - NEW(s, Set); - s->next = base->head; - base->head = s; - NEW_STR(nam, name); - s->set.name = nam; - s->runs = NULL; - s->nRuns = 0; - s->lifetime = lifetime; - s->start = start; - s->step = step; - s->var = var; - s->undef = undef_value; - s->log = NULL; - ResetSum(&s->sum); - return s; - OnError: - return NULL; -} - -DataSet *DataFindSet(DataBase *dBase, char *name) { - Base *base; - if (dBase==NULL) { - base=&database; - } else { - base=(Base *)dBase; - } - return (DataSet *) FindSet(base, name); -} - -DataSet *DataCreateSet(DataBase *dBase, char *name, float *var, int step, int lifetime, int start) { - Base *base; - if (dBase==NULL) { - base=&database; - } else { - base=(Base *)dBase; - } - return (DataSet *) CreateSet(base, name, var, step, lifetime, start); -} - -int DataSetStep(DataSet *set, int step) { - Set *s; - - ERR_P(set); - ERR_I(step-1); /* step > 0 */ - s = (Set *)set; - s->step = step; - return 0; - OnError: return -1; -} - -int DataSetLifetime(DataSet *set, int lifetime) { - Set *s; - - ERR_P(set); - s = (Set *)set; - s->lifetime = lifetime; - return 0; - OnError: return -1; -} - -Run *InsertRun(Set *s, int time) { - Run *r, *next, *last; - - NEW(r, Run); - r->next = s->runs; - s->runs = r; - r->step = s->step; - s->nRuns++; - if (s->nRuns * s->step > s->lifetime) { - next=r->next; - last=r; - while (next!=NULL && next->endTime > time - s->lifetime) { - last = next; - next = last->next; - } - while (next!=NULL) { - last->next = next->next; - FREE(next); - s->nRuns--; - next = last->next; - } - } - return r; - OnError: - return NULL; -} - -int Put(Set *set, int time, float value) { - Run *r; - int t; - int size; - float last; - static int errcnt=0; - - ERR_P(set); - if (value == DATA_UNDEF) return 0; - r = set->runs; - if (r == NULL || r->step != set->step || r->size+3 > RUN_SIZE) { - ERR_P(r = InsertRun(set, time)); - r->startTime = time; - r->endTime = time - r->step; - size = 0; - t = 1; - } else { - size = r->size; - t = (time - r->endTime) / r->step; - last = r->data[size-1]; - } - if (t<0) { - if (t<-1) { - if (errcnt<4) { - errcnt++; - logfileOut(LOG_MAIN, "%s %d set.name, time, r->endTime); - } - ERR_MSG("back in time not possible"); - } - if (errcnt>0) errcnt--; - t=0; - } - if (t == 0) { - InsSum(&set->sum, time, value); - } else { - if (size % 2) { - PutSum(&set->sum, r->data+size-1); size++; - r->endTime += r->step; - t--; - } - if (t > 2) { - r->data[size]=t-1; size++; - r->data[size]=DATA_UNDEF; size++; - set->sum.reset = 1; - r->endTime += r->step * (t-1); - t=1; - } - InsSum(&set->sum, time, value); - if (t % 2) { - r->data[size]=value; size++; /* put a provisory value */ - r->endTime += r->step; - } else if (t == 2) { - PutSum(&set->sum, r->data+size); size+=2; - r->endTime += r->step * 2; - } - } - r->size = size; - return 0; - OnError: - return -1; -} - -int DataPut(DataSet *set, int time, float value) { - return Put((Set *)set, time, value); -} - -int DataPutAll(DataBase *base, int mytime) { - Set *s; - char value[32]; - char tname[32]; - static time_t lastOpen = 0; - float val; - - if (base == NULL) { - s=database.head; - } else { - s=((Base *)base)->head; - } - while (s!=NULL) { - if (s->var!=NULL) { - val = *s->var; - if (val == s->undef) { - val = DATA_UNDEF; - } - ERR_I(Put(s, mytime, val)); - if (s->log == NULL && val != DATA_UNDEF && time(NULL) > lastOpen + 300) { - /* try to make logger if not yet tried in the last 5 min. */ - snprintf(tname, sizeof tname, "tt.%s", s->set.name); - s->log = LoggerMake(tname, s->step, 0); - if (s->log == NULL) { - lastOpen = time(NULL); - } - } - if (s->log != NULL) { - if (val == DATA_UNDEF) { - value[0]='\0'; - } else { - snprintf(value, sizeof value, "%.5g", val); - } - LoggerWrite(s->log, mycUnixTime(mytime), s->step, value); - } - } - s=s->next; - } - return 0; - OnError: - return -1; -} - -int Start(Set *s) { - Run *r; - int t1, t2; - - r = s->runs; - t1 = s->start; - if (r != NULL) { - t2 = r->endTime - s->lifetime; - if (t1 < t2) { - while (r != NULL) { - t1 = r->startTime; - r = r->next; - } - if (t1 > t2) { - t1 = t2; - } - } - } - return t1; -} - -void FreeBase(Base *base) { - Set *s, *sFree; - Run *r, *rFree; - - s = base->head; - while (s != NULL) { - r = s->runs; - while (r != NULL) { - rFree = r; - r = r->next; - FREE(rFree); - } - sFree=s; - s = s->next; - FREE(sFree); - } -} - -int GetSet(Set *s, int startTime, int endTime, int size, float *data) { - Run *r; - int t, tlim; - float d; - int i, idx; - Summary sum; - - if (size<=0 || size%2 != 0) ERR_MSG("size must be even and positive"); - ERR_P(s); - ERR_P(data); - - r = s->runs; - - ResetSum(&sum); - idx = size - 2; - tlim = (endTime - startTime) * idx / size + startTime; - - while (r != NULL) { - if (startTime > r->endTime) break; - if (endTime >= r->startTime) { - t = r->endTime; - d = 0; - for (i = r->size - 1; i>=0; i--, t-=r->step) { - d = r->data[i]; - if (d == DATA_UNDEF) { - i--; - t -= (int)(r->data[i] + 0.5) * r->step; - sum.reset = 1; - } else { - if (t < startTime) break; - if (t < endTime) { - while (t < tlim) { - PutSum(&sum, data+idx); idx-=2; - tlim = (endTime - startTime) * idx / size + startTime; - } - InsSum(&sum, t, d); - } - } - } - } - r = r->next; - } - sum.reset = 1; - while (idx >= 0) { - PutSum(&sum, data+idx); idx-=2; - } - return 0; - OnError: - return -1; -} - -void Scan(void *sData, char *line) { - Set *set; - Run *run; - Base *base; - char str[64], nam[64]; - int l, iret, hh, mm, ss; - float num; - int tim, tshift, t0; - - base=((ScanData *)sData)->base; - tim=((ScanData *)sData)->tim; - - /* read time */ - l=0; iret=sscanf(line, "%d:%d:%d%n", &hh, &mm, &ss, &l); line+=l; - if (iret!=3) return; - tim+=hh*3600+mm*60+ss; - if (tim < ((ScanData *)sData)->from || tim > ((ScanData *)sData)->to) return; - - set=NULL; - l=0; iret=sscanf(line, "%64s%n", str, &l); line+=l; - while (iret==1) { - if (str[0] >= 'A') { - str_copy(nam, str); - l=0; iret=sscanf(line, "%64s%n", str, &l); line+=l; - if (iret==1) { - iret=sscanf(str, "%f", &num); - if (iret==1) { - tshift = 0; - if (0 != strcmp(nam, "_")) { - set=FindSet(base, nam); - if (set!=NULL) tshift = 1; - } - if (set!=NULL && tim < set->end) { - if (tshift) { - t0 = tim - ((ScanData *)sData)->stdStep*2; - run = set->runs; - if (run != NULL && run->endTime >= t0) { - t0 = run->endTime; - } - t0 += set->step; - if (t0 > tim) t0 = tim; - Put(set, t0, num); - } else { - Put(set, tim, num); - } - } - } - } - } else { - l=0; iret=sscanf(line, "%64s%n", str, &l); line+=l; - } - } -} - -void Load(Base *base, int from, int to, int stdStep) { - ScanData scanData; - int t; - - scanData.base = base; - scanData.stdStep = stdStep; - scanData.from = from; - scanData.to = to; - - /* round down "from" and "to" to 00:00 local time */ - from = from - (from % (24*3600)); - to = to - (to % (24*3600)); - - for (t=from; t<=to; t+=24*3600) { - scanData.tim=t; - logfileScan(mycDate(t), Scan, &scanData); - } -} - -int DataGetMult(char *names, int startTime, int endTime, int step, int stdStep, float *data, int data_len) { - Base base; - Set *set, *s; - int stp, minStep, period, s1; - char *nams, nam[32]; - int p, l, n, i, j, siz1, siz2, halfsiz, start; - - base.head = NULL; - period = endTime - startTime; - if (period<=0) period=1; - n=0; nams = names; - while (nams != NULL) { /* count names */ - nams = str_split(nam, nams, ' '); - if (nam[0] != '\0') n++; - } - - stp=step; - if (stp startTime) { - set=CreateSet(&base, nam, NULL, stp, period, startTime); - if (set != NULL) set->end = start; - } - } - } - if (base.head != NULL) { /* load if needed */ - Load(&base, startTime, endTime, stdStep); - } - p=0; - nams=names; - while (nams!=NULL) { - nams=str_split(nam, nams, ' '); - if (nam[0]!='\0') { - s = FindSet(&database, nam); - set = FindSet(&base, nam); - s1 = startTime; - if (s == NULL) { - if (set == NULL) { - s1 = 0; - } else { - s = set; - } - } else { - minStep = s->step; - if (set != NULL) { - s1 = Start(s); - if (s1 >= endTime) { - s = set; - s1 = startTime; - } else if (s1 < startTime || s1 <= Start(set)) { - s1 = startTime; - } - } - } - if (s1 == 0) { /* empty array */ - data[p++]=0; - } else { - minStep = s->step; - stp = step; - halfsiz = period / (2 * stp) + 1; - if (startTime + minStep * halfsiz * 2 > endTime) { - if (stp < minStep) stp = minStep; - halfsiz = period / (2 * stp) + 1; - if (halfsiz * 2 + n > data_len) { /* check if enough space */ - halfsiz = ((data_len - p) / n - 1) / 2; - } - } - siz1 = (s1 - startTime) * halfsiz / period * 2; - siz2 = halfsiz * 2 - siz1; - s1 = startTime + (siz1 * period + halfsiz) / halfsiz / 2; - p++; - if (siz1 > 0) { - halfsiz = (s1 - startTime) / set->step / 2; - if (halfsiz * 2 < siz1 && halfsiz > 0) { - ERR_I(GetSet(set, startTime, s1, halfsiz*2, data+p)); - j = siz1 - 1; - for (i = halfsiz * 2-1; i >= 0; i--) { /* expand data */ - while (j > siz1 / 2 * i / halfsiz) { - data[p+j]=DATA_GAP; j--; - } - data[p+j]=data[p+i]; j--; - } - } else { - ERR_I(GetSet(set, startTime, s1, siz1, data+p)); - } - l=siz1; - } else { - l=0; - } - if (siz2 > 0) { - ERR_I(GetSet(s, s1, endTime, siz2, data+p+siz1)); - l+=siz2; - } - data[p-1]=l; - p+=l; - } - n--; - } - } - FreeBase(&base); - return p; - OnError: - return -1; -} diff --git a/tecs/tecs_data.h b/tecs/tecs_data.h deleted file mode 100644 index 048ddf3..0000000 --- a/tecs/tecs_data.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef TECS_DATA_H_ -#define TECS_DATA_H_ - -typedef struct { - char *name; -} DataSet; - -typedef struct { - void *private; -} DataBase; - -DataSet *DataCreateSet(DataBase *dBase, char *name, float *var, int step, int lifetime, int start); -/* - create a new dataset - if the dataset already exists, or memory allocation failed, NULL is returned - set to NULL to use the common database -*/ - -DataSet *DataFindSet(DataBase *dBase, char *name); -/* - find a previously created dataset. - returns NULL if dataset not found - set to NULL to use the common database -*/ - -int DataSetStep(DataSet *set, int step); -int DataSetLifetime(DataSet *set, int lifetime); -int DataPut(DataSet *set, int time, float value); -/* - put one value to dataset -*/ - -int DataPutAll(DataBase *dBase, int time); -/* - put all variables in a set to their dataset -*/ - -int DataGetMult(char *names, int startTime, int endTime, int step, int stdStep, float *data, int data_len); -/* - get multiple datasets -*/ - -void DataUndef(float undef); - -/* - define DATA_UNDEF as a binary and decimal well defined, hopefully rarely used number -*/ -#define DATA_UNDEF MYC_NAN -#define DATA_GAP (MYC_NAN*2) - -#endif /* TECS_DATA_H_ */ diff --git a/tecs/tecs_dlog.inc b/tecs/tecs_dlog.inc deleted file mode 100644 index 7eaaf7d..0000000 --- a/tecs/tecs_dlog.inc +++ /dev/null @@ -1,14 +0,0 @@ - integer version, recs, mdat, recl - parameter (version=106, recs=1024, mdat=4, recl=mdat*recs) - integer step,size,dirlen - parameter (step=5, size=8*24*3600/step, dirlen=size/recs+1) - real undef - parameter (undef=-65535.0) - - integer lunw, lunr, wrec, rrec - integer vers, stim, etim - logical update - real wdat(mdat,0:recs-1), rdat(mdat,0:recs-1) - integer wdir(0:dirlen-1), rdir(0:dirlen-1) - common/tecs_dlog_inc/ lunw, lunr, wrec, rrec - 1, vers, stim, etim, update, wdat, rdat, wdir, rdir diff --git a/tecs/tecs_for.f b/tecs/tecs_for.f deleted file mode 100644 index 3ad923d..0000000 --- a/tecs/tecs_for.f +++ /dev/null @@ -1,231 +0,0 @@ - SUBROUTINE TECS_FOR ! File TAS_SRC:[TECS]TECS_FOR.FOR -c =================== -c -cdec$ ident 'V01D' -c------------------------------------------------------------------------------ -c Fortran-Interface to the TECS Client -c -c M. Zolliker, March 2000 -c Updates: -c V01A 21-Mar-2000 DM. Integrate into TASMAD -c 05-Apr-2000 M.Z. modifed error handling/changed arguments in TeccGet3 -c 01-May-2000 M.Z. renamed source, TECS_OPEN is now in a separate, system dependent file -c V01C 11-May-2000 DM. Split into modules. -c V01D 12-May-2000 M.Z. Changed error handling, no longer automatic call to TECS_OPEN -c------------------------------------------------------------------------------ -c -c For a description of the public interface: -c on VMS: search tecs_for.for "!'''!" (''' may be omitted) -c on Unix: grep !"!" tecs_for.for -c -c Public routines in this Module: -c -c subroutine TECS_OPEN (LUN, INIT, IRET) - open connection to tecs, if not yet open -c subroutine TECS_GET_T (IOLUN, TEMP, IRET) - read the temperature, wait if tecs is configuring -c subroutine TECS_WRITE_ERROR (IOLUN) - write out last occured error in TECS_x routines -c -c For internal use only: -c -c subroutine TECS_FOR - dummy entry point to get module name -c in library to match the file name. -c subroutine TECS_ERR_ROUTINE (LUN, TEXT) - (for internal use only) -c -!!------------------------------------------------------------------------------ -!! C Routines with Fortran interface (see TECS_CLI.C): -!! -!! integer function TECS_SET (TEMP) - set temperature target -!! integer function TECS_GET (TEMP) - get sample temperature -!! integer function TECS_QUIT_SERVER () - force server to quit -!! integer function TECS_GET_PAR (NAME, PAR) - get parameter -!! integer function TECS_SET_PAR (NAME, PAR) - set parameter -!! integer function TECS_SEND (CMND, REPLY) - send command to LakeShore -!! subroutine TECS_CLOSE - close connection to tecs -!! -!! real TEMP -!! character*(*) NAME, PAR, CMND, REPLY -!! -!! integer return values are error codes (negative means error, like in most C system routines) -!! -! -! C routines only for internal use in TECS_FOR.FOR: -! -! integer function TECS_INIT(STARTCMD, PORT) - open server connection -! logical function TECS_IS_OPEN () - check if tecs is open -! integer function TECS_GET3(SET_T, REG_T, SAM_T) - read 3 temperatures -! integer function TECS_WAIT() - wait for end of configuration -! -! character*(*) STARTCMD -! integer PORT -! real SET_T,REG_T,SAM_T -c------------------------------------------------------------------------------ - implicit none - stop 'TECS_FOR: do not call module header' - end -!!------------------------------------------------------------------------------ -!! Fortran routines in this file: -!! - SUBROUTINE TECS_OPEN(LUN, INIT, IRET) !! -!! ===================================== -!! -!! Open connection to the Tecs Server, if not yet done. -!! (a) LUN==0: INIT is the start command which should contain "-p " -!! (b) LUN/=0: INIT is the file specification where to read port number and start command -!! -c------------------------------------------------------------------------------ - implicit none - -c-------------------------------------------------------------- -c Define the dummy arguments - integer LUN !! logical number for reading init file - character*(*) INIT !! file specification or start command - integer IRET !! iret<0 means error -c-------------------------------------------------------------- - integer ios, port, i - character*128 startcmd - -! functions: - integer tecs_init - logical tecs_is_open -c-------------------------------------------------------------- - - if (tecs_is_open()) then - iret=1 ! already open - return - endif - - port=0 - - if (lun .eq. 0) then - -c extract the port number from the start command - - i=index(init, '-p ') - if (i .eq. 0) i=index(init, '-P ') - if (i .ne. 0) then - read(init(min(len(init),i+3):),*,iostat=ios) port - endif - - if (port .eq. 0) port=9753 - - if (init(1:1) .eq. '#') then - i=index(init, '-')-1 - if (i .le. 0) i=len(init) - else - i=len(init) - endif - iret=tecs_init(init(1:i), port) - - else - -c if INIT exists, read it to get the port number and the start command - - startcmd=' ' - - call sys_open(lun, init, 'R', ios) - if (ios .eq. 0) read (lun, *, iostat=ios) port - if (ios .eq. 0) read (lun, *, iostat=ios) ! skip options line - if (ios .eq. 0) read (lun, '(a)', iostat=ios) startcmd - close(lun) - if (ios .ne. 0) then - iret=-2 - call err_msg('TECS_OPEN: init file not found') - return - endif - if (port .eq. 0) port=9753 - iret=tecs_init(startcmd, port) - - endif - end - - SUBROUTINE TECS_GET_T (IOLUN, TEMP, IRET) !! -!! ========================================= -!! -!! Get temperatures and wait if TECS is configuring -!! - implicit none - -c Define the dummy arguments - - integer IOLUN !! unit to write informational messages - real*4 TEMP(4) !! TASMAD temperature array: set-temp, regulation, sample, aux-temp - integer IRET !! IRET=0: o.k., IRET<0: error -c------------------------------------------------------------------------------ - integer tecs_get3, tecs_wait - external tecs_get3, tecs_wait -c------------------------------------------------------------------------------ - iret=tecs_get3(temp(1), temp(3), temp(2)) ! temp(2) and temp(3) are exchanged in MSHOWT - if (iret .lt. 0) then - call err_txt('tecs_get_3'//char(10)//'tecs_get_t') - return - endif - if (iret .gt. 0) then -! write(iolun, *) 'configuring temperature controller ...' -! iret=tecs_wait() -! if (iret .lt. 0) then -! call err_txt('tecs_wait'//char(10)//'tecs_get_t') -! return -! endif -! write(iolun, *) '... done' -! iret=tecs_get3(temp(1), temp(3), temp(2)) ! temp(2) and temp(3) are exchanged in MSHOWT -! if (iret .lt. 0) then -! call err_txt('tecs_get3(2)'//char(10)//'tecs_get_t') -! return -! endif - endif - temp(4)=0.0 ! no auxilliary sensor - end - - subroutine TECS_WRITE_ERROR(IOLUN) !! -!! ================================== -!! -!! write out error message of last error and stack info -!! - implicit none - - integer IOLUN !! logical unit for output - - external tecs_err_routine - - call err_set_outrtn(tecs_err_routine, iolun) - call err_show('Error in TECS') - end - - - subroutine TECS_WRITE_MSG(IOLUN) !! -!! ================================ -!! -!! write out error message of last error without stack info -!! - implicit none - - integer IOLUN !! logical unit for output - - external tecs_err_routine - - call err_set_outrtn(tecs_err_routine, iolun) - call err_short - end - - - SUBROUTINE TECS_ERR_ROUTINE (LUN, TEXT) -! ======================================= -! -! routine called from C -! - implicit none -c-------------------------------------------------------------- -c Define the dummy arguments - byte text(128) - integer lun -c-------------------------------------------------------------- - integer i, j -c-------------------------------------------------------------- - do i=1,128 - if (text(i) .eq. 0) then - write(lun, '(x,128a1)') (text(j), j=1,i-1) - return - endif - enddo -! no terminating ASCII NUL found - write(lun, *) 'error in TECS_ERR_ROUTINE: illegal error text' - end diff --git a/tecs/tecs_logger.c b/tecs/tecs_logger.c deleted file mode 100644 index 527d0a6..0000000 --- a/tecs/tecs_logger.c +++ /dev/null @@ -1,2 +0,0 @@ -#define TECS_LOG 1 -#include "../../logger.c" diff --git a/tecs/tecs_lsc.c b/tecs/tecs_lsc.c deleted file mode 100644 index 3b678c3..0000000 --- a/tecs/tecs_lsc.c +++ /dev/null @@ -1,217 +0,0 @@ -#include -#include -#include -#include -#include -#include "myc_err.h" -#include "coc_logfile.h" -#include "coc_server.h" -#include "tecs_lsc.h" -#include "myc_str.h" - -#define MAX_PAR 16 -#define MAX_ARG 9 - -int LscEqPar(char *par, char *res) { - char *p, *r, pbuf[SER_BUF_LEN], rbuf[SER_BUF_LEN]; - int i1,i2; - float f1, f2; - - p=par; - r=res; - while (p!=NULL) { - if (r==NULL) { - return(0); - } - p=str_split(pbuf, p, ','); - str_trim(pbuf, pbuf, sizeof(pbuf)); - r=str_split(rbuf, r, ','); - str_trim(rbuf, rbuf, sizeof(rbuf)); - if (pbuf[0]!='\0' && 0!=strcasecmp(pbuf, rbuf)) { - i1=sscanf(pbuf, "%f", &f1); - i2=sscanf(rbuf, "%f", &f2); - if (i1!=1 || i2!=1 || abs(f1-f2)>1e-4+abs(f1)*5e-6) { - logfileOut(LOG_INFO, "%s#%s\n", pbuf, rbuf); - return(0); - } - } - } - return(1); -} - -#define nLIST 30 - -char *LscCmd(SerChannel *ser, const char *cmds) { - char *blank, *colon, *qu, *res; - const char *p, *this, *next, *cmd_ptr, *retreq; - const char *list[nLIST]; - char seg[SER_BUF_LEN], result[SER_BUF_LEN], par[SER_BUF_LEN]; - char cmd[SER_BUF_LEN]; - char varname[32]; - DeclStrBuf(sbuf, SER_BUF_LEN); - int nres, i, response, try; - - nres=0; - response=0; - this=cmds; - while (this!=NULL) { - next=str_split(cmd, this, ';'); - retreq=strchr(cmd, '>'); - if (retreq!=NULL) { /* save pointer to return request */ - i=retreq-cmd; - cmd[i]='\0'; /* cut return request */ - list[nres]=this+i; - nres++; assert(nres<=nLIST); - } - cmd_ptr=sbuf.buf+sbuf.wrpos; /* pointer to command in buffer */ - p=str_split(seg, cmd, '['); - ERR_I(StrPut(&sbuf, seg, StrNONE)); - while (p!=NULL) { /* substitute variables */ - p=str_split(varname, p, ']'); - if (p==NULL) ERR_MSG("missing ']'"); - ERR_I(CocPutVar(varname, &sbuf, StrNONE)); - p=str_split(seg, p, '['); - ERR_I(StrPut(&sbuf, seg, StrNONE)); - } - ERR_I(str_copy(cmd, cmd_ptr)); - colon=strchr(cmd_ptr, ':'); - if (colon!=NULL) { /* command with query */ - blank=strchr(cmd_ptr, ' '); - if (blank==NULL || blank>colon) { - *colon=' '; blank=colon; - } else { - *colon=','; - } - list[nres]=colon+1; nres++; assert(nres<=nLIST); /* pointer to parameters */ - list[nres]=cmd_ptr; nres++; assert(nres<=nLIST); /* pointer to command */ - ERR_I(StrPut(&sbuf, ";", StrNONE)); - cmd[blank-cmd_ptr]='?'; /* build query */ - if (colon==blank) colon++; - cmd[colon-cmd_ptr]='\0'; - ERR_I(StrPut(&sbuf, cmd, ';')); /* put query */ - response=1; - } else { - qu=strchr(cmd, '?'); - ERR_I(StrPut(&sbuf, ";", StrNONE)); - if (qu!=NULL) { /* command is a query */ - response=1; - if (retreq==NULL) { - /* ERR_MSG("missing return format"); */ - } - list[nres]=NULL; nres++; assert(nres<=nLIST); - } else { - if (retreq!=NULL) ERR_MSG("no return request allowed after command without query "); - } - } - this=next; - } - - if (!response) { - ERR_I(StrPut(&sbuf, "busy?",'\0')); - } else { - sbuf.buf[sbuf.wrpos-1]='\0'; /* strip off trailing ";" */ - } - - try = 3; - while (1) { - ERR_P(res=SerCmd(ser, sbuf.buf)); - if (0!=strncmp("?TMO", res, 4)) { - break; - } - try--; - if (try <= 0) { - ERR_MSG("timeout"); - } - } - /* - list[0..nres-1] contains a now: - for a command with return request: - - a pointer to a the request - then, for a command with query: - - a pointer to the parameters and - - a pointer to the command - this is repeated for every command - */ - - /* check results */ - this=res; - for (i=0; i') { - i++; - } else { - retreq=NULL; - } - } - if (list[i]!=NULL) { - qu=str_split(par, list[i], ';'); /* get parameters */ - i++; - if (!LscEqPar(par, result)) { /* try again with single command */ - qu=strchr(qu, ';'); - assert(list[i]!=NULL); - str_copy(cmd, list[i]); - if (qu!=NULL) cmd[qu-list[i]]='\0'; - ERR_P(qu=SerCmd(ser, cmd)); - if (!LscEqPar(par, qu)) { - if (0!=strcmp(result, qu)) { - ERR_MSG("result does not match"); - } else { - ERR_MSG("result does not match command"); - } - } - } - } - if (retreq!=NULL) { /* query */ - StrLink(&sbuf, result); - str_split(par, retreq+1, ';'); - p=par; - while (p!=NULL) { - p=str_split(varname, p, ','); - if (varname[0]!='\0') { - if (p==NULL) { /* last element: get rest of line */ - ERR_I(CocGetVar(varname, &sbuf, '\0')); - } else { - ERR_I(CocGetVar(varname, &sbuf, ',')); - } - } else { - ERR_P(StrGet(&sbuf, varname, ',')); - } - } - } - } - return(res); - OnError: return(NULL); -} - - -char *LscReadStat(int stat) { - if (stat &128) return("units overrange"); - if (stat & 64) return("units zero"); - if (stat & 32) return("temp overrange"); - if (stat & 16) return("temp underrange"); - if (stat & 2) return("old reading"); - if (stat & 1) return("invalid reading"); - return (""); -} - -static char - *heaterStatus[7]={ - "", - "heater supply over V", - "heater supply under V", - "heater output DAC error", - "heater Ilimit DAC error", - "open heater load", - "heater load < 10 Ohm", - }; - -char *LscHtrStat(int stat) { - if (stat<0 || stat>sizeof(heaterStatus)) { - return("unknown heater status"); - } else { - return(heaterStatus[stat]); - } -} diff --git a/tecs/tecs_lsc.h b/tecs/tecs_lsc.h deleted file mode 100644 index 10db37f..0000000 --- a/tecs/tecs_lsc.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef _TECS_LSC_H_ -#define _TECS_LSC_H_ - -#include "tecs_serial.h" - -char *LscCmd(SerChannel *ser, const char *cmds); -/* - Send commands to LSC-340. - There may be several commands separated by semicolon. - A special syntax is used: - - Commands containing a colon are commands with query, - i.e. the sent parameters are checked. The sent parameters - are those after the query, the command before the colon - is used as query, after inserting a question mark. - - Variable names in square brackets are substitute by their value - - Return values may be assigned to variables, separated by - a right angle bracket. There may be several variables - separated by comma, corresponding to the returned parameters, - beeing separated by commas also. If the variable is not terminated - by a comma, the whole remaining result is assigned, even if it - contains commas. Return values may only be used when a command - with wuery was sent, or when the command was a query (containing - a question mark). - - Example: - - LscCmd(ser, "RANGE:5>range;SETP 1:[tempH];CRVHDR?[num]>name,head;MODE 2"); - - assume that tempH=295 and num=25 the command sent to LSC is: - - RANGE 5;RANGE?;SETP 1,295;SETP?1;CRVHDR?25;MODE 2 - - and assume LSC sens back: - - 3;295.000E+00;CTI5 ,R10410 ,3,+330.000E+0,2 - - then the following variables will be assigned: - - range=3 - name="CTI5" - head="R10410 ,3,+330.000E+0,2" - - All used variables have to be declared with CocDef... (see coc_server.h) -*/ - -int LscEqPar(char *par, char *res); -/* - compare if parameters are equal (numbers as numbers, spaces ignored) - if any parameter in par is omitted, it is not compared -*/ - -char *LscReadStat(int stat); - -char *LscHtrStat(int stat); - -#endif /* _TECS_LSC_H_ */ diff --git a/tecs/tecs_plot.f b/tecs/tecs_plot.f deleted file mode 100644 index a4afe81..0000000 --- a/tecs/tecs_plot.f +++ /dev/null @@ -1,1020 +0,0 @@ - subroutine tecs_plot(reserved) - - character*(*) reserved - - integer dmax, nmax, nmenu, naux, nwin - parameter (dmax=1024, nmax=12, nmenu=13, nwin=4, naux=1) - ! dmax*nmax*4 should be less than COC_RES_LEN in coc_util.h - integer minRange, maxRange, oneDay - parameter (minRange=60, maxRange=7*24*3600, oneDay=24*3600) - integer zoom, right, live - parameter (zoom=1, right=2, live=3) - real winmin, undef - parameter (winmin=60., undef=-1.125/1024./1024./1024.) - - real*4 x1,x2,xmin,xmax,ymin(nwin),ymax(nwin),window - real*4 xd(dmax, nmax),yd(dmax,nmax), yy0(nmax), yy1(nmax) - real*4 ylast1,ylast2 - real*4 y1/0.0/,y2/0.0/ - real*4 ex,ey,fx,fy,row,ticks,tim0,tim1,menuwid - real*4 dx,dy - real*4 ylim(nmax) ! limits of sensor label text - integer l,j,n,t,leng,i1,i2,rl,startday,thisday - integer iostat - integer nset - integer ncol, mode - integer is ! 1...nset - integer im ! 1...nmax - integer first,last,step,tbase,lastj - integer retLen(nmax) - integer chartperiod/5/ - logical focus(nmax)/3*.true.,9*.false./ - logical omit(nmax)/12*.false./ - logical fixleft/.false./ - logical yzoom - integer winconf(nwin) ! number of windows below actual - integer showsets - integer nextfocus - real winh - integer nticks - character key*1 - character text(2,nmenu)*16/ - 1 'L' ,'live off' - 1 ,'z' ,'sel. zoom' - 1 ,'+' ,'zoom in' - 1 ,'-' ,'zoom out' - 1 ,'2d' ,'2 days' - 1 ,'1h' ,'1 hour' - 1 ,'15m' ,'15 min' - 1 ,'31.7t','goto date' - 1 ,'a' ,'all chan' - 1 ,'c' ,'clear chan' - 1 ,'s' ,'focus' - 1 ,'f' ,'write file' - 1 ,'q' ,'quit'/ - character weekdays(7)*4/ - 1 'Mon','Tue','Wed','Thu','Fri','Sat','Sun'/ - character buf*8, device*8, name*40, filnam*128, numb*16 - character title*64, pars*64, allpars*64 - character*4 parnam(nmax) - 1 /'Tm','Ts','Tr','Te','Tk','T1','T2','T3','T4','P','He','Aux'/ - integer unit(nmax) - 1 / 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4/ ! 1: Kelvin, 2: Watt, 3: %, 4: other - integer color(nmax) - 1 / 2, 4, 3, 5, 6, 8, 14, 15, 13, 2, 2, 2/ - integer isx(nmax)/12*1/ ! at begin all channels selected - integer imx(nmax) - save imx - integer idx(nmax) - logical gap, done - logical saveit - integer iret, lund, numl, mon, day - integer pars_len, title_len, text_len, name_len - character line*132 - real x0 - logical loop - integer tdif - integer fact - - ! functions - integer myc_now, myc_time, myc_date, get_data - integer tecs_get_mult, tecs_get_par - integer pgopen - - data window/0./ - - fact=1 - read(reserved, *, iostat=iostat) fact - if (fact .lt. 1) fact=1 - if (window .eq. 0) window=1800. - iret = tecs_get_mult(' logperiod ', t, 1, dx) - if (iret .lt. 0) goto 99 - chartperiod = nint(dx) - if (chartperiod .lt. 1) chartperiod=5 - saveit=.false. - mode=live - yzoom=.false. - iret=pgopen(' ') - - call pgqinf('TYPE', device, l) - if (device .eq. 'NULL' .or. iret .le. 0) then - call pgclos - iret=pgopen('?') - call pgqinf('TYPE', device, l) - if (device .eq. 'NULL' .or. iret .le. 0) then - print *,'No PGPLOT-Device defined' - goto 9 - endif - call sys_setenv('PGPLOT_DEV', '/'//device) - endif - - call pgqcol(j,ncol) - ! print *,j,ncol,' colors ',device - if (ncol .ge. 8 .and. device .ne. 'VT125') then - call pgscr(0, 1.0, 1.0, 1.0) - call pgscr(1, 0.0, 0.0, 0.0) - call pgscr(2, 1.0, 0.0, 0.0) - call pgscr(3, 0.0, 1.0, 0.0) - call pgscr(4, 0.0, 0.0, 1.0) - call pgscr(5, 0.0, 1.0, 1.0) - call pgscr(6, 1.0, 0.0, 1.0) - call pgscr(7, 1.0, 1.0, 0.0) - call pgscr(8, 1.0, 0.5, 0.0) - endif - - call pgask(.false.) - call pgupdt - l=0 - x1=0 - step=0 - allpars=' ' - do im=1,nmax - call str_trim(allpars, allpars, l) - allpars=allpars(1:l)//' '//parnam(im) - enddo - showsets=1 - nextfocus=0 - -1 continue - - iret=tecs_get_mult(allpars, t, nmax, yy1) - if (iret .lt. 0) goto 99 - tdif=myc_now()-t - tdif=tdif-mod(tdif+1800*25, 3600)+1800 ! round to next full hour - if (tdif .gt. 7200 .or. tdif .lt. -7200) then ! a hack - t=myc_now() - tdif=0 - endif - if (tdif .ne. 0) then - print *,'time difference ',tdif/3600,' h' - endif - t=t+tdif - if (showsets .eq. 1) then ! select only channels which have NOW a signal - do im=1,nmax - if (isx(im) .eq. 0 .and. yy1(im) .ne. undef) then - isx(im)=1 - endif - enddo - else if (showsets .eq. 2) then ! select all channels - do im=1,nmax - isx(im)=1 - focus(im)=unit(im) .eq. 1 - enddo - endif - is=0 - pars=' ' - do im=1,nmax - if (omit(im)) then - isx(im)=0 - omit(im)=.false. - else if (isx(im) .ne. 0) then - is=is+1 - isx(im)=is - imx(is)=im - call str_trim(pars, pars, pars_len) - pars=pars(1:pars_len)//' '//parnam(im) - endif - enddo - nset=is - - if (window .eq. 0) then - last=t - step=maxRange/dmax - window=maxRange - first=t-min(dmax*step-1,maxRange-step) - else if (mode .ge. right) then - last=t - if (fixleft) then - window=last-tbase-x1 - fixleft=.false. - endif - step=window/(dmax-2)+0.99 - last=t - first=t-min(dmax*step-1,nint(window)) -! if (first .ne. t-nint(window)) then -! print *,'t-shift',first-(t-nint(window)) -! endif - else - if (mode .eq. zoom) then - x2=(x1+x2+window)/2 - x1=x2-window - endif - if (x1 .gt. x2-minRange) x1=x2-minRange - step=(x2-x1)/(dmax-2)+0.99 - last=x2+tbase - first=x1-step+tbase - endif - if (step .eq. 0) step=1 - - if (step .gt. 60) then ! normalize step - step=(step+59)/60*60 - else if (step .gt. 30) then - step=60 - else if (step .gt. 20) then - step=30 - else - step=(step+chartperiod-1)/chartperiod*chartperiod - endif - first=last-(last-first+step-1)/step*step ! round first - ! print *,step,last-first - tbase=first-mod(first,7*oneDay) - iret=get_data(pars, first-tdif, last-tdif, step*fact, tbase-tdif - 1 , xd, yd, dmax, nmax, retLen) - if (iret .lt. 0) goto 99 - - x2 = last - tbase - if (mode .ge. right) then - x1=x2-window - else - x1 = first - tbase - endif - tim0=t-tbase - - do is=1,nset - im=imx(is) - leng=retLen(is) - do while (leng .gt. 1 .and. yd(leng,is) .eq. undef) - leng=leng-1 - enddo - if (leng .eq. 1) leng=0 - retLen(is)=leng - yy0(is)=yy1(im) - if (leng .gt. 0) then - if (mode .eq. live) then - xd(leng,is)=tim0 - yd(leng,is)=yy0(is) - endif - omit(im)=.false. -! else if (showsets .eq. 2) then ! next time omit unused channels -! omit(im)=.true. - endif - enddo - - showsets=0 - - j=0 - do im=1,nmax - is=isx(im) - if (focus(im)) then - if (is .ne. 0 .and. unit(im) .eq. 1) then - if (retLen(is) .gt. 0) then - j=j+1 ! focus o.k. - goto 2 - endif - endif - focus(im)=.false. - if (j .eq. 0 .and. im .lt. nmax) focus(im+1)=.true. -2 continue - endif - enddo - if (j .eq. 0) then - if (nextfocus .ne. 0) then - do is=1,nset - im=imx(is) - if (retLen(is) .gt. 0 .and. unit(im) .eq. 1) focus(im)=.true. - enddo - else if (.not. yzoom) then - y1=ymin(1) - y2=ymax(1) - yzoom=.true. - endif - endif - nextfocus=0 - if (saveit) goto 9 - if (mode .eq. live) then - x2=max(tim0,x2)+min(1800., window*0.5) - endif - - if (window .gt. 36*3600) then - ticks=12*3600 - if (window .lt. 60*3600) then - nticks=6 - else - nticks=2 - endif - elseif (window .gt. 18*3600) then - ticks=6*3600 - if (window .lt. 30*3600) then - nticks=6 - else - nticks=3 - endif - elseif (window .gt. 10*3600) then - ticks=2*3600 - nticks=2 - elseif (window .gt. 3*3600) then - ticks=3600 - if (window .lt. 5*3600) then - nticks=6 - else - nticks=2 - endif - elseif (window .gt. 6000) then - ticks=1200 - nticks=2 - elseif (window .gt. 1800) then - ticks=600 - if (window .lt. 3600) then - nticks=5 - else - nticks=2 - endif - elseif (window .gt. 900) then - ticks=300 - nticks=5 - elseif (window .gt. 600) then - ticks=120 - nticks=2 - elseif (window .gt. 120) then - ticks=60 - if (window .lt. 300) then - nticks=6 - else - nticks=2 - endif - else - ticks=30 - nticks=3 - endif - - do rl=1,nwin - winconf(rl)=nwin-rl ! number of windows to follow - enddo - - do rl=1,nwin - if (yzoom .and. rl .eq. 1) then - if (y2 .gt. y1) then - ymin(1)=y1 - ymax(1)=y2 - endif - else - ymin(rl)=1e30 - ymax(rl)=-1e30 - ylast1=ymin(rl) - ylast2=ymax(rl) - do is=1,nset - im=imx(is) - if (unit(im) .eq. rl .and. (focus(im) .or. rl .gt. 1)) then - do j=1,retLen(is) - if (yd(j,is) .ne. undef) then - ymin(rl)=min(ymin(rl),yd(j,is)) - ymax(rl)=max(ymax(rl),yd(j,is)) - endif - enddo - do j=max(1,retLen(is)-4),retLen(is) - if (yd(j,is) .ne. undef) then - ylast1=min(ylast1,yd(j, is)) - ylast2=max(ylast2,yd(j, is)) - endif - enddo - endif - enddo - - ey=(ymax(rl)-ymin(rl)) - fy=abs(ymax(rl)) - ymax(rl)=ymax(rl)+max(fy*0.02,ey*0.01) - ymin(rl)=ymin(rl)-max(fy*0.02,ey*0.01) - if (mode .eq. live) then - ymin(rl)=min(ymin(rl),max(0.0,ylast1-ey*0.4)) - ymax(rl)=max(ymax(rl),ylast2+ey*0.4) - endif - endif - - if (ymax(rl) .lt. ymin(rl)) then - do j=1,rl-1 - winconf(j)=winconf(j)-1 - enddo - ymax(rl)=1.0 - ymin(rl)=0 - elseif (ymax(rl) .eq. ymin(rl)) then - ymax(rl)=ymin(rl)*1.00001+1.0 - ymin(rl)=-1.0e-3 - endif - enddo - - winh=0.9/(winconf(1)+3.5) - - do rl=1,nwin - - if (rl .gt. 1) then - if (winconf(rl) .eq. winconf(rl-1)) goto 6 ! window empty - endif - call set_win(rl,winh,winconf,x1,x2,ymin(rl),ymax(rl)) - - do is=nset,1,-1 - im=imx(is) - if (unit(im) .eq. rl) then - call pgsci(color(im)) - l=0 - lastj=1 - do j=1,retLen(is) - if (yd(j,is) .eq. undef) then - if (j .gt. lastj) then - call pgline(j-lastj, xd(lastj,is), yd(lastj,is)) - endif - lastj=j+1 - else - l=j - endif - enddo - if (retLen(is) .gt. lastj) - 1 call pgline(retLen(is)+1-lastj, xd(lastj,is), yd(lastj,is)) - retLen(is)=l - endif - enddo - call pgsci(1) - if (rl .eq. 1) then - call pgsch(1.0) - call pgtbox('ZHXYBINST', ticks, nticks, 'BCINMST1', 0.0, 0) - call pgtbox('C', 0.0, 0, ' ', 0.0, 0) - ey=0.0 - do is=1,nset - im=imx(is) - if (unit(im) .eq. rl .and. retLen(is) .gt. 0) then - name=parnam(im) - if (name .eq. 'Tm') then - name='Main' - elseif (name .eq. 'Ts') then - name='Sample' - elseif (name .eq. 'Tr') then - name='Set' - endif - call str_trim(name, name, name_len) - if (focus(im)) then - name=name(1:name_len)//'*' - call str_trim(name, name, name_len) - endif - call pglen(5, name(1:name_len), fx, fy) - call pgsci(color(im)) - call pgmtxt ('L', 2.5, ey, 0.0, name(1:name_len)) - ey=ey+fy+0.04 - endif - ylim(is)=ymin(1)+(ey-0.02)*(ymax(1)-ymin(1)) - enddo - call pgsci(1) - call pgmtxt ('L', 2.5, ey, 0.0, 'T [K]') - else - do is=1,nset - im=imx(is) - if (unit(im) .eq. rl) goto 5 - enddo - im=0 -5 if (im .ne. 0) then - call pgsch(4*winh) - call pgtbox('ZCIST', ticks, nticks, 'BINST1', 0.0, 0) - call pgtbox('B', 0.0, 0, 'CIVMST', 0.0, 0) - call pgsci(color(im)) - call pgsch(1.0) - if (parnam(im) .eq. 'P' .or. parnam(im) .eq. 'p') then - call pgmtxt ('L', 2.5, 0.5, 0.5, 'Power [W]') - elseif (parnam(im) .eq. 'He') then - title='%' - iret=tecs_get_par('heUnits', title, 0) - call str_trim(title, title, title_len) - call pgmtxt ('L', 2.5, 0.5, 0.5, - 1 'Helium ['//title(1:title_len)//']') - else - call pgmtxt ('L', 2.5, 0.5, 0.5, parnam(im)) - endif - endif - endif -6 continue - enddo - - call pgsch(0.7) - rl=1 - call set_win(rl,winh,winconf,x1,x2,ymin(rl),ymax(rl)) - - call pgsci(1) - call pgsclp(0) - if (mode .eq. live) then - text(2,1)='live off' - else - text(2,1)='live on' - endif - menuwid=0.0 - do j=1,nmenu - call str_trim(text(2,j), text(2,j), text_len) - call pglen(5, text(2,j)(1:text_len), fx, fy) - call pgmtxt('T', 3.0, menuwid, 0.0, '|'//text(1,j)) - call pgmtxt('T', 2.5, menuwid, 0.0, '|') - call pgmtxt('T', 2.0, menuwid, 0.0, '|'//text(2,j)) - menuwid=menuwid+fx+0.01 - enddo - call pgmtxt('T', 3.0, menuwid, 0.0, '|') - call pgmtxt('T', 2.5, menuwid, 0.0, '|') - call pgmtxt('T', 2.0, menuwid, 0.0, '|') - menuwid=menuwid+0.01 - - call pgsch(0.8) - done=.false. - row=(ymax(rl)-ymin(rl))/30. - ey=ymin(rl)-row*3.5 - j=max(0,int((x1+oneDay/2)/oneDay)) - - ex=(j+0.5)*oneDay - do while (ex .le. x2) - done=.true. - write(buf,'(i8.8)') myc_date(nint(ex)+tbase) - call pgptxt(ex, ey, 0.0, 0.5, - 1 weekdays(mod(j,7)+1)//buf(7:8)//'.'//buf(5:6)) - ex=ex-12*3600 - if (ex .gt. x1) then - call pgmove(ex, ey) - call pgdraw(ex, ey+row) - endif - ex=ex+oneDay - if (ex .lt. x2) then - call pgmove(ex, ey) - call pgdraw(ex, ey+row) - endif - j=j+1 - ex=(j+0.5)*oneDay - enddo - if (.not. done) then - n=nint(x2)/oneDay*oneDay - l=nint(x1)-n - j=nint(x2)-n - if (l .lt. 0) then - if (-l .gt. j) then - ex=0.0 - l=nint(x1)+tbase - else - ex=1.0 - l=nint(x2)+tbase - endif - else - ex=0.5 - l=nint(x2)+tbase - endif - thisday=mod(l/oneDay,7)+1 - write(buf,'(i8.8)') myc_date(l) - call pgmtxt('B', 3.5, ex, ex, - 1 weekdays(thisday)//buf(7:8)//'.'//buf(5:6)) - endif - - iret=tecs_get_par('device', title, 0) - if (iret .lt. 0) goto 99 - j=index(title, '(') - if (j .gt. 2 ) then - title=title(1:j-1) - else if (title .eq. ' ') then - title='test - no device' - endif - - if (mode .eq. live) then - call pgmtxt('T', -1.5, 0.02, 0.0, title) - endif - call pgsclp(1) - - call purge_keys ! purge buffer - - numl=0 - numb=' ' -7 ex=undef - if (mode .eq. live) then - ! if (device(1:1) .eq. 'X') then - ! call pgmtxt('T', 0.5, 0.0, 0.0, 'LIVE MODE (click on text window before pressing any further key)') - ! endif - ! call get_key(key, 0, chartperiod) - j=chartperiod-mod(myc_now(), chartperiod) - call get_cursor(ex, ey, key, -j) - - do while (key .eq. char(0) .or. key .eq. ' ') ! no key or space key pressed - iret=tecs_get_mult(pars, t, nset, yy1) - if (iret .lt. 0) goto 99 - t=t+tdif - tim1=t-tbase - if (tim1 .gt. x2) then - call pgpage - fixleft=.true. - goto 1 - endif - if (tim1 .gt. tim0) then - do rl=1,nwin - call set_win(rl,winh,winconf,x1,x2,ymin(rl),ymax(rl)) - do is=nset,1,-1 - im=imx(is) - if (unit(im) .eq. rl) then - if (yy0(is) .ne. undef .and. yy1(is) .ne. undef) then - if ((focus(im) .or. unit(im) .gt. 1) .and. - 1 (yy1(is) .lt. ymin(rl) .or. - 1 yy1(is) .gt. ymax(rl))) then - call pgpage - fixleft=.true. - goto 1 - endif - call pgsci(color(im)) - call pgmove(tim0, yy0(is)) - call pgdraw(tim1, yy1(is)) - endif - yy0(is)=yy1(is) - endif - enddo - enddo - tim0=tim1 - - endif - j=chartperiod-mod(myc_now(), chartperiod) - rl=1 - call set_win(rl,winh,winconf,x1,x2,ymin(rl),ymax(rl)) - call get_cursor(ex, ey, key, -j) - enddo - else - call get_cursor(ex, ey, key, 0) - endif - rl=1 - call set_win(rl,winh,winconf,x1,x2,ymin(rl),ymax(rl)) - -8 if (key .ge. 'a') key=char(ichar(key)-32) - if (key .eq. '-') then - window=min(window*2, 8.0*oneDay) - if (mode .eq. zoom) then - x1=x1-(x2-x1)/2 - x2=x2+(x2-x1)/3 - endif - if (yzoom) then - y1=y1-(y2-y1)/2 - y2=y2+(y2-y1)/3 - endif - elseif (key .eq. 'X') then - window=0 - mode=0 - yzoom=.false. - elseif (key .eq. '+' .or. key .eq. ',') then - window=max(winmin,window/2) - if (ex .eq. undef) then - ex=(x1+x2)/2 - ey=(min(y2,ymax(1))+max(y1,ymin(1)))/2 - end if - if (mode .eq. zoom) then - fx=max(winmin,x2-x1) - x1=ex-fx/4 - x2=ex+fx/4 - endif - if (yzoom) then - fy=max(y2-y1,1e-3,y2*1e-5) - y1=ey-fy/4 - y2=ey+fy/4 - endif - elseif (key .eq. 'Z') then - call pgsci(1) - if (ex .eq. undef) then - call pgmtxt('T', 0.5, 0.0, 0.0, - 1 'click on two opposite corners of a selection rectangle') - call get_cursor(ex, ey, key, 0) - else - call pgmtxt('T', 0.5, 0.0, 0.0, - 1 'click on second corner of selection rectangle') - endif - call pgsci(6) - xmin=x1 - xmax=x2 - call pgmove(xmin, ey) - call pgdraw(xmax, ey) - call pgmove(ex, ymin(rl)) - call pgdraw(ex, ymax(rl)) - if (device(1:1) .eq. 'X') then - fx=ex - fy=ey - call get_cursor(fx, fy, key, 2) - else - call get_cursor(fx, fy, key, 0) - endif - x1=max(xmin,min(ex,fx)) - x2=min(xmax,max(ex,fx)) - if (x1 .ge. x2) then - x1=xmin - x2=xmax - endif - window=x2-x1 - y1=max(ymin(1),min(ey,fy)) - y2=min(ymax(1),max(ey,fy)) - if (y1 .ge. y2) then - y1=ymin(1) - y2=ymax(1) - endif - if (y1 .ne. ymin(1) .or. y2 .ne. ymax(2)) then - yzoom=.true. - endif - if (x1 .ne. xmin .or. x2 .ne. xmax) then - mode=zoom - endif - elseif (key .eq. 'J') then - dx=ex-(xmax+xmin)*0.5 - dy=ey-(ymax(1)+ymin(1))*0.5 - x1=xmin+dx - x2=xmax+dx - y1=ymin(1)+dy - y2=ymax(1)+dy - mode=zoom - yzoom=.true. - elseif (key .ge. '0' .and. key .le. '9' .or. key .eq. '.') then ! number - if (numl .lt. len(numb)) then - numl=numl+1 - numb(numl:numl)=key - call pgsci(1) - call pgsch(0.8) - call pgmtxt('T', 2.0, menuwid, 0.0, numb(1:numl)) - endif - ! if (mode .eq. zoom) mode=0 - goto 7 - elseif (key .eq. 'D') then - ex=1 - read(numb, *, iostat=iostat) ex - window=min(maxRange,max(minRange, nint(oneDay*ex))) - if (mode .lt. right) mode=right - yzoom=.false. - x1=0 - elseif (key .eq. 'H') then - ex=1 - read(numb, *, iostat=iostat) ex - window=min(maxRange,max(minRange, nint(3600*ex))) - if (mode .lt. right) mode=right - yzoom=.false. - x1=0 - elseif (key .eq. 'M') then - ex=1 - read(numb, *, iostat=iostat) ex - window=min(maxRange,max(minRange, nint(60*ex))) - if (mode .lt. right) mode=right - yzoom=.false. - x1=0 - elseif (key .eq. 'T' .or. numl .gt. 0 .and. - 1 (key .eq. char(13) .or. key .eq. char(10))) then - j=index(numb,'.') - day=0 - if (j .gt. 1 .and. j .lt. numl) then - read(numb(1:j-1), *, iostat=iostat) day - mon=0 - numb=numb(j+1:numl) - j=index(numb,'.') - if (j .gt. 0) numb(j:)=' ' - read(numb, *, iostat=iostat) mon - tbase = myc_time(day+mon*100) - else - read(numb, *, iostat=iostat) day - tbase = myc_time(day) - endif - x1=0 - x2=oneDay - window=x2 - mode=zoom - yzoom=.false. - elseif (key .eq. 'L') then - if (mode .eq. live) then - mode=right - else - mode=live - endif - elseif (key .eq. 'F') then - saveit=.true. - elseif (key .eq. 'Q' .or. key .eq. char(13) - 1 .or. key .eq. char(10)) then - goto 9 - elseif (key .eq. 'A') then - showsets=2 - yzoom=.false. - elseif (key .eq. 'C') then ! clear set - if (ex .lt. x1) then - if (ey .ge. ymin(1) .and. - 1 ey .le. ymax(1)) then - do is=1,nset - if (ey .lt. ylim(is)) then - im=imx(is) - omit(im)=.true. - goto 1 - endif - enddo - else - ey=(ymin(1)-ey)/(ymax(1)-ymin(1))*3.0+0.5 - if (ey .gt. 1.0) then - do im=1,nmax - j=unit(im) - if (winconf(1)-winconf(j) .eq. int(ey)) then - omit(im)=.true. - endif - enddo - endif - endif - endif - elseif (key .eq. 'S') then ! toggle focus - if (ex .lt. x1) then - if (ey .ge. ymin(1) .and. - 1 ey .le. ymax(1)) then - do is=1,nset - if (ey .lt. ylim(is)) then - im=imx(is) - focus(im)=.not. focus(im) - goto 89 - endif - enddo - endif - endif - j=nset - n=0 - do is=1,nset - im=imx(is) - if (focus(im)) then - focus(im)=.false. - j=is - n=n+1 - endif - enddo - if (n .gt. 1) then - if (j .gt. 3) then ! was "all", set to "default" - focus(1)=.true. - focus(2)=.true. - focus(3)=.true. - else ! was "default" select 1 - focus(1)=.true. - endif - goto 89 - endif - nextfocus=1 - do is=1,nset - im=imx(is) - if (im .gt. j) then ! select next - focus(im)=.true. - goto 89 - endif - enddo - ! select all - do is=1,nset - im=imx(is) - focus(im)=.true. - enddo -89 yzoom=.false. - elseif (mode .eq. live) then - goto 7 - endif - numl=0 - numb=' ' - call pgpage - goto 1 -99 call tecs_write_msg(6) -9 continue - call pgclos - call purge_keys - print * - if (saveit) then - lund=41 - print '(x,a,$)', 'Filename: ' - read(*,'(a)') filnam - open(lund, file=filnam, status='unknown') - - line='hour' - call str_trim(line, line, l) - do is=1,nset - im=imx(is) - idx(is)=0 - do j=1,retlen(is) - if (yd(j,is) .ne. undef) then - idx(is)=1 - l=l+1 - line(l:l)=char(9) - call str_trim(line(l+1:), parnam(im), text_len) - l=l+max(9,text_len) - goto 109 - endif - enddo -109 continue - enddo - write(lund, '(a)') line(1:l) - - n=1 - x0=0 - do while (x0 .lt. 3e7) - x0=4e7 - do is=1,nmax ! find next x - if (idx(is) .gt. 0 .and. idx(is) .lt. retlen(is)) then - x0=min(x0,xd(idx(is),is)) - endif - enddo - if (x0 .lt. 3e7) then - write(line,'(f9.4)') x0/3600. - l=9 - do is=1,nmax - if (idx(is) .gt. 0) then - l=l+1 - line(l:l)=char(9) - if (idx(is) .le. retlen(is)) then - if (xd(idx(is),is) .lt. x0+1) then - write(line(l+1:), '(f9.4)') - 1 max(-999.,min(9999.,yd(idx(is),is))) - l=l+9 - idx(is)=idx(is)+1 - endif - endif - endif - enddo - write(lund, '(a)') line(1:l) - n=n+1 - endif - enddo - close(lund) - print *, n, ' lines written to ',filnam(1:48) - endif - - end - - - subroutine get_cursor(x, y, key, mode) - character*1 key - real*4 x, y - integer mode - integer with_timeout/-1/ - integer l - character res*32 - - if (with_timeout .lt. 0) then - with_timeout=0 - call pgqinf('VERSION', res, l) - if (res(l:l) .eq. '+') then - call pgqinf('TYPE', res, l) - if (res(1:1) .eq. 'X') then - with_timeout=1 - end if - end if - end if - if (with_timeout .gt. 0 .or. mode .ge. 0) then - call pgband(mode, 0, x, y, x, y, key) - else - call sys_get_key(key, -mode) - endif - end - - - subroutine purge_keys - character key*1 - key=' ' - do while (key .ne. char(0)) - call sys_get_key(key, 0) - end do - end - - - subroutine set_win(rl, winh, winconf, x1, x2, y1, y2) - integer rl - real winh - integer winconf(*) - real x1, x2, y1, y2 - - real b - - if (rl .eq. 1) then - call pgsvp(0.07,0.93,0.9-3*winh,0.9) - else - b=winconf(rl)*winh - call pgsvp(0.07,0.93,b+0.01,b+winh-0.01) - endif - - call pgswin(x1,x2,y1,y2) - end - - - integer function get_data(pars, first, last, step, tbase - 1 , xd, yd, dmax, nmax, retlen) - - character pars*(*) - integer first, last, step, tbase, dmax, nmax, retlen(nmax) - real*4 xd(dmax,nmax), yd(dmax,nmax) - - integer oneDay, maxn - parameter (oneDay = 24*3600, maxn=12) - integer tecs_get_data - - integer i,j,rl(maxn),m,k,n,mm - - if (nmax .gt. maxn) stop 'get_data: nmax>maxn' - if (last-first .le. oneDay) then - get_data=tecs_get_data(pars, first, last, step, tbase - 1 , xd, yd, dmax, nmax, retLen) - else - do j=1,nmax - retlen(j)=0 - enddo - m=0 - do i=first/oneDay,last/oneDay - get_data=tecs_get_data(pars, max(first,i*oneDay) - 1 , min(last,(i+1)*oneDay-step), step, tbase - 1 , xd(m+1, 1), yd(m+1, 1), dmax, nmax, rl) - if (get_data .lt. 0) return - mm=0 - do j=1,nmax - n=retlen(j) - do k=m+1,m+rl(j) - n=n+1 - xd(n,j)=xd(k,j) - yd(n,j)=yd(k,j) - enddo - retlen(j)=n - mm=max(mm,n) - enddo - if (m .gt. 0) then - print '(a,$)',' .' - endif - m=mm - enddo - endif - end diff --git a/tecs/tecs_serial.c b/tecs/tecs_serial.c deleted file mode 100644 index dc1adec..0000000 --- a/tecs/tecs_serial.c +++ /dev/null @@ -1,265 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include "rs232c_def.h" -#include "asynsrv_def.h" -#include "sinq_prototypes.h" -#include "myc_err.h" -#include "tecs_serial.h" -#include "coc_logfile.h" -#include "coc_util.h" -#include "myc_str.h" -#include "myc_mem.h" -#include "uselect.h" - -#define ASYNSRV_TYPE 1 -#define TERMSRV_TYPE 2 -#define EOT '\r' - -typedef struct { - char host[64]; - int type; /* = ASYNSRV_TYPE */ - struct AsynSrv__info asyn_info; /* Contains skt, host, port & chan */ - struct RS__MsgStruct to_host; - struct RS__RespStruct from_host; -} AsynSrvChan; - -typedef struct { - char host[64]; - int type; /* = TERMSRV_TYPE */ - char res[SER_BUF_LEN]; - int fd, tmo; - int (*idleHdl)(int,int); -} TermSrvChan; - -void SerA_error(void) { - char *a_txt; - int a_cod, a_my, a_vms; - - AsynSrv_ErrInfo(&a_txt, &a_cod, &a_my, &a_vms); - ErrMsg("asynsrv error"); ErrTxt(a_txt,0); -} - -int SerWait(int tmo_msec, int fd) { - struct timeval tmo; - fd_set mask; - int i; - - FD_ZERO(&mask); - FD_SET(fd, &mask); - - tmo.tv_sec=tmo_msec / 1000; - tmo.tv_usec=(tmo_msec % 1000) % 1000 +1; - ERR_SI(i=uselect(fd+1,&mask,NULL,NULL,&tmo)); - - if (i==0) return(0); /* timeout */ - return(1); - OnError: return(-1); -} - -SerChannel *SerOpen(const char *hostPort, int msecTmo, int (*idleHdl)(int,int)) { - AsynSrvChan *aser; - TermSrvChan *tser; - char hbuf[64], cport[16], host[32]; - char *p, *c; - struct sockaddr_in sadr; - int iret; - time_t t1, t2; - static int ecnt; - - time(&t1); - str_copy(hbuf, hostPort); - p=str_split(host, hbuf, ':'); - ERR_P(p); - c=str_split(cport, p, '/'); - if (msecTmo==0) msecTmo=5000; - if (c!=NULL) { - NEW(aser, AsynSrvChan); aser->type=ASYNSRV_TYPE; - str_copy(aser->asyn_info.host, host); - aser->asyn_info.port=atoi(cport); - aser->asyn_info.chan=atoi(c); - - iret=AsynSrv_Open(&aser->asyn_info); - if (iret==1) { - iret=AsynSrv_Config(&aser->asyn_info, "msecTmo", msecTmo, "idleHdl", idleHdl, NULL); - } - if (iret!=1) { SerA_error(); goto OnError; } - time(&t2); - ecnt=0; - logfileOut(LOG_MAIN, "connection to %s:%d/%d opened (%d sec)\n", - aser->asyn_info.host, aser->asyn_info.port, aser->asyn_info.chan, - t2-t1); - str_copy(aser->host, hostPort); - return((SerChannel *)aser); - } else { - NEW(tser, TermSrvChan); tser->type=TERMSRV_TYPE; - tser->tmo=msecTmo; - if (idleHdl==NULL) { - tser->idleHdl=SerWait; - } else { - tser->idleHdl=idleHdl; - } - ERR_I(CocCreateSockAdr(&sadr, host, atoi(p))); - ERR_SI(tser->fd=socket(AF_INET, SOCK_STREAM, 0)); - ERR_SI(connect(tser->fd, (struct sockaddr *)&sadr, sizeof(sadr))); - time(&t2); - ecnt=0; - logfileOut(LOG_MAIN, "connected to %s (%d sec)\n", hostPort, t2-t1); - str_copy(tser->host, hostPort); - return ((SerChannel *)tser); - } - OnError: - time(&t2); - if (ecnt<4) { - logfileOut(LOG_MAIN, "failed after %d sec\n", t2-t1); - ecnt++; - } - return(NULL); -} - -int SerSetTmo(SerChannel *serch, int msecTmo) { - AsynSrvChan *aser; - TermSrvChan *tser; - int iret; - - if (serch->type==ASYNSRV_TYPE) { - aser=(AsynSrvChan *)serch; - iret=AsynSrv_Config(&aser->asyn_info, "msecTmo", msecTmo, NULL); - if (iret!=1) { SerA_error(); goto OnError; } - } else if (serch->type==TERMSRV_TYPE) { - tser=(TermSrvChan *)serch; - tser->tmo=msecTmo; - } - return 0; - OnError: return -1; -} - -void SerClose(SerChannel *serch) { - AsynSrvChan *aser; - TermSrvChan *tser; - - if (serch->type==ASYNSRV_TYPE) { - aser=(AsynSrvChan *)serch; - AsynSrv_Close(&aser->asyn_info, 1); - } else if (serch->type==TERMSRV_TYPE) { - tser=(TermSrvChan *)serch; - close(tser->fd); - } - serch->type=0; -} - -SerChannel *SerCheck(SerChannel *serch) { - if (serch==NULL || serch->type==0) { - return(NULL); - } else { - return(serch); - } -} - -char *SerCmd(SerChannel *serch, char *cmnd) { - int l, n; - AsynSrvChan *aser; - TermSrvChan *tser; - char *result, *pos; - char junk[256]; - int iret, incomplete; - - l=strlen(cmnd); - if (l>=SER_BUF_LEN-1) ERR_COD(ENOBUFS); - cmnd[l]=EOT; l++; - cmnd[l]='\0'; - - logfileOut(LOG_SER, ">%s\n", cmnd); - if (serch->type==ASYNSRV_TYPE) { - aser=(AsynSrvChan *)serch; - iret=AsynSrv_SendCmnds(&aser->asyn_info, &aser->to_host, &aser->from_host, cmnd, NULL); - if (iret!=1) { - SerA_error(); - SerClose(serch); - return(NULL); - } - result=AsynSrv_GetReply(&aser->asyn_info, &aser->from_host, NULL); - if (result==NULL) ERR_MSG("empty result"); - } else if (serch->type==TERMSRV_TYPE) { - tser=(TermSrvChan *)serch; - ERR_I(iret=SerWait(0, tser->fd)); - while (iret>0) { /* skip contents in type-ahead buffer */ - ERR_SI(l=recv(tser->fd, junk, sizeof(junk)-1, 0)); - if (l==0) { - ErrMsg("disconnected"); - SerClose(serch); - goto OnError; - } - junk[l]='\0'; - logfileOut(LOG_MAIN, "skipped: '%s'\n", junk); - ERR_I(iret=SerWait(0, tser->fd)); - } - iret=send(tser->fd, cmnd, l, 0); - if (iret<0) { - ErrMsg("disconnected"); - SerClose(serch); - goto OnError; - } - n=sizeof(tser->res); - pos=tser->res; - result=NULL; - incomplete=1; - while (incomplete) { - /* Wait for an event on tser->fd or a timeout tmo */ - iret=tser->idleHdl(tser->tmo, tser->fd); - if (iret==0) { - if (result==NULL) { - result="?TMO"; - return result; - } - /* if (result==NULL) ERR_MSG("timeout"); */ - ERR_MSG("missing terminator"); - } - ERR_SI(l=recv(tser->fd, pos, n, 0)); - if (l==0) { - ErrMsg("disconnected"); - SerClose(serch); - goto OnError; - } - n -= l; - if (n==0) ERR_MSG("answer too long"); - while (l>0) { - if (*pos>' ') { - if (result==NULL) result=pos; /* skip trailing white space */ - } else if (*pos<' ') { /* all control characters are treated as terminators */ - if (result!=NULL) { - *pos='\0'; - incomplete=0; - } - } - pos++; l--; - } - } - } else { - serch->type=0; - ERR_MSG("invalid channel"); - } - logfileOut(LOG_SER, "<%s\n", result); - - return(result); - OnError: - return(NULL); -} - -/* obsolete ? -char *SerCmdC(SerChannel *serch, const char *cmnd) { - char cmd[SER_BUF_LEN]; - int l; - - l=strlen(cmnd); - if (l>=SER_BUF_LEN-1) ERR_COD(ENOBUFS); - strcpy(cmd, cmnd); - return(SerCmd(serch, cmd)); - OnError: return(NULL); -} -*/ - diff --git a/tecs/tecs_serial.h b/tecs/tecs_serial.h deleted file mode 100644 index 8fb801b..0000000 --- a/tecs/tecs_serial.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef _SERUTIL_H_ -#define _SERUTIL_H_ - -#define SER_BUF_LEN 320 - -typedef struct { - char host[64]; - /* private */ - int type; -} SerChannel; - -SerChannel *SerOpen(const char *host, int msecTmo, int (*idleHdl)(int,int)); -char *SerCmd(SerChannel *ser, char *cmnd); -int SerSetTmo(SerChannel *ser, int msecTmo); -SerChannel *SerCheck(SerChannel *ser); -void SerClose(SerChannel *ser); - -/* char *SerCmdC(SerChannel *ser, const char *cmnd); */ - -#endif /* _SERUTIL_H_ */ diff --git a/tecs/tecsinstall b/tecs/tecsinstall deleted file mode 100755 index 583840a..0000000 --- a/tecs/tecsinstall +++ /dev/null @@ -1,176 +0,0 @@ -#!/bin/tcsh -# script to install tecs on an instrument computer -set base=/afs/psi.ch/project/sinq -set tecsdir=$base/common/lib/tecs -if ("$OSTYPE" == "linux") then - set osdir=$base/linux/stow/tecs -else if ("$OSTYPE" == "osf1") then - set osdir=$base/tru64/stow/tecs -else - echo "unknown os: $OSTYPE" - exit -endif - -if (! -d bin) then - echo no 'bin' directory found - exit -endif - -set inst=${PWD:t:al} -if ($inst == tascom) then - set inst=rita2 -endif -echo -n "enter lowercase instrument name [$inst]: " -set ans=$< -if ("$ans" != "") then - set inst="$ans" -endif -set sd=${inst}_sics -if (! -d $sd) then - set sd=bin -endif - -set ok=1 - -# find inst in inilist -set hos=(`grep "${inst}:" $tecsdir/inilist`) || set hos=(0 /) -set hos=$hos[2] -set hos=${hos:s/host=//} -if ("${hos:s,/,,}" != "$hos") then - set std=n -else - set std=y -endif - -set ans=n -if ($std == y) set $ans=y -echo -n "is tecs the standard environment on $inst [$std] ? " -set ans="$<" -if ("$ans" == "y" || "$ans" == "Y") then - set ans=y -else if ("ans" == "n" || "$ans" == "N") then - set ans=n -else - set ans=$std -endif - -echo "--------------------------------------------------------------------------" -if (-e $sd/startsics) then - grep "keep_running TecsServer" $sd/startsics > /dev/null - if (! $?) then - echo "the sequence starting TecsServer should be removed from $sd/startsics" - set ok="" - endif - grep startecs $sd/startsics > /dev/null - if ($?) then - if ($ans == y) then - echo "$sd/startsics should contain 'startecs'" - set ok="" - endif - else - if ($ans != y) then - echo "$sd/startsics should NOT contain 'startecs'" - set ok="" - endif - endif -else - echo "$sd/startsics not found" - set ok="" -endif - -set tecs_tcl_not_found=1 -if (-e $sd/${inst}.tcl) then - grep -i "DefineAlias tt " $sd/${inst}.tcl > /dev/null - if ($?) then - echo "$sd/${inst}.tcl should contain 'DefineAlias tt temperature'" - endif - grep -i "tecs on" $sd/${inst}.tcl > /dev/null - if ($?) then - if ($ans == y) then - echo "$sd/${inst}.tcl should contain 'tecs on'" - set ok="" - endif - else - if ($ans != y) then - echo "$sd/${inst}.tcl should NOT contain 'tecs on'" - set ok="" - endif - endif - grep "/tecs.tcl" $sd/${inst}.tcl > /dev/null - set tecs_tcl_not_found=$? -else - echo "$sd/${inst}.tcl not found" - set ok="" -endif - -if (-e $sd/${inst}com.tcl) then - grep "/tecs.tcl" $sd/${inst}com.tcl > /dev/null - if ($? && $tecs_tcl_not_found) then - set hom='$home' - echo "$sd/${inst}com.tcl should contain 'source $hom/$sd/tecs.tcl' or similar" - set ok="" - endif -else - echo "$sd/${inst}com.tcl not found" - set ok="" -endif - -if ("$ok" == "") then - echo "" - echo "please fix all above, before starting tecsinstall again" - echo -n "ignore and continue anyway [n] ? " - set ans="$<" - if ("$ans" != "y" && "$ans" != "Y") then - exit - endif -endif - -set til=($sd/tecs.ini* tecs/tecs.ini* bi[n-n]) -set tin="$til[1]" -if (-f $tin) then - set hos1=`grep "host=" $tin > /dev/null` && set hos1="$hos" -else - set hos1="$hos" -endif - -echo "Specification for serial connection" -if ("$hos" == "/") then - if ($ans == n) then - echo " syntax: host=localhost:4000/" - else - echo " syntax: host=psts:<3000+channel>" - endif - set hos="" -else - if ("$hos" != "$hos1") then - echo " actual value: host=$hos1" - endif - echo " recommended value: host=$hos (default)" -endif -echo -n " host=" -set hans="$<" -if ("$hans" != "") then - if ("$hos" != "$hans") then - echo "if you are sure that this is valid," - echo "please update $tecsdir/inilist for $inst" - endif - set hos="$hans" -endif - -rm -rf bin/tecs -rm -f ${til:s/bin//} \ - bin/TecsClient bin/TecsServer bin/keep_running bin/killtecs bin/startecs \ - $sd/TecsClient $sd/TecsServer $sd/keep_running $sd/killtecs $sd/startecs -mkdir -p tecs -echo "host=$hos" > tecs/tecs.ini -ln -s $PWD/tecs/TecsClient bin/tecs -ln -s $PWD/tecs/TecsClient bin/TecsClient -ln -s $PWD/tecs/startecs bin/ -ln -s $PWD/tecs/killtecs bin/ -rsync -vrCt --delete $tecsdir/cfg tecs/ | grep -v speedup | grep -v wrote -rsync -vt $tecsdir/startecs tecs/ | grep -v speedup | grep -v wrote -rsync -vt $tecsdir/killtecs tecs/ | grep -v speedup | grep -v wrote -rsync -vt $osdir/bin/TecsClient tecs/ | grep -v speedup | grep -v wrote -rsync -vt $osdir/bin/TecsServer tecs/ | grep -v speedup | grep -v wrote -rsync -vt $osdir/bin/keep_running tecs/ | grep -v speedup | grep -v wrote -mkdir -p tecs/log/ diff --git a/tecs/term.c b/tecs/term.c deleted file mode 100644 index e01f463..0000000 --- a/tecs/term.c +++ /dev/null @@ -1,548 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "term.h" -#include "myc_mem.h" -#include "myc_str.h" -#include "sys_select.h" -#include "uselect.h" - -#define ESC_TMO 1000 -#define REF_TMO 50 -#define HISTORY_LINES 256 - -#define L_ARROW 0200 -#define R_ARROW 0201 -#define U_ARROW 0202 -#define D_ARROW 0203 -#define EVT_CHAR '\0' -#define DEL_CHAR '\b' -#define RET_CHAR '\n' - -static char esc_key='\0'; - -static fd_set regMask; -static int minReg=0, maxReg=0; -static char filehead[256]=""; - -static char *func[256]={NULL}; - -void term_reg_socket(int socket) { - FD_SET(socket, ®Mask); - if (socket > maxReg) { - if (maxReg == 0) minReg = socket; - maxReg = socket; - } else if (socket < minReg) { - minReg = socket; - } -} - -void term_unr_socket(int socket) { - FD_CLR(socket, ®Mask); -} - -int term_raw_key(int *key, int msecTmo) { - fd_set mask; - - mask=regMask; - return(sys_select_or_key(&mask, msecTmo, key)); -} - -int term_wait_socket(int socket, int msecTmo) { - fd_set mask; - struct timeval tmo; - int i; - - if (socket == 0) { - mask = regMask; - } else { - FD_ZERO(&mask); - FD_SET(socket, &mask); - } - FD_SET(STDIN_FILENO, &mask); - tmo.tv_sec=msecTmo / 1000; - tmo.tv_usec=(msecTmo % 1000) * 1000; - i=uselect(FD_SETSIZE, &mask, NULL, NULL, &tmo); - if (FD_ISSET(STDIN_FILENO, &mask)) { - return 0; - } - if (i<0) return i; - if (i) { - if (socket && FD_ISSET(socket, &mask)) { - return socket; - } - for (i=minReg; i<=maxReg; i++) { - if (FD_ISSET(i, &mask)) { - return i; - }; - } - return -1; - } - return 0; -} - -int term_get_key(int *key, int msecTmo) { - int iret; - int k; - int kode; - - fflush(stdout); - if (esc_key==0) { - iret=term_raw_key(&k, msecTmo); - } else { - k=esc_key; - } - while (k==27) { /* esc */ - iret=term_raw_key(&k, ESC_TMO); - switch (k) { - case 'O': k=0217; break; /* ss3 */ - case '[': k=0233; break; /* csi */ - default: break; - } - } - if (iret!=STDIN_FILENO) { - esc_key=k; - *key='\0'; - return(iret); - } - switch (k) { - case 0233: /* csi */ - iret=term_raw_key(&k, ESC_TMO); - kode=0; - while (k>='0' && k <='9') { - kode=kode*10+(k-'0'); - iret=term_raw_key(&k, ESC_TMO); - } - if (iret!=STDIN_FILENO) { - esc_key=k; - *key='\0'; - return(iret); - } - switch (k) { /* L,R,U,D arrows */ - case 'D': k=L_ARROW; break; - case 'C': k=R_ARROW; break; - case 'A': k=U_ARROW; break; - case 'B': k=D_ARROW; break; - default: - if (k=='~') { - k = 128 + kode; - } else { - k += 128; - } - if (k>255) k='?'; - } - break; - case 0217: /* ss3 */ - iret=term_raw_key(&k, ESC_TMO); - if (iret!=STDIN_FILENO) { - esc_key=k; - *key='\0'; - return(iret); - } - if (k=='M') { /* enter */ - k=RET_CHAR; - } else if (k >= 'l' && k <= 'y') { - k=k-64; - } else { - switch (k) { /* L,R,U,D arrows */ - case 'D': k=L_ARROW; break; - case 'C': k=R_ARROW; break; - case 'A': k=U_ARROW; break; - case 'B': k=D_ARROW; break; - default: k += 128; if (k>255) k='?'; - } - } - break; - case 0177: /* del */ - case '\b': /* bs */ - k=DEL_CHAR; - break; - case '\r': /* cr */ - case '\n': /* lf */ - k=RET_CHAR; - break; - case EVT_CHAR: /* time out*/ - break; - default: - if (k>0176) { - k='?'; - } - } - *key=k; - esc_key='\0'; - return (STDIN_FILENO); -} - -static char *history[HISTORY_LINES]={NULL}; -/* history array: it's a cyclic buffer, when it is full, the oldest values - are overwritten. -*/ - -static int hist_pos=0; /* position when scrolling through the history */ -static int hist_end=0; /* end of history. Always history[hist_end]==NULL */ - -FILE *term_open_pref(int temp, char *head, char *mode) { - char buf[PATH_MAX+1], old[PATH_MAX+1], wd[PATH_MAX]; - char *usr, *home, *p; - int l; - FILE *fil; - mode_t oldmask; - - usr = getenv("USER"); - if (temp && usr==NULL) return NULL; - if (usr != NULL && *usr != '\0' && strstr(usr, "lnsg") != 0) { - if (! getcwd(wd, sizeof wd)) return NULL; - home=getenv("HOME"); - if (!home) return NULL; - realpath(home, buf); - l = strlen(buf); - buf[l] = '/'; l++; - buf[l]= '\0'; - if (wd[l] != '\0' && strncmp(wd, buf, l) == 0) { /* wd starts with $HOME */ - p = strchr(wd+l, '/'); - if (p) *p='\0'; /* determine 1st subdirectory of $HOME */ - if (temp) { - str_append(wd, "_lnsg"); - usr = wd+l; - } else { - home = wd; - } - } else { - home = buf; - } - } else { - home=getenv("HOME"); - if (!home) return NULL; - } - if (temp) { - /* old file name */ - str_copy(old, "/tmp/"); - str_append(old, head); - str_append(old, "."); - str_append(old, usr); - /* new file name */ - str_copy(buf, "/tmp/six/"); - oldmask = umask(0); - mkdir(buf, S_IRWXU+S_IRWXG+S_IRWXO); - umask(oldmask); - str_append(buf, head); - str_append(buf, "."); - str_append(buf, usr); /* usr is the username, or lnsg_ */ - } else { - /* old file name */ - str_copy(old, home); - str_append(old, "/."); - str_append(old, head); - /* new file name */ - str_copy(buf, home); - str_append(buf, "/.six/"); - mkdir(buf, S_IRWXU+S_IRGRP+S_IXGRP+S_IROTH+S_IXOTH); - str_append(buf, head); - } - rename(old, buf); /* if old file exists, rename it to new */ - if (*mode == 'd') { - unlink(buf); - return NULL; - } else { - fil = fopen(buf, mode); - return fil; - } -} - -char *term_fgets(char *buf, int size, FILE *fil) { - char *p, *ret; - char skipbuf[256]; - - buf[0]='\0'; - ret=fgets(buf, size, fil); - if (ret==NULL) { - return NULL; - } - p=strchr(buf,'\n'); - if (p==NULL) { - while (p==NULL) { /* skip rest of line */ - ret=fgets(skipbuf, sizeof(skipbuf), fil); - if (ret==NULL) { - return NULL; - } - p=strchr(skipbuf,'\n'); - } - } else { - *p='\0'; - } - return ret; -} - -void term_save_hist(int trimlast) { - FILE *fil; - int i,n; - if (filehead[0]=='\0') return; - fil=term_open_pref(1, filehead, "w"); - if (fil==NULL) return; - n=HISTORY_LINES-1; - if (trimlast) { - n--; - } - i=hist_end; - while (n>0) { - n--; - i++; if (i>=HISTORY_LINES) i=0; - if (history[i]!=NULL) { - fputs(history[i], fil); fputs("\n", fil); - } - } - fclose(fil); -} - -void term_read_hist(char *id, char *instr) { - FILE *fil; - int i; - char buf[1024], *lin; - - str_copy(filehead, id); - str_append(filehead, "_hist_"); - str_append(filehead, instr); - fil=term_open_pref(1, filehead, "r"); - if (fil==NULL) return; - hist_end=0; - while (hist_end0) { - lin=MALLOC(i+1); - strncpy(lin, buf, i+1); - history[hist_end]=lin; - hist_end++; - } - } - fclose(fil); - history[hist_end]=NULL; - hist_pos=hist_end; -} - -static int dirty=0; /* line is to be cleared through a call of term_clear */ - -void term_clear(void) { - if (dirty) { - fputs("\r\033[K\033[0m", stdout); /* clear to end of line, clear colors */ - dirty=0; - } -} - -void term_off(void) { - dirty=1; - term_clear(); - sys_keys_off(); -} - -int term_get_line(char *buf, int size, int *pos, char *prompt, fd_set *mask) { - char *lin; - int key; - int i,l,iret,buflen; - char tmp[1024]; - static char back[512]=""; - - if (back[0] == '\0') { - memset(back, '\b', sizeof back); - } - buf[size-1]='\0'; /* make sure buf is null terminated */ - l=strlen(buf); - if (*pos>l) { - *pos=l; - } else if (*pos<0) { - *pos=0; - } - iret=term_get_key(&key, 0); - while (1) { - if (iret==-1 || key == RET_CHAR || key==EVT_CHAR) { /* refresh after a short timeout */ - snprintf(tmp, sizeof tmp, "%s%s%s%s%s%.*s", - "\r\033[0m\033[1m", /* no color, bold */ - prompt, "\033[34m", /* blue */ - buf, "\033[K\033[0m", /* clear to end of line, clear colors */ - l - *pos, back); - fputs(tmp, stdout); - if (iret==-1) { - iret=term_get_key(&key, -1); /* no timeout */ - } - } - switch (key) { - case EVT_CHAR: - /* caller must clear line before next write with term_clear() */ - dirty=1; - return(iret); - - /* interrupted EXIT */ - - case RET_CHAR: - i=hist_end-1; if (i<0) i=HISTORY_LINES-1; - if ((history[i]==NULL || 0!=strcmp(history[i], buf)) && buf[0]!='\0') { /* do not save equal and empty lines */ - buflen=strlen(buf)+1; - lin=MALLOC(buflen); - strncpy(lin, buf, buflen); - history[hist_end]=lin; - hist_end++; if (hist_end>=HISTORY_LINES) hist_end=0; - if (history[hist_end]!=NULL) { - FREE(history[hist_end]); /* clear line at end of history */ - } - history[hist_end] = NULL; - } - hist_pos=hist_end; - term_save_hist(0); - return(STDIN_FILENO); - - /* normal EXIT */ - - case DEL_CHAR: - if (*pos>0) { - for (i=*pos; buf[i]!='\0'; i++) { - buf[i-1] = buf [i]; - } - buf[i-1]='\0'; - (*pos)--; - l--; - } - break; - case L_ARROW: - if (*pos>0) (*pos)--; - break; - case R_ARROW: - if (buf[*pos]!='\0') (*pos)++; - break; - case U_ARROW: - case D_ARROW: - if (key==U_ARROW) { - i=hist_pos-1; if (i<0) i=HISTORY_LINES-1; - } else { - i=hist_pos+1; if (i>=HISTORY_LINES) i=0; - } - if (history[i]!=NULL) { - strncpy(buf, history[i], size-1); - buf[size-1]='\0'; - hist_pos=i; - l=strlen(buf); - } else { - buf[0]='\0'; - l=0; - if (history[hist_pos]!=NULL) { - hist_pos=i; - } - } - *pos=l; - break; - case 1: /* ctrl-A: jump to begin of line */ - *pos = 0; - break; - case 5: /* ctrl-E: jump to end of line */ - *pos = strlen(buf); - break; - default: - if (key <' ' || key > 0176) { /* untreated special key */ - if (func[key] != NULL) { - snprintf(buf, size, "%s", func[key]); - key = RET_CHAR; - continue; - } - key = '?'; - } - if (l*pos; i--) { - buf[i]=buf[i-1]; - } - (*pos)++; l++; - buf[i]=key; - buf[l]='\0'; - } - break; - } - iret=term_get_key(&key, REF_TMO); - } -} - -void term_define_key(char *cmd, int keyArg) { - int iret; - int key; - - if (keyArg) { - key = keyArg; - } else { - if (*cmd) { - printf("\n# press key for command '%s' or return", cmd); - } else { - printf("\n# press key for which to remove command"); - } - iret = term_get_key(&key, 5000); - } - switch (key) { - case EVT_CHAR: - case DEL_CHAR: - case L_ARROW: - case R_ARROW: - case U_ARROW: - case D_ARROW: - break; - case RET_CHAR: - printf("\n# canceled\n"); - default: - if (key <' ' || key > 0176) { /* special key */ - if (*cmd) { - if (func[key]) free(func[key]); - func[key] = strdup(cmd); - if (!keyArg) { - printf("\n# programmed key %d\n", key); - } - } else { - if (func[key]) { - if (!keyArg) { - printf("\n# removed command '%s' from key %d\n", func[key], key); - } - free(func[key]); - } else { - if (!keyArg) { - printf("\n# no command on key %d\n", key); - } - } - func[key] = NULL; - } - return; - } - } - printf("\n# key %d is not programmable\n", key); -} - -void term_save_keys(FILE *fil, void (*out)(char *)) { - int key; - char buf[128]; - - for (key=0; key<256; key++) { - if (func[key]) { - fprintf(fil, "%d %s\n", key, func[key]); - if (out) { - snprintf(buf, sizeof buf, " key %d defined as '%s'\n", key, func[key]); - out(buf); - } - } - } -} - -void term_load_keys(FILE *fil, void (*out)(char *)) { - char line[136], buf[128]; - int key, l; - - while (term_fgets(line, sizeof line, fil)) { - key = 0; - sscanf(line, "%d %n", &key, &l); - if (key != 0) { - term_define_key(line+l, key); - if (out) { - snprintf(buf, sizeof buf, " key %d defined as '%s'\n", key, line+l); - out(buf); - } - } - } -} diff --git a/tecs/term.h b/tecs/term.h deleted file mode 100644 index 54010dc..0000000 --- a/tecs/term.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef TERM_H_ -#define TERM_H_ - -#include - -void term_reg_socket(int socket); -/* register socket */ - -void term_unr_socket(int socket); -/* unregister socket */ - -int term_raw_key(int *key, int msecTmo); - -int term_wait_socket(int socket, int msecTmo); -/* wait for a read event on socket or timeout - special case socket=0: wait for a read event on any socket - return socket number - or 0 for timeout -*/ - -int term_get_key(int *key, int msecTmo); - -void term_clear(void); - -int term_get_line(char *buf, int size, int *pos, char *prompt, fd_set *mask); - -FILE *term_open_pref(int temp, char *head, char *mode); -/* open a user specific preferences or temporary file */ - -char *term_fgets(char *buf, int size, FILE *fil); -/* fgets without newline */ - -void term_read_hist(char *id, char *instr); -/* read history from temporary file with id */ - -void term_save_hist(int trimlast); -/* store history (without last line if trimlast) */ - -void term_off(void); - -void term_define_key(char *cmd, int keyArg); - -void term_save_keys(FILE *fil, void (*out)(char *)); -/* save keys on file */ - -void term_load_keys(FILE *fil, void (*out)(char *)); -/* load keys on file */ - -#endif /* TERM_H_ */ diff --git a/tecs/uselect.c b/tecs/uselect.c deleted file mode 100644 index 4173a80..0000000 --- a/tecs/uselect.c +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include -#include -#include "uselect.h" - -/* an uninterruptable version of select. M.Z. Oct 2008 */ - -int uselect(int nfds, - fd_set *readfds, fd_set *writefds, fd_set *exceptfds, - struct timeval *timeout) { - - sigset_t sigmask; - struct timespec tmo, *tmoPtr; - - sigfillset(&sigmask); - if (timeout) { - tmo.tv_sec = timeout->tv_sec; - tmo.tv_nsec = timeout->tv_usec * 1000; - tmoPtr = &tmo; - } else { - tmoPtr = NULL; - } - return pselect(nfds, readfds, writefds, exceptfds, tmoPtr, &sigmask); -} diff --git a/tecs/uselect.h b/tecs/uselect.h deleted file mode 100644 index 4d848d9..0000000 --- a/tecs/uselect.h +++ /dev/null @@ -1,7 +0,0 @@ -#include - -/* an uninterruptable version of select. M.Z. Oct 2008 */ - -int uselect(int nfds, - fd_set *readfds, fd_set *writefds, fd_set *exceptfds, - struct timeval *timeout); diff --git a/tecsdriv.c b/tecsdriv.c deleted file mode 100644 index 35319c5..0000000 --- a/tecsdriv.c +++ /dev/null @@ -1,546 +0,0 @@ -/*--------------------------------------------------------------------------- - T E C S D R I V . C - - This is the implementation for TECS object derived from an more general - environment controller. At present, TECS is used for driving the - LakeShore 340 Temperature Controller. - - Markus Zolliker, March 2000 - - Copyright: - - Labor fuer Neutronenstreuung - Paul Scherrer Institut - CH-5423 Villigen-PSI - - - The authors hereby grant permission to use, copy, modify, distribute, - and license this software and its documentation for any purpose, provided - that existing copyright notices are retained in all copies and that this - notice is included verbatim in any distributions. No written agreement, - license, or royalty fee is required for any of the authorized uses. - Modifications to this software may be copyrighted by their authors - and need not follow the licensing terms described here, provided that - the new terms are clearly indicated on the first page of each file where - they apply. - - IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY - FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES - ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY - DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - - THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE - IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE - NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR - MODIFICATIONS. -----------------------------------------------------------------------------*/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "tecsdriv.h" -#include -#include -#include "tecs/coc_util.h" -#include "tecs/tecs_cli.h" -#include "tecs/myc_str.h" -#include "tecs/myc_err.h" -#include -#include "statistics.h" - -/*-----------------------------------------------------------------------*/ -typedef struct { - void *pData; - char *lastError; - time_t lastGet, lastGetX; - float lastValue, lastPos, lastDelta; - int iLastError, port; - int (*EVLimits) (void *, float, char *, int); - char server[256]; -} TecsDriv, *pTecsDriv; - -typedef struct { - char *buffer; - int size; -} Buffer; - -void outFunc(char *str, void *arg) -{ - Buffer *buffer = arg; - str_ncat(buffer->buffer, str, buffer->size); - str_ncat(buffer->buffer, "\n", buffer->size); -} - -/*-------------------------------------------------------------------------*/ - -int TecsWrapper(SConnection * pCon, SicsInterp * pSics, void *pData, - int argc, char *argv[]) -{ - pEVControl self = NULL; - char pBueffel[1024], result[1024], *res; - int iRet = -1; - pEVDriver pD; - pTecsDriv pMe; - float fVal; - Buffer buffer; - ObPar *pPar; - - self = (pEVControl) pData; - assert(self); - assert(pCon); - assert(pSics); - - if (argc < 2) { - return EVControlWrapper(pCon, pSics, pData, argc, argv); - } - - pD = self->pDriv; - assert(pD); - pMe = pD->pPrivate; - assert(pMe); - snprintf(pBueffel, sizeof pBueffel, " %s ", argv[1]); - strtolower(pBueffel); - if (0 == strcmp(pBueffel, " targetvalue ")) { - if (argc == 2) { - iRet = CocGet(pMe->pData, "set", result); /* get parameter */ - if (iRet < 0) - goto Error; - self->fTarget = atof(result); - } - return EVControlWrapper(pCon, pSics, pData, argc, argv); - } else if (0 == strcmp(pBueffel, " get ")) { - buffer.buffer = result; - buffer.size = sizeof result; - result[0] = '\0'; - iRet = TeccGetMult(pMe->pData, argc - 2, argv + 2, outFunc, &buffer); - if (iRet < 0) - goto Error; - SCWrite(pCon, result, eValue); - return 1; - } else if (0 == strcmp(pBueffel, " list ")) { - iRet = CocGet(pMe->pData, "set", result); /* get parameter */ - if (iRet < 0) - goto Error; - self->fTarget = atof(result); - iRet = CocGet(pMe->pData, "tlimit", result); /* get parameter */ - if (iRet < 0) - goto Error; - iRet = EVCGetPar(self, "upperlimit", &fVal); - if (abs(fVal - atof(result)) > 1.0e-4 * abs(fVal)) { - fVal = atof(result); - pPar = ObParFind(self->pParam, "upperlimit"); - if (pPar != NULL) { - pPar->fVal = fVal; - } - } - iRet = EVControlWrapper(pCon, pSics, pData, argc, argv); - if (iRet != 0) { - iRet = CocGet(pMe->pData, "status", result); /* show status */ - if (iRet < 0) - goto Error; - SCWrite(pCon, result, eValue); - } - return iRet; - } else if (0 == strcmp(pBueffel, " upperlimit ")) { - if (argc == 3) { - iRet = CocSetGet(pMe->pData, "tLimit", argv[2], result); /* set and get parameter */ - res = strchr(result, '='); - if (res != NULL) { - str_copy(result, res + 1); - } - } else if (argc == 2) { - iRet = CocGet(pMe->pData, "tLimit", result); /* get parameter */ - } - if (iRet < 0) - goto Error; - fVal = atof(result); - if (argc == 3 && atof(argv[2]) > fVal) { - snprintf(pBueffel, sizeof pBueffel, - "WARNING: upper limit reduced to maximal allowed value: %g", - fVal); - SCWrite(pCon, pBueffel, eWarning); - } - if (argc == 3) { - iRet = EVCSetPar(self, "upperlimit", fVal, pCon); - } else { - pPar = ObParFind(self->pParam, "upperlimit"); - if (pPar != NULL) { - pPar->fVal = fVal; - } - iRet = 1; - } - if (iRet) { - snprintf(pBueffel, sizeof pBueffel, - "%s.%s = %s\n", self->pName, argv[1], result); - SCWrite(pCon, pBueffel, eValue); - } - return iRet; - } else if (0 == strcmp(pBueffel, " lowerlimit ")) { - if (argc > 2) { - if (atof(argv[2]) > ObVal(self->pParam, UPLIMIT)) { - SCWrite(pCon, - "ERROR: lower limit must not be higher than upperlimit", - eError); - return 0; - } - } - return EVControlWrapper(pCon, pSics, pData, argc, argv); - } else if (NULL != - strstr - (" log send tolerance access errorhandler interrupt interest uninterest safevalue currentvalue maxwait settle errorscript runscript driver ", - pBueffel)) { - /* forward to standard handler */ - return EVControlWrapper(pCon, pSics, pData, argc, argv); - } - if (argc > 2) { /* set case */ - iRet = CocSet(pMe->pData, argv[1], argv[2]); - if (iRet < 0) - goto Error; - return 1; - } else { /* get case (or command without parameter) */ - if (0 == strcasecmp(argv[1], "kill")) { - iRet = CocSet(pMe->pData, "quit", "1"); /* send quit flag */ - strcpy(result, "1"); - } else { - iRet = CocGet(pMe->pData, argv[1], result); /* get parameter */ - } - if (iRet < 0) - goto Error; - snprintf(pBueffel, sizeof pBueffel, - "%s.%s = %s\n", self->pName, argv[1], result); - SCWrite(pCon, pBueffel, eValue); - return 1; - } - /* not reached */ -Error: - sprintf(pBueffel, "ERROR in TECS: %s", ErrMessage); - SCWrite(pCon, pBueffel, eError); - return 0; -} - -/*----------------------------------------------------------------------------*/ - -static int TecsGet(pEVDriver self, float *fPos) -{ - pTecsDriv pMe = NULL; - int iRet; - time_t now; - static Statistics *stat = NULL; - Statistics *old; - - assert(self); - pMe = (pTecsDriv) self->pPrivate; - assert(pMe); - - time(&now); - if (now != pMe->lastGet) { /* TecsGet was not yet called within this second */ - pMe->lastGet = now; - } else { /* do not call tecs again, as we have already quite recent values */ - *fPos = pMe->lastValue; - pMe->iLastError = 0; - return 1; - } - - if (stat == NULL) - stat = StatisticsNew("TecsGet"); - old = StatisticsBegin(stat); - - /* get temperature */ - iRet = TeccGet(pMe->pData, fPos); - StatisticsEnd(old); - - pMe->lastValue = *fPos; - if (iRet < 0) { - pMe->lastError = ErrMessage; - pMe->iLastError = 1; /* severe */ - return 0; - } - pMe->iLastError = 0; - return 1; -} - -/*----------------------------------------------------------------------------*/ - -static int TecsGetX(pEVDriver self, float *fTarget, float *fPos, - float *fDelta) -{ - pTecsDriv pMe = NULL; - int iRet; - time_t now; - static Statistics *stat = NULL; - Statistics *old; - - assert(self); - pMe = (pTecsDriv) self->pPrivate; - assert(pMe); - - time(&now); - if (now != pMe->lastGetX) { /* TecsGetX was not yet called within this second */ - pMe->lastGetX = now; - } else { /* do not call tecs again, as we have already quite recent values */ - *fPos = pMe->lastPos; - *fDelta = pMe->lastDelta; - pMe->iLastError = 0; - return 1; - } - - if (stat == NULL) - stat = StatisticsNew("TecsGetX"); - old = StatisticsBegin(stat); - - /* get temperatures */ - iRet = TeccGetX(pMe->pData, fTarget, fPos, fDelta); - StatisticsEnd(old); - - pMe->lastPos = *fPos; - pMe->lastDelta = *fDelta; - if (iRet < 0) { - pMe->lastError = ErrMessage; - pMe->iLastError = 1; /* severe */ - return 0; - } - pMe->iLastError = 0; - return 1; -} - -/*----------------------------------------------------------------------------*/ -static int TecsRun(pEVDriver self, float fVal) -{ - pTecsDriv pMe = NULL; - int iRet; - - assert(self); - pMe = (pTecsDriv) self->pPrivate; - assert(pMe); - - /* set temperature */ - iRet = TeccSet(pMe->pData, fVal); - if (iRet < 0) { - pMe->iLastError = 1; /* severe */ - pMe->lastError = ErrMessage; - return 0; - } - return 1; -} - -/*--------------------------------------------------------------------------*/ -int TecsError(pEVDriver self, int *iCode, char *error, int iErrLen) -{ - pTecsDriv pMe = NULL; - - assert(self); - pMe = (pTecsDriv) self->pPrivate; - assert(pMe); - - *iCode = pMe->iLastError; - if (pMe->lastError == NULL) { - str_ncpy(error, "undefined error", iErrLen); - } else { - str_ncpy(error, pMe->lastError, iErrLen); - str_ncat(error, " (TECS)", iErrLen); - } - return 1; -} - -/*---------------------------------------------------------------------------*/ -static int TecsFix(pEVDriver self, int iError) -{ - pTecsDriv pMe = NULL; - int iRet; - - assert(self); - pMe = (pTecsDriv) self->pPrivate; - assert(pMe); - if (pMe->iLastError == 1) { /* for Tecs, iLastError means severity level */ - return (DEVFAULT); /* 1: severe */ - } else { - return (DEVREDO); /* 2: try again, good luck! */ - } -} - -/*--------------------------------------------------------------------------*/ -static int TecsSend(pEVDriver self, char *pCommand, char *pReply, int iLen) -{ - pTecsDriv pMe = NULL; - int iRet; - - assert(self); - pMe = (pTecsDriv) self->pPrivate; - assert(pMe); - - iRet = TeccSend(pMe->pData, pCommand, pReply, iLen); - if (iRet < 0) { - pMe->lastError = ErrMessage; - return 0; - } - return 1; - -} - -/*--------------------------------------------------------------------------*/ -static int TecsInit(pEVDriver self) -{ - pTecsDriv pMe = NULL; - int iRet; - - assert(self); - pMe = (pTecsDriv) self->pPrivate; - assert(pMe); - - pMe->pData = TeccInit(pMe->server, pMe->port); - if (pMe->pData == NULL) { - pMe->iLastError = 1; /* severe */ - pMe->lastError = ErrMessage; - return -1; /* fatal */ - } - return 1; -} - -/*--------------------------------------------------------------------------*/ -static int TecsClose(pEVDriver self) -{ - pTecsDriv pMe = NULL; - int iRet; - - assert(self); - pMe = (pTecsDriv) self->pPrivate; - assert(pMe); - - TeccClose(pMe->pData); - pMe->pData = NULL; - return 1; -} - -/*--------------------------------------------------------------------------*/ -static int TecsHalt(pEVDriver * self) -{ - assert(self); - - return 1; -} - -/*------------------------------------------------------------------------*/ -void TecsKill(void *pData) -{ - pTecsDriv pMe = NULL; - - pMe = (pTecsDriv) pData; - assert(pMe); - free(pMe); -} - -/*------------------------------------------------------------------------*/ -pEVDriver CreateTecsDriver(int argc, char *argv[]) -{ - pEVDriver pNew = NULL; - pTecsDriv pMe = NULL; - pSicsVariable pInst = NULL; - char *pPort = NULL, *pPath = NULL; - FILE *fil; - char buf[256]; - - pNew = CreateEVDriver(argc, argv); - pMe = (pTecsDriv) malloc(sizeof(TecsDriv)); - memset(pMe, 0, sizeof(TecsDriv)); - if (!pNew || !pMe) { - return NULL; - } - pNew->pPrivate = pMe; - pNew->KillPrivate = TecsKill; - - /* initalise pTecsDriver */ - pMe->lastError = NULL; - - pMe->port = 0; - pMe->server[0] = '\0'; - - pPath = IFindOption(pSICSOptions, "TecsInit"); - if (pPath != NULL) { - fil = fopen(pPath, "r"); - if (fil != NULL) { - pPort = fgets(buf, sizeof(buf), fil); - if (pPort != NULL) { - pMe->port = atoi(pPort); - } - fgets(buf, sizeof(buf), fil); - fgets(pMe->server, sizeof(pMe->server), fil); - } - } - - if (pMe->port == 0) { - /* get the port number for tecs */ - pPort = IFindOption(pSICSOptions, "TecsPort"); - if (pPort != NULL) { - pMe->port = atoi(pPort); - } - if (pMe->port == 0) { - pMe->port = 9753; - } - } - - /* initialise function pointers */ - pNew->SetValue = TecsRun; - pNew->GetValue = TecsGet; - pNew->Send = TecsSend; - pNew->GetError = TecsError; - pNew->TryFixIt = TecsFix; - pNew->Init = TecsInit; - pNew->Close = TecsClose; - pNew->GetValues = TecsGetX; - - return pNew; -} - -/*------------------------------------------------------------------------*/ -static int TecsLimits(void *pData, float fVal, char *pError, int iErrLen) -{ - /* wrapper for EVILimits */ - pEVControl pEvc; - pTecsDriv pMe; - int iRet; - float f; - char result[64]; - - pEvc = (pEVControl) pData; - assert(pEvc); - pMe = pEvc->pDriv->pPrivate; - assert(pMe); - iRet = CocGet(pMe->pData, "tLimit", result); /* get parameter */ - if (iRet >= 0) { - f = 0.0; - f = atof(result); - if (f > 0.0) - pEvc->pParam[UPLIMIT].fVal = f; - } - return pMe->EVLimits(pData, fVal, pError, iErrLen); -} - -/*------------------------------------------------------------------------*/ -void TecsCustomize(SConnection * pCon, pEVControl pEvc) -{ - /* customize tecs driver */ - pTecsDriv pMe; - - pMe = pEvc->pDriv->pPrivate; - assert(pMe); - assert(pMe->EVLimits != pEvc->pDrivInt->CheckLimits); - pMe->EVLimits = pEvc->pDrivInt->CheckLimits; /* save original CheckLimits function */ - pEvc->pDrivInt->CheckLimits = TecsLimits; - EVCSetPar(pEvc, "upperlimit", 1800.0, pCon); - EVCSetPar(pEvc, "lowerlimit", 0.0, pCon); -} diff --git a/tecsdriv.h b/tecsdriv.h deleted file mode 100644 index f0a02a5..0000000 --- a/tecsdriv.h +++ /dev/null @@ -1,29 +0,0 @@ -/*------------------------------------------------------------------------- - T E C S D R I V . H - - Support for TECS server (LakeShore 340 Temperature controllers) for SICS. - The meaning and working of the functions defined is as described for a - general environment controller. - - Markus Zolliker, March 2000 - - copyright: see implementation file. - ------------------------------------------------------------------------------*/ -#ifndef SICSTECS -#define SICSTECS -/*------------------------- The Driver ------------------------------------*/ - -pEVDriver CreateTecsDriver(int argc, char *argv[]); - - -/*------------------------- The Tecs object ------------------------------*/ - -int TecsWrapper(SConnection * pCon, SicsInterp * pSics, void *pData, - int argc, char *argv[]); - -int TecsError(pEVDriver self, int *iCode, char *error, int iErrLen); - -void TecsCustomize(SConnection * pCon, pEVControl pEvc); - -#endif