From dd43f912785ada4178adff024a2328342fcd8dbc Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Wed, 4 Sep 1996 20:10:43 +0000 Subject: [PATCH] added new files --- src/cas/example/Makefile.Vx | 38 +++++++++++++++++++++++ src/cas/example/main.cc | 61 +++++++++++++++++++++++++++++++++++++ src/cas/example/vxEntry.cc | 43 ++++++++++++++++++++++++++ 3 files changed, 142 insertions(+) create mode 100644 src/cas/example/Makefile.Vx create mode 100644 src/cas/example/main.cc create mode 100644 src/cas/example/vxEntry.cc diff --git a/src/cas/example/Makefile.Vx b/src/cas/example/Makefile.Vx new file mode 100644 index 000000000..df941c9ee --- /dev/null +++ b/src/cas/example/Makefile.Vx @@ -0,0 +1,38 @@ + +CAS = ../../ +TOP = $(CAS)/../.. + +include $(TOP)/config/CONFIG_BASE + +CXXCMPLR = STRICT + +USR_INCLUDES = +USR_LDFLAGS = + +DEPLIBS_BASE = $(EPICS_BASE_LIB) +DEPLIBS = $(DEPLIBS_BASE)/libcas.a $(DEPLIBSWOCAS) + +SRCS.cc += ../vxEntry.cc +SRCS.cc += ../exServer.cc +SRCS.cc += ../exPV.cc +SRCS.cc += ../exSyncPV.cc +SRCS.cc += ../exAsyncPV.cc +SRCS.cc += ../exChannel.cc + +LIBOBJS += vxEntry.o +LIBOBJS += exServer.o +LIBOBJS += exPV.o +LIBOBJS += exSyncPV.o +LIBOBJS += exAsyncPV.o +LIBOBJS += exChannel.o + +LIBNAME = libexserver.o +include $(TOP)/config/RULES.Vx + +excas: $(OBJS) $(DEPLIBS) + $(LINK.cc) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS) + +clean:: + @$(RM) -rf Templates.DB + @$(RM) core + diff --git a/src/cas/example/main.cc b/src/cas/example/main.cc new file mode 100644 index 000000000..8105ad523 --- /dev/null +++ b/src/cas/example/main.cc @@ -0,0 +1,61 @@ + +#include +#include + +// +// main() +// +int main (int argc, const char **argv) +{ + osiTime begin(osiTime::getCurrent()); + exServer *pCAS; + unsigned debugLevel = 0u; + float executionTime; + aitBool forever = aitTrue; + int i; + + pCAS = new exServer(32u,5u,500u); + if (!pCAS) { + return (-1); + } + + for (i=1; i -t\n", + argv[0]); + return (1); + } + + pCAS->setDebugLevel(debugLevel); + + if (forever) { + osiTime delay(1000u,0u); + // + // loop here forever + // + while (aitTrue) { + fileDescriptorManager.process(delay); + } + } + else { + osiTime total(executionTime); + osiTime delay(osiTime::getCurrent() - begin); + // + // loop here untime the specified execution time + // expires + // + while (delay < total) { + fileDescriptorManager.process(delay); + delay = osiTime::getCurrent() - begin; + } + } + delete pCAS; + return (0); +} + diff --git a/src/cas/example/vxEntry.cc b/src/cas/example/vxEntry.cc new file mode 100644 index 000000000..4a416117b --- /dev/null +++ b/src/cas/example/vxEntry.cc @@ -0,0 +1,43 @@ + +#include +#include + +// +// main() +// +int excas (unsigned debugLevel=0u, unsigned delaySec=0) +{ + osiTime begin(osiTime::getCurrent()); + exServer *pCAS; + + pCAS = new exServer(32u,5u,500u); + if (!pCAS) { + return (-1); + } + + pCAS->setDebugLevel(debugLevel); + + if (delaySec==0u) { + // + // loop here forever + // + while (aitTrue) { + taskDelay(10); + } + } + else { + osiTime total( ((float)delaySec) ); + osiTime delay(osiTime::getCurrent() - begin); + // + // loop here untill the specified execution time + // expires + // + while (delay < total) { + taskDelay(10); + delay = osiTime::getCurrent() - begin; + } + } + delete pCAS; + return (0); +} +