moved include files. .ascii=> .db; path changes
This commit is contained in:
@@ -13,37 +13,45 @@ DEPLIBS_BASE = $(EPICS_BASE_LIB)
|
||||
DEPLIBS = ./libDb.a\
|
||||
$(DEPLIBS_BASE)/libCom.a
|
||||
|
||||
INC += alarm.h
|
||||
INC += alarmString.h
|
||||
INC += dbBase.h
|
||||
INC += dbFldTypes.h
|
||||
INC += dbStaticLib.h
|
||||
INC += link.h
|
||||
INC += special.h
|
||||
INC += guigroup.h
|
||||
|
||||
SRCS.c = \
|
||||
dbAsciiYacc.c \
|
||||
../dbAsciiTest.c\
|
||||
../dbAsciiExpand.c\
|
||||
dbYacc.c \
|
||||
../dbReadTest.c\
|
||||
../dbExpandInclude.c\
|
||||
../dbPvdLib.c\
|
||||
../dbStaticNoRun.c\
|
||||
../dbStaticLib.c\
|
||||
../dbAsciiToMenuH.c\
|
||||
../dbAsciiToRecordtypeH.c
|
||||
../dbToMenuH.c\
|
||||
../dbToRecordtypeH.c
|
||||
|
||||
OBJS = \
|
||||
dbAsciiTest.o\
|
||||
dbAsciiExpand.o\
|
||||
dbAsciiToMenuH.o\
|
||||
dbAsciiToRecordtypeH.o
|
||||
dbReadTest.o\
|
||||
dbExpandInclude.o\
|
||||
dbToMenuH.o\
|
||||
dbToRecordtypeH.o
|
||||
|
||||
LIBOBJS = dbStaticLib.o dbAsciiYacc.o dbPvdLib.o dbStaticNoRun.o
|
||||
LIBOBJS = dbStaticLib.o dbYacc.o dbPvdLib.o dbStaticNoRun.o
|
||||
LIBNAME = libDb.a
|
||||
|
||||
PROD = \
|
||||
dbAsciiTest\
|
||||
dbAsciiExpand\
|
||||
dbAsciiToMenuH\
|
||||
dbAsciiToRecordtypeH
|
||||
dbReadTest\
|
||||
dbExpandInclude\
|
||||
dbToMenuH\
|
||||
dbToRecordtypeH
|
||||
|
||||
include $(EPICS)/config/RULES.Unix
|
||||
|
||||
# Extra rule since dbAsciiRoutines.c is included in dbAsciiYacc.c
|
||||
dbAsciiYacc.o: dbAsciiLex.c ../dbAsciiRoutines.c
|
||||
# Extra rule since dbLexRoutines.c is included in dbYacc.c
|
||||
dbYacc.o: dbLex.c ../dbLexRoutines.c
|
||||
|
||||
clean::
|
||||
@$(RM) dbAsciiLex.c dbAsciiYacc.c
|
||||
@$(RM) dbLex.c dbYacc.c
|
||||
|
||||
|
||||
@@ -7,13 +7,13 @@ USR_CFLAGS = -ansi
|
||||
VX_WARN_YES = -Wall -pedantic
|
||||
|
||||
SRCS.c = \
|
||||
dbAsciiYacc.c \
|
||||
dbYacc.c \
|
||||
../dbPvdLib.c\
|
||||
../dbStaticRun.c\
|
||||
../dbStaticLib.c
|
||||
|
||||
OBJSdbLib = \
|
||||
dbAsciiYacc.o\
|
||||
dbYacc.o\
|
||||
dbPvdLib.o\
|
||||
dbStaticRun.o\
|
||||
dbStaticLib.o
|
||||
@@ -22,11 +22,11 @@ PROD = dbStaticLib
|
||||
|
||||
include $(EPICS)/config/RULES.Vx
|
||||
|
||||
# Extra rule since dbAsciiRoutines.c is included in dbAsciiYacc.c
|
||||
dbAsciiYacc.o: dbAsciiLex.c ../dbAsciiRoutines.c
|
||||
# Extra rule since dbLexRoutines.c is included in dbYacc.c
|
||||
dbYacc.o: dbLex.c ../dbLexRoutines.c
|
||||
|
||||
clean::
|
||||
@$(RM) dbAsciiLex.c dbAsciiYacc.c
|
||||
@$(RM) dbLex.c dbYacc.c
|
||||
|
||||
dbStaticLib: $(OBJSdbLib)
|
||||
$(RM) $@
|
||||
|
||||
173
src/dbStatic/alarm.h
Normal file
173
src/dbStatic/alarm.h
Normal file
@@ -0,0 +1,173 @@
|
||||
/* Alarm definitions (Must Match choiceGbl.ascii) */
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
* Date: 11-7-90
|
||||
*
|
||||
* 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:
|
||||
* -----------------
|
||||
* .00 mm-dd-yy iii Comment
|
||||
* .01 07-16-92 jba changed VALID_ALARM to INVALID_ALARM
|
||||
* .02 08-11-92 jba added new status DISABLE_ALARM, SIMM_ALARM
|
||||
* .03 05-11-94 jba added new status READ_ACCESS_ALARM, WRITE_ACCESS_ALARM
|
||||
* $Log$
|
||||
* Revision 1.14 1995/10/12 01:25:56 jhill
|
||||
* added CVS logging
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef INCalarmh
|
||||
#define INCalarmh 1
|
||||
|
||||
#include <shareLib.h>
|
||||
#include <epicsTypes.h>
|
||||
|
||||
#ifndef stringOf
|
||||
#ifdef VAXC
|
||||
#define stringOf(TOKEN) "TOKEN"
|
||||
#else
|
||||
#define stringOf(TOKEN) #TOKEN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* defines for the choice fields */
|
||||
/* ALARM SEVERITIES - NOTE: must match defs in choiceGbl.ascii GBL_ALARM_SEV */
|
||||
#define NO_ALARM 0x0
|
||||
#define MINOR_ALARM 0x1
|
||||
#define MAJOR_ALARM 0x2
|
||||
#define INVALID_ALARM 0x3
|
||||
#define ALARM_NSEV INVALID_ALARM+1
|
||||
|
||||
#ifndef NO_ALARMH_ENUM
|
||||
|
||||
typedef enum {
|
||||
epicsSevNone = NO_ALARM,
|
||||
epicsSevMajor = MINOR_ALARM,
|
||||
epicsSevInvalid = MAJOR_ALARM
|
||||
}epicsAlarmSeverity;
|
||||
#define firstEpicsAlarmSev epicsSevNone
|
||||
#define lastEpicsAlarmSev epicsSevInvalid
|
||||
|
||||
#ifdef epicsAlarmGLOBAL
|
||||
READONLY char *epicsAlarmSeverityStrings [lastEpicsAlarmSev+1] = {
|
||||
stringOf (NO_ALARM),
|
||||
stringOf (MINOR_ALARM),
|
||||
stringOf (MAJOR_ALARM)
|
||||
};
|
||||
#else /*epicsAlarmGLOBAL*/
|
||||
epicsShareExtern READONLY char *epicsAlarmSeverityStrings [lastEpicsAlarmSev+1];
|
||||
#endif /*epicsAlarmGLOBAL*/
|
||||
|
||||
#endif /* NO_ALARMH_ENUM */
|
||||
|
||||
/* ALARM STATUS -NOTE: must match defs in choiceGbl.ascii GBL_ALARM_STAT */
|
||||
/* NO_ALARM = 0 as above */
|
||||
#define READ_ALARM 1
|
||||
#define WRITE_ALARM 2
|
||||
/* ANALOG ALARMS */
|
||||
#define HIHI_ALARM 3
|
||||
#define HIGH_ALARM 4
|
||||
#define LOLO_ALARM 5
|
||||
#define LOW_ALARM 6
|
||||
/* BINARY ALARMS */
|
||||
#define STATE_ALARM 7
|
||||
#define COS_ALARM 8
|
||||
/* other alarms */
|
||||
#define COMM_ALARM 9
|
||||
#define TIMEOUT_ALARM 10
|
||||
#define HW_LIMIT_ALARM 11
|
||||
#define CALC_ALARM 12
|
||||
#define SCAN_ALARM 13
|
||||
#define LINK_ALARM 14
|
||||
#define SOFT_ALARM 15
|
||||
#define BAD_SUB_ALARM 16
|
||||
#define UDF_ALARM 17
|
||||
#define DISABLE_ALARM 18
|
||||
#define SIMM_ALARM 19
|
||||
#define READ_ACCESS_ALARM 20
|
||||
#define WRITE_ACCESS_ALARM 21
|
||||
#define ALARM_NSTATUS WRITE_ACCESS_ALARM + 1
|
||||
|
||||
#ifndef NO_ALARMH_ENUM
|
||||
|
||||
typedef enum {
|
||||
epicsAlarmRead = READ_ALARM,
|
||||
epicsAlarmWrite = WRITE_ALARM,
|
||||
epicsAlarmHiHi = HIHI_ALARM,
|
||||
epicsAlarmHigh = HIGH_ALARM,
|
||||
epicsAlarmLoLo = LOLO_ALARM,
|
||||
epicsAlarmLow = LOW_ALARM,
|
||||
epicsAlarmState = STATE_ALARM,
|
||||
epicsAlarmCos = COS_ALARM,
|
||||
epicsAlarmComm = COMM_ALARM,
|
||||
epicsAlarmTimeout = TIMEOUT_ALARM,
|
||||
epicsAlarmHwLimit = HW_LIMIT_ALARM,
|
||||
epicsAlarmCalc = CALC_ALARM,
|
||||
epicsAlarmScan = SCAN_ALARM,
|
||||
epicsAlarmLink = LINK_ALARM,
|
||||
epicsAlarmSoft = SOFT_ALARM,
|
||||
epicsAlarmBadSub = BAD_SUB_ALARM,
|
||||
epicsAlarmUDF = UDF_ALARM,
|
||||
epicsAlarmDisable = DISABLE_ALARM,
|
||||
epicsAlarmSimm = SIMM_ALARM,
|
||||
epicsAlarmReadAccess = READ_ACCESS_ALARM,
|
||||
epicsAlarmWriteAccess = WRITE_ACCESS_ALARM
|
||||
}epicsAlarmCondition;
|
||||
#define firstEpicsAlarmCond epicsSevNone
|
||||
#define lastEpicsAlarmCond epicsAlarmWriteAccess
|
||||
|
||||
#ifdef epicsAlarmGLOBAL
|
||||
READONLY char *epicsAlarmConditionStrings [lastEpicsAlarmCond+1] = {
|
||||
stringOf (epicsAlarmRead),
|
||||
stringOf (epicsAlarmWrite),
|
||||
stringOf (epicsAlarmHiHi),
|
||||
stringOf (epicsAlarmHigh),
|
||||
stringOf (epicsAlarmLoLo),
|
||||
stringOf (epicsAlarmLow),
|
||||
stringOf (epicsAlarmState),
|
||||
stringOf (epicsAlarmCos),
|
||||
stringOf (epicsAlarmComm),
|
||||
stringOf (epicsAlarmTimeout),
|
||||
stringOf (epicsAlarmHwLimit),
|
||||
stringOf (epicsAlarmCalc),
|
||||
stringOf (epicsAlarmScan),
|
||||
stringOf (epicsAlarmLink),
|
||||
stringOf (epicsAlarmSoft),
|
||||
stringOf (epicsAlarmBadSub),
|
||||
stringOf (epicsAlarmUDF),
|
||||
stringOf (epicsAlarmDisable),
|
||||
stringOf (epicsAlarmSimm),
|
||||
stringOf (epicsAlarmReadAccess),
|
||||
stringOf (epicsAlarmWriteAccess),
|
||||
};
|
||||
#else /*epicsAlarmGLOBAL*/
|
||||
epicsShareExtern READONLY char *epicsAlarmConditionStrings [lastEpicsAlarmCond+1];
|
||||
#endif /*epicsAlarmGLOBAL*/
|
||||
|
||||
#endif /* NO_ALARMH_ENUM */
|
||||
|
||||
#endif /* INCalarmh */
|
||||
|
||||
81
src/dbStatic/alarmString.h
Normal file
81
src/dbStatic/alarmString.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/* $Id$
|
||||
* Author:
|
||||
* Date:
|
||||
*
|
||||
* 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:
|
||||
* -----------------
|
||||
* .01 06-06-91 bkc Modified alarmSeverityString: add VALID alarm,
|
||||
* remove INFO alarm
|
||||
* .02 09-10-91 bkc Change status string corresponding to
|
||||
* dbconV2/menus.c
|
||||
* .03 07-16-92 jba changed VALID_ALARM to INVALID_ALARM
|
||||
* .04 02-03-93 jba added 2 new status values
|
||||
* .05 05-11-94 jba addd READ_ACCESS, WRITE_ACCESS, rmvd EPICS_V2 ifdef
|
||||
* ...
|
||||
*/
|
||||
|
||||
/* alarmString.h - String values for alarms (Must match alarm.h)!!!!*/
|
||||
/* share/epicsH @(#)alarmString.h 1.3 11/6/90 */
|
||||
#ifndef INCalarmStringh
|
||||
#define INCalarmStringh 1
|
||||
|
||||
|
||||
static char *alarmStringhSccsId = "$Id$";
|
||||
|
||||
char * alarmSeverityString[]={
|
||||
"NO_ALARM",
|
||||
"MINOR",
|
||||
"MAJOR",
|
||||
"INVALID"
|
||||
};
|
||||
|
||||
|
||||
/*** note: this should be reconciled with alarm.h ***/
|
||||
|
||||
|
||||
char * alarmStatusString[]={
|
||||
"NO_ALARM",
|
||||
"READ",
|
||||
"WRITE",
|
||||
"HIHI",
|
||||
"HIGH",
|
||||
"LOLO",
|
||||
"LOW",
|
||||
"STATE",
|
||||
"COS",
|
||||
"COMM",
|
||||
"TIMEOUT",
|
||||
"HWLIMIT",
|
||||
"CALC",
|
||||
"SCAN",
|
||||
"LINK",
|
||||
"SOFT",
|
||||
"BAD_SUB",
|
||||
"UDF",
|
||||
"DISABLE",
|
||||
"SIMM",
|
||||
"READ_ACCESS",
|
||||
"WRITE_ACCESS"};
|
||||
|
||||
#endif
|
||||
145
src/dbStatic/dbBase.h
Normal file
145
src/dbStatic/dbBase.h
Normal file
@@ -0,0 +1,145 @@
|
||||
/* $Id$
|
||||
*
|
||||
* Current Author: Marty Kraimer
|
||||
* Date: 03-19-92
|
||||
*
|
||||
* 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:
|
||||
* -----------------
|
||||
* .01 03-19-92 mrk Original
|
||||
* .02 05-18-92 rcz New database access
|
||||
* .03 09-21-92 rcz removed #include <dbPvd.h>
|
||||
*/
|
||||
|
||||
#ifndef INCdbBaseh
|
||||
#define INCdbBaseh 1
|
||||
|
||||
#include <dbFldTypes.h>
|
||||
#include <ellLib.h>
|
||||
#include <dbDefs.h>
|
||||
|
||||
typedef struct dbMenu {
|
||||
ELLNODE node;
|
||||
char *name;
|
||||
int nChoice;
|
||||
char **papChoiceName;
|
||||
char **papChoiceValue;
|
||||
}dbMenu;
|
||||
|
||||
typedef struct drvSup {
|
||||
ELLNODE node;
|
||||
char *name;
|
||||
struct drvet *pdrvet;
|
||||
}drvSup;
|
||||
|
||||
typedef struct devSup {
|
||||
ELLNODE node;
|
||||
char *name;
|
||||
char *choice;
|
||||
int link_type;
|
||||
/*Following only available on run time system*/
|
||||
struct dset *pdset;
|
||||
}devSup;
|
||||
|
||||
typedef struct dbDeviceMenu {
|
||||
int nChoice;
|
||||
char **papChoice;
|
||||
}dbDeviceMenu;
|
||||
|
||||
/* conversion types*/
|
||||
typedef enum {CT_DECIMAL,CT_HEX} ctType;
|
||||
/* access level types */
|
||||
typedef enum {ASL0,ASL1} asLevel;
|
||||
|
||||
/*Breakpoint Tables */
|
||||
typedef struct brkInt{ /* breakpoint interval */
|
||||
float raw; /*raw value for beginning of interval */
|
||||
float slope; /*slope for interval */
|
||||
float eng; /*converted value for beginning of interval*/
|
||||
}brkInt;
|
||||
|
||||
typedef struct brkTable { /* breakpoint table */
|
||||
ELLNODE node;
|
||||
char *name; /*breakpoint table name */
|
||||
long number; /*number of brkInt in this table*/
|
||||
struct brkInt **papBrkInt; /* ptr to array of ptr to brkInt */
|
||||
}brkTable;
|
||||
|
||||
typedef struct dbFldDes{ /* field description */
|
||||
char *prompt; /*Prompt string for DCT*/
|
||||
char *name; /*Field name*/
|
||||
char *extra; /*C def for DBF_NOACCESS*/
|
||||
struct dbRecDes *pdbRecDes;
|
||||
short indRecDes; /*within dbRecDes.papFldDes */
|
||||
short special; /*Special processing requirements */
|
||||
dbfType field_type; /*Field type as defined in dbFldTypes.h */
|
||||
short process_passive;/*should dbPutField process passive */
|
||||
ctType base; /*base for integer to string conversions*/
|
||||
short promptgroup; /*prompt, i.e. gui group */
|
||||
short interest; /*interest level */
|
||||
asLevel as_level; /*access security level */
|
||||
char *initial; /*initial value */
|
||||
/*If (DBF_MENU,DBF_DEVICE) ftPvt is (pdbMenu,pdbDeviceMenu) */
|
||||
void *ftPvt;
|
||||
/*On no runtime following only set for STRING */
|
||||
short size; /*length in bytes of a field element */
|
||||
/*The following are only available on run time system*/
|
||||
short offset; /*Offset in bytes from beginning of record*/
|
||||
}dbFldDes;
|
||||
|
||||
typedef struct dbRecordNode {
|
||||
ELLNODE node;
|
||||
void *precord;
|
||||
char *recordname;
|
||||
}dbRecordNode;
|
||||
|
||||
typedef struct dbRecDes {
|
||||
ELLNODE node;
|
||||
ELLLIST recList; /*LIST head of sorted dbRecordNodes*/
|
||||
ELLLIST devList; /*List of associated device support*/
|
||||
char *name;
|
||||
short no_fields; /* number of fields defined */
|
||||
short no_prompt; /* number of fields to configure*/
|
||||
short no_links; /* number of links */
|
||||
short *link_ind; /* addr of array of ind in papFldDes*/
|
||||
char **papsortFldName;/* ptr to array of ptr to fld names*/
|
||||
short *sortFldInd; /* addr of array of ind in papFldDes*/
|
||||
dbFldDes *pvalFldDes; /*pointer dbFldDes for VAL field*/
|
||||
short indvalFlddes; /*ind in apFldDes*/
|
||||
dbFldDes **papFldDes; /* ptr to array of ptr to fldDes*/
|
||||
/*The following are only available on run time system*/
|
||||
struct rset *prset;
|
||||
int rec_size; /*record size in bytes */
|
||||
}dbRecDes;
|
||||
|
||||
typedef struct dbBase {
|
||||
ELLLIST menuList;
|
||||
ELLLIST recDesList;
|
||||
ELLLIST drvList;
|
||||
ELLLIST bptList; /*Break Point Table Head*/
|
||||
void *pathPvt;
|
||||
void *ppvd; /* pointer to process variable directory*/
|
||||
void *pgpHash; /*General purpose Hash Table*/
|
||||
short ignoreMissingMenus;
|
||||
}dbBase;
|
||||
#endif
|
||||
@@ -1,4 +1,4 @@
|
||||
/* dbAsciiExpand.c */
|
||||
/* dbExpandInclude.c */
|
||||
/* Author: Marty Kraimer Date: 30NOV95 */
|
||||
/*****************************************************************
|
||||
COPYRIGHT NOTIFICATION
|
||||
@@ -30,22 +30,39 @@ DBBASE *pdbbase = NULL;
|
||||
|
||||
int main(int argc,char **argv)
|
||||
{
|
||||
int arg,strip;
|
||||
char *path=0;
|
||||
long status;
|
||||
int i;
|
||||
|
||||
/*Look for path, i.e. -I path or -Ipath*/
|
||||
for(arg=1; arg<argc; arg++) {
|
||||
if(strncmp(argv[arg],"-I",2)!=0) continue;
|
||||
if(strlen(argv[arg])==2) {
|
||||
path = argv[arg+1];
|
||||
strip = 2;
|
||||
} else {
|
||||
path = argv[arg] + 2;
|
||||
strip = 1;
|
||||
}
|
||||
argc -= strip;
|
||||
for(i=arg; i<argc; i++) argv[i] = argv[i + strip];
|
||||
break;
|
||||
}
|
||||
if(argc<2) {
|
||||
printf("usage: dbAsciiExpand file1.ascii fi;e2.ascii ...\n");
|
||||
printf("usage: dbExpandInclude -Ipath file1.db file2.db ...\n");
|
||||
exit(0);
|
||||
}
|
||||
for(i=1; i<argc; i++) {
|
||||
status = dbAsciiRead(&pdbbase,argv[i]);
|
||||
status = dbReadDatabase(&pdbbase,argv[i],path);
|
||||
if(!status) continue;
|
||||
epicsPrintf("For input file %s",argv[i]);
|
||||
errMessage(status,"from dbAsciiInitialize");
|
||||
fprintf(stderr,"For input file %s",argv[i]);
|
||||
errMessage(status,"from dbReadDatabase");
|
||||
}
|
||||
dbWriteMenu(pdbbase,0);
|
||||
dbWriteRecDes(pdbbase,0);
|
||||
dbWriteDevice(pdbbase);
|
||||
dbWriteDriver(pdbbase);
|
||||
dbWriteMenuFP(pdbbase,stdout,0);
|
||||
dbWriteRecDesFP(pdbbase,stdout,0);
|
||||
dbWriteDeviceFP(pdbbase,stdout);
|
||||
dbWriteDriverFP(pdbbase,stdout);
|
||||
dbWriteRecordFP(pdbbase,stdout,0,0);
|
||||
return(0);
|
||||
}
|
||||
@@ -3,7 +3,7 @@ string [a-zA-Z0-9_\,\./\*#\[\]%: ;!|\'\-&\(\)@\?\+<>=\$\t]
|
||||
|
||||
%{
|
||||
#undef YY_INPUT
|
||||
#define YY_INPUT(b,r,ms) (r=(*dbAscii_yyinput)(b,ms))
|
||||
#define YY_INPUT(b,r,ms) (r=(*db_yyinput)(b,ms))
|
||||
|
||||
static int yyreset(void)
|
||||
{
|
||||
@@ -17,6 +17,7 @@ static int yyreset(void)
|
||||
|
||||
"include" {return(tokenINCLUDE);}
|
||||
"path" {return(tokenPATH);}
|
||||
"addpath" {return(tokenADDPATH);}
|
||||
"menu" {return(tokenMENU);}
|
||||
"choice" {return(tokenCHOICE);}
|
||||
"recordtype" {return(tokenRECORDTYPE);}
|
||||
@@ -1,4 +1,4 @@
|
||||
/* dbAsciiRoutines.c */
|
||||
/* dbLexRoutines.c */
|
||||
/* Author: Marty Kraimer Date: 13JUL95*/
|
||||
/*****************************************************************
|
||||
COPYRIGHT NOTIFICATION
|
||||
@@ -45,33 +45,33 @@ static void yyerrorAbort(char *str);
|
||||
static void allocTemp(void *pvoid);
|
||||
static void *popFirstTemp(void);
|
||||
static void *getLastTemp(void);
|
||||
static int dbAscii_yyinput(char *buf,int max_size);
|
||||
static void dbAsciiIncludePrint(FILE *fp);
|
||||
static void dbAsciiPath(char *path);
|
||||
static void dbAsciiIncludeNew(char *include_file);
|
||||
static void dbAsciiMenuHead(char *name);
|
||||
static void dbAsciiMenuChoice(char *name,char *value);
|
||||
static void dbAsciiMenuBody(void);
|
||||
static int db_yyinput(char *buf,int max_size);
|
||||
static void dbIncludePrint(FILE *fp);
|
||||
static void dbPathCmd(char *path);
|
||||
static void dbAddPathCmd(char *path);
|
||||
static void dbIncludeNew(char *include_file);
|
||||
static void dbMenuHead(char *name);
|
||||
static void dbMenuChoice(char *name,char *value);
|
||||
static void dbMenuBody(void);
|
||||
|
||||
static void dbAsciiRecordtypeHead(char *name);
|
||||
static void dbAsciiRecordtypeBody(void);
|
||||
static void dbAsciiRecordtypeFieldHead(char *name,char *type);
|
||||
static void dbAsciiRecordtypeFieldItem(char *name,char *value);
|
||||
static void dbRecordtypeHead(char *name);
|
||||
static void dbRecordtypeBody(void);
|
||||
static void dbRecordtypeFieldHead(char *name,char *type);
|
||||
static void dbRecordtypeFieldItem(char *name,char *value);
|
||||
|
||||
static void dbAsciiDevice(char *recordtype,char *linktype,
|
||||
static void dbDevice(char *recordtype,char *linktype,
|
||||
char *dsetname,char *choicestring);
|
||||
static void dbAsciiDriver(char *name);
|
||||
static void dbDriver(char *name);
|
||||
|
||||
static void dbAsciiBreakHead(char *name);
|
||||
static void dbAsciiBreakItem(char *value);
|
||||
static void dbAsciiBreakBody(void);
|
||||
static void dbBreakHead(char *name);
|
||||
static void dbBreakItem(char *value);
|
||||
static void dbBreakBody(void);
|
||||
|
||||
static void dbAsciiRecordHead(char *rectype,char*name);
|
||||
static void dbAsciiRecordField(char *name,char *value);
|
||||
static void dbAsciiRecordBody(void);
|
||||
static void dbRecordHead(char *rectype,char*name);
|
||||
static void dbRecordField(char *name,char *value);
|
||||
static void dbRecordBody(void);
|
||||
|
||||
/*private declarations*/
|
||||
static int firstTime = TRUE;
|
||||
#define MY_BUFFER_SIZE 1024
|
||||
static char *my_buffer=NULL;
|
||||
static char *my_buffer_ptr=NULL;
|
||||
@@ -132,52 +132,84 @@ static void *getLastTemp(void)
|
||||
return(ptempListNode->item);
|
||||
}
|
||||
|
||||
static long dbAsciiReadCOM(DBBASE **ppdbbase,const char *filename, FILE *fp)
|
||||
static char *dbOpenFile(DBBASE *pdbbase,const char *filename,FILE **fp)
|
||||
{
|
||||
ELLLIST *ppathList = (ELLLIST *)pdbbase->pathPvt;
|
||||
dbPathNode *pdbPathNode;
|
||||
char *fullfilename;
|
||||
|
||||
*fp = 0;
|
||||
if(!filename) return(0);
|
||||
if(!ppathList
|
||||
|| (ellCount(ppathList)==0)
|
||||
|| filename[0]=='/'
|
||||
|| (filename[0]=='.' && (filename[1]=='.' || filename[1]=='/')) ) {
|
||||
*fp = fopen(filename,"r");
|
||||
return(0);
|
||||
}
|
||||
pdbPathNode = (dbPathNode *)ellFirst(ppathList);
|
||||
while(pdbPathNode) {
|
||||
fullfilename = dbCalloc(strlen(filename)+strlen(pdbPathNode->directory)
|
||||
+2,sizeof(char));
|
||||
strcpy(fullfilename,pdbPathNode->directory);
|
||||
strcat(fullfilename,"/");
|
||||
strcat(fullfilename,filename);
|
||||
*fp = fopen(fullfilename,"r");
|
||||
free((void *)fullfilename);
|
||||
if(*fp) return(pdbPathNode->directory);
|
||||
pdbPathNode = (dbPathNode *)ellNext(&pdbPathNode->node);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long dbReadCOM(DBBASE **ppdbbase,const char *filename, FILE *fp,
|
||||
const char *path)
|
||||
{
|
||||
long status;
|
||||
inputFile *pinputFile;
|
||||
char *penv;
|
||||
|
||||
if(*ppdbbase == 0) *ppdbbase = dbAllocBase();
|
||||
pdbbase = *ppdbbase;
|
||||
if(path) {
|
||||
dbPath(pdbbase,path);
|
||||
} else {
|
||||
penv = getenv("EPICS_DB_INCLUDE_PATH");
|
||||
if(penv) {
|
||||
dbPath(pdbbase,penv);
|
||||
} else {
|
||||
dbPath(pdbbase,".");
|
||||
}
|
||||
}
|
||||
my_buffer = dbCalloc(MY_BUFFER_SIZE,sizeof(char));
|
||||
if(firstTime) {
|
||||
ellInit(&inputFileList);
|
||||
ellInit(&tempList);
|
||||
freeListInitPvt(&freeListPvt,sizeof(tempListNode),5);
|
||||
firstTime = FALSE;
|
||||
}
|
||||
pinputFile = (inputFile *)ellLast(&inputFileList);
|
||||
while(pinputFile) {
|
||||
fclose(pinputFile->fp);
|
||||
free((void *)pinputFile->filename);
|
||||
free((void *)pinputFile->path);
|
||||
ellDelete(&inputFileList,(ELLNODE *)pinputFile);
|
||||
free((void *)pinputFile);
|
||||
pinputFile = (inputFile *)ellLast(&inputFileList);
|
||||
}
|
||||
ellInit(&inputFileList);
|
||||
ellInit(&tempList);
|
||||
freeListInitPvt(&freeListPvt,sizeof(tempListNode),5);
|
||||
pinputFile = dbCalloc(1,sizeof(inputFile));
|
||||
if(filename) {
|
||||
pinputFile->filename = dbCalloc(strlen(filename)+1,sizeof(char));
|
||||
strcpy(pinputFile->filename,filename);
|
||||
}
|
||||
if(!fp) {
|
||||
if(!filename || !(fp = fopen(filename,"r"))) {
|
||||
FILE *fp;
|
||||
|
||||
if(filename) pinputFile->path = dbOpenFile(pdbbase,filename,&fp);
|
||||
if(!filename || !fp) {
|
||||
errPrintf(0,__FILE__, __LINE__,
|
||||
"dbAsciiRead opening file %s\n",filename);
|
||||
free((void *)pinputFile);
|
||||
"dbRead opening file %s",filename);
|
||||
free((void *)my_buffer);
|
||||
freeListCleanup(freeListPvt);
|
||||
free((void *)pinputFile);
|
||||
return(-1);
|
||||
}
|
||||
pinputFile->fp = fp;
|
||||
} else {
|
||||
pinputFile->fp = fp;
|
||||
}
|
||||
pinputFile->fp = fp;
|
||||
pinputFile->line_num = 0;
|
||||
pinputFileNow = pinputFile;
|
||||
my_buffer[0] = '\0';
|
||||
my_buffer_ptr = my_buffer;
|
||||
if(*ppdbbase) {
|
||||
pdbbase = *ppdbbase;
|
||||
} else {
|
||||
pdbbase = dbAllocBase();
|
||||
*ppdbbase = pdbbase;
|
||||
}
|
||||
ellAdd(&inputFileList,&pinputFile->node);
|
||||
status = pvt_yy_parse();
|
||||
if(status) {
|
||||
@@ -185,28 +217,25 @@ static long dbAsciiReadCOM(DBBASE **ppdbbase,const char *filename, FILE *fp)
|
||||
}
|
||||
freeListCleanup(freeListPvt);
|
||||
free((void *)my_buffer);
|
||||
firstTime = TRUE;
|
||||
return(0);
|
||||
}
|
||||
|
||||
long dbAsciiRead(DBBASE **ppdbbase,const char *filename)
|
||||
{return (dbAsciiReadCOM(ppdbbase,filename,0));}
|
||||
long dbReadDatabase(DBBASE **ppdbbase,const char *filename,const char *path)
|
||||
{return (dbReadCOM(ppdbbase,filename,0,path));}
|
||||
|
||||
long dbAsciiReadFP(DBBASE **ppdbbase,FILE *fp)
|
||||
{return (dbAsciiReadCOM(ppdbbase,0,fp));}
|
||||
long dbReadDatabaseFP(DBBASE **ppdbbase,FILE *fp,const char *path)
|
||||
{return (dbReadCOM(ppdbbase,0,fp,path));}
|
||||
|
||||
static int dbAscii_yyinput(char *buf, int max_size)
|
||||
static int db_yyinput(char *buf, int max_size)
|
||||
{
|
||||
int l,n;
|
||||
|
||||
if(*my_buffer_ptr==0) {
|
||||
while(fgets(my_buffer,MY_BUFFER_SIZE,pinputFileNow->fp)==NULL) {
|
||||
|
||||
if(fclose(pinputFileNow->fp))
|
||||
errPrintf(0,__FILE__, __LINE__,
|
||||
"Closing file %s\n",pinputFileNow->filename);
|
||||
"Closing file %s",pinputFileNow->filename);
|
||||
free((void *)pinputFileNow->filename);
|
||||
free((void *)pinputFileNow->path);
|
||||
ellDelete(&inputFileList,(ELLNODE *)pinputFileNow);
|
||||
free((void *)pinputFileNow);
|
||||
pinputFileNow = (inputFile *)ellLast(&inputFileList);
|
||||
@@ -223,21 +252,21 @@ static int dbAscii_yyinput(char *buf, int max_size)
|
||||
return(n);
|
||||
}
|
||||
|
||||
static void dbAsciiIncludePrint(FILE *fp)
|
||||
static void dbIncludePrint(FILE *fp)
|
||||
{
|
||||
inputFile *pinputFile = pinputFileNow;
|
||||
|
||||
fprintf(fp,"input line: %s",my_buffer);
|
||||
while(pinputFile) {
|
||||
if(pinputFile->filename) {
|
||||
fprintf(fp," in file: ");
|
||||
fprintf(fp," in:");
|
||||
if(pinputFile->path)
|
||||
fprintf(fp," path \"%s\"",pinputFile->path);
|
||||
fprintf(fp,"%s",pinputFile->filename);
|
||||
fprintf(fp," path \"%s\" ",pinputFile->path);
|
||||
fprintf(fp," file %s",pinputFile->filename);
|
||||
} else {
|
||||
fprintf(fp," stdin:");
|
||||
fprintf(fp,"stdin:");
|
||||
if(pinputFile->path)
|
||||
fprintf(fp," path \"%s\"",pinputFile->path);
|
||||
fprintf(fp," path \"%s\" ",pinputFile->path);
|
||||
}
|
||||
fprintf(fp," line %d\n",pinputFile->line_num);
|
||||
pinputFile = (inputFile *)ellPrevious(&pinputFile->node);
|
||||
@@ -246,104 +275,59 @@ static void dbAsciiIncludePrint(FILE *fp)
|
||||
return;
|
||||
}
|
||||
|
||||
static void dbAsciiPath(char *path)
|
||||
static void dbPathCmd(char *path)
|
||||
{
|
||||
pinputFileNow->path = path;
|
||||
dbPath(pdbbase,path);
|
||||
free((void *)path);
|
||||
}
|
||||
|
||||
static void dbAddPathCmd(char *path)
|
||||
{
|
||||
dbAddPath(pdbbase,path);
|
||||
free((void *)path);
|
||||
}
|
||||
|
||||
static void dbAsciiIncludeNew(char *filename)
|
||||
static void dbIncludeNew(char *filename)
|
||||
{
|
||||
inputFile *newfile;
|
||||
inputFile *pinputFile;
|
||||
inputFile *pinputFileFirst;
|
||||
FILE *fp;
|
||||
char *currentPath;
|
||||
char *newCurrentPath;
|
||||
int lenPathAndFilename = 0;
|
||||
int lenstr;
|
||||
|
||||
newfile = dbCalloc(1,sizeof(inputFile));
|
||||
newfile->filename = dbCalloc(strlen(filename)+1,sizeof(char));
|
||||
strcpy(newfile->filename,filename);
|
||||
/*search backward for first path starting with / */
|
||||
pinputFile = (inputFile *)ellLast(&inputFileList);
|
||||
while(pinputFile) {
|
||||
if(pinputFile->path) {
|
||||
if(pinputFile->path[0]=='/') break;
|
||||
}
|
||||
pinputFile = (inputFile *)ellPrevious(&pinputFile->node);
|
||||
}
|
||||
if(!pinputFile) pinputFile=(inputFile *)ellFirst(&inputFileList);
|
||||
pinputFileFirst = pinputFile;
|
||||
while(pinputFile) {
|
||||
if(pinputFile->path) {
|
||||
lenstr = strlen(pinputFile->path);
|
||||
lenPathAndFilename += lenstr;
|
||||
if(pinputFile->path[lenstr-1] != '/') lenPathAndFilename++;
|
||||
}
|
||||
pinputFile = (inputFile *)ellNext(&pinputFile->node);
|
||||
}
|
||||
lenPathAndFilename += strlen(filename) + 1;
|
||||
currentPath = dbCalloc(lenPathAndFilename,sizeof(char));
|
||||
pinputFile = pinputFileFirst;
|
||||
while(pinputFile) {
|
||||
if(pinputFile->path) {
|
||||
strcat(currentPath,pinputFile->path);
|
||||
lenstr = strlen(pinputFile->path);
|
||||
if(pinputFile->path[lenstr-1] != '/') strcat(currentPath,"/");
|
||||
}
|
||||
pinputFile = (inputFile *)ellNext(&pinputFile->node);
|
||||
}
|
||||
strcat(currentPath,filename);
|
||||
fp = fopen(currentPath,"r");
|
||||
if(!fp) { /*Try preceeding path with ./rec */
|
||||
newCurrentPath = dbCalloc(
|
||||
(strlen("./rec/") + strlen(currentPath) + 1),sizeof(char));
|
||||
strcpy(newCurrentPath,"./rec/");
|
||||
strcat(newCurrentPath,currentPath);
|
||||
fp = fopen(newCurrentPath,"r");
|
||||
free((void *)newCurrentPath);
|
||||
}
|
||||
if(!fp) { /*Try preceeding path with ./base/rec */
|
||||
newCurrentPath = dbCalloc(
|
||||
(strlen("./base/rec/") + strlen(currentPath) + 1),sizeof(char));
|
||||
strcpy(newCurrentPath,"./base/rec/");
|
||||
strcat(newCurrentPath,currentPath);
|
||||
fp = fopen(newCurrentPath,"r");
|
||||
free((void *)newCurrentPath);
|
||||
}
|
||||
pinputFile = dbCalloc(1,sizeof(inputFile));
|
||||
pinputFile->path = dbOpenFile(pdbbase,filename,&fp);
|
||||
if(!fp) {
|
||||
errPrintf(0,__FILE__, __LINE__,
|
||||
"dbAsciiIncludeNew opening file %s\n",currentPath);
|
||||
"dbIncludeNew opening file %s",filename);
|
||||
yyerror(NULL);
|
||||
free((void *)filename);
|
||||
free((void *)newfile);
|
||||
free((void *)pinputFile);
|
||||
return;
|
||||
}
|
||||
free((void *)currentPath);
|
||||
pinputFile->filename = dbCalloc(strlen(filename)+1,sizeof(char));
|
||||
strcpy(pinputFile->filename,filename);
|
||||
free((void *)filename);
|
||||
newfile->fp = fp;
|
||||
ellAdd(&inputFileList,&newfile->node);
|
||||
pinputFileNow = newfile;
|
||||
pinputFile->fp = fp;
|
||||
ellAdd(&inputFileList,&pinputFile->node);
|
||||
pinputFileNow = pinputFile;
|
||||
}
|
||||
|
||||
static void dbAsciiMenuHead(char *name)
|
||||
static void dbMenuHead(char *name)
|
||||
{
|
||||
dbMenu *pdbMenu;
|
||||
GPHENTRY *pgphentry;
|
||||
|
||||
pgphentry = gphFind(pdbbase->pgpHash,name,&pdbbase->menuList);
|
||||
if(pgphentry) {
|
||||
yyerror("Duplicate menu ignored");
|
||||
duplicate = TRUE;
|
||||
free((void *)name);
|
||||
return;
|
||||
}
|
||||
pdbMenu = dbCalloc(1,sizeof(dbMenu));
|
||||
pdbMenu->name = name;
|
||||
if(ellCount(&tempList)) yyerrorAbort("dbAsciiMenuHead: tempList not empty");
|
||||
if(ellCount(&tempList)) yyerrorAbort("dbMenuHead: tempList not empty");
|
||||
allocTemp(pdbMenu);
|
||||
}
|
||||
|
||||
static void dbAsciiMenuChoice(char *name,char *value)
|
||||
static void dbMenuChoice(char *name,char *value)
|
||||
{
|
||||
if(duplicate) {
|
||||
free((void *)name);
|
||||
@@ -354,7 +338,7 @@ static void dbAsciiMenuChoice(char *name,char *value)
|
||||
allocTemp(value);
|
||||
}
|
||||
|
||||
static void dbAsciiMenuBody(void)
|
||||
static void dbMenuBody(void)
|
||||
{
|
||||
dbMenu *pnewMenu;
|
||||
dbMenu *pMenu;
|
||||
@@ -374,7 +358,7 @@ static void dbAsciiMenuBody(void)
|
||||
pnewMenu->papChoiceName[i] = (char *)popFirstTemp();
|
||||
pnewMenu->papChoiceValue[i] = (char *)popFirstTemp();
|
||||
}
|
||||
if(ellCount(&tempList)) yyerrorAbort("dbAsciiMenuBody: tempList not empty");
|
||||
if(ellCount(&tempList)) yyerrorAbort("dbMenuBody: tempList not empty");
|
||||
/* Add menu in sorted order */
|
||||
pMenu = (dbMenu *)ellFirst(&pdbbase->menuList);
|
||||
while(pMenu && strcmp(pMenu->name,pnewMenu->name) >0 )
|
||||
@@ -391,24 +375,25 @@ static void dbAsciiMenuBody(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void dbAsciiRecordtypeHead(char *name)
|
||||
static void dbRecordtypeHead(char *name)
|
||||
{
|
||||
dbRecDes *pdbRecDes;
|
||||
GPHENTRY *pgphentry;
|
||||
|
||||
pgphentry = gphFind(pdbbase->pgpHash,name,&pdbbase->recDesList);
|
||||
if(pgphentry) {
|
||||
yyerror("Duplicate recordtype ignored");
|
||||
duplicate = TRUE;
|
||||
free((void *)name);
|
||||
return;
|
||||
}
|
||||
pdbRecDes = dbCalloc(1,sizeof(dbRecDes));
|
||||
pdbRecDes->name = name;
|
||||
if(ellCount(&tempList))
|
||||
yyerrorAbort("dbAsciiRecordtypeHead tempList not empty");
|
||||
yyerrorAbort("dbRecordtypeHead tempList not empty");
|
||||
allocTemp(pdbRecDes);
|
||||
}
|
||||
|
||||
static void dbAsciiRecordtypeFieldHead(char *name,char *type)
|
||||
static void dbRecordtypeFieldHead(char *name,char *type)
|
||||
{
|
||||
dbFldDes *pdbFldDes;
|
||||
int i;
|
||||
@@ -433,7 +418,7 @@ static void dbAsciiRecordtypeFieldHead(char *name,char *type)
|
||||
yyerrorAbort("Illegal Field Type");
|
||||
}
|
||||
|
||||
static void dbAsciiRecordtypeFieldItem(char *name,char *value)
|
||||
static void dbRecordtypeFieldItem(char *name,char *value)
|
||||
{
|
||||
dbFldDes *pdbFldDes;
|
||||
|
||||
@@ -549,7 +534,7 @@ static void dbAsciiRecordtypeFieldItem(char *name,char *value)
|
||||
}
|
||||
}
|
||||
|
||||
static void dbAsciiRecordtypeBody(void)
|
||||
static void dbRecordtypeBody(void)
|
||||
{
|
||||
dbRecDes *pdbRecDes;
|
||||
dbFldDes *pdbFldDes;
|
||||
@@ -587,7 +572,7 @@ static void dbAsciiRecordtypeBody(void)
|
||||
fprintf(stderr,"recordtype(%s).%s extra not specified\n",
|
||||
pdbRecDes->name,pdbFldDes->name);
|
||||
}
|
||||
if(ellCount(&tempList)) yyerrorAbort("dbAsciiMenuBody: tempList not empty");
|
||||
if(ellCount(&tempList)) yyerrorAbort("dbMenuBody: tempList not empty");
|
||||
pdbRecDes->no_prompt = no_prompt;
|
||||
pdbRecDes->no_links = no_links;
|
||||
pdbRecDes->link_ind = dbCalloc(no_prompt,sizeof(short));
|
||||
@@ -632,7 +617,7 @@ static void dbAsciiRecordtypeBody(void)
|
||||
dbGetRecordtypeSizeOffset(pdbRecDes);
|
||||
}
|
||||
|
||||
static void dbAsciiDevice(char *recordtype,char *linktype,
|
||||
static void dbDevice(char *recordtype,char *linktype,
|
||||
char *dsetname,char *choicestring)
|
||||
{
|
||||
devSup *pdevSup;
|
||||
@@ -643,6 +628,10 @@ static void dbAsciiDevice(char *recordtype,char *linktype,
|
||||
pgphentry = gphFind(pdbbase->pgpHash,recordtype,&pdbbase->recDesList);
|
||||
if(!pgphentry) {
|
||||
yyerror(" record type not found");
|
||||
free((void *)recordtype);
|
||||
free((void *)linktype);
|
||||
free((void *)dsetname);
|
||||
free((void *)choicestring);
|
||||
return;
|
||||
}
|
||||
free(recordtype);
|
||||
@@ -661,7 +650,6 @@ static void dbAsciiDevice(char *recordtype,char *linktype,
|
||||
pdbRecDes = (dbRecDes *)pgphentry->userPvt;
|
||||
pgphentry = gphFind(pdbbase->pgpHash,choicestring,&pdbRecDes->devList);
|
||||
if(pgphentry) {
|
||||
yyerror("Duplicate Device Support ignored");
|
||||
free((void *)dsetname);
|
||||
free((void *)choicestring);
|
||||
return;
|
||||
@@ -678,15 +666,15 @@ static void dbAsciiDevice(char *recordtype,char *linktype,
|
||||
}
|
||||
ellAdd(&pdbRecDes->devList,&pdevSup->node);
|
||||
}
|
||||
|
||||
static void dbAsciiDriver(char *name)
|
||||
|
||||
static void dbDriver(char *name)
|
||||
{
|
||||
drvSup *pdrvSup;
|
||||
GPHENTRY *pgphentry;
|
||||
|
||||
pgphentry = gphFind(pdbbase->pgpHash,name,&pdbbase->drvList);
|
||||
if(pgphentry) {
|
||||
yyerror("Duplicate driver ignored");
|
||||
free((void *)name);
|
||||
return;
|
||||
}
|
||||
pdrvSup = dbCalloc(1,sizeof(drvSup));
|
||||
@@ -699,22 +687,23 @@ static void dbAsciiDriver(char *name)
|
||||
ellAdd(&pdbbase->drvList,&pdrvSup->node);
|
||||
}
|
||||
|
||||
static void dbAsciiBreakHead(char *name)
|
||||
static void dbBreakHead(char *name)
|
||||
{
|
||||
brkTable *pbrkTable;
|
||||
GPHENTRY *pgphentry;
|
||||
|
||||
pgphentry = gphFind(pdbbase->pgpHash,name,&pdbbase->bptList);
|
||||
if(pgphentry) {
|
||||
yyerror("Duplicate breakpoint table ignored");
|
||||
duplicate = TRUE;
|
||||
free((void *)name);
|
||||
return;
|
||||
}
|
||||
pbrkTable = dbCalloc(1,sizeof(brkTable));
|
||||
pbrkTable->name = name;
|
||||
if(ellCount(&tempList)) yyerrorAbort("dbAsciiBreakHead:tempList not empty"); allocTemp(pbrkTable);
|
||||
if(ellCount(&tempList)) yyerrorAbort("dbBreakHead:tempList not empty"); allocTemp(pbrkTable);
|
||||
}
|
||||
|
||||
static void dbAsciiBreakItem(char *value)
|
||||
static void dbBreakItem(char *value)
|
||||
{
|
||||
if(duplicate) {
|
||||
free((void *)value);
|
||||
@@ -722,8 +711,8 @@ static void dbAsciiBreakItem(char *value)
|
||||
}
|
||||
allocTemp(value);
|
||||
}
|
||||
|
||||
static void dbAsciiBreakBody(void)
|
||||
|
||||
static void dbBreakBody(void)
|
||||
{
|
||||
brkTable *pnewbrkTable;
|
||||
brkTable *pbrkTable;
|
||||
@@ -738,7 +727,7 @@ static void dbAsciiBreakBody(void)
|
||||
pnewbrkTable = (brkTable *)popFirstTemp();
|
||||
pnewbrkTable->number = number = ellCount(&tempList)/2;
|
||||
if(number*2 != ellCount(&tempList))
|
||||
yyerrorAbort("dbAsciiBreakBody: Odd number of values");
|
||||
yyerrorAbort("dbBreakBody: Odd number of values");
|
||||
pnewbrkTable->papBrkInt = dbCalloc(number,sizeof(brkInt));
|
||||
for(i=0; i<number; i++) {
|
||||
double raw,eng;
|
||||
@@ -748,7 +737,7 @@ static void dbAsciiBreakBody(void)
|
||||
praw = (char *)popFirstTemp();
|
||||
peng = (char *)popFirstTemp();
|
||||
if((sscanf(praw,"%lf",&raw)!=1) || (sscanf(peng,"%lf",&eng)!=1) ) {
|
||||
yyerrorAbort("dbAsciibrkTable: Illegal table value");
|
||||
yyerrorAbort("dbbrkTable: Illegal table value");
|
||||
}
|
||||
free((void *)praw);
|
||||
free((void *)peng);
|
||||
@@ -788,14 +777,14 @@ static void dbAsciiBreakBody(void)
|
||||
if(!pbrkTable) ellAdd(&pdbbase->bptList,&pnewbrkTable->node);
|
||||
}
|
||||
|
||||
static void dbAsciiRecordHead(char *rectype,char *name)
|
||||
static void dbRecordHead(char *rectype,char *name)
|
||||
{
|
||||
DBENTRY *pdbentry;
|
||||
long status;
|
||||
|
||||
pdbentry = dbAllocEntry(pdbbase);
|
||||
if(ellCount(&tempList))
|
||||
yyerrorAbort("dbAsciiRecordHead: tempList not empty");
|
||||
yyerrorAbort("dbRecordHead: tempList not empty");
|
||||
allocTemp(pdbentry);
|
||||
status = dbFindRecdes(pdbentry,rectype);
|
||||
if(status) {
|
||||
@@ -805,9 +794,11 @@ static void dbAsciiRecordHead(char *rectype,char *name)
|
||||
}
|
||||
/*Duplicate records ok. Thus dont check return status.*/
|
||||
dbCreateRecord(pdbentry,name);
|
||||
free((void *)rectype);
|
||||
free((void *)name);
|
||||
}
|
||||
|
||||
static void dbAsciiRecordField(char *name,char *value)
|
||||
static void dbRecordField(char *name,char *value)
|
||||
{
|
||||
DBENTRY *pdbentry;
|
||||
tempListNode *ptempListNode;
|
||||
@@ -827,14 +818,16 @@ static void dbAsciiRecordField(char *name,char *value)
|
||||
yyerror(NULL);
|
||||
return;
|
||||
}
|
||||
free((void *)name);
|
||||
free((void *)value);
|
||||
}
|
||||
|
||||
static void dbAsciiRecordBody(void)
|
||||
static void dbRecordBody(void)
|
||||
{
|
||||
DBENTRY *pdbentry;
|
||||
|
||||
pdbentry = (DBENTRY *)popFirstTemp();
|
||||
if(ellCount(&tempList))
|
||||
yyerrorAbort("dbAsciiRecordBody: tempList not empty");
|
||||
yyerrorAbort("dbRecordBody: tempList not empty");
|
||||
dbFreeEntry(pdbentry);
|
||||
}
|
||||
@@ -84,7 +84,7 @@ static unsigned short hash( char *pname, int length)
|
||||
return((ind1<<dbPvdHashTableShift) ^ ind0);
|
||||
}
|
||||
|
||||
int dbPvdTableSize(DBBASE *pdbbase,int size)
|
||||
int dbPvdTableSize(int size)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* asciiTest.c */
|
||||
/* dbReadTest.c */
|
||||
/* Author: Marty Kraimer Date: 13JUL95 */
|
||||
/*****************************************************************
|
||||
COPYRIGHT NOTIFICATION
|
||||
@@ -32,16 +32,32 @@ int main(int argc,char **argv)
|
||||
{
|
||||
long status;
|
||||
int i;
|
||||
int arg,strip;
|
||||
char *path=0;
|
||||
|
||||
/*Look for path, i.e. -I path or -Ipath*/
|
||||
for(arg=1; arg<argc; arg++) {
|
||||
if(strncmp(argv[arg],"-I",2)!=0) continue;
|
||||
if(strlen(argv[arg])==2) {
|
||||
path = argv[arg+1];
|
||||
strip = 2;
|
||||
} else {
|
||||
path = argv[arg] + 2;
|
||||
strip = 1;
|
||||
}
|
||||
argc -= strip;
|
||||
for(i=arg; i<argc; i++) argv[i] = argv[i + strip];
|
||||
break;
|
||||
}
|
||||
if(argc<2) {
|
||||
printf("usage: dbAsciiTest file1.ascii fi;e2.ascii ...\n");
|
||||
printf("usage: dbReadTest file1.db file2.db ...\n");
|
||||
exit(0);
|
||||
}
|
||||
for(i=1; i<argc; i++) {
|
||||
status = dbAsciiRead(&pdbbase,argv[i]);
|
||||
status = dbReadDatabase(&pdbbase,argv[i],path);
|
||||
if(!status) continue;
|
||||
epicsPrintf("For input file %s",argv[i]);
|
||||
errMessage(status,"from dbAsciiInitialize");
|
||||
fprintf(stderr,"For input file %s",argv[i]);
|
||||
errMessage(status,"from dbReadDatabase");
|
||||
}
|
||||
/*
|
||||
dbDumpRecDes(pdbbase,"ai");
|
||||
@@ -49,7 +65,7 @@ int main(int argc,char **argv)
|
||||
dbPvdDump(pdbbase);
|
||||
gphDump(pdbbase->pgpHash);
|
||||
dbDumpMenu(pdbbase,NULL);
|
||||
dbDumpRecords(pdbbase,NULL,0);
|
||||
dbDumpRecord(pdbbase,NULL,0);
|
||||
*/
|
||||
dbFreeBase(pdbbase);
|
||||
return(0);
|
||||
@@ -45,7 +45,6 @@ of this distribution.
|
||||
#include <dbStaticPvt.h>
|
||||
#include <devSup.h>
|
||||
#include <drvSup.h>
|
||||
#include <cvtTable.h>
|
||||
#include <special.h>
|
||||
#include <gpHash.h>
|
||||
#include <guigroup.h>
|
||||
@@ -134,6 +133,23 @@ static char **promptAddr[VXI_IO+1];
|
||||
static int formlines[VXI_IO+1];
|
||||
|
||||
/* internal routines*/
|
||||
static void dbFreePath(DBBASE *pdbbase) {
|
||||
ELLLIST *ppathList;
|
||||
dbPathNode *pdbPathNode;
|
||||
|
||||
if(!pdbbase) return;
|
||||
ppathList = (ELLLIST *)pdbbase->pathPvt;
|
||||
if(!ppathList) return;
|
||||
while(pdbPathNode = (dbPathNode *)ellFirst(ppathList)) {
|
||||
ellDelete(ppathList,&pdbPathNode->node);
|
||||
free((void *)pdbPathNode->directory);
|
||||
free((void *)pdbPathNode);
|
||||
}
|
||||
free((void *)ppathList);
|
||||
pdbbase->pathPvt = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
static void initForms(void)
|
||||
{
|
||||
static int firstTime=TRUE;
|
||||
@@ -298,7 +314,7 @@ void dbFreeBase(dbBase *pdbbase)
|
||||
pdbRecordNode = (dbRecordNode *)ellFirst(&pdbRecDes->recList);
|
||||
while(pdbRecordNode) {
|
||||
pdbRecordNodeNext = (dbRecordNode *)ellNext(&pdbRecordNode->node);
|
||||
if(dbFindRecord(&dbentry,pdbRecordNode->recordname))
|
||||
if(!dbFindRecord(&dbentry,pdbRecordNode->recordname))
|
||||
dbDeleteRecord(&dbentry);
|
||||
pdbRecordNode = pdbRecordNodeNext;
|
||||
}
|
||||
@@ -379,6 +395,7 @@ void dbFreeBase(dbBase *pdbbase)
|
||||
}
|
||||
gphFreeMem(pdbbase->pgpHash);
|
||||
dbPvdFreeMem(pdbbase);
|
||||
dbFreePath(pdbbase);
|
||||
free((void *)pdbbase);
|
||||
return;
|
||||
}
|
||||
@@ -423,15 +440,68 @@ DBENTRY *dbCopyEntry(DBENTRY *pdbentry)
|
||||
|
||||
long dbRead(DBBASE *pdbbase,FILE *fp)
|
||||
{
|
||||
return(dbAsciiReadFP(&pdbbase,fp));
|
||||
return(dbReadDatabaseFP(&pdbbase,fp,0));
|
||||
}
|
||||
long dbWrite(DBBASE *pdbbase,FILE *fpdctsdr,FILE *fp)
|
||||
{
|
||||
epicsPrintf("dbWrite obsolete. It does NOTHING\n");
|
||||
fprintf(stderr,"dbWrite obsolete. It does NOTHING\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
long dbPath(DBBASE *pdbbase,const char *path)
|
||||
{
|
||||
if(!pdbbase) return(-1);
|
||||
dbFreePath(pdbbase);
|
||||
return(dbAddPath(pdbbase,path));
|
||||
}
|
||||
|
||||
long dbWriteRecords(DBBASE *pdbbase,FILE *fp,char *precdesname,int level)
|
||||
long dbAddPath(DBBASE *pdbbase,const char *path)
|
||||
{
|
||||
ELLLIST *ppathList;
|
||||
dbPathNode *pdbPathNode;
|
||||
const char *pcolon;
|
||||
const char *pdir;
|
||||
int len;
|
||||
|
||||
if(!pdbbase) return(-1);
|
||||
ppathList = (ELLLIST *)pdbbase->pathPvt;
|
||||
if(!ppathList) {
|
||||
ppathList= dbCalloc(1,sizeof(ELLLIST));
|
||||
ellInit(ppathList);
|
||||
pdbbase->pathPvt = (void *)ppathList;
|
||||
}
|
||||
pdir = path;
|
||||
while(pdir) {
|
||||
if(*pdir == ':') {
|
||||
pdir++;
|
||||
continue;
|
||||
}
|
||||
pdbPathNode = (dbPathNode *)dbCalloc(1,sizeof(dbPathNode));
|
||||
ellAdd(ppathList,&pdbPathNode->node);
|
||||
pcolon = strchr(pdir,':');
|
||||
len = (pcolon ? (pcolon - pdir) : strlen(pdir));
|
||||
pdbPathNode->directory = (char *)dbCalloc(1,len + 1);
|
||||
strncpy(pdbPathNode->directory,pdir,len);
|
||||
pdir = (pcolon ? (pcolon+1) : 0);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
long dbWriteRecord(DBBASE *ppdbbase,const char *filename,
|
||||
char *precdesname,int level)
|
||||
{
|
||||
FILE *outFile;
|
||||
|
||||
outFile = fopen(filename,"w");
|
||||
if(!outFile) {
|
||||
errPrintf(0,__FILE__,__LINE__,"Error opening %s\n",filename);
|
||||
return(-1);
|
||||
}
|
||||
dbWriteRecordFP(ppdbbase,outFile,precdesname,level);
|
||||
return(fclose(outFile));
|
||||
}
|
||||
|
||||
long dbWriteRecordFP(DBBASE *pdbbase,FILE *fp,char *precdesname,int level)
|
||||
{
|
||||
DBENTRY dbentry;
|
||||
DBENTRY *pdbentry=&dbentry;
|
||||
@@ -440,18 +510,24 @@ long dbWriteRecords(DBBASE *pdbbase,FILE *fp,char *precdesname,int level)
|
||||
|
||||
dctonly = ((level>1) ? FALSE : TRUE);
|
||||
dbInitEntry(pdbbase,pdbentry);
|
||||
if(!precdesname)
|
||||
if(!precdesname) {
|
||||
status = dbFirstRecdes(pdbentry);
|
||||
else
|
||||
if(status) {
|
||||
fprintf(stderr,"dbWriteRecordFP: No record descriptions\n");
|
||||
return(status);
|
||||
}
|
||||
} else {
|
||||
status = dbFindRecdes(pdbentry,precdesname);
|
||||
if(status) {
|
||||
fprintf(stderr,"No record description\n");
|
||||
return(status);
|
||||
if(status) {
|
||||
fprintf(stderr,"dbWriteRecordFP: No record description for %s\n",
|
||||
precdesname);
|
||||
return(status);
|
||||
}
|
||||
}
|
||||
while(!status) {
|
||||
status = dbFirstRecord(pdbentry);
|
||||
while(!status) {
|
||||
fprintf(fp,"record(%s,%s) {\n",
|
||||
fprintf(fp,"record(%s,\"%s\") {\n",
|
||||
dbGetRecdesName(pdbentry),dbGetRecordName(pdbentry));
|
||||
status = dbFirstFielddes(pdbentry,dctonly);
|
||||
while(!status) {
|
||||
@@ -471,15 +547,31 @@ long dbWriteRecords(DBBASE *pdbbase,FILE *fp,char *precdesname,int level)
|
||||
return(0);
|
||||
}
|
||||
|
||||
void dbWriteMenu(DBBASE *pdbbase,char *menuName)
|
||||
long dbWriteMenu(DBBASE *ppdbbase,const char *filename,char *menuName)
|
||||
{
|
||||
FILE *outFile;
|
||||
|
||||
outFile = fopen(filename,"w");
|
||||
if(!outFile) {
|
||||
errPrintf(0,__FILE__,__LINE__,"Error opening %s\n",filename);
|
||||
return(-1);
|
||||
}
|
||||
dbWriteMenuFP(ppdbbase,outFile,menuName);
|
||||
if(fclose(outFile)) {
|
||||
errPrintf(0,__FILE__,__LINE__,"Error closing %s\n",filename);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
long dbWriteMenuFP(DBBASE *pdbbase,FILE *fp,char *menuName)
|
||||
{
|
||||
dbMenu *pdbMenu;
|
||||
int gotMatch;
|
||||
int i;
|
||||
|
||||
if(!pdbbase) {
|
||||
printf("pdbbase not specified\n");
|
||||
return;
|
||||
fprintf(stderr,"pdbbase not specified\n");
|
||||
return(-1);
|
||||
}
|
||||
pdbMenu = (dbMenu *)ellFirst(&pdbbase->menuList);
|
||||
while(pdbMenu) {
|
||||
@@ -489,19 +581,36 @@ void dbWriteMenu(DBBASE *pdbbase,char *menuName)
|
||||
gotMatch=TRUE;
|
||||
}
|
||||
if(gotMatch) {
|
||||
fprintf(stdout,"menu(%s) {\n",pdbMenu->name);
|
||||
fprintf(fp,"menu(%s) {\n",pdbMenu->name);
|
||||
for(i=0; i<pdbMenu->nChoice; i++) {
|
||||
fprintf(stdout,"\tchoice(%s,\"%s\")\n",pdbMenu->papChoiceName[i],
|
||||
fprintf(fp,"\tchoice(%s,\"%s\")\n",pdbMenu->papChoiceName[i],
|
||||
pdbMenu->papChoiceValue[i]);
|
||||
}
|
||||
fprintf(stdout,"}\n");
|
||||
fprintf(fp,"}\n");
|
||||
if(menuName) break;
|
||||
}
|
||||
pdbMenu = (dbMenu *)ellNext(&pdbMenu->node);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
void dbWriteRecDes(DBBASE *pdbbase,char *recdesName)
|
||||
long dbWriteRecDes(DBBASE *pdbbase,const char *filename,char *recdesName)
|
||||
{
|
||||
FILE *outFile;
|
||||
|
||||
outFile = fopen(filename,"w");
|
||||
if(!outFile) {
|
||||
errPrintf(0,__FILE__,__LINE__,"Error opening %s\n",filename);
|
||||
return(-1);
|
||||
}
|
||||
dbWriteRecDesFP(pdbbase,outFile,recdesName);
|
||||
if(fclose(outFile)) {
|
||||
errPrintf(0,__FILE__,__LINE__,"Error closing %s\n",filename);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
long dbWriteRecDesFP(DBBASE *pdbbase,FILE *fp,char *recdesName)
|
||||
{
|
||||
dbRecDes *pdbRecDes;
|
||||
dbFldDes *pdbFldDes;
|
||||
@@ -509,8 +618,8 @@ void dbWriteRecDes(DBBASE *pdbbase,char *recdesName)
|
||||
int i;
|
||||
|
||||
if(!pdbbase) {
|
||||
printf("pdbbase not specified\n");
|
||||
return;
|
||||
fprintf(stderr,"pdbbase not specified\n");
|
||||
return(-1);
|
||||
}
|
||||
for(pdbRecDes = (dbRecDes *)ellFirst(&pdbbase->recDesList);
|
||||
pdbRecDes; pdbRecDes = (dbRecDes *)ellNext(&pdbRecDes->node)) {
|
||||
@@ -520,27 +629,28 @@ void dbWriteRecDes(DBBASE *pdbbase,char *recdesName)
|
||||
gotMatch=TRUE;
|
||||
}
|
||||
if(!gotMatch) continue;
|
||||
fprintf(stdout,"recordtype(%s) {\n",pdbRecDes->name);
|
||||
fprintf(fp,"recordtype(%s) {\n",pdbRecDes->name);
|
||||
for(i=0; i<pdbRecDes->no_fields; i++) {
|
||||
int j;
|
||||
|
||||
pdbFldDes = pdbRecDes->papFldDes[i];
|
||||
fprintf(stdout,"\tfield(%s,",pdbFldDes->name);
|
||||
fprintf(fp,"\tfield(%s,",pdbFldDes->name);
|
||||
for(j=0; j<DBF_NTYPES; j++) {
|
||||
if(pamapdbfType[j].value == pdbFldDes->field_type) break;
|
||||
}
|
||||
if(j>=DBF_NTYPES)
|
||||
printf("\t field_type: %d\n", pdbFldDes->field_type);
|
||||
fprintf(stderr,"\t field_type: %d\n",
|
||||
pdbFldDes->field_type);
|
||||
else
|
||||
fprintf(stdout,"%s) {\n",pamapdbfType[j].strvalue);
|
||||
fprintf(fp,"%s) {\n",pamapdbfType[j].strvalue);
|
||||
if(pdbFldDes->prompt)
|
||||
fprintf(stdout,"\t\tprompt(\"%s\")\n",pdbFldDes->prompt);
|
||||
fprintf(fp,"\t\tprompt(\"%s\")\n",pdbFldDes->prompt);
|
||||
if(pdbFldDes->initial)
|
||||
fprintf(stdout,"\t\tinitial(\"%s\")\n",pdbFldDes->initial);
|
||||
fprintf(fp,"\t\tinitial(\"%s\")\n",pdbFldDes->initial);
|
||||
if(pdbFldDes->promptgroup) {
|
||||
for(j=0; j<GUI_NTYPES; j++) {
|
||||
if(pamapguiGroup[j].value == pdbFldDes->promptgroup) {
|
||||
fprintf(stdout,"\t\tpromptgroup(%s)\n",
|
||||
fprintf(fp,"\t\tpromptgroup(%s)\n",
|
||||
pamapguiGroup[j].strvalue);
|
||||
break;
|
||||
}
|
||||
@@ -549,45 +659,62 @@ void dbWriteRecDes(DBBASE *pdbbase,char *recdesName)
|
||||
if(pdbFldDes->special) {
|
||||
for(j=0; j<SPC_NTYPES; j++) {
|
||||
if(pamapspcType[j].value == pdbFldDes->special) {
|
||||
fprintf(stdout,"\t\tspecial(%s)\n",
|
||||
fprintf(fp,"\t\tspecial(%s)\n",
|
||||
pamapspcType[j].strvalue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(pdbFldDes->extra)
|
||||
fprintf(stdout,"\t\textra(\"%s\")\n",pdbFldDes->extra);
|
||||
fprintf(fp,"\t\textra(\"%s\")\n",pdbFldDes->extra);
|
||||
if(pdbFldDes->field_type==DBF_MENU) {
|
||||
if(pdbFldDes->ftPvt)
|
||||
fprintf(stdout,"\t\tmenu(%s)\n",
|
||||
fprintf(fp,"\t\tmenu(%s)\n",
|
||||
((dbMenu *)pdbFldDes->ftPvt)->name);
|
||||
else
|
||||
printf("\t\t menu: NOT FOUND\n");
|
||||
fprintf(stderr,"\t\t menu: NOT FOUND\n");
|
||||
}
|
||||
if(pdbFldDes->field_type==DBF_STRING) {
|
||||
fprintf(stdout,"\t\tsize(%d)\n",
|
||||
fprintf(fp,"\t\tsize(%d)\n",
|
||||
pdbFldDes->size);
|
||||
}
|
||||
if(pdbFldDes->process_passive) fprintf(stdout,"\t\tpp(TRUE)\n");
|
||||
if(pdbFldDes->base) fprintf(stdout,"\t\tbase(HEX)\n");
|
||||
if(pdbFldDes->process_passive) fprintf(fp,"\t\tpp(TRUE)\n");
|
||||
if(pdbFldDes->base) fprintf(fp,"\t\tbase(HEX)\n");
|
||||
if(pdbFldDes->interest)
|
||||
fprintf(stdout,"\t\tinterest(%d)\n",pdbFldDes->interest);
|
||||
if(!pdbFldDes->as_level) fprintf(stdout,"\t\tasl(ASL0)\n");
|
||||
fprintf(stdout,"\t}\n");
|
||||
fprintf(fp,"\t\tinterest(%d)\n",pdbFldDes->interest);
|
||||
if(!pdbFldDes->as_level) fprintf(fp,"\t\tasl(ASL0)\n");
|
||||
fprintf(fp,"\t}\n");
|
||||
}
|
||||
fprintf(stdout,"}\n");
|
||||
fprintf(fp,"}\n");
|
||||
if(recdesName) break;
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
void dbWriteDevice(DBBASE *pdbbase)
|
||||
long dbWriteDevice(DBBASE *pdbbase,const char *filename)
|
||||
{
|
||||
FILE *outFile;
|
||||
|
||||
outFile = fopen(filename,"w");
|
||||
if(!outFile) {
|
||||
errPrintf(0,__FILE__,__LINE__,"Error opening %s\n",filename);
|
||||
return(-1);
|
||||
}
|
||||
dbWriteDeviceFP(pdbbase,outFile);
|
||||
if(fclose(outFile)) {
|
||||
errPrintf(0,__FILE__,__LINE__,"Error closing %s\n",filename);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
long dbWriteDeviceFP(DBBASE *pdbbase,FILE *fp)
|
||||
{
|
||||
dbRecDes *pdbRecDes;
|
||||
devSup *pdevSup;
|
||||
|
||||
if(!pdbbase) {
|
||||
printf("pdbbase not specified\n");
|
||||
return;
|
||||
fprintf(stderr,"dbWriteDeviceFP: pdbbase not specified\n");
|
||||
return(-1);
|
||||
}
|
||||
for(pdbRecDes = (dbRecDes *)ellFirst(&pdbbase->recDesList);
|
||||
pdbRecDes; pdbRecDes = (dbRecDes *)ellNext(&pdbRecDes->node)) {
|
||||
@@ -599,29 +726,47 @@ void dbWriteDevice(DBBASE *pdbbase)
|
||||
if(pamaplinkType[j].value==pdevSup->link_type) break;
|
||||
}
|
||||
if(j>=LINK_NTYPES) {
|
||||
fprintf(stdout,"link_type not valid\n");
|
||||
fprintf(fp,"link_type not valid\n");
|
||||
continue;
|
||||
}
|
||||
fprintf(stdout,"device(%s,%s,%s,\"%s\")\n",
|
||||
fprintf(fp,"device(%s,%s,%s,\"%s\")\n",
|
||||
pdbRecDes->name,
|
||||
pamaplinkType[j].strvalue,
|
||||
pdevSup->name,pdevSup->choice);
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
void dbWriteDriver(DBBASE *pdbbase)
|
||||
long dbWriteDriver(DBBASE *pdbbase,const char *filename)
|
||||
{
|
||||
FILE *outFile;
|
||||
|
||||
outFile = fopen(filename,"w");
|
||||
if(!outFile) {
|
||||
errPrintf(0,__FILE__,__LINE__,"Error opening %s\n",filename);
|
||||
return(-1);
|
||||
}
|
||||
dbWriteDriverFP(pdbbase,outFile);
|
||||
if(fclose(outFile)) {
|
||||
errPrintf(0,__FILE__,__LINE__,"Error closing %s\n",filename);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
long dbWriteDriverFP(DBBASE *pdbbase,FILE *fp)
|
||||
{
|
||||
drvSup *pdrvSup;
|
||||
|
||||
if(!pdbbase) {
|
||||
printf("pdbbase not specified\n");
|
||||
return;
|
||||
fprintf(stderr,"pdbbase not specified\n");
|
||||
return(-1);
|
||||
}
|
||||
for(pdrvSup = (drvSup *)ellFirst(&pdbbase->drvList);
|
||||
pdrvSup; pdrvSup = (drvSup *)ellNext(&pdrvSup->node)) {
|
||||
fprintf(stdout,"driver(%s)\n",pdrvSup->name);
|
||||
fprintf(fp,"driver(%s)\n",pdrvSup->name);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
long dbFindRecdes(DBENTRY *pdbentry,char *rectype)
|
||||
@@ -714,10 +859,10 @@ long dbDeleteRecord(DBENTRY *pdbentry)
|
||||
long status;
|
||||
|
||||
if (!precnode) return (S_dbLib_recNotFound);
|
||||
if(status = dbFreeRecord(pdbentry)) return(status);
|
||||
preclist = &precdes->recList;
|
||||
ellDelete(preclist,&precnode->node);
|
||||
dbPvdDelete(pdbbase,precnode);
|
||||
if(status = dbFreeRecord(pdbentry)) return(status);
|
||||
free((void *)precnode);
|
||||
pdbentry->precnode = NULL;
|
||||
return (0);
|
||||
@@ -747,6 +892,11 @@ long dbFindRecord(DBENTRY *pdbentry,char *precordName)
|
||||
if(*precordName++=='.') return(dbFindField(pdbentry, precordName));
|
||||
return (0);
|
||||
}
|
||||
|
||||
int dbFoundField(DBENTRY *pdbentry)
|
||||
{
|
||||
return((pdbentry->pfield) ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
long dbFirstRecord(DBENTRY *pdbentry)
|
||||
{
|
||||
@@ -2479,34 +2629,22 @@ long dbGetPvlink(DBENTRY *pdbentry,int *pp,int *ms,char *pvname)
|
||||
}
|
||||
}
|
||||
|
||||
void dbDumpMenu(DBBASE *pdbbase,char *menuName)
|
||||
void dbDumpRecord(dbBase *pdbbase,char *precdesname,int level)
|
||||
{
|
||||
dbMenu *pdbMenu;
|
||||
int gotMatch;
|
||||
int i;
|
||||
|
||||
if(!pdbbase) {
|
||||
printf("pdbbase not specified\n");
|
||||
return;
|
||||
}
|
||||
pdbMenu = (dbMenu *)ellFirst(&pdbbase->menuList);
|
||||
while(pdbMenu) {
|
||||
if(menuName) {
|
||||
gotMatch = (strcmp(menuName,pdbMenu->name)==0) ? TRUE : FALSE;
|
||||
}else {
|
||||
gotMatch=TRUE;
|
||||
}
|
||||
if(gotMatch) {
|
||||
printf("menu(%s) {\n",pdbMenu->name);
|
||||
for(i=0; i<pdbMenu->nChoice; i++) {
|
||||
printf("\tchoice(%s,%s)\n",pdbMenu->papChoiceName[i],
|
||||
pdbMenu->papChoiceValue[i]);
|
||||
}
|
||||
printf("}\n");
|
||||
if(menuName) break;
|
||||
}
|
||||
pdbMenu = (dbMenu *)ellNext(&pdbMenu->node);
|
||||
dbWriteRecordFP(pdbbase,stdout,precdesname,level);
|
||||
}
|
||||
|
||||
void dbDumpMenu(DBBASE *pdbbase,char *menuName)
|
||||
{
|
||||
if(!pdbbase) {
|
||||
printf("pdbbase not specified\n");
|
||||
return;
|
||||
}
|
||||
dbWriteMenuFP(pdbbase,stdout,menuName);
|
||||
}
|
||||
|
||||
void dbDumpRecDes(DBBASE *pdbbase,char *recdesName)
|
||||
@@ -2661,25 +2799,11 @@ void dbDumpDevice(DBBASE *pdbbase,char *recdesName)
|
||||
|
||||
void dbDumpDriver(DBBASE *pdbbase)
|
||||
{
|
||||
drvSup *pdrvSup;
|
||||
|
||||
if(!pdbbase) {
|
||||
printf("pdbbase not specified\n");
|
||||
return;
|
||||
}
|
||||
for(pdrvSup = (drvSup *)ellFirst(&pdbbase->drvList);
|
||||
pdrvSup; pdrvSup = (drvSup *)ellNext(&pdrvSup->node)) {
|
||||
printf("%s(%p)\n",pdrvSup->name,pdrvSup->pdrvet);
|
||||
}
|
||||
}
|
||||
|
||||
void dbDumpRecords(dbBase *pdbbase,char *precdesname,int levl)
|
||||
{
|
||||
if(!pdbbase) {
|
||||
printf("pdbbase not specified\n");
|
||||
return;
|
||||
}
|
||||
dbWriteRecords(pdbbase,stdout,precdesname,levl);
|
||||
dbWriteDriverFP(pdbbase,stdout);
|
||||
}
|
||||
|
||||
static char *bus[VXI_IO+1] = {"","","VME","CAMAC","AB",
|
||||
|
||||
194
src/dbStatic/dbStaticLib.h
Normal file
194
src/dbStatic/dbStaticLib.h
Normal file
@@ -0,0 +1,194 @@
|
||||
/* $Id$
|
||||
*
|
||||
* Author: Marty Kraimer
|
||||
* Date: 06-08-93
|
||||
*
|
||||
* 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:
|
||||
* -----------------
|
||||
* .01 06-08-93 mrk Replace dbManipulate
|
||||
* .02 06-07-95 mrk Get rid of default.dctsdr info
|
||||
*/
|
||||
|
||||
#ifndef INCdbStaticLibh
|
||||
#define INCdbStaticLibh 1
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <ellLib.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbFldTypes.h>
|
||||
#include <dbBase.h>
|
||||
#include <link.h>
|
||||
#include <errMdef.h>
|
||||
|
||||
/*Field types as seen by static database access clients*/
|
||||
#define DCT_STRING 0
|
||||
#define DCT_INTEGER 1
|
||||
#define DCT_REAL 2
|
||||
#define DCT_MENU 3
|
||||
#define DCT_MENUFORM 4
|
||||
#define DCT_INLINK 5
|
||||
#define DCT_OUTLINK 6
|
||||
#define DCT_FWDLINK 7
|
||||
#define DCT_NOACCESS 8
|
||||
|
||||
/*Link types as seen by static database access clients*/
|
||||
#define DCT_LINK_CONSTANT 0
|
||||
#define DCT_LINK_FORM 1
|
||||
#define DCT_LINK_PV 2
|
||||
#define DCT_LINK_DEVICE 3
|
||||
|
||||
/*options for dbRead and dbWrite*/
|
||||
#define DB_RECDES_IO 0x1
|
||||
#define DB_RECORD_IO 0x2
|
||||
|
||||
typedef dbBase DBBASE;
|
||||
|
||||
typedef struct{
|
||||
DBBASE *pdbbase;
|
||||
dbRecDes *precdes;
|
||||
dbFldDes *pflddes;
|
||||
dbRecordNode *precnode;
|
||||
void *pfield;
|
||||
char *message;
|
||||
short indfield;
|
||||
void *formpvt;
|
||||
} DBENTRY;
|
||||
|
||||
/* Static database access routines*/
|
||||
DBBASE *dbAllocBase(void);
|
||||
void dbFreeBase(DBBASE *pdbbase);
|
||||
DBENTRY *dbAllocEntry(DBBASE *pdbbase);
|
||||
void dbFreeEntry(DBENTRY *pdbentry);
|
||||
void dbInitEntry(DBBASE *pdbbase,DBENTRY *pdbentry);
|
||||
void dbFinishEntry(DBENTRY *pdbentry);
|
||||
DBENTRY *dbCopyEntry(DBENTRY *pdbentry);
|
||||
|
||||
long dbReadDatabase(DBBASE **ppdbbase,const char *filename,const char *path);
|
||||
long dbReadDatabaseFP(DBBASE **ppdbbase,FILE *fp,const char *path);
|
||||
long dbPath(DBBASE *pdbbase,const char *path);
|
||||
long dbAddPath(DBBASE *pdbbase,const char *path);
|
||||
long dbWriteRecord(DBBASE *ppdbbase,const char *filename,
|
||||
char *precdesname,int level);
|
||||
long dbWriteRecordFP(DBBASE *ppdbbase,FILE *fp,
|
||||
char *precdesname,int level);
|
||||
long dbWriteMenu(DBBASE *pdbbase,const char *filename,char *menuName);
|
||||
long dbWriteMenuFP(DBBASE *pdbbase,FILE *fp,char *menuName);
|
||||
long dbWriteRecDes(DBBASE *pdbbase,const char *filename,char *recdesName);
|
||||
long dbWriteRecDesFP(DBBASE *pdbbase,FILE *fp,char *recdesName);
|
||||
long dbWriteDevice(DBBASE *pdbbase,const char *filename);
|
||||
long dbWriteDeviceFP(DBBASE *pdbbase,FILE *fp);
|
||||
long dbWriteDriver(DBBASE *pdbbase,const char *filename);
|
||||
long dbWriteDriverFP(DBBASE *pdbbase,FILE *fp);
|
||||
|
||||
/*Following two routines are obsolete. For now dbRead calls dbAsciiRead.*/
|
||||
/* dbWrite does nothing */
|
||||
long dbRead(DBBASE *pdbbase,FILE *fp);
|
||||
long dbWrite(DBBASE *pdbbase,FILE *fpdctsdr,FILE *fp);
|
||||
|
||||
long dbFindRecdes(DBENTRY *pdbentry,char *recdesname);
|
||||
long dbFirstRecdes(DBENTRY *pdbentry);
|
||||
long dbNextRecdes(DBENTRY *pdbentry);
|
||||
char *dbGetRecdesName(DBENTRY *pdbentry);
|
||||
int dbGetNRecdes(DBENTRY *pdbentry);
|
||||
|
||||
long dbCreateRecord(DBENTRY *pdbentry,char *precordName);
|
||||
long dbDeleteRecord(DBENTRY *pdbentry);
|
||||
long dbFindRecord(DBENTRY *pdbentry,char *precordName);
|
||||
long dbFirstRecord(DBENTRY *pdbentry); /*first of record type*/
|
||||
long dbNextRecord(DBENTRY *pdbentry);
|
||||
int dbGetNRecords(DBENTRY *pdbentry);
|
||||
char *dbGetRecordName(DBENTRY *pdbentry);
|
||||
long dbRenameRecord(DBENTRY *pdbentry,char *newName);
|
||||
|
||||
long dbFindField(DBENTRY *pdbentry,char *pfieldName);
|
||||
long dbFirstFielddes(DBENTRY *pdbentry,int dctonly);
|
||||
long dbNextFielddes(DBENTRY *pdbentry,int dctonly);
|
||||
int dbGetFieldType(DBENTRY *pdbentry);
|
||||
int dbGetNFields(DBENTRY *pdbentry,int dctonly);
|
||||
char *dbGetFieldName(DBENTRY *pdbentry);
|
||||
char *dbGetPrompt(DBENTRY *pdbentry);
|
||||
int dbGetPromptGroup(DBENTRY *pdbentry);
|
||||
|
||||
char *dbGetString(DBENTRY *pdbentry);
|
||||
long dbPutString(DBENTRY *pdbentry,char *pstring);
|
||||
char *dbVerify(DBENTRY *pdbentry,char *pstring);
|
||||
char *dbGetRange(DBENTRY *pdbentry);
|
||||
int dbIsDefaultValue(DBENTRY *pdbentry);
|
||||
|
||||
brkTable *dbFindBrkTable(DBBASE *pdbbase,char *name);
|
||||
|
||||
dbMenu *dbFindMenu(DBBASE *pdbbase,char *name);
|
||||
char **dbGetChoices(DBENTRY *pdbentry);
|
||||
int dbGetMenuIndex(DBENTRY *pdbentry);
|
||||
long dbPutMenuIndex(DBENTRY *pdbentry,int index);
|
||||
int dbGetNMenuChoices(DBENTRY *pdbentry);
|
||||
|
||||
int dbAllocForm(DBENTRY *pdbentry);
|
||||
long dbFreeForm(DBENTRY *pdbentry);
|
||||
char **dbGetFormPrompt(DBENTRY *pdbentry);
|
||||
char **dbGetFormValue(DBENTRY *pdbentry);
|
||||
long dbPutForm(DBENTRY *pdbentry,char **value);
|
||||
char **dbVerifyForm(DBENTRY *pdbentry,char **value);
|
||||
|
||||
int dbGetNLinks(DBENTRY *pdbentry);
|
||||
long dbGetLinkField(DBENTRY *pdbentry,int index);
|
||||
int dbGetLinkType(DBENTRY *pdbentry);
|
||||
long dbCvtLinkToConstant(DBENTRY *pdbentry);
|
||||
long dbCvtLinkToPvlink(DBENTRY *pdbentry);
|
||||
long dbPutPvlink(DBENTRY *pdbentry,int pp,int ms,char *pvname);
|
||||
long dbGetPvlink(DBENTRY *pdbentry,int *pp,int *ms,char *pvname);
|
||||
|
||||
/*dump routines*/
|
||||
void dbDumpRecord(DBBASE *pdbbase,char *precdesname,int level);
|
||||
void dbDumpMenu(DBBASE *pdbbase,char *menuName);
|
||||
void dbDumpRecDes(DBBASE *pdbbase,char *recdesName);
|
||||
void dbDumpFldDes(DBBASE *pdbbase,char *recdesName,char *fname);
|
||||
void dbDumpDevice(DBBASE *pdbbase,char *recdesName);
|
||||
void dbDumpDriver(DBBASE *pdbbase);
|
||||
void dbPvdDump(DBBASE *pdbbase,int verbose);
|
||||
void dbReportDeviceConfig(DBBASE *pdbbase,FILE *report);
|
||||
|
||||
/* Misc useful routines*/
|
||||
/*general purpose allocation routines to invoke calloc and maloc */
|
||||
/* NOTE: These routines do NOT return if they fail. */
|
||||
void *dbCalloc(size_t nobj,size_t size);
|
||||
void *dbMalloc(size_t size);
|
||||
|
||||
extern int dbDebug;
|
||||
|
||||
#define S_dbLib_recdesNotFound (M_dbLib| 1) /*Record Type does not exist*/
|
||||
#define S_dbLib_recExists (M_dbLib| 3) /*Record Already exists*/
|
||||
#define S_dbLib_recNotFound (M_dbLib| 5) /*Record Not Found*/
|
||||
#define S_dbLib_flddesNotFound (M_dbLib| 7) /*Field Description Not Found*/
|
||||
#define S_dbLib_fieldNotFound (M_dbLib| 9) /*Field Not Found*/
|
||||
#define S_dbLib_badField (M_dbLib|11) /*Bad Field value*/
|
||||
#define S_dbLib_menuNotFound (M_dbLib|13) /*Menu not found*/
|
||||
#define S_dbLib_badLink (M_dbLib|15) /*Bad Link Field*/
|
||||
#define S_dbLib_nameLength (M_dbLib|17) /*Record Name is too long*/
|
||||
#define S_dbLib_noRecSup (M_dbLib|19) /*Record support not found*/
|
||||
#endif /*INCdbStaticLibh*/
|
||||
@@ -48,13 +48,13 @@ long dbAllocRecord(DBENTRY *pdbentry,char *precordName)
|
||||
switch(pflddes->field_type) {
|
||||
case DBF_STRING:
|
||||
if(pflddes->size <= 0) {
|
||||
epicsPrintf("size=0 for %s.%s\n",precdes->name,pflddes->name);
|
||||
fprintf(stderr,"size=0 for %s.%s\n",precdes->name,pflddes->name);
|
||||
pflddes->size = 1;
|
||||
}
|
||||
papField[i] = dbCalloc(pflddes->size,sizeof(char));
|
||||
if(pflddes->initial) {
|
||||
if(strlen(pflddes->initial) >= pflddes->size) {
|
||||
epicsPrintf("initial size > size for %s.%s\n",
|
||||
fprintf(stderr,"initial size > size for %s.%s\n",
|
||||
precdes->name,pflddes->name);
|
||||
} else {
|
||||
strcpy((char *)papField[i],pflddes->initial);
|
||||
@@ -97,7 +97,7 @@ long dbAllocRecord(DBENTRY *pdbentry,char *precordName)
|
||||
case DBF_NOACCESS:
|
||||
break;
|
||||
default:
|
||||
epicsPrintf("dbAllocRecord: Illegal field type\n");
|
||||
fprintf(stderr,"dbAllocRecord: Illegal field type\n");
|
||||
}
|
||||
}
|
||||
pstr = (char *)papField[0];
|
||||
|
||||
@@ -47,6 +47,12 @@ long dbPutStringNum(DBENTRY *pdbentry,char *pstring);
|
||||
|
||||
void dbGetRecordtypeSizeOffset(dbRecDes *pdbRecDes);
|
||||
|
||||
/* The following is for path */
|
||||
typedef struct dbPathNode {
|
||||
ELLNODE node;
|
||||
char *directory;
|
||||
} dbPathNode;
|
||||
|
||||
/*The following are in dbPvdLib.c*/
|
||||
/*directory*/
|
||||
typedef struct{
|
||||
@@ -54,7 +60,8 @@ typedef struct{
|
||||
dbRecDes *precdes;
|
||||
dbRecordNode *precnode;
|
||||
}PVDENTRY;
|
||||
int dbPvdTableSize(DBBASE *pdbbase,int size);
|
||||
int dbPvdTableSize(int size);
|
||||
extern int dbDebug;
|
||||
void dbPvdInitPvt(DBBASE *pdbbase);
|
||||
PVDENTRY *dbPvdFind(DBBASE *pdbbase,char *name,int lenname);
|
||||
PVDENTRY *dbPvdAdd(DBBASE *pdbbase,dbRecDes *precdes,dbRecordNode *precnode);
|
||||
|
||||
@@ -38,7 +38,6 @@ of this distribution.
|
||||
#include <devSup.h>
|
||||
#include <drvSup.h>
|
||||
#include <recSup.h>
|
||||
#include <cvtTable.h>
|
||||
#include <special.h>
|
||||
|
||||
static char hex_digit_to_ascii[16]={'0','1','2','3','4','5','6','7','8','9',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* dbAsciiToMenuH.c */
|
||||
/* dbToMenu.c */
|
||||
/* Author: Marty Kraimer Date: 11Sep95 */
|
||||
/*****************************************************************
|
||||
COPYRIGHT NOTIFICATION
|
||||
@@ -27,9 +27,12 @@ of this distribution.
|
||||
#include <gpHash.h>
|
||||
|
||||
DBBASE *pdbbase = NULL;
|
||||
|
||||
|
||||
int main(int argc,char **argv)
|
||||
{
|
||||
int arg,strip;
|
||||
char *path=0;
|
||||
long status;
|
||||
dbMenu *pdbMenu;
|
||||
char *outFilename;
|
||||
@@ -38,8 +41,22 @@ int main(int argc,char **argv)
|
||||
int i;
|
||||
char *plastSlash;
|
||||
|
||||
/*Look for path, i.e. -I path or -Ipath*/
|
||||
for(arg=1; arg<argc; arg++) {
|
||||
if(strncmp(argv[arg],"-I",2)!=0) continue;
|
||||
if(strlen(argv[arg])==2) {
|
||||
path = argv[arg+1];
|
||||
strip = 2;
|
||||
} else {
|
||||
path = argv[arg] + 2;
|
||||
strip = 1;
|
||||
}
|
||||
argc -= strip;
|
||||
for(i=arg; i<argc; i++) argv[i] = argv[i + strip];
|
||||
break;
|
||||
}
|
||||
if(argc!=2) {
|
||||
fprintf(stderr,"usage: dbAsciiToMenuH file.ascii\n");
|
||||
fprintf(stderr,"usage: dbToMenu -Ipath file.db\n");
|
||||
exit(-1);
|
||||
}
|
||||
/*remove path so that outFile is created where program is executed*/
|
||||
@@ -47,9 +64,9 @@ int main(int argc,char **argv)
|
||||
plastSlash = (plastSlash ? plastSlash+1 : argv[1]);
|
||||
outFilename = dbCalloc(1,strlen(plastSlash)+1);
|
||||
strcpy(outFilename,plastSlash);
|
||||
pext = strstr(outFilename,".ascii");
|
||||
pext = strstr(outFilename,".db");
|
||||
if(!pext) {
|
||||
fprintf(stderr,"Input file MUST have .ascii extension\n");
|
||||
fprintf(stderr,"Input file MUST have .db extension\n");
|
||||
exit(-1);
|
||||
}
|
||||
strcpy(pext,".h");
|
||||
@@ -60,9 +77,9 @@ int main(int argc,char **argv)
|
||||
}
|
||||
pdbbase = dbAllocBase();
|
||||
pdbbase->ignoreMissingMenus = TRUE;
|
||||
status = dbAsciiRead(&pdbbase,argv[1]);
|
||||
status = dbReadDatabase(&pdbbase,argv[1],path);
|
||||
if(status) {
|
||||
epicsPrintf("Terminal error For input file %s\n",argv[1]);
|
||||
fprintf(stderr,"Terminal error For input file %s\n",argv[1]);
|
||||
exit(-1);
|
||||
}
|
||||
pdbMenu = (dbMenu *)ellFirst(&pdbbase->menuList);
|
||||
@@ -1,4 +1,4 @@
|
||||
/* dbAsciiToRecordtypeH.c */
|
||||
/* dbToRecordtypeH.c */
|
||||
/* Author: Marty Kraimer Date: 11Sep95 */
|
||||
/*****************************************************************
|
||||
COPYRIGHT NOTIFICATION
|
||||
@@ -30,6 +30,8 @@ DBBASE *pdbbase = NULL;
|
||||
|
||||
int main(int argc,char **argv)
|
||||
{
|
||||
int arg,strip;
|
||||
char *path=0;
|
||||
long status;
|
||||
char *outFilename;
|
||||
char *pext;
|
||||
@@ -41,8 +43,22 @@ int main(int argc,char **argv)
|
||||
int isdbCommonRecord = FALSE;
|
||||
char *plastSlash;
|
||||
|
||||
/*Look for path, i.e. -I path or -Ipath*/
|
||||
for(arg=1; arg<argc; arg++) {
|
||||
if(strncmp(argv[arg],"-I",2)!=0) continue;
|
||||
if(strlen(argv[arg])==2) {
|
||||
path = argv[arg+1];
|
||||
strip = 2;
|
||||
} else {
|
||||
path = argv[arg] + 2;
|
||||
strip = 1;
|
||||
}
|
||||
argc -= strip;
|
||||
for(i=arg; i<argc; i++) argv[i] = argv[i + strip];
|
||||
break;
|
||||
}
|
||||
if(argc!=2) {
|
||||
fprintf(stderr,"usage: dbAsciiToMenuH file.ascii\n");
|
||||
fprintf(stderr,"usage: dbToRecordtypeH -Ipath file.db\n");
|
||||
exit(-1);
|
||||
}
|
||||
/*remove path so that outFile is created where program is executed*/
|
||||
@@ -50,9 +66,9 @@ int main(int argc,char **argv)
|
||||
plastSlash = (plastSlash ? plastSlash+1 : argv[1]);
|
||||
outFilename = dbCalloc(1,strlen(plastSlash)+1);
|
||||
strcpy(outFilename,plastSlash);
|
||||
pext = strstr(outFilename,".ascii");
|
||||
pext = strstr(outFilename,".db");
|
||||
if(!pext) {
|
||||
fprintf(stderr,"Input file MUST have .ascii extension\n");
|
||||
fprintf(stderr,"Input file MUST have .db extension\n");
|
||||
exit(-1);
|
||||
}
|
||||
strcpy(pext,".h");
|
||||
@@ -67,9 +83,9 @@ int main(int argc,char **argv)
|
||||
}
|
||||
pdbbase = dbAllocBase();
|
||||
pdbbase->ignoreMissingMenus = TRUE;
|
||||
status = dbAsciiRead(&pdbbase,argv[1]);
|
||||
status = dbReadDatabase(&pdbbase,argv[1],path);
|
||||
if(status) {
|
||||
epicsPrintf("Terminal error For input file %s\n",argv[1]);
|
||||
fprintf(stderr,"Terminal error For input file %s\n",argv[1]);
|
||||
exit(-1);
|
||||
}
|
||||
fprintf(outFile,"#include <vxWorks.h>\n");
|
||||
@@ -3,13 +3,13 @@ static int yyerror();
|
||||
static int yy_start;
|
||||
static long pvt_yy_parse(void);
|
||||
static int yyFailed = 0;
|
||||
#include "dbAsciiRoutines.c"
|
||||
#include "dbLexRoutines.c"
|
||||
static char *menuString = "menu";
|
||||
%}
|
||||
|
||||
%start database
|
||||
|
||||
%token tokenINCLUDE tokenPATH
|
||||
%token tokenINCLUDE tokenPATH tokenADDPATH
|
||||
%token tokenMENU tokenCHOICE tokenRECORDTYPE tokenFIELD
|
||||
%token tokenDEVICE tokenDRIVER tokenBREAKTABLE
|
||||
%token tokenRECORD
|
||||
@@ -26,6 +26,7 @@ database: database database_item | database_item;
|
||||
|
||||
database_item: include
|
||||
| path
|
||||
| addpath
|
||||
| tokenMENU menu_head menu_body
|
||||
| tokenRECORDTYPE recordtype_head recordtype_body
|
||||
| device
|
||||
@@ -37,25 +38,31 @@ database_item: include
|
||||
include: tokenINCLUDE tokenSTRING
|
||||
{
|
||||
if(dbDebug>2) printf("include : %s\n",$2);
|
||||
dbAsciiIncludeNew($2);
|
||||
dbIncludeNew($2);
|
||||
};
|
||||
|
||||
path: tokenPATH tokenSTRING
|
||||
{
|
||||
if(dbDebug>2) printf("path : %s\n",$2);
|
||||
dbAsciiPath($2);
|
||||
dbPathCmd($2);
|
||||
};
|
||||
|
||||
addpath: tokenADDPATH tokenSTRING
|
||||
{
|
||||
if(dbDebug>2) printf("addpath : %s\n",$2);
|
||||
dbAddPathCmd($2);
|
||||
};
|
||||
|
||||
menu_head: '(' tokenSTRING ')'
|
||||
{
|
||||
if(dbDebug>2) printf("menu_head %s\n",$2);
|
||||
dbAsciiMenuHead($2);
|
||||
dbMenuHead($2);
|
||||
};
|
||||
|
||||
menu_body: '{' choice_list '}'
|
||||
{
|
||||
if(dbDebug>2) printf("menu_body\n");
|
||||
dbAsciiMenuBody();
|
||||
dbMenuBody();
|
||||
}
|
||||
| include ;
|
||||
|
||||
@@ -64,19 +71,19 @@ choice_list: choice_list choice | choice;
|
||||
choice: tokenCHOICE '(' tokenSTRING ',' tokenSTRING ')'
|
||||
{
|
||||
if(dbDebug>2) printf("choice %s %s\n",$3,$5);
|
||||
dbAsciiMenuChoice($3,$5);
|
||||
dbMenuChoice($3,$5);
|
||||
} ;
|
||||
|
||||
recordtype_head: '(' tokenSTRING ')'
|
||||
{
|
||||
if(dbDebug>2) printf("recordtype_head %s\n",$2);
|
||||
dbAsciiRecordtypeHead($2);
|
||||
dbRecordtypeHead($2);
|
||||
};
|
||||
|
||||
recordtype_body: '{' recordtype_field_list '}'
|
||||
{
|
||||
if(dbDebug>2) printf("recordtype_body\n");
|
||||
dbAsciiRecordtypeBody();
|
||||
dbRecordtypeBody();
|
||||
};
|
||||
|
||||
recordtype_field_list: recordtype_field_list recordtype_field
|
||||
@@ -88,7 +95,7 @@ recordtype_field: tokenFIELD recordtype_field_head recordtype_field_body
|
||||
recordtype_field_head: '(' tokenSTRING ',' tokenSTRING ')'
|
||||
{
|
||||
if(dbDebug>2) printf("recordtype_field_head %s %s\n",$2,$4);
|
||||
dbAsciiRecordtypeFieldHead($2,$4);
|
||||
dbRecordtypeFieldHead($2,$4);
|
||||
};
|
||||
|
||||
recordtype_field_body: '{' recordtype_field_item_list '}' ;
|
||||
@@ -99,7 +106,7 @@ recordtype_field_item_list: recordtype_field_item_list recordtype_field_item
|
||||
recordtype_field_item: tokenSTRING '(' tokenSTRING ')'
|
||||
{
|
||||
if(dbDebug>2) printf("recordtype_field_item %s %s\n",$1,$3);
|
||||
dbAsciiRecordtypeFieldItem($1,$3);
|
||||
dbRecordtypeFieldItem($1,$3);
|
||||
}
|
||||
| tokenMENU '(' tokenSTRING ')'
|
||||
{
|
||||
@@ -108,7 +115,7 @@ recordtype_field_item: tokenSTRING '(' tokenSTRING ')'
|
||||
if(dbDebug>2) printf("recordtype_field_item %s (%s)\n",menuString,$3);
|
||||
pmenu = (char *)malloc(strlen(menuString)+1);
|
||||
strcpy(pmenu,menuString);
|
||||
dbAsciiRecordtypeFieldItem(pmenu,$3);
|
||||
dbRecordtypeFieldItem(pmenu,$3);
|
||||
};
|
||||
|
||||
|
||||
@@ -116,26 +123,26 @@ device: tokenDEVICE '('
|
||||
tokenSTRING ',' tokenSTRING ',' tokenSTRING ',' tokenSTRING ')'
|
||||
{
|
||||
if(dbDebug>2) printf("device %s %s %s %s\n",$3,$5,$7,$9);
|
||||
dbAsciiDevice($3,$5,$7,$9);
|
||||
dbDevice($3,$5,$7,$9);
|
||||
};
|
||||
|
||||
|
||||
driver: tokenDRIVER '(' tokenSTRING ')'
|
||||
{
|
||||
if(dbDebug>2) printf("driver %s\n",$3);
|
||||
dbAsciiDriver($3);
|
||||
dbDriver($3);
|
||||
};
|
||||
|
||||
break_head: '(' tokenSTRING ')'
|
||||
{
|
||||
if(dbDebug>2) printf("break_head %s\n",$2);
|
||||
dbAsciiBreakHead($2);
|
||||
dbBreakHead($2);
|
||||
};
|
||||
|
||||
break_body : '{' break_list '}'
|
||||
{
|
||||
if(dbDebug>2) printf("break_body\n");
|
||||
dbAsciiBreakBody();
|
||||
dbBreakBody();
|
||||
};
|
||||
|
||||
break_list: break_list ',' break_item | break_item;
|
||||
@@ -143,20 +150,20 @@ break_list: break_list ',' break_item | break_item;
|
||||
break_item: tokenSTRING
|
||||
{
|
||||
if(dbDebug>2) printf("break_item tokenSTRING %s\n",$1);
|
||||
dbAsciiBreakItem($1);
|
||||
dbBreakItem($1);
|
||||
};
|
||||
|
||||
|
||||
record_head: '(' tokenSTRING ',' tokenSTRING ')'
|
||||
{
|
||||
if(dbDebug>2) printf("record_head %s %s\n",$2,$4);
|
||||
dbAsciiRecordHead($2,$4);
|
||||
dbRecordHead($2,$4);
|
||||
};
|
||||
|
||||
record_body: '{' record_field_list '}'
|
||||
{
|
||||
if(dbDebug>2) printf("record_body\n");
|
||||
dbAsciiRecordBody();
|
||||
dbRecordBody();
|
||||
};
|
||||
|
||||
record_field_list: record_field_list record_field
|
||||
@@ -165,13 +172,13 @@ record_field_list: record_field_list record_field
|
||||
record_field: tokenFIELD '(' tokenSTRING ',' tokenSTRING ')'
|
||||
{
|
||||
if(dbDebug>2) printf("record_field %s %s\n",$3,$5);
|
||||
dbAsciiRecordField($3,$5);
|
||||
dbRecordField($3,$5);
|
||||
}
|
||||
| include ;
|
||||
|
||||
%%
|
||||
|
||||
#include "dbAsciiLex.c"
|
||||
#include "dbLex.c"
|
||||
|
||||
|
||||
static int yyerror(char *str)
|
||||
@@ -179,7 +186,7 @@ static int yyerror(char *str)
|
||||
fprintf(stderr,"Error ");
|
||||
if(str) fprintf(stderr,"\"%s\"",str);
|
||||
fprintf(stderr," Last token \"%s\"\n",yytext);
|
||||
dbAsciiIncludePrint(stderr);
|
||||
dbIncludePrint(stderr);
|
||||
yyFailed = TRUE;
|
||||
return(0);
|
||||
}
|
||||
74
src/dbStatic/guigroup.h
Normal file
74
src/dbStatic/guigroup.h
Normal file
@@ -0,0 +1,74 @@
|
||||
|
||||
/* $Id$
|
||||
these are used in the pmt (prompt) field of the record support
|
||||
ascii files. They represent field groupings for dct tools
|
||||
*/
|
||||
|
||||
#ifndef __gui_group_h__
|
||||
#define __gui_group_h__
|
||||
|
||||
#define GUI_COMMON 1
|
||||
#define GUI_ALARMS 2
|
||||
#define GUI_BITS1 3
|
||||
#define GUI_BITS2 4
|
||||
#define GUI_CALC 5
|
||||
#define GUI_CLOCK 6
|
||||
#define GUI_COMPRESS 7
|
||||
#define GUI_CONVERT 8
|
||||
#define GUI_DISPLAY 9
|
||||
#define GUI_HIST 10
|
||||
#define GUI_INPUTS 11
|
||||
#define GUI_LINKS 12
|
||||
#define GUI_MBB 13
|
||||
#define GUI_MOTOR 14
|
||||
#define GUI_OUTPUT 15
|
||||
#define GUI_PID 16
|
||||
#define GUI_PULSE 17
|
||||
#define GUI_SELECT 18
|
||||
#define GUI_SEQ1 19
|
||||
#define GUI_SEQ2 20
|
||||
#define GUI_SEQ3 21
|
||||
#define GUI_SUB 22
|
||||
#define GUI_TIMER 23
|
||||
#define GUI_WAVE 24
|
||||
#define GUI_SCAN 25
|
||||
#define GUI_NTYPES 25
|
||||
|
||||
typedef struct mapguiGroup{
|
||||
char *strvalue;
|
||||
int value;
|
||||
}mapguiGroup;
|
||||
|
||||
#ifndef GUIGROUPS_GBLSOURCE
|
||||
extern mapguiGroup pamapguiGroup[];
|
||||
#else
|
||||
mapguiGroup pamapguiGroup[GUI_NTYPES] = {
|
||||
{"GUI_COMMON",GUI_COMMON},
|
||||
{"GUI_ALARMS",GUI_ALARMS},
|
||||
{"GUI_BITS1",GUI_BITS1},
|
||||
{"GUI_BITS2",GUI_BITS2},
|
||||
{"GUI_CALC",GUI_CALC},
|
||||
{"GUI_CLOCK",GUI_CLOCK},
|
||||
{"GUI_COMPRESS",GUI_COMPRESS},
|
||||
{"GUI_CONVERT",GUI_CONVERT},
|
||||
{"GUI_DISPLAY",GUI_DISPLAY},
|
||||
{"GUI_HIST",GUI_HIST},
|
||||
{"GUI_INPUTS",GUI_INPUTS},
|
||||
{"GUI_LINKS",GUI_LINKS},
|
||||
{"GUI_MBB",GUI_MBB},
|
||||
{"GUI_MOTOR",GUI_MOTOR},
|
||||
{"GUI_OUTPUT",GUI_OUTPUT},
|
||||
{"GUI_PID",GUI_PID},
|
||||
{"GUI_PULSE",GUI_PULSE},
|
||||
{"GUI_SELECT",GUI_SELECT},
|
||||
{"GUI_SEQ1",GUI_SEQ1},
|
||||
{"GUI_SEQ2",GUI_SEQ2},
|
||||
{"GUI_SEQ3",GUI_SEQ3},
|
||||
{"GUI_SUB",GUI_SUB},
|
||||
{"GUI_TIMER",GUI_TIMER},
|
||||
{"GUI_WAVE",GUI_WAVE},
|
||||
{"GUI_SCAN",GUI_SCAN}
|
||||
};
|
||||
#endif /*GUIGROUPS_GBLSOURCE*/
|
||||
|
||||
#endif /*__gui_group_h__*/
|
||||
212
src/dbStatic/link.h
Normal file
212
src/dbStatic/link.h
Normal file
@@ -0,0 +1,212 @@
|
||||
/* link.h */
|
||||
/* base/include $Id$ */
|
||||
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
* Date: 6-1-90
|
||||
*
|
||||
* 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:
|
||||
* -----------------
|
||||
* .01 12-18-91 jba Changed caddr_t to void *
|
||||
* .02 3-16-92 frl changed link.value.value to double
|
||||
* .03 9-9-92 frl added vxi link type
|
||||
* .04 12-13-93 mcn added conversion pointer for fast links
|
||||
* .05 1-10-95 jt added rf_io structure
|
||||
*/
|
||||
|
||||
#include <dbDefs.h>
|
||||
|
||||
/* link types */
|
||||
#ifndef INClinkLT
|
||||
#define INClinkLT
|
||||
#define CONSTANT 0
|
||||
#define PV_LINK 1
|
||||
#define VME_IO 2
|
||||
#define CAMAC_IO 3
|
||||
#define AB_IO 4
|
||||
#define GPIB_IO 5
|
||||
#define BITBUS_IO 6
|
||||
#define DB_LINK 10
|
||||
#define CA_LINK 11
|
||||
#define INST_IO 12 /* instrument */
|
||||
#define BBGPIB_IO 13 /* bitbus -> gpib */
|
||||
#define RF_IO 14
|
||||
#define VXI_IO 15
|
||||
#define LINK_NTYPES 13
|
||||
typedef struct maplinkType{
|
||||
char *strvalue;
|
||||
int value;
|
||||
}maplinkType;
|
||||
|
||||
#ifndef LINK_GBLSOURCE
|
||||
extern maplinkType pamaplinkType[];
|
||||
#else
|
||||
maplinkType pamaplinkType[LINK_NTYPES] = {
|
||||
{"CONSTANT",CONSTANT},
|
||||
{"PV_LINK",PV_LINK},
|
||||
{"VME_IO",VME_IO},
|
||||
{"CAMAC_IO",CAMAC_IO},
|
||||
{"AB_IO",AB_IO},
|
||||
{"GPIB_IO",GPIB_IO},
|
||||
{"BITBUS_IO",BITBUS_IO},
|
||||
{"DB_LINK",DB_LINK},
|
||||
{"CA_LINK",CA_LINK},
|
||||
{"INST_IO",INST_IO},
|
||||
{"BBGPIB_IO",BBGPIB_IO},
|
||||
{"RF_IO",RF_IO},
|
||||
{"VXI_IO",VXI_IO}
|
||||
};
|
||||
#endif /*LINK_GBLSOURCE*/
|
||||
|
||||
#endif /*INClinkLT*/
|
||||
|
||||
#ifndef INClinkh
|
||||
#define INClinkh 1
|
||||
#define INSTIO_FLD_SZ 36 /* field size for instio */
|
||||
#define LINK_PARAM_SZ 32
|
||||
#define VME_PARAM_SZ 32
|
||||
#define AB_PARAM_SZ 28
|
||||
#define CAMAC_PARAM_SZ 26
|
||||
#define VXI_PARAM_SZ 26
|
||||
#define VXIDYNAMIC 0
|
||||
#define VXISTATIC 1
|
||||
|
||||
/* structure of a link to a process variable*/
|
||||
struct pv_link {
|
||||
short process_passive; /* should in/out passive link be processed*/
|
||||
short maximize_sevr; /* maximize sevr of link. stat=LINK_ALARM*/
|
||||
char *pvname;
|
||||
};
|
||||
|
||||
/* structure of a link to a database link */
|
||||
struct db_link {
|
||||
short process_passive; /* should in/out passive link be processed */
|
||||
short maximize_sevr; /* maximize sevr of link. stat=LINK_ALARM */
|
||||
void *pdbAddr; /* pointer to database address structure */
|
||||
long (*conversion)(); /* conversion routine for fast links */
|
||||
};
|
||||
|
||||
/* structure of a VME io channel */
|
||||
struct vmeio {
|
||||
short card;
|
||||
short signal;
|
||||
char parm[VME_PARAM_SZ];
|
||||
};
|
||||
|
||||
/* structure of a CAMAC io channel */
|
||||
struct camacio {
|
||||
short b;
|
||||
short c;
|
||||
short n;
|
||||
short a;
|
||||
short f;
|
||||
char parm[CAMAC_PARAM_SZ];
|
||||
};
|
||||
|
||||
/* structure of a RF io channel */
|
||||
struct rfio {
|
||||
short branch;
|
||||
short cryo;
|
||||
short micro;
|
||||
short dataset;
|
||||
short element;
|
||||
long ext;
|
||||
};
|
||||
|
||||
/* structure of a Allen-Bradley io channel */
|
||||
struct abio {
|
||||
short link;
|
||||
short adapter;
|
||||
short card;
|
||||
short signal;
|
||||
char parm[AB_PARAM_SZ];
|
||||
};
|
||||
|
||||
/* structure of a gpib io channel */
|
||||
struct gpibio {
|
||||
short link;
|
||||
short addr; /* device address */
|
||||
char parm[LINK_PARAM_SZ];
|
||||
};
|
||||
|
||||
/* structure of a bitbus io channel */
|
||||
struct bitbusio {
|
||||
unsigned char link;
|
||||
unsigned char node;
|
||||
unsigned char port;
|
||||
unsigned char signal;
|
||||
char parm[LINK_PARAM_SZ];
|
||||
};
|
||||
|
||||
/* structure of a bitbus to gpib io channel */
|
||||
struct bbgpibio {
|
||||
unsigned char link;
|
||||
unsigned char bbaddr;
|
||||
unsigned char gpibaddr;
|
||||
unsigned char pad;
|
||||
char parm[LINK_PARAM_SZ];
|
||||
};
|
||||
|
||||
/* structure of an instrument io link */
|
||||
struct instio {
|
||||
char string[INSTIO_FLD_SZ]; /* the cat of location.
|
||||
signal.parameter */
|
||||
};
|
||||
|
||||
/* structure of a vxi link */
|
||||
struct vxiio{
|
||||
short flag; /* 0 = frame/slot, 1 = SA */
|
||||
short frame;
|
||||
short slot;
|
||||
short la; /* logical address if flag =1 */
|
||||
short signal;
|
||||
char parm[VXI_PARAM_SZ];
|
||||
};
|
||||
|
||||
/* union of possible address structures */
|
||||
union value{
|
||||
char *constantStr; /*constant string*/
|
||||
struct pv_link pv_link; /* link to process variable*/
|
||||
struct vmeio vmeio; /* vme io point */
|
||||
struct camacio camacio; /* camac io point */
|
||||
struct rfio rfio; /* CEBAF RF buffer interface */
|
||||
struct abio abio; /* allen-bradley io point */
|
||||
struct gpibio gpibio;
|
||||
struct bitbusio bitbusio;
|
||||
struct db_link db_link; /* Data base link */
|
||||
void *ca_link; /* Channel Access link */
|
||||
struct instio instio; /* instrument io link */
|
||||
struct bbgpibio bbgpibio; /* bitbus to gpib io link */
|
||||
struct vxiio vxiio; /* vxi io */
|
||||
};
|
||||
|
||||
struct link{
|
||||
long type;
|
||||
long pad;
|
||||
union value value;
|
||||
};
|
||||
|
||||
typedef struct link DBLINK;
|
||||
#endif
|
||||
79
src/dbStatic/special.h
Normal file
79
src/dbStatic/special.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/* special.h */
|
||||
/* share/epicsH $Id$ */
|
||||
|
||||
/*
|
||||
* Author: Marty Kraimer
|
||||
* Date: 6-1-90
|
||||
*
|
||||
* 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:
|
||||
* -----------------
|
||||
* .01 06-07-91 mrk Cleaned up
|
||||
* .02 03-04-92 jba Added special Hardware Link
|
||||
* .03 07-27-93 mrk Added SPC_ALARMACK
|
||||
* .04 02-09-94 mrk Added SPC_AS
|
||||
*/
|
||||
|
||||
#ifndef INCspecialh
|
||||
#define INCspecialh 1
|
||||
|
||||
/*NOTE Do NOT add aditional definitions with out modifying dbLexRoutines.c */
|
||||
/* types 1-99 are global. Record specific must start with 100 */
|
||||
#define SPC_NOMOD 1 /*Field must not be modified */
|
||||
#define SPC_DBADDR 2 /*db_name_to_addr must call cvt_dbaddr */
|
||||
#define SPC_SCAN 3 /*A scan related field is being changed */
|
||||
#define SPC_ALARMACK 5 /*Special Alarm Acknowledgement*/
|
||||
#define SPC_AS 6 /* Access Security*/
|
||||
/* useful when record support must be notified of a field changing value*/
|
||||
#define SPC_MOD 100
|
||||
/* used by all records that support a reset field */
|
||||
#define SPC_RESET 101 /*The res field is being modified*/
|
||||
/* Specific to conversion (Currently only ai */
|
||||
#define SPC_LINCONV 102 /*A linear conversion field is being changed*/
|
||||
/* Specific to calculation records */
|
||||
#define SPC_CALC 103 /*The CALC field is being changed*/
|
||||
|
||||
|
||||
#define SPC_NTYPES 9
|
||||
typedef struct mapspcType{
|
||||
char *strvalue;
|
||||
int value;
|
||||
}mapspcType;
|
||||
|
||||
#ifndef SPECIAL_GBLSOURCE
|
||||
extern mapspcType pamapspcType[];
|
||||
#else
|
||||
mapspcType pamapspcType[SPC_NTYPES] = {
|
||||
{"SPC_NOMOD",SPC_NOMOD},
|
||||
{"SPC_DBADDR",SPC_DBADDR},
|
||||
{"SPC_SCAN",SPC_SCAN},
|
||||
{"SPC_ALARMACK",SPC_ALARMACK},
|
||||
{"SPC_AS",SPC_AS},
|
||||
{"SPC_MOD",SPC_MOD},
|
||||
{"SPC_RESET",SPC_RESET},
|
||||
{"SPC_LINCONV",SPC_LINCONV},
|
||||
{"SPC_CALC",SPC_CALC}
|
||||
};
|
||||
#endif /*SPECIAL_GBLSOURCE*/
|
||||
|
||||
#endif /*INCspecialh*/
|
||||
Reference in New Issue
Block a user