From 1c6e4969957eff8c9c3e6a63ff26c712583463be Mon Sep 17 00:00:00 2001 From: Marty Kraimer Date: Mon, 6 Mar 2000 21:44:08 +0000 Subject: [PATCH] split db_access.h so ca not dependent on db --- src/db/Makefile | 5 +- src/db/dbAddr.h | 10 ---- src/db/dbCa.c | 4 +- src/db/db_access.c | 2 +- src/db/db_access.h | 100 +++++++----------------------------- src/db/db_access_routines.h | 50 ++++++++++++++++++ src/db/db_convert.h | 72 ++++++++++++++++++++++++++ src/db/db_test.c | 1 + src/db/dbcar.c | 10 +++- 9 files changed, 157 insertions(+), 97 deletions(-) create mode 100644 src/db/db_access_routines.h create mode 100644 src/db/db_convert.h diff --git a/src/db/Makefile b/src/db/Makefile index 9e4239c3a..783ddf5b8 100644 --- a/src/db/Makefile +++ b/src/db/Makefile @@ -16,11 +16,14 @@ INC += dbLock.h INC += dbNotify.h INC += dbScan.h INC += dbTest.h -INC += db_access.h INC += db_test.h INC += db_field_log.h INC += initHooks.h INC += recGbl.h +# The following go away what old database access goes away +INC += db_access.h +INC += db_access_routines.h +INC += db_convert.h MENUS += menuAlarmSevr.h MENUS += menuAlarmStat.h diff --git a/src/db/dbAddr.h b/src/db/dbAddr.h index 38ba02df8..a47a5bdde 100644 --- a/src/db/dbAddr.h +++ b/src/db/dbAddr.h @@ -22,14 +22,4 @@ typedef struct dbAddr{ /*DBR_STRING,...,DBR_ENUM,DBR_NOACCESS*/ }DBADDR; -/* - * old db access API - * (included here because these routines use dbAccess.h and their - * prototypes must also be included in db_access.h) - */ -epicsShareFunc int epicsShareAPI db_name_to_addr(const char *pname, DBADDR *paddr); -epicsShareFunc int epicsShareAPI db_put_field(DBADDR *paddr, int src_type, - const void *psrc, int no_elements); -epicsShareFunc int epicsShareAPI db_get_field(DBADDR *paddr, int dest_type, - void *pdest, int no_elements, void *pfl); #endif /* dbAddrh */ diff --git a/src/db/dbCa.c b/src/db/dbCa.c index bbb56cd2c..c2eb4168f 100644 --- a/src/db/dbCa.c +++ b/src/db/dbCa.c @@ -41,11 +41,13 @@ of this distribution. #include "epicsPrint.h" #include "dbCommon.h" #include "cadef.h" +#include "db_access.h" #include "caerr.h" /*following because we cant include dbStaticLib.h*/ epicsShareFunc void * epicsShareAPI dbCalloc(size_t nobj,size_t size); #define epicsExportSharedSymbols -#include "db_access.h" +#include "db_access_routines.h" +#include "db_convert.h" #include "dbScan.h" #include "dbCa.h" #include "dbCaPvt.h" diff --git a/src/db/db_access.c b/src/db/db_access.c index a8614c803..440614e72 100644 --- a/src/db/db_access.c +++ b/src/db/db_access.c @@ -61,9 +61,9 @@ #include "recSup.h" #include "alarm.h" #define epicsExportSharedSymbols -#include "dbAddr.h" #include "dbNotify.h" #include "dbAccessDefs.h" +#include "db_access_routines.h" #ifndef NULL #define NULL 0 diff --git a/src/db/db_access.h b/src/db/db_access.h index 229492e37..3dd562ef3 100644 --- a/src/db/db_access.h +++ b/src/db/db_access.h @@ -1,34 +1,24 @@ /* base/include/db_access.h */ -/* $Id$ +/* $Id$ */ + +/* Author: Bob Dalesio + * Date: 4-4-88 */ -/* - * Author: Bob Dalesio - * Date: 4-4-88 - * - * Experimental Physics and Industrial Control System (EPICS) - * - * Copyright 1991, the Regents of the University of California, - * and the University of Chicago Board of Governors. - * - * This software was produced under U.S. Government contracts: - * (W-7405-ENG-36) at the Los Alamos National Laboratory, - * and (W-31-109-ENG-38) at Argonne National Laboratory. - * - * Initial development by: - * The Controls and Automation Group (AT-8) - * Ground Test Accelerator - * Accelerator Technology Division - * Los Alamos National Laboratory - * - * Co-developed with - * The Controls and Computing Group - * Accelerator Systems Division - * Advanced Photon Source - * Argonne National Laboratory - * - * - * Modification Log: +/***************************************************************** + COPYRIGHT NOTIFICATION +***************************************************************** + +(C) COPYRIGHT 1991 Regents of the University of California, +and the University of Chicago Board of Governors. + +This software was developed under a United States Government license +described on the COPYRIGHT_Combined file included as part +of this distribution. +**********************************************************************/ + + +/* Modification Log: * ----------------- * .01 05-02-88 lrd add control enumeration field, structure & size * .02 05-12-88 lrd add array structures @@ -89,9 +79,6 @@ #ifndef INCLdb_accessh #define INCLdb_accessh -#ifdef __cplusplus -extern "C" { -#endif #include @@ -99,10 +86,6 @@ extern "C" { #include "epicsTypes.h" #include "tsStamp.h" #include "ellLib.h" -#include "dbAddr.h" - -epicsShareExtern struct dbBase *pdbbase; -epicsShareExtern volatile int interruptAccept; #define MAX_UNITS_SIZE 8 @@ -212,45 +195,6 @@ epicsShareDef READONLY int epicsTypeToDBR_XXXX [lastEpicsType+1] = { }; #endif -/*Definitions that allow old database access to use new conversion routines*/ -#define newDBF_DEVICE 11 -#define newDBR_ENUM 9 -epicsShareExtern long (*dbGetConvertRoutine[newDBF_DEVICE+1][newDBR_ENUM+1]) - (struct dbAddr *paddr, void *pbuffer,long nRequest, - long no_elements, long offset); -epicsShareExtern long (*dbPutConvertRoutine[newDBR_ENUM+1][newDBF_DEVICE+1]) - (struct dbAddr *paddr, void *pbuffer,long nRequest, - long no_elements, long offset); -epicsShareExtern long (*dbFastGetConvertRoutine[newDBF_DEVICE+1][newDBR_ENUM+1])(); -epicsShareExtern long (*dbFastPutConvertRoutine[newDBR_ENUM+1][newDBF_DEVICE+1])(); - -/*Conversion between old and new DBR types*/ -epicsShareExtern unsigned short dbDBRoldToDBFnew[DBR_DOUBLE+1]; -epicsShareExtern unsigned short dbDBRnewToDBRold[newDBR_ENUM+1]; -#ifdef DB_TEXT_GLBLSOURCE -epicsShareDef unsigned short dbDBRoldToDBFnew[DBR_DOUBLE+1] = { - 0, /*DBR_STRING to DBF_STRING*/ - 3, /*DBR_INT to DBF_SHORT*/ - 7, /*DBR_FLOAT to DBF_FLOAT*/ - 9, /*DBR_ENUM to DBF_ENUM*/ - 1, /*DBR_CHAR to DBF_CHAR*/ - 5, /*DBR_LONG to DBF_LONG*/ - 8 /*DBR_DOUBLE to DBF_DOUBLE*/ -}; -epicsShareDef unsigned short dbDBRnewToDBRold[newDBR_ENUM+1] = { - 0, /*DBR_STRING to DBR_STRING*/ - 4, /*DBR_CHAR to DBR_CHAR*/ - 4, /*DBR_UCHAR to DBR_CHAR*/ - 1, /*DBR_SHORT to DBR_SHORT*/ - 5, /*DBR_USHORT to DBR_LONG*/ - 5, /*DBR_LONG to DBR_LONG*/ - 6, /*DBR_ULONG to DBR_DOUBLE*/ - 2, /*DBR_FLOAT to DBR_FLOAT*/ - 6, /*DBR_DOUBLE to DBR_DOUBLE*/ - 3, /*DBR_ENUM to DBR_ENUM*/ -}; -#endif /*DB_TEXT_GLBLSOURCE*/ - /* * The DBR_XXXX types are indicies into this array */ @@ -305,10 +249,6 @@ epicsShareDef READONLY epicsType DBR_XXXXToEpicsType [LAST_BUFFER_TYPE+1] = { epicsShareExtern READONLY epicsType DBR_XXXXToEpicsType [LAST_BUFFER_TYPE+1]; #endif -/* extra processing flags */ -#define EP_SCAN 0x01 -#define EP_INIT 0x02 -#define EP_CALC 0x03 /* values returned for each field type * DBR_STRING returns a NULL terminated string @@ -1153,8 +1093,4 @@ union db_access_val{ epicsShareDef READONLY short dbr_text_dim = (sizeof dbr_text)/(sizeof (char *)) + 1; #endif -#ifdef __cplusplus -} -#endif - #endif /* INCLdb_accessh */ diff --git a/src/db/db_access_routines.h b/src/db/db_access_routines.h new file mode 100644 index 000000000..0b0912283 --- /dev/null +++ b/src/db/db_access_routines.h @@ -0,0 +1,50 @@ +/* base/include/db_access_routines.h */ + +/***************************************************************** + COPYRIGHT NOTIFICATION +***************************************************************** + +(C) COPYRIGHT 1991 Regents of the University of California, +and the University of Chicago Board of Governors. + +This software was developed under a United States Government license +described on the COPYRIGHT_Combined file included as part +of this distribution. +**********************************************************************/ + +/* This defined routines for old database access. These were broken out of + db_access.h so that ca can be build independent of db. + src/ca contains db_access, which contains that data definitions +*/ + +#ifndef INCLdb_access_routinesh +#define INCLdb_access_routinesh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "dbAddr.h" + +epicsShareExtern struct dbBase *pdbbase; +epicsShareExtern volatile int interruptAccept; + + +/* + * old db access API + * (included here because these routines use dbAccess.h and their + * prototypes must also be included in db_access.h) + */ +epicsShareFunc int epicsShareAPI db_name_to_addr( + const char *pname, DBADDR *paddr); +epicsShareFunc int epicsShareAPI db_put_field( + DBADDR *paddr, int src_type,const void *psrc, int no_elements); +epicsShareFunc int epicsShareAPI db_get_field( + DBADDR *paddr, int dest_type,void *pdest, int no_elements, void *pfl); + + +#ifdef __cplusplus +} +#endif + +#endif /* INCLdb_access_routinesh */ diff --git a/src/db/db_convert.h b/src/db/db_convert.h new file mode 100644 index 000000000..0739d6a81 --- /dev/null +++ b/src/db/db_convert.h @@ -0,0 +1,72 @@ +/* db_convert.h */ + +/***************************************************************** + COPYRIGHT NOTIFICATION +***************************************************************** + +(C) COPYRIGHT 1991 Regents of the University of California, +and the University of Chicago Board of Governors. + +This software was developed under a United States Government license +described on the COPYRIGHT_Combined file included as part +of this distribution. +**********************************************************************/ + + +#ifndef INCLdb_converth +#define INCLdb_converth + +#ifdef __cplusplus +extern "C" { +#endif + +#include "dbAddr.h" + +epicsShareExtern struct dbBase *pdbbase; +epicsShareExtern volatile int interruptAccept; + +/*Definitions that allow old database access to use new conversion routines*/ +#define newDBF_DEVICE 11 +#define newDBR_ENUM 9 +epicsShareExtern long (*dbGetConvertRoutine[newDBF_DEVICE+1][newDBR_ENUM+1]) + (struct dbAddr *paddr, void *pbuffer,long nRequest, + long no_elements, long offset); +epicsShareExtern long (*dbPutConvertRoutine[newDBR_ENUM+1][newDBF_DEVICE+1]) + (struct dbAddr *paddr, void *pbuffer,long nRequest, + long no_elements, long offset); +epicsShareExtern long (*dbFastGetConvertRoutine[newDBF_DEVICE+1][newDBR_ENUM+1])(); +epicsShareExtern long (*dbFastPutConvertRoutine[newDBR_ENUM+1][newDBF_DEVICE+1])(); + +/*Conversion between old and new DBR types*/ +epicsShareExtern unsigned short dbDBRoldToDBFnew[DBR_DOUBLE+1]; +epicsShareExtern unsigned short dbDBRnewToDBRold[newDBR_ENUM+1]; +#ifdef DB_CONVERT_GBLSOURCE +epicsShareDef unsigned short dbDBRoldToDBFnew[DBR_DOUBLE+1] = { + 0, /*DBR_STRING to DBF_STRING*/ + 3, /*DBR_INT to DBF_SHORT*/ + 7, /*DBR_FLOAT to DBF_FLOAT*/ + 9, /*DBR_ENUM to DBF_ENUM*/ + 1, /*DBR_CHAR to DBF_CHAR*/ + 5, /*DBR_LONG to DBF_LONG*/ + 8 /*DBR_DOUBLE to DBF_DOUBLE*/ +}; +epicsShareDef unsigned short dbDBRnewToDBRold[newDBR_ENUM+1] = { + 0, /*DBR_STRING to DBR_STRING*/ + 4, /*DBR_CHAR to DBR_CHAR*/ + 4, /*DBR_UCHAR to DBR_CHAR*/ + 1, /*DBR_SHORT to DBR_SHORT*/ + 5, /*DBR_USHORT to DBR_LONG*/ + 5, /*DBR_LONG to DBR_LONG*/ + 6, /*DBR_ULONG to DBR_DOUBLE*/ + 2, /*DBR_FLOAT to DBR_FLOAT*/ + 6, /*DBR_DOUBLE to DBR_DOUBLE*/ + 3, /*DBR_ENUM to DBR_ENUM*/ +}; +#endif /*DB_CONVERT_GBLSOURCE*/ + + +#ifdef __cplusplus +} +#endif + +#endif /* INCLdb_converth */ diff --git a/src/db/db_test.c b/src/db/db_test.c index 5cfc9f385..9d5fa30d2 100644 --- a/src/db/db_test.c +++ b/src/db/db_test.c @@ -42,6 +42,7 @@ #include "errlog.h" #define epicsExportSharedSymbols #include "db_access.h" +#include "db_access_routines.h" #include "dbNotify.h" diff --git a/src/db/dbcar.c b/src/db/dbcar.c index 20122b6cf..75d40aeb3 100644 --- a/src/db/dbcar.c +++ b/src/db/dbcar.c @@ -37,14 +37,20 @@ of this distribution. #undef INVALID_DB_REQ /*end of conflicting definitions*/ #include "cadef.h" +#include "db_access.h" #include "dbDefs.h" #include "epicsPrint.h" #include "dbCommon.h" #include "shareLib.h" #define epicsExportSharedSymbols -/*define DB_TEXT_GLBLSOURCE because db_access.d does not include db_access.h*/ + +/*define DB_TEXT_GLBLSOURCE temporily; ca will do this later */ #define DB_TEXT_GLBLSOURCE -#include "db_access.h" + +/*define DB_CONVERT_GBLSOURCE because db_access.c does not include db_access.h*/ +#define DB_CONVERT_GBLSOURCE +#include "db_access_routines.h" +#include "db_convert.h" #include "dbCaPvt.h" #include "dbCa.h"