version working with also with redhat linux

This commit is contained in:
cvs
2002-06-13 13:05:44 +00:00
parent 442a784e5c
commit ae1ed10f5b
9 changed files with 42 additions and 71 deletions

View File

@ -1,4 +1,4 @@
#include <sys/time.h> #include <time.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
@ -67,11 +67,7 @@ int InstrHost(char *input, char *instr, char *host, char *user, char *pcod
#ifdef F_CHAR #ifdef F_CHAR
/* compile only when fortran c interface stuff is defined */ /* compile only when fortran c interface stuff is defined */
#ifdef __VMS int F_FUN(instr_host)(F_CHAR(input), F_CHAR(instr), F_CHAR(host), F_CHAR(user), F_CHAR(pcod)
#define instr_host_ instr_host
#endif
int instr_host_(F_CHAR(input), F_CHAR(instr), F_CHAR(host), F_CHAR(user), F_CHAR(pcod)
, int input_len, int instr_len, int host_len, int user_len, int pcod_len) { , int input_len, int instr_len, int host_len, int user_len, int pcod_len) {
char buf[256], in[256], ho[256], us[256], pc[256]; char buf[256], in[256], ho[256], us[256], pc[256];
int iRet; int iRet;

View File

@ -1,5 +1,5 @@
#ifndef _INSTR_HOSTS_H_ #ifndef _MYC_STR_H_
#define _INSTR_HOSTS_H_ #define _MYC_STR_H_
int InstrHost(char *input, char *instr, char *host, char *user, char *pcod int InstrHost(char *input, char *instr, char *host, char *user, char *pcod
, int instr_len, int host_len, int user_len, int pcod_len); , int instr_len, int host_len, int user_len, int pcod_len);
@ -8,4 +8,4 @@ int InstrHost(char *input, char *instr, char *host, char *user, char *pcod
output is: instrument name, host name, user name and pcod (the code needed to enter...) output is: instrument name, host name, user name and pcod (the code needed to enter...)
*/ */
#endif /* _INSTR_HOSTS_H_ */ #endif /* _MYC_STR_H_ */

View File

@ -104,40 +104,32 @@ void ERR_EXIT(char *text) {
#ifdef F_CHAR #ifdef F_CHAR
/* compile only when fortran c interface stuff is defined */ /* compile only when fortran c interface stuff is defined */
#ifdef __VMS void F_FUN(err_show)(F_CHAR(text), int text_len) {
#define err_show_ err_show
#define err_txt_ err_txt
#define err_msg_ err_msg
#define err_set_outrtn_ err_set_outrtn
#define err_short_ err_short
#endif
void err_show_(F_CHAR(text), int text_len) {
char buf[256]; char buf[256];
STR_TO_C(buf, text); STR_TO_C(buf, text);
ErrShow(buf); ErrShow(buf);
} }
void err_txt_(F_CHAR(text), int text_len) { void F_FUN(err_txt)(F_CHAR(text), int text_len) {
char buf[256]; char buf[256];
STR_TO_C(buf, text); STR_TO_C(buf, text);
ErrTxt(buf,0); ErrTxt(buf,0);
} }
void err_msg_(F_CHAR(text), int text_len) { void F_FUN(err_msg)(F_CHAR(text), int text_len) {
char buf[256]; char buf[256];
STR_TO_C(buf, text); STR_TO_C(buf, text);
ErrMsg(buf); ErrMsg(buf);
} }
void err_set_outrtn_(void (*rtn)(), void *arg) { void F_FUN(err_set_outrtn)(void (*rtn)(), void *arg) {
ErrSetOutRtn(rtn, arg); ErrSetOutRtn(rtn, arg);
} }
void err_short_(void) { void F_FUN(err_short)(void) {
ErrShort(ErrMessage); ErrShort(ErrMessage);
} }

View File

@ -1,5 +1,5 @@
#include <assert.h> #include <assert.h>
#include <sys/time.h> #include <time.h>
#include <sys/timeb.h> #include <sys/timeb.h>
#include "sys_util.h" #include "sys_util.h"
#include "myc_time.h" #include "myc_time.h"
@ -107,14 +107,8 @@ int mycTime(int date) {
/* compile only when fortran c interface stuff is defined */ /* compile only when fortran c interface stuff is defined */
#ifdef __VMS int F_FUN(myc_now)(void) { return mycNow(); }
#define myc_date_ myc_date int F_FUN(myc_date)(int *time) { return mycDate(*time); }
#define myc_time_ myc_time int F_FUN(myc_time)(int *date) { return mycTime(*date); }
#define myc_now_ myc_now
#endif
int myc_now_(void) { return mycNow(); }
int myc_date_(int *time) { return mycDate(*time); }
int myc_time_(int *date) { return mycTime(*date); }
#endif #endif

View File

@ -26,17 +26,25 @@ typedef struct { short size, dummy; char *text; } SysVmsChar;
#define F_CHAR(VAR) SysVmsChar *VAR##_desc #define F_CHAR(VAR) SysVmsChar *VAR##_desc
#define STR_TO_C(DST,SRC) str_ntrim(DST, SRC##_desc->text, sizeof(DST), SRC##_desc->size) #define STR_TO_C(DST,SRC) str_ntrim(DST, SRC##_desc->text, sizeof(DST), SRC##_desc->size)
#define STR_TO_F(DST,SRC) str_npad(DST##_desc->text, SRC, DST##_desc->size) #define STR_TO_F(DST,SRC) str_npad(DST##_desc->text, SRC, DST##_desc->size)
#define F_FUN(A) A
typedef size_t sys_adr_len; /* argument of accept and gethostbyadr */ typedef size_t sys_adr_len; /* argument of accept and gethostbyadr */
void sys_ctrl_init(void); void sys_ctrl_init(void);
#elif defined __alpha || defined __unix #elif defined __alpha || defined __unix
#define F_CHAR(VAR) char *VAR #define F_CHAR(VAR) char *VAR
#define STR_TO_C(DST,SRC) str_ntrim(DST, SRC, sizeof(DST), SRC##_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) #define STR_TO_F(DST,SRC) str_npad(DST, SRC, DST##_len)
#ifdef __alpha
#define F_FUN(A) A##_
#else
#define F_FUN(A) A##__
#endif
typedef int sys_adr_len; /* argument of accept and gethostbyadr */ typedef int sys_adr_len; /* argument of accept and gethostbyadr */
#define sys_ctrl_init() 0 #define sys_ctrl_init() 0

View File

@ -107,27 +107,9 @@ void TeccClose(pTecsClient conn) {
/* compile only when fortran c interface stuff is defined */ /* compile only when fortran c interface stuff is defined */
#ifdef __VMS
#define tecs_get_par_ tecs_get_par
#define tecs_get_mult_ tecs_get_mult
#define tecs_set_par_ tecs_set_par
#define tecs_init_ tecs_init
#define tecs_get3_ tecs_get3
#define tecs_get_ tecs_get
#define tecs_set_ tecs_set
#define tecs_is_open_ tecs_is_open
#define tecs_close_ tecs_close
#define tecs_quit_server_ tecs_quit_server
#define tecs_watch_log_ tecs_watch_log
#define tecs_get_data_ tecs_get_data
#define tecs_date_ tecs_date
#define tecs_time_ tecs_time
#define tecs_rights_ tecs_rights
#endif
static pTecsClient conn=NULL; static pTecsClient conn=NULL;
int tecs_set_par_(F_CHAR(name), F_CHAR(par), int *show, int name_len, int par_len) { 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]; char nbuf[64], pbuf[COC_CMD_LEN];
int iret=-1; int iret=-1;
@ -144,7 +126,7 @@ int tecs_set_par_(F_CHAR(name), F_CHAR(par), int *show, int name_len, int par_le
OnError: return(-1); OnError: return(-1);
} }
int tecs_get_par_(F_CHAR(name), F_CHAR(par), int *show, int name_len, int par_len) { 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]; char *b, nbuf[64], pbuf[COC_RES_LEN];
int iret=-1; int iret=-1;
@ -169,7 +151,7 @@ int tecs_get_par_(F_CHAR(name), F_CHAR(par), int *show, int name_len, int par_le
OnError: return(-1); OnError: return(-1);
} }
int tecs_get_mult_(F_CHAR(names), int *time, int *nvalues, float values[], int names_len) { int F_FUN(tecs_get_mult)(F_CHAR(names), int *time, int *nvalues, float values[], int names_len) {
char *b, nbuf[64], pbuf[COC_RES_LEN]; char *b, nbuf[64], pbuf[COC_RES_LEN];
char *nams, nam[32]; char *nams, nam[32];
int i; int i;
@ -193,7 +175,7 @@ int tecs_get_mult_(F_CHAR(names), int *time, int *nvalues, float values[], int n
OnError: return(-1); OnError: return(-1);
} }
int tecs_init_(F_CHAR(startcmd), int *port, int startcmd_len) { int F_FUN(tecs_init)(F_CHAR(startcmd), int *port, int startcmd_len) {
char sbuf[132]; char sbuf[132];
STR_TO_C(sbuf, startcmd); STR_TO_C(sbuf, startcmd);
@ -202,7 +184,7 @@ int tecs_init_(F_CHAR(startcmd), int *port, int startcmd_len) {
OnError: return(-1); OnError: return(-1);
} }
int tecs_rights_(int write) { int F_FUN(tecs_rights)(int write) {
if (write) { if (write) {
ERR_I(CocSendMagic(conn, rwCode)); ERR_I(CocSendMagic(conn, rwCode));
} else { } else {
@ -212,34 +194,34 @@ int tecs_rights_(int write) {
OnError: return(-1); OnError: return(-1);
} }
int tecs_get_(float *temp) { int F_FUN(tecs_get)(float *temp) {
ERR_I(TeccGet(conn, temp)); ERR_I(TeccGet(conn, temp));
return(0); return(0);
OnError: return(-1); OnError: return(-1);
} }
int tecs_get3_(float *t1, float *t2, float *t3) { int F_FUN(tecs_get3)(float *t1, float *t2, float *t3) {
ERR_I(TeccGet3(conn, t1, t2, t3)); ERR_I(TeccGet3(conn, t1, t2, t3));
return(0); return(0);
OnError: return(-1); OnError: return(-1);
} }
int tecs_set_(float *temp) { int F_FUN(tecs_set)(float *temp) {
ERR_I(TeccSet(conn, *temp)); ERR_I(TeccSet(conn, *temp));
return(0); return(0);
OnError: return(-1); OnError: return(-1);
} }
int tecs_is_open_() { int F_FUN(tecs_is_open)(void) {
return(conn!=NULL); return(conn!=NULL);
} }
void tecs_close_(void) { void F_FUN(tecs_close)(void) {
TeccClose(conn); TeccClose(conn);
conn=NULL; conn=NULL;
} }
int tecs_quit_server_(int *kill) { int F_FUN(tecs_quit_server)(int *kill) {
int iret; int iret;
ERR_I(iret=TeccQuitServer(conn, *kill)); ERR_I(iret=TeccQuitServer(conn, *kill));
@ -247,7 +229,7 @@ int tecs_quit_server_(int *kill) {
OnError: return(-1); OnError: return(-1);
} }
int tecs_watch_log_(F_CHAR(list), int list_len) { int F_FUN(tecs_watch_log)(F_CHAR(list), int list_len) {
char buf[16]; char buf[16];
STR_TO_C(buf, list); STR_TO_C(buf, list);
ERR_I(CocWatchLog(conn, buf)); ERR_I(CocWatchLog(conn, buf));
@ -255,7 +237,7 @@ int tecs_watch_log_(F_CHAR(list), int list_len) {
OnError: return(-1); OnError: return(-1);
} }
int tecs_get_data_(F_CHAR(names), int *startTime, int *endTime, int *step, int *tbase 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 , float xdata[], float ydata[], int *maxLen, int *width
, int retLen[], int names_len) { , int retLen[], int names_len) {
char nam[64]; char nam[64];

View File

@ -17,6 +17,9 @@ pTecsClient TeccInit(char *server, int port);
int TeccGet(pTecsClient conn, float *temp); int TeccGet(pTecsClient conn, float *temp);
/* get temperature */ /* get temperature */
int TeccGet3(pTecsClient conn, float *tSet, float *tExch, float *tSamp);
/* get temperatures */
int TeccSet(pTecsClient conn, float temp); int TeccSet(pTecsClient conn, float temp);
/* set temperature */ /* set temperature */

View File

@ -137,8 +137,7 @@ c if INIT exists, read it to get the port number and the start command
endif endif
end end
SUBROUTINE TECS_GET_T (IOLUN, TEMP, IRET) !!
SUBROUTINE TECS_GET_T (IOLUN, TEMP, IRET) !!
!! ========================================= !! =========================================
!! !!
!! Get temperatures and wait if TECS is configuring !! Get temperatures and wait if TECS is configuring
@ -176,8 +175,7 @@ c------------------------------------------------------------------------------
temp(4)=0.0 ! no auxilliary sensor temp(4)=0.0 ! no auxilliary sensor
end end
subroutine TECS_WRITE_ERROR(IOLUN) !!
subroutine TECS_WRITE_ERROR(IOLUN) !!
!! ================================== !! ==================================
!! !!
!! write out error message of last error and stack info !! write out error message of last error and stack info
@ -193,8 +191,7 @@ c------------------------------------------------------------------------------
end end
subroutine TECS_WRITE_MSG(IOLUN) !!
subroutine TECS_WRITE_MSG(IOLUN) !!
!! ================================ !! ================================
!! !!
!! write out error message of last error without stack info !! write out error message of last error without stack info
@ -210,8 +207,7 @@ c------------------------------------------------------------------------------
end end
SUBROUTINE TECS_ERR_ROUTINE (LUN, TEXT)
SUBROUTINE TECS_ERR_ROUTINE (LUN, TEXT)
! ======================================= ! =======================================
! !
! routine called from C ! routine called from C