Compare commits
65 Commits
R3.13.0-be
...
R3.13.0-be
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22b550ed35 | ||
|
|
a17b659a86 | ||
|
|
b5e120d082 | ||
|
|
b8d6a8216e | ||
|
|
5587867f6f | ||
|
|
be33ae291e | ||
|
|
932a4b0d5c | ||
|
|
7452aea2bc | ||
|
|
178e034e75 | ||
|
|
cbb5a6acde | ||
|
|
08a8e874eb | ||
|
|
29f381b8f4 | ||
|
|
5d123c6a4d | ||
|
|
2d999ed858 | ||
|
|
956fba853e | ||
|
|
97b96da957 | ||
|
|
63a377ce99 | ||
|
|
84df076e38 | ||
|
|
582d4b64cd | ||
|
|
ebebde9539 | ||
|
|
8771c33c46 | ||
|
|
3eae90a803 | ||
|
|
693de689e9 | ||
|
|
a30a0fcbaa | ||
|
|
0283890686 | ||
|
|
c1d0a4ad5a | ||
|
|
b2fcff709b | ||
|
|
aed16987e2 | ||
|
|
b6a5423a1f | ||
|
|
9610b9a07d | ||
|
|
98df963844 | ||
|
|
19f9d0c14d | ||
|
|
a5e1223b0c | ||
|
|
0db9c03505 | ||
|
|
a3ce428cdd | ||
|
|
057e1723cb | ||
|
|
0f156d5219 | ||
|
|
1d39b11b7f | ||
|
|
9e12de8e4f | ||
|
|
4aa19f07d7 | ||
|
|
142b7515e3 | ||
|
|
8feefadabf | ||
|
|
6a9030e5e6 | ||
|
|
bece5d0b9a | ||
|
|
24e0989142 | ||
|
|
815668143f | ||
|
|
737278aa41 | ||
|
|
c14d23494c | ||
|
|
d611fa2d75 | ||
|
|
1aa384308d | ||
|
|
2e80e8c2ee | ||
|
|
0830382ec7 | ||
|
|
c253066bc7 | ||
|
|
6fca0cd260 | ||
|
|
470152454b | ||
|
|
4a8507cb0d | ||
|
|
6917b31975 | ||
|
|
0cf19108db | ||
|
|
01b3617614 | ||
|
|
27567a54ed | ||
|
|
c04f34be42 | ||
|
|
0d2b196be2 | ||
|
|
7c23cf9c8c | ||
|
|
2d0dd7828f | ||
|
|
6fbc050c96 |
@@ -22,6 +22,7 @@ YACC = $(EYACC)
|
||||
LEX = $(ELEX)
|
||||
G++ = g++
|
||||
CCC = CC
|
||||
MV = mv
|
||||
RMDIR = rm -rf
|
||||
MKDIR = mkdir
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ YACC = $(EYACC)
|
||||
LEX = $(ELEX)
|
||||
G++ = g++
|
||||
CCC = CC
|
||||
MV = mv
|
||||
RMDIR = rm -rf
|
||||
MKDIR = mkdir
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ YACC = $(EYACC)
|
||||
LEX = $(ELEX)
|
||||
G++ = g++
|
||||
CCC = CC
|
||||
MV = mv
|
||||
RMDIR = rm -rf
|
||||
MKDIR = mkdir
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ YACC = $(EYACC)
|
||||
LEX = $(ELEX)
|
||||
G++ = g++
|
||||
CCC = CC
|
||||
MV = mv
|
||||
RMDIR = rm -rf
|
||||
MKDIR = mkdir
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ YACC = $(EYACC)
|
||||
LEX = $(ELEX)
|
||||
G++ = /opt/gnu/bin/g++
|
||||
CCC = /opt/SUNWspro/bin/CC
|
||||
MV = mv
|
||||
RMDIR = rm -rf
|
||||
MKDIR = mkdir
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ YACC = $(EYACC)
|
||||
LEX = $(ELEX)
|
||||
G++ = g++
|
||||
CCC = /usr/lang/CC
|
||||
MV = mv
|
||||
RMDIR = rm -rf
|
||||
MKDIR = mkdir
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
# the order of following list is important
|
||||
|
||||
# for c++ build add the dirs gdd and cas after ca
|
||||
|
||||
DIRS = \
|
||||
tools \
|
||||
include \
|
||||
@@ -16,8 +18,6 @@ DIRS = \
|
||||
db \
|
||||
bpt \
|
||||
ca \
|
||||
gdd \
|
||||
cas \
|
||||
util \
|
||||
misc \
|
||||
sequencer \
|
||||
|
||||
@@ -36,7 +36,7 @@ endif
|
||||
# hkv2f
|
||||
# niCpu030
|
||||
#
|
||||
CROSS_COMPILER_TARGET_ARCHS=mv167
|
||||
CROSS_COMPILER_TARGET_ARCHS=mv167 mv162
|
||||
|
||||
# If only a subset of the host architectures perform
|
||||
# the build for the CROSS_COMPILER_TARGET_ARCHS
|
||||
|
||||
@@ -23,6 +23,8 @@ all:: install
|
||||
|
||||
pre_build::
|
||||
|
||||
rebuild:: clean install
|
||||
|
||||
build:: pre_build $(LIBNAME) $(TARGETS) $(PROD)
|
||||
|
||||
inc:: $(INSTALL_INC)
|
||||
@@ -82,20 +84,20 @@ $(TARGETS) $(PROD): $(DEPLIBS)
|
||||
$(YACC) $(YACCOPT) $<
|
||||
@if [ -f y.tab.c ]; \
|
||||
then \
|
||||
echo "/bin/mv y.tab.c $*.c"; \
|
||||
/bin/mv y.tab.c $*.c; \
|
||||
echo "$(MV) y.tab.c $*.c"; \
|
||||
$(MV) y.tab.c $*.c; \
|
||||
fi
|
||||
@if [ -f y.tab.h ]; \
|
||||
then \
|
||||
echo "/bin/mv y.tab.h $*.h"; \
|
||||
/bin/mv y.tab.h $*.h; \
|
||||
echo "$(MV) y.tab.h $*.h"; \
|
||||
$(MV) y.tab.h $*.h; \
|
||||
fi
|
||||
|
||||
%.c: ../%.l
|
||||
$(RM) lex.yy.c
|
||||
$(LEX) $(LEXOPT) $<
|
||||
$(RM) $@
|
||||
/bin/mv lex.yy.c $@
|
||||
$(MV) lex.yy.c $@
|
||||
|
||||
#state notation language rule
|
||||
%.c: ../%.st
|
||||
@@ -128,7 +130,7 @@ $(TARGETS) $(PROD): $(DEPLIBS)
|
||||
$(RM) $(<F).nr
|
||||
ln -s $<
|
||||
$(MANGEN) -s $(<F)
|
||||
mv $(<F).nr $(<F).1
|
||||
$(MV) $(<F).nr $(<F).1
|
||||
|
||||
# Mangen Rule:
|
||||
%.1:../%
|
||||
@@ -136,7 +138,7 @@ $(TARGETS) $(PROD): $(DEPLIBS)
|
||||
$(RM) $(<F).nr
|
||||
ln -s $<
|
||||
$(MANGEN) -s $(<F)
|
||||
mv $(<F).nr $(<F).1
|
||||
$(MV) $(<F).nr $(<F).1
|
||||
|
||||
$(LIBNAME): $(LIBOBJS)
|
||||
@echo Building library $@
|
||||
@@ -252,7 +254,7 @@ $(INSTALL_TEMPLATES)/$(TEMPLATES_DIR)/%: %
|
||||
|
||||
.PRECIOUS: %.o %.c
|
||||
|
||||
.PHONY: all inc depends build install pre-build clean
|
||||
.PHONY: all inc depends build install pre-build clean rebuild
|
||||
|
||||
-include .DEPENDS
|
||||
|
||||
|
||||
@@ -27,10 +27,12 @@ INSTALL_DBDNAME=$(DBDNAME:%=$(INSTALL_DBD)/%)
|
||||
|
||||
all:: install
|
||||
|
||||
rebuild:: clean install
|
||||
|
||||
pre_build::
|
||||
|
||||
build:: pre_build $(MENUS) $(RECTYPES) $(BPTS)\
|
||||
$(LIBNAME) $(TARGETS) $(PROD)
|
||||
$(LIBNAME) $(TARGETS) $(PROD) $(DBDNAME)
|
||||
|
||||
inc:: $(INSTALL_INC)
|
||||
|
||||
@@ -55,7 +57,7 @@ endif
|
||||
clean::
|
||||
@echo "Cleaning"
|
||||
@$(RM) *.i *.o *.a $(TARGETS) $(PROD) $(LIBNAME) $(INC) \
|
||||
$(DBDINSTALL) $(MENUS) $(RECTYPES) $(BPTS) $(DBDEXPAND)
|
||||
$(DBDINSTALL) $(MENUS) $(RECTYPES) $(BPTS) $(DBDNAME)
|
||||
|
||||
|
||||
# The order of the following dependencies is
|
||||
@@ -90,20 +92,20 @@ clean::
|
||||
$(YACC) $(YACCOPT) $<
|
||||
@if [ -f y.tab.c ]; \
|
||||
then \
|
||||
echo "/bin/mv y.tab.c $*.c"; \
|
||||
/bin/mv y.tab.c $*.c; \
|
||||
echo "$(MV) y.tab.c $*.c"; \
|
||||
$(MV) y.tab.c $*.c; \
|
||||
fi
|
||||
@if [ -f y.tab.h ]; \
|
||||
then \
|
||||
echo "/bin/mv y.tab.h $*.h"; \
|
||||
/bin/mv y.tab.h $*.h; \
|
||||
echo "$(MV) y.tab.h $*.h"; \
|
||||
$(MV) y.tab.h $*.h; \
|
||||
fi
|
||||
|
||||
%.c: ../%.l
|
||||
$(RM) lex.yy.c
|
||||
$(LEX) $(LEXOPT) $<
|
||||
$(RM) $@
|
||||
/bin/mv lex.yy.c $@
|
||||
$(MV) lex.yy.c $@
|
||||
|
||||
#state notation language rules
|
||||
%.c: ../%.st
|
||||
@@ -136,7 +138,7 @@ clean::
|
||||
$(RM) $(<F).nr
|
||||
ln -s $<
|
||||
$(MANGEN) -s $(<F)
|
||||
mv $(<F).nr $(<F).1
|
||||
$(MV) $(<F).nr $(<F).1
|
||||
|
||||
|
||||
$(INSTALL_DBD)/%: %
|
||||
@@ -254,7 +256,7 @@ $(INSTALL_DOC)/%: ../%
|
||||
|
||||
.PRECIOUS: %.o %.c
|
||||
|
||||
.PHONY: all inc depends build install pre-build clean
|
||||
.PHONY: all inc depends build install pre-build clean rebuild
|
||||
|
||||
-include .DEPENDS
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ ACTIONS += inc
|
||||
ACTIONS += build
|
||||
ACTIONS += install
|
||||
ACTIONS += depends
|
||||
ACTIONS += rebuild
|
||||
|
||||
actionPart = $(word 1, $(subst $(DIVIDER), ,$@))
|
||||
archPart = $(word 2, $(subst $(DIVIDER), ,$@))
|
||||
@@ -18,7 +19,7 @@ archPart = $(word 2, $(subst $(DIVIDER), ,$@))
|
||||
#
|
||||
# hostActionArchTargets
|
||||
#
|
||||
hostArchs = $(HOST_ARCH) $(filter-out $(HOST_ARCH),$(CROSS_COMPILER_HOST_ARCHS))
|
||||
hostArchs = $(HOST_ARCH)
|
||||
hostActionArchTargets = $(foreach x, $(ACTIONS),\
|
||||
$(foreach arch,$(hostArchs), $(x)$(DIVIDER)$(arch)))
|
||||
ifeq (Makefile.$(BUILD_TYPE), $(wildcard Makefile.$(BUILD_TYPE)))
|
||||
@@ -35,7 +36,7 @@ endif
|
||||
#
|
||||
# crossActionArchTargets
|
||||
#
|
||||
crossArchs = $(CROSS_COMPILER_TARGET_ARCHS)
|
||||
crossArchs = $(filter-out $(hostArchs),$(BUILD_ARCHS))
|
||||
crossActionArchTargets = $(foreach x, $(ACTIONS), \
|
||||
$(foreach arch, $(CROSS_COMPILER_TARGET_ARCHS), $(x)$(DIVIDER)$(arch)))
|
||||
ifeq (Makefile.Vx, $(wildcard Makefile.Vx))
|
||||
|
||||
@@ -26,7 +26,7 @@ actionArchTargets = $(foreach action, $(ACTIONS),\
|
||||
|
||||
all:: inc install
|
||||
|
||||
rebuild:: clean uninstall all
|
||||
rebuild:: clean all
|
||||
|
||||
$(DIRS) $(dirActionTargets) $(dirArchTargets)$(dirActionArchTargets) ::
|
||||
$(MAKE) -C $(dirPart) $(actionArchPart)
|
||||
|
||||
@@ -168,9 +168,8 @@ LOCAL void asCaTask(void)
|
||||
pasg->inpBad |= (1<<pasginp->inpIndex);
|
||||
pcapvt = pasginp->capvt = asCalloc(1,sizeof(CAPVT));
|
||||
/*Note calls connectCallback immediately called for local Pvs*/
|
||||
SEVCHK(ca_build_and_connect(pasginp->inp,TYPENOTCONN,0,
|
||||
&pcapvt->chid,0,connectCallback,pasginp),
|
||||
"ca_build_and_connect");
|
||||
SEVCHK(ca_search_and_connect(pasginp->inp,&pcapvt->chid,
|
||||
connectCallback,pasginp),"ca_build_and_connect");
|
||||
/*Note calls accessRightsCallback immediately called for local Pvs*/
|
||||
SEVCHK(ca_replace_access_rights_event(pcapvt->chid,accessRightsCallback),
|
||||
"ca_replace_access_rights_event");
|
||||
|
||||
@@ -9,7 +9,7 @@ PROD = makeBpt
|
||||
|
||||
include $(TOP)/config/RULES.Unix
|
||||
|
||||
$(PROD): $(OBJS) $(DEPLIBS)
|
||||
$(PROD): $(OBJS)
|
||||
$(RM) $@
|
||||
$(LINK.c) -o $@ ${OBJS} $(LDLIBS)
|
||||
|
||||
|
||||
@@ -99,6 +99,9 @@
|
||||
/************************************************************************/
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.85 1996/09/04 20:02:00 jhill
|
||||
* test for non-nill piiu under vxWorks
|
||||
*
|
||||
* Revision 1.84 1996/07/10 23:30:09 jhill
|
||||
* fixed GNU warnings
|
||||
*
|
||||
@@ -638,7 +641,7 @@ LOCAL void create_udp_fd()
|
||||
|
||||
status = taskPriorityGet(VXTASKIDSELF, &pri);
|
||||
if(status<0)
|
||||
ca_signal(ECA_INTERNAL,NULL);
|
||||
genLocalExcep (ECA_INTERNAL,NULL);
|
||||
|
||||
strcpy(name,"RD ");
|
||||
strncat(
|
||||
@@ -663,7 +666,7 @@ LOCAL void create_udp_fd()
|
||||
0,
|
||||
0);
|
||||
if (status<0) {
|
||||
ca_signal(ECA_INTERNAL,NULL);
|
||||
genLocalExcep (ECA_INTERNAL,NULL);
|
||||
}
|
||||
|
||||
ca_static->recv_tid = status;
|
||||
@@ -836,8 +839,7 @@ void ca_process_exit()
|
||||
FALSE);
|
||||
}
|
||||
if (socket_close(piiu->sock_chan) < 0){
|
||||
ca_signal(
|
||||
ECA_INTERNAL,
|
||||
genLocalExcep ( ECA_INTERNAL,
|
||||
"Corrupt iiu list- at close");
|
||||
}
|
||||
piiu = (struct ioc_in_use *) piiu->node.next;
|
||||
@@ -2964,11 +2966,41 @@ int epicsShareAPI ca_test_io()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* generateLocalExceptionWithFileAndLine ()
|
||||
*/
|
||||
void generateLocalExceptionWithFileAndLine (long stat, char *ctx,
|
||||
char *pFile, unsigned lineNo)
|
||||
{
|
||||
struct exception_handler_args args;
|
||||
|
||||
/*
|
||||
* NOOP if they disable exceptions
|
||||
*/
|
||||
if (!ca_static->ca_exception_func) {
|
||||
return;
|
||||
}
|
||||
|
||||
args.usr = ca_static->ca_exception_arg;
|
||||
args.chid = NULL;
|
||||
args.type = -1;
|
||||
args.count = 0u;
|
||||
args.addr = NULL;
|
||||
args.stat = stat;
|
||||
args.op = CA_OP_OTHER;
|
||||
args.ctx = ctx;
|
||||
args.pFile = pFile;
|
||||
args.lineNo = lineNo;
|
||||
|
||||
LOCKEVENTS;
|
||||
(*ca_static->ca_exception_func) (args);
|
||||
UNLOCKEVENTS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* CA_SIGNAL()
|
||||
*
|
||||
*
|
||||
*/
|
||||
void epicsShareAPI ca_signal(long ca_status,char *message)
|
||||
{
|
||||
@@ -2985,7 +3017,7 @@ void epicsShareAPI ca_signal(long ca_status,char *message)
|
||||
* of this routine is calling this routine
|
||||
* (if they call this routine again).
|
||||
*/
|
||||
const char *ca_message(long ca_status)
|
||||
READONLY char * epicsShareAPI ca_message (long ca_status)
|
||||
{
|
||||
unsigned msgNo = CA_EXTRACT_MSG_NO(ca_status);
|
||||
|
||||
@@ -3328,27 +3360,26 @@ void issue_claim_channel(struct ioc_in_use *piiu, chid pchan)
|
||||
*/
|
||||
LOCAL void ca_default_exception_handler(struct exception_handler_args args)
|
||||
{
|
||||
char *pName;
|
||||
|
||||
if(args.chid){
|
||||
pName = ca_name(args.chid);
|
||||
}
|
||||
else{
|
||||
pName = "?";
|
||||
}
|
||||
char *pCtx;
|
||||
|
||||
/*
|
||||
* LOCK around use of sprintf buffer
|
||||
*/
|
||||
LOCK;
|
||||
sprintf(sprintf_buf,
|
||||
"%s - with request chan=%s op=%ld data type=%s count=%ld",
|
||||
args.ctx,
|
||||
pName,
|
||||
args.op,
|
||||
dbr_type_to_text(args.type),
|
||||
args.count);
|
||||
ca_signal(args.stat, sprintf_buf);
|
||||
if (args.chid && args.op != CA_OP_OTHER) {
|
||||
sprintf(sprintf_buf,
|
||||
"%s - with request chan=%s op=%ld data type=%s count=%ld",
|
||||
args.ctx,
|
||||
ca_name(args.chid),
|
||||
args.op,
|
||||
dbr_type_to_text(args.type),
|
||||
args.count);
|
||||
pCtx = sprintf_buf;
|
||||
}
|
||||
else {
|
||||
pCtx = args.ctx;
|
||||
}
|
||||
ca_signal_with_file_and_lineno(args.stat, pCtx, args.pFile, args.lineNo);
|
||||
UNLOCK;
|
||||
}
|
||||
|
||||
@@ -3423,6 +3454,16 @@ int epicsShareAPI ca_v42_ok(chid chan)
|
||||
return v42;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ca_version()
|
||||
* function that returns the CA version string
|
||||
*/
|
||||
READONLY char * epicsShareAPI ca_version()
|
||||
{
|
||||
return CA_VERSION_STRING;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
|
||||
@@ -7,6 +7,12 @@ static char *sccsId = "@(#) $Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.37 1996/09/16 16:31:01 jhill
|
||||
* fixed NT warnings
|
||||
*
|
||||
* Revision 1.36 1996/07/24 21:55:33 jhill
|
||||
* fixed gnu warnings
|
||||
*
|
||||
* Revision 1.35 1996/07/01 19:49:15 jhill
|
||||
* turned on analog value wrap-around test
|
||||
*
|
||||
@@ -141,6 +147,11 @@ int doacctst(char *pname)
|
||||
lib$init_timer();
|
||||
#endif /*VMS*/
|
||||
|
||||
printf("CA Client V%s\n", ca_version());
|
||||
|
||||
/*
|
||||
* CA pend event delay accuracy test
|
||||
*/
|
||||
{
|
||||
TS_STAMP end_time;
|
||||
TS_STAMP start_time;
|
||||
@@ -158,12 +169,28 @@ int doacctst(char *pname)
|
||||
accuracy = 100.0*(delay-request)/request;
|
||||
printf("CA pend event delay accuracy = %f %%\n",
|
||||
accuracy);
|
||||
assert (abs(accuracy) < 10.0);
|
||||
assert (fabs(accuracy) < 10.0);
|
||||
}
|
||||
|
||||
size = dbr_size_n(DBR_GR_FLOAT, NUM);
|
||||
ptr = (struct dbr_gr_float *) malloc(size);
|
||||
|
||||
/*
|
||||
* verify that we dont print a disconnect message when
|
||||
* we delete the last channel
|
||||
* (this fails if we see a disconnect message)
|
||||
*/
|
||||
status = ca_search( pname, &chix3);
|
||||
SEVCHK(status, NULL);
|
||||
status = ca_pend_io(1000.0);
|
||||
SEVCHK(status, NULL);
|
||||
status = ca_clear_channel(chix3);
|
||||
SEVCHK(status, NULL);
|
||||
|
||||
/*
|
||||
* verify lots of disconnects
|
||||
* verify channel connected state variables
|
||||
*/
|
||||
printf("Connect/disconnect test");
|
||||
fflush(stdout);
|
||||
for (i = 0; i < 10; i++) {
|
||||
@@ -290,32 +317,32 @@ int doacctst(char *pname)
|
||||
ca_read_access(chix1) &&
|
||||
ca_write_access(chix1)){
|
||||
|
||||
dbr_double_t incr;
|
||||
dbr_double_t epsil;
|
||||
dbr_double_t base;
|
||||
dbr_float_t incr;
|
||||
dbr_float_t epsil;
|
||||
dbr_float_t base;
|
||||
unsigned long iter;
|
||||
|
||||
printf ("float test ...");
|
||||
fflush(stdout);
|
||||
epsil = FLT_EPSILON*4;
|
||||
epsil = FLT_EPSILON*4.0F;
|
||||
base = FLT_MIN;
|
||||
for (i=FLT_MIN_EXP; i<FLT_MAX_EXP; i+=FLT_MAX_EXP/10) {
|
||||
incr = ldexp (0.5,i);
|
||||
iter = FLT_MAX/fabs(incr);
|
||||
incr = (dbr_float_t) ldexp (0.5F,i);
|
||||
iter = (unsigned long) (FLT_MAX/fabs(incr));
|
||||
iter = min (iter,10);
|
||||
floatTest(chix1, base, incr, epsil, iter);
|
||||
}
|
||||
base = FLT_MAX;
|
||||
for (i=FLT_MIN_EXP; i<FLT_MAX_EXP; i+=FLT_MAX_EXP/10) {
|
||||
incr = - ldexp (0.5,i);
|
||||
iter = FLT_MAX/fabs(incr);
|
||||
incr = (dbr_float_t) - ldexp (0.5F,i);
|
||||
iter = (unsigned long) (FLT_MAX/fabs(incr));
|
||||
iter = min (iter,10);
|
||||
floatTest(chix1, base, incr, epsil, iter);
|
||||
}
|
||||
base = - FLT_MAX;
|
||||
for (i=FLT_MIN_EXP; i<FLT_MAX_EXP; i+=FLT_MAX_EXP/10) {
|
||||
incr = ldexp (0.5,i);
|
||||
iter = FLT_MAX/fabs(incr);
|
||||
incr = (dbr_float_t) ldexp (0.5F,i);
|
||||
iter = (unsigned long) (FLT_MAX/fabs(incr));
|
||||
iter = min (iter,10);
|
||||
floatTest(chix1, base, incr, epsil, iter);
|
||||
}
|
||||
@@ -341,21 +368,21 @@ int doacctst(char *pname)
|
||||
base = DBL_MIN;
|
||||
for (i=DBL_MIN_EXP; i<DBL_MAX_EXP; i+=DBL_MAX_EXP/10) {
|
||||
incr = ldexp (0.5,i);
|
||||
iter = DBL_MAX/fabs(incr);
|
||||
iter = (unsigned long) (DBL_MAX/fabs(incr));
|
||||
iter = min (iter,10);
|
||||
doubleTest(chix1, base, incr, epsil, iter);
|
||||
}
|
||||
base = DBL_MAX;
|
||||
for (i=DBL_MIN_EXP; i<DBL_MAX_EXP; i+=DBL_MAX_EXP/10) {
|
||||
incr = - ldexp (0.5,i);
|
||||
iter = DBL_MAX/fabs(incr);
|
||||
iter = (unsigned long) (DBL_MAX/fabs(incr));
|
||||
iter = min (iter,10);
|
||||
doubleTest(chix1, base, incr, epsil, iter);
|
||||
}
|
||||
base = - DBL_MAX;
|
||||
for (i=DBL_MIN_EXP; i<DBL_MAX_EXP; i+=DBL_MAX_EXP/10) {
|
||||
incr = ldexp (0.5,i);
|
||||
iter = DBL_MAX/fabs(incr);
|
||||
iter = (unsigned long) (DBL_MAX/fabs(incr));
|
||||
iter = min (iter,10);
|
||||
doubleTest(chix1, base, incr, epsil, iter);
|
||||
}
|
||||
@@ -366,8 +393,8 @@ int doacctst(char *pname)
|
||||
* ca_pend_io() must block
|
||||
*/
|
||||
if(ca_read_access(chix4)){
|
||||
dbr_float_t req = 3.3;
|
||||
dbr_float_t resp = 0.0;
|
||||
dbr_float_t req = 3.3F;
|
||||
dbr_float_t resp = 0.0F;
|
||||
|
||||
printf ("get TMO test ...");
|
||||
fflush(stdout);
|
||||
@@ -378,10 +405,10 @@ int doacctst(char *pname)
|
||||
assert (resp == req);
|
||||
}
|
||||
else {
|
||||
assert (resp == 0.0);
|
||||
assert (resp == 0.0F);
|
||||
}
|
||||
|
||||
resp = 0.0;
|
||||
resp = 0.0F;
|
||||
SEVCHK (ca_put(DBR_FLOAT, chix4, &req),NULL);
|
||||
SEVCHK (ca_get(DBR_FLOAT, chix4, &resp),NULL);
|
||||
SEVCHK (ca_pend_io(2000.0),NULL);
|
||||
@@ -657,7 +684,7 @@ int doacctst(char *pname)
|
||||
accuracy = 100.0*(delay-request)/request;
|
||||
printf("CA pend event delay accuracy = %f %%\n",
|
||||
accuracy);
|
||||
assert (abs(accuracy) < 10.0);
|
||||
assert (fabs(accuracy) < 10.0);
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
*
|
||||
* History
|
||||
* $Log$
|
||||
* Revision 1.1 1996/06/20 18:02:22 jhill
|
||||
* installed into CVS
|
||||
*
|
||||
* Revision 1.1.1.1 1996/06/20 00:28:15 jhill
|
||||
* ca server installation
|
||||
*
|
||||
@@ -62,6 +65,9 @@
|
||||
*
|
||||
* .10 050594 joh New command added for CA V4.3 - wakeup the server
|
||||
* $Log$
|
||||
* Revision 1.1 1996/06/20 18:02:22 jhill
|
||||
* installed into CVS
|
||||
*
|
||||
* Revision 1.1.1.1 1996/06/20 00:28:15 jhill
|
||||
* ca server installation
|
||||
*
|
||||
@@ -70,9 +76,24 @@
|
||||
|
||||
#define __CAPROTO__
|
||||
|
||||
/* TCP/UDP port number (bumped each protocol change) */
|
||||
#define CA_PROTOCOL_VERSION 4u
|
||||
#define CA_MINOR_VERSION 7u
|
||||
/*
|
||||
* CA protocol number
|
||||
* TCP/UDP port number (bumped each major protocol change)
|
||||
*/
|
||||
#define CA_PROTOCOL_VERSION_STR 4
|
||||
#define CA_MINOR_VERSION_STR 7
|
||||
|
||||
/*
|
||||
* add unsigned to the above numbers for numerical
|
||||
* comparisons (two defines above are used to create
|
||||
* version number string - prefer not to have u there)
|
||||
*/
|
||||
#ifndef CONCAT
|
||||
#define CONCAT(A,B) A ## B
|
||||
#endif
|
||||
#define UNSIGNED(N) CONCAT(N,u)
|
||||
#define CA_PROTOCOL_VERSION UNSIGNED(CA_PROTOCOL_VERSION_STR)
|
||||
#define CA_MINOR_VERSION UNSIGNED(CA_MINOR_VERSION_STR)
|
||||
#define CA_UKN_MINOR_VERSION 0u /* unknown minor version */
|
||||
#if CA_PROTOCOL_VERSION == 4u
|
||||
#define CA_V41(MAJOR,MINOR) ((MINOR)>=1u)
|
||||
@@ -228,5 +249,14 @@ struct monops { /* monitor req opi to ioc */
|
||||
*/
|
||||
#define unreasonablePVNameSize 500u
|
||||
|
||||
#ifndef STRINGOF
|
||||
#define STRINGOF(A) #A
|
||||
#endif
|
||||
#ifndef EXPANDTOSTRING
|
||||
#define EXPANDTOSTRING(A) STRINGOF(A)
|
||||
#endif
|
||||
#define CA_VERSION_STRING \
|
||||
(EXPANDTOSTRING(CA_PROTOCOL_VERSION_STR)"."EXPANDTOSTRING(CA_MINOR_VERSION_STR))
|
||||
|
||||
#endif /* __CAPROTO__ */
|
||||
|
||||
|
||||
@@ -258,6 +258,8 @@ struct exception_handler_args{
|
||||
long stat; /* Channel access std status code */
|
||||
long op; /* External codes for channel access operations */
|
||||
char *ctx; /* A character string containing context info */
|
||||
char *pFile; /* source file name (may be NULL) */
|
||||
unsigned lineNo; /* source file line number */
|
||||
};
|
||||
|
||||
|
||||
@@ -984,6 +986,11 @@ int epicsShareAPI ca_v42_ok(chid chan);
|
||||
int epicsShareAPI ca_v42_ok();
|
||||
#endif /*CAC_FUNC_PROTO*/
|
||||
|
||||
/*
|
||||
* function that returns the CA version string
|
||||
*/
|
||||
READONLY char * epicsShareAPI ca_version();
|
||||
|
||||
/*
|
||||
* ca_replace_printf_handler ()
|
||||
*
|
||||
|
||||
@@ -214,7 +214,7 @@ READONLY char *ca_message_text[]
|
||||
#endif
|
||||
|
||||
#ifdef __STDC__
|
||||
READONLY char *ca_message(long ca_status);
|
||||
READONLY char * epicsShareAPI ca_message(long ca_status);
|
||||
#else /* __STDC__ */
|
||||
READONLY char *ca_message();
|
||||
#endif
|
||||
|
||||
@@ -30,6 +30,9 @@
|
||||
/* (dont send all chans in a block) */
|
||||
/* */
|
||||
/* $Log$
|
||||
* Revision 1.35 1996/06/19 17:59:04 jhill
|
||||
* many 3.13 beta changes
|
||||
*
|
||||
* Revision 1.34 1995/08/22 00:19:21 jhill
|
||||
* use current time var to init time stamp in a beacon hash entry
|
||||
* */
|
||||
@@ -262,7 +265,7 @@ LOCAL void retrySearchRequest (int silent)
|
||||
if (status == ECA_NORMAL) {
|
||||
retry_cnt++;
|
||||
if (!(silent || chix->pConnFunc)) {
|
||||
ca_signal (
|
||||
genLocalExcep (
|
||||
ECA_CHIDNOTFND,
|
||||
(char *)(chix+1));
|
||||
retry_cnt_no_handler++;
|
||||
@@ -314,7 +317,7 @@ LOCAL void retrySearchRequest (int silent)
|
||||
sprintf_buf,
|
||||
"%d channels outstanding",
|
||||
retry_cnt);
|
||||
ca_signal (ECA_CHIDRETRY, sprintf_buf);
|
||||
genLocalExcep (ECA_CHIDRETRY, sprintf_buf);
|
||||
}
|
||||
}
|
||||
UNLOCK;
|
||||
|
||||
@@ -47,6 +47,9 @@
|
||||
/* address in use so that test works on UNIX */
|
||||
/* kernels that support multicast */
|
||||
/* $Log$
|
||||
* Revision 1.64 1996/08/13 23:15:36 jhill
|
||||
* fixed warning
|
||||
*
|
||||
* Revision 1.63 1996/07/09 22:41:28 jhill
|
||||
* silence gcc warning
|
||||
*
|
||||
@@ -425,7 +428,7 @@ int net_proto
|
||||
sizeof(saddr));
|
||||
if(status<0){
|
||||
ca_printf("CAC: bind (err=%s)\n",strerror(MYERRNO));
|
||||
ca_signal(ECA_INTERNAL,"bind failed");
|
||||
genLocalExcep (ECA_INTERNAL,"bind failed");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -451,7 +454,7 @@ int net_proto
|
||||
|
||||
default:
|
||||
free(piiu);
|
||||
ca_signal(ECA_INTERNAL,"alloc_ioc: ukn protocol\n");
|
||||
genLocalExcep (ECA_INTERNAL,"alloc_ioc: ukn protocol");
|
||||
/*
|
||||
* turn off gcc warnings
|
||||
*/
|
||||
@@ -541,7 +544,7 @@ void caSetupBCastAddrList (ELLLIST *pList, SOCKET sock, unsigned port)
|
||||
port);
|
||||
|
||||
if (ellCount(pList)==0) {
|
||||
ca_signal (ECA_NOSEARCHADDR, NULL);
|
||||
genLocalExcep (ECA_NOSEARCHADDR, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1206,6 +1209,7 @@ LOCAL void close_ioc (IIU *piiu)
|
||||
caAddrNode *pNode;
|
||||
chid chix;
|
||||
int status;
|
||||
unsigned chanDisconnectCount;
|
||||
|
||||
/*
|
||||
* dont close twice
|
||||
@@ -1224,10 +1228,13 @@ LOCAL void close_ioc (IIU *piiu)
|
||||
|
||||
if (piiu == piiuCast) {
|
||||
piiuCast = NULL;
|
||||
chanDisconnectCount = 0u;
|
||||
}
|
||||
else {
|
||||
chid pNext;
|
||||
|
||||
chanDisconnectCount = ellCount(&piiu->chidlist);
|
||||
|
||||
/*
|
||||
* remove IOC from the hash table
|
||||
*/
|
||||
@@ -1277,7 +1284,9 @@ LOCAL void close_ioc (IIU *piiu)
|
||||
|
||||
ellFree (&piiu->destAddr);
|
||||
|
||||
ca_signal (ECA_DISCONN,piiu->host_name_str);
|
||||
if (chanDisconnectCount) {
|
||||
genLocalExcep (ECA_DISCONN, piiu->host_name_str);
|
||||
}
|
||||
|
||||
free (piiu);
|
||||
|
||||
|
||||
@@ -32,6 +32,9 @@
|
||||
/************************************************************************/
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.56 1996/08/13 23:16:19 jhill
|
||||
* removed os specific code
|
||||
*
|
||||
* Revision 1.55 1996/08/05 19:21:26 jhill
|
||||
* removed unused proto
|
||||
*
|
||||
@@ -633,6 +636,10 @@ void clearChannelResources(unsigned id);
|
||||
void caSetDefaultPrintfHandler (void);
|
||||
void cacDisconnectChannel(chid chix, enum channel_state state);
|
||||
int caSendMsgPending(void);
|
||||
void generateLocalExceptionWithFileAndLine(long stat, char *ctx,
|
||||
char *pFile, unsigned line);
|
||||
#define genLocalExcep(STAT, PCTX) \
|
||||
generateLocalExceptionWithFileAndLine (STAT, PCTX, __FILE__, __LINE__)
|
||||
|
||||
/*
|
||||
* !!KLUDGE!!
|
||||
|
||||
@@ -579,6 +579,8 @@ const struct in_addr *pnet_addr
|
||||
*/
|
||||
monix = NULL;
|
||||
args.addr = NULL;
|
||||
args.pFile = NULL;
|
||||
args.lineNo = 0u;
|
||||
LOCK;
|
||||
switch (ntohs(req->m_cmmd)) {
|
||||
case CA_PROTO_READ_NOTIFY:
|
||||
@@ -813,7 +815,7 @@ const struct in_addr *pnet_addr
|
||||
(char *)(chan + 1),
|
||||
chpiiu->host_name_str,
|
||||
rej);
|
||||
ca_signal(ECA_DBLCHNL, sprintf_buf);
|
||||
genLocalExcep (ECA_DBLCHNL, sprintf_buf);
|
||||
}
|
||||
UNLOCK;
|
||||
return;
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* $Log$
|
||||
* Revision 1.25 1996/08/13 23:16:23 jhill
|
||||
* removed os specific code
|
||||
*
|
||||
* Revision 1.23 1996/08/05 19:18:56 jhill
|
||||
* better msg for lack of fp
|
||||
*
|
||||
@@ -739,7 +742,7 @@ LOCAL void ca_check_for_fp()
|
||||
|
||||
assert(taskOptionsGet(taskIdSelf(), &options) == OK);
|
||||
if (!(options & VX_FP_TASK)) {
|
||||
ca_signal(ECA_NEEDSFP, taskName(taskIdSelf()));
|
||||
genLocalExcep (ECA_NEEDSFP, taskName(taskIdSelf()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,11 +32,17 @@
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* $Log$
|
||||
* Revision 1.21 1996/08/05 19:20:29 jhill
|
||||
* removed incorrect ver number
|
||||
*
|
||||
* Revision 1.20 1995/12/19 19:36:20 jhill
|
||||
* function prototype changes
|
||||
*
|
||||
* Revision 1.19 1995/11/29 19:15:42 jhill
|
||||
* added $Log$
|
||||
* added Revision 1.21 1996/08/05 19:20:29 jhill
|
||||
* added removed incorrect ver number
|
||||
* added
|
||||
* Revision 1.20 1995/12/19 19:36:20 jhill
|
||||
* function prototype changes
|
||||
* to the header
|
||||
@@ -49,6 +55,7 @@
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
#include <mmsystem.h>
|
||||
#include <epicsVersion.h>
|
||||
|
||||
#include "iocinf.h"
|
||||
|
||||
@@ -469,7 +476,7 @@ BOOL epicsShareAPI DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
|
||||
|
||||
#if _DEBUG /* for gui applications, setup console for error messages */
|
||||
if (AllocConsole()) {
|
||||
SetConsoleTitle("Channel Access Status");
|
||||
SetConsoleTitle(EPICS_VERSION_STRING);
|
||||
freopen( "CONOUT$", "a", stderr );
|
||||
}
|
||||
fprintf(stderr, "Process attached to ca.dll\n");
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
|
||||
CAS = ../../..
|
||||
#HERE := $(shell pwd)
|
||||
HERE = .
|
||||
CAS = $(HERE)/../../..
|
||||
TOP = $(CAS)/../..
|
||||
SRC = $(CAS)/generic
|
||||
CA = $(CAS)/../ca
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
|
||||
CAS = ../../..
|
||||
#HERE := $(shell pwd)
|
||||
HERE = .
|
||||
CAS := $(HERE)/../../..
|
||||
TOP = $(CAS)/../..
|
||||
SRC = $(CAS)/generic
|
||||
CA = $(CAS)/../ca
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
CAS = ../../
|
||||
CAS = ../..
|
||||
TOP = $(CAS)/../..
|
||||
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
@@ -1,11 +1,25 @@
|
||||
//
|
||||
// $Id$
|
||||
// Author: Jeff HIll (LANL)
|
||||
//
|
||||
// $Log$
|
||||
//
|
||||
|
||||
#include <exServer.h>
|
||||
#include <taskLib.h>
|
||||
|
||||
//
|
||||
// main()
|
||||
// so we can call this from the vxWorks shell
|
||||
//
|
||||
int excas (unsigned debugLevel=0u, unsigned delaySec=0)
|
||||
extern "C" {
|
||||
|
||||
exServer *pExampleCAS;
|
||||
|
||||
//
|
||||
// excas ()
|
||||
// (vxWorks example server entry point)
|
||||
//
|
||||
int excas (unsigned debugLevel, unsigned delaySec)
|
||||
{
|
||||
osiTime begin(osiTime::getCurrent());
|
||||
exServer *pCAS;
|
||||
@@ -16,12 +30,13 @@ int excas (unsigned debugLevel=0u, unsigned delaySec=0)
|
||||
}
|
||||
|
||||
pCAS->setDebugLevel(debugLevel);
|
||||
pExampleCAS = pCAS;
|
||||
|
||||
if (delaySec==0u) {
|
||||
//
|
||||
// loop here forever
|
||||
//
|
||||
while (aitTrue) {
|
||||
while (1) {
|
||||
taskDelay(10);
|
||||
}
|
||||
}
|
||||
@@ -37,7 +52,19 @@ int excas (unsigned debugLevel=0u, unsigned delaySec=0)
|
||||
delay = osiTime::getCurrent() - begin;
|
||||
}
|
||||
}
|
||||
pCAS->show(debugLevel);
|
||||
pExampleCAS = NULL;
|
||||
delete pCAS;
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int excasShow(unsigned level)
|
||||
{
|
||||
if (pExampleCAS!=NULL) {
|
||||
pExampleCAS->show(level);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
*
|
||||
* History
|
||||
* $Log$
|
||||
* Revision 1.2 1996/06/21 02:30:52 jhill
|
||||
* solaris port
|
||||
*
|
||||
* Revision 1.1.1.1 1996/06/20 00:28:14 jhill
|
||||
* ca server installation
|
||||
*
|
||||
@@ -115,6 +118,9 @@ void caServer::show(unsigned level)
|
||||
if (this->pCAS) {
|
||||
this->pCAS->show(level);
|
||||
}
|
||||
else {
|
||||
printf("caServer:: no server internals attached\n");
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
*
|
||||
* History
|
||||
* $Log$
|
||||
* Revision 1.4 1996/09/04 20:12:04 jhill
|
||||
* added arg to serverToolDebugFunc()
|
||||
*
|
||||
* Revision 1.3 1996/08/13 22:56:12 jhill
|
||||
* added init for mutex class
|
||||
*
|
||||
@@ -61,13 +64,15 @@ void caServerI::show (unsigned level)
|
||||
printf( "Channel Access Server Status V%d.%d\n",
|
||||
CA_PROTOCOL_VERSION, CA_MINOR_VERSION);
|
||||
|
||||
this->lock();
|
||||
this->osiMutex::show(level);
|
||||
|
||||
this->osiLock();
|
||||
while ( (pClient = iter()) ) {
|
||||
pClient->show(level);
|
||||
}
|
||||
|
||||
this->dgClient.show(level);
|
||||
this->unlock();
|
||||
this->osiUnlock();
|
||||
|
||||
bytes_reserved = 0u;
|
||||
#if 0
|
||||
@@ -94,14 +99,14 @@ void caServerI::show (unsigned level)
|
||||
#endif
|
||||
printf(
|
||||
"The server's integer resource id conversion table:\n");
|
||||
this->lock();
|
||||
this->osiLock();
|
||||
this->uintResTable<casRes>::show(level);
|
||||
this->unlock();
|
||||
this->osiUnlock();
|
||||
printf(
|
||||
"The server's character string resource id conversion table:\n");
|
||||
this->lock();
|
||||
this->osiLock();
|
||||
this->stringResTbl.show(level);
|
||||
this->unlock();
|
||||
this->osiUnlock();
|
||||
}
|
||||
|
||||
// @@@@@@ caPrintAddrList(&destAddr);
|
||||
@@ -193,7 +198,7 @@ caServerI::~caServerI()
|
||||
{
|
||||
casClient *pClient;
|
||||
|
||||
this->lock();
|
||||
this->osiLock();
|
||||
|
||||
//
|
||||
// delete all clients
|
||||
@@ -202,6 +207,8 @@ caServerI::~caServerI()
|
||||
delete pClient;
|
||||
}
|
||||
|
||||
this->osiUnlock();
|
||||
|
||||
//
|
||||
// verify that we didnt leak a PV
|
||||
//
|
||||
@@ -214,9 +221,9 @@ caServerI::~caServerI()
|
||||
//
|
||||
void caServerI::installClient(casStrmClient *pClient)
|
||||
{
|
||||
this->lock();
|
||||
this->osiLock();
|
||||
this->clientList.add(*pClient);
|
||||
this->unlock();
|
||||
this->osiUnlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -225,9 +232,9 @@ void caServerI::installClient(casStrmClient *pClient)
|
||||
//
|
||||
void caServerI::removeClient(casStrmClient *pClient)
|
||||
{
|
||||
this->lock();
|
||||
this->osiLock();
|
||||
this->clientList.remove(*pClient);
|
||||
this->unlock();
|
||||
this->osiUnlock();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
*
|
||||
* History
|
||||
* $Log$
|
||||
* Revision 1.1.1.1 1996/06/20 00:28:16 jhill
|
||||
* ca server installation
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -110,10 +113,10 @@ inline void caServerI::installPV (casPVI &pv)
|
||||
{
|
||||
int resLibStatus;
|
||||
|
||||
this->lock ();
|
||||
this->osiLock ();
|
||||
this->pvCount++;
|
||||
resLibStatus = this->stringResTbl.add (pv);
|
||||
this->unlock ();
|
||||
this->osiUnlock ();
|
||||
assert (resLibStatus==0);
|
||||
}
|
||||
|
||||
@@ -124,11 +127,11 @@ inline void caServerI::removePV(casPVI &pv)
|
||||
{
|
||||
casPVI *pPV;
|
||||
|
||||
this->lock();
|
||||
this->osiLock();
|
||||
casVerify (this->pvCount>=1u);
|
||||
this->pvCount--;
|
||||
pPV = this->stringResTbl.remove (pv);
|
||||
this->unlock();
|
||||
this->osiUnlock();
|
||||
casVerify (pPV!=0);
|
||||
casVerify (pPV==&pv);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
*
|
||||
* History
|
||||
* $Log$
|
||||
* Revision 1.2 1996/09/04 20:16:24 jhill
|
||||
* moved operator -> here
|
||||
*
|
||||
* Revision 1.1.1.1 1996/06/20 00:28:16 jhill
|
||||
* ca server installation
|
||||
*
|
||||
@@ -44,7 +47,7 @@
|
||||
//
|
||||
inline void casAsyncIOI::lock()
|
||||
{
|
||||
client.lock();
|
||||
client.osiLock();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -52,7 +55,7 @@ inline void casAsyncIOI::lock()
|
||||
//
|
||||
inline void casAsyncIOI::unlock()
|
||||
{
|
||||
client.unlock();
|
||||
client.osiUnlock();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
*
|
||||
* History
|
||||
* $Log$
|
||||
* Revision 1.3 1996/09/04 20:18:27 jhill
|
||||
* moved operator -> here
|
||||
*
|
||||
* Revision 1.2 1996/07/01 19:56:10 jhill
|
||||
* one last update prior to first release
|
||||
*
|
||||
@@ -55,7 +58,7 @@ inline casChannel * casChannelI::operator -> ()
|
||||
//
|
||||
inline void casChannelI::lock()
|
||||
{
|
||||
this->client.lock();
|
||||
this->client.osiLock();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -63,7 +66,7 @@ inline void casChannelI::lock()
|
||||
//
|
||||
inline void casChannelI::unlock()
|
||||
{
|
||||
this->client.unlock();
|
||||
this->client.osiUnlock();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
*
|
||||
* History
|
||||
* $Log$
|
||||
* Revision 1.2 1996/08/13 22:53:14 jhill
|
||||
* changes for MVC++
|
||||
*
|
||||
* Revision 1.1.1.1 1996/06/20 00:28:16 jhill
|
||||
* ca server installation
|
||||
*
|
||||
@@ -107,6 +110,8 @@ casCoreClient::~casCoreClient()
|
||||
ca_printf ("CAS: Connection Terminated\n");
|
||||
}
|
||||
|
||||
this->osiLock();
|
||||
|
||||
//
|
||||
// cancel any pending asynchronous IO
|
||||
//
|
||||
@@ -120,6 +125,8 @@ casCoreClient::~casCoreClient()
|
||||
delete pCurIO;
|
||||
pCurIO = pNextIO;
|
||||
}
|
||||
|
||||
this->osiUnlock();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
*
|
||||
* History
|
||||
* $Log$
|
||||
* Revision 1.5 1996/09/04 20:19:47 jhill
|
||||
* added missing byte swap on search reply port no
|
||||
*
|
||||
* Revision 1.4 1996/08/13 22:54:20 jhill
|
||||
* fixed little endian problem
|
||||
*
|
||||
@@ -311,7 +314,8 @@ void casDGClient::process()
|
||||
// force all replies to be sent to the client
|
||||
// that made the request
|
||||
//
|
||||
this->clear();
|
||||
this->inBuf::clear();
|
||||
this->outBuf::clear();
|
||||
|
||||
//
|
||||
// read in new input
|
||||
@@ -319,12 +323,11 @@ void casDGClient::process()
|
||||
fillCond = this->fill();
|
||||
if (fillCond == casFillDisconnect) {
|
||||
casVerify(0);
|
||||
return;
|
||||
}
|
||||
//
|
||||
// verify that we have a message to process
|
||||
//
|
||||
if (this->inBuf::bytesPresent()>0u) {
|
||||
else if (this->inBuf::bytesPresent()>0u) {
|
||||
//
|
||||
// process the message
|
||||
//
|
||||
@@ -332,22 +335,20 @@ void casDGClient::process()
|
||||
if (status) {
|
||||
errMessage (status,
|
||||
"unexpected error processing stateless protocol");
|
||||
//
|
||||
// clear the input buffer so this will
|
||||
// not effect future input
|
||||
//
|
||||
this->clear();
|
||||
}
|
||||
else {
|
||||
//
|
||||
// force all replies to go to the sender
|
||||
//
|
||||
flushCond = this->flush();
|
||||
if (flushCond!=casFlushCompleted) {
|
||||
this->clear();
|
||||
casVerify(0);
|
||||
}
|
||||
}
|
||||
//
|
||||
// force all replies to go to the sender
|
||||
//
|
||||
flushCond = this->flush();
|
||||
if (flushCond!=casFlushCompleted) {
|
||||
casVerify(0);
|
||||
}
|
||||
}
|
||||
//
|
||||
// clear the input/output buffers so replies
|
||||
// are always sent to the sender of the request
|
||||
//
|
||||
this->inBuf::clear();
|
||||
this->outBuf::clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
*
|
||||
* History
|
||||
* $Log$
|
||||
* Revision 1.2 1996/07/24 22:00:49 jhill
|
||||
* added pushOnToEventQueue()
|
||||
*
|
||||
* Revision 1.1.1.1 1996/06/20 00:28:15 jhill
|
||||
* ca server installation
|
||||
*
|
||||
@@ -79,16 +82,18 @@ casEventSys::~casEventSys()
|
||||
{
|
||||
casEvent *pE;
|
||||
|
||||
this->mutex.lock();
|
||||
|
||||
/*
|
||||
* They must cancel all active event blocks first
|
||||
* all active event blocks must be canceled first
|
||||
*/
|
||||
assert (this->numEventBlocks==0);
|
||||
|
||||
this->mutex.osiLock();
|
||||
|
||||
while ( (pE = this->eventLogQue.get()) ) {
|
||||
delete pE;
|
||||
}
|
||||
|
||||
this->mutex.osiUnlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -97,10 +102,10 @@ casEventSys::~casEventSys()
|
||||
//
|
||||
void casEventSys::installMonitor()
|
||||
{
|
||||
this->mutex.lock();
|
||||
this->mutex.osiLock();
|
||||
this->numEventBlocks++;
|
||||
this->maxLogEntries += averageEventEntries;
|
||||
this->mutex.unlock();
|
||||
this->mutex.osiUnlock();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -108,11 +113,11 @@ void casEventSys::installMonitor()
|
||||
//
|
||||
void casEventSys::removeMonitor()
|
||||
{
|
||||
this->mutex.lock();
|
||||
this->mutex.osiLock();
|
||||
assert (this->numEventBlocks>=1u);
|
||||
this->numEventBlocks--;
|
||||
this->maxLogEntries -= averageEventEntries;
|
||||
this->mutex.unlock();
|
||||
this->mutex.osiUnlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +131,7 @@ casProcCond casEventSys::process()
|
||||
casProcCond cond = casProcOk;
|
||||
unsigned long nAccepted = 0u;
|
||||
|
||||
this->mutex.lock();
|
||||
this->mutex.osiLock();
|
||||
|
||||
while ( (pEvent = this->eventLogQue.get()) ) {
|
||||
|
||||
@@ -166,7 +171,7 @@ casProcCond casEventSys::process()
|
||||
this->coreClient.eventFlush();
|
||||
}
|
||||
|
||||
this->mutex.unlock();
|
||||
this->mutex.osiUnlock();
|
||||
|
||||
return cond;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
*
|
||||
* History
|
||||
* $Log$
|
||||
* Revision 1.1.1.1 1996/06/20 00:28:16 jhill
|
||||
* ca server installation
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -41,9 +44,9 @@
|
||||
//
|
||||
inline void casEventSys::addToEventQueue(casEvent &event)
|
||||
{
|
||||
this->mutex.lock();
|
||||
this->mutex.osiLock();
|
||||
this->eventLogQue.add(event);
|
||||
this->mutex.unlock();
|
||||
this->mutex.osiUnlock();
|
||||
//
|
||||
// wakes up the event queue consumer
|
||||
//
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
*
|
||||
* History
|
||||
* $Log$
|
||||
* Revision 1.6 1996/09/04 20:21:41 jhill
|
||||
* removed operator -> and added member pv
|
||||
*
|
||||
* Revision 1.5 1996/07/01 19:56:11 jhill
|
||||
* one last update prior to first release
|
||||
*
|
||||
@@ -560,13 +563,14 @@ public:
|
||||
|
||||
inline aitBool okToBeginNewIO() const;
|
||||
|
||||
inline void lock();
|
||||
inline void unlock();
|
||||
private:
|
||||
tsDLList<casPVListChan> chanList;
|
||||
caServerI &cas;
|
||||
casPV &pv;
|
||||
unsigned nMonAttached;
|
||||
unsigned nIOAttached;
|
||||
|
||||
inline void lock();
|
||||
inline void unlock();
|
||||
};
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
*
|
||||
* History
|
||||
* $Log$
|
||||
* Revision 1.4 1996/07/24 22:00:49 jhill
|
||||
* added pushOnToEventQueue()
|
||||
*
|
||||
* Revision 1.3 1996/07/01 19:56:11 jhill
|
||||
* one last update prior to first release
|
||||
*
|
||||
@@ -82,7 +85,7 @@ casMonitor::~casMonitor()
|
||||
{
|
||||
casCoreClient &client = this->ciu.getClient();
|
||||
|
||||
this->mutex.lock();
|
||||
this->mutex.osiLock();
|
||||
|
||||
this->disable();
|
||||
|
||||
@@ -97,6 +100,8 @@ casMonitor::~casMonitor()
|
||||
this->pModifiedValue = NULL;
|
||||
}
|
||||
this->ciu.deleteMonitor(*this);
|
||||
|
||||
this->mutex.osiUnlock();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -106,24 +111,16 @@ void casMonitor::enable()
|
||||
{
|
||||
caStatus status;
|
||||
|
||||
this->mutex.lock();
|
||||
if (this->enabled) {
|
||||
this->mutex.unlock();
|
||||
return;
|
||||
this->mutex.osiLock();
|
||||
if (!this->enabled && this->ciu->readAccess()) {
|
||||
this->enabled = TRUE;
|
||||
status = this->ciu.getPVI().registerEvent();
|
||||
if (status) {
|
||||
errMessage(status,
|
||||
"Server tool failed to register event\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (!this->ciu->readAccess()) {
|
||||
this->mutex.unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
this->enabled = TRUE;
|
||||
status = this->ciu.getPVI().registerEvent();
|
||||
if (status) {
|
||||
errMessage(status,
|
||||
"Server tool failed to register event\n");
|
||||
}
|
||||
this->mutex.unlock();
|
||||
this->mutex.osiUnlock();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -131,14 +128,12 @@ void casMonitor::enable()
|
||||
//
|
||||
void casMonitor::disable()
|
||||
{
|
||||
this->mutex.lock();
|
||||
if (!this->enabled) {
|
||||
this->mutex.unlock();
|
||||
return;
|
||||
this->mutex.osiLock();
|
||||
if (this->enabled) {
|
||||
this->enabled = FALSE;
|
||||
this->ciu.getPVI().unregisterEvent();
|
||||
}
|
||||
this->enabled = FALSE;
|
||||
this->ciu.getPVI().unregisterEvent();
|
||||
this->mutex.unlock();
|
||||
this->mutex.osiUnlock();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -150,7 +145,7 @@ void casMonitor::push(gdd &newValue)
|
||||
casMonEvent *pLog = NULL;
|
||||
char full;
|
||||
|
||||
this->mutex.lock();
|
||||
this->mutex.osiLock();
|
||||
|
||||
//
|
||||
// get a new block if we havent exceeded quotas
|
||||
@@ -205,7 +200,7 @@ void casMonitor::push(gdd &newValue)
|
||||
|
||||
client.addToEventQueue(*pLog);
|
||||
|
||||
this->mutex.unlock();
|
||||
this->mutex.osiUnlock();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -219,7 +214,7 @@ caStatus casMonitor::executeEvent(casMonEvent *pEV)
|
||||
pVal = pEV->getValue ();
|
||||
assert (pVal);
|
||||
|
||||
this->mutex.lock();
|
||||
this->mutex.osiLock();
|
||||
if (this->ciu.getClient().getEventsOff()==aitFalse) {
|
||||
status = this->callBack (*pVal);
|
||||
}
|
||||
@@ -236,7 +231,7 @@ caStatus casMonitor::executeEvent(casMonEvent *pEV)
|
||||
this->pModifiedValue = pVal;
|
||||
status = S_cas_success;
|
||||
}
|
||||
this->mutex.unlock();
|
||||
this->mutex.osiUnlock();
|
||||
|
||||
//
|
||||
// if the event isnt accepted we will try
|
||||
@@ -285,12 +280,12 @@ void casMonitor::show(unsigned level)
|
||||
//
|
||||
void casMonitor::postIfModified()
|
||||
{
|
||||
this->mutex.lock();
|
||||
this->mutex.osiLock();
|
||||
if (this->pModifiedValue) {
|
||||
this->callBack (*this->pModifiedValue);
|
||||
this->pModifiedValue->unreference ();
|
||||
this->pModifiedValue = NULL;
|
||||
}
|
||||
this->mutex.unlock();
|
||||
this->mutex.osiUnlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
*
|
||||
* History
|
||||
* $Log$
|
||||
* Revision 1.1.1.1 1996/06/20 00:28:15 jhill
|
||||
* ca server installation
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -39,8 +42,9 @@
|
||||
|
||||
casMsgIO::casMsgIO()
|
||||
{
|
||||
elapsedAtLastSend = this->elapsedAtLastRecv
|
||||
this->elapsedAtLastSend = this->elapsedAtLastRecv
|
||||
= osiTime::getCurrent ();
|
||||
this->blockingStatus = xIsBlocking;
|
||||
}
|
||||
|
||||
casMsgIO::~casMsgIO()
|
||||
@@ -81,15 +85,41 @@ xRecvStatus casMsgIO::xRecv(char *pBuf, bufSizeT nBytes, bufSizeT &nActualBytes)
|
||||
return stat;
|
||||
}
|
||||
|
||||
xSendStatus casMsgIO::xSend(char *pBuf, bufSizeT nBytes, bufSizeT &nActualBytes)
|
||||
xSendStatus casMsgIO::xSend(char *pBuf, bufSizeT nBytesAvailableToSend,
|
||||
bufSizeT nBytesNeedToBeSent, bufSizeT &nActualBytes)
|
||||
{
|
||||
xSendStatus stat;
|
||||
bufSizeT nActualBytesDelta;
|
||||
|
||||
stat = this->osdSend(pBuf, nBytes, nActualBytes);
|
||||
if (stat == xSendOK) {
|
||||
this->elapsedAtLastSend = osiTime::getCurrent();
|
||||
assert (nBytesAvailableToSend>=nBytesNeedToBeSent);
|
||||
|
||||
nActualBytes = 0u;
|
||||
if (this->blockingStatus == xIsntBlocking) {
|
||||
stat = this->osdSend(pBuf, nBytesAvailableToSend,
|
||||
nActualBytes);
|
||||
if (stat == xSendOK) {
|
||||
this->elapsedAtLastSend = osiTime::getCurrent();
|
||||
}
|
||||
return stat;
|
||||
}
|
||||
return stat;
|
||||
|
||||
while (nBytesNeedToBeSent) {
|
||||
stat = this->osdSend(pBuf, nBytesAvailableToSend,
|
||||
nActualBytesDelta);
|
||||
if (stat != xSendOK) {
|
||||
return stat;
|
||||
}
|
||||
|
||||
this->elapsedAtLastSend = osiTime::getCurrent();
|
||||
nActualBytes += nActualBytesDelta;
|
||||
if (nBytesNeedToBeSent>nActualBytesDelta) {
|
||||
nBytesNeedToBeSent -= nActualBytesDelta;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return xSendOK;
|
||||
}
|
||||
|
||||
void casMsgIO::sendBeacon(char & /*msg*/, bufSizeT /*length*/,
|
||||
@@ -103,9 +133,9 @@ int casMsgIO::getFileDescriptor() const
|
||||
return -1; // some os will not have file descriptors
|
||||
}
|
||||
|
||||
void casMsgIO::setNonBlocking()
|
||||
void casMsgIO::xSetNonBlocking()
|
||||
{
|
||||
printf("virtual base setNonBlocking() called?\n");
|
||||
printf("virtual base casMsgIO::xSetNonBlocking() called?\n");
|
||||
}
|
||||
|
||||
bufSizeT casMsgIO::incommingBytesPresent() const
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
*
|
||||
* History
|
||||
* $Log$
|
||||
* Revision 1.5 1996/09/04 20:23:59 jhill
|
||||
* added operator ->
|
||||
*
|
||||
* Revision 1.4 1996/07/01 19:56:13 jhill
|
||||
* one last update prior to first release
|
||||
*
|
||||
@@ -75,7 +78,13 @@ casPV * casPVI::operator -> () const
|
||||
//
|
||||
inline void casPVI::lock()
|
||||
{
|
||||
this->cas.lock();
|
||||
//
|
||||
// NOTE:
|
||||
// if this lock becomes something else besides the
|
||||
// server's lock then look carefully at the
|
||||
// comment in casPVI::deleteSignal()
|
||||
//
|
||||
this->cas.osiLock();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -83,7 +92,7 @@ inline void casPVI::lock()
|
||||
//
|
||||
inline void casPVI::unlock()
|
||||
{
|
||||
this->cas.unlock();
|
||||
this->cas.osiUnlock();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -148,13 +157,29 @@ inline void casPVI::unregisterIO()
|
||||
//
|
||||
inline void casPVI::deleteSignal()
|
||||
{
|
||||
this->lock();
|
||||
caServerI &localCASRef(this->cas);
|
||||
|
||||
//
|
||||
// We dont take the PV lock here because
|
||||
// the PV may be destroyed and we must
|
||||
// keep the lock unlock pairs consistent
|
||||
// (because the PV's lock is really a ref
|
||||
// to the server's lock)
|
||||
//
|
||||
// This is safe to do because we take the PV
|
||||
// lock when we add a new channel (and the
|
||||
// PV lock is realy the server's lock)
|
||||
//
|
||||
localCASRef.osiLock();
|
||||
|
||||
if (this->chanList.count()==0u) {
|
||||
(*this)->destroy();
|
||||
//
|
||||
// !! dont access self after destroy !!
|
||||
//
|
||||
}
|
||||
else {
|
||||
this->unlock();
|
||||
}
|
||||
|
||||
localCASRef.osiUnlock();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -29,6 +29,10 @@
|
||||
*
|
||||
* History
|
||||
* $Log$
|
||||
* Revision 1.9 1996/09/04 20:25:53 jhill
|
||||
* use correct app type for exist test gdd, correct byte
|
||||
* oder for mon mask, and efficient use of PV name gdd
|
||||
*
|
||||
* Revision 1.8 1996/08/05 23:22:57 jhill
|
||||
* gddScaler => gddScalar
|
||||
*
|
||||
@@ -214,7 +218,7 @@ casStrmClient::~casStrmClient()
|
||||
delete [] this->pHostName;
|
||||
}
|
||||
|
||||
this->lock();
|
||||
this->osiLock();
|
||||
|
||||
//
|
||||
// delete all channel attached
|
||||
@@ -228,6 +232,10 @@ casStrmClient::~casStrmClient()
|
||||
pChan->clientDestroy();
|
||||
pChan = pNextChan;
|
||||
}
|
||||
|
||||
delete &this->msgIO;
|
||||
|
||||
this->osiUnlock();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -812,7 +820,7 @@ caStatus casStrmClient::hostNameAction()
|
||||
size-1);
|
||||
pMalloc[size-1]='\0';
|
||||
|
||||
this->lock();
|
||||
this->osiLock();
|
||||
|
||||
if (this->pHostName) {
|
||||
delete [] this->pHostName;
|
||||
@@ -823,7 +831,7 @@ caStatus casStrmClient::hostNameAction()
|
||||
(*pciu)->setOwner(this->pUserName, this->pHostName);
|
||||
}
|
||||
|
||||
this->unlock();
|
||||
this->osiUnlock();
|
||||
|
||||
return S_cas_success;
|
||||
}
|
||||
@@ -857,7 +865,7 @@ caStatus casStrmClient::clientNameAction()
|
||||
size-1);
|
||||
pMalloc[size-1]='\0';
|
||||
|
||||
this->lock();
|
||||
this->osiLock();
|
||||
if (this->pUserName) {
|
||||
delete [] this->pUserName;
|
||||
}
|
||||
@@ -866,7 +874,7 @@ caStatus casStrmClient::clientNameAction()
|
||||
while ( (pciu = iter()) ) {
|
||||
(*pciu)->setOwner(this->pUserName, this->pHostName);
|
||||
}
|
||||
this->unlock();
|
||||
this->osiUnlock();
|
||||
|
||||
return S_cas_success;
|
||||
}
|
||||
@@ -1015,11 +1023,11 @@ caStatus casStrmClient::eventsOnAction ()
|
||||
// perhaps this is to slow - perhaps there
|
||||
// should be a queue of modified events
|
||||
//
|
||||
this->lock();
|
||||
this->osiLock();
|
||||
while ( (pciu = iter()) ) {
|
||||
pciu->postAllModifiedEvents();
|
||||
}
|
||||
this->unlock();
|
||||
this->osiUnlock();
|
||||
|
||||
return S_cas_success;
|
||||
}
|
||||
@@ -1639,13 +1647,13 @@ caStatus casStrmClient::createChanResponse(casChannelI *,
|
||||
// prevent problems such as the PV being deleted before the
|
||||
// channel references it
|
||||
//
|
||||
this->lock();
|
||||
this->osiLock();
|
||||
|
||||
pCanonicalName->markConstant();
|
||||
|
||||
pPV = this->ctx.getServer()->createPV(*pCanonicalName);
|
||||
if (!pPV) {
|
||||
this->unlock();
|
||||
this->osiUnlock();
|
||||
return this->channelCreateFailed(&msg, S_cas_noMemory);
|
||||
}
|
||||
|
||||
@@ -1656,12 +1664,12 @@ caStatus casStrmClient::createChanResponse(casChannelI *,
|
||||
pChan = (*pPV)->createChannel(this->ctx,
|
||||
this->pUserName, this->pHostName);
|
||||
if (!pChan) {
|
||||
this->unlock();
|
||||
this->osiUnlock();
|
||||
pPV->deleteSignal();
|
||||
return this->channelCreateFailed(&msg, S_cas_noMemory);
|
||||
}
|
||||
|
||||
this->unlock();
|
||||
this->osiUnlock();
|
||||
|
||||
pChanI = (casChannelI *) pChan;
|
||||
|
||||
@@ -1711,7 +1719,7 @@ casPVI *caServerI::createPV (gdd &name)
|
||||
name.getRef(pNameStr);
|
||||
stringId id (pNameStr->string());
|
||||
|
||||
this->lock ();
|
||||
this->osiLock ();
|
||||
|
||||
pPVI = this->stringResTbl.lookup (id);
|
||||
if (!pPVI) {
|
||||
@@ -1726,7 +1734,7 @@ casPVI *caServerI::createPV (gdd &name)
|
||||
// lock shouldnt be released until we finish creating and
|
||||
// installing the PV
|
||||
//
|
||||
this->unlock ();
|
||||
this->osiUnlock ();
|
||||
|
||||
return pPVI;
|
||||
}
|
||||
@@ -1744,10 +1752,10 @@ inline aitBool caServerI::roomForNewChannel() const
|
||||
//
|
||||
void casStrmClient::installChannel(casChannelI &chan)
|
||||
{
|
||||
this->lock();
|
||||
this->osiLock();
|
||||
this->getCAS().installItem(chan);
|
||||
this->chanList.add(chan);
|
||||
this->unlock();
|
||||
this->osiUnlock();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1757,10 +1765,10 @@ void casStrmClient::removeChannel(casChannelI &chan)
|
||||
{
|
||||
casRes *pRes;
|
||||
|
||||
this->lock();
|
||||
this->osiLock();
|
||||
pRes = this->getCAS().removeItem(chan);
|
||||
assert (&chan == (casChannelI *)pRes);
|
||||
this->chanList.remove(chan);
|
||||
this->unlock();
|
||||
this->osiUnlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
*
|
||||
* History
|
||||
* $Log$
|
||||
* Revision 1.3 1996/09/04 20:27:01 jhill
|
||||
* doccasdef.h
|
||||
*
|
||||
* Revision 1.2 1996/08/13 22:53:59 jhill
|
||||
* fixed little endian problem
|
||||
*
|
||||
@@ -47,13 +50,12 @@
|
||||
//
|
||||
outBuf::outBuf(casMsgIO &virtualCircuit, osiMutex &mutexIn) :
|
||||
io(virtualCircuit),
|
||||
mutex(mutexIn)
|
||||
mutex(mutexIn),
|
||||
pBuf(NULL),
|
||||
bufSize(io.optimumBufferSize()),
|
||||
stack(0u)
|
||||
{
|
||||
assert(&io);
|
||||
|
||||
this->stack = 0u;
|
||||
this->bufSize = 0u;
|
||||
this->pBuf = NULL;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -61,10 +63,8 @@ outBuf::outBuf(casMsgIO &virtualCircuit, osiMutex &mutexIn) :
|
||||
//
|
||||
caStatus outBuf::init()
|
||||
{
|
||||
this->bufSize = io.optimumBufferSize();
|
||||
this->pBuf = new char [this->bufSize];
|
||||
if (!this->pBuf) {
|
||||
this->bufSize = 0u;
|
||||
return S_cas_noMemory;
|
||||
}
|
||||
return S_cas_success;
|
||||
@@ -94,30 +94,32 @@ caHdr **ppMsg
|
||||
)
|
||||
{
|
||||
bufSizeT msgsize;
|
||||
bufSizeT stackNeeded;
|
||||
|
||||
extsize = CA_MESSAGE_ALIGN(extsize);
|
||||
|
||||
msgsize = extsize + sizeof(caHdr);
|
||||
if (msgsize>this->bufSize) {
|
||||
if (msgsize>this->bufSize || this->pBuf==NULL) {
|
||||
return S_cas_hugeRequest;
|
||||
}
|
||||
|
||||
stackNeeded = this->bufSize - msgsize;
|
||||
|
||||
this->mutex.lock();
|
||||
this->mutex.osiLock();
|
||||
|
||||
if (this->stack + msgsize > this->bufSize) {
|
||||
if (this->stack > stackNeeded) {
|
||||
|
||||
/*
|
||||
* Try to flush the output queue
|
||||
*/
|
||||
this->flush();
|
||||
this->flush(casFlushSpecified, msgsize);
|
||||
|
||||
/*
|
||||
* If this failed then the fd is nonblocking
|
||||
* and we will let select() take care of it
|
||||
*/
|
||||
if (this->stack + msgsize > this->bufSize) {
|
||||
this->mutex.unlock();
|
||||
if (this->stack > stackNeeded) {
|
||||
this->mutex.osiUnlock();
|
||||
this->sendBlockSignal();
|
||||
return S_cas_sendBlocked;
|
||||
}
|
||||
@@ -183,43 +185,69 @@ void outBuf::commitMsg ()
|
||||
this->stack += sizeof(caHdr) + extSize;
|
||||
assert (this->stack <= this->bufSize);
|
||||
|
||||
this->mutex.unlock();
|
||||
this->mutex.osiUnlock();
|
||||
}
|
||||
|
||||
//
|
||||
// outBuf::flush()
|
||||
//
|
||||
casFlushCondition outBuf::flush()
|
||||
casFlushCondition outBuf::flush(casFlushRequest req,
|
||||
bufSizeT spaceRequired)
|
||||
{
|
||||
bufSizeT nBytes;
|
||||
xSendStatus stat;
|
||||
bufSizeT nBytes;
|
||||
bufSizeT stackNeeded;
|
||||
bufSizeT nBytesNeeded;
|
||||
xSendStatus stat;
|
||||
casFlushCondition cond;
|
||||
|
||||
if (this->stack<=0u) {
|
||||
return casFlushCompleted;
|
||||
}
|
||||
|
||||
stat = this->io.xSend(this->pBuf, this->stack, nBytes);
|
||||
if (stat!=xSendOK) {
|
||||
if (!this->pBuf) {
|
||||
return casFlushDisconnect;
|
||||
}
|
||||
else if (nBytes >= this->stack) {
|
||||
this->stack=0u;
|
||||
return casFlushCompleted;
|
||||
}
|
||||
else if (nBytes) {
|
||||
bufSizeT len;
|
||||
|
||||
len = this->stack-nBytes;
|
||||
//
|
||||
// memmove() is ok with overlapping buffers
|
||||
//
|
||||
memmove (this->pBuf, &this->pBuf[nBytes], len);
|
||||
this->stack = len;
|
||||
return casFlushPartial;
|
||||
this->mutex.osiLock();
|
||||
|
||||
if (req==casFlushAll) {
|
||||
nBytesNeeded = this->stack;
|
||||
}
|
||||
else {
|
||||
return casFlushNone;
|
||||
stackNeeded = this->bufSize - spaceRequired;
|
||||
if (this->stack>stackNeeded) {
|
||||
nBytesNeeded = this->stack - stackNeeded;
|
||||
}
|
||||
else {
|
||||
nBytesNeeded = 0u;
|
||||
}
|
||||
}
|
||||
|
||||
stat = this->io.xSend(this->pBuf, this->stack,
|
||||
nBytesNeeded, nBytes);
|
||||
if (nBytes) {
|
||||
bufSizeT len;
|
||||
|
||||
if (nBytes >= this->stack) {
|
||||
this->stack=0u;
|
||||
cond = casFlushCompleted;
|
||||
}
|
||||
else {
|
||||
len = this->stack-nBytes;
|
||||
//
|
||||
// memmove() is ok with overlapping buffers
|
||||
//
|
||||
memmove (this->pBuf, &this->pBuf[nBytes], len);
|
||||
this->stack = len;
|
||||
cond = casFlushPartial;
|
||||
}
|
||||
}
|
||||
else {
|
||||
cond = casFlushNone;
|
||||
}
|
||||
|
||||
if (stat!=xSendOK) {
|
||||
cond = casFlushDisconnect;
|
||||
}
|
||||
this->mutex.osiUnlock();
|
||||
return cond;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
*
|
||||
* History
|
||||
* $Log$
|
||||
* Revision 1.10 1996/09/04 20:27:02 jhill
|
||||
* doccasdef.h
|
||||
*
|
||||
* Revision 1.9 1996/08/13 22:56:14 jhill
|
||||
* added init for mutex class
|
||||
*
|
||||
@@ -110,6 +113,7 @@ caStatus copyBetweenDD(gdd &dest, gdd &src);
|
||||
//
|
||||
enum xRecvStatus {xRecvOK, xRecvDisconnect};
|
||||
enum xSendStatus {xSendOK, xSendDisconnect};
|
||||
enum xBlockingStatus {xIsBlocking, xIsntBlocking};
|
||||
enum casIOState {casOnLine, casOffLine};
|
||||
typedef unsigned bufSizeT;
|
||||
class casMsgIO {
|
||||
@@ -129,8 +133,8 @@ public:
|
||||
//
|
||||
// device dependent recv
|
||||
//
|
||||
xSendStatus xSend (char *pBuf, bufSizeT nBytesToSend,
|
||||
bufSizeT &nBytesSent);
|
||||
xSendStatus xSend (char *pBuf, bufSizeT nBytesAvailableToSend,
|
||||
bufSizeT nBytesNeedToBeSent, bufSizeT &nBytesSent);
|
||||
xRecvStatus xRecv (char *pBuf, bufSizeT nBytesToRecv,
|
||||
bufSizeT &nByesRecv);
|
||||
|
||||
@@ -140,7 +144,11 @@ public:
|
||||
virtual casIOState state() const=0;
|
||||
virtual void hostNameFromAddr (char *pBuf, unsigned bufSize)=0;
|
||||
virtual int getFileDescriptor() const;
|
||||
virtual void setNonBlocking();
|
||||
void setNonBlocking()
|
||||
{
|
||||
this->xSetNonBlocking();
|
||||
this->blockingStatus = xIsntBlocking;
|
||||
}
|
||||
|
||||
//
|
||||
// only for use with DG io
|
||||
@@ -154,12 +162,14 @@ private:
|
||||
//
|
||||
osiTime elapsedAtLastSend;
|
||||
osiTime elapsedAtLastRecv;
|
||||
xBlockingStatus blockingStatus;
|
||||
|
||||
virtual xSendStatus osdSend (const char *pBuf,
|
||||
bufSizeT nBytesReq, bufSizeT &nBytesActual) =0;
|
||||
virtual xRecvStatus osdRecv (char *pBuf,
|
||||
bufSizeT nBytesReq, bufSizeT &nBytesActual) =0;
|
||||
virtual void osdShow (unsigned level) const = 0;
|
||||
virtual void xSetNonBlocking();
|
||||
};
|
||||
|
||||
#include <casOSD.h> // OS dependent
|
||||
@@ -260,9 +270,9 @@ private:
|
||||
//
|
||||
inline void casEventSys::insertEventQueue(casEvent &insert, casEvent &prevEvent)
|
||||
{
|
||||
this->mutex.lock();
|
||||
this->mutex.osiLock();
|
||||
this->eventLogQue.insertAfter(insert, prevEvent);
|
||||
this->mutex.unlock();
|
||||
this->mutex.osiUnlock();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -270,9 +280,9 @@ inline void casEventSys::insertEventQueue(casEvent &insert, casEvent &prevEvent)
|
||||
//
|
||||
inline void casEventSys::pushOnToEventQueue(casEvent &event)
|
||||
{
|
||||
this->mutex.lock();
|
||||
this->mutex.osiLock();
|
||||
this->eventLogQue.push(event);
|
||||
this->mutex.unlock();
|
||||
this->mutex.osiUnlock();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -280,9 +290,9 @@ inline void casEventSys::pushOnToEventQueue(casEvent &event)
|
||||
//
|
||||
inline void casEventSys::removeFromEventQueue(casEvent &event)
|
||||
{
|
||||
this->mutex.lock();
|
||||
this->mutex.osiLock();
|
||||
this->eventLogQue.remove(event);
|
||||
this->mutex.unlock();
|
||||
this->mutex.osiUnlock();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -469,6 +479,9 @@ enum casFlushCondition{
|
||||
casFlushPartial,
|
||||
casFlushCompleted,
|
||||
casFlushDisconnect};
|
||||
enum casFlushRequest{
|
||||
casFlushAll,
|
||||
casFlushSpecified};
|
||||
|
||||
class outBuf {
|
||||
public:
|
||||
@@ -480,13 +493,24 @@ public:
|
||||
// number of bytes in the output queue?
|
||||
//
|
||||
bufSizeT bytesPresent() const
|
||||
{ return this->stack; }
|
||||
{
|
||||
return this->stack;
|
||||
}
|
||||
|
||||
//
|
||||
// number of bytes unused in the output queue?
|
||||
//
|
||||
bufSizeT bytesFree() const
|
||||
{
|
||||
return this->bufSize - this->stack;
|
||||
}
|
||||
|
||||
//
|
||||
// flush output queue
|
||||
// (returns the number of bytes sent)
|
||||
//
|
||||
casFlushCondition flush();
|
||||
casFlushCondition flush(casFlushRequest req = casFlushAll,
|
||||
bufSizeT spaceRequired=0u);
|
||||
|
||||
//
|
||||
// allocate message buffer space
|
||||
@@ -502,18 +526,25 @@ public:
|
||||
//
|
||||
// release an allocated message (but dont send it)
|
||||
//
|
||||
void discardMsg () { this->mutex.unlock(); };
|
||||
void discardMsg ()
|
||||
{
|
||||
this->mutex.osiUnlock();
|
||||
};
|
||||
|
||||
void show(unsigned level);
|
||||
|
||||
virtual unsigned getDebugLevel()=0;
|
||||
virtual void sendBlockSignal()=0;
|
||||
|
||||
void clear()
|
||||
{
|
||||
this->stack = 0u;
|
||||
}
|
||||
private:
|
||||
casMsgIO &io;
|
||||
osiMutex &mutex;
|
||||
char *pBuf;
|
||||
bufSizeT bufSize;
|
||||
const bufSizeT bufSize;
|
||||
bufSizeT stack;
|
||||
};
|
||||
|
||||
@@ -552,16 +583,16 @@ public:
|
||||
|
||||
void installAsyncIO(casAsyncIOI &ioIn)
|
||||
{
|
||||
this->lock();
|
||||
this->osiLock();
|
||||
this->ioInProgList.add(ioIn);
|
||||
this->unlock();
|
||||
this->osiUnlock();
|
||||
}
|
||||
|
||||
void removeAsyncIO(casAsyncIOI &ioIn)
|
||||
{
|
||||
this->lock();
|
||||
this->osiLock();
|
||||
this->ioInProgList.remove(ioIn);
|
||||
this->unlock();
|
||||
this->osiUnlock();
|
||||
}
|
||||
|
||||
casRes *lookupRes(const caResId &idIn, casResType type);
|
||||
@@ -668,8 +699,8 @@ protected:
|
||||
const void *dp, const char *pFileName,
|
||||
const unsigned lineno);
|
||||
|
||||
private:
|
||||
casMsgIO &msgIO;
|
||||
private:
|
||||
|
||||
//
|
||||
// dump message to stderr
|
||||
@@ -822,7 +853,7 @@ private:
|
||||
//
|
||||
// casDGClient
|
||||
//
|
||||
class casDGClient : private casDGIO, public casClient {
|
||||
class casDGClient : private casDGIO, private casClient {
|
||||
public:
|
||||
casDGClient (caServerI &serverIn);
|
||||
|
||||
@@ -857,9 +888,24 @@ public:
|
||||
|
||||
void destroy();
|
||||
|
||||
int getFD() const
|
||||
{
|
||||
return this->casClient::getFD();
|
||||
}
|
||||
|
||||
protected:
|
||||
void process();
|
||||
|
||||
casProcCond eventSysProcess()
|
||||
{
|
||||
return this->casEventSys::process();
|
||||
}
|
||||
|
||||
casFlushCondition flush(casFlushRequest req = casFlushAll,
|
||||
bufSizeT spaceRequired=0u)
|
||||
{
|
||||
return this->outBuf::flush(req,spaceRequired);
|
||||
}
|
||||
private:
|
||||
void ioBlockedSignal(); // dummy
|
||||
|
||||
|
||||
@@ -176,9 +176,9 @@ void casDGIO::osdShow (unsigned level) const
|
||||
}
|
||||
|
||||
//
|
||||
// casDGIO::setNonBlocking()
|
||||
// casDGIO::xSetNonBlocking()
|
||||
//
|
||||
void casDGIO::setNonBlocking()
|
||||
void casDGIO::xSetNonBlocking()
|
||||
{
|
||||
int status;
|
||||
int yes = TRUE;
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
// Some BSD calls have crept in here
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.4 1996/09/04 20:29:08 jhill
|
||||
// removed os depen stuff
|
||||
//
|
||||
// Revision 1.3 1996/08/13 23:00:29 jhill
|
||||
// removed include of netdb.h
|
||||
//
|
||||
@@ -84,7 +87,7 @@ public:
|
||||
~casStreamIO();
|
||||
|
||||
int getFileDescriptor() const;
|
||||
void setNonBlocking();
|
||||
void xSetNonBlocking();
|
||||
bufSizeT optimumBufferSize ();
|
||||
|
||||
casIOState state() const;
|
||||
@@ -110,7 +113,7 @@ public:
|
||||
~casDGIO();
|
||||
|
||||
int getFileDescriptor() const;
|
||||
void setNonBlocking();
|
||||
void xSetNonBlocking();
|
||||
bufSizeT optimumBufferSize ();
|
||||
void sendBeacon(char &msg, bufSizeT length,
|
||||
aitUint32 &m_avail);
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
//
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.4 1996/07/24 22:03:36 jhill
|
||||
// fixed net proto for gnu compiler
|
||||
//
|
||||
// Revision 1.3 1996/07/09 22:55:22 jhill
|
||||
// added cast
|
||||
//
|
||||
@@ -23,8 +26,15 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#ifndef SUNOS4 // the SUNOS4 prototypes are trad C - see bsdProto.h
|
||||
//
|
||||
// the SUNOS4 and vxWorks5.2 prototypes are trad C
|
||||
//
|
||||
#if !defined(SUNOS4) && !defined(vxWorks)
|
||||
#include <arpa/inet.h>
|
||||
#else
|
||||
extern "C" {
|
||||
char * inet_ntoa(struct in_addr);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -32,10 +42,9 @@
|
||||
// casStreamIO::casStreamIO()
|
||||
//
|
||||
casStreamIO::casStreamIO(const SOCKET s, const caAddr &a) :
|
||||
sock(s), addr(a)
|
||||
sockState(casOffLine), sock(s), addr(a)
|
||||
{
|
||||
assert (sock>=0);
|
||||
this->sockState = casOffLine;
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +133,8 @@ caStatus casStreamIO::init()
|
||||
casStreamIO::~casStreamIO()
|
||||
{
|
||||
if (sock>=0) {
|
||||
close(sock);
|
||||
close(this->sock);
|
||||
printf("closing sock=%d\n", this->sock);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +142,7 @@ casStreamIO::~casStreamIO()
|
||||
//
|
||||
// casStreamIO::osdSend()
|
||||
//
|
||||
xSendStatus casStreamIO::osdSend(const char *pBuf, bufSizeT nBytes,
|
||||
xSendStatus casStreamIO::osdSend(const char *pBuf, bufSizeT nBytesReq,
|
||||
bufSizeT &nBytesActual)
|
||||
{
|
||||
int status;
|
||||
@@ -156,31 +166,29 @@ xSendStatus casStreamIO::osdSend(const char *pBuf, bufSizeT nBytes,
|
||||
return xSendDisconnect;
|
||||
}
|
||||
|
||||
|
||||
if (nBytes<=0u) {
|
||||
if (nBytesReq<=0u) {
|
||||
nBytesActual = 0u;
|
||||
return xSendOK;
|
||||
}
|
||||
|
||||
status = send (
|
||||
this->sock,
|
||||
pBuf,
|
||||
nBytes,
|
||||
0);
|
||||
if (status == 0) {
|
||||
this->sockState = casOffLine;
|
||||
status = send (
|
||||
this->sock,
|
||||
(char *) pBuf,
|
||||
nBytesReq,
|
||||
0);
|
||||
if (status == 0) {
|
||||
this->sockState = casOffLine;
|
||||
return xSendDisconnect;
|
||||
}
|
||||
else if (status<0) {
|
||||
int anerrno = SOCKERRNO;
|
||||
}
|
||||
else if (status<0) {
|
||||
int anerrno = SOCKERRNO;
|
||||
|
||||
if (anerrno != EWOULDBLOCK) {
|
||||
this->sockState = casOffLine;
|
||||
if (anerrno != EWOULDBLOCK) {
|
||||
this->sockState = casOffLine;
|
||||
}
|
||||
nBytesActual = 0u;
|
||||
return xSendOK;
|
||||
}
|
||||
|
||||
nBytesActual = (bufSizeT) status;
|
||||
return xSendOK;
|
||||
}
|
||||
@@ -247,9 +255,9 @@ void casStreamIO::osdShow (unsigned level) const
|
||||
|
||||
|
||||
//
|
||||
// casStreamIO::setNonBlocking()
|
||||
// casStreamIO::xSsetNonBlocking()
|
||||
//
|
||||
void casStreamIO::setNonBlocking()
|
||||
void casStreamIO::xSetNonBlocking()
|
||||
{
|
||||
int status;
|
||||
int yes = TRUE;
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
*
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.2 1996/08/05 19:29:25 jhill
|
||||
* os depen code now smaller
|
||||
*
|
||||
* Revision 1.1.1.1 1996/06/20 00:28:06 jhill
|
||||
* ca server installation
|
||||
*
|
||||
@@ -52,7 +55,7 @@ void casDGEvWakeup::show(unsigned level)
|
||||
void casDGEvWakeup::expire()
|
||||
{
|
||||
casProcCond cond;
|
||||
cond = this->os.casEventSys::process();
|
||||
cond = this->os.eventSysProcess();
|
||||
if (cond != casProcOk) {
|
||||
//
|
||||
// if "this" is being used above this
|
||||
|
||||
@@ -10,8 +10,9 @@ public:
|
||||
// (since g++ does not have exceptions)
|
||||
//
|
||||
int init() {return 0;}
|
||||
void lock() {};
|
||||
void unlock() {};
|
||||
void osiLock() {}
|
||||
void osiUnlock() {}
|
||||
void show (unsigned) {}
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
*
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.1 1996/09/04 22:06:43 jhill
|
||||
* installed
|
||||
*
|
||||
* Revision 1.1.1.1 1996/06/20 00:28:06 jhill
|
||||
* ca server installation
|
||||
*
|
||||
@@ -109,9 +112,9 @@ caServerOS::~caServerOS()
|
||||
|
||||
|
||||
//
|
||||
// caServer()
|
||||
// caServerEntry()
|
||||
//
|
||||
void caServer(caServerI *pCAS)
|
||||
void caServerEntry(caServerI *pCAS)
|
||||
{
|
||||
//
|
||||
// forever
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
*
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.1 1996/09/04 22:06:45 jhill
|
||||
* installed
|
||||
*
|
||||
* Revision 1.1.1.1 1996/06/20 00:28:06 jhill
|
||||
* ca server installation
|
||||
*
|
||||
@@ -100,7 +103,7 @@ void casDGOS::show(unsigned level)
|
||||
taskShow(this->clientTId, level);
|
||||
}
|
||||
if (taskIdVerify(this->eventTId) == OK) {
|
||||
taskShow(this->eventTId, level);
|
||||
printf("casDGOS task id = %x\n", this->eventTId);
|
||||
}
|
||||
if (this->eventSignalSem) {
|
||||
semShow(this->eventSignalSem, level);
|
||||
@@ -174,16 +177,11 @@ casProcCond casDGOS::processInput ()
|
||||
//
|
||||
int casDGServer (casDGOS *pDGOS)
|
||||
{
|
||||
caStatus status;
|
||||
|
||||
//
|
||||
// block for the next DG until the connection closes
|
||||
//
|
||||
while (TRUE) {
|
||||
status = pDGOS->processInput();
|
||||
if (status) {
|
||||
errMessage(status, "casDGServer (casDGOS *pDGOS)");
|
||||
}
|
||||
pDGOS->process();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,7 +200,7 @@ int casDGEvent (casDGOS *pDGOS)
|
||||
status = semTake(pDGOS->eventSignalSem, WAIT_FOREVER);
|
||||
assert (status!=OK);
|
||||
|
||||
cond = pDGOS->casEventSys::process();
|
||||
cond = pDGOS->eventSysProcess();
|
||||
if (cond != casProcOk) {
|
||||
printf("DG event sys process failed\n");
|
||||
}
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
// Some BSD calls have crept in here
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.1 1996/09/04 22:06:46 jhill
|
||||
// installed
|
||||
//
|
||||
// Revision 1.1.1.1 1996/06/20 00:28:06 jhill
|
||||
// ca server installation
|
||||
//
|
||||
@@ -61,14 +64,14 @@ class caServerOS;
|
||||
//
|
||||
// vxWorks task entry
|
||||
//
|
||||
int caServerEntry(caServerI *pCAS);
|
||||
void caServerEntry(caServerI *pCAS);
|
||||
|
||||
//
|
||||
// caServerOS
|
||||
//
|
||||
class caServerOS {
|
||||
friend class casServerReg;
|
||||
friend int caServerEntry(caServerOS *pOS);
|
||||
friend void caServerEntry(caServerI *pCAS);
|
||||
public:
|
||||
caServerOS (caServerI &casIn) :
|
||||
cas (casIn), pBTmr (NULL), tid(ERROR) {}
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
//
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.1 1996/09/04 22:06:46 jhill
|
||||
// installed
|
||||
//
|
||||
// Revision 1.1.1.1 1996/06/20 00:28:06 jhill
|
||||
// ca server installation
|
||||
//
|
||||
@@ -23,7 +26,7 @@
|
||||
//
|
||||
void casStreamOS::ioBlockedSignal()
|
||||
{
|
||||
printf("in casStreamOS::ioBlockedSignal()\n");
|
||||
printf("in casStreamOS::ioBlockedSignal() ?\n");
|
||||
}
|
||||
|
||||
//
|
||||
@@ -115,7 +118,7 @@ void casStreamOS::show(unsigned level)
|
||||
taskShow(this->clientTId, level);
|
||||
}
|
||||
if (taskIdVerify(this->eventTId)==OK) {
|
||||
taskShow(this->eventTId, level);
|
||||
printf("casStreamOS task id %x\n", this->eventTId);
|
||||
}
|
||||
if (this->eventSignalSem) {
|
||||
semShow(this->eventSignalSem, level);
|
||||
@@ -217,10 +220,9 @@ int casStrmServer (casStreamOS *pStrmOS)
|
||||
{
|
||||
casFillCondition fillCond;
|
||||
casProcCond procCond;
|
||||
caStatus status;
|
||||
|
||||
//
|
||||
// block for the next DG until the connection closes
|
||||
// block for the next message until the connection closes
|
||||
//
|
||||
while (TRUE) {
|
||||
//
|
||||
@@ -237,20 +239,13 @@ int casStrmServer (casStreamOS *pStrmOS)
|
||||
//
|
||||
return OK;
|
||||
}
|
||||
else if (pStrmOS->inBuf::full()==aitTrue) {
|
||||
//
|
||||
// If there isnt any space then temporarily
|
||||
// stop calling this routine until problem is resolved
|
||||
// either by:
|
||||
// (1) sending or
|
||||
// (2) a blocked IO op unblocks
|
||||
//
|
||||
delete pStrmOS;
|
||||
//
|
||||
// NO CODE HERE
|
||||
// (see delete above)
|
||||
//
|
||||
return OK;
|
||||
//
|
||||
// force the output buffer to flush prior to
|
||||
// blocking for more input (if no input bytes are
|
||||
// pending)
|
||||
//
|
||||
if (pStrmOS->bytesAvailable()<=0u) {
|
||||
pStrmOS->flush();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,7 +264,7 @@ int casStrmEvent(casStreamOS *pStrmOS)
|
||||
//
|
||||
while (TRUE) {
|
||||
status = semTake(pStrmOS->eventSignalSem, WAIT_FOREVER);
|
||||
assert (status!=OK);
|
||||
assert (status==OK);
|
||||
|
||||
cond = pStrmOS->casEventSys::process();
|
||||
if (cond != casProcOk) {
|
||||
|
||||
@@ -3,9 +3,26 @@
|
||||
// osiMutex - OS independent mutex
|
||||
// (vxWorks version)
|
||||
//
|
||||
//
|
||||
// NOTES:
|
||||
// 1) epicsPrintf() is used in this file because we cant stand
|
||||
// the logMsg() 8 arg API amd we dont want the messages from different
|
||||
// tasks to co-mingle
|
||||
//
|
||||
|
||||
#include <semLib.h>
|
||||
#include <assert.h>
|
||||
#include <epicsAssert.h>
|
||||
#include <epicsPrint.h>
|
||||
|
||||
|
||||
#ifdef DEBUG_OSIMUTEX
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_OSIMUTEX
|
||||
#define osiLock() osiLockI (__FILE__, __LINE__)
|
||||
#define osiUnlock() osiUnlockI (__FILE__, __LINE__)
|
||||
#endif
|
||||
|
||||
class osiMutex {
|
||||
public:
|
||||
@@ -24,26 +41,71 @@ public:
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
# ifdef DEBUG_OSIMUTEX
|
||||
epicsPrintf("created mutex at %lx\n",
|
||||
(unsigned long) this->mutex);
|
||||
# endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
~osiMutex()
|
||||
{
|
||||
STATUS s;
|
||||
s = semDelete (this->mutex);
|
||||
assert (s==OK);
|
||||
# ifdef DEBUG_OSIMUTEX
|
||||
epicsPrintf("destroyed mutex at %lx\n",
|
||||
(unsigned long) this->mutex);
|
||||
# endif
|
||||
}
|
||||
void lock()
|
||||
|
||||
#ifdef DEBUG_OSIMUTEX
|
||||
void osiLockI(const char *pFN, unsigned ln)
|
||||
#else
|
||||
void osiLock()
|
||||
#endif
|
||||
{
|
||||
STATUS s;
|
||||
if (!this->mutex) {
|
||||
epicsPrintf(
|
||||
"osiMutex: lock request before init was ignored\n");
|
||||
return;
|
||||
}
|
||||
assert(this->mutex);
|
||||
s = semTake (this->mutex, WAIT_FOREVER);
|
||||
assert (s==OK);
|
||||
# ifdef DEBUG_OSIMUTEX
|
||||
epicsPrintf("L%lx in %s at %u\n",
|
||||
(unsigned long) this->mutex,
|
||||
pFN, ln);
|
||||
# endif
|
||||
}
|
||||
void unlock()
|
||||
|
||||
#ifdef DEBUG_OSIMUTEX
|
||||
void osiUnlockI(const char *pFN, unsigned ln)
|
||||
#else
|
||||
void osiUnlock()
|
||||
#endif
|
||||
{
|
||||
STATUS s;
|
||||
|
||||
if (!this->mutex) {
|
||||
epicsPrintf(
|
||||
"osiMutex: unlock request before init was ignored\n");
|
||||
return;
|
||||
}
|
||||
s = semGive (this->mutex);
|
||||
assert (s==OK);
|
||||
# ifdef DEBUG_OSIMUTEX
|
||||
epicsPrintf("U%lx in %s at %d\n",
|
||||
(unsigned long) this->mutex,
|
||||
pFN, ln);
|
||||
# endif
|
||||
}
|
||||
|
||||
void show(unsigned level)
|
||||
{
|
||||
semShow(this->mutex, (int) level);
|
||||
}
|
||||
private:
|
||||
SEM_ID mutex;
|
||||
|
||||
@@ -49,5 +49,5 @@ sf2db: sf2dbYacc.o
|
||||
sf2dbYacc.o: sf2dbLex.c
|
||||
|
||||
clean::
|
||||
/bin/rm -f sf2dbYacc.c sf2dbLex.c
|
||||
$(RM) -f sf2dbYacc.c sf2dbLex.c
|
||||
|
||||
|
||||
@@ -65,7 +65,8 @@ static char *ptypename[DBF_NTYPES] = {
|
||||
"DBF_NOACCESS"
|
||||
};
|
||||
|
||||
static char *pguigroup[] = {
|
||||
#define NGUIDEFS 26
|
||||
static char *pguigroup[NGUIDEFS] = {
|
||||
"",
|
||||
"GUI_COMMON",
|
||||
"GUI_ALARMS",
|
||||
@@ -308,7 +309,10 @@ gen_rectype:
|
||||
fprintf(fp,"\t\tprompt(\"%s\")\n",pfldDes->prompt);
|
||||
}
|
||||
if(pfldDes->promptflag) {
|
||||
fprintf(fp,"\t\tpromptgroup(%s)\n",pguigroup[pfldDes->promptflag]);
|
||||
if(pfldDes->promptflag<0 || pfldDes->promptflag>=NGUIDEFS)
|
||||
fprintf(fp,"\t\tpromptgroup(%s)\n",pguigroup[9]);/*GUI_DISPLAY*/
|
||||
else
|
||||
fprintf(fp,"\t\tpromptgroup(%s)\n",pguigroup[pfldDes->promptflag]);
|
||||
}
|
||||
if(pfldDes->as_level == 0) fprintf(fp,"\t\tasl(ASL0)\n");
|
||||
if(pfldDes->special) {
|
||||
|
||||
@@ -203,3 +203,8 @@ LIBOBJS += $(EPICS_BASE_BIN)/drvHp1404a.o
|
||||
#LIBOBJS += $(EPICS_BASE_BIN)/drvXy240.o
|
||||
#LIBOBJS += $(EPICS_BASE_BIN)/drvXy566.o
|
||||
#LIBOBJS += $(EPICS_BASE_BIN)/drvVmic2534.o
|
||||
#
|
||||
#from src/devOpt
|
||||
#
|
||||
#LIBOBJS += $(EPICS_BASE_BIN)/devBBInteract.o
|
||||
#LIBOBJS += $(EPICS_BASE_BIN)/devGpibInteract.o
|
||||
|
||||
@@ -43,6 +43,7 @@ of this distribution.
|
||||
#include "dbCa.h"
|
||||
/*Following is because dbScan.h causes include for dbAccess.h*/
|
||||
void scanOnce(void *precord);
|
||||
extern volatile int interruptAccept;
|
||||
|
||||
static ELLLIST caList; /* Work list for dbCaTask */
|
||||
static SEM_ID caListSem; /*Mutual exclusions semaphores for caList*/
|
||||
@@ -138,7 +139,7 @@ long dbCaGetLink(struct link *plink,short dbrType, char *pdest,
|
||||
epicsPrintf("dbCaGetLink: semStatus!OK\n");
|
||||
return(-1);
|
||||
}
|
||||
if(ca_state(pca->chid) != cs_conn) {
|
||||
if(!pca->chid || ca_state(pca->chid) != cs_conn) {
|
||||
pca->sevr = INVALID_ALARM;
|
||||
goto done;
|
||||
}
|
||||
@@ -214,7 +215,7 @@ long dbCaPutLink(struct link *plink,short dbrType,
|
||||
epicsPrintf("dbCaGetLink: semStatus!OK\n");
|
||||
return(-1);
|
||||
}
|
||||
if(ca_state(pca->chid) != cs_conn) {
|
||||
if(!pca->chid || ca_state(pca->chid) != cs_conn) {
|
||||
semGive(pca->lock);
|
||||
return(-1);
|
||||
}
|
||||
@@ -305,8 +306,7 @@ caAttributes *getpcaAttributes(struct link *plink)
|
||||
|
||||
if(!plink || (plink->type!=CA_LINK)) return(NULL);
|
||||
pca = (caLink *)plink->value.pv_link.pvt;
|
||||
if(!pca) return(NULL);
|
||||
if(ca_state(pca->chid)!=cs_conn) return(NULL);
|
||||
if(!pca->chid || ca_state(pca->chid)!=cs_conn) return(NULL);
|
||||
return(pca->pcaAttributes);
|
||||
}
|
||||
|
||||
@@ -374,8 +374,7 @@ long dbCaGetNelements(struct link *plink,long *nelements)
|
||||
if(!plink) return(-1);
|
||||
if(plink->type != CA_LINK) return(-1);
|
||||
pca = (caLink *)plink->value.pv_link.pvt;
|
||||
if(!pca) return(-1);
|
||||
if(ca_state(pca->chid)!=cs_conn) return(-1);
|
||||
if(!pca->chid || ca_state(pca->chid)!=cs_conn) return(-1);
|
||||
*nelements = pca->nelements;
|
||||
return(0);
|
||||
}
|
||||
@@ -387,8 +386,7 @@ long dbCaGetSevr(struct link *plink,short *severity)
|
||||
if(!plink) return(-1);
|
||||
if(plink->type != CA_LINK) return(-1);
|
||||
pca = (caLink *)plink->value.pv_link.pvt;
|
||||
if(!pca) return(-1);
|
||||
if(ca_state(pca->chid)!=cs_conn) return(-1);
|
||||
if(!pca->chid || ca_state(pca->chid)!=cs_conn) return(-1);
|
||||
*severity = pca->sevr;
|
||||
return(0);
|
||||
}
|
||||
@@ -606,6 +604,8 @@ void dbCaTask()
|
||||
int status;
|
||||
|
||||
SEVCHK(ca_task_initialize(),NULL);
|
||||
/*Dont do anything until iocInit initializes database*/
|
||||
while(!interruptAccept) taskDelay(10);
|
||||
/* channel access event loop */
|
||||
while (TRUE){
|
||||
semTake(caWakeupSem,WAIT_FOREVER);
|
||||
|
||||
@@ -155,7 +155,7 @@ int db_event_list(char *name)
|
||||
printf(" ev que %x\n",pevent->ev_que);
|
||||
printf(" ev user %x\n",pevent->ev_que->evuser);
|
||||
#endif
|
||||
printf( "task %x select %x pfield %x behind by %d\n",
|
||||
printf( "task %x select %x pfield %x behind by %ld\n",
|
||||
pevent->ev_que->evuser->taskid,
|
||||
pevent->select,
|
||||
(unsigned int) pevent->paddr->pfield,
|
||||
|
||||
@@ -207,10 +207,15 @@ void dbLockSetRecordLock(dbCommon *precord)
|
||||
|
||||
void dbScanLock(dbCommon *precord)
|
||||
{
|
||||
lockRecord *plockRecord = (lockRecord *)precord->lset;
|
||||
lockRecord *plockRecord;
|
||||
lockSet *plockSet;
|
||||
STATUS status;
|
||||
|
||||
if(!(plockRecord= (lockRecord *)precord->lset)) {
|
||||
epicsPrintf("dbScanLock plockRecord is NULL record %s\n",
|
||||
precord->name);
|
||||
exit(1);
|
||||
}
|
||||
while(TRUE) {
|
||||
if(changingLockSets) {
|
||||
semTake(globalWaitSemid,WAIT_FOREVER);
|
||||
|
||||
@@ -586,15 +586,16 @@ static void scanList(scan_list *psl)
|
||||
/*In reading this code remember that the call to dbProcess can result*/
|
||||
/*in the SCAN field being changed in an arbitrary number of records */
|
||||
|
||||
scan_element *pse,*prev,*next;
|
||||
scan_element *pse,*prev;
|
||||
scan_element *next=0;
|
||||
|
||||
FASTLOCK(&psl->lock);
|
||||
psl->modified = FALSE;
|
||||
pse = (scan_element *)ellFirst(&psl->list);
|
||||
prev = NULL;
|
||||
next = (scan_element *)ellNext((void *)pse);
|
||||
if(pse) next = (scan_element *)ellNext((void *)pse);
|
||||
FASTUNLOCK(&psl->lock);
|
||||
while(pse!=NULL) {
|
||||
while(pse) {
|
||||
struct dbCommon *precord = pse->precord;
|
||||
|
||||
dbScanLock(precord);
|
||||
@@ -604,22 +605,22 @@ static void scanList(scan_list *psl)
|
||||
if(!psl->modified) {
|
||||
prev = pse;
|
||||
pse = (scan_element *)ellNext((void *)pse);
|
||||
if(pse!=NULL)next = (scan_element *)ellNext((void *)pse);
|
||||
if(pse)next = (scan_element *)ellNext((void *)pse);
|
||||
} else if (pse->pscan_list==psl) {
|
||||
/*This scan element is still in same scan list*/
|
||||
prev = pse;
|
||||
pse = (scan_element *)ellNext((void *)pse);
|
||||
if(pse!=NULL)next = (scan_element *)ellNext((void *)pse);
|
||||
if(pse)next = (scan_element *)ellNext((void *)pse);
|
||||
psl->modified = FALSE;
|
||||
} else if (prev!=NULL && prev->pscan_list==psl) {
|
||||
} else if (prev && prev->pscan_list==psl) {
|
||||
/*Previous scan element is still in same scan list*/
|
||||
pse = (scan_element *)ellNext((void *)prev);
|
||||
if(pse!=NULL) {
|
||||
if(pse) {
|
||||
prev = (scan_element *)ellPrevious((void *)pse);
|
||||
next = (scan_element *)ellNext((void *)pse);
|
||||
}
|
||||
psl->modified = FALSE;
|
||||
} else if (next!=NULL && next->pscan_list==psl) {
|
||||
} else if (next && next->pscan_list==psl) {
|
||||
/*Next scan element is still in same scan list*/
|
||||
pse = next;
|
||||
prev = (scan_element *)ellPrevious((void *)pse);
|
||||
@@ -667,7 +668,7 @@ static void addToList(struct dbCommon *precord,scan_list *psl)
|
||||
}
|
||||
pse ->pscan_list = psl;
|
||||
ptemp = (scan_element *)ellFirst(&psl->list);
|
||||
while(ptemp!=NULL) {
|
||||
while(ptemp) {
|
||||
if(ptemp->precord->phas>precord->phas) {
|
||||
ellInsert(&psl->list,
|
||||
ellPrevious((void *)ptemp),(void *)pse);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name [a-zA-Z0-9_\-:\.\[\]<>;]
|
||||
string [a-zA-Z0-9_\,\./\*#\[\]%: ;!|\'\-&\(\)@\?\+<>=\$\t]
|
||||
string [a-zA-Z0-9_\,\^~\./\*#\[\]%: ;!|\'\-&\(\)@\?\+<>=\$\t]
|
||||
|
||||
%{
|
||||
#undef YY_INPUT
|
||||
|
||||
@@ -89,8 +89,8 @@ static char *promptOUTLINK[] = {
|
||||
"NPP PP CA:",
|
||||
"NMS or MS:"};
|
||||
static char *promptFWDLINK[] = {
|
||||
" PV Name:",
|
||||
" PP CA:"};
|
||||
" PV Name:",
|
||||
"<null> CA:"};
|
||||
static char *promptVME_IO[] = {
|
||||
" card:",
|
||||
"signal:",
|
||||
@@ -219,6 +219,8 @@ long dbNextFielddes(DBENTRY *pdbentry,int dctonly)
|
||||
{return dbNextField(pdbentry,dctonly);}
|
||||
char **dbGetChoices(DBENTRY *pdbentry)
|
||||
{return dbGetMenuChoices(pdbentry);}
|
||||
void dbDumpRecDes(DBBASE *pdbbase,char *recordTypeName)
|
||||
{dbDumpRecordType(pdbbase,recordTypeName);}
|
||||
|
||||
/* internal routines*/
|
||||
void copyEntry(DBENTRY *pfrom,DBENTRY *pto)
|
||||
@@ -1682,15 +1684,16 @@ char *dbGetString(DBENTRY *pdbentry)
|
||||
short pvlMask;
|
||||
|
||||
pvlMask = plink->value.pv_link.pvlMask;
|
||||
if(pvlMask&pvlOptPP) ppind=1;
|
||||
else if(pvlMask&pvlOptCA) ppind=2;
|
||||
if(pvlMask&pvlOptCA) ppind=2;
|
||||
else ppind=0;
|
||||
if(plink->value.pv_link.pvname)
|
||||
strcpy(message,plink->value.pv_link.pvname);
|
||||
else
|
||||
strcpy(message,"");
|
||||
strcat(message," ");
|
||||
strcat(message,ppstring[ppind]);
|
||||
if(ppind) {
|
||||
strcat(message," ");
|
||||
strcat(message,ppstring[ppind]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default :
|
||||
@@ -1831,16 +1834,42 @@ long dbPutString(DBENTRY *pdbentry,char *pstring)
|
||||
if(plink->type==CONSTANT) dbCvtLinkToPvlink(pdbentry);
|
||||
end = strchr(pstr,' ');
|
||||
if(end) {
|
||||
if(strstr(end,"NPP")) ppOpt = 0;
|
||||
else if(strstr(end,"CPP")) ppOpt = pvlOptCPP;
|
||||
else if(strstr(end,"PP")) ppOpt = pvlOptPP;
|
||||
else if(strstr(end,"CA")) ppOpt = pvlOptCA;
|
||||
else if(strstr(end,"CP")) ppOpt = pvlOptCP;
|
||||
else ppOpt = 0;
|
||||
if(strstr(end,"NMS")) msOpt = 0;
|
||||
else if(strstr(end,"MS")) msOpt = pvlOptMS;
|
||||
else msOpt = 0;
|
||||
*end = 0;
|
||||
switch (pflddes->field_type) {
|
||||
case DBF_INLINK: {
|
||||
if(strstr(end,"NPP")) ppOpt = 0;
|
||||
else if(strstr(end,"CPP")) ppOpt = pvlOptCPP;
|
||||
else if(strstr(end,"PP")) ppOpt = pvlOptPP;
|
||||
else if(strstr(end,"CA")) ppOpt = pvlOptCA;
|
||||
else if(strstr(end,"CP")) ppOpt = pvlOptCP;
|
||||
else ppOpt = 0;
|
||||
if(strstr(end,"NMS")) msOpt = 0;
|
||||
else if(strstr(end,"MS")) msOpt = pvlOptMS;
|
||||
else msOpt = 0;
|
||||
*end = 0;
|
||||
}
|
||||
break;
|
||||
case DBF_OUTLINK: {
|
||||
if(strstr(end,"NPP")) ppOpt = 0;
|
||||
else if(strstr(end,"PP")) ppOpt = pvlOptPP;
|
||||
else if(strstr(end,"CA")) ppOpt = pvlOptCA;
|
||||
else ppOpt = 0;
|
||||
if(strstr(end,"NMS")) msOpt = 0;
|
||||
else if(strstr(end,"MS")) msOpt = pvlOptMS;
|
||||
else msOpt = 0;
|
||||
*end = 0;
|
||||
}
|
||||
break;
|
||||
case DBF_FWDLINK: {
|
||||
if(strstr(end,"NPP")) ppOpt = 0;
|
||||
else if(strstr(end,"CA")) ppOpt = pvlOptCA;
|
||||
else ppOpt = 0;
|
||||
msOpt = 0;
|
||||
*end = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
epicsPrintf("dbPutString: Logic Error\n");
|
||||
}
|
||||
}
|
||||
status = putPvLink(pdbentry,ppOpt|msOpt,pstr);
|
||||
return(0);
|
||||
@@ -2435,7 +2464,7 @@ char **dbGetFormValue(DBENTRY *pdbentry)
|
||||
if(plink->value.pv_link.pvname)
|
||||
strcpy(*value,plink->value.pv_link.pvname);
|
||||
else
|
||||
strcpy(*value,"\0");
|
||||
strcpy(*value,"");
|
||||
value++;
|
||||
if(pvlMask&pvlOptPP) strcpy(*value,"PP");
|
||||
else if(pvlMask&pvlOptCA) strcpy(*value,"CA");
|
||||
@@ -2454,7 +2483,7 @@ char **dbGetFormValue(DBENTRY *pdbentry)
|
||||
if(plink->value.pv_link.pvname)
|
||||
strcpy(*value,plink->value.pv_link.pvname);
|
||||
else
|
||||
strcpy(*value,"\0");
|
||||
strcpy(*value,"");
|
||||
value++;
|
||||
if(pvlMask&pvlOptPP) strcpy(*value,"PP");
|
||||
else if(pvlMask&pvlOptCA) strcpy(*value,"CA");
|
||||
@@ -2466,11 +2495,15 @@ char **dbGetFormValue(DBENTRY *pdbentry)
|
||||
}
|
||||
break;
|
||||
case FORM_FWDLINK: {
|
||||
short pvlMask = plink->value.pv_link.pvlMask;
|
||||
|
||||
if(plink->value.pv_link.pvname)
|
||||
strcpy(*value,plink->value.pv_link.pvname);
|
||||
else
|
||||
strcpy(*value,"\0");
|
||||
strcpy(*value,"");
|
||||
value++;
|
||||
if(pvlMask&pvlOptCA) strcpy(*value,"CA");
|
||||
else strcpy(*value,"");
|
||||
}
|
||||
break;
|
||||
case FORM_VME_IO:
|
||||
@@ -2620,7 +2653,7 @@ long dbPutForm(DBENTRY *pdbentry,char **value)
|
||||
**verify = 0;
|
||||
value++; verify++;
|
||||
**verify = 0; /*Initialize verify to NULL*/
|
||||
if(!(*value)) ppOpt = 0;
|
||||
if((*value==NULL) || (strcmp(*value,"")==0)) ppOpt = 0;
|
||||
else if(strstr(*value,"NPP")) ppOpt = 0;
|
||||
else if(strstr(*value,"PP")) ppOpt = pvlOptPP;
|
||||
else if(strstr(*value,"CA")) ppOpt = pvlOptCA;
|
||||
@@ -2629,7 +2662,7 @@ long dbPutForm(DBENTRY *pdbentry,char **value)
|
||||
else strcpy(*verify,"Illegal. Chose a value");
|
||||
value++; verify++;
|
||||
**verify = 0; /*Initialize verify to NULL*/
|
||||
if(!(*value)) msOpt = 0;
|
||||
if((*value==NULL) || (strcmp(*value,"")==0)) msOpt = 0;
|
||||
else if(strstr(*value,"NMS")) msOpt = 0;
|
||||
else if(strstr(*value,"MS")) msOpt = pvlOptMS;
|
||||
else strcpy(*verify,"Illegal. Chose a value");
|
||||
@@ -2656,14 +2689,14 @@ long dbPutForm(DBENTRY *pdbentry,char **value)
|
||||
**verify = 0;
|
||||
value++; verify++;
|
||||
**verify = 0; /*Initialize verify to NULL*/
|
||||
if(!(*value)) ppOpt = 0;
|
||||
if((*value==NULL) || (strcmp(*value,"")==0)) ppOpt = 0;
|
||||
else if(strstr(*value,"NPP")) ppOpt = 0;
|
||||
else if(strstr(*value,"PP")) ppOpt = pvlOptPP;
|
||||
else if(strstr(*value,"CA")) ppOpt = pvlOptCA;
|
||||
else strcpy(*verify,"Illegal. Chose a value");
|
||||
value++; verify++;
|
||||
**verify = 0; /*Initialize verify to NULL*/
|
||||
if(!(*value)) msOpt = 0;
|
||||
if((*value==NULL) || (strcmp(*value,"")==0)) msOpt = 0;
|
||||
else if(strstr(*value,"NMS")) msOpt = 0;
|
||||
else if(strstr(*value,"MS")) msOpt = pvlOptMS;
|
||||
else strcpy(*verify,"Illegal. Chose a value");
|
||||
@@ -2686,6 +2719,11 @@ long dbPutForm(DBENTRY *pdbentry,char **value)
|
||||
|
||||
pstr = *value;
|
||||
**verify = 0;
|
||||
value++; verify++;
|
||||
**verify = 0; /*Initialize verify to NULL*/
|
||||
if((*value==NULL) || (strcmp(*value,"")==0)) ppOpt = 0;
|
||||
else if(strstr(*value,"CA")) ppOpt = pvlOptCA;
|
||||
else strcpy(*verify,"Illegal. Chose a value");
|
||||
putPvLink(pdbentry,ppOpt|msOpt,pstr);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -34,12 +34,7 @@
|
||||
#define INCdbStaticLibh 1
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <ellLib.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbFldTypes.h>
|
||||
#include <dbBase.h>
|
||||
#include <link.h>
|
||||
@@ -118,6 +113,7 @@ int dbGetNRecdes(DBENTRY *pdbentry);
|
||||
long dbFirstFielddes(DBENTRY *pdbentry,int dctonly);
|
||||
long dbNextFielddes(DBENTRY *pdbentry,int dctonly);
|
||||
char **dbGetChoices(DBENTRY *pdbentry);
|
||||
void dbDumpRecDes(DBBASE *pdbbase,char *recordTypeName);
|
||||
/*End obsolete routines*/
|
||||
|
||||
long dbFindRecordType(DBENTRY *pdbentry,char *recordTypename);
|
||||
@@ -207,6 +203,6 @@ extern int dbStaticDebug;
|
||||
#define S_dbLib_nameLength (M_dbLib|17) /*Record Name is too long*/
|
||||
#define S_dbLib_noRecSup (M_dbLib|19) /*Record support not found*/
|
||||
#define S_dbLib_strLen (M_dbLib|21) /*String is too long*/
|
||||
#define S_dbLib_noSizeOffset (M_dbLib|23) /*Missing SizeOffset Routine*/
|
||||
#define S_dbLib_noSizeOffset (M_dbLib|23) /*Missing SizeOffset Routine - No record support?*/
|
||||
#define S_dbLib_noForm (M_dbLib|25) /*dbAllocForm was not called*/
|
||||
#endif /*INCdbStaticLibh*/
|
||||
|
||||
@@ -164,6 +164,7 @@ int dbIsDefaultValue(DBENTRY *pdbentry)
|
||||
{
|
||||
dbFldDes *pflddes = pdbentry->pflddes;
|
||||
void *pfield = pdbentry->pfield;
|
||||
char *endp;
|
||||
|
||||
if(!pflddes) return(FALSE);
|
||||
switch (pflddes->field_type) {
|
||||
@@ -182,13 +183,19 @@ int dbIsDefaultValue(DBENTRY *pdbentry)
|
||||
case DBF_DOUBLE:
|
||||
case DBF_ENUM:
|
||||
if(!pfield) return(TRUE);
|
||||
if(!pflddes->initial) return(FALSE);
|
||||
if(!pflddes->initial) {
|
||||
if((strtod((char *)pfield,&endp)==0.0) && (*endp=='\0'))
|
||||
return(TRUE);
|
||||
return(FALSE);
|
||||
}
|
||||
return(strcmp((char *)pfield,(char *)pflddes->initial)==0);
|
||||
case DBF_MENU: {
|
||||
unsigned short val,ival;
|
||||
unsigned short val=0;
|
||||
unsigned short ival;
|
||||
|
||||
if(!pfield) return(FALSE);
|
||||
val = *(unsigned short *)pfield;
|
||||
if(pfield) val = *(unsigned short *)pfield;
|
||||
if(!pfield || pflddes->initial == 0)
|
||||
return((val==0)?TRUE:FALSE);
|
||||
if(pflddes->initial == 0) return((val==0)?TRUE:FALSE);
|
||||
sscanf(pflddes->initial,"%hu",&ival);
|
||||
return((val==ival)?TRUE:FALSE);
|
||||
@@ -212,8 +219,12 @@ int dbIsDefaultValue(DBENTRY *pdbentry)
|
||||
|
||||
if(!plink) return(FALSE);
|
||||
if(plink->type!=CONSTANT) return(FALSE);
|
||||
if(plink->value.constantStr == 0) return(TRUE);
|
||||
if(!pflddes->initial) return(FALSE);
|
||||
if(!plink->value.constantStr) return(TRUE);
|
||||
if(!pflddes->initial) {
|
||||
if((strtod((char *)plink->value.constantStr,&endp)==0.0)
|
||||
&& (*endp=='\0')) return(TRUE);
|
||||
return(FALSE);
|
||||
}
|
||||
if(strcmp(plink->value.constantStr,pflddes->initial)==0)
|
||||
return(TRUE);
|
||||
return(FALSE);
|
||||
|
||||
@@ -602,7 +602,7 @@ void dbGetRecordtypeSizeOffset(dbRecordType *pdbRecordType)
|
||||
if (vxstatus != OK) {
|
||||
status = S_dbLib_noSizeOffset;
|
||||
errPrintf(status,__FILE__,__LINE__,"%s",name);
|
||||
taskSuspend(0);
|
||||
return;
|
||||
}
|
||||
sizeOffset(pdbRecordType);
|
||||
}
|
||||
|
||||
@@ -64,8 +64,7 @@ menu_body: '{' choice_list '}'
|
||||
{
|
||||
if(dbStaticDebug>2) printf("menu_body\n");
|
||||
dbMenuBody();
|
||||
}
|
||||
| include ;
|
||||
};
|
||||
|
||||
choice_list: choice_list choice | choice;
|
||||
|
||||
@@ -73,7 +72,8 @@ choice: tokenCHOICE '(' tokenSTRING ',' tokenSTRING ')'
|
||||
{
|
||||
if(dbStaticDebug>2) printf("choice %s %s\n",$3,$5);
|
||||
dbMenuChoice($3,$5);
|
||||
} ;
|
||||
}
|
||||
| include;
|
||||
|
||||
recordtype_head: '(' tokenSTRING ')'
|
||||
{
|
||||
@@ -163,7 +163,17 @@ record_head: '(' tokenSTRING ',' tokenSTRING ')'
|
||||
dbRecordHead($2,$4);
|
||||
};
|
||||
|
||||
record_body: '{' record_field_list '}'
|
||||
record_body: /*Null*/
|
||||
{
|
||||
if(dbStaticDebug>2) printf("null record_body\n");
|
||||
dbRecordBody();
|
||||
}
|
||||
| '{' '}'
|
||||
{
|
||||
if(dbStaticDebug>2) printf("record_body - no fields\n");
|
||||
dbRecordBody();
|
||||
}
|
||||
| '{' record_field_list '}'
|
||||
{
|
||||
if(dbStaticDebug>2) printf("record_body\n");
|
||||
dbRecordBody();
|
||||
|
||||
@@ -52,6 +52,9 @@
|
||||
* .01 1-04-96 rc Created using existing Allen Bradley device
|
||||
* support as a model
|
||||
* .02 6-17-96 rc Mods to make -Wall -pedantic not complain
|
||||
* .03 7-30-96 rc Changed alarm severity reporting in Hstp1Write
|
||||
* .04 10-09-96 rc/saa Fix bug when there's no hardware and remove
|
||||
* HW limit alarm.
|
||||
* ...
|
||||
*/
|
||||
|
||||
@@ -304,7 +307,7 @@
|
||||
#define HSTP1_K_SCANDELAY (sysClkRateGet () / 3)
|
||||
|
||||
#define VELOCITY 0 /* From recSteppermotor.c */
|
||||
#define POSITION 1 /* " */
|
||||
#define POSITION 1 /* " " */
|
||||
|
||||
/* Create the dsets*/
|
||||
static long report (int);
|
||||
@@ -1200,10 +1203,6 @@ static void StateCmdRead (Hstp1Pvt *hstp1,
|
||||
{
|
||||
recGblSetSevr (hstp1->rec, UDF_ALARM, INVALID_ALARM);
|
||||
}
|
||||
else if (cmd->status[0] & HSTP1_M_INPERRS)
|
||||
{
|
||||
recGblSetSevr (hstp1->rec, HW_LIMIT_ALARM, MAJOR_ALARM);
|
||||
}
|
||||
else if (cmd->status[0] & HSTP1_M_CMDERR)
|
||||
{
|
||||
recGblSetSevr (hstp1->rec, WRITE_ALARM, MINOR_ALARM);
|
||||
@@ -1320,8 +1319,11 @@ static int Hstp1Write (Hstp1Pvt *hstp1,
|
||||
/* If not queued within the timeout period, indicate error */
|
||||
if (status != abBtqueued)
|
||||
{
|
||||
unsigned short severity = INVALID_ALARM;
|
||||
|
||||
Dbg (Printf (FN, "btWrite failed with %s", abStatusMessage[status]));
|
||||
recGblSetSevr (hstp1->rec, WRITE_ALARM, MAJOR_ALARM);
|
||||
if ((status == abBusy) || (status == abTimeout)) severity = MAJOR_ALARM;
|
||||
recGblSetSevr (hstp1->rec, WRITE_ALARM, severity);
|
||||
semGive (hstp1->allocSem);
|
||||
return (ERROR);
|
||||
}
|
||||
@@ -1595,9 +1597,16 @@ static long report (int level)
|
||||
*/
|
||||
{
|
||||
Hstp1Blk *hstp1Blk = Hstp1;
|
||||
register Hstp1Pvt *hstp1 = (Hstp1Pvt *) lstFirst (&hstp1Blk->scanLst);
|
||||
register Hstp1Pvt *hstp1;
|
||||
|
||||
|
||||
if (hstp1Blk == 0)
|
||||
{
|
||||
epicsPrintf ("AB-1746HSTP1 card(s) not initialized\n");
|
||||
return (0);
|
||||
}
|
||||
hstp1 = (Hstp1Pvt *) lstFirst (&hstp1Blk->scanLst);
|
||||
|
||||
while (hstp1)
|
||||
{
|
||||
struct abio *abio = (struct abio *) &(hstp1->rec->out.value);
|
||||
@@ -1700,4 +1709,3 @@ static int Hstp1Printf (const char *fn, char *fmt, ...)
|
||||
va_start (var, fmt);
|
||||
return (epicsVprintf (fmtBuf, var));
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ SRCS.c += ../drvHpe1445a.c
|
||||
SRCS.c += ../drvKscV215.c
|
||||
SRCS.c += ../drvMz8310.c
|
||||
SRCS.c += ../drvStc.c
|
||||
SRCS.c += ../drvTime.c
|
||||
#SRCS.c += ../drvCaenV265.c
|
||||
|
||||
SRCS.c += ../drvVipc310.c
|
||||
|
||||
@@ -473,7 +473,7 @@ LOCAL mz8310Stat mz8310_read_test(unsigned card, unsigned channel)
|
||||
mz8310Stat mz8310_one_shot(
|
||||
unsigned preset, /* TRUE or COMPLEMENT logic */
|
||||
double edge0_delay, /* sec */
|
||||
double edge1_delay, /* set */
|
||||
double edge1_delay, /* sec */
|
||||
unsigned card, /* 0 through ... */
|
||||
unsigned channel, /* 0 through channels on a card */
|
||||
unsigned int_source, /* (FALSE)External/ (TRUE)Internal source */
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include <vxWorks.h>
|
||||
#include <stdioLib.h>
|
||||
#include <vxLib.h>
|
||||
#include <taskLib.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <drvSup.h>
|
||||
@@ -286,5 +287,29 @@ unsigned int_source
|
||||
return STC_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* stcWriteData()
|
||||
*/
|
||||
void stcWriteData(volatile uint16_t *pdata, uint16_t data)
|
||||
{
|
||||
*pdata = data;
|
||||
}
|
||||
|
||||
/*
|
||||
* stcReadData()
|
||||
*/
|
||||
uint16_t stcReadData(volatile uint16_t *pdata)
|
||||
{
|
||||
uint16_t data;
|
||||
data = *pdata;
|
||||
return data;
|
||||
}
|
||||
|
||||
/*
|
||||
* stcWriteCmd()
|
||||
*/
|
||||
void stcWriteCmd(volatile uint8_t *pcmd, uint8_t cmd)
|
||||
{
|
||||
*pcmd = cmd;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,23 +45,28 @@
|
||||
#define CHIPCHAN (channel%CHANONCHIP)
|
||||
#define CHIPNUM (channel/CHANONCHIP)
|
||||
|
||||
#define STC_RESET *pcmd = 0xffU
|
||||
#define STC_BUS16 *pcmd = 0xefU
|
||||
#define STC_SET_MASTER_MODE(D) {*pcmd = 0x17U; *pdata=(D);}
|
||||
#define STC_MASTER_MODE (*pcmd = 0x17U, *pdata)
|
||||
#define STC_RESET stcWriteCmd(pcmd,0xffU);
|
||||
#define STC_BUS16 stcWriteCmd(pcmd,0xefU);
|
||||
#define STC_BUS16 stcWriteCmd(pcmd,0xefU);
|
||||
#define STC_SET_MASTER_MODE(D) {stcWriteCmd(pcmd,0x17U); \
|
||||
stcWriteData(pdata,(D));}
|
||||
#define STC_MASTER_MODE (stcWriteCmd(pcmd,0x17U), stcReadData(pdata))
|
||||
|
||||
#define STC_CTR_INIT(MODE,LOAD,HOLD)\
|
||||
{*pcmd = CHIPCHAN+1; *pdata = (MODE); *pdata = (LOAD); *pdata= (HOLD);}
|
||||
{stcWriteCmd(pcmd,CHIPCHAN+1); stcWriteData(pdata,(MODE)); \
|
||||
stcWriteData(pdata,(LOAD)); stcWriteData(pdata,(HOLD));}
|
||||
|
||||
#define STC_CTR_READ(MODE,LOAD,HOLD)\
|
||||
{*pcmd = CHIPCHAN+1; (MODE) = *pdata; (LOAD) = *pdata; (HOLD) = *pdata;}
|
||||
{stcWriteCmd(pcmd,CHIPCHAN+1); (MODE) = stcReadData(pdata); \
|
||||
(LOAD) = stcReadData(pdata); (HOLD) = stcReadData(pdata);}
|
||||
|
||||
#define STC_SET_TC(D) *pcmd = 0xe0U | ((D)?8:0)|(CHIPCHAN+1U)
|
||||
#define STC_SET_TC(D) stcWriteCmd(pcmd, \
|
||||
0xe0U | ((D)?8:0)|(CHIPCHAN+1U) )
|
||||
|
||||
#define STC_LOAD *pcmd = 0x40U | 1<<(CHIPCHAN)
|
||||
#define STC_STEP *pcmd = 0xf0U | (CHIPCHAN+1U)
|
||||
#define STC_ARM *pcmd = 0x20U | 1<<CHIPCHAN
|
||||
#define STC_DISARM *pcmd = 0xc0U | 1<<CHIPCHAN
|
||||
#define STC_LOAD stcWriteCmd(pcmd, 0x40U | 1<<(CHIPCHAN))
|
||||
#define STC_STEP stcWriteCmd(pcmd, 0xf0U | (CHIPCHAN+1U))
|
||||
#define STC_ARM stcWriteCmd(pcmd, 0x20U | 1<<CHIPCHAN)
|
||||
#define STC_DISARM stcWriteCmd(pcmd, 0xc0U | 1<<CHIPCHAN)
|
||||
|
||||
|
||||
|
||||
@@ -105,3 +110,7 @@ unsigned channel,
|
||||
unsigned int_source
|
||||
);
|
||||
|
||||
void stcWriteData(volatile uint16_t *pdata, uint16_t data);
|
||||
uint16_t stcReadData(volatile uint16_t *pdata);
|
||||
void stcWriteCmd(volatile uint8_t *pcmd, uint8_t cmd);
|
||||
|
||||
|
||||
@@ -1,250 +0,0 @@
|
||||
/* drvTime.c */
|
||||
/* base/src/drv $Id$ */
|
||||
/* Glue between timing_drivers and the GTA database
|
||||
* Author: Jeff Hill
|
||||
* Date: Feb 89
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos Natjonal Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* joh 02-20-89 Init Release
|
||||
* joh 11-16-89 added vxi timing
|
||||
* bg 11-18-91 added time_io_report
|
||||
* bg 02-24-91 added levels to time_io_report.
|
||||
* bg 06-26-92 Combined time_driver.c and drvTime.c
|
||||
* joh 08-05-92 removed report & init routines
|
||||
*/
|
||||
|
||||
static char *sccsID = "@(#)drvTime.c 1.10\t9/9/93";
|
||||
|
||||
/* drvTime.c - Driver Support Routines for Time */
|
||||
#include <vxWorks.h>
|
||||
#include <logLib.h>
|
||||
|
||||
#include <module_types.h>
|
||||
#include <epicsPrint.h>
|
||||
|
||||
#include <drvMz8310.h>
|
||||
#include <drvAt5Vxi.h>
|
||||
|
||||
struct pulse{
|
||||
double offset;
|
||||
double width;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* time_driver_read()
|
||||
*
|
||||
*
|
||||
*/
|
||||
int time_driver_read
|
||||
(
|
||||
card, /* 0 through ... */
|
||||
channel, /* 0 through chans on card */
|
||||
card_type, /* module type as stored in GTA DB */
|
||||
int_source, /* (TRUE)External/ (FALSE)Internal source */
|
||||
preset, /* TRUE or COMPLEMENT logic */
|
||||
pulses, /* ptr to array of structure describing pulses */
|
||||
npulses, /* N elements found */
|
||||
npulmax /* N elements in the caller's array */
|
||||
)
|
||||
unsigned card;
|
||||
unsigned channel;
|
||||
unsigned card_type;
|
||||
unsigned *int_source;
|
||||
unsigned *preset;
|
||||
struct pulse *pulses;
|
||||
unsigned *npulses;
|
||||
unsigned npulmax;
|
||||
{
|
||||
int status;
|
||||
|
||||
*npulses=0;
|
||||
|
||||
switch(card_type){
|
||||
case MZ8310:
|
||||
if(npulmax<1)
|
||||
return ERROR;
|
||||
status = mz8310_one_shot_read (
|
||||
preset,
|
||||
&pulses->offset,
|
||||
&pulses->width,
|
||||
card,
|
||||
channel,
|
||||
int_source
|
||||
);
|
||||
if(status==0)
|
||||
*npulses=1;
|
||||
|
||||
return status;
|
||||
case VXI_AT5_TIME:
|
||||
if(npulmax<1)
|
||||
return ERROR;
|
||||
status = at5vxi_one_shot_read (
|
||||
preset,
|
||||
&pulses->offset,
|
||||
&pulses->width,
|
||||
card,
|
||||
channel,
|
||||
int_source
|
||||
);
|
||||
if(status==0)
|
||||
*npulses=1;
|
||||
|
||||
return status;
|
||||
case DG535:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
epicsPrintf("time_driver: No support for that type of timing card\n");
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
||||
int time_driver (
|
||||
card, /* 0 through ... */
|
||||
channel, /* 0 through chans on card */
|
||||
card_type, /* module type as stored in GTA DB */
|
||||
int_source, /* (TRUE)External/ (FALSE)Internal source */
|
||||
preset, /* TRUE or COMPLEMENT logic */
|
||||
pulses, /* ptr to array of structure describing pulses */
|
||||
npulses, /* N elements in this array */
|
||||
eventrtn, /* routine to run on events */
|
||||
eventrtnarg /* argument to above rtn */
|
||||
)
|
||||
unsigned int card;
|
||||
unsigned int channel;
|
||||
unsigned int card_type;
|
||||
unsigned int int_source;
|
||||
int preset;
|
||||
struct pulse *pulses;
|
||||
unsigned int npulses;
|
||||
void (*eventrtn)(void *pParam);
|
||||
void *eventrtnarg;
|
||||
{
|
||||
|
||||
switch(card_type){
|
||||
case MZ8310:
|
||||
if(npulses != 1)
|
||||
return ERROR;
|
||||
return mz8310_one_shot (
|
||||
preset,
|
||||
pulses->offset,
|
||||
pulses->width,
|
||||
card,
|
||||
channel,
|
||||
int_source,
|
||||
eventrtn,
|
||||
eventrtnarg
|
||||
);
|
||||
case VXI_AT5_TIME:
|
||||
if(npulses != 1)
|
||||
return ERROR;
|
||||
return at5vxi_one_shot (
|
||||
preset,
|
||||
pulses->offset,
|
||||
pulses->width,
|
||||
card,
|
||||
channel,
|
||||
int_source,
|
||||
eventrtn,
|
||||
eventrtnarg
|
||||
);
|
||||
case DG535:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
epicsPrintf("time_driver: No support for that type of timing card\n");
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int time_test()
|
||||
{
|
||||
unsigned int card=0;
|
||||
unsigned int channel=0;
|
||||
unsigned int card_type=MZ8310;
|
||||
unsigned int int_source=1;
|
||||
int preset=1;
|
||||
static struct
|
||||
pulse pulses={.00001,.00001};
|
||||
unsigned int npulses = 1;
|
||||
|
||||
unsigned int t_int_source;
|
||||
int t_preset;
|
||||
struct pulse t_pulses;
|
||||
unsigned int t_npulses;
|
||||
|
||||
int status;
|
||||
|
||||
status =
|
||||
time_driver (
|
||||
card, /* 0 through ... */
|
||||
channel, /* 0 through chans on card */
|
||||
card_type, /* module type as stored in GTA DB */
|
||||
int_source, /* (TRUE)External/ (FALSE)Internal source */
|
||||
preset, /* TRUE or COMPLEMENT logic */
|
||||
&pulses, /* ptr to array of structure describing pulses */
|
||||
npulses, /* N elements in this array */
|
||||
NULL, /* routine to run on events */
|
||||
NULL /* argument to above rtn */
|
||||
);
|
||||
if(status==ERROR)
|
||||
return ERROR;
|
||||
|
||||
|
||||
status =
|
||||
time_driver_read(
|
||||
card, /* 0 through ... */
|
||||
channel, /* 0 through chans on card */
|
||||
card_type, /* module type as stored in GTA DB */
|
||||
&t_int_source, /* (TRUE)External/ (FALSE)Internal source */
|
||||
&t_preset, /* TRUE or COMPLEMENT logic */
|
||||
&t_pulses, /* ptr to array of structure describing pulses */
|
||||
&t_npulses, /* N elements found */
|
||||
1 /* max N elements in this array */
|
||||
);
|
||||
if(status==ERROR)
|
||||
return ERROR;
|
||||
|
||||
|
||||
epicsPrintf( "wrote: preset %x internal-clk %x delay %f width %f \n",
|
||||
preset,
|
||||
int_source,
|
||||
pulses.offset,
|
||||
pulses.width);
|
||||
epicsPrintf( "read: preset %x internal-clk %x delay %f width %f count %x\n",
|
||||
t_preset,
|
||||
t_int_source,
|
||||
t_pulses.offset,
|
||||
t_pulses.width,
|
||||
t_npulses);
|
||||
return OK;
|
||||
}
|
||||
@@ -5,6 +5,9 @@
|
||||
# $Id$
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.11 1996/07/24 22:47:29 jhill
|
||||
# removed OPTIM_YES=-g which caused link fail
|
||||
#
|
||||
# Revision 1.10 1996/07/23 17:13:29 jbk
|
||||
# various fixes - dbmapper incorrectly worked with enum types
|
||||
#
|
||||
@@ -45,7 +48,7 @@
|
||||
# *Revision 1.1 1996/05/31 13:15:14 jbk
|
||||
# *add new stuff
|
||||
|
||||
VPATH=.:..
|
||||
VPATH=..
|
||||
|
||||
TOP= ../../..
|
||||
# EPICS = /usr/local/epics/R3.12.2
|
||||
@@ -109,6 +112,6 @@ genApps: genApps.o $(MY_OBJS)
|
||||
$(LINK.cc) -o $@ $^ $(LDLIBS)
|
||||
|
||||
clean::
|
||||
/bin/rm -f aitConvertGenerated.cc aitGen genApps
|
||||
$(RM) -f aitConvertGenerated.cc aitGen genApps
|
||||
|
||||
|
||||
|
||||
72
src/gdd/Makefile.regular
Normal file
72
src/gdd/Makefile.regular
Normal file
@@ -0,0 +1,72 @@
|
||||
|
||||
# Author: Jim Kowalkowski
|
||||
# Date: 9/9/96
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# $Log$
|
||||
#
|
||||
|
||||
DEPENDS_FLAG = -M # -xM
|
||||
CCFLAGS = -g -DGDDAUTOPRINT
|
||||
CXXFLAGS = $(CCFLAGS)
|
||||
CFLAGS = $(CCFLAGS)
|
||||
# CCC=purify CC
|
||||
# CC=purify cc
|
||||
|
||||
AR = ar
|
||||
|
||||
SRCS = aitGen.c aitTypes.c aitHelpers.cc \
|
||||
gdd.cc gddAppDefs.cc gddAppTable.cc gddNewDel.cc \
|
||||
gddTest.cc genApps.cc
|
||||
|
||||
MY_OBJS = gdd.o gddTest.o gddAppTable.o gddNewDel.o gddAppDefs.o \
|
||||
aitTypes.o aitConvert.o aitHelpers.o
|
||||
|
||||
LIBOBJS = $(MY_OBJS) dbMapper.o
|
||||
LIBNAME = libgdd.a
|
||||
|
||||
all: $(LIBNAME) dbMapper.o
|
||||
|
||||
$(LIBNAME): $(LIBOBJS)
|
||||
$(AR) r $(LIBNAME) $@
|
||||
|
||||
# cannot generate dependencies for aitConvert automatically
|
||||
|
||||
gdd.o: gdd.cc
|
||||
gddTest.o: gddTest.cc
|
||||
gddAppTable.o: gddAppTable.cc
|
||||
gddAppDefs.o: gddAppDefs.cc
|
||||
gddNewDel.o: gddNewDel.cc
|
||||
aitHelpers.o: aitHelpers.cc
|
||||
aitTypes.o: aitTypes.c
|
||||
aitConvert.o: aitConvert.cc aitConvert.h aitConvertGenerated.cc aitTypes.h
|
||||
|
||||
aitConvertGenerated.cc: aitGen aitTypes.h
|
||||
./aitGen
|
||||
|
||||
aitGen: aitGen.o aitTypes.o
|
||||
$(LINK.c) -o $@ $^ $(LDLIBS)
|
||||
|
||||
# cannot generate dependencies for dbMapper.o automatically
|
||||
|
||||
dbMapper.o: dbMapper.cc gdd.h gddAppTable.h dbMapper.h gddApps.h aitTypes.h
|
||||
$(COMPILE.cc) -I$(HOME)/include $<
|
||||
$(AR) r $(LIBNAME) $@
|
||||
|
||||
gddApps.h: genApps
|
||||
./genApps $@
|
||||
|
||||
genApps: genApps.o $(MY_OBJS)
|
||||
$(LINK.cc) -o $@ $^ $(LDLIBS)
|
||||
|
||||
depends:
|
||||
-$(COMPILE.cc) $(DEPENDS_FLAG) $(SRCS) >> .DEPENDS
|
||||
|
||||
clean:
|
||||
/bin/rm -f aitConvertGenerated.cc aitGen genApps *.o *.a
|
||||
|
||||
.DEPENDS:
|
||||
touch .DEPENDS
|
||||
|
||||
include .DEPENDS
|
||||
@@ -4,6 +4,9 @@
|
||||
// $Id$
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.13 1996/08/23 20:29:35 jbk
|
||||
// completed fixes for the aitString and fixed string management
|
||||
//
|
||||
// Revision 1.12 1996/08/22 21:05:43 jbk
|
||||
// More fixes to make strings and fixed string work better.
|
||||
//
|
||||
@@ -113,7 +116,7 @@ gddDbrToAitTable gddDbrToAit[] = {
|
||||
{ aitEnumInt32, 0, "value" },
|
||||
{ aitEnumFloat64, 0, "value" },
|
||||
// Graphic
|
||||
{ aitEnumFixedString, 0, "dbr_gr_string" },
|
||||
{ aitEnumFixedString, 0, "value" },
|
||||
{ aitEnumInt16, 0, "dbr_gr_short" },
|
||||
{ aitEnumFloat32, 0, "dbr_gr_float" },
|
||||
{ aitEnumEnum16, 0, "dbr_gr_enum" },
|
||||
@@ -121,7 +124,7 @@ gddDbrToAitTable gddDbrToAit[] = {
|
||||
{ aitEnumInt32, 0, "dbr_gr_long" },
|
||||
{ aitEnumFloat64, 0, "dbr_gr_double" },
|
||||
// control
|
||||
{ aitEnumFixedString, 0, "dbr_ctrl_string" },
|
||||
{ aitEnumFixedString, 0, "value" },
|
||||
{ aitEnumInt16, 0, "dbr_ctrl_short" },
|
||||
{ aitEnumFloat32, 0, "dbr_ctrl_float" },
|
||||
{ aitEnumEnum16, 0, "dbr_ctrl_enum" },
|
||||
@@ -169,7 +172,7 @@ static int mapGddToString(void* v, gdd* dd) {
|
||||
dbx=(aitFixedString*)dd->dataPointer();
|
||||
|
||||
int len = dd->getDataSizeElements();
|
||||
if(dbx!=db) dd->get(db);
|
||||
if(dbx!=db) dd->get(*db);
|
||||
return len;
|
||||
}
|
||||
|
||||
@@ -380,7 +383,7 @@ static int mapStsGddToString(void* v, gdd* dd)
|
||||
dbx=(aitFixedString*)dd->dataPointer();
|
||||
|
||||
// copy string into user buffer for now if not the same as one in gdd
|
||||
if(dbx!=dbv) dd->get(dbv);
|
||||
if(dbx!=dbv) dd->get(*dbv);
|
||||
dd->getStatSevr(db->status,db->severity);
|
||||
return dd->getDataSizeElements();
|
||||
}
|
||||
@@ -521,7 +524,7 @@ static int mapTimeGddToString(void* v, gdd* dd)
|
||||
else
|
||||
dbx=(aitFixedString*)dd->dataPointer();
|
||||
|
||||
if(dbv!=dbx) dd->get(dbv);
|
||||
if(dbv!=dbx) dd->get(*dbv);
|
||||
|
||||
dd->getStatSevr(db->status,db->severity);
|
||||
dd->getTimeStamp((aitTimeStamp*)&db->stamp);
|
||||
|
||||
BIN
src/gdd/gdd.gif
Normal file
BIN
src/gdd/gdd.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.3 KiB |
@@ -8,6 +8,12 @@
|
||||
* $Id$
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.14 1996/09/07 13:03:05 jbk
|
||||
* fixes to destroyData function
|
||||
*
|
||||
* Revision 1.13 1996/09/04 22:47:09 jhill
|
||||
* allow vxWorks 5.1 and gnu win 32
|
||||
*
|
||||
* Revision 1.12 1996/08/27 13:05:06 jbk
|
||||
* final repairs to string functions, put() functions, and error code printing
|
||||
*
|
||||
@@ -734,7 +740,7 @@ inline gddStatus gdd::unreference(void)
|
||||
{
|
||||
// managed dd always destroys the entire thing
|
||||
ref_cnt=1;
|
||||
if(destruct) destruct->run(this);
|
||||
if(destruct) destruct->destroy(this);
|
||||
destruct=NULL;
|
||||
}
|
||||
else if(!isFlat())
|
||||
@@ -749,9 +755,12 @@ inline void gdd::destroyData(void)
|
||||
{
|
||||
// up to destructor to free the bounds
|
||||
if(isContainer())
|
||||
destruct->run(this);
|
||||
destruct->destroy(this);
|
||||
else
|
||||
destruct->run(dataPointer());
|
||||
destruct->destroy(dataPointer());
|
||||
|
||||
destruct=NULL;
|
||||
setData(NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -972,49 +981,81 @@ inline gddStatus gdd::put(aitType* d) {
|
||||
|
||||
// ---------------------get(pointer) functions--------------------------
|
||||
inline void gdd::get(void* d) {
|
||||
aitConvert(primitiveType(),d,primitiveType(),dataPointer(),
|
||||
getDataSizeElements());
|
||||
if(isScalar())
|
||||
aitConvert(primitiveType(),d,primitiveType(),dataAddress(),1);
|
||||
else
|
||||
aitConvert(primitiveType(),d,primitiveType(),dataPointer(),
|
||||
getDataSizeElements());
|
||||
}
|
||||
inline void gdd::get(void* d,aitEnum e) {
|
||||
aitConvert(e,d,primitiveType(),dataPointer(),
|
||||
getDataSizeElements());
|
||||
if(isScalar())
|
||||
aitConvert(e,d,primitiveType(),dataAddress(),1);
|
||||
else
|
||||
aitConvert(e,d,primitiveType(),dataPointer(),getDataSizeElements());
|
||||
}
|
||||
inline void gdd::get(aitFloat64* d)
|
||||
{
|
||||
aitConvert(aitEnumFloat64,d,primitiveType(),dataPointer(),
|
||||
getDataSizeElements());
|
||||
if(isScalar())
|
||||
aitConvert(aitEnumFloat64,d,primitiveType(),dataAddress(),1);
|
||||
else
|
||||
aitConvert(aitEnumFloat64,d,primitiveType(),dataPointer(),
|
||||
getDataSizeElements());
|
||||
}
|
||||
inline void gdd::get(aitFloat32* d) {
|
||||
aitConvert(aitEnumFloat32,d,primitiveType(),dataPointer(),
|
||||
getDataSizeElements());
|
||||
if(isScalar())
|
||||
aitConvert(aitEnumFloat32,d,primitiveType(),dataAddress(),1);
|
||||
else
|
||||
aitConvert(aitEnumFloat32,d,primitiveType(),dataPointer(),
|
||||
getDataSizeElements());
|
||||
}
|
||||
inline void gdd::get(aitUint32* d) {
|
||||
aitConvert(aitEnumUint32,d,primitiveType(),dataPointer(),
|
||||
getDataSizeElements());
|
||||
if(isScalar())
|
||||
aitConvert(aitEnumUint32,d,primitiveType(),dataAddress(),1);
|
||||
else
|
||||
aitConvert(aitEnumUint32,d,primitiveType(),dataPointer(),
|
||||
getDataSizeElements());
|
||||
}
|
||||
inline void gdd::get(aitInt32* d) {
|
||||
aitConvert(aitEnumInt32,d,primitiveType(),dataPointer(),
|
||||
getDataSizeElements());
|
||||
if(isScalar())
|
||||
aitConvert(aitEnumInt32,d,primitiveType(),dataAddress(),1);
|
||||
else
|
||||
aitConvert(aitEnumInt32,d,primitiveType(),dataPointer(),
|
||||
getDataSizeElements());
|
||||
}
|
||||
inline void gdd::get(aitUint16* d) {
|
||||
aitConvert(aitEnumUint16,d,primitiveType(),dataPointer(),
|
||||
getDataSizeElements());
|
||||
if(isScalar())
|
||||
aitConvert(aitEnumUint16,d,primitiveType(),dataAddress(),1);
|
||||
else
|
||||
aitConvert(aitEnumUint16,d,primitiveType(),dataPointer(),
|
||||
getDataSizeElements());
|
||||
}
|
||||
inline void gdd::get(aitInt16* d) {
|
||||
aitConvert(aitEnumInt16,d,primitiveType(),dataPointer(),
|
||||
getDataSizeElements());
|
||||
if(isScalar())
|
||||
aitConvert(aitEnumInt16,d,primitiveType(),dataAddress(),1);
|
||||
else
|
||||
aitConvert(aitEnumInt16,d,primitiveType(),dataPointer(),
|
||||
getDataSizeElements());
|
||||
}
|
||||
inline void gdd::get(aitUint8* d) {
|
||||
aitConvert(aitEnumUint8,d,primitiveType(),dataPointer(),
|
||||
getDataSizeElements());
|
||||
if(isScalar())
|
||||
aitConvert(aitEnumUint8,d,primitiveType(),dataAddress(),1);
|
||||
else
|
||||
aitConvert(aitEnumUint8,d,primitiveType(),dataPointer(),
|
||||
getDataSizeElements());
|
||||
}
|
||||
inline void gdd::get(aitString* d) {
|
||||
aitConvert(aitEnumString,d,primitiveType(),dataPointer(),
|
||||
getDataSizeElements());
|
||||
if(isScalar())
|
||||
aitConvert(aitEnumString,d,primitiveType(),dataAddress(),1);
|
||||
else
|
||||
aitConvert(aitEnumString,d,primitiveType(),dataPointer(),
|
||||
getDataSizeElements());
|
||||
}
|
||||
inline void gdd::get(aitFixedString* d) {
|
||||
aitConvert(aitEnumFixedString,d,primitiveType(),dataPointer(),
|
||||
getDataSizeElements());
|
||||
if(isScalar())
|
||||
aitConvert(aitEnumFixedString,d,primitiveType(),dataAddress(),1);
|
||||
else
|
||||
aitConvert(aitEnumFixedString,d,primitiveType(),dataPointer(),
|
||||
getDataSizeElements());
|
||||
}
|
||||
|
||||
// special case for string scalar to aitInt8 array!
|
||||
|
||||
169
src/gdd/gdd.html
Normal file
169
src/gdd/gdd.html
Normal file
@@ -0,0 +1,169 @@
|
||||
<TITLE>GDD User's Guide</TITLE>
|
||||
<HR><P><img src="gdd.gif">
|
||||
<P><H1>General Data Descriptor Library User's Guide</H1>
|
||||
|
||||
<HR><H2>General Overview</H2>
|
||||
The purpose of the General Data Descriptor Library (GDD library) is to
|
||||
fully describe, hold, and manage scalar and array data. Using a GDD,
|
||||
you can describe a piece of data's type, dimensionality, and structure.
|
||||
In addition you can identify the data with an integer application type value
|
||||
which can be translated into a text string. A user can store data into and
|
||||
retreived data from a GDD in any desired data type. A GDD can contain
|
||||
a list of GDDs. This allows users to create and describe hierarchical
|
||||
data structures dynamically. GDD organized in this fashion are known
|
||||
as containers.
|
||||
<P>
|
||||
As mentioned above, a GDD can describe an n-dimension array. The user
|
||||
can describe the bounds of the n-dimensional array. To facilitate the
|
||||
use of large, and perhaps shared data arrays, a GDD allows a user to
|
||||
store a reference to an array of data. In addition, a destructor function
|
||||
can be registed in the GDD to inform the owner of the data array when
|
||||
the GDD referencing the data goes away. The purpose of the destructor
|
||||
function is to delete the array of data, since the GDD does not know
|
||||
what to do with referenced data.
|
||||
<P>
|
||||
To manage GDDs in a multi-tasking system or a system that
|
||||
uses many layers of software, GDDs implement reference counting. With
|
||||
reference counting, only one copy of GDD can be shared by many subsystems.
|
||||
The GDD creator function can pass it to many other functions without
|
||||
worrying about deleting it, when the last function using the GDD requests
|
||||
that it be destroyed does it really go away.
|
||||
<P>
|
||||
As menitioned above, a GDD allows the user to describe the data in terms
|
||||
of the application. This is done by the user by assigning an arbitrary
|
||||
integer identifier to a GDD. The user places a meaning on the identifiers
|
||||
such as 1=high-alarm-limit, 2=low-alarm-limit. This identifier is termed
|
||||
application type. A second component of the GDD library known as the
|
||||
Application Type Table is used to manage the application type identifiers.
|
||||
Application type values are registered in the table along with a text
|
||||
string and optionally a prototype GDD. The prototype GDD can be a
|
||||
container GDD. The table allows users to retreive GDDs of a specific
|
||||
application type.
|
||||
<P>
|
||||
A GDD describe and manages a piece of data using the following information:
|
||||
<P>
|
||||
<UL>
|
||||
<LI>Application Type (user assigned integer value)
|
||||
<LI>Primitive Type (storage type identifier - int/double/short/etc.)
|
||||
<LI>Dimension (of array data)
|
||||
<LI>Bounds (array data structure information)
|
||||
<LI>Destructor (to delete referenced array data)
|
||||
<LI>Time Stamp (last time updated)
|
||||
<LI>Status (user assign data status field)
|
||||
<LI>Reference Count
|
||||
<LI>Data Field
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
The GDD library is a C++ class library and therefore requires using the
|
||||
C++ compiler.
|
||||
|
||||
<HR><H2>Creating and Using a GDD</H2>
|
||||
The gdd class is the main class in the GDD library. It controls almost
|
||||
all actions perfomed on the data. The gdd class is further broken down
|
||||
into three subclasses for performing operations are specific types of GDDs:
|
||||
gddContainer, gddAtomic, and gddScalar. The gddContainer class aids in the
|
||||
creation of container type GDDs. It adds functions such as "insert GDD",
|
||||
"remove GDD", and "give me GDD x from the container" to the basic gdd class.
|
||||
The gddAtomic class helps create and manage array data GDDs. The gddScalar
|
||||
class makes it easy to create scalar GDDs.
|
||||
<P>
|
||||
All GDDs must be created dynamically, <B>a GDD cannot be created on the
|
||||
stack</B> as a local variable. The gdd class forbids the user from deleting
|
||||
the gdd. In order for referencing counting to work correctly the <B>user must
|
||||
"unreference" the gdd instance instead of delete it</B>. The gdd class does
|
||||
take over the memory management routines for itself and all it's subclass.
|
||||
This means that you are not using the malloc()/free() memory management when
|
||||
GDDs are created and destroyed. It is important to remember that since
|
||||
reference counting is used, <B>a GDD passed into a function must be referenced
|
||||
before the function returns if the GDD is to be kept </B>for longer then the
|
||||
running of that function. In other words, if you are creating a library
|
||||
function "add" that records process variable names in a linked list, and the
|
||||
process variable names are passed to you as GDDs, then you must reference
|
||||
the GDD since the linked list exists after the return of the "add" function.
|
||||
If you are creating a GDD, you must unreference it when you are finished
|
||||
with it, even it you have passed it into other library functions.
|
||||
Generalizing on this, <B>it is the responsibility of the GDD creator or
|
||||
GDD referencer to unreference the GDD instance</B> when they are finished
|
||||
with it.
|
||||
<P>
|
||||
<HR><H3>Primitive Types</H3>
|
||||
As mentioned in the overview, a piece of descriptive information that a
|
||||
GDD maintains is the and primitive type code. This field
|
||||
describes the format of the data (storage type).
|
||||
The primitive type field of a GDD is an enumeration
|
||||
of all the general storage types supported by the compilers. A user can
|
||||
determine dynamically what the storage format of the data in a GDD is using
|
||||
the primitive type code information. The GDD library redefines the general
|
||||
storage class names for integers and floating point numbers and enumerates
|
||||
them in the "aitTypes.h" header file. The redefined names describe the
|
||||
format and the bit length so that they can be used across architectures.
|
||||
The initial part of the header file name "aitTypes.h" is ait which
|
||||
stands for "Architecture Independant Types". The standard data types
|
||||
supported by the GDD library are
|
||||
<PRE>
|
||||
aitInt8 8 bit character
|
||||
aitUint8 8 bit unsigned character
|
||||
aitInt16 16 bit short
|
||||
aitUint16 16 bit unsigned short
|
||||
aitEnum16 16 enumerated value
|
||||
aitInt32 32 bit integer
|
||||
aitUint32 32 bit unsigned integer
|
||||
aitFloat32 32 bit floating point number
|
||||
aitFloat64 64 bit floating point number
|
||||
aitPointer Standard pointer
|
||||
aitIndex 32 bit index value
|
||||
aitStatus 32 bit unsigned integer for status value
|
||||
aitFixedString 40 byte string of characters
|
||||
aitString Variable length string data type
|
||||
aitTimeStamp Two 32 bit integers describing time (seconds/nanoseconds)
|
||||
</PRE>
|
||||
These data types should be used whenever possible to prevent problems when
|
||||
compiling programs for different architectures. Most of they data types
|
||||
are enumerated as descrived above for use as a primitive type code. The
|
||||
enumerated names are just the above type names with the word "Enum"
|
||||
inserted after "ait". It should be noted that aitTimeStamp is not a
|
||||
standard primitive type.
|
||||
<PRE>
|
||||
typedef enum {
|
||||
aitEnumInvalid=0,
|
||||
aitEnumInt8,
|
||||
aitEnumUint8,
|
||||
aitEnumInt16,
|
||||
aitEnumUint16,
|
||||
aitEnumEnum16,
|
||||
aitEnumInt32,
|
||||
aitEnumUint32,
|
||||
aitEnumFloat32,
|
||||
aitEnumFloat64,
|
||||
aitEnumFixedString,
|
||||
aitEnumString,
|
||||
aitEnumContainer
|
||||
} aitEnum;
|
||||
</PRE>
|
||||
The enumerated type code allows a user to dynamically convert from one
|
||||
type to another. The AIT portion of the GDD library contains a large
|
||||
primitive type conversion matrix. The conversion matrix is indexed by
|
||||
the source and destination enumeration type codes. The matrix is a
|
||||
|
||||
<P>
|
||||
Several important issues related to where the actual data is stored
|
||||
must be remembered when using GDDs:
|
||||
<OL>
|
||||
<LI>If a gdd is a scalar, then the gdd hold the data it describes, the
|
||||
dimension is zero, and the bounds are empty.
|
||||
<LI>If a gdd is an array, then the gdd refers to the data it describes,
|
||||
refers to bounds that describe it's structure, and optionally
|
||||
refers to a user's data destructor.
|
||||
<LI>If a gdd is a container, then the dimension is fixed at one and the
|
||||
bounds describe how many elements are in the container.
|
||||
</OL>
|
||||
|
||||
<HR><P><A HREF="gddref.html">GDD Reference Manual</A>
|
||||
<HR>Home page for <A HREF="http://www.aps.anl.gov/asd/controls/hideos/jimk.html">Jim Kowalkowski</A>.<BR>
|
||||
|
||||
<HR>Argonne National Laboratory
|
||||
<A HREF="http://www.aps.anl.gov/asd/controls/epics_copyright.html">Copyright</A>
|
||||
Information<BR>
|
||||
<ADDRESS>jbk@aps.anl.gov (Jim Kowalkowski)</ADDRESS> updated 9/13/96<BR>
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
// $Id$
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.3 1996/08/27 13:05:08 jbk
|
||||
// final repairs to string functions, put() functions, and error code printing
|
||||
//
|
||||
// Revision 1.2 1996/06/26 21:00:08 jbk
|
||||
// Fixed up code in aitHelpers, removed unused variables in others
|
||||
// Fixed potential problem in gddAppTable.cc with the map functions
|
||||
@@ -372,7 +375,7 @@ gddStatus gddApplicationTypeTable::mapAppToIndex(
|
||||
else
|
||||
rc=gddErrorOutOfBounds;
|
||||
}
|
||||
gddAutoPrint("gddAppTable::mapAppToIndex()",rc);
|
||||
// gddAutoPrint("gddAppTable::mapAppToIndex()",rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -258,6 +258,8 @@ struct exception_handler_args{
|
||||
long stat; /* Channel access std status code */
|
||||
long op; /* External codes for channel access operations */
|
||||
char *ctx; /* A character string containing context info */
|
||||
char *pFile; /* source file name (may be NULL) */
|
||||
unsigned lineNo; /* source file line number */
|
||||
};
|
||||
|
||||
|
||||
@@ -984,6 +986,11 @@ int epicsShareAPI ca_v42_ok(chid chan);
|
||||
int epicsShareAPI ca_v42_ok();
|
||||
#endif /*CAC_FUNC_PROTO*/
|
||||
|
||||
/*
|
||||
* function that returns the CA version string
|
||||
*/
|
||||
READONLY char * epicsShareAPI ca_version();
|
||||
|
||||
/*
|
||||
* ca_replace_printf_handler ()
|
||||
*
|
||||
|
||||
@@ -214,7 +214,7 @@ READONLY char *ca_message_text[]
|
||||
#endif
|
||||
|
||||
#ifdef __STDC__
|
||||
READONLY char *ca_message(long ca_status);
|
||||
READONLY char * epicsShareAPI ca_message(long ca_status);
|
||||
#else /* __STDC__ */
|
||||
READONLY char *ca_message();
|
||||
#endif
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
#define EPICS_MODIFICATION 0
|
||||
#define EPICS_UPDATE_LEVEL 5
|
||||
|
||||
#define epicsReleaseVersion "@(#)Version R3.13.0.beta2 $Date$"
|
||||
#define epicsReleaseVersion "@(#)Version R3.13.0.beta3 $Date$"
|
||||
|
||||
#define EPICS_VERSION_STRING "EPICS Version 3.13.0.beta2"
|
||||
#define EPICS_VERSION_STRING "EPICS Version 3.13.0.beta3"
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
OUTPUT_FORMAT("a.out-sunos-big")
|
||||
OUTPUT_ARCH(m68k)
|
||||
__DYNAMIC = 0;
|
||||
SECTIONS
|
||||
{
|
||||
.text 0x00:
|
||||
{
|
||||
CREATE_OBJECT_SYMBOLS
|
||||
*(.text)
|
||||
}
|
||||
.data SIZEOF(.text) + ADDR(.text) :
|
||||
{
|
||||
*(.data)
|
||||
CONSTRUCTORS
|
||||
}
|
||||
.bss SIZEOF(.data) + ADDR(.data) :
|
||||
{
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,13 @@ include $(TOP)/config/CONFIG_BASE
|
||||
CMPLR = STRICT
|
||||
|
||||
USR_CFLAGS = -D_NO_PROTO
|
||||
USR_LDLIBS += -lCom
|
||||
USR_LDFLAGS += -L.
|
||||
#USR_CFLAGS = -v -g
|
||||
#CC = $(PURIFYHOME)/purify $(C_$(CMPLR))
|
||||
|
||||
DEPLIBS_BASE = $(INSTALL_LIB)
|
||||
DEPLIBS += $(DEPLIBS_BASE)/libCom.a
|
||||
|
||||
INC += cvtFast.h
|
||||
INC += ellLib.h
|
||||
@@ -22,6 +29,7 @@ INC += fdManager.h
|
||||
INC += osiTime.h
|
||||
INC += osiTimer.h
|
||||
INC += macLib.h
|
||||
INC += impLib.h
|
||||
|
||||
SRCS.c += ../bucketLib.c
|
||||
SRCS.c += ../calcPerform.c
|
||||
@@ -42,11 +50,13 @@ SRCS.c += ../postfix.c
|
||||
SRCS.c += ../realpath.c
|
||||
SRCS.c += ../tsSubr.c
|
||||
SRCS.c += ../assertUNIX.c
|
||||
SRCS.c += ../fdManager.cc
|
||||
SRCS.c += ../osiTimer.cc
|
||||
SRCS.c += ../osiTimeOSD.cc
|
||||
#SRCS.c += ../fdManager.cc
|
||||
#SRCS.c += ../osiTimer.cc
|
||||
#SRCS.c += ../osiTimeOSD.cc
|
||||
SRCS.c += ../macCore.c
|
||||
SRCS.c += ../macUtil.c
|
||||
SRCS.c += ../impLib.c
|
||||
SRCS.c += ../impExpand.c
|
||||
|
||||
LIBOBJS += bucketLib.o
|
||||
LIBOBJS += calcPerform.o
|
||||
@@ -67,15 +77,18 @@ LIBOBJS += postfix.o
|
||||
LIBOBJS += realpath.o
|
||||
LIBOBJS += tsSubr.o
|
||||
LIBOBJS += assertUNIX.o
|
||||
LIBOBJS += fdManager.o
|
||||
LIBOBJS += osiTimer.o
|
||||
LIBOBJS += osiTimeOSD.o
|
||||
#LIBOBJS += fdManager.o
|
||||
#LIBOBJS += osiTimer.o
|
||||
#LIBOBJS += osiTimeOSD.o
|
||||
LIBOBJS += macCore.o
|
||||
LIBOBJS += macUtil.o
|
||||
LIBOBJS += impLib.o
|
||||
LIBOBJS += impExpand.o
|
||||
|
||||
LIBNAME = libCom.a
|
||||
|
||||
#TARGETS = tsTest
|
||||
PROD += impExpand
|
||||
|
||||
MAN3 = gpHash.3 freeList.3
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
TOP = ../../..
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
USR_CFLAGS += -Wall -pedantic
|
||||
|
||||
SRCS.c += ../calcPerform.c
|
||||
SRCS.c += ../cvtFast.c
|
||||
@@ -21,6 +22,7 @@ SRCS.c += ../errPrintfVX.c
|
||||
SRCS.c += ../assertVX.c
|
||||
SRCS.c += ../macCore.c
|
||||
SRCS.c += ../macUtil.c
|
||||
SRCS.c += ../impLib.c
|
||||
|
||||
LIBOBJS += calcPerform.o
|
||||
LIBOBJS += cvtFast.o
|
||||
@@ -41,6 +43,7 @@ LIBOBJS += errPrintfVX.o
|
||||
LIBOBJS += assertVX.o
|
||||
LIBOBJS += macCore.o
|
||||
LIBOBJS += macUtil.o
|
||||
LIBOBJS += impLib.o
|
||||
|
||||
LIBNAME = libCom
|
||||
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
# Experimental Physics and Industrial Control System (EPICS)
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.4 1996/06/25 21:48:33 jba
|
||||
# Makefile includes now from base/src/config, removed all soft links
|
||||
#
|
||||
# Revision 1.3 1996/05/10 16:10:18 mrk
|
||||
# remove hard path to base/include
|
||||
#
|
||||
@@ -63,6 +66,7 @@ cat >${OBJ} <<!EOF
|
||||
*/
|
||||
|
||||
#include <envDefs.h>
|
||||
#include <shareLib.h>
|
||||
|
||||
!EOF
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ int cvtFloatToString(
|
||||
|
||||
/* can this routine handle this conversion */
|
||||
if (precision > 8 || flt_value > 10000000.0 || flt_value < -10000000.0) {
|
||||
sprintf(pstr_value,"%12.5e\0",(double)flt_value);
|
||||
sprintf(pstr_value,"%12.5e",(double)flt_value);
|
||||
return((int)strlen(pstr_value));
|
||||
}
|
||||
startAddr = pstr_value;
|
||||
@@ -88,12 +88,12 @@ int cvtFloatToString(
|
||||
};
|
||||
|
||||
/* remove the whole number portion */
|
||||
whole = flt_value;
|
||||
whole = (long)flt_value;
|
||||
ftemp = flt_value - whole;
|
||||
|
||||
/* multiplier to convert fractional portion to integer */
|
||||
fplace = frac_multiplier[precision];
|
||||
fraction = ftemp * fplace * 10;
|
||||
fraction = (long)(ftemp * fplace * 10);
|
||||
fraction = (fraction + 5) / 10; /* round up */
|
||||
|
||||
/* determine rounding into the whole number portion */
|
||||
@@ -152,10 +152,10 @@ int cvtDoubleToString(
|
||||
if (precision > 8 || flt_value > 10000000.0 || flt_value < -10000000.0) {
|
||||
if (precision > 8 || flt_value > 1e16 || flt_value < -1e16) {
|
||||
if(precision>17) precision=17;
|
||||
sprintf(pstr_value,"%*.*e\0",precision+7,precision,
|
||||
sprintf(pstr_value,"%*.*e",precision+7,precision,
|
||||
flt_value);
|
||||
} else {
|
||||
sprintf(pstr_value,"%.0f\0",flt_value);
|
||||
sprintf(pstr_value,"%.0f",flt_value);
|
||||
}
|
||||
return((int)strlen(pstr_value));
|
||||
}
|
||||
@@ -168,12 +168,12 @@ int cvtDoubleToString(
|
||||
};
|
||||
|
||||
/* remove the whole number portion */
|
||||
whole = flt_value;
|
||||
whole = (long)flt_value;
|
||||
ftemp = flt_value - whole;
|
||||
|
||||
/* multiplier to convert fractional portion to integer */
|
||||
fplace = frac_multiplier[precision];
|
||||
fraction = ftemp * fplace * 10;
|
||||
fraction = (long)(ftemp * fplace * 10);
|
||||
fraction = (fraction + 5) / 10; /* round up */
|
||||
|
||||
/* determine rounding into the whole number portion */
|
||||
|
||||
@@ -76,7 +76,7 @@ int cvtFloatToString(
|
||||
|
||||
/* can this routine handle this conversion */
|
||||
if (precision > 8 || flt_value > 10000000.0 || flt_value < -10000000.0) {
|
||||
sprintf(pstr_value,"%12.5e\0",(double)flt_value);
|
||||
sprintf(pstr_value,"%12.5e",(double)flt_value);
|
||||
return((int)strlen(pstr_value));
|
||||
}
|
||||
startAddr = pstr_value;
|
||||
@@ -88,12 +88,12 @@ int cvtFloatToString(
|
||||
};
|
||||
|
||||
/* remove the whole number portion */
|
||||
whole = flt_value;
|
||||
whole = (long)flt_value;
|
||||
ftemp = flt_value - whole;
|
||||
|
||||
/* multiplier to convert fractional portion to integer */
|
||||
fplace = frac_multiplier[precision];
|
||||
fraction = ftemp * fplace * 10;
|
||||
fraction = (long)(ftemp * fplace * 10);
|
||||
fraction = (fraction + 5) / 10; /* round up */
|
||||
|
||||
/* determine rounding into the whole number portion */
|
||||
@@ -152,10 +152,10 @@ int cvtDoubleToString(
|
||||
if (precision > 8 || flt_value > 10000000.0 || flt_value < -10000000.0) {
|
||||
if (precision > 8 || flt_value > 1e16 || flt_value < -1e16) {
|
||||
if(precision>17) precision=17;
|
||||
sprintf(pstr_value,"%*.*e\0",precision+7,precision,
|
||||
sprintf(pstr_value,"%*.*e",precision+7,precision,
|
||||
flt_value);
|
||||
} else {
|
||||
sprintf(pstr_value,"%.0f\0",flt_value);
|
||||
sprintf(pstr_value,"%.0f",flt_value);
|
||||
}
|
||||
return((int)strlen(pstr_value));
|
||||
}
|
||||
@@ -168,12 +168,12 @@ int cvtDoubleToString(
|
||||
};
|
||||
|
||||
/* remove the whole number portion */
|
||||
whole = flt_value;
|
||||
whole = (long)flt_value;
|
||||
ftemp = flt_value - whole;
|
||||
|
||||
/* multiplier to convert fractional portion to integer */
|
||||
fplace = frac_multiplier[precision];
|
||||
fraction = ftemp * fplace * 10;
|
||||
fraction = (long)(ftemp * fplace * 10);
|
||||
fraction = (fraction + 5) / 10; /* round up */
|
||||
|
||||
/* determine rounding into the whole number portion */
|
||||
|
||||
@@ -626,7 +626,7 @@ main()
|
||||
exit(4);
|
||||
}
|
||||
printf("ok\nellConcat() check... ");
|
||||
ellConcat(list1, list2);
|
||||
ellConcat(&list1, &list2);
|
||||
if ((ellCount(&list1) != 20)||(ellCount(&list2) != 0)||
|
||||
(list1.node.previous != (ELLNODE *)pmyNode))
|
||||
{
|
||||
|
||||
@@ -626,7 +626,7 @@ main()
|
||||
exit(4);
|
||||
}
|
||||
printf("ok\nellConcat() check... ");
|
||||
ellConcat(list1, list2);
|
||||
ellConcat(&list1, &list2);
|
||||
if ((ellCount(&list1) != 20)||(ellCount(&list2) != 0)||
|
||||
(list1.node.previous != (ELLNODE *)pmyNode))
|
||||
{
|
||||
|
||||
36
src/libCom/env/envDefs.h
vendored
36
src/libCom/env/envDefs.h
vendored
@@ -30,6 +30,7 @@
|
||||
* .03 09-26-94 joh ifdef out double inclusion
|
||||
* .04 11-28-94 joh new CA env var
|
||||
* .05 04-20-95 anj moved defaults to CONFIG_ENV
|
||||
* .06 09-11-96 joh ANSI prototypes
|
||||
*
|
||||
* make options
|
||||
* -DvxWorks makes a version for VxWorks
|
||||
@@ -59,6 +60,15 @@
|
||||
|
||||
#include <shareLib.h>
|
||||
|
||||
#ifdef WIN32
|
||||
# include <winsock.h>
|
||||
#else
|
||||
# include <sys/types.h>
|
||||
# include <netinet/in.h>
|
||||
# include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct envParam {
|
||||
char *name; /* text name of the parameter */
|
||||
char dflt[80]; /* default value for the parameter */
|
||||
@@ -94,12 +104,26 @@ epicsShareExtern ENV_PARAM EPICS_AR_PORT;
|
||||
epicsShareExtern ENV_PARAM
|
||||
*env_param_list[EPICS_ENV_VARIABLE_COUNT+1];
|
||||
|
||||
char *envGetConfigParam();
|
||||
long envPrtConfigParam();
|
||||
long envSetConfigParam();
|
||||
long envGetInetAddrConfigParam();
|
||||
long envGetDoubleConfigParam();
|
||||
long envGetLongConfigParam();
|
||||
#ifdef __STDC__
|
||||
char * epicsShareAPI envGetConfigParam(ENV_PARAM *pParam,
|
||||
int bufDim, char *pBuf);
|
||||
long epicsShareAPI envPrtConfigParam(ENV_PARAM *pParam);
|
||||
long epicsShareAPI envSetConfigParam(ENV_PARAM *pParam,
|
||||
char *value);
|
||||
long epicsShareAPI envGetInetAddrConfigParam(ENV_PARAM *pParam,
|
||||
struct in_addr *pAddr);
|
||||
long epicsShareAPI envGetDoubleConfigParam(ENV_PARAM *pParam,
|
||||
double *pDouble);
|
||||
long epicsShareAPI envGetLongConfigParam(ENV_PARAM *pParam,
|
||||
long *pLong);
|
||||
#else
|
||||
char * epicsShareAPI envGetConfigParam();
|
||||
long epicsShareAPI envPrtConfigParam();
|
||||
long epicsShareAPI envSetConfigParam();
|
||||
long epicsShareAPI envGetInetAddrConfigParam();
|
||||
long epicsShareAPI envGetDoubleConfigParam();
|
||||
long epicsShareAPI envGetLongConfigParam();
|
||||
#endif
|
||||
|
||||
#endif /*envDefsH*/
|
||||
|
||||
|
||||
56
src/libCom/env/envSubr.c
vendored
56
src/libCom/env/envSubr.c
vendored
@@ -34,6 +34,7 @@
|
||||
* .06 05-24-95 joh added return stmnt to epicsPrtEnvParams()
|
||||
* .07 11-03-96 joh fixed bug occuring when diagnostic is
|
||||
* printed and the env var cant be found
|
||||
* .08 09-11-96 joh ANSI prototypes
|
||||
*
|
||||
* make options
|
||||
* -DvxWorks makes a version for VxWorks
|
||||
@@ -70,14 +71,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef WIN32
|
||||
# include <winsock.h>
|
||||
#else
|
||||
# include <sys/types.h>
|
||||
# include <netinet/in.h>
|
||||
# include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#ifdef vxWorks
|
||||
#include <inetLib.h>
|
||||
#include <envLib.h>
|
||||
@@ -125,11 +118,11 @@
|
||||
* printf("DISPLAY is %s\n", temp);
|
||||
*
|
||||
*-*/
|
||||
char *
|
||||
envGetConfigParam(pParam, bufDim, pBuf)
|
||||
ENV_PARAM *pParam; /* I pointer to config param structure */
|
||||
int bufDim; /* I dimension of parameter buffer */
|
||||
char *pBuf; /* I pointer to parameter buffer */
|
||||
char * epicsShareAPI envGetConfigParam(
|
||||
ENV_PARAM *pParam, /* I pointer to config param structure */
|
||||
int bufDim, /* I dimension of parameter buffer */
|
||||
char *pBuf /* I pointer to parameter buffer */
|
||||
)
|
||||
{
|
||||
char *pEnv; /* pointer to environment string */
|
||||
long i;
|
||||
@@ -182,10 +175,10 @@ char *pBuf; /* I pointer to parameter buffer */
|
||||
* }
|
||||
*
|
||||
*-*/
|
||||
long
|
||||
envGetDoubleConfigParam(pParam, pDouble)
|
||||
ENV_PARAM *pParam; /* I pointer to config param structure */
|
||||
double *pDouble; /* O pointer to place to store value */
|
||||
long epicsShareAPI envGetDoubleConfigParam(
|
||||
ENV_PARAM *pParam, /* I pointer to config param structure */
|
||||
double *pDouble /* O pointer to place to store value */
|
||||
)
|
||||
{
|
||||
char text[128];
|
||||
char *ptext;
|
||||
@@ -237,10 +230,10 @@ double *pDouble; /* O pointer to place to store value */
|
||||
* }
|
||||
*
|
||||
*-*/
|
||||
long
|
||||
envGetInetAddrConfigParam(pParam, pAddr)
|
||||
ENV_PARAM *pParam; /* I pointer to config param structure */
|
||||
struct in_addr *pAddr; /* O pointer to struct to receive inet addr */
|
||||
long epicsShareAPI envGetInetAddrConfigParam(
|
||||
ENV_PARAM *pParam, /* I pointer to config param structure */
|
||||
struct in_addr *pAddr /* O pointer to struct to receive inet addr */
|
||||
)
|
||||
{
|
||||
char text[128];
|
||||
char *ptext;
|
||||
@@ -293,10 +286,10 @@ struct in_addr *pAddr; /* O pointer to struct to receive inet addr */
|
||||
* }
|
||||
*
|
||||
*-*/
|
||||
long
|
||||
envGetLongConfigParam(pParam, pLong)
|
||||
ENV_PARAM *pParam; /* I pointer to config param structure */
|
||||
long *pLong; /* O pointer to place to store value */
|
||||
long epicsShareAPI envGetLongConfigParam(
|
||||
ENV_PARAM *pParam, /* I pointer to config param structure */
|
||||
long *pLong /* O pointer to place to store value */
|
||||
)
|
||||
{
|
||||
char text[128];
|
||||
char *ptext;
|
||||
@@ -331,9 +324,8 @@ long *pLong; /* O pointer to place to store value */
|
||||
* envPrtConfigParam(&EPICS_TS_MIN_WEST);
|
||||
*
|
||||
*-*/
|
||||
long
|
||||
envPrtConfigParam(pParam)
|
||||
ENV_PARAM *pParam; /* I pointer to config param structure */
|
||||
long epicsShareAPI envPrtConfigParam(
|
||||
ENV_PARAM *pParam) /* pointer to config param structure */
|
||||
{
|
||||
char text[80];
|
||||
if (envGetConfigParam(pParam, 80, text) == NULL)
|
||||
@@ -374,10 +366,10 @@ ENV_PARAM *pParam; /* I pointer to config param structure */
|
||||
* envSetConfigParam &EPICS_TS_MIN_WEST,"360"
|
||||
*
|
||||
*-*/
|
||||
long
|
||||
envSetConfigParam (pParam, value)
|
||||
ENV_PARAM *pParam; /* I pointer to config param structure */
|
||||
char *value; /* I pointer to value string */
|
||||
long epicsShareAPI envSetConfigParam (
|
||||
ENV_PARAM *pParam, /* I pointer to config param structure */
|
||||
char *value /* I pointer to value string */
|
||||
)
|
||||
{
|
||||
#ifndef vxWorks
|
||||
printf("envSetConfigParam can only be used under vxWorks\n");
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
* .03 09-26-94 joh ifdef out double inclusion
|
||||
* .04 11-28-94 joh new CA env var
|
||||
* .05 04-20-95 anj moved defaults to CONFIG_ENV
|
||||
* .06 09-11-96 joh ANSI prototypes
|
||||
*
|
||||
* make options
|
||||
* -DvxWorks makes a version for VxWorks
|
||||
@@ -59,6 +60,15 @@
|
||||
|
||||
#include <shareLib.h>
|
||||
|
||||
#ifdef WIN32
|
||||
# include <winsock.h>
|
||||
#else
|
||||
# include <sys/types.h>
|
||||
# include <netinet/in.h>
|
||||
# include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct envParam {
|
||||
char *name; /* text name of the parameter */
|
||||
char dflt[80]; /* default value for the parameter */
|
||||
@@ -94,12 +104,26 @@ epicsShareExtern ENV_PARAM EPICS_AR_PORT;
|
||||
epicsShareExtern ENV_PARAM
|
||||
*env_param_list[EPICS_ENV_VARIABLE_COUNT+1];
|
||||
|
||||
char *envGetConfigParam();
|
||||
long envPrtConfigParam();
|
||||
long envSetConfigParam();
|
||||
long envGetInetAddrConfigParam();
|
||||
long envGetDoubleConfigParam();
|
||||
long envGetLongConfigParam();
|
||||
#ifdef __STDC__
|
||||
char * epicsShareAPI envGetConfigParam(ENV_PARAM *pParam,
|
||||
int bufDim, char *pBuf);
|
||||
long epicsShareAPI envPrtConfigParam(ENV_PARAM *pParam);
|
||||
long epicsShareAPI envSetConfigParam(ENV_PARAM *pParam,
|
||||
char *value);
|
||||
long epicsShareAPI envGetInetAddrConfigParam(ENV_PARAM *pParam,
|
||||
struct in_addr *pAddr);
|
||||
long epicsShareAPI envGetDoubleConfigParam(ENV_PARAM *pParam,
|
||||
double *pDouble);
|
||||
long epicsShareAPI envGetLongConfigParam(ENV_PARAM *pParam,
|
||||
long *pLong);
|
||||
#else
|
||||
char * epicsShareAPI envGetConfigParam();
|
||||
long epicsShareAPI envPrtConfigParam();
|
||||
long epicsShareAPI envSetConfigParam();
|
||||
long epicsShareAPI envGetInetAddrConfigParam();
|
||||
long epicsShareAPI envGetDoubleConfigParam();
|
||||
long epicsShareAPI envGetLongConfigParam();
|
||||
#endif
|
||||
|
||||
#endif /*envDefsH*/
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
* .06 05-24-95 joh added return stmnt to epicsPrtEnvParams()
|
||||
* .07 11-03-96 joh fixed bug occuring when diagnostic is
|
||||
* printed and the env var cant be found
|
||||
* .08 09-11-96 joh ANSI prototypes
|
||||
*
|
||||
* make options
|
||||
* -DvxWorks makes a version for VxWorks
|
||||
@@ -70,14 +71,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef WIN32
|
||||
# include <winsock.h>
|
||||
#else
|
||||
# include <sys/types.h>
|
||||
# include <netinet/in.h>
|
||||
# include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#ifdef vxWorks
|
||||
#include <inetLib.h>
|
||||
#include <envLib.h>
|
||||
@@ -125,11 +118,11 @@
|
||||
* printf("DISPLAY is %s\n", temp);
|
||||
*
|
||||
*-*/
|
||||
char *
|
||||
envGetConfigParam(pParam, bufDim, pBuf)
|
||||
ENV_PARAM *pParam; /* I pointer to config param structure */
|
||||
int bufDim; /* I dimension of parameter buffer */
|
||||
char *pBuf; /* I pointer to parameter buffer */
|
||||
char * epicsShareAPI envGetConfigParam(
|
||||
ENV_PARAM *pParam, /* I pointer to config param structure */
|
||||
int bufDim, /* I dimension of parameter buffer */
|
||||
char *pBuf /* I pointer to parameter buffer */
|
||||
)
|
||||
{
|
||||
char *pEnv; /* pointer to environment string */
|
||||
long i;
|
||||
@@ -182,10 +175,10 @@ char *pBuf; /* I pointer to parameter buffer */
|
||||
* }
|
||||
*
|
||||
*-*/
|
||||
long
|
||||
envGetDoubleConfigParam(pParam, pDouble)
|
||||
ENV_PARAM *pParam; /* I pointer to config param structure */
|
||||
double *pDouble; /* O pointer to place to store value */
|
||||
long epicsShareAPI envGetDoubleConfigParam(
|
||||
ENV_PARAM *pParam, /* I pointer to config param structure */
|
||||
double *pDouble /* O pointer to place to store value */
|
||||
)
|
||||
{
|
||||
char text[128];
|
||||
char *ptext;
|
||||
@@ -237,10 +230,10 @@ double *pDouble; /* O pointer to place to store value */
|
||||
* }
|
||||
*
|
||||
*-*/
|
||||
long
|
||||
envGetInetAddrConfigParam(pParam, pAddr)
|
||||
ENV_PARAM *pParam; /* I pointer to config param structure */
|
||||
struct in_addr *pAddr; /* O pointer to struct to receive inet addr */
|
||||
long epicsShareAPI envGetInetAddrConfigParam(
|
||||
ENV_PARAM *pParam, /* I pointer to config param structure */
|
||||
struct in_addr *pAddr /* O pointer to struct to receive inet addr */
|
||||
)
|
||||
{
|
||||
char text[128];
|
||||
char *ptext;
|
||||
@@ -293,10 +286,10 @@ struct in_addr *pAddr; /* O pointer to struct to receive inet addr */
|
||||
* }
|
||||
*
|
||||
*-*/
|
||||
long
|
||||
envGetLongConfigParam(pParam, pLong)
|
||||
ENV_PARAM *pParam; /* I pointer to config param structure */
|
||||
long *pLong; /* O pointer to place to store value */
|
||||
long epicsShareAPI envGetLongConfigParam(
|
||||
ENV_PARAM *pParam, /* I pointer to config param structure */
|
||||
long *pLong /* O pointer to place to store value */
|
||||
)
|
||||
{
|
||||
char text[128];
|
||||
char *ptext;
|
||||
@@ -331,9 +324,8 @@ long *pLong; /* O pointer to place to store value */
|
||||
* envPrtConfigParam(&EPICS_TS_MIN_WEST);
|
||||
*
|
||||
*-*/
|
||||
long
|
||||
envPrtConfigParam(pParam)
|
||||
ENV_PARAM *pParam; /* I pointer to config param structure */
|
||||
long epicsShareAPI envPrtConfigParam(
|
||||
ENV_PARAM *pParam) /* pointer to config param structure */
|
||||
{
|
||||
char text[80];
|
||||
if (envGetConfigParam(pParam, 80, text) == NULL)
|
||||
@@ -374,10 +366,10 @@ ENV_PARAM *pParam; /* I pointer to config param structure */
|
||||
* envSetConfigParam &EPICS_TS_MIN_WEST,"360"
|
||||
*
|
||||
*-*/
|
||||
long
|
||||
envSetConfigParam (pParam, value)
|
||||
ENV_PARAM *pParam; /* I pointer to config param structure */
|
||||
char *value; /* I pointer to value string */
|
||||
long epicsShareAPI envSetConfigParam (
|
||||
ENV_PARAM *pParam, /* I pointer to config param structure */
|
||||
char *value /* I pointer to value string */
|
||||
)
|
||||
{
|
||||
#ifndef vxWorks
|
||||
printf("envSetConfigParam can only be used under vxWorks\n");
|
||||
|
||||
@@ -155,7 +155,7 @@ int errSymBld()
|
||||
for (i = 0; i < errSymTbl->nsymbols; i++, errArray++) {
|
||||
modnum = errArray->errNum >> 16;
|
||||
if (modnum < 501) {
|
||||
printf("errSymBld: ERROR - Module number in errSymTbl < 501 was Module=%x Name=%s\n",
|
||||
printf("errSymBld: ERROR - Module number in errSymTbl < 501 was Module=%lx Name=%s\n",
|
||||
errArray->errNum, errArray->name);
|
||||
continue;
|
||||
}
|
||||
@@ -200,8 +200,8 @@ long errNum;
|
||||
unsigned short modnum;
|
||||
unsigned short errnum;
|
||||
|
||||
modnum = errNum >> 16;
|
||||
errnum = errNum & 0xffff;
|
||||
modnum = (unsigned short) (errNum >> 16);
|
||||
errnum = (unsigned short) (errNum & 0xffff);
|
||||
return((unsigned short)(((modnum - 500) * 20) + errnum) % NHASH);
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ int ModSymFind(status, pname, pvalue)
|
||||
ERRNUMNODE *pNextNode;
|
||||
ERRNUMNODE **phashnode = NULL;
|
||||
|
||||
modNum = (status >> 16);
|
||||
modNum = (unsigned short) (status >> 16);
|
||||
if (modNum < 501) {
|
||||
*pvalue = -1;
|
||||
return(0);
|
||||
@@ -319,7 +319,7 @@ int errSymFind(status, name)
|
||||
errSymBld();
|
||||
}
|
||||
|
||||
modnum = (status >> 16);
|
||||
modnum = (unsigned short) (status >> 16);
|
||||
if (modnum <= 500)
|
||||
#ifdef vxWorks
|
||||
symFindByValue((SYMTAB_ID)statSymTbl, status, name,(int*) &value, (SYM_TYPE*)&type);
|
||||
@@ -397,8 +397,8 @@ long errNum;
|
||||
errSymBld();
|
||||
|
||||
message[0] = '\0';
|
||||
modnum = errNum >> 16;
|
||||
errnum = errNum & 0xffff;
|
||||
modnum = (unsigned short) (errNum >> 16);
|
||||
errnum = (unsigned short) (errNum & 0xffff);
|
||||
if (modnum < 501) {
|
||||
printf("Usage: errSymTestPrint(long errNum) \n");
|
||||
printf("errSymTestPrint: module number < 501 \n");
|
||||
@@ -435,5 +435,3 @@ unsigned short endErrNum;
|
||||
errSymTestPrint(errNum);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ int errSymBld()
|
||||
for (i = 0; i < errSymTbl->nsymbols; i++, errArray++) {
|
||||
modnum = errArray->errNum >> 16;
|
||||
if (modnum < 501) {
|
||||
printf("errSymBld: ERROR - Module number in errSymTbl < 501 was Module=%x Name=%s\n",
|
||||
printf("errSymBld: ERROR - Module number in errSymTbl < 501 was Module=%lx Name=%s\n",
|
||||
errArray->errNum, errArray->name);
|
||||
continue;
|
||||
}
|
||||
@@ -200,8 +200,8 @@ long errNum;
|
||||
unsigned short modnum;
|
||||
unsigned short errnum;
|
||||
|
||||
modnum = errNum >> 16;
|
||||
errnum = errNum & 0xffff;
|
||||
modnum = (unsigned short) (errNum >> 16);
|
||||
errnum = (unsigned short) (errNum & 0xffff);
|
||||
return((unsigned short)(((modnum - 500) * 20) + errnum) % NHASH);
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ int ModSymFind(status, pname, pvalue)
|
||||
ERRNUMNODE *pNextNode;
|
||||
ERRNUMNODE **phashnode = NULL;
|
||||
|
||||
modNum = (status >> 16);
|
||||
modNum = (unsigned short) (status >> 16);
|
||||
if (modNum < 501) {
|
||||
*pvalue = -1;
|
||||
return(0);
|
||||
@@ -319,7 +319,7 @@ int errSymFind(status, name)
|
||||
errSymBld();
|
||||
}
|
||||
|
||||
modnum = (status >> 16);
|
||||
modnum = (unsigned short) (status >> 16);
|
||||
if (modnum <= 500)
|
||||
#ifdef vxWorks
|
||||
symFindByValue((SYMTAB_ID)statSymTbl, status, name,(int*) &value, (SYM_TYPE*)&type);
|
||||
@@ -397,8 +397,8 @@ long errNum;
|
||||
errSymBld();
|
||||
|
||||
message[0] = '\0';
|
||||
modnum = errNum >> 16;
|
||||
errnum = errNum & 0xffff;
|
||||
modnum = (unsigned short) (errNum >> 16);
|
||||
errnum = (unsigned short) (errNum & 0xffff);
|
||||
if (modnum < 501) {
|
||||
printf("Usage: errSymTestPrint(long errNum) \n");
|
||||
printf("errSymTestPrint: module number < 501 \n");
|
||||
@@ -435,5 +435,3 @@ unsigned short endErrNum;
|
||||
errSymTestPrint(errNum);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
87
src/libCom/impExpand.c
Normal file
87
src/libCom/impExpand.c
Normal file
@@ -0,0 +1,87 @@
|
||||
/* impExpand.c */
|
||||
/* Author: Marty Kraimer Date: 18SEP96 */
|
||||
/*****************************************************************
|
||||
COPYRIGHT NOTIFICATION
|
||||
*****************************************************************
|
||||
|
||||
(C) COPYRIGHT 1993 UNIVERSITY OF CHICAGO
|
||||
|
||||
This software was developed under a United States Government license
|
||||
described on the COPYRIGHT_UniversityOfChicago file included as part
|
||||
of this distribution.
|
||||
**********************************************************************/
|
||||
|
||||
/* Modification Log:
|
||||
* -----------------
|
||||
* .01 18SEP96 mrk Initial Implementation
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <impLib.h>
|
||||
|
||||
#define MAX_SIZE 256
|
||||
|
||||
int main(int argc,char **argv)
|
||||
{
|
||||
IMP_HANDLE handle;
|
||||
int narg,i;
|
||||
char *parm;
|
||||
char buffer[MAX_SIZE];
|
||||
|
||||
/*Look for options*/
|
||||
if(argc<2) {
|
||||
fprintf(stderr,
|
||||
"usage: impExpand -Idir -Idir "
|
||||
"-S substitutions -S substitutions"
|
||||
" file1 file2 ...\n");
|
||||
exit(0);
|
||||
}
|
||||
if(impInit(&handle,MAX_SIZE)!=impSuccess) {
|
||||
fprintf(stderr,"impInit failed\n");
|
||||
exit(0);
|
||||
}
|
||||
while((strncmp(argv[1],"-I",2)==0)||(strncmp(argv[1],"-S",2)==0)) {
|
||||
if(strlen(argv[1])==2) {
|
||||
parm = argv[2];
|
||||
narg = 2;
|
||||
} else {
|
||||
parm = argv[1]+2;
|
||||
narg = 1;
|
||||
}
|
||||
if(strncmp(argv[1],"-I",2)==0) {
|
||||
if(impAddPath(handle,parm)!=impSuccess) {
|
||||
fprintf(stderr,"impAddPath failed\n");
|
||||
exit(0);
|
||||
}
|
||||
} else {
|
||||
if(impMacAddSubstitutions(handle,parm)!=impSuccess) {
|
||||
fprintf(stderr,"impMacAddSubstitutions failed\n");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
argc -= narg;
|
||||
for(i=1; i<argc; i++) argv[i] = argv[i + narg];
|
||||
}
|
||||
if(argc<2 || (strncmp(argv[1],"-",1)==0)) {
|
||||
fprintf(stderr,
|
||||
"usage: impExpand -Idir -Idir "
|
||||
"-S substitutions -S substitutions"
|
||||
" file1.dbd file2.dbd ...\n");
|
||||
exit(0);
|
||||
}
|
||||
for(i=1; i<argc; i++) {
|
||||
if(impOpenFile(handle,argv[i])!=impSuccess) {
|
||||
fprintf(stderr,"impOpenFile failed for %s\n",argv[i]);
|
||||
exit(0);
|
||||
}
|
||||
while(impGetLine(handle,buffer,MAX_SIZE)) printf("%s",buffer);
|
||||
if(impCloseFile(handle)!=impSuccess) {
|
||||
fprintf(stderr,"impCloseFile failed for %s\n",argv[i]);
|
||||
}
|
||||
}
|
||||
impFree(handle);
|
||||
return(0);
|
||||
}
|
||||
475
src/libCom/impLib.c
Normal file
475
src/libCom/impLib.c
Normal file
@@ -0,0 +1,475 @@
|
||||
/*impLib.c*/
|
||||
/*****************************************************************
|
||||
COPYRIGHT NOTIFICATION
|
||||
*****************************************************************
|
||||
|
||||
(C) COPYRIGHT 1993 UNIVERSITY OF CHICAGO
|
||||
|
||||
This software was developed under a United States Government license
|
||||
described on the COPYRIGHT_UniversityOfChicago file included as part
|
||||
of this distribution.
|
||||
**********************************************************************/
|
||||
|
||||
/* Modification Log:
|
||||
* -----------------
|
||||
* 01 17sep96 mrk Original
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#ifdef vxWorks
|
||||
#include <vxWorks.h>
|
||||
#include <taskLib.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ellLib.h>
|
||||
#include <epicsPrint.h>
|
||||
#include <impLib.h>
|
||||
|
||||
/*private declarations*/
|
||||
typedef struct pathNode {
|
||||
ELLNODE node;
|
||||
char *directory;
|
||||
}pathNode;
|
||||
|
||||
typedef struct inputFile{
|
||||
ELLNODE node;
|
||||
char *path;
|
||||
char *filename;
|
||||
FILE *fp;
|
||||
int line_num;
|
||||
}inputFile;
|
||||
|
||||
typedef struct impPvt{
|
||||
char *includeToken;
|
||||
char *pathToken;
|
||||
char *addPathToken;
|
||||
char *envName;
|
||||
MAC_HANDLE *macHandle;
|
||||
char *buffer; /*For use if macros are being expanded*/
|
||||
int bufferSize;
|
||||
ELLLIST pathList;
|
||||
ELLLIST inputFileList;
|
||||
}impPvt;
|
||||
|
||||
/*private routines */
|
||||
static void *impCalloc(size_t nobj,size_t size);
|
||||
static void freePath(impPvt *handle);
|
||||
static void freeInputFileList(impPvt *handle);
|
||||
static char *openFile(impPvt *handle,const char *filename,FILE **fp);
|
||||
static void includeNew(impPvt *handle,char *filename);
|
||||
static char *getParameter(char *pfirst,char *token);
|
||||
|
||||
/*Beginning of Private routines*/
|
||||
static void *impCalloc(size_t nobj,size_t size)
|
||||
{
|
||||
void *p;
|
||||
|
||||
p=calloc(nobj,size);
|
||||
if(p) return(p);
|
||||
printf("impCalloc: Can't allocate memory\n");
|
||||
#ifdef vxWorks
|
||||
taskSuspend(0);
|
||||
#else
|
||||
abort();
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
static void freePath(impPvt *handle)
|
||||
{
|
||||
pathNode *ppathNode;
|
||||
|
||||
if(!handle) return;
|
||||
while(ppathNode = (pathNode *)ellFirst(&handle->pathList)) {
|
||||
ellDelete(&handle->pathList,&ppathNode->node);
|
||||
free((void *)ppathNode->directory);
|
||||
free((void *)ppathNode);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static void freeInputFileList(impPvt *handle)
|
||||
{
|
||||
inputFile *pinputFileNow;
|
||||
|
||||
while(pinputFileNow=(inputFile *)ellFirst(&handle->inputFileList)) {
|
||||
if(pinputFileNow->fp && fclose(pinputFileNow->fp))
|
||||
epicsPrintf("Error Closing file %s",pinputFileNow->filename);
|
||||
free((void *)pinputFileNow->filename);
|
||||
ellDelete(&handle->inputFileList,(ELLNODE *)pinputFileNow);
|
||||
free((void *)pinputFileNow);
|
||||
}
|
||||
}
|
||||
|
||||
static char *openFile(impPvt *handle,const char *filename,FILE **fp)
|
||||
{
|
||||
ELLLIST *ppathList = &handle->pathList;
|
||||
pathNode *ppathNode;
|
||||
char *fullfilename;
|
||||
|
||||
if(!filename) return(0);
|
||||
if(!ppathList || (ellCount(ppathList)==0) || strchr(filename,'/')){
|
||||
*fp = fopen(filename,"r");
|
||||
return(0);
|
||||
}
|
||||
ppathNode = (pathNode *)ellFirst(ppathList);
|
||||
while(ppathNode) {
|
||||
fullfilename = impCalloc(strlen(filename)+strlen(ppathNode->directory)
|
||||
+2,sizeof(char));
|
||||
strcpy(fullfilename,ppathNode->directory);
|
||||
strcat(fullfilename,"/");
|
||||
strcat(fullfilename,filename);
|
||||
*fp = fopen(fullfilename,"r");
|
||||
free((void *)fullfilename);
|
||||
if(*fp) return(ppathNode->directory);
|
||||
ppathNode = (pathNode *)ellNext(&ppathNode->node);
|
||||
}
|
||||
epicsPrintf("Error opening file %s\n",filename);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void includeNew(impPvt *handle,char *filename)
|
||||
{
|
||||
inputFile *pinputFile;
|
||||
FILE *fp = NULL;
|
||||
|
||||
pinputFile = impCalloc(1,sizeof(inputFile));
|
||||
pinputFile->path = openFile(handle,filename,&fp);
|
||||
if(!fp) {
|
||||
errPrintf(0,__FILE__, __LINE__,
|
||||
"includeNew opening file %s",filename);
|
||||
free((void *)pinputFile);
|
||||
return;
|
||||
}
|
||||
pinputFile->filename = impCalloc(strlen(filename)+1,sizeof(char));
|
||||
strcpy(pinputFile->filename,filename);
|
||||
pinputFile->fp = fp;
|
||||
ellAdd(&handle->inputFileList,&pinputFile->node);
|
||||
}
|
||||
|
||||
static char *getParameter(char *pfirst,char *token)
|
||||
{
|
||||
char *plast;
|
||||
size_t nskip;
|
||||
char *prtn;
|
||||
size_t size;
|
||||
|
||||
/*Skip blanks and tabs*/
|
||||
pfirst += strlen(token);
|
||||
nskip = strspn(pfirst," \t");
|
||||
pfirst += nskip;
|
||||
if(!*pfirst) return(NULL);
|
||||
if(*pfirst=='"') {
|
||||
++pfirst;
|
||||
plast = strchr(pfirst,'"');
|
||||
if(!plast) return(NULL);
|
||||
size = plast-pfirst+1;
|
||||
} else {
|
||||
size = strcspn(pfirst," \t") + 1;
|
||||
}
|
||||
if(size<=1) return(NULL);
|
||||
prtn = impCalloc(size,sizeof(char));
|
||||
strncpy(prtn,pfirst,size-1);
|
||||
return(prtn);
|
||||
}
|
||||
|
||||
int impInit(IMP_HANDLE *phandle,int bufferSize)
|
||||
{
|
||||
impPvt *handle;
|
||||
|
||||
handle = impCalloc(1,sizeof(impPvt));
|
||||
handle->buffer = impCalloc(bufferSize,sizeof(char));
|
||||
handle->bufferSize = bufferSize;
|
||||
ellInit(&handle->pathList);
|
||||
ellInit(&handle->inputFileList);
|
||||
impSetIncludeToken((IMP_HANDLE *)handle,"include");
|
||||
*phandle = (IMP_HANDLE)handle;
|
||||
return(impSuccess);
|
||||
}
|
||||
|
||||
void impFree(IMP_HANDLE imp)
|
||||
{
|
||||
impPvt *handle = (impPvt *)imp;
|
||||
if(!handle) return;
|
||||
|
||||
freePath(handle);
|
||||
freeInputFileList(handle);
|
||||
free((void *)handle->includeToken);
|
||||
free((void *)handle->pathToken);
|
||||
free((void *)handle->addPathToken);
|
||||
free((void *)handle->envName);
|
||||
free((void *)handle->buffer);
|
||||
if(handle->macHandle) macDeleteHandle(handle->macHandle);
|
||||
free((void *)handle);
|
||||
}
|
||||
|
||||
int impSetIncludeToken(IMP_HANDLE imp,char *includeToken)
|
||||
{
|
||||
impPvt *handle = (impPvt *)imp;
|
||||
|
||||
if(!handle) return(impFailure);
|
||||
free((void *)handle->includeToken);
|
||||
handle->includeToken = NULL;
|
||||
if(!includeToken) return(impSuccess);
|
||||
handle->includeToken = impCalloc(strlen(includeToken)+1,sizeof(char));
|
||||
strcpy(handle->includeToken,includeToken);
|
||||
return(impSuccess);
|
||||
}
|
||||
|
||||
int impSetEnvName(IMP_HANDLE imp,char *envName)
|
||||
{
|
||||
impPvt *handle = (impPvt *)imp;
|
||||
|
||||
if(!handle) return(impFailure);
|
||||
free((void *)handle->envName);
|
||||
handle->envName = NULL;
|
||||
if(!envName) return(impSuccess);
|
||||
handle->envName = impCalloc(strlen(envName)+1,sizeof(char));
|
||||
strcpy(handle->envName,envName);
|
||||
return(impSuccess);
|
||||
}
|
||||
|
||||
MAC_HANDLE *impGetMacHandle(IMP_HANDLE imp)
|
||||
{
|
||||
impPvt *handle = (impPvt *)imp;
|
||||
|
||||
if(!handle) return(NULL);
|
||||
return(handle->macHandle);
|
||||
}
|
||||
|
||||
int impSetMacHandle(IMP_HANDLE imp,MAC_HANDLE *mac)
|
||||
{
|
||||
impPvt *handle = (impPvt *)imp;
|
||||
|
||||
if(!handle) return(impFailure);
|
||||
if(handle->macHandle) return(impFailure);
|
||||
handle->macHandle = mac;
|
||||
return(impSuccess);
|
||||
}
|
||||
|
||||
void impMacFree(IMP_HANDLE imp)
|
||||
{
|
||||
impPvt *handle = (impPvt *)imp;
|
||||
|
||||
if(!handle) return;
|
||||
if(handle->macHandle) {
|
||||
macDeleteHandle(handle->macHandle);
|
||||
handle->macHandle = NULL;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int impMacAddSubstitutions(IMP_HANDLE imp,const char *substitutions)
|
||||
{
|
||||
impPvt *handle = (impPvt *)imp;
|
||||
char **pairs;
|
||||
|
||||
if(!handle) return(impFailure);
|
||||
if(!substitutions || strlen(substitutions)==0) return(impSuccess);
|
||||
if(!handle->macHandle && macCreateHandle(&handle->macHandle,NULL)) {
|
||||
epicsPrintf("macCreateHandle error\n");
|
||||
return(impFailure);
|
||||
}
|
||||
macParseDefns(handle->macHandle,(char *)substitutions,&pairs);
|
||||
if(pairs) {
|
||||
macInstallMacros(handle->macHandle,pairs);
|
||||
free((void *)pairs);
|
||||
}
|
||||
return(impSuccess);
|
||||
}
|
||||
|
||||
int impMacAddNameValuePairs(IMP_HANDLE imp,const char *pairs[])
|
||||
{
|
||||
impPvt *handle = (impPvt *)imp;
|
||||
|
||||
if(!handle) return(impFailure);
|
||||
if(!handle->macHandle && macCreateHandle(&handle->macHandle,NULL)) {
|
||||
epicsPrintf("macCreateHandle error\n");
|
||||
return(impFailure);
|
||||
}
|
||||
macInstallMacros(handle->macHandle,(char **)pairs);
|
||||
return(impSuccess);
|
||||
}
|
||||
|
||||
int impSetPath(IMP_HANDLE imp,const char *path)
|
||||
{
|
||||
impPvt *handle = (impPvt *)imp;
|
||||
|
||||
if(!handle) return(impFailure);
|
||||
freePath(handle);
|
||||
return(impAddPath(handle,path));
|
||||
}
|
||||
|
||||
int impAddPath(IMP_HANDLE imp,const char *path)
|
||||
{
|
||||
impPvt *handle = (impPvt *)imp;
|
||||
|
||||
ELLLIST *ppathList;
|
||||
pathNode *ppathNode;
|
||||
const char *pcolon;
|
||||
const char *pdir;
|
||||
int len;
|
||||
|
||||
if(!handle) return(impFailure);
|
||||
ppathList = &handle->pathList;
|
||||
pdir = path;
|
||||
while(pdir) {
|
||||
if(*pdir == ':') {
|
||||
pdir++;
|
||||
continue;
|
||||
}
|
||||
ppathNode = (pathNode *)impCalloc(1,sizeof(pathNode));
|
||||
ellAdd(ppathList,&ppathNode->node);
|
||||
pcolon = strchr(pdir,':');
|
||||
len = (pcolon ? (pcolon - pdir) : strlen(pdir));
|
||||
ppathNode->directory = (char *)impCalloc(1,len + 1);
|
||||
strncpy(ppathNode->directory,pdir,len);
|
||||
pdir = (pcolon ? (pcolon+1) : 0);
|
||||
}
|
||||
return(impSuccess);
|
||||
}
|
||||
|
||||
int impPrintInclude(IMP_HANDLE imp,FILE *fp)
|
||||
{
|
||||
impPvt *handle = (impPvt *)imp;
|
||||
inputFile *pinputFile;
|
||||
|
||||
if(!handle) return(impFailure);
|
||||
pinputFile = (inputFile *)ellLast(&handle->inputFileList);
|
||||
if(!pinputFile || !handle->buffer) return(impFailure);
|
||||
fprintf(fp,"input line: %s",handle->buffer);
|
||||
while(pinputFile) {
|
||||
if(pinputFile->filename) {
|
||||
fprintf(fp," in:");
|
||||
if(pinputFile->path)
|
||||
fprintf(fp," path \"%s\" ",pinputFile->path);
|
||||
fprintf(fp," file %s",pinputFile->filename);
|
||||
} else {
|
||||
fprintf(fp,"stdin:");
|
||||
if(pinputFile->path)
|
||||
fprintf(fp," path \"%s\" ",pinputFile->path);
|
||||
}
|
||||
fprintf(fp," line %d\n",pinputFile->line_num);
|
||||
pinputFile = (inputFile *)ellPrevious(&pinputFile->node);
|
||||
}
|
||||
fprintf(fp,"\n");
|
||||
return(impSuccess);
|
||||
}
|
||||
|
||||
int impDumpPath(IMP_HANDLE imp)
|
||||
{
|
||||
impPvt *handle = (impPvt *)imp;
|
||||
ELLLIST *ppathList;
|
||||
pathNode *ppathNode;
|
||||
|
||||
if(!handle) return(impFailure);
|
||||
ppathList = &handle->pathList;
|
||||
if(!ppathList || !(ppathNode = (pathNode *)ellFirst(ppathList))) {
|
||||
printf("no path defined\n");
|
||||
return(impSuccess);
|
||||
}
|
||||
while(ppathNode) {
|
||||
printf("%s",ppathNode->directory);
|
||||
ppathNode = (pathNode *)ellNext(&ppathNode->node);
|
||||
if(ppathNode) printf(":");
|
||||
}
|
||||
printf("\n");
|
||||
return(impSuccess);
|
||||
}
|
||||
|
||||
int impOpenFile(IMP_HANDLE imp,char *filename)
|
||||
{
|
||||
impPvt *handle = (impPvt *)imp;
|
||||
inputFile *pinputFile;
|
||||
FILE *fp;
|
||||
char *penv;
|
||||
|
||||
if(!handle) return(impFailure);
|
||||
freeInputFileList(handle);
|
||||
if((ellCount(&handle->pathList)==0) && handle->envName) {
|
||||
penv = getenv(handle->envName);
|
||||
if(penv)impSetPath(imp,penv);
|
||||
}
|
||||
pinputFile = impCalloc(1,sizeof(inputFile));
|
||||
if(filename) {
|
||||
pinputFile->filename = impCalloc(strlen(filename)+1,sizeof(char));
|
||||
strcpy(pinputFile->filename,filename);
|
||||
pinputFile->path = openFile(handle,filename,&fp);
|
||||
if(!fp) {
|
||||
epicsPrintf("Error opening file %s\n",filename);
|
||||
return(impFailure);
|
||||
}
|
||||
} else {
|
||||
fp = stdin;
|
||||
}
|
||||
pinputFile->fp = fp;
|
||||
pinputFile->line_num = 0;
|
||||
handle->buffer[0] = '\0';
|
||||
ellAdd(&handle->inputFileList,&pinputFile->node);
|
||||
return(impSuccess);
|
||||
}
|
||||
|
||||
int impCloseFile(IMP_HANDLE imp)
|
||||
{
|
||||
impPvt *handle = (impPvt *)imp;
|
||||
|
||||
if(!handle) return(impFailure);
|
||||
if(ellCount(&handle->inputFileList) !=0) freeInputFileList(handle);
|
||||
return(impSuccess);
|
||||
}
|
||||
|
||||
int impGetLine(IMP_HANDLE imp,char *buffer,int bufferSize)
|
||||
{
|
||||
impPvt *handle = (impPvt *)imp;
|
||||
char *fgetsRtn;
|
||||
int n;
|
||||
char *pfirst;
|
||||
size_t nskip;
|
||||
char *parameter;
|
||||
inputFile *pinputFileNow;
|
||||
|
||||
if(!handle) return(impFailure);
|
||||
while(TRUE) { /*until we get some input*/
|
||||
MAC_HANDLE *macHandle = handle->macHandle;
|
||||
|
||||
pinputFileNow = (inputFile *)ellLast(&handle->inputFileList);
|
||||
if(!pinputFileNow) return(0);
|
||||
if(macHandle)
|
||||
fgetsRtn=fgets(handle->buffer,handle->bufferSize,pinputFileNow->fp);
|
||||
else
|
||||
fgetsRtn=fgets(buffer,bufferSize,pinputFileNow->fp);
|
||||
if(!fgetsRtn) {
|
||||
if(fclose(pinputFileNow->fp))
|
||||
errPrintf(0,__FILE__, __LINE__,
|
||||
"Closing file %s",pinputFileNow->filename);
|
||||
free((void *)pinputFileNow->filename);
|
||||
ellDelete(&handle->inputFileList,(ELLNODE *)pinputFileNow);
|
||||
free((void *)pinputFileNow);
|
||||
continue;
|
||||
}
|
||||
pinputFileNow->line_num++;
|
||||
if(macHandle) {
|
||||
n = macExpandString(macHandle,handle->buffer,buffer,bufferSize-1);
|
||||
if(n<0) {
|
||||
epicsPrintf("macExpandString failed for %s",handle->buffer);
|
||||
impPrintInclude(imp,stderr);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
nskip = strspn(fgetsRtn," \t");
|
||||
pfirst = fgetsRtn + nskip;
|
||||
if(handle->includeToken
|
||||
&& pfirst[0]==handle->includeToken[0]
|
||||
&& strstr(pfirst,handle->includeToken)){
|
||||
parameter = getParameter(pfirst,handle->includeToken);
|
||||
if(!parameter) continue;
|
||||
includeNew(imp,parameter);
|
||||
free((void *)parameter);
|
||||
continue;
|
||||
}
|
||||
return(strlen(buffer));
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user