M.Z.
This commit is contained in:
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
int CocConnect(CocConn *conn) {
|
int CocConnect(CocConn *conn) { /* connect, but do not start */
|
||||||
int i;
|
int i;
|
||||||
struct sockaddr_in sadr;
|
struct sockaddr_in sadr;
|
||||||
|
|
||||||
@ -43,15 +43,15 @@ int CocConnect(CocConn *conn) {
|
|||||||
OnError: return(-1);
|
OnError: return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CocOpen(CocConn *conn)
|
int CocOpen(CocConn *conn) { /* connect and start, if not succsessful */
|
||||||
{
|
int i, try, tmo;
|
||||||
int i, try, tmo, iret=-1;
|
|
||||||
|
|
||||||
ERR_I(i=CocConnect(conn));
|
ERR_I(i=CocConnect(conn));
|
||||||
if (i==0) return(0);
|
if (i==0) return(0);
|
||||||
|
/* connection refused */
|
||||||
if (conn->startcmd[0]=='\0') {
|
if (conn->startcmd[0]=='\0') {
|
||||||
CocDelay(500);
|
CocDelay(500);
|
||||||
ErrTxt("connect",1); return(-2);
|
ErrTxt("connect",1); return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Starting TecsServer ...\n\n%s\n", conn->startcmd);
|
printf("Starting TecsServer ...\n\n%s\n", conn->startcmd);
|
||||||
@ -69,12 +69,13 @@ int CocOpen(CocConn *conn)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ERR_MSG("can not start TECS, too many retries");
|
ERR_MSG("can not start TECS, too many retries");
|
||||||
OnError: return(iret);
|
OnError: return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
int CocInitClient(CocConn *conn, char *host, int port, char *magic, int bufsize, char *startcmd) {
|
int CocInitClient(CocConn *conn, char *host, int port, char *magic, int bufsize, char *startcmd) {
|
||||||
|
int iret;
|
||||||
assert(conn!=NULL);
|
assert(conn!=NULL);
|
||||||
if (bufsize==0) bufsize=1024;
|
if (bufsize==0) bufsize=1024;
|
||||||
StrLink(&conn->cmdbuf, conn->cmdbuf_);
|
StrLink(&conn->cmdbuf, conn->cmdbuf_);
|
||||||
@ -84,9 +85,15 @@ int CocInitClient(CocConn *conn, char *host, int port, char *magic, int bufsize,
|
|||||||
ERR_I(str_copy(conn->magic, magic));
|
ERR_I(str_copy(conn->magic, magic));
|
||||||
ERR_I(str_copy(conn->startcmd, startcmd));
|
ERR_I(str_copy(conn->startcmd, startcmd));
|
||||||
conn->fd=-1;
|
conn->fd=-1;
|
||||||
ERR_I(CocOpen(conn));
|
ERR_I(iret=CocOpen(conn));
|
||||||
ERR_I(CocSendMagic(conn, conn->magic));
|
if (iret==0) {
|
||||||
return(0);
|
iret=CocSendMagic(conn, conn->magic);
|
||||||
|
if (iret<0) {
|
||||||
|
CocCloseClient(conn);
|
||||||
|
iret=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(iret);
|
||||||
OnError: return(-1);
|
OnError: return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,10 +136,7 @@ int CocTryCmd(CocConn *conn) {
|
|||||||
|
|
||||||
signal(SIGPIPE, SIG_IGN);
|
signal(SIGPIPE, SIG_IGN);
|
||||||
if (conn->fd<0) {
|
if (conn->fd<0) {
|
||||||
/*
|
ERR_I(iret=CocConnect(conn)); /* was CocOpen earlier */
|
||||||
ERR_I(iret=CocOpen(conn));
|
|
||||||
*/
|
|
||||||
ERR_I(iret=CocConnect(conn));
|
|
||||||
if (iret == 1) {
|
if (iret == 1) {
|
||||||
CocDelay(500);
|
CocDelay(500);
|
||||||
ErrTxt("connect",1); return (-1);
|
ErrTxt("connect",1); return (-1);
|
||||||
@ -467,6 +471,7 @@ int CocShowLog(CocConn *conn, char *loglist, int start, int lines) {
|
|||||||
void CocCloseClient(CocConn *conn) {
|
void CocCloseClient(CocConn *conn) {
|
||||||
assert(conn!=NULL);
|
assert(conn!=NULL);
|
||||||
close(conn->fd);
|
close(conn->fd);
|
||||||
|
conn->fd=-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ void logfileStamp(char *text) {
|
|||||||
fprintf(fil, "---\t%02d:%02d:%02d\n", stamp / 60, stamp % 60, time % 60, text);
|
fprintf(fil, "---\t%02d:%02d:%02d\n", stamp / 60, stamp % 60, time % 60, text);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fprintf(fil, "\t%02d:%02d:%02d %s", stamp / 60, stamp % 60, time % 60, text);
|
fprintf(fil, "\t%02d:%02d:%02d%s", stamp / 60, stamp % 60, time % 60, text);
|
||||||
}
|
}
|
||||||
dirty=0;
|
dirty=0;
|
||||||
lastStamp=stamp;
|
lastStamp=stamp;
|
||||||
@ -135,7 +135,11 @@ void logfileOut(int mask, const char *fmt, ...)
|
|||||||
vsprintf(buf, fmt, ap);
|
vsprintf(buf, fmt, ap);
|
||||||
assert(buf[statusSize]=='\0'); /* check for overflow */
|
assert(buf[statusSize]=='\0'); /* check for overflow */
|
||||||
if (buf[0]=='@') {
|
if (buf[0]=='@') {
|
||||||
str_ncat(statusBuf, buf+1, statusSize);
|
if (buf[1]==' ') {
|
||||||
|
str_ncat(statusBuf, buf+2, statusSize);
|
||||||
|
} else {
|
||||||
|
str_ncat(statusBuf, buf+1, statusSize);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
str_ncat(statusBuf, buf, statusSize);
|
str_ncat(statusBuf, buf, statusSize);
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ static Instrument list[]={
|
|||||||
{ "FOCUS", "lnsa16.psi.ch", 9753, "FOCUS" , 1},
|
{ "FOCUS", "lnsa16.psi.ch", 9753, "FOCUS" , 1},
|
||||||
{ "TASP", "lnsa12.psi.ch", 9753, "TASP", 1},
|
{ "TASP", "lnsa12.psi.ch", 9753, "TASP", 1},
|
||||||
{ "TASP0", "lnsa09.psi.ch", 9753, NULL , 0},
|
{ "TASP0", "lnsa09.psi.ch", 9753, NULL , 0},
|
||||||
{ "RITA", "lnsa08.psi.ch", 9753, NULL , 0},
|
{ "RITA", "rita2.psi.ch", 9753, NULL , 0},
|
||||||
{ "PREP", "lnsa01.psi.ch", 9753, NULL , 0},
|
{ "PREP", "lnsa01.psi.ch", 9753, NULL , 0},
|
||||||
{ "AREA", "lnsa01.psi.ch", 9751, NULL , 0},
|
{ "AREA", "lnsa01.psi.ch", 9751, NULL , 0},
|
||||||
{ "TEST", "lnsa15.psi.ch", 9753, "lnslib", 2}
|
{ "TEST", "lnsa15.psi.ch", 9753, "lnslib", 2}
|
||||||
|
38
tecs/tecs.c
38
tecs/tecs.c
@ -531,7 +531,7 @@ int PrepInput(char *label) {
|
|||||||
sensD.alarm=0;
|
sensD.alarm=0;
|
||||||
}
|
}
|
||||||
loop=1;
|
loop=1;
|
||||||
resist=25;
|
resist=10;
|
||||||
str_copy(heUnits, "%");
|
str_copy(heUnits, "%");
|
||||||
|
|
||||||
i=sscanf(t, "%12s%n", nam, &l);
|
i=sscanf(t, "%12s%n", nam, &l);
|
||||||
@ -632,6 +632,8 @@ float WeightedAverage(float tH, float tL, Testpoint *t) {
|
|||||||
float p,q, tLow, tHigh;
|
float p,q, tLow, tHigh;
|
||||||
SensorT *s1, *s2;
|
SensorT *s1, *s2;
|
||||||
|
|
||||||
|
if (tH==DATA_UNDEF) tH=0.0;
|
||||||
|
if (tL==DATA_UNDEF) tL=0.0;
|
||||||
s1=t->sensor1;
|
s1=t->sensor1;
|
||||||
s2=t->sensor2;
|
s2=t->sensor2;
|
||||||
tH = tH * s1->scale;
|
tH = tH * s1->scale;
|
||||||
@ -653,7 +655,7 @@ float WeightedAverage(float tH, float tL, Testpoint *t) {
|
|||||||
} else if (tL!=0.0) {
|
} else if (tL!=0.0) {
|
||||||
return tL ;
|
return tL ;
|
||||||
}
|
}
|
||||||
return 0.0;
|
return DATA_UNDEF;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogMinMax(int new) {
|
void LogMinMax(int new) {
|
||||||
@ -663,6 +665,7 @@ void LogMinMax(int new) {
|
|||||||
float tbuf;
|
float tbuf;
|
||||||
SensorT *s1, *s2;
|
SensorT *s1, *s2;
|
||||||
|
|
||||||
|
sprintf(buf, "@");
|
||||||
if (cryo.sensor1!=NULL) { /* at least one sensor is present */
|
if (cryo.sensor1!=NULL) { /* at least one sensor is present */
|
||||||
for (i=0; i<2; i++) {
|
for (i=0; i<2; i++) {
|
||||||
tpoint=tpoints[i];
|
tpoint=tpoints[i];
|
||||||
@ -681,8 +684,11 @@ void LogMinMax(int new) {
|
|||||||
s2->max=0;
|
s2->max=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(buf, "@Tm %.5g _ %.5g", cryo.t1, cryo.t2);
|
if (cryo.t1!=DATA_UNDEF) {
|
||||||
if (cryo.sensor1!=samp.sensor1) {
|
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);
|
sprintf(buf1, " Ts %.5g _ %.5g", samp.t1, samp.t2);
|
||||||
str_append(buf, buf1);
|
str_append(buf, buf1);
|
||||||
}
|
}
|
||||||
@ -694,9 +700,7 @@ void LogMinMax(int new) {
|
|||||||
sprintf(buf1, " Te %.5g", te);
|
sprintf(buf1, " Te %.5g", te);
|
||||||
str_append(buf, buf1);
|
str_append(buf, buf1);
|
||||||
}
|
}
|
||||||
} else if (nScan>0) {
|
} else if (nScan==0) {
|
||||||
sprintf(buf, "@");
|
|
||||||
} else {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (i=4; i<4+nScan; i++) {
|
for (i=4; i<4+nScan; i++) {
|
||||||
@ -857,14 +861,14 @@ int ReadTemp(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stat=(s->stat1 & s->stat2) & (255-3); /* ignore "old reading" and "invalid reading", error must be on min & max */
|
stat=(s->stat1 & s->stat2) & (255-3); /* ignore "old reading" and "invalid reading", error must be on min & max */
|
||||||
if (stat != s->readStat) {
|
if (stat > s->readStat || stat==0 && s->readStat>0) {
|
||||||
s->readStat=stat;
|
|
||||||
err=LscReadStat(stat);
|
err=LscReadStat(stat);
|
||||||
if (*err=='\0') {
|
if (*err=='\0') {
|
||||||
logfileOut(LOG_MAIN, "reading o.k. %s\n", s->ch);
|
logfileOut(LOG_MAIN, "reading o.k. %s\n", s->ch);
|
||||||
} else {
|
} else {
|
||||||
logfileOut(LOG_MAIN, "%s %s\n", err, s->ch);
|
logfileOut(LOG_MAIN, "%s %s\n", err, s->ch);
|
||||||
}
|
}
|
||||||
|
s->readStat=stat;
|
||||||
}
|
}
|
||||||
if (stat==0) {
|
if (stat==0) {
|
||||||
|
|
||||||
@ -916,7 +920,7 @@ int ReadTemp(void) {
|
|||||||
if (samp.sensor1!=cryo.sensor1) {
|
if (samp.sensor1!=cryo.sensor1) {
|
||||||
ts=samp.temp;
|
ts=samp.temp;
|
||||||
}
|
}
|
||||||
if (samp.temp==0.0) {
|
if (samp.temp==DATA_UNDEF) {
|
||||||
samp.temp=cryo.temp;
|
samp.temp=cryo.temp;
|
||||||
}
|
}
|
||||||
} else if (nScan==0) {
|
} else if (nScan==0) {
|
||||||
@ -1112,17 +1116,21 @@ void CalcMaxPower(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int SetMaxPower(void) {
|
int SetMaxPower(void) {
|
||||||
static float p0;
|
static float p0, pold;
|
||||||
|
float plim;
|
||||||
|
|
||||||
if (loop == 1) {
|
if (loop == 1) {
|
||||||
ERR_P(LscCmd(ser, "CLIMIT?1>,,,iAmp,iRange"));
|
ERR_P(LscCmd(ser, "CLIMIT?1>,,,iAmp,iRange"));
|
||||||
if (iRange>0) {
|
if (iRange>0) {
|
||||||
p0=resist*pow(4.0,iAmp)*pow(10.0,iRange)/6.4e6*powFact;
|
p0=resist*pow(4.0,iAmp)*pow(10.0,iRange)/6.4e6*powFact;
|
||||||
|
plim=2500/resist;
|
||||||
|
pold=p0;
|
||||||
|
if (pold>plim) pold=plim;
|
||||||
}
|
}
|
||||||
CalcMaxPower();
|
CalcMaxPower();
|
||||||
}
|
}
|
||||||
logfileOut(LOG_MAIN, "maxPower changed from %g to %g\n", p0, maxPower);
|
logfileOut(LOG_MAIN, "maxPower changed from %g to %g\n", pold, maxPower);
|
||||||
ERR_P(LscCmd(ser, "CDISP 1:[loop],25000,1;MOUT [loop]:0;CMODE [loop]:1"));
|
ERR_P(LscCmd(ser, "CDISP 1:[loop],[resist],1;MOUT [loop]:0;CMODE [loop]:1"));
|
||||||
if (slope<0) slope=-slope;
|
if (slope<0) slope=-slope;
|
||||||
if (slope!=0 && slope<0.1) slope=0.1;
|
if (slope!=0 && slope<0.1) slope=0.1;
|
||||||
fbuf=tLimit/CtlScale();
|
fbuf=tLimit/CtlScale();
|
||||||
@ -1133,6 +1141,7 @@ int SetMaxPower(void) {
|
|||||||
ERR_P(LscCmd(ser, "CLIMIT 2:[fbuf],[slope],0"));
|
ERR_P(LscCmd(ser, "CLIMIT 2:[fbuf],[slope],0"));
|
||||||
}
|
}
|
||||||
p0=scalPower;
|
p0=scalPower;
|
||||||
|
pold=maxPower;
|
||||||
return 0;
|
return 0;
|
||||||
OnError: return -1;
|
OnError: return -1;
|
||||||
}
|
}
|
||||||
@ -2117,6 +2126,7 @@ int LogfileHdl(int mode, void *base, int fd) {
|
|||||||
str_copy(buf, logDir);
|
str_copy(buf, logDir);
|
||||||
str_append(buf, serverId);
|
str_append(buf, serverId);
|
||||||
logfile=logfileInit(buf, logIt, use_stdout, logIt && use_stdout);
|
logfile=logfileInit(buf, logIt, use_stdout, logIt && use_stdout);
|
||||||
|
CocDefStr(logfile, COC_RDONLY);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2275,7 +2285,6 @@ int main(int argc, char *argv[]) {
|
|||||||
CocDefStr(intype, RD);
|
CocDefStr(intype, RD);
|
||||||
CocDefStr(status, RD); CocHdl(StatusHdl);
|
CocDefStr(status, RD); CocHdl(StatusHdl);
|
||||||
CocDefStr(pid, RD); CocHdl(PidSumHdl);
|
CocDefStr(pid, RD); CocHdl(PidSumHdl);
|
||||||
CocDefStr(logfile, RD);
|
|
||||||
CocDefStr(config, RD);
|
CocDefStr(config, RD);
|
||||||
|
|
||||||
CocDefInt(cod1, RD);
|
CocDefInt(cod1, RD);
|
||||||
@ -2392,6 +2401,7 @@ int main(int argc, char *argv[]) {
|
|||||||
str_copy(buf, logDir);
|
str_copy(buf, logDir);
|
||||||
str_append(buf, serverId);
|
str_append(buf, serverId);
|
||||||
logfile=logfileInit(buf, logIt, use_stdout, logIt && use_stdout);
|
logfile=logfileInit(buf, logIt, use_stdout, logIt && use_stdout);
|
||||||
|
CocDefStr(logfile, RD);
|
||||||
logfileOut(LOG_MAIN ,"\n");
|
logfileOut(LOG_MAIN ,"\n");
|
||||||
logfileWrite(logMask);
|
logfileWrite(logMask);
|
||||||
|
|
||||||
|
@ -54,14 +54,15 @@ char *TecsSet(float temp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *TecsInit(char *host, int port) {
|
char *TecsInit(char *host, int port) {
|
||||||
if (port==0) port=9753;
|
int iret;
|
||||||
if (conn!=NULL) TeccClose(conn);
|
if (conn!=NULL) TeccClose(conn);
|
||||||
NEW(conn, CocConn);
|
NEW(conn, CocConn);
|
||||||
if (host==NULL || *host=='\0') {
|
if (host==NULL || *host=='\0') {
|
||||||
ERR_I(CocInitClient(conn, "", port, rwCode, 0, ""));
|
ERR_I(iret=CocInitClient(conn, "", port, rwCode, 0, ""));
|
||||||
} else {
|
} else {
|
||||||
ERR_I(CocInitClient(conn, host, port, rdCode, 0, ""));
|
ERR_I(iret=CocInitClient(conn, host, port, rdCode, 0, ""));
|
||||||
}
|
}
|
||||||
|
if (iret==1) ErrShort("TECS_INIT: can not connect to TecsServer");
|
||||||
return NULL;
|
return NULL;
|
||||||
OnError:
|
OnError:
|
||||||
FREE(conn);
|
FREE(conn);
|
||||||
|
@ -17,25 +17,30 @@ static char *rwCode="rwacs";
|
|||||||
static char *rdCode="rdacs";
|
static char *rdCode="rdacs";
|
||||||
|
|
||||||
pTecsClient TeccInit(char *startcmd, int port) {
|
pTecsClient TeccInit(char *startcmd, int port) {
|
||||||
CocConn *conn;
|
CocConn *conn=NULL;
|
||||||
char *code, host[64];
|
char *code, host[64];
|
||||||
|
int iret;
|
||||||
|
|
||||||
NEW(conn, CocConn);
|
NEW(conn, CocConn);
|
||||||
code=rwCode;
|
code=rwCode;
|
||||||
if (startcmd[0]=='#') {
|
if (startcmd[0]=='#') {
|
||||||
gethostname(host, sizeof(host));
|
gethostname(host, sizeof(host));
|
||||||
if (0!=strcmp(startcmd+1, host)) code=rdCode;
|
if (0!=strcmp(startcmd+1, host)) code=rdCode;
|
||||||
ERR_I(CocInitClient(conn, startcmd+1, port, code, 0, ""));
|
ERR_I(iret=CocInitClient(conn, startcmd+1, port, code, 0, ""));
|
||||||
} else {
|
} else {
|
||||||
ERR_I(CocInitClient(conn, "", port, code, 0, startcmd));
|
ERR_I(iret=CocInitClient(conn, "", port, code, 0, startcmd));
|
||||||
}
|
}
|
||||||
|
if (iret==1) ErrShort("TECS_INIT: can not connect to TecsServer");
|
||||||
return((pTecsClient)conn);
|
return((pTecsClient)conn);
|
||||||
OnError: return(NULL);
|
OnError:
|
||||||
|
if (conn!=NULL) FREE(conn);
|
||||||
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
pTecsClient TeccStart(char *startcmd, char *host, int port) {
|
pTecsClient TeccStart(char *startcmd, char *host, int port) {
|
||||||
CocConn *conn;
|
CocConn *conn;
|
||||||
char *code, *cmd, thishost[64];
|
char *code, *cmd, thishost[64];
|
||||||
|
int iret;
|
||||||
|
|
||||||
NEW(conn, CocConn);
|
NEW(conn, CocConn);
|
||||||
code=rwCode;
|
code=rwCode;
|
||||||
@ -47,7 +52,8 @@ pTecsClient TeccStart(char *startcmd, char *host, int port) {
|
|||||||
cmd="";
|
cmd="";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ERR_I(CocInitClient(conn, host, port, code, 0, cmd));
|
ERR_I(iret=CocInitClient(conn, host, port, code, 0, cmd));
|
||||||
|
if (iret==1) ErrShort("TECS_INIT: can not connect to TecsServer");
|
||||||
return((pTecsClient)conn);
|
return((pTecsClient)conn);
|
||||||
OnError: return(NULL);
|
OnError: return(NULL);
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
program tecs_client
|
program tecs_client
|
||||||
|
|
||||||
real temp
|
|
||||||
character device*32, start*80, line*80, cmd*16, par*80, response*1024
|
character device*32, start*80, line*80, cmd*16, par*80, response*1024
|
||||||
character inst*64, host*64, user*1, pcod*1
|
character inst*64, host*64, user*1, pcod*1
|
||||||
integer i,j,k,iret,l,port
|
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 cmdpar*128
|
||||||
character prompt*32/'tecs>'/
|
character prompt*32/'tecs>'/
|
||||||
integer promptlen/6/
|
integer promptlen/6/
|
||||||
@ -82,8 +85,25 @@
|
|||||||
|
|
||||||
l=0
|
l=0
|
||||||
1 if (oneCommand) goto 99
|
1 if (oneCommand) goto 99
|
||||||
call sys_rd_line(line, l, prompt(1:promptlen))
|
if (nfiles .gt. 0) then
|
||||||
if (l .lt. 0) goto 99
|
read(luns(idx), '(q,a)', err=22,end=22) l, line
|
||||||
|
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
|
||||||
|
open(luns(idx), name=line(2:), status='old', readonly)
|
||||||
|
goto 1
|
||||||
|
endif
|
||||||
11 l=l+1
|
11 l=l+1
|
||||||
line(l:l)=' '
|
line(l:l)=' '
|
||||||
cmd=' '
|
cmd=' '
|
||||||
@ -230,6 +250,10 @@
|
|||||||
elseif (cmd .eq. 'watch') then
|
elseif (cmd .eq. 'watch') then
|
||||||
iret=tecs_watch_log(par)
|
iret=tecs_watch_log(par)
|
||||||
if (iret .lt. 0) goto 19
|
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
|
else
|
||||||
iret=tecs_set_par(cmd, par, 2)
|
iret=tecs_set_par(cmd, par, 2)
|
||||||
if (iret .lt. 0) goto 19
|
if (iret .lt. 0) goto 19
|
||||||
@ -245,6 +269,18 @@
|
|||||||
endif
|
endif
|
||||||
goto 1
|
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)
|
90 call tecs_write_error(6)
|
||||||
92 call exit(40) ! Abort
|
92 call exit(40) ! Abort
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user