From 830d2ff0614a9e949ca8cca87da61507331b2f91 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Fri, 13 Jun 1997 09:20:26 +0000 Subject: [PATCH] installed --- src/cas/example/directoryService/Makefile | 7 + .../example/directoryService/Makefile.Host | 27 + .../Makefile.Vx.WorkInProgress | 38 + src/cas/example/directoryService/README | 13 + .../directoryService/directoryServer.cc | 155 ++++ .../directoryService/directoryServer.h | 135 +++ src/cas/example/directoryService/main.cc | 215 +++++ .../example/directoryService/pvDirectory.txt | 5 + src/cas/example/directoryService/templInst.cc | 27 + src/cas/example/directoryService/test.adl | 844 ++++++++++++++++++ src/cas/example/directoryService/vxEntry.cc | 81 ++ 11 files changed, 1547 insertions(+) create mode 100644 src/cas/example/directoryService/Makefile create mode 100644 src/cas/example/directoryService/Makefile.Host create mode 100644 src/cas/example/directoryService/Makefile.Vx.WorkInProgress create mode 100644 src/cas/example/directoryService/README create mode 100644 src/cas/example/directoryService/directoryServer.cc create mode 100644 src/cas/example/directoryService/directoryServer.h create mode 100644 src/cas/example/directoryService/main.cc create mode 100644 src/cas/example/directoryService/pvDirectory.txt create mode 100644 src/cas/example/directoryService/templInst.cc create mode 100644 src/cas/example/directoryService/test.adl create mode 100644 src/cas/example/directoryService/vxEntry.cc diff --git a/src/cas/example/directoryService/Makefile b/src/cas/example/directoryService/Makefile new file mode 100644 index 000000000..d2a6e1302 --- /dev/null +++ b/src/cas/example/directoryService/Makefile @@ -0,0 +1,7 @@ + +TOP=../../../.. + +include $(TOP)/config/CONFIG_BASE + +include $(TOP)/config/RULES_ARCHS + diff --git a/src/cas/example/directoryService/Makefile.Host b/src/cas/example/directoryService/Makefile.Host new file mode 100644 index 000000000..dbc5ad9f1 --- /dev/null +++ b/src/cas/example/directoryService/Makefile.Host @@ -0,0 +1,27 @@ + +CAS = ../../.. +TOP = $(CAS)/../.. + +include $(TOP)/config/CONFIG_BASE + +CXXCMPLR = STRICT + +PROD_LIBS := cas ca gdd Com + +SRCS += main.cc +SRCS += directoryServer.cc +SRCS += templInst.cc + +PROD := caDirServ + +include $(TOP)/config/RULES.Host + +pcaDirServ: $(PROD_OBJS) $(PRODDEPLIBS) + $(PURIFY) $(PROD_LINKER) $(PROD_OBJS) $(LDLIBS) + +clean:: + @$(RM) caDirServ + @$(RM) pcaDirServ + @$(RM) -rf Templates.DB + @$(RM) core + diff --git a/src/cas/example/directoryService/Makefile.Vx.WorkInProgress b/src/cas/example/directoryService/Makefile.Vx.WorkInProgress new file mode 100644 index 000000000..e85297480 --- /dev/null +++ b/src/cas/example/directoryService/Makefile.Vx.WorkInProgress @@ -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/directoryService/README b/src/cas/example/directoryService/README new file mode 100644 index 000000000..be747381d --- /dev/null +++ b/src/cas/example/directoryService/README @@ -0,0 +1,13 @@ + +This directory contains an example ca directory (name resolution) server. + +The directory server reads in a file with records as follows: + [] + +The server responds to search requests with the true server address of +the PV (not the address of this directory server). + +This server can be used to cause EPICS to locate any PV listed in +the file anywhere on the internet. You must of course set EPICS_CA_ADDR_LIST +for the client so that it points at a running instance of this directory +(name resolution) server. \ No newline at end of file diff --git a/src/cas/example/directoryService/directoryServer.cc b/src/cas/example/directoryService/directoryServer.cc new file mode 100644 index 000000000..def5b59fd --- /dev/null +++ b/src/cas/example/directoryService/directoryServer.cc @@ -0,0 +1,155 @@ + +// +// Example EPICS CA directory server +// + +#include "directoryServer.h" +#include "tsMinMax.h" + +const pvInfo *pvInfo::pFirst; + +// +// directoryServer::directoryServer() +// +directoryServer::directoryServer(const char * const pvPrefix, unsigned pvCount, unsigned aliasCount) : + caServer(pvCount*(aliasCount+1u)) +{ + unsigned i; + const pvInfo *pPVI; + int resLibStatus; + char pvAlias[256]; + const char * const pNameFmtStr = "%.100s%.20s"; + const char * const pAliasFmtStr = "%.100s%.20s%u"; + + // + // hash table size may need adjustment here? + // + resLibStatus = this->stringResTbl.init(pvCount*(aliasCount+1u)); + if (resLibStatus) { + fprintf(stderr, "CAS: string resource id table init failed\n"); + // + // should throw an exception once this is portable + // + assert(resLibStatus==0); + } + + // + // pre-create all of the simple PVs that this server will export + // + for (pPVI = pvInfo::getFirst(); pPVI; pPVI=pPVI->getNext()) { + + // + // Install canonical (root) name + // + sprintf(pvAlias, pNameFmtStr, pvPrefix, pPVI->getName()); + this->installAliasName(*pPVI, pvAlias); + + // + // Install numbered alias names + // + for (i=0u; igetName(), i); + this->installAliasName(*pPVI, pvAlias); + } + } +} + +// +// directoryServer::installAliasName() +// +void directoryServer::installAliasName(const pvInfo &info, const char *pAliasName) +{ + pvEntry *pEntry; + + pEntry = new pvEntry(info, *this, pAliasName); + if (pEntry) { + int resLibStatus; + resLibStatus = this->stringResTbl.add(*pEntry); + if (resLibStatus==0) { + return; + } + else { + delete pEntry; + } + } + fprintf(stderr, +"Unable to enter PV=\"%s\" Alias=\"%s\" in PV name alias hash table\n", + info.getName(), pAliasName); +} + +// +// directoryServer::pvExistTest() +// +pvExistReturn directoryServer::pvExistTest + (const casCtx&, const char *pPVName) +{ + // + // lifetime of id is shorter than lifetime of pName + // + char pvNameBuf[512]; + stringId id(pPVName, stringId::refString); + stringId idBuf(pvNameBuf, stringId::refString); + pvEntry *pPVE; + const char *pStr, *pLastStr; + + // + // strip trailing occurrence of ".field" + // (for compatibility with EPICS + // function block database). + // + pStr = pPVName; + do { + pLastStr = pStr; + pStr = strstr (pStr, "."); + } + while (pStr); + + if (pLastStr==pPVName) { + pPVE = this->stringResTbl.lookup(id); + if (!pPVE) { + return pverDoesNotExistHere; + } + } + else { + size_t diff = pLastStr-pPVName; + diff = tsMin (diff, sizeof(pvNameBuf)-1); + memcpy (pvNameBuf, pPVName, diff); + pvNameBuf[diff] = '\0'; + pLastStr = pvNameBuf; + pPVE = this->stringResTbl.lookup(idBuf); + if (!pPVE) { + // + // look for entire PV name (in case this PV isnt + // associated a function block database) + // + // lifetime of id2 is shorter than lifetime of pName + // + pPVE = this->stringResTbl.lookup(id); + if (!pPVE) { + return pverDoesNotExistHere; + } + } + } + + return pvExistReturn (caNetAddr(pPVE->getInfo().getAddr())); +} + + +// +// directoryServer::show() +// +void directoryServer::show (unsigned level) const +{ + // + // server tool specific show code goes here + // + this->stringResTbl.show(level); + + // + // print information about ca server libarary + // internals + // + this->caServer::show(level); +} + diff --git a/src/cas/example/directoryService/directoryServer.h b/src/cas/example/directoryService/directoryServer.h new file mode 100644 index 000000000..29e839fd6 --- /dev/null +++ b/src/cas/example/directoryService/directoryServer.h @@ -0,0 +1,135 @@ +// +// Example EPICS CA directory server +// +// +// caServer +// | +// directoryServer +// +// + + +// +// ANSI C +// +#include +#include + +// +// EPICS +// +#include "epicsAssert.h" +#define caNetAddrSock +#include "casdef.h" +#include "resourceLib.h" + + +#ifndef NELEMENTS +# define NELEMENTS(A) (sizeof(A)/sizeof(A[0])) +#endif + +class directoryServer; + +// +// pvInfo +// +class pvInfo { +public: + pvInfo (const char *pNameIn, sockaddr_in addrIn) : + addr(addrIn), pNext(pvInfo::pFirst) + { + pvInfo::pFirst = this; + this->pName = new char [strlen(pNameIn)+1u]; + assert(this->pName); + strcpy(this->pName, pNameIn); + } + + const struct sockaddr_in getAddr() const { return this->addr; } + const char *getName () const { return this->pName; } + const pvInfo *getNext () const { return this->pNext; } + static const pvInfo *getFirst () { return pvInfo::pFirst; } +private: + struct sockaddr_in addr; + char *pName; + const pvInfo *pNext; + static const pvInfo *pFirst; +}; + +// +// pvEntry +// +// o entry in the string hash table for the pvInfo +// o Since there may be aliases then we may end up +// with several of this class all referencing +// the same pv info class (justification +// for this breaking out into a seperate class +// from pvInfo) +// +class pvEntry : public stringId, public tsSLNode { +public: + pvEntry (const pvInfo &infoIn, directoryServer &casIn, + const char *pAliasName) : + stringId(pAliasName), info(infoIn), cas(casIn) + { + assert(this->stringId::resourceName()!=NULL); + } + + inline ~pvEntry(); + + const pvInfo &getInfo() const { return this->info; } + + inline void destroy (); + +private: + const pvInfo &info; + directoryServer &cas; +}; + + + +// +// directoryServer +// +class directoryServer : public caServer { +public: + directoryServer (const char * const pvPrefix, unsigned pvCount, unsigned aliasCount); + void show (unsigned level) const; + pvExistReturn pvExistTest (const casCtx&, const char *pPVName); + + void installAliasName (const pvInfo &info, const char *pAliasName); + inline void removeAliasName(pvEntry &entry); + +private: + resTable stringResTbl; +}; + + +// +// directoryServer::removeAliasName() +// +inline void directoryServer::removeAliasName(pvEntry &entry) +{ + pvEntry *pE; + pE = this->stringResTbl.remove(entry); + assert(pE = &entry); +} + +// +// pvEntry::~pvEntry() +// +inline pvEntry::~pvEntry() +{ + this->cas.removeAliasName(*this); +} + +// +// pvEntry::destroy() +// +inline void pvEntry::destroy () +{ + // + // always created with new + // + delete this; +} + diff --git a/src/cas/example/directoryService/main.cc b/src/cas/example/directoryService/main.cc new file mode 100644 index 000000000..60a932b5d --- /dev/null +++ b/src/cas/example/directoryService/main.cc @@ -0,0 +1,215 @@ + +#include + +#include "directoryServer.h" +#include "fdManager.h" + +#define LOCAL static + +LOCAL int parseDirectoryFile (const char *pFileName); +LOCAL int parseDirectoryFP (FILE *pf, const char *pFileName); + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef INADDR_NONE +#define INADDR_NONE (~0ul) +#endif + +// +// main() +// (example single threaded ca server tool main loop) +// +extern int main (int argc, const char **argv) +{ + osiTime begin(osiTime::getCurrent()); + directoryServer *pCAS; + unsigned debugLevel = 0u; + float executionTime; + char pvPrefix[128] = ""; + char fileName[128] = "pvDirectory.txt"; + unsigned aliasCount = 0u; + aitBool forever = aitTrue; + int nPV; + int i; + + for (i=1; i -t -p -c -f]\n", + argv[0]); + + return (1); + } + + nPV = parseDirectoryFile (fileName); + if (nPV<=0) { + fprintf(stderr, +"No PVs in directory file=%s. Exiting because there is no useful work to do.\n", + fileName); + return (-1); + } + + pCAS = new directoryServer(pvPrefix, (unsigned) nPV, aliasCount); + if (!pCAS) { + 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; + } + } + pCAS->show(2u); + delete pCAS; + return (0); +} + +// +// parseDirectoryFile() +// +// PV directory file is expected to have entries of the form: +// [] +// +// +LOCAL int parseDirectoryFile (const char *pFileName) +{ + + FILE *pf; + int nPV; + + // + // open a file that contains the PV directory + // + pf = fopen(pFileName, "r"); + if (!pf) { + fprintf(stderr, "Directory file access probems with file=\"%s\" because \"%s\"\n", + pFileName, strerror(errno)); + return (-1); + } + + nPV = parseDirectoryFP (pf, pFileName); + + fclose (pf); + + return nPV; +} + +// +// parseDirectoryFP() +// +// PV directory file is expected to have entries of the form: +// [] +// +// +LOCAL int parseDirectoryFP (FILE *pf, const char *pFileName) +{ + pvInfo *pPVI; + char pvNameStr[128]; + struct sockaddr_in ipa; + char hostNameStr[128]; + int nPV=0; + + ipa.sin_family = AF_INET; + while (TRUE) { + + // + // parse the PV name entry from the file + // + if (fscanf(pf, " %127s ", pvNameStr) != 1) { + return nPV; // success + } + + // + // parse out server address + // + if (fscanf(pf, " %s ", hostNameStr) == 1) { + + ipa.sin_addr.s_addr = inet_addr(hostNameStr); + if (ipa.sin_addr.s_addr==INADDR_NONE) { + struct hostent *pent; + + pent = gethostbyname(hostNameStr); + if (!pent) { + fprintf (pf, "Unknown host name=\"%s\" (or bad dotted ip addr) in \"%s\" with PV=\"%s\"?\n", + hostNameStr, pFileName, pvNameStr); + return -1; + } + if (pent->h_addrtype != AF_INET) { + fprintf (pf, "Unknown addr type for host=\"%s\" in \"%s\" with PV=\"%s\" addr type=%u?\n", + hostNameStr, pFileName, pvNameStr, pent->h_addrtype); + return -1; + } + assert (pent->h_addr_list[0]); + assert (pent->h_length==sizeof(ipa.sin_addr)); + + memcpy ((char *)&ipa.sin_addr, pent->h_addr_list[0], pent->h_length); + + } + } + else { + fprintf (stderr,"No host name (or dotted ip addr) after PV name in \"%s\" with PV=\"%s\"?\n", + pFileName, pvNameStr); + return -1; + } + + // + // parse out optional IP port number + // + unsigned portNumber; + if (fscanf(pf, " %u ", &portNumber) == 1) { + if (portNumber>0xffff) { + fprintf (stderr,"Port number supplied is to large in \"%s\" with PV=\"%s\" host=\"%s\" port=%u?\n", + pFileName, pvNameStr, hostNameStr, portNumber); + return -1; + } + + ipa.sin_port = (aitUint16) portNumber; + } + else { + ipa.sin_port = 0u; // will default to this server's port + } + + pPVI = new pvInfo (pvNameStr, ipa); + if (!pPVI) { + fprintf (stderr, "Unable to allocate space for a new PV in \"%s\" with PV=\"%s\" host=\"%s\"\n", + pFileName, pvNameStr, hostNameStr); + return -1; + } + nPV++; + } +} diff --git a/src/cas/example/directoryService/pvDirectory.txt b/src/cas/example/directoryService/pvDirectory.txt new file mode 100644 index 000000000..3fe449c3b --- /dev/null +++ b/src/cas/example/directoryService/pvDirectory.txt @@ -0,0 +1,5 @@ + +ca:ai_2000 ioc3.atdiv.lanl.gov 22000 +ca:ai_2001 128.165.32.83 22000 +ca:ao_2000 ioc3 +ca:ao_2001 128.165.32.83 diff --git a/src/cas/example/directoryService/templInst.cc b/src/cas/example/directoryService/templInst.cc new file mode 100644 index 000000000..9716054b4 --- /dev/null +++ b/src/cas/example/directoryService/templInst.cc @@ -0,0 +1,27 @@ + +// +// $Id$ +// +// Explcit instantiation of template instances used by the +// example server +// +// + +#include "directoryServer.h" +#include "resourceLib.cc" + +// +// if the compiler supports explicit instantiation of +// template member functions +// +#if defined(EXPL_TEMPL) + // + // From Stroustrups's "The C++ Programming Language" + // Appendix A: r.14.9 + // + // This explicitly instantiates the template class's + // member functions into "templInst.o" + // + template class resTable ; +#endif + diff --git a/src/cas/example/directoryService/test.adl b/src/cas/example/directoryService/test.adl new file mode 100644 index 000000000..6086a3be5 --- /dev/null +++ b/src/cas/example/directoryService/test.adl @@ -0,0 +1,844 @@ +file { + name="test.dl" +} +display { + magic="305419896" + majv="2" + mnrv="4" + ndyng="0" + npc="5" + nstr="8" + ndynamic="12" + nplot="0" + nrd="0" + nes="0" + nkd="0" + object { + x="0" + y="0" + width="421" + height="306" + } + clr="0" + bclr="1" + nwords_dspy="1106" + nwords_sta="28" + nwords_cmap="36" + nwords_crules="106" + odyng="306" + osta="278" + odynamic="306" + oplot="1106" + ord="1106" + oes="1106" + okd="1106" + opc="58" + ostr="88" + ocmap="136" + ocrules="172" + style="solid" + fill="outline" + width="0" + clrmod="static" + vismod="static" + clrrule="alarm" + pv="" + cmap="" +} +"<>" { + ncolors="8" + dl_color { + r="255" + g="255" + b="255" + inten="255" + blink="off" + RISCpad="128" + } + dl_color { + r="0" + g="0" + b="0" + inten="0" + blink="off" + RISCpad="75" + } + dl_color { + r="255" + g="0" + b="0" + inten="255" + blink="off" + RISCpad="-14684" + } + dl_color { + r="255" + g="0" + b="0" + inten="255" + blink="on" + RISCpad="14744" + } + dl_color { + r="255" + g="255" + b="0" + inten="255" + blink="off" + RISCpad="-16536" + } + dl_color { + r="255" + g="255" + b="0" + inten="255" + blink="on" + RISCpad="-15536" + } + dl_color { + r="0" + g="0" + b="255" + inten="255" + blink="off" + RISCpad="-28408" + } + dl_color { + r="0" + g="0" + b="255" + inten="255" + blink="on" + RISCpad="0" + } +} +"<>" { + nrules="1" + dl_color_rule { + name="alarm" + info[0] { + chan="$(C).SEVR" + value="MAJOR" + connector="use" + comparator="equals" + clr="2" + RISCpad="0" + } + info[1] { + chan="$(C).SEVR" + value="MINOR" + connector="use" + comparator="equals" + clr="4" + RISCpad="127" + } + info[2] { + chan="$(C).SEVR" + value="INFO" + connector="use" + comparator="equals" + clr="6" + RISCpad="44" + } + info[3] { + chan="" + value="" + connector="use" + comparator="equals" + clr="1" + RISCpad="-128" + } + info[4] { + chan="" + value="" + connector="use" + comparator="equals" + clr="1" + RISCpad="-1" + } + info[5] { + chan="" + value="" + connector="use" + comparator="equals" + clr="1" + RISCpad="-104" + } + info[6] { + chan="" + value="" + connector="use" + comparator="equals" + clr="1" + RISCpad="-1" + } + info[7] { + chan="" + value="" + connector="use" + comparator="equals" + clr="1" + RISCpad="8" + } + info[8] { + chan="" + value="" + connector="use" + comparator="equals" + clr="1" + RISCpad="120" + } + info[9] { + chan="" + value="" + connector="use" + comparator="equals" + clr="1" + RISCpad="1" + } + info[10] { + chan="" + value="" + connector="use" + comparator="equals" + clr="1" + RISCpad="7" + } + info[11] { + chan="" + value="" + connector="use" + comparator="equals" + clr="1" + RISCpad="19" + } + info[12] { + chan="" + value="" + connector="use" + comparator="equals" + clr="1" + RISCpad="48" + } + info[13] { + chan="" + value="" + connector="use" + comparator="equals" + clr="1" + RISCpad="28" + } + info[14] { + chan="" + value="" + connector="use" + comparator="equals" + clr="1" + RISCpad="-88" + } + info[15] { + chan="" + value="" + connector="use" + comparator="equals" + clr="1" + RISCpad="0" + } + fg_enable="on" + bg_enable="on" + default_fg="0" + default_bg="1" + } +} +"<>" { + attr { + clr="0" + style="solid" + fill="outline" + width="0" + } +} +"text" { + object { + x="44" + y="16" + width="104" + height="14" + groupid="0" + } + textix="Sync" + align="horiz. left" + RISC_pad="0" +} +"text" { + object { + x="260" + y="13" + width="92" + height="17" + groupid="0" + } + textix="Async" + align="horiz. left" + RISC_pad="0" +} +"indicator" { + object { + x="15" + y="88" + width="170" + height="22" + groupid="0" + } + monitor { + chan="fred" + clr="0" + bclr="1" + label="limits" + clrmod="static" + rulechan[0] = "" + rulechan[1] = "" + rulechan[2] = "" + rulechan[3] = "" + rulechan[4] = "" + rulechan[5] = "" + rulechan[6] = "" + rulechan[7] = "" + rulechan[8] = "" + rulechan[9] = "" + rulechan[10] = "" + rulechan[11] = "" + rulechan[12] = "" + rulechan[13] = "" + rulechan[14] = "" + rulechan[15] = "" + clrrule="alarm" + clrargs="" + rulecolorbg="0" + rulecolorfg="0" + hdl="0" + ldl="0" + prec="-1" + newunits="" + units="none" + decorate="none" + convertFunc="" + convertParams="" + } + direction="down" + RISC_pad="0" +} +"text update" { + object { + x="16" + y="133" + width="169" + height="17" + groupid="0" + } + monitor { + chan="fred" + clr="0" + bclr="1" + label="none" + clrmod="static" + rulechan[0] = "" + rulechan[1] = "" + rulechan[2] = "" + rulechan[3] = "" + rulechan[4] = "" + rulechan[5] = "" + rulechan[6] = "" + rulechan[7] = "" + rulechan[8] = "" + rulechan[9] = "" + rulechan[10] = "" + rulechan[11] = "" + rulechan[12] = "" + rulechan[13] = "" + rulechan[14] = "" + rulechan[15] = "" + clrrule="alarm" + clrargs="" + rulecolorbg="0" + rulecolorfg="0" + hdl="0" + ldl="0" + prec="-1" + newunits="" + units="append" + decorate="none" + convertFunc="" + convertParams="" + } + align="horiz. left" + format="decimal" +} +"valuator" { + object { + x="15" + y="43" + width="168" + height="26" + groupid="0" + } + control { + chan="fred" + clr="0" + bclr="1" + label="limits" + clrmod="static" + rulechan[0] = "" + rulechan[1] = "" + rulechan[2] = "" + rulechan[3] = "" + rulechan[4] = "" + rulechan[5] = "" + rulechan[6] = "" + rulechan[7] = "" + rulechan[8] = "" + rulechan[9] = "" + rulechan[10] = "" + rulechan[11] = "" + rulechan[12] = "" + rulechan[13] = "" + rulechan[14] = "" + rulechan[15] = "" + clrrule="alarm" + clrargs="" + rulecolorbg="0" + rulecolorfg="0" + hdl="0" + ldl="0" + prec="-1" + newunits="" + units="none" + decorate="none" + convertFunc="" + convertParams="" + } + direction="down" + gain="coarse" + sendMode="send on motion" + increment="0" +} +"indicator" { + object { + x="215" + y="81" + width="170" + height="30" + groupid="0" + } + monitor { + chan="freddy" + clr="0" + bclr="1" + label="limits" + clrmod="static" + rulechan[0] = "" + rulechan[1] = "" + rulechan[2] = "" + rulechan[3] = "" + rulechan[4] = "" + rulechan[5] = "" + rulechan[6] = "" + rulechan[7] = "" + rulechan[8] = "" + rulechan[9] = "" + rulechan[10] = "" + rulechan[11] = "" + rulechan[12] = "" + rulechan[13] = "" + rulechan[14] = "" + rulechan[15] = "" + clrrule="alarm" + clrargs="" + rulecolorbg="0" + rulecolorfg="0" + hdl="0" + ldl="0" + prec="-1" + newunits="" + units="none" + decorate="none" + convertFunc="" + convertParams="" + } + direction="down" + RISC_pad="0" +} +"text update" { + object { + x="216" + y="133" + width="171" + height="18" + groupid="0" + } + monitor { + chan="freddy" + clr="0" + bclr="1" + label="none" + clrmod="static" + rulechan[0] = "" + rulechan[1] = "" + rulechan[2] = "" + rulechan[3] = "" + rulechan[4] = "" + rulechan[5] = "" + rulechan[6] = "" + rulechan[7] = "" + rulechan[8] = "" + rulechan[9] = "" + rulechan[10] = "" + rulechan[11] = "" + rulechan[12] = "" + rulechan[13] = "" + rulechan[14] = "" + rulechan[15] = "" + clrrule="alarm" + clrargs="" + rulecolorbg="0" + rulecolorfg="0" + hdl="0" + ldl="0" + prec="-1" + newunits="" + units="append" + decorate="none" + convertFunc="" + convertParams="" + } + align="horiz. left" + format="decimal" +} +"valuator" { + object { + x="215" + y="43" + width="168" + height="28" + groupid="0" + } + control { + chan="freddy" + clr="0" + bclr="1" + label="limits" + clrmod="static" + rulechan[0] = "" + rulechan[1] = "" + rulechan[2] = "" + rulechan[3] = "" + rulechan[4] = "" + rulechan[5] = "" + rulechan[6] = "" + rulechan[7] = "" + rulechan[8] = "" + rulechan[9] = "" + rulechan[10] = "" + rulechan[11] = "" + rulechan[12] = "" + rulechan[13] = "" + rulechan[14] = "" + rulechan[15] = "" + clrrule="alarm" + clrargs="" + rulecolorbg="0" + rulecolorfg="0" + hdl="0" + ldl="0" + prec="-1" + newunits="" + units="none" + decorate="none" + convertFunc="" + convertParams="" + } + direction="down" + gain="coarse" + sendMode="send on motion" + increment="0" +} +"indicator" { + object { + x="16" + y="225" + width="171" + height="19" + groupid="0" + } + monitor { + chan="jane" + clr="0" + bclr="1" + label="limits" + clrmod="static" + rulechan[0] = "" + rulechan[1] = "" + rulechan[2] = "" + rulechan[3] = "" + rulechan[4] = "" + rulechan[5] = "" + rulechan[6] = "" + rulechan[7] = "" + rulechan[8] = "" + rulechan[9] = "" + rulechan[10] = "" + rulechan[11] = "" + rulechan[12] = "" + rulechan[13] = "" + rulechan[14] = "" + rulechan[15] = "" + clrrule="alarm" + clrargs="" + rulecolorbg="0" + rulecolorfg="0" + hdl="0" + ldl="0" + prec="-1" + newunits="" + units="none" + decorate="none" + convertFunc="" + convertParams="" + } + direction="down" + RISC_pad="0" +} +"text update" { + object { + x="17" + y="259" + width="170" + height="20" + groupid="0" + } + monitor { + chan="jane" + clr="0" + bclr="1" + label="none" + clrmod="static" + rulechan[0] = "" + rulechan[1] = "" + rulechan[2] = "" + rulechan[3] = "" + rulechan[4] = "" + rulechan[5] = "" + rulechan[6] = "" + rulechan[7] = "" + rulechan[8] = "" + rulechan[9] = "" + rulechan[10] = "" + rulechan[11] = "" + rulechan[12] = "" + rulechan[13] = "" + rulechan[14] = "" + rulechan[15] = "" + clrrule="alarm" + clrargs="" + rulecolorbg="0" + rulecolorfg="0" + hdl="0" + ldl="0" + prec="-1" + newunits="" + units="append" + decorate="none" + convertFunc="" + convertParams="" + } + align="horiz. left" + format="decimal" +} +"valuator" { + object { + x="15" + y="187" + width="170" + height="19" + groupid="0" + } + control { + chan="jane" + clr="0" + bclr="1" + label="limits" + clrmod="static" + rulechan[0] = "" + rulechan[1] = "" + rulechan[2] = "" + rulechan[3] = "" + rulechan[4] = "" + rulechan[5] = "" + rulechan[6] = "" + rulechan[7] = "" + rulechan[8] = "" + rulechan[9] = "" + rulechan[10] = "" + rulechan[11] = "" + rulechan[12] = "" + rulechan[13] = "" + rulechan[14] = "" + rulechan[15] = "" + clrrule="alarm" + clrargs="" + rulecolorbg="0" + rulecolorfg="0" + hdl="0" + ldl="0" + prec="-1" + newunits="" + units="none" + decorate="none" + convertFunc="" + convertParams="" + } + direction="down" + gain="coarse" + sendMode="send on motion" + increment="0" +} +"indicator" { + object { + x="219" + y="218" + width="173" + height="23" + groupid="0" + } + monitor { + chan="janet" + clr="0" + bclr="1" + label="limits" + clrmod="static" + rulechan[0] = "" + rulechan[1] = "" + rulechan[2] = "" + rulechan[3] = "" + rulechan[4] = "" + rulechan[5] = "" + rulechan[6] = "" + rulechan[7] = "" + rulechan[8] = "" + rulechan[9] = "" + rulechan[10] = "" + rulechan[11] = "" + rulechan[12] = "" + rulechan[13] = "" + rulechan[14] = "" + rulechan[15] = "" + clrrule="alarm" + clrargs="" + rulecolorbg="0" + rulecolorfg="0" + hdl="0" + ldl="0" + prec="-1" + newunits="" + units="none" + decorate="none" + convertFunc="" + convertParams="" + } + direction="down" + RISC_pad="0" +} +"text update" { + object { + x="220" + y="257" + width="174" + height="20" + groupid="0" + } + monitor { + chan="janet" + clr="0" + bclr="1" + label="none" + clrmod="static" + rulechan[0] = "" + rulechan[1] = "" + rulechan[2] = "" + rulechan[3] = "" + rulechan[4] = "" + rulechan[5] = "" + rulechan[6] = "" + rulechan[7] = "" + rulechan[8] = "" + rulechan[9] = "" + rulechan[10] = "" + rulechan[11] = "" + rulechan[12] = "" + rulechan[13] = "" + rulechan[14] = "" + rulechan[15] = "" + clrrule="alarm" + clrargs="" + rulecolorbg="0" + rulecolorfg="0" + hdl="0" + ldl="0" + prec="-1" + newunits="" + units="append" + decorate="none" + convertFunc="" + convertParams="" + } + align="horiz. left" + format="decimal" +} +"valuator" { + object { + x="219" + y="188" + width="171" + height="21" + groupid="0" + } + control { + chan="janet" + clr="0" + bclr="1" + label="limits" + clrmod="static" + rulechan[0] = "" + rulechan[1] = "" + rulechan[2] = "" + rulechan[3] = "" + rulechan[4] = "" + rulechan[5] = "" + rulechan[6] = "" + rulechan[7] = "" + rulechan[8] = "" + rulechan[9] = "" + rulechan[10] = "" + rulechan[11] = "" + rulechan[12] = "" + rulechan[13] = "" + rulechan[14] = "" + rulechan[15] = "" + clrrule="alarm" + clrargs="" + rulecolorbg="0" + rulecolorfg="0" + hdl="0" + ldl="0" + prec="-1" + newunits="" + units="none" + decorate="none" + convertFunc="" + convertParams="" + } + direction="down" + gain="coarse" + sendMode="send on motion" + increment="0" +} diff --git a/src/cas/example/directoryService/vxEntry.cc b/src/cas/example/directoryService/vxEntry.cc new file mode 100644 index 000000000..c7bce818a --- /dev/null +++ b/src/cas/example/directoryService/vxEntry.cc @@ -0,0 +1,81 @@ +// +// $Id$ +// Author: Jeff HIll (LANL) +// +// $Log$ +// Revision 1.2 1997/04/10 19:39:26 jhill +// API changes +// +// Revision 1.1 1996/12/06 22:20:22 jhill +// moved down one level +// +// Revision 1.2 1996/09/16 18:22:09 jhill +// added cvs log entries +// +// + +#include +#include + +#include "exServer.h" + +// +// so we can call this from the vxWorks shell +// +extern "C" { + +exServer *pExampleCAS; + +// +// excas () +// (vxWorks example server entry point) +// +int excas (unsigned debugLevel, unsigned delaySec) +{ + osiTime begin(osiTime::getCurrent()); + exServer *pCAS; + + pCAS = new exServer(32u,5u,500u); + if (!pCAS) { + return (-1); + } + + pCAS->setDebugLevel(debugLevel); + pExampleCAS = pCAS; + + if (delaySec==0u) { + // + // loop here forever + // + while (1) { + 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; + } + } + pCAS->show(debugLevel); + pExampleCAS = NULL; + delete pCAS; + return 0; +} + +int excasShow(unsigned level) +{ + if (pExampleCAS!=NULL) { + pExampleCAS->show(level); + } + return 0; +} + +} // extern "C" +