API changes and include with not <>
This commit is contained in:
@@ -27,6 +27,9 @@
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* $Log$
|
||||
* Revision 1.7 1997/01/22 22:06:49 jhill
|
||||
* doc
|
||||
*
|
||||
* Revision 1.6 1996/11/02 01:56:55 jhill
|
||||
* improved message
|
||||
*
|
||||
@@ -46,9 +49,9 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <epicsAssert.h>
|
||||
#include <epicsPrint.h>
|
||||
#include <epicsVersion.h>
|
||||
#include "epicsAssert.h"
|
||||
#include "epicsPrint.h"
|
||||
#include "epicsVersion.h"
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* $Log$
|
||||
* Revision 1.6 1997/01/22 22:07:22 jhill
|
||||
* doc
|
||||
*
|
||||
* Revision 1.5 1996/06/19 17:14:12 jhill
|
||||
* print out the EPICS release when there is an assert failure
|
||||
*
|
||||
@@ -47,9 +50,9 @@
|
||||
#include <vxWorks.h>
|
||||
#include <taskLib.h>
|
||||
|
||||
#include <epicsAssert.h>
|
||||
#include <epicsPrint.h>
|
||||
#include <epicsVersion.h>
|
||||
#include "epicsAssert.h"
|
||||
#include "epicsPrint.h"
|
||||
#include "epicsVersion.h"
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <epicsAssert.h>
|
||||
#include <bucketLib.h>
|
||||
#include "epicsAssert.h"
|
||||
#include "bucketLib.h"
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
|
||||
@@ -33,6 +33,9 @@
|
||||
* .02 121693 joh added bucketFree()
|
||||
* .03 052395 joh use std EPICS status
|
||||
* $Log$
|
||||
* Revision 1.2 1996/06/19 19:44:53 jhill
|
||||
* C++ support
|
||||
*
|
||||
*
|
||||
* NOTES:
|
||||
* .01 Storage for identifier must persist until an item is deleted
|
||||
@@ -45,8 +48,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <errMdef.h>
|
||||
#include <epicsTypes.h>
|
||||
#include "errMdef.h"
|
||||
#include "epicsTypes.h"
|
||||
|
||||
typedef unsigned BUCKETID;
|
||||
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <epicsAssert.h>
|
||||
#include <bucketLib.h>
|
||||
#include "epicsAssert.h"
|
||||
#include "bucketLib.h"
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
|
||||
@@ -33,6 +33,9 @@
|
||||
* .02 121693 joh added bucketFree()
|
||||
* .03 052395 joh use std EPICS status
|
||||
* $Log$
|
||||
* Revision 1.2 1996/06/19 19:44:53 jhill
|
||||
* C++ support
|
||||
*
|
||||
*
|
||||
* NOTES:
|
||||
* .01 Storage for identifier must persist until an item is deleted
|
||||
@@ -45,8 +48,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <errMdef.h>
|
||||
#include <epicsTypes.h>
|
||||
#include "errMdef.h"
|
||||
#include "epicsTypes.h"
|
||||
|
||||
typedef unsigned BUCKETID;
|
||||
|
||||
|
||||
@@ -109,8 +109,8 @@
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <dbDefs.h>
|
||||
#include <post.h>
|
||||
#include "dbDefs.h"
|
||||
#include "post.h"
|
||||
#include <math.h>
|
||||
|
||||
static double local_random();
|
||||
|
||||
@@ -98,8 +98,8 @@
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <dbDefs.h>
|
||||
#include <post.h>
|
||||
#include "dbDefs.h"
|
||||
#include "post.h"
|
||||
#include <ctype.h>
|
||||
|
||||
/* declarations for postfix */
|
||||
|
||||
@@ -109,8 +109,8 @@
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <dbDefs.h>
|
||||
#include <post.h>
|
||||
#include "dbDefs.h"
|
||||
#include "post.h"
|
||||
#include <math.h>
|
||||
|
||||
static double local_random();
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <limits.h> /* XPG2/XPG3/POSIX.1/FIPS151-1/ANSI-C */
|
||||
#include <cvtFast.h>
|
||||
#include "cvtFast.h"
|
||||
|
||||
/*
|
||||
* This routine converts numbers less than 10,000,000. It defers to f_to_str for
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <limits.h> /* XPG2/XPG3/POSIX.1/FIPS151-1/ANSI-C */
|
||||
#include <cvtFast.h>
|
||||
#include "cvtFast.h"
|
||||
|
||||
/*
|
||||
* This routine converts numbers less than 10,000,000. It defers to f_to_str for
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ellLib.h>
|
||||
#include "ellLib.h"
|
||||
|
||||
#if !defined(NULL)
|
||||
#define NULL 0
|
||||
|
||||
@@ -51,7 +51,7 @@ struct ELLLIST {
|
||||
};
|
||||
typedef struct ELLLIST ELLLIST;
|
||||
|
||||
#ifdef __STDC__
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
|
||||
#ifdef DLLLIB_USE_MACROS
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ellLib.h>
|
||||
#include "ellLib.h"
|
||||
|
||||
#if !defined(NULL)
|
||||
#define NULL 0
|
||||
|
||||
@@ -51,7 +51,7 @@ struct ELLLIST {
|
||||
};
|
||||
typedef struct ELLLIST ELLLIST;
|
||||
|
||||
#ifdef __STDC__
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
|
||||
#ifdef DLLLIB_USE_MACROS
|
||||
|
||||
|
||||
67
src/libCom/env/envDefs.h
vendored
67
src/libCom/env/envDefs.h
vendored
@@ -32,6 +32,7 @@
|
||||
* .05 04-20-95 anj moved defaults to CONFIG_ENV
|
||||
* .06 09-11-96 joh ANSI prototypes
|
||||
* .07 09-18-96 joh added envParamIsEmpty()
|
||||
* .08 03-18-97 joh remove env param length limit
|
||||
*
|
||||
* make options
|
||||
* -DvxWorks makes a version for VxWorks
|
||||
@@ -59,35 +60,39 @@
|
||||
#ifndef envDefsH
|
||||
#define envDefsH
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "shareLib.h"
|
||||
#include "osiSock.h"
|
||||
|
||||
typedef struct envParam {
|
||||
char *name; /* text name of the parameter */
|
||||
char dflt[80]; /* default value for the parameter */
|
||||
char *pdflt;
|
||||
} ENV_PARAM;
|
||||
|
||||
/*
|
||||
* bldEnvData looks for "epicsShareExtern ENV_PARAM"
|
||||
*/
|
||||
epicsShareExtern ENV_PARAM EPICS_CA_ADDR_LIST;
|
||||
epicsShareExtern ENV_PARAM EPICS_CA_CONN_TMO;
|
||||
epicsShareExtern ENV_PARAM EPICS_CA_BEACON_PERIOD;
|
||||
epicsShareExtern ENV_PARAM EPICS_CA_AUTO_ADDR_LIST;
|
||||
epicsShareExtern ENV_PARAM EPICS_CA_REPEATER_PORT;
|
||||
epicsShareExtern ENV_PARAM EPICS_CA_SERVER_PORT;
|
||||
epicsShareExtern ENV_PARAM EPICS_CAS_INTF_ADDR_LIST;
|
||||
epicsShareExtern ENV_PARAM EPICS_CAS_BEACON_ADDR_LIST;
|
||||
epicsShareExtern ENV_PARAM EPICS_CAS_SERVER_PORT;
|
||||
epicsShareExtern ENV_PARAM EPICS_TS_MIN_WEST;
|
||||
epicsShareExtern ENV_PARAM EPICS_TS_NTP_INET;
|
||||
epicsShareExtern ENV_PARAM EPICS_IOC_LOG_PORT;
|
||||
epicsShareExtern ENV_PARAM EPICS_IOC_LOG_INET;
|
||||
epicsShareExtern ENV_PARAM EPICS_IOC_LOG_FILE_LIMIT;
|
||||
epicsShareExtern ENV_PARAM EPICS_IOC_LOG_FILE_NAME;
|
||||
epicsShareExtern ENV_PARAM EPICS_IOC_LOG_FILE_COMMAND;
|
||||
epicsShareExtern ENV_PARAM EPICS_CMD_PROTO_PORT;
|
||||
epicsShareExtern ENV_PARAM EPICS_AR_PORT;
|
||||
epicsShareExtern const ENV_PARAM EPICS_CA_ADDR_LIST;
|
||||
epicsShareExtern const ENV_PARAM EPICS_CA_CONN_TMO;
|
||||
epicsShareExtern const ENV_PARAM EPICS_CA_BEACON_PERIOD;
|
||||
epicsShareExtern const ENV_PARAM EPICS_CA_AUTO_ADDR_LIST;
|
||||
epicsShareExtern const ENV_PARAM EPICS_CA_REPEATER_PORT;
|
||||
epicsShareExtern const ENV_PARAM EPICS_CA_SERVER_PORT;
|
||||
epicsShareExtern const ENV_PARAM EPICS_CAS_INTF_ADDR_LIST;
|
||||
epicsShareExtern const ENV_PARAM EPICS_CAS_BEACON_ADDR_LIST;
|
||||
epicsShareExtern const ENV_PARAM EPICS_CAS_SERVER_PORT;
|
||||
epicsShareExtern const ENV_PARAM EPICS_TS_MIN_WEST;
|
||||
epicsShareExtern const ENV_PARAM EPICS_TS_NTP_INET;
|
||||
epicsShareExtern const ENV_PARAM EPICS_IOC_LOG_PORT;
|
||||
epicsShareExtern const ENV_PARAM EPICS_IOC_LOG_INET;
|
||||
epicsShareExtern const ENV_PARAM EPICS_IOC_LOG_FILE_LIMIT;
|
||||
epicsShareExtern const ENV_PARAM EPICS_IOC_LOG_FILE_NAME;
|
||||
epicsShareExtern const ENV_PARAM EPICS_IOC_LOG_FILE_COMMAND;
|
||||
epicsShareExtern const ENV_PARAM EPICS_CMD_PROTO_PORT;
|
||||
epicsShareExtern const ENV_PARAM EPICS_AR_PORT;
|
||||
#define EPICS_ENV_VARIABLE_COUNT 18
|
||||
|
||||
/*
|
||||
@@ -97,30 +102,34 @@ epicsShareExtern ENV_PARAM EPICS_AR_PORT;
|
||||
* bldEnvData looks for "epicsShareExtern ENV_PARAM" so
|
||||
* this always needs to be divided into two lines
|
||||
*/
|
||||
epicsShareExtern ENV_PARAM
|
||||
epicsShareExtern const ENV_PARAM
|
||||
*env_param_list[EPICS_ENV_VARIABLE_COUNT+1];
|
||||
|
||||
#ifdef __STDC__
|
||||
char * epicsShareAPI envGetConfigParam(ENV_PARAM *pParam,
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
char * epicsShareAPI envGetConfigParam(const ENV_PARAM *pParam,
|
||||
int bufDim, char *pBuf);
|
||||
long epicsShareAPI envPrtConfigParam(ENV_PARAM *pParam);
|
||||
long epicsShareAPI envSetConfigParam(ENV_PARAM *pParam,
|
||||
const char * epicsShareAPI envGetConfigParamPtr(const ENV_PARAM *pParam);
|
||||
long epicsShareAPI envPrtConfigParam(const ENV_PARAM *pParam);
|
||||
long epicsShareAPI envSetConfigParam(const ENV_PARAM *pParam,
|
||||
char *value);
|
||||
long epicsShareAPI envGetInetAddrConfigParam(ENV_PARAM *pParam,
|
||||
long epicsShareAPI envGetInetAddrConfigParam(const ENV_PARAM *pParam,
|
||||
struct in_addr *pAddr);
|
||||
long epicsShareAPI envGetDoubleConfigParam(ENV_PARAM *pParam,
|
||||
long epicsShareAPI envGetDoubleConfigParam(const ENV_PARAM *pParam,
|
||||
double *pDouble);
|
||||
long epicsShareAPI envGetLongConfigParam(ENV_PARAM *pParam,
|
||||
long epicsShareAPI envGetLongConfigParam(const ENV_PARAM *pParam,
|
||||
long *pLong);
|
||||
int epicsShareAPI envParamIsEmpty(ENV_PARAM *pParam);
|
||||
#else
|
||||
char * epicsShareAPI envGetConfigParam();
|
||||
const char * epicsShareAPI envGetConfigParamPtr();
|
||||
long epicsShareAPI envPrtConfigParam();
|
||||
long epicsShareAPI envSetConfigParam();
|
||||
long epicsShareAPI envGetInetAddrConfigParam();
|
||||
long epicsShareAPI envGetDoubleConfigParam();
|
||||
long epicsShareAPI envGetLongConfigParam();
|
||||
int epicsShareAPI envParamIsEmpty();
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*envDefsH*/
|
||||
|
||||
157
src/libCom/env/envSubr.c
vendored
157
src/libCom/env/envSubr.c
vendored
@@ -35,7 +35,10 @@
|
||||
* .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
|
||||
* .09 10-18-96 joh added envParamIsEmpty()
|
||||
* .09 10-18-96 joh added envParamIsEmpty()
|
||||
* .10 03-18-97 joh added envGetConfigParamPtr()
|
||||
* (replaces envParamIsEmpty())
|
||||
* .11 03-18-97 joh remove env param length limits
|
||||
*
|
||||
* make options
|
||||
* -DvxWorks makes a version for VxWorks
|
||||
@@ -54,16 +57,15 @@
|
||||
* Many EPICS environment parameters are predefined in envDefs.h.
|
||||
*
|
||||
* QUICK REFERENCE
|
||||
* #include <envDefs.h>
|
||||
* #include "envDefs.h"
|
||||
* ENV_PARAM param;
|
||||
* char *envGetConfigParamPtr( pParam )
|
||||
* char *envGetConfigParam( pParam, bufDim, pBuf )
|
||||
* long envGetLongConfigParam( pParam, pLong )
|
||||
* long envGetDoubleConfigParam( pParam, pDouble )
|
||||
* long envGetInetAddrConfigParam( pParam, pAddr )
|
||||
* long envPrtConfigParam( pParam )
|
||||
* long envSetConfigParam( pParam, valueString )
|
||||
* int envParamIsEmpty( pParam )
|
||||
)
|
||||
*
|
||||
* SEE ALSO
|
||||
* $epics/share/bin/envSetupParams, envDefs.h
|
||||
@@ -84,6 +86,55 @@
|
||||
#define epicsExportSharedSymbols
|
||||
#include "envDefs.h"
|
||||
|
||||
|
||||
/*+/subr**********************************************************************
|
||||
* NAME envGetConfigParamPtr - returns a pointer to the configuration
|
||||
* parameter value string
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Returns a pointer to a configuration parameter value.
|
||||
* If the configuration parameter isn't found in the environment,
|
||||
* then a pointer to the default value for the parameter is copied.
|
||||
* If no parameter is found and there is no default, then
|
||||
* NULL is returned.
|
||||
*
|
||||
* RETURNS
|
||||
* pointer to the environment variable value string, or
|
||||
* NULL if no parameter value and no default value was found
|
||||
*
|
||||
* EXAMPLES
|
||||
* 1. Get the value for the EPICS-defined environment parameter
|
||||
* EPICS_TS_MIN_WEST.
|
||||
*
|
||||
* #include "envDefs.h"
|
||||
* const char *pStr;
|
||||
*
|
||||
* pStr = envGetConfigParamPtr(&EPICS_TS_MIN_WEST);
|
||||
* if (pStr) {
|
||||
* printf("minutes west of UTC is: %s\n", pStr);
|
||||
* }
|
||||
*
|
||||
*-*/
|
||||
const char * epicsShareAPI envGetConfigParamPtr(
|
||||
const ENV_PARAM *pParam /* I pointer to config param structure */
|
||||
)
|
||||
{
|
||||
const char *pEnv; /* pointer to environment string */
|
||||
|
||||
pEnv = getenv(pParam->name);
|
||||
|
||||
if (pEnv == NULL) {
|
||||
pEnv = pParam->pdflt;
|
||||
}
|
||||
|
||||
if (pEnv) {
|
||||
if (pEnv[0u] == '\0') {
|
||||
pEnv = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return pEnv;
|
||||
}
|
||||
|
||||
|
||||
/*+/subr**********************************************************************
|
||||
@@ -104,39 +155,34 @@
|
||||
* 1. Get the value for the EPICS-defined environment parameter
|
||||
* EPICS_TS_MIN_WEST.
|
||||
*
|
||||
* #include <envDefs.h>
|
||||
* #include "envDefs.h"
|
||||
* char temp[80];
|
||||
*
|
||||
* printf("minutes west of UTC is: %s\n",
|
||||
* envGetConfigParam(&EPICS_TS_MIN_WEST, 80, temp));
|
||||
* envGetConfigParam(&EPICS_TS_MIN_WEST, sizeof(temp), temp));
|
||||
*
|
||||
* 2. Get the value for the DISPLAY environment parameter under UNIX.
|
||||
*
|
||||
* #include <envDefs.h>
|
||||
* #include "envDefs.h"
|
||||
* char temp[80];
|
||||
* ENV_PARAM display={"DISPLAY",""}
|
||||
*
|
||||
* if (envGetConfigParam(&display, 80, temp) == NULL)
|
||||
* if (envGetConfigParam(&display, sizeof(temp), temp) == NULL)
|
||||
* printf("DISPLAY isn't defined\n");
|
||||
* else
|
||||
* printf("DISPLAY is %s\n", temp);
|
||||
*
|
||||
*-*/
|
||||
char * epicsShareAPI envGetConfigParam(
|
||||
ENV_PARAM *pParam, /* I pointer to config param structure */
|
||||
const 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 */
|
||||
const char *pEnv; /* pointer to environment string */
|
||||
|
||||
pEnv = getenv(pParam->name);
|
||||
|
||||
if (pEnv == NULL) {
|
||||
pEnv = pParam->dflt;
|
||||
}
|
||||
|
||||
if (pEnv[0u] == '\0') {
|
||||
pEnv = epicsShareAPI envGetConfigParamPtr(pParam);
|
||||
if (!pEnv) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -165,7 +211,7 @@ char *pBuf /* I pointer to parameter buffer */
|
||||
* EXAMPLE
|
||||
* 1. Get the value for the real environment parameter EPICS_THRESHOLD.
|
||||
*
|
||||
* #include <envDefs.h>
|
||||
* #include "envDefs.h"
|
||||
* double threshold;
|
||||
* long status;
|
||||
*
|
||||
@@ -180,7 +226,7 @@ char *pBuf /* I pointer to parameter buffer */
|
||||
*
|
||||
*-*/
|
||||
long epicsShareAPI envGetDoubleConfigParam(
|
||||
ENV_PARAM *pParam, /* I pointer to config param structure */
|
||||
const ENV_PARAM *pParam,/* I pointer to config param structure */
|
||||
double *pDouble /* O pointer to place to store value */
|
||||
)
|
||||
{
|
||||
@@ -194,7 +240,7 @@ double *pDouble /* O pointer to place to store value */
|
||||
if (count == 1) {
|
||||
return 0;
|
||||
}
|
||||
(void)printf("Unable to find a real number in %s=%s\n",
|
||||
(void)fprintf(stderr,"Unable to find a real number in %s=%s\n",
|
||||
pParam->name, text);
|
||||
}
|
||||
|
||||
@@ -220,7 +266,7 @@ double *pDouble /* O pointer to place to store value */
|
||||
* EXAMPLE
|
||||
* 1. Get the value for the inet address environment parameter EPICS_INET.
|
||||
*
|
||||
* #include <envDefs.h>
|
||||
* #include "envDefs.h"
|
||||
* struct in_addr addr;
|
||||
* long status;
|
||||
*
|
||||
@@ -235,7 +281,7 @@ double *pDouble /* O pointer to place to store value */
|
||||
*
|
||||
*-*/
|
||||
long epicsShareAPI envGetInetAddrConfigParam(
|
||||
ENV_PARAM *pParam, /* I pointer to config param structure */
|
||||
const ENV_PARAM *pParam,/* I pointer to config param structure */
|
||||
struct in_addr *pAddr /* O pointer to struct to receive inet addr */
|
||||
)
|
||||
{
|
||||
@@ -250,7 +296,7 @@ struct in_addr *pAddr /* O pointer to struct to receive inet addr */
|
||||
pAddr->s_addr = status;
|
||||
return 0;
|
||||
}
|
||||
(void)printf("Unable to find an IP address in %s=%s\n",
|
||||
(void)fprintf(stderr,"Unable to find an IP address in %s=%s\n",
|
||||
pParam->name, text);
|
||||
}
|
||||
return -1;
|
||||
@@ -276,7 +322,7 @@ struct in_addr *pAddr /* O pointer to struct to receive inet addr */
|
||||
* 1. Get the value as a long for the integer environment parameter
|
||||
* EPICS_NUMBER_OF_ITEMS.
|
||||
*
|
||||
* #include <envDefs.h>
|
||||
* #include "envDefs.h"
|
||||
* long count;
|
||||
* long status;
|
||||
*
|
||||
@@ -291,7 +337,7 @@ struct in_addr *pAddr /* O pointer to struct to receive inet addr */
|
||||
*
|
||||
*-*/
|
||||
long epicsShareAPI envGetLongConfigParam(
|
||||
ENV_PARAM *pParam, /* I pointer to config param structure */
|
||||
const ENV_PARAM *pParam,/* I pointer to config param structure */
|
||||
long *pLong /* O pointer to place to store value */
|
||||
)
|
||||
{
|
||||
@@ -304,7 +350,7 @@ long *pLong /* O pointer to place to store value */
|
||||
count = sscanf(text, "%ld", pLong);
|
||||
if (count == 1)
|
||||
return 0;
|
||||
(void)printf("Unable to find an integer in %s=%s\n",
|
||||
(void)fprintf(stderr,"Unable to find an integer in %s=%s\n",
|
||||
pParam->name, text);
|
||||
}
|
||||
return -1;
|
||||
@@ -323,19 +369,21 @@ long *pLong /* O pointer to place to store value */
|
||||
* 1. Print the value for the EPICS-defined environment parameter
|
||||
* EPICS_TS_MIN_WEST.
|
||||
*
|
||||
* #include <envDefs.h>
|
||||
* #include "envDefs.h"
|
||||
*
|
||||
* envPrtConfigParam(&EPICS_TS_MIN_WEST);
|
||||
*
|
||||
*-*/
|
||||
long epicsShareAPI envPrtConfigParam(
|
||||
ENV_PARAM *pParam) /* pointer to config param structure */
|
||||
const ENV_PARAM *pParam) /* pointer to config param structure */
|
||||
{
|
||||
char text[80];
|
||||
if (envGetConfigParam(pParam, 80, text) == NULL)
|
||||
printf("%s is undefined\n", pParam->name);
|
||||
const char *pVal;
|
||||
|
||||
pVal = epicsShareAPI envGetConfigParamPtr(pParam);
|
||||
if (pVal == NULL)
|
||||
fprintf(stderr, "%s is undefined\n", pParam->name);
|
||||
else
|
||||
printf("%s: %s\n", pParam->name, text);
|
||||
fprintf(stdout,"%s: %s\n", pParam->name, pVal);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -361,7 +409,7 @@ ENV_PARAM *pParam) /* pointer to config param structure */
|
||||
*
|
||||
* In a program running under VxWorks:
|
||||
*
|
||||
* #include <envDefs.h>
|
||||
* #include "envDefs.h"
|
||||
*
|
||||
* envSetConfigParam(&EPICS_TS_MIN_WEST, "360");
|
||||
*
|
||||
@@ -371,12 +419,12 @@ ENV_PARAM *pParam) /* pointer to config param structure */
|
||||
*
|
||||
*-*/
|
||||
long epicsShareAPI envSetConfigParam (
|
||||
ENV_PARAM *pParam, /* I pointer to config param structure */
|
||||
const 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");
|
||||
fprintf(stderr, "envSetConfigParam can only be used under vxWorks\n");
|
||||
return -1L;
|
||||
#else
|
||||
long retCode = 0;
|
||||
@@ -437,7 +485,7 @@ char *value /* I pointer to value string */
|
||||
* EXAMPLE
|
||||
* 1. Print the value for all EPICS-defined environment parameters.
|
||||
*
|
||||
* #include <envDefs.h>
|
||||
* #include "envDefs.h"
|
||||
*
|
||||
* epicsPrtEnvParams();
|
||||
*
|
||||
@@ -445,7 +493,7 @@ char *value /* I pointer to value string */
|
||||
long
|
||||
epicsPrtEnvParams()
|
||||
{
|
||||
ENV_PARAM **ppParam = env_param_list;
|
||||
const ENV_PARAM **ppParam = env_param_list;
|
||||
|
||||
while (*ppParam != NULL)
|
||||
envPrtConfigParam(*(ppParam++));
|
||||
@@ -453,38 +501,3 @@ epicsPrtEnvParams()
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*+/subr**********************************************************************
|
||||
* NAME envParamIsEmpty - test for empty environment parameter
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Return TRUE if the environment parameter is empty - else false
|
||||
*
|
||||
* AUTHOR
|
||||
* Jeff Hill
|
||||
* RETURNS
|
||||
* 0 or 1
|
||||
*
|
||||
* EXAMPLE
|
||||
* #include <envDefs.h>
|
||||
*
|
||||
* if (envParamIsEmpty(&EPICS_CAS_SERVER_PORT)) {
|
||||
* port = caFetchPortConfig(&EPICS_CA_SERVER_PORT, CA_SERVER_PORT);
|
||||
* }
|
||||
*
|
||||
*-*/
|
||||
int epicsShareAPI envParamIsEmpty(
|
||||
ENV_PARAM *pParam /* I pointer to config param structure */
|
||||
)
|
||||
{
|
||||
char *pEnv; /* pointer to environment string */
|
||||
|
||||
pEnv = getenv(pParam->name);
|
||||
|
||||
if (pEnv == NULL && pParam->dflt[0u] == '\0') {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
* .05 04-20-95 anj moved defaults to CONFIG_ENV
|
||||
* .06 09-11-96 joh ANSI prototypes
|
||||
* .07 09-18-96 joh added envParamIsEmpty()
|
||||
* .08 03-18-97 joh remove env param length limit
|
||||
*
|
||||
* make options
|
||||
* -DvxWorks makes a version for VxWorks
|
||||
@@ -59,35 +60,39 @@
|
||||
#ifndef envDefsH
|
||||
#define envDefsH
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "shareLib.h"
|
||||
#include "osiSock.h"
|
||||
|
||||
typedef struct envParam {
|
||||
char *name; /* text name of the parameter */
|
||||
char dflt[80]; /* default value for the parameter */
|
||||
char *pdflt;
|
||||
} ENV_PARAM;
|
||||
|
||||
/*
|
||||
* bldEnvData looks for "epicsShareExtern ENV_PARAM"
|
||||
*/
|
||||
epicsShareExtern ENV_PARAM EPICS_CA_ADDR_LIST;
|
||||
epicsShareExtern ENV_PARAM EPICS_CA_CONN_TMO;
|
||||
epicsShareExtern ENV_PARAM EPICS_CA_BEACON_PERIOD;
|
||||
epicsShareExtern ENV_PARAM EPICS_CA_AUTO_ADDR_LIST;
|
||||
epicsShareExtern ENV_PARAM EPICS_CA_REPEATER_PORT;
|
||||
epicsShareExtern ENV_PARAM EPICS_CA_SERVER_PORT;
|
||||
epicsShareExtern ENV_PARAM EPICS_CAS_INTF_ADDR_LIST;
|
||||
epicsShareExtern ENV_PARAM EPICS_CAS_BEACON_ADDR_LIST;
|
||||
epicsShareExtern ENV_PARAM EPICS_CAS_SERVER_PORT;
|
||||
epicsShareExtern ENV_PARAM EPICS_TS_MIN_WEST;
|
||||
epicsShareExtern ENV_PARAM EPICS_TS_NTP_INET;
|
||||
epicsShareExtern ENV_PARAM EPICS_IOC_LOG_PORT;
|
||||
epicsShareExtern ENV_PARAM EPICS_IOC_LOG_INET;
|
||||
epicsShareExtern ENV_PARAM EPICS_IOC_LOG_FILE_LIMIT;
|
||||
epicsShareExtern ENV_PARAM EPICS_IOC_LOG_FILE_NAME;
|
||||
epicsShareExtern ENV_PARAM EPICS_IOC_LOG_FILE_COMMAND;
|
||||
epicsShareExtern ENV_PARAM EPICS_CMD_PROTO_PORT;
|
||||
epicsShareExtern ENV_PARAM EPICS_AR_PORT;
|
||||
epicsShareExtern const ENV_PARAM EPICS_CA_ADDR_LIST;
|
||||
epicsShareExtern const ENV_PARAM EPICS_CA_CONN_TMO;
|
||||
epicsShareExtern const ENV_PARAM EPICS_CA_BEACON_PERIOD;
|
||||
epicsShareExtern const ENV_PARAM EPICS_CA_AUTO_ADDR_LIST;
|
||||
epicsShareExtern const ENV_PARAM EPICS_CA_REPEATER_PORT;
|
||||
epicsShareExtern const ENV_PARAM EPICS_CA_SERVER_PORT;
|
||||
epicsShareExtern const ENV_PARAM EPICS_CAS_INTF_ADDR_LIST;
|
||||
epicsShareExtern const ENV_PARAM EPICS_CAS_BEACON_ADDR_LIST;
|
||||
epicsShareExtern const ENV_PARAM EPICS_CAS_SERVER_PORT;
|
||||
epicsShareExtern const ENV_PARAM EPICS_TS_MIN_WEST;
|
||||
epicsShareExtern const ENV_PARAM EPICS_TS_NTP_INET;
|
||||
epicsShareExtern const ENV_PARAM EPICS_IOC_LOG_PORT;
|
||||
epicsShareExtern const ENV_PARAM EPICS_IOC_LOG_INET;
|
||||
epicsShareExtern const ENV_PARAM EPICS_IOC_LOG_FILE_LIMIT;
|
||||
epicsShareExtern const ENV_PARAM EPICS_IOC_LOG_FILE_NAME;
|
||||
epicsShareExtern const ENV_PARAM EPICS_IOC_LOG_FILE_COMMAND;
|
||||
epicsShareExtern const ENV_PARAM EPICS_CMD_PROTO_PORT;
|
||||
epicsShareExtern const ENV_PARAM EPICS_AR_PORT;
|
||||
#define EPICS_ENV_VARIABLE_COUNT 18
|
||||
|
||||
/*
|
||||
@@ -97,30 +102,34 @@ epicsShareExtern ENV_PARAM EPICS_AR_PORT;
|
||||
* bldEnvData looks for "epicsShareExtern ENV_PARAM" so
|
||||
* this always needs to be divided into two lines
|
||||
*/
|
||||
epicsShareExtern ENV_PARAM
|
||||
epicsShareExtern const ENV_PARAM
|
||||
*env_param_list[EPICS_ENV_VARIABLE_COUNT+1];
|
||||
|
||||
#ifdef __STDC__
|
||||
char * epicsShareAPI envGetConfigParam(ENV_PARAM *pParam,
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
char * epicsShareAPI envGetConfigParam(const ENV_PARAM *pParam,
|
||||
int bufDim, char *pBuf);
|
||||
long epicsShareAPI envPrtConfigParam(ENV_PARAM *pParam);
|
||||
long epicsShareAPI envSetConfigParam(ENV_PARAM *pParam,
|
||||
const char * epicsShareAPI envGetConfigParamPtr(const ENV_PARAM *pParam);
|
||||
long epicsShareAPI envPrtConfigParam(const ENV_PARAM *pParam);
|
||||
long epicsShareAPI envSetConfigParam(const ENV_PARAM *pParam,
|
||||
char *value);
|
||||
long epicsShareAPI envGetInetAddrConfigParam(ENV_PARAM *pParam,
|
||||
long epicsShareAPI envGetInetAddrConfigParam(const ENV_PARAM *pParam,
|
||||
struct in_addr *pAddr);
|
||||
long epicsShareAPI envGetDoubleConfigParam(ENV_PARAM *pParam,
|
||||
long epicsShareAPI envGetDoubleConfigParam(const ENV_PARAM *pParam,
|
||||
double *pDouble);
|
||||
long epicsShareAPI envGetLongConfigParam(ENV_PARAM *pParam,
|
||||
long epicsShareAPI envGetLongConfigParam(const ENV_PARAM *pParam,
|
||||
long *pLong);
|
||||
int epicsShareAPI envParamIsEmpty(ENV_PARAM *pParam);
|
||||
#else
|
||||
char * epicsShareAPI envGetConfigParam();
|
||||
const char * epicsShareAPI envGetConfigParamPtr();
|
||||
long epicsShareAPI envPrtConfigParam();
|
||||
long epicsShareAPI envSetConfigParam();
|
||||
long epicsShareAPI envGetInetAddrConfigParam();
|
||||
long epicsShareAPI envGetDoubleConfigParam();
|
||||
long epicsShareAPI envGetLongConfigParam();
|
||||
int epicsShareAPI envParamIsEmpty();
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*envDefsH*/
|
||||
|
||||
@@ -35,7 +35,10 @@
|
||||
* .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
|
||||
* .09 10-18-96 joh added envParamIsEmpty()
|
||||
* .09 10-18-96 joh added envParamIsEmpty()
|
||||
* .10 03-18-97 joh added envGetConfigParamPtr()
|
||||
* (replaces envParamIsEmpty())
|
||||
* .11 03-18-97 joh remove env param length limits
|
||||
*
|
||||
* make options
|
||||
* -DvxWorks makes a version for VxWorks
|
||||
@@ -54,16 +57,15 @@
|
||||
* Many EPICS environment parameters are predefined in envDefs.h.
|
||||
*
|
||||
* QUICK REFERENCE
|
||||
* #include <envDefs.h>
|
||||
* #include "envDefs.h"
|
||||
* ENV_PARAM param;
|
||||
* char *envGetConfigParamPtr( pParam )
|
||||
* char *envGetConfigParam( pParam, bufDim, pBuf )
|
||||
* long envGetLongConfigParam( pParam, pLong )
|
||||
* long envGetDoubleConfigParam( pParam, pDouble )
|
||||
* long envGetInetAddrConfigParam( pParam, pAddr )
|
||||
* long envPrtConfigParam( pParam )
|
||||
* long envSetConfigParam( pParam, valueString )
|
||||
* int envParamIsEmpty( pParam )
|
||||
)
|
||||
*
|
||||
* SEE ALSO
|
||||
* $epics/share/bin/envSetupParams, envDefs.h
|
||||
@@ -84,6 +86,55 @@
|
||||
#define epicsExportSharedSymbols
|
||||
#include "envDefs.h"
|
||||
|
||||
|
||||
/*+/subr**********************************************************************
|
||||
* NAME envGetConfigParamPtr - returns a pointer to the configuration
|
||||
* parameter value string
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Returns a pointer to a configuration parameter value.
|
||||
* If the configuration parameter isn't found in the environment,
|
||||
* then a pointer to the default value for the parameter is copied.
|
||||
* If no parameter is found and there is no default, then
|
||||
* NULL is returned.
|
||||
*
|
||||
* RETURNS
|
||||
* pointer to the environment variable value string, or
|
||||
* NULL if no parameter value and no default value was found
|
||||
*
|
||||
* EXAMPLES
|
||||
* 1. Get the value for the EPICS-defined environment parameter
|
||||
* EPICS_TS_MIN_WEST.
|
||||
*
|
||||
* #include "envDefs.h"
|
||||
* const char *pStr;
|
||||
*
|
||||
* pStr = envGetConfigParamPtr(&EPICS_TS_MIN_WEST);
|
||||
* if (pStr) {
|
||||
* printf("minutes west of UTC is: %s\n", pStr);
|
||||
* }
|
||||
*
|
||||
*-*/
|
||||
const char * epicsShareAPI envGetConfigParamPtr(
|
||||
const ENV_PARAM *pParam /* I pointer to config param structure */
|
||||
)
|
||||
{
|
||||
const char *pEnv; /* pointer to environment string */
|
||||
|
||||
pEnv = getenv(pParam->name);
|
||||
|
||||
if (pEnv == NULL) {
|
||||
pEnv = pParam->pdflt;
|
||||
}
|
||||
|
||||
if (pEnv) {
|
||||
if (pEnv[0u] == '\0') {
|
||||
pEnv = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return pEnv;
|
||||
}
|
||||
|
||||
|
||||
/*+/subr**********************************************************************
|
||||
@@ -104,39 +155,34 @@
|
||||
* 1. Get the value for the EPICS-defined environment parameter
|
||||
* EPICS_TS_MIN_WEST.
|
||||
*
|
||||
* #include <envDefs.h>
|
||||
* #include "envDefs.h"
|
||||
* char temp[80];
|
||||
*
|
||||
* printf("minutes west of UTC is: %s\n",
|
||||
* envGetConfigParam(&EPICS_TS_MIN_WEST, 80, temp));
|
||||
* envGetConfigParam(&EPICS_TS_MIN_WEST, sizeof(temp), temp));
|
||||
*
|
||||
* 2. Get the value for the DISPLAY environment parameter under UNIX.
|
||||
*
|
||||
* #include <envDefs.h>
|
||||
* #include "envDefs.h"
|
||||
* char temp[80];
|
||||
* ENV_PARAM display={"DISPLAY",""}
|
||||
*
|
||||
* if (envGetConfigParam(&display, 80, temp) == NULL)
|
||||
* if (envGetConfigParam(&display, sizeof(temp), temp) == NULL)
|
||||
* printf("DISPLAY isn't defined\n");
|
||||
* else
|
||||
* printf("DISPLAY is %s\n", temp);
|
||||
*
|
||||
*-*/
|
||||
char * epicsShareAPI envGetConfigParam(
|
||||
ENV_PARAM *pParam, /* I pointer to config param structure */
|
||||
const 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 */
|
||||
const char *pEnv; /* pointer to environment string */
|
||||
|
||||
pEnv = getenv(pParam->name);
|
||||
|
||||
if (pEnv == NULL) {
|
||||
pEnv = pParam->dflt;
|
||||
}
|
||||
|
||||
if (pEnv[0u] == '\0') {
|
||||
pEnv = epicsShareAPI envGetConfigParamPtr(pParam);
|
||||
if (!pEnv) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -165,7 +211,7 @@ char *pBuf /* I pointer to parameter buffer */
|
||||
* EXAMPLE
|
||||
* 1. Get the value for the real environment parameter EPICS_THRESHOLD.
|
||||
*
|
||||
* #include <envDefs.h>
|
||||
* #include "envDefs.h"
|
||||
* double threshold;
|
||||
* long status;
|
||||
*
|
||||
@@ -180,7 +226,7 @@ char *pBuf /* I pointer to parameter buffer */
|
||||
*
|
||||
*-*/
|
||||
long epicsShareAPI envGetDoubleConfigParam(
|
||||
ENV_PARAM *pParam, /* I pointer to config param structure */
|
||||
const ENV_PARAM *pParam,/* I pointer to config param structure */
|
||||
double *pDouble /* O pointer to place to store value */
|
||||
)
|
||||
{
|
||||
@@ -194,7 +240,7 @@ double *pDouble /* O pointer to place to store value */
|
||||
if (count == 1) {
|
||||
return 0;
|
||||
}
|
||||
(void)printf("Unable to find a real number in %s=%s\n",
|
||||
(void)fprintf(stderr,"Unable to find a real number in %s=%s\n",
|
||||
pParam->name, text);
|
||||
}
|
||||
|
||||
@@ -220,7 +266,7 @@ double *pDouble /* O pointer to place to store value */
|
||||
* EXAMPLE
|
||||
* 1. Get the value for the inet address environment parameter EPICS_INET.
|
||||
*
|
||||
* #include <envDefs.h>
|
||||
* #include "envDefs.h"
|
||||
* struct in_addr addr;
|
||||
* long status;
|
||||
*
|
||||
@@ -235,7 +281,7 @@ double *pDouble /* O pointer to place to store value */
|
||||
*
|
||||
*-*/
|
||||
long epicsShareAPI envGetInetAddrConfigParam(
|
||||
ENV_PARAM *pParam, /* I pointer to config param structure */
|
||||
const ENV_PARAM *pParam,/* I pointer to config param structure */
|
||||
struct in_addr *pAddr /* O pointer to struct to receive inet addr */
|
||||
)
|
||||
{
|
||||
@@ -250,7 +296,7 @@ struct in_addr *pAddr /* O pointer to struct to receive inet addr */
|
||||
pAddr->s_addr = status;
|
||||
return 0;
|
||||
}
|
||||
(void)printf("Unable to find an IP address in %s=%s\n",
|
||||
(void)fprintf(stderr,"Unable to find an IP address in %s=%s\n",
|
||||
pParam->name, text);
|
||||
}
|
||||
return -1;
|
||||
@@ -276,7 +322,7 @@ struct in_addr *pAddr /* O pointer to struct to receive inet addr */
|
||||
* 1. Get the value as a long for the integer environment parameter
|
||||
* EPICS_NUMBER_OF_ITEMS.
|
||||
*
|
||||
* #include <envDefs.h>
|
||||
* #include "envDefs.h"
|
||||
* long count;
|
||||
* long status;
|
||||
*
|
||||
@@ -291,7 +337,7 @@ struct in_addr *pAddr /* O pointer to struct to receive inet addr */
|
||||
*
|
||||
*-*/
|
||||
long epicsShareAPI envGetLongConfigParam(
|
||||
ENV_PARAM *pParam, /* I pointer to config param structure */
|
||||
const ENV_PARAM *pParam,/* I pointer to config param structure */
|
||||
long *pLong /* O pointer to place to store value */
|
||||
)
|
||||
{
|
||||
@@ -304,7 +350,7 @@ long *pLong /* O pointer to place to store value */
|
||||
count = sscanf(text, "%ld", pLong);
|
||||
if (count == 1)
|
||||
return 0;
|
||||
(void)printf("Unable to find an integer in %s=%s\n",
|
||||
(void)fprintf(stderr,"Unable to find an integer in %s=%s\n",
|
||||
pParam->name, text);
|
||||
}
|
||||
return -1;
|
||||
@@ -323,19 +369,21 @@ long *pLong /* O pointer to place to store value */
|
||||
* 1. Print the value for the EPICS-defined environment parameter
|
||||
* EPICS_TS_MIN_WEST.
|
||||
*
|
||||
* #include <envDefs.h>
|
||||
* #include "envDefs.h"
|
||||
*
|
||||
* envPrtConfigParam(&EPICS_TS_MIN_WEST);
|
||||
*
|
||||
*-*/
|
||||
long epicsShareAPI envPrtConfigParam(
|
||||
ENV_PARAM *pParam) /* pointer to config param structure */
|
||||
const ENV_PARAM *pParam) /* pointer to config param structure */
|
||||
{
|
||||
char text[80];
|
||||
if (envGetConfigParam(pParam, 80, text) == NULL)
|
||||
printf("%s is undefined\n", pParam->name);
|
||||
const char *pVal;
|
||||
|
||||
pVal = epicsShareAPI envGetConfigParamPtr(pParam);
|
||||
if (pVal == NULL)
|
||||
fprintf(stderr, "%s is undefined\n", pParam->name);
|
||||
else
|
||||
printf("%s: %s\n", pParam->name, text);
|
||||
fprintf(stdout,"%s: %s\n", pParam->name, pVal);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -361,7 +409,7 @@ ENV_PARAM *pParam) /* pointer to config param structure */
|
||||
*
|
||||
* In a program running under VxWorks:
|
||||
*
|
||||
* #include <envDefs.h>
|
||||
* #include "envDefs.h"
|
||||
*
|
||||
* envSetConfigParam(&EPICS_TS_MIN_WEST, "360");
|
||||
*
|
||||
@@ -371,12 +419,12 @@ ENV_PARAM *pParam) /* pointer to config param structure */
|
||||
*
|
||||
*-*/
|
||||
long epicsShareAPI envSetConfigParam (
|
||||
ENV_PARAM *pParam, /* I pointer to config param structure */
|
||||
const 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");
|
||||
fprintf(stderr, "envSetConfigParam can only be used under vxWorks\n");
|
||||
return -1L;
|
||||
#else
|
||||
long retCode = 0;
|
||||
@@ -437,7 +485,7 @@ char *value /* I pointer to value string */
|
||||
* EXAMPLE
|
||||
* 1. Print the value for all EPICS-defined environment parameters.
|
||||
*
|
||||
* #include <envDefs.h>
|
||||
* #include "envDefs.h"
|
||||
*
|
||||
* epicsPrtEnvParams();
|
||||
*
|
||||
@@ -445,7 +493,7 @@ char *value /* I pointer to value string */
|
||||
long
|
||||
epicsPrtEnvParams()
|
||||
{
|
||||
ENV_PARAM **ppParam = env_param_list;
|
||||
const ENV_PARAM **ppParam = env_param_list;
|
||||
|
||||
while (*ppParam != NULL)
|
||||
envPrtConfigParam(*(ppParam++));
|
||||
@@ -453,38 +501,3 @@ epicsPrtEnvParams()
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*+/subr**********************************************************************
|
||||
* NAME envParamIsEmpty - test for empty environment parameter
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Return TRUE if the environment parameter is empty - else false
|
||||
*
|
||||
* AUTHOR
|
||||
* Jeff Hill
|
||||
* RETURNS
|
||||
* 0 or 1
|
||||
*
|
||||
* EXAMPLE
|
||||
* #include <envDefs.h>
|
||||
*
|
||||
* if (envParamIsEmpty(&EPICS_CAS_SERVER_PORT)) {
|
||||
* port = caFetchPortConfig(&EPICS_CA_SERVER_PORT, CA_SERVER_PORT);
|
||||
* }
|
||||
*
|
||||
*-*/
|
||||
int epicsShareAPI envParamIsEmpty(
|
||||
ENV_PARAM *pParam /* I pointer to config param structure */
|
||||
)
|
||||
{
|
||||
char *pEnv; /* pointer to environment string */
|
||||
|
||||
pEnv = getenv(pParam->name);
|
||||
|
||||
if (pEnv == NULL && pParam->dflt[0u] == '\0') {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,8 +45,16 @@ extern "C" {
|
||||
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
|
||||
extern void epicsAssert (const char *pFile, const unsigned line,
|
||||
const char *pMsg, const char *pAuthorName);
|
||||
extern void epicsAssert (const char *pFile, const unsigned line,
|
||||
const char *pMsg, const char *pAuthorName);
|
||||
|
||||
#else /*__STDC__ or __cplusplus*/
|
||||
|
||||
extern void epicsAssert ();
|
||||
|
||||
#endif /*__STDC__ or __cplusplus*/
|
||||
|
||||
#if (defined(__STDC__) || defined(__cplusplus)) && !defined(VAXC)
|
||||
|
||||
#ifdef epicsAssertAuthor
|
||||
#define assert(exp) \
|
||||
@@ -58,7 +66,6 @@ extern void epicsAssert (const char *pFile, const unsigned line,
|
||||
|
||||
#else /*__STDC__ or __cplusplus*/
|
||||
|
||||
extern void epicsAssert ();
|
||||
|
||||
#ifdef epicsAssertAuthor
|
||||
#define assert(exp) \
|
||||
@@ -68,7 +75,7 @@ extern void epicsAssert ();
|
||||
{if (!(exp)) epicsAssert (__FILE__, __LINE__, "", 0);}
|
||||
#endif /* epicsAssertAuthor */
|
||||
|
||||
#endif /*__STDC__ or __cplusplus*/
|
||||
#endif /* (__STDC__ or __cplusplus) and not VAXC */
|
||||
|
||||
#endif /* NDEBUG */
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ extern "C" {
|
||||
#else
|
||||
# include <varargs.h>
|
||||
#endif
|
||||
#include <ellLib.h>
|
||||
#include "ellLib.h"
|
||||
|
||||
#define RTN_SUCCESS(STATUS) ((STATUS)==0)
|
||||
|
||||
|
||||
@@ -41,10 +41,10 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <epicsAssert.h>
|
||||
#include <dbDefs.h>
|
||||
#include <errMdef.h>
|
||||
#include <epicsPrint.h>
|
||||
#include "epicsAssert.h"
|
||||
#include "dbDefs.h"
|
||||
#include "errMdef.h"
|
||||
#include "epicsPrint.h"
|
||||
#include "errSymTbl.h"
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
* -----------------
|
||||
* .01 02-16-95 mrk Extracted from errSymLib.c
|
||||
* $Log$
|
||||
* Revision 1.8 1996/09/04 21:46:20 jhill
|
||||
* fixed gcc warning
|
||||
*
|
||||
* Revision 1.7 1995/11/08 23:44:41 jhill
|
||||
* changes associated with fixing the log client
|
||||
*
|
||||
@@ -50,12 +53,12 @@
|
||||
#include <error.h>
|
||||
#include <logLib.h>
|
||||
|
||||
#include <epicsAssert.h>
|
||||
#include <ellLib.h>
|
||||
#include <dbDefs.h>
|
||||
#include <task_params.h>
|
||||
#include <errMdef.h>
|
||||
#include <epicsPrint.h>
|
||||
#include "epicsAssert.h"
|
||||
#include "ellLib.h"
|
||||
#include "dbDefs.h"
|
||||
#include "task_params.h"
|
||||
#include "errMdef.h"
|
||||
#include "epicsPrint.h"
|
||||
#ifndef LOCAL
|
||||
#define LOCAL static
|
||||
#endif /* LOCAL */
|
||||
|
||||
@@ -70,9 +70,9 @@
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ellLib.h>
|
||||
#include <dbDefs.h>
|
||||
#include <errMdef.h>
|
||||
#include "ellLib.h"
|
||||
#include "dbDefs.h"
|
||||
#include "errMdef.h"
|
||||
#include "errSymTbl.h"
|
||||
|
||||
#ifdef vxWorks
|
||||
|
||||
@@ -50,7 +50,7 @@ extern "C" {
|
||||
#else
|
||||
# include <varargs.h>
|
||||
#endif
|
||||
#include <ellLib.h>
|
||||
#include "ellLib.h"
|
||||
|
||||
#define RTN_SUCCESS(STATUS) ((STATUS)==0)
|
||||
|
||||
|
||||
@@ -70,9 +70,9 @@
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ellLib.h>
|
||||
#include <dbDefs.h>
|
||||
#include <errMdef.h>
|
||||
#include "ellLib.h"
|
||||
#include "dbDefs.h"
|
||||
#include "errMdef.h"
|
||||
#include "errSymTbl.h"
|
||||
|
||||
#ifdef vxWorks
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
//
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.3 1996/11/02 02:04:42 jhill
|
||||
// fixed several subtle bugs
|
||||
//
|
||||
// Revision 1.2 1996/09/04 21:50:16 jhill
|
||||
// added hashed fd to fdi convert
|
||||
//
|
||||
@@ -31,16 +34,21 @@
|
||||
#define epicsExportSharedSymbols
|
||||
#include "osiTimer.h"
|
||||
#include "fdManager.h"
|
||||
|
||||
#if !defined(__SUNPRO_CC)
|
||||
#define INSTANCIATE_RES_LIB_STATIC
|
||||
#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 "fdManager.o"
|
||||
// functions used by fdManager
|
||||
//
|
||||
# include <resourceLib.cc>
|
||||
template class resTable <fdReg, fdRegId>;
|
||||
#endif
|
||||
|
||||
@@ -94,7 +102,9 @@ fdManager::~fdManager()
|
||||
//
|
||||
void fdManager::process (const osiTime &delay)
|
||||
{
|
||||
tsDLFwdIter<fdReg> regIter(this->regList);
|
||||
static const tsDLIterBD<fdReg> eol; // end of list
|
||||
tsDLIterBD<fdReg> iter;
|
||||
tsDLIterBD<fdReg> tmp;
|
||||
osiTime minDelay;
|
||||
osiTime zeroDelay;
|
||||
fdReg *pReg;
|
||||
@@ -126,8 +136,8 @@ void fdManager::process (const osiTime &delay)
|
||||
minDelay = delay;
|
||||
}
|
||||
|
||||
while ( (pReg=regIter()) ) {
|
||||
FD_SET(pReg->getFD(), &this->fdSets[pReg->getType()]);
|
||||
for (iter=this->regList.first(); iter!=eol; ++iter) {
|
||||
FD_SET(iter->getFD(), &this->fdSets[iter->getType()]);
|
||||
}
|
||||
minDelay.getTV (tv.tv_sec, tv.tv_usec);
|
||||
status = select (this->maxFD, &this->fdSets[fdrRead],
|
||||
@@ -152,14 +162,17 @@ void fdManager::process (const osiTime &delay)
|
||||
//
|
||||
// Look for activity
|
||||
//
|
||||
regIter.reset();
|
||||
while ( (pReg=regIter()) ) {
|
||||
if (FD_ISSET(pReg->getFD(), &this->fdSets[pReg->getType()])) {
|
||||
FD_CLR(pReg->getFD(), &this->fdSets[pReg->getType()]);
|
||||
regIter.remove();
|
||||
this->activeList.add(*pReg);
|
||||
pReg->state = fdrActive;
|
||||
iter=this->regList.first();
|
||||
while (iter!=eol) {
|
||||
tmp = iter;
|
||||
tmp++;
|
||||
if (FD_ISSET(iter->getFD(), &this->fdSets[iter->getType()])) {
|
||||
FD_CLR(iter->getFD(), &this->fdSets[iter->getType()]);
|
||||
this->regList.remove(*iter);
|
||||
this->activeList.add(*iter);
|
||||
iter->state = fdrActive;
|
||||
}
|
||||
iter=tmp;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -32,6 +32,9 @@
|
||||
*
|
||||
* History
|
||||
* $Log$
|
||||
* Revision 1.3 1996/11/02 02:04:41 jhill
|
||||
* fixed several subtle bugs
|
||||
*
|
||||
* Revision 1.2 1996/09/04 21:50:16 jhill
|
||||
* added hashed fd to fdi convert
|
||||
*
|
||||
@@ -114,17 +117,7 @@ public:
|
||||
virtual ~fdReg ();
|
||||
|
||||
virtual void show(unsigned level) const;
|
||||
private:
|
||||
|
||||
//
|
||||
// called when there is activity on the fd
|
||||
// NOTES
|
||||
// 1) the fdManager will call this only once during the
|
||||
// lifetime of a fdReg object if the constructor
|
||||
// specified "onceOnly"
|
||||
//
|
||||
virtual void callBack ()=0;
|
||||
|
||||
|
||||
//
|
||||
// Called by the file descriptor manager:
|
||||
// 1) If the fdManager is deleted and there are still
|
||||
@@ -135,6 +128,16 @@ private:
|
||||
// fdReg::destroy() does a "delete this"
|
||||
//
|
||||
virtual void destroy ();
|
||||
private:
|
||||
|
||||
//
|
||||
// called when there is activity on the fd
|
||||
// NOTES
|
||||
// 1) the fdManager will call this only once during the
|
||||
// lifetime of a fdReg object if the constructor
|
||||
// specified "onceOnly"
|
||||
//
|
||||
virtual void callBack ()=0;
|
||||
|
||||
unsigned char state; // fdRegState goes here
|
||||
unsigned char onceOnly;
|
||||
|
||||
@@ -71,6 +71,9 @@
|
||||
* we eliminate delete ambiguity (chance of the same
|
||||
* being reused).
|
||||
* $Log$
|
||||
* Revision 1.22 1996/07/09 23:01:31 jhill
|
||||
* nill 2nd arg to gettimeofday()
|
||||
*
|
||||
* Revision 1.21 1996/06/19 17:12:40 jhill
|
||||
* check for fd>FD_SETSIZE and improved func proto
|
||||
*
|
||||
@@ -122,12 +125,12 @@ static char *pSccsId = "@(#) $Id$";
|
||||
#include <semLib.h>
|
||||
#endif
|
||||
|
||||
#include <epicsAssert.h>
|
||||
#include <fdmgr.h>
|
||||
#include <epicsTypes.h>
|
||||
#include "epicsAssert.h"
|
||||
#include "fdmgr.h"
|
||||
#include "epicsTypes.h"
|
||||
|
||||
#define NOBSDNETPROTO
|
||||
#include <bsdProto.h>
|
||||
#include "bsdProto.h"
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
|
||||
@@ -46,8 +46,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <ellLib.h>
|
||||
#include <bucketLib.h>
|
||||
#include "ellLib.h"
|
||||
#include "bucketLib.h"
|
||||
|
||||
#if defined(vxWorks)
|
||||
# include <vxWorks.h>
|
||||
@@ -71,7 +71,7 @@ extern "C" {
|
||||
# include <stdlib.h>
|
||||
# include <errno.h>
|
||||
# include <malloc.h>
|
||||
# include <winsock.h>
|
||||
# include <windows.h>
|
||||
# define FDMGR_OS WIN32
|
||||
#endif
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
//
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.3 1996/11/02 02:04:42 jhill
|
||||
// fixed several subtle bugs
|
||||
//
|
||||
// Revision 1.2 1996/09/04 21:50:16 jhill
|
||||
// added hashed fd to fdi convert
|
||||
//
|
||||
@@ -31,16 +34,21 @@
|
||||
#define epicsExportSharedSymbols
|
||||
#include "osiTimer.h"
|
||||
#include "fdManager.h"
|
||||
|
||||
#if !defined(__SUNPRO_CC)
|
||||
#define INSTANCIATE_RES_LIB_STATIC
|
||||
#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 "fdManager.o"
|
||||
// functions used by fdManager
|
||||
//
|
||||
# include <resourceLib.cc>
|
||||
template class resTable <fdReg, fdRegId>;
|
||||
#endif
|
||||
|
||||
@@ -94,7 +102,9 @@ fdManager::~fdManager()
|
||||
//
|
||||
void fdManager::process (const osiTime &delay)
|
||||
{
|
||||
tsDLFwdIter<fdReg> regIter(this->regList);
|
||||
static const tsDLIterBD<fdReg> eol; // end of list
|
||||
tsDLIterBD<fdReg> iter;
|
||||
tsDLIterBD<fdReg> tmp;
|
||||
osiTime minDelay;
|
||||
osiTime zeroDelay;
|
||||
fdReg *pReg;
|
||||
@@ -126,8 +136,8 @@ void fdManager::process (const osiTime &delay)
|
||||
minDelay = delay;
|
||||
}
|
||||
|
||||
while ( (pReg=regIter()) ) {
|
||||
FD_SET(pReg->getFD(), &this->fdSets[pReg->getType()]);
|
||||
for (iter=this->regList.first(); iter!=eol; ++iter) {
|
||||
FD_SET(iter->getFD(), &this->fdSets[iter->getType()]);
|
||||
}
|
||||
minDelay.getTV (tv.tv_sec, tv.tv_usec);
|
||||
status = select (this->maxFD, &this->fdSets[fdrRead],
|
||||
@@ -152,14 +162,17 @@ void fdManager::process (const osiTime &delay)
|
||||
//
|
||||
// Look for activity
|
||||
//
|
||||
regIter.reset();
|
||||
while ( (pReg=regIter()) ) {
|
||||
if (FD_ISSET(pReg->getFD(), &this->fdSets[pReg->getType()])) {
|
||||
FD_CLR(pReg->getFD(), &this->fdSets[pReg->getType()]);
|
||||
regIter.remove();
|
||||
this->activeList.add(*pReg);
|
||||
pReg->state = fdrActive;
|
||||
iter=this->regList.first();
|
||||
while (iter!=eol) {
|
||||
tmp = iter;
|
||||
tmp++;
|
||||
if (FD_ISSET(iter->getFD(), &this->fdSets[iter->getType()])) {
|
||||
FD_CLR(iter->getFD(), &this->fdSets[iter->getType()]);
|
||||
this->regList.remove(*iter);
|
||||
this->activeList.add(*iter);
|
||||
iter->state = fdrActive;
|
||||
}
|
||||
iter=tmp;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -32,6 +32,9 @@
|
||||
*
|
||||
* History
|
||||
* $Log$
|
||||
* Revision 1.3 1996/11/02 02:04:41 jhill
|
||||
* fixed several subtle bugs
|
||||
*
|
||||
* Revision 1.2 1996/09/04 21:50:16 jhill
|
||||
* added hashed fd to fdi convert
|
||||
*
|
||||
@@ -114,17 +117,7 @@ public:
|
||||
virtual ~fdReg ();
|
||||
|
||||
virtual void show(unsigned level) const;
|
||||
private:
|
||||
|
||||
//
|
||||
// called when there is activity on the fd
|
||||
// NOTES
|
||||
// 1) the fdManager will call this only once during the
|
||||
// lifetime of a fdReg object if the constructor
|
||||
// specified "onceOnly"
|
||||
//
|
||||
virtual void callBack ()=0;
|
||||
|
||||
|
||||
//
|
||||
// Called by the file descriptor manager:
|
||||
// 1) If the fdManager is deleted and there are still
|
||||
@@ -135,6 +128,16 @@ private:
|
||||
// fdReg::destroy() does a "delete this"
|
||||
//
|
||||
virtual void destroy ();
|
||||
private:
|
||||
|
||||
//
|
||||
// called when there is activity on the fd
|
||||
// NOTES
|
||||
// 1) the fdManager will call this only once during the
|
||||
// lifetime of a fdReg object if the constructor
|
||||
// specified "onceOnly"
|
||||
//
|
||||
virtual void callBack ()=0;
|
||||
|
||||
unsigned char state; // fdRegState goes here
|
||||
unsigned char onceOnly;
|
||||
|
||||
@@ -46,8 +46,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <ellLib.h>
|
||||
#include <bucketLib.h>
|
||||
#include "ellLib.h"
|
||||
#include "bucketLib.h"
|
||||
|
||||
#if defined(vxWorks)
|
||||
# include <vxWorks.h>
|
||||
@@ -71,7 +71,7 @@ extern "C" {
|
||||
# include <stdlib.h>
|
||||
# include <errno.h>
|
||||
# include <malloc.h>
|
||||
# include <winsock.h>
|
||||
# include <windows.h>
|
||||
# define FDMGR_OS WIN32
|
||||
#endif
|
||||
|
||||
|
||||
@@ -60,4 +60,5 @@ void *freeListCalloc(void *pvt);
|
||||
void *freeListMalloc(void *pvt);
|
||||
void freeListFree(void *pvt,void*pmem);
|
||||
void freeListCleanup(void *pvt);
|
||||
size_t freeListItemsAvail(void *pvt);
|
||||
#endif /*INCfreeListh*/
|
||||
|
||||
@@ -60,4 +60,5 @@ void *freeListCalloc(void *pvt);
|
||||
void *freeListMalloc(void *pvt);
|
||||
void freeListFree(void *pvt,void*pmem);
|
||||
void freeListCleanup(void *pvt);
|
||||
size_t freeListItemsAvail(void *pvt);
|
||||
#endif /*INCfreeListh*/
|
||||
|
||||
@@ -49,17 +49,19 @@ DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000).
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 04-19-94 mrk Initial Implementation
|
||||
* .02 03-28-97 joh added freeListItemAvail() function
|
||||
*/
|
||||
|
||||
#ifdef vxWorks
|
||||
#include <vxWorks.h>
|
||||
#include <fast_lock.h>
|
||||
#include <taskLib.h>
|
||||
#include "fast_lock.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <freeList.h>
|
||||
#include "freeList.h"
|
||||
|
||||
typedef struct allocMem {
|
||||
struct allocMem *next;
|
||||
@@ -70,6 +72,7 @@ typedef struct {
|
||||
int nmalloc;
|
||||
void *head;
|
||||
allocMem *mallochead;
|
||||
size_t nBlocksAvailable;
|
||||
#ifdef vxWorks
|
||||
FAST_LOCK lock;
|
||||
#endif
|
||||
@@ -90,6 +93,7 @@ void freeListInitPvt(void **ppvt,int size,int nmalloc)
|
||||
pfl->nmalloc = nmalloc;
|
||||
pfl->head = NULL;
|
||||
pfl->mallochead = NULL;
|
||||
pfl->nBlocksAvailable = 0u;
|
||||
#ifdef vxWorks
|
||||
FASTLOCKINIT(&pfl->lock);
|
||||
#endif
|
||||
@@ -139,9 +143,11 @@ void *freeListMalloc(void *pvt)
|
||||
ptemp = ((char *)ptemp) + pfl->size;
|
||||
}
|
||||
ptemp = pfl->head;
|
||||
pfl->nBlocksAvailable += pfl->nmalloc;
|
||||
}
|
||||
ppnext = pfl->head;
|
||||
pfl->head = *ppnext;
|
||||
pfl->nBlocksAvailable--;
|
||||
#ifdef vxWorks
|
||||
FASTUNLOCK(&pfl->lock);
|
||||
#endif
|
||||
@@ -159,6 +165,7 @@ void freeListFree(void *pvt,void*pmem)
|
||||
ppnext = pmem;
|
||||
*ppnext = pfl->head;
|
||||
pfl->head = pmem;
|
||||
pfl->nBlocksAvailable++;
|
||||
#ifdef vxWorks
|
||||
FASTUNLOCK(&pfl->lock);
|
||||
#endif
|
||||
@@ -179,3 +186,10 @@ void freeListCleanup(void *pvt)
|
||||
}
|
||||
free(pvt);
|
||||
}
|
||||
|
||||
size_t freeListItemsAvail(void *pvt)
|
||||
{
|
||||
FREELISTPVT *pfl = pvt;
|
||||
return pfl->nBlocksAvailable;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,17 +49,19 @@ DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000).
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 04-19-94 mrk Initial Implementation
|
||||
* .02 03-28-97 joh added freeListItemAvail() function
|
||||
*/
|
||||
|
||||
#ifdef vxWorks
|
||||
#include <vxWorks.h>
|
||||
#include <fast_lock.h>
|
||||
#include <taskLib.h>
|
||||
#include "fast_lock.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <freeList.h>
|
||||
#include "freeList.h"
|
||||
|
||||
typedef struct allocMem {
|
||||
struct allocMem *next;
|
||||
@@ -70,6 +72,7 @@ typedef struct {
|
||||
int nmalloc;
|
||||
void *head;
|
||||
allocMem *mallochead;
|
||||
size_t nBlocksAvailable;
|
||||
#ifdef vxWorks
|
||||
FAST_LOCK lock;
|
||||
#endif
|
||||
@@ -90,6 +93,7 @@ void freeListInitPvt(void **ppvt,int size,int nmalloc)
|
||||
pfl->nmalloc = nmalloc;
|
||||
pfl->head = NULL;
|
||||
pfl->mallochead = NULL;
|
||||
pfl->nBlocksAvailable = 0u;
|
||||
#ifdef vxWorks
|
||||
FASTLOCKINIT(&pfl->lock);
|
||||
#endif
|
||||
@@ -139,9 +143,11 @@ void *freeListMalloc(void *pvt)
|
||||
ptemp = ((char *)ptemp) + pfl->size;
|
||||
}
|
||||
ptemp = pfl->head;
|
||||
pfl->nBlocksAvailable += pfl->nmalloc;
|
||||
}
|
||||
ppnext = pfl->head;
|
||||
pfl->head = *ppnext;
|
||||
pfl->nBlocksAvailable--;
|
||||
#ifdef vxWorks
|
||||
FASTUNLOCK(&pfl->lock);
|
||||
#endif
|
||||
@@ -159,6 +165,7 @@ void freeListFree(void *pvt,void*pmem)
|
||||
ppnext = pmem;
|
||||
*ppnext = pfl->head;
|
||||
pfl->head = pmem;
|
||||
pfl->nBlocksAvailable++;
|
||||
#ifdef vxWorks
|
||||
FASTUNLOCK(&pfl->lock);
|
||||
#endif
|
||||
@@ -179,3 +186,10 @@ void freeListCleanup(void *pvt)
|
||||
}
|
||||
free(pvt);
|
||||
}
|
||||
|
||||
size_t freeListItemsAvail(void *pvt)
|
||||
{
|
||||
FREELISTPVT *pfl = pvt;
|
||||
return pfl->nBlocksAvailable;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,9 +56,9 @@ DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000).
|
||||
#ifndef INCgpHashh
|
||||
#define INCgpHashh 1
|
||||
|
||||
#include <ellLib.h>
|
||||
#include "ellLib.h"
|
||||
#ifdef vxWorks
|
||||
#include <fast_lock.h>
|
||||
#include "fast_lock.h"
|
||||
#endif
|
||||
|
||||
typedef struct{
|
||||
|
||||
@@ -56,9 +56,9 @@ DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000).
|
||||
#ifndef INCgpHashh
|
||||
#define INCgpHashh 1
|
||||
|
||||
#include <ellLib.h>
|
||||
#include "ellLib.h"
|
||||
#ifdef vxWorks
|
||||
#include <fast_lock.h>
|
||||
#include "fast_lock.h"
|
||||
#endif
|
||||
|
||||
typedef struct{
|
||||
|
||||
@@ -57,13 +57,13 @@ DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000).
|
||||
#include <taskLib.h>
|
||||
#endif
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include "dbDefs.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <gpHash.h>
|
||||
#include <ellLib.h>
|
||||
#include <epicsPrint.h>
|
||||
#include "gpHash.h"
|
||||
#include "ellLib.h"
|
||||
#include "epicsPrint.h"
|
||||
|
||||
typedef struct gphPvt {
|
||||
int tableSize;
|
||||
|
||||
@@ -57,13 +57,13 @@ DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000).
|
||||
#include <taskLib.h>
|
||||
#endif
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include "dbDefs.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <gpHash.h>
|
||||
#include <ellLib.h>
|
||||
#include <epicsPrint.h>
|
||||
#include "gpHash.h"
|
||||
#include "ellLib.h"
|
||||
#include "epicsPrint.h"
|
||||
|
||||
typedef struct gphPvt {
|
||||
int tableSize;
|
||||
|
||||
@@ -20,7 +20,7 @@ of this distribution.
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <impLib.h>
|
||||
#include "impLib.h"
|
||||
|
||||
#define MAX_SIZE 256
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ of this distribution.
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ellLib.h>
|
||||
#include <epicsPrint.h>
|
||||
#include <impLib.h>
|
||||
#include "ellLib.h"
|
||||
#include "epicsPrint.h"
|
||||
#include "impLib.h"
|
||||
|
||||
/*private declarations*/
|
||||
typedef struct pathNode {
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <epicsAssert.h>
|
||||
#include <ellLib.h>
|
||||
#include "epicsAssert.h"
|
||||
#include "ellLib.h"
|
||||
|
||||
#ifdef vxWorks
|
||||
#define LOCKS_REQUIRED
|
||||
@@ -42,7 +42,7 @@
|
||||
#endif /*vxWorks*/
|
||||
|
||||
#ifdef LOCKS_REQUIRED
|
||||
#include <fast_lock.h>
|
||||
#include "fast_lock.h"
|
||||
#else /*LOCKS_REQUIRED*/
|
||||
#define FASTLOCK(A)
|
||||
#define FASTUNLOCK(A)
|
||||
@@ -65,7 +65,7 @@ typedef struct debugMallocHeader{
|
||||
unsigned long magic;
|
||||
}DMH;
|
||||
|
||||
#include <memDebugLib.h>
|
||||
#include "memDebugLib.h"
|
||||
#undef free
|
||||
#undef malloc
|
||||
#undef calloc
|
||||
|
||||
@@ -140,8 +140,8 @@
|
||||
# include <ctype.h>
|
||||
# include <stdio.h>
|
||||
#endif
|
||||
#include <epicsAssert.h>
|
||||
#include <tsDefs.h>
|
||||
#include "epicsAssert.h"
|
||||
#include "tsDefs.h"
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
|
||||
@@ -45,8 +45,16 @@ extern "C" {
|
||||
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
|
||||
extern void epicsAssert (const char *pFile, const unsigned line,
|
||||
const char *pMsg, const char *pAuthorName);
|
||||
extern void epicsAssert (const char *pFile, const unsigned line,
|
||||
const char *pMsg, const char *pAuthorName);
|
||||
|
||||
#else /*__STDC__ or __cplusplus*/
|
||||
|
||||
extern void epicsAssert ();
|
||||
|
||||
#endif /*__STDC__ or __cplusplus*/
|
||||
|
||||
#if (defined(__STDC__) || defined(__cplusplus)) && !defined(VAXC)
|
||||
|
||||
#ifdef epicsAssertAuthor
|
||||
#define assert(exp) \
|
||||
@@ -58,7 +66,6 @@ extern void epicsAssert (const char *pFile, const unsigned line,
|
||||
|
||||
#else /*__STDC__ or __cplusplus*/
|
||||
|
||||
extern void epicsAssert ();
|
||||
|
||||
#ifdef epicsAssertAuthor
|
||||
#define assert(exp) \
|
||||
@@ -68,7 +75,7 @@ extern void epicsAssert ();
|
||||
{if (!(exp)) epicsAssert (__FILE__, __LINE__, "", 0);}
|
||||
#endif /* epicsAssertAuthor */
|
||||
|
||||
#endif /*__STDC__ or __cplusplus*/
|
||||
#endif /* (__STDC__ or __cplusplus) and not VAXC */
|
||||
|
||||
#endif /* NDEBUG */
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
*
|
||||
* History
|
||||
* $Log$
|
||||
* Revision 1.4 1996/11/02 02:06:00 jhill
|
||||
* const param => #define
|
||||
*
|
||||
* Revision 1.3 1996/09/04 21:53:36 jhill
|
||||
* allow use with goofy vxWorks 5.2 time spec - which has unsigned sec and
|
||||
* signed nsec
|
||||
@@ -62,20 +65,20 @@
|
||||
#define nSecPerUSec 1000u
|
||||
#define secPerMin 60u
|
||||
|
||||
#include <shareLib.h>
|
||||
#include "shareLib.h"
|
||||
|
||||
class epicsShareClass osiTime {
|
||||
static friend osiTime operator+
|
||||
static friend inline osiTime operator+
|
||||
(const osiTime &lhs, const osiTime &rhs);
|
||||
static friend osiTime operator-
|
||||
static friend inline osiTime operator-
|
||||
(const osiTime &lhs, const osiTime &rhs);
|
||||
static friend int operator>=
|
||||
static friend inline int operator>=
|
||||
(const osiTime &lhs, const osiTime &rhs);
|
||||
static friend int operator>
|
||||
static friend inline int operator>
|
||||
(const osiTime &lhs, const osiTime &rhs);
|
||||
static friend int operator<=
|
||||
static friend inline int operator<=
|
||||
(const osiTime &lhs, const osiTime &rhs);
|
||||
static friend int operator<
|
||||
static friend inline int operator<
|
||||
(const osiTime &lhs, const osiTime &rhs);
|
||||
public:
|
||||
osiTime () : sec(0u), nSec(0u) {}
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
*
|
||||
* History
|
||||
* $Log$
|
||||
* Revision 1.6 1996/11/02 02:06:58 jhill
|
||||
* fixed several subtle problems
|
||||
*
|
||||
* Revision 1.5 1996/09/16 21:19:25 jhill
|
||||
* removed unused variable
|
||||
*
|
||||
@@ -62,16 +65,17 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include <osiTimer.h>
|
||||
#include "osiTimer.h"
|
||||
|
||||
osiTimerQueue staticTimerQueue;
|
||||
static const tsDLIterBD<osiTimer> eol; // end of list
|
||||
|
||||
//
|
||||
// osiTimer::arm()
|
||||
//
|
||||
void osiTimer::arm (const osiTime * const pInitialDelay)
|
||||
{
|
||||
osiTimer *pTmr;
|
||||
tsDLIterBD<osiTimer> iter;
|
||||
# ifdef DEBUG
|
||||
unsigned preemptCount=0u;
|
||||
# endif
|
||||
@@ -97,27 +101,27 @@ void osiTimer::arm (const osiTime * const pInitialDelay)
|
||||
//
|
||||
// **** this should use a binary tree ????
|
||||
//
|
||||
tsDLIter<osiTimer> iter (staticTimerQueue.pending);
|
||||
while ( (pTmr = iter.prev()) ) {
|
||||
if (pTmr->exp <= this->exp) {
|
||||
iter = staticTimerQueue.pending.last();
|
||||
while (1) {
|
||||
if (iter==eol) {
|
||||
//
|
||||
// add to the beginning of the list
|
||||
//
|
||||
staticTimerQueue.pending.push (*this);
|
||||
break;
|
||||
}
|
||||
if (iter->exp <= this->exp) {
|
||||
//
|
||||
// add after the item found that expires earlier
|
||||
//
|
||||
staticTimerQueue.pending.insertAfter (*this, *iter);
|
||||
break;
|
||||
}
|
||||
# ifdef DEBUG
|
||||
preemptCount++;
|
||||
# endif
|
||||
--iter;
|
||||
}
|
||||
if (pTmr) {
|
||||
//
|
||||
// add after the item found that expires earlier
|
||||
//
|
||||
staticTimerQueue.pending.insertAfter (*this, *pTmr);
|
||||
}
|
||||
else {
|
||||
//
|
||||
// add to the beginning of the list
|
||||
//
|
||||
staticTimerQueue.pending.push (*this);
|
||||
}
|
||||
this->state = ositPending;
|
||||
|
||||
# ifdef DEBUG
|
||||
@@ -228,17 +232,11 @@ osiTime osiTimerQueue::delayToFirstExpire() const
|
||||
{
|
||||
osiTimer *pTmr;
|
||||
osiTime cur(osiTime::getCurrent());
|
||||
tsDLIter<osiTimer> iter(this->pending);
|
||||
osiTime delay;
|
||||
|
||||
pTmr = iter.next();
|
||||
pTmr = this->pending.first();
|
||||
if (pTmr) {
|
||||
if (pTmr->exp>=cur) {
|
||||
delay = pTmr->exp - cur;
|
||||
}
|
||||
else {
|
||||
delay = osiTime(0u,0u);
|
||||
}
|
||||
delay = pTmr->timeRemaining();
|
||||
}
|
||||
else {
|
||||
//
|
||||
@@ -257,7 +255,8 @@ osiTime osiTimerQueue::delayToFirstExpire() const
|
||||
//
|
||||
void osiTimerQueue::process()
|
||||
{
|
||||
tsDLFwdIter<osiTimer> pendIter (this->pending);
|
||||
tsDLIterBD<osiTimer> iter;
|
||||
tsDLIterBD<osiTimer> tmp;
|
||||
osiTime cur(osiTime::getCurrent());
|
||||
osiTimer *pTmr;
|
||||
|
||||
@@ -267,13 +266,17 @@ void osiTimerQueue::process()
|
||||
}
|
||||
this->inProcess = osiTrue;
|
||||
|
||||
while ( (pTmr = pendIter.next()) ) {
|
||||
if (pTmr->exp >= cur) {
|
||||
iter = this->pending.first();
|
||||
while ( iter!=eol ) {
|
||||
if (iter->exp >= cur) {
|
||||
break;
|
||||
}
|
||||
pendIter.remove();
|
||||
pTmr->state = ositExpired;
|
||||
this->expired.add(*pTmr);
|
||||
tmp = iter;
|
||||
++tmp;
|
||||
this->pending.remove(*iter);
|
||||
iter->state = ositExpired;
|
||||
this->expired.add(*iter);
|
||||
iter = tmp;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -320,13 +323,12 @@ void osiTimerQueue::process()
|
||||
//
|
||||
void osiTimerQueue::show(unsigned level) const
|
||||
{
|
||||
osiTimer *pTmr;
|
||||
|
||||
printf("osiTimerQueue with %d items pending and %d items expired\n",
|
||||
printf("osiTimerQueue with %u items pending and %u items expired\n",
|
||||
this->pending.count(), this->expired.count());
|
||||
tsDLIter<osiTimer> iter (this->pending);
|
||||
while ( (pTmr = iter.next()) ) {
|
||||
pTmr->show(level);
|
||||
tsDLIterBD<osiTimer> iter(this->pending.first());
|
||||
while ( iter!=eol ) {
|
||||
iter->show(level);
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,3 +365,55 @@ const char *osiTimer::name() const
|
||||
return "osiTimer";
|
||||
}
|
||||
|
||||
//
|
||||
// osiTimer::reschedule()
|
||||
//
|
||||
// pull this timer out of the queue ans reinstall
|
||||
// it with a new experation time
|
||||
//
|
||||
void osiTimer::reschedule(const osiTime &newDelay)
|
||||
{
|
||||
//
|
||||
// signal the timer queue if this
|
||||
// occurrring during the expire call
|
||||
// back
|
||||
//
|
||||
if (this == staticTimerQueue.pExpireTmr) {
|
||||
staticTimerQueue.pExpireTmr = 0;
|
||||
}
|
||||
switch (this->state) {
|
||||
case ositPending:
|
||||
staticTimerQueue.pending.remove(*this);
|
||||
break;
|
||||
case ositExpired:
|
||||
staticTimerQueue.expired.remove(*this);
|
||||
break;
|
||||
case ositLimbo:
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
this->state = ositLimbo;
|
||||
this->arm(&newDelay);
|
||||
}
|
||||
|
||||
//
|
||||
// osiTimer::timeRemaining()
|
||||
//
|
||||
// return the number of seconds remaining before
|
||||
// this timer will expire
|
||||
//
|
||||
osiTime osiTimer::timeRemaining()
|
||||
{
|
||||
osiTime cur = osiTime::getCurrent();
|
||||
osiTime delay;
|
||||
|
||||
if (this->exp>cur) {
|
||||
delay = this->exp - cur;
|
||||
}
|
||||
else {
|
||||
delay = osiTime(0u,0u);
|
||||
}
|
||||
return delay;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
*
|
||||
* History
|
||||
* $Log$
|
||||
* Revision 1.3 1996/11/02 02:06:59 jhill
|
||||
* fixed several subtle problems
|
||||
*
|
||||
* Revision 1.2 1996/08/05 21:51:11 jhill
|
||||
* fixed delete this confusion
|
||||
*
|
||||
@@ -45,8 +48,8 @@
|
||||
#ifndef osiTimerHInclude
|
||||
#define osiTimerHInclude
|
||||
|
||||
#include <tsDLList.h>
|
||||
#include <osiTime.h>
|
||||
#include "tsDLList.h"
|
||||
#include "osiTime.h"
|
||||
|
||||
enum osiBool {osiFalse=0, osiTrue=1};
|
||||
enum osiTimerState {ositPending, ositExpired, ositLimbo};
|
||||
@@ -95,6 +98,18 @@ public:
|
||||
//
|
||||
virtual const osiTime delay() const;
|
||||
|
||||
//
|
||||
// change the timers expiration to newDelay
|
||||
// seconds after when reschedule() is called
|
||||
//
|
||||
void reschedule(const osiTime &newDelay);
|
||||
|
||||
//
|
||||
// return the number of seconds remaining before
|
||||
// this timer will expire
|
||||
//
|
||||
osiTime timeRemaining();
|
||||
|
||||
virtual void show (unsigned level) const;
|
||||
|
||||
//
|
||||
|
||||
@@ -98,8 +98,8 @@
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <dbDefs.h>
|
||||
#include <post.h>
|
||||
#include "dbDefs.h"
|
||||
#include "post.h"
|
||||
#include <ctype.h>
|
||||
|
||||
/* declarations for postfix */
|
||||
|
||||
18
src/libCom/sigPipeIgnore.h
Normal file
18
src/libCom/sigPipeIgnore.h
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
/*
|
||||
* install NOOP SIGPIPE handler
|
||||
*
|
||||
* escape into C to call signal because of a brain dead
|
||||
* signal() func proto supplied in signal.h by gcc 2.7.2
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void installSigPipeIgnore (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
*
|
||||
* History
|
||||
* $Log$
|
||||
* Revision 1.6 1996/11/02 02:06:58 jhill
|
||||
* fixed several subtle problems
|
||||
*
|
||||
* Revision 1.5 1996/09/16 21:19:25 jhill
|
||||
* removed unused variable
|
||||
*
|
||||
@@ -62,16 +65,17 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include <osiTimer.h>
|
||||
#include "osiTimer.h"
|
||||
|
||||
osiTimerQueue staticTimerQueue;
|
||||
static const tsDLIterBD<osiTimer> eol; // end of list
|
||||
|
||||
//
|
||||
// osiTimer::arm()
|
||||
//
|
||||
void osiTimer::arm (const osiTime * const pInitialDelay)
|
||||
{
|
||||
osiTimer *pTmr;
|
||||
tsDLIterBD<osiTimer> iter;
|
||||
# ifdef DEBUG
|
||||
unsigned preemptCount=0u;
|
||||
# endif
|
||||
@@ -97,27 +101,27 @@ void osiTimer::arm (const osiTime * const pInitialDelay)
|
||||
//
|
||||
// **** this should use a binary tree ????
|
||||
//
|
||||
tsDLIter<osiTimer> iter (staticTimerQueue.pending);
|
||||
while ( (pTmr = iter.prev()) ) {
|
||||
if (pTmr->exp <= this->exp) {
|
||||
iter = staticTimerQueue.pending.last();
|
||||
while (1) {
|
||||
if (iter==eol) {
|
||||
//
|
||||
// add to the beginning of the list
|
||||
//
|
||||
staticTimerQueue.pending.push (*this);
|
||||
break;
|
||||
}
|
||||
if (iter->exp <= this->exp) {
|
||||
//
|
||||
// add after the item found that expires earlier
|
||||
//
|
||||
staticTimerQueue.pending.insertAfter (*this, *iter);
|
||||
break;
|
||||
}
|
||||
# ifdef DEBUG
|
||||
preemptCount++;
|
||||
# endif
|
||||
--iter;
|
||||
}
|
||||
if (pTmr) {
|
||||
//
|
||||
// add after the item found that expires earlier
|
||||
//
|
||||
staticTimerQueue.pending.insertAfter (*this, *pTmr);
|
||||
}
|
||||
else {
|
||||
//
|
||||
// add to the beginning of the list
|
||||
//
|
||||
staticTimerQueue.pending.push (*this);
|
||||
}
|
||||
this->state = ositPending;
|
||||
|
||||
# ifdef DEBUG
|
||||
@@ -228,17 +232,11 @@ osiTime osiTimerQueue::delayToFirstExpire() const
|
||||
{
|
||||
osiTimer *pTmr;
|
||||
osiTime cur(osiTime::getCurrent());
|
||||
tsDLIter<osiTimer> iter(this->pending);
|
||||
osiTime delay;
|
||||
|
||||
pTmr = iter.next();
|
||||
pTmr = this->pending.first();
|
||||
if (pTmr) {
|
||||
if (pTmr->exp>=cur) {
|
||||
delay = pTmr->exp - cur;
|
||||
}
|
||||
else {
|
||||
delay = osiTime(0u,0u);
|
||||
}
|
||||
delay = pTmr->timeRemaining();
|
||||
}
|
||||
else {
|
||||
//
|
||||
@@ -257,7 +255,8 @@ osiTime osiTimerQueue::delayToFirstExpire() const
|
||||
//
|
||||
void osiTimerQueue::process()
|
||||
{
|
||||
tsDLFwdIter<osiTimer> pendIter (this->pending);
|
||||
tsDLIterBD<osiTimer> iter;
|
||||
tsDLIterBD<osiTimer> tmp;
|
||||
osiTime cur(osiTime::getCurrent());
|
||||
osiTimer *pTmr;
|
||||
|
||||
@@ -267,13 +266,17 @@ void osiTimerQueue::process()
|
||||
}
|
||||
this->inProcess = osiTrue;
|
||||
|
||||
while ( (pTmr = pendIter.next()) ) {
|
||||
if (pTmr->exp >= cur) {
|
||||
iter = this->pending.first();
|
||||
while ( iter!=eol ) {
|
||||
if (iter->exp >= cur) {
|
||||
break;
|
||||
}
|
||||
pendIter.remove();
|
||||
pTmr->state = ositExpired;
|
||||
this->expired.add(*pTmr);
|
||||
tmp = iter;
|
||||
++tmp;
|
||||
this->pending.remove(*iter);
|
||||
iter->state = ositExpired;
|
||||
this->expired.add(*iter);
|
||||
iter = tmp;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -320,13 +323,12 @@ void osiTimerQueue::process()
|
||||
//
|
||||
void osiTimerQueue::show(unsigned level) const
|
||||
{
|
||||
osiTimer *pTmr;
|
||||
|
||||
printf("osiTimerQueue with %d items pending and %d items expired\n",
|
||||
printf("osiTimerQueue with %u items pending and %u items expired\n",
|
||||
this->pending.count(), this->expired.count());
|
||||
tsDLIter<osiTimer> iter (this->pending);
|
||||
while ( (pTmr = iter.next()) ) {
|
||||
pTmr->show(level);
|
||||
tsDLIterBD<osiTimer> iter(this->pending.first());
|
||||
while ( iter!=eol ) {
|
||||
iter->show(level);
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,3 +365,55 @@ const char *osiTimer::name() const
|
||||
return "osiTimer";
|
||||
}
|
||||
|
||||
//
|
||||
// osiTimer::reschedule()
|
||||
//
|
||||
// pull this timer out of the queue ans reinstall
|
||||
// it with a new experation time
|
||||
//
|
||||
void osiTimer::reschedule(const osiTime &newDelay)
|
||||
{
|
||||
//
|
||||
// signal the timer queue if this
|
||||
// occurrring during the expire call
|
||||
// back
|
||||
//
|
||||
if (this == staticTimerQueue.pExpireTmr) {
|
||||
staticTimerQueue.pExpireTmr = 0;
|
||||
}
|
||||
switch (this->state) {
|
||||
case ositPending:
|
||||
staticTimerQueue.pending.remove(*this);
|
||||
break;
|
||||
case ositExpired:
|
||||
staticTimerQueue.expired.remove(*this);
|
||||
break;
|
||||
case ositLimbo:
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
this->state = ositLimbo;
|
||||
this->arm(&newDelay);
|
||||
}
|
||||
|
||||
//
|
||||
// osiTimer::timeRemaining()
|
||||
//
|
||||
// return the number of seconds remaining before
|
||||
// this timer will expire
|
||||
//
|
||||
osiTime osiTimer::timeRemaining()
|
||||
{
|
||||
osiTime cur = osiTime::getCurrent();
|
||||
osiTime delay;
|
||||
|
||||
if (this->exp>cur) {
|
||||
delay = this->exp - cur;
|
||||
}
|
||||
else {
|
||||
delay = osiTime(0u,0u);
|
||||
}
|
||||
return delay;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
*
|
||||
* History
|
||||
* $Log$
|
||||
* Revision 1.3 1996/11/02 02:06:59 jhill
|
||||
* fixed several subtle problems
|
||||
*
|
||||
* Revision 1.2 1996/08/05 21:51:11 jhill
|
||||
* fixed delete this confusion
|
||||
*
|
||||
@@ -45,8 +48,8 @@
|
||||
#ifndef osiTimerHInclude
|
||||
#define osiTimerHInclude
|
||||
|
||||
#include <tsDLList.h>
|
||||
#include <osiTime.h>
|
||||
#include "tsDLList.h"
|
||||
#include "osiTime.h"
|
||||
|
||||
enum osiBool {osiFalse=0, osiTrue=1};
|
||||
enum osiTimerState {ositPending, ositExpired, ositLimbo};
|
||||
@@ -95,6 +98,18 @@ public:
|
||||
//
|
||||
virtual const osiTime delay() const;
|
||||
|
||||
//
|
||||
// change the timers expiration to newDelay
|
||||
// seconds after when reschedule() is called
|
||||
//
|
||||
void reschedule(const osiTime &newDelay);
|
||||
|
||||
//
|
||||
// return the number of seconds remaining before
|
||||
// this timer will expire
|
||||
//
|
||||
osiTime timeRemaining();
|
||||
|
||||
virtual void show (unsigned level) const;
|
||||
|
||||
//
|
||||
|
||||
@@ -54,9 +54,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <shareLib.h>
|
||||
#include "shareLib.h"
|
||||
|
||||
#include <errMdef.h> /* get M_ts for this subsystem's `number' */
|
||||
#include "errMdef.h" /* get M_ts for this subsystem's `number' */
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
-
|
||||
@@ -185,7 +185,7 @@ struct tsDetail {
|
||||
#ifndef TS_PRIVATE_DATA
|
||||
epicsShareExtern char *glTsStatText[7];
|
||||
#else
|
||||
char *glTsStatText[] = {
|
||||
epicsShareDecl char *glTsStatText[] = {
|
||||
/* S_ts_OK */ "success",
|
||||
/* S_ts_sysTimeError */ "error getting system time",
|
||||
/* S_ts_badTextCode */ "invalid TS_TEXT_xxx code",
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
* time zone.
|
||||
*
|
||||
* QUICK REFERENCE
|
||||
* #include <tsDefs.h>
|
||||
* #include "tsDefs.h"
|
||||
* TS_STAMP timeStamp;
|
||||
* void date( )
|
||||
* void tsAddDouble( >pStampSum, pStamp, secAsDouble )
|
||||
|
||||
Reference in New Issue
Block a user