change pdbBase to pdbbase

This commit is contained in:
Marty Kraimer
1995-12-01 16:59:24 +00:00
parent e113a5bed2
commit 2b7d67509e
10 changed files with 87 additions and 90 deletions

View File

@@ -72,7 +72,7 @@ DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000).
#include <subRecord.h>
#include <task_params.h>
extern struct dbBase *pdbBase;
extern struct dbBase *pdbbase;
static FILE *stream;
#define BUF_SIZE 100
@@ -106,7 +106,7 @@ static long asDbAddRecords(void)
long status;
dbCommon *precord;
dbInitEntry(pdbBase,pdbentry);
dbInitEntry(pdbbase,pdbentry);
status = dbFirstRecdes(pdbentry);
while(!status) {
status = dbFirstRecord(pdbentry);

View File

@@ -31,26 +31,21 @@ DBBASE *pdbbase = NULL;
int main(int argc,char **argv)
{
long status;
FILE *fp;
int i;
if(argc!=3) {
printf("usage: dbAsciiExpand infile outfile\n");
if(argc<2) {
printf("usage: dbAsciiExpand file1.ascii fi;e2.ascii ...\n");
exit(0);
}
status = dbAsciiRead(&pdbbase,argv[1]);
fp = fopen(argv[2],"w");
if(!fp) {
errMessage(0,argv[2]);
return(-1);
}
dbWriteMenu(pdbbase,fp,0);
dbWriteRecDes(pdbbase,fp,0);
dbWriteDevice(pdbbase,fp);
dbWriteDriver(pdbbase,fp);
status = fclose(fp);
if(!fp) {
errMessage(0,argv[2]);
return(-1);
for(i=1; i<argc; i++) {
status = dbAsciiRead(&pdbbase,argv[i]);
if(!status) continue;
epicsPrintf("For input file %s",argv[i]);
errMessage(status,"from dbAsciiInitialize");
}
dbWriteMenu(pdbbase,0);
dbWriteRecDes(pdbbase,0);
dbWriteDevice(pdbbase);
dbWriteDriver(pdbbase);
return(0);
}

View File

@@ -296,18 +296,18 @@ static void dbAsciiIncludeNew(char *filename)
}
strcat(currentPath,filename);
fp = fopen(currentPath,"r");
if(!fp) {
if(!fp) { /*Try preceeding path with ./rec */
newCurrentPath = dbCalloc(
(strlen("./base/rec/") + strlen(currentPath) + 1),sizeof(char));
strcpy(newCurrentPath,"./base/rec/");
(strlen("./rec/") + strlen(currentPath) + 1),sizeof(char));
strcpy(newCurrentPath,"./rec/");
strcat(newCurrentPath,currentPath);
fp = fopen(newCurrentPath,"r");
free((void *)newCurrentPath);
}
if(!fp) {
if(!fp) { /*Try preceeding path with ./base/rec */
newCurrentPath = dbCalloc(
(strlen("./rec/") + strlen(currentPath) + 1),sizeof(char));
strcpy(newCurrentPath,"./rec/");
(strlen("./base/rec/") + strlen(currentPath) + 1),sizeof(char));
strcpy(newCurrentPath,"./base/rec/");
strcat(newCurrentPath,currentPath);
fp = fopen(newCurrentPath,"r");
free((void *)newCurrentPath);

View File

@@ -42,6 +42,7 @@ int main(int argc,char **argv)
fprintf(stderr,"usage: dbAsciiToMenuH file.ascii\n");
exit(-1);
}
/*remove path so that outFile is created where program is executed*/
plastSlash = strrchr(argv[1],'/');
plastSlash = (plastSlash ? plastSlash+1 : argv[1]);
outFilename = dbCalloc(1,strlen(plastSlash)+1);

View File

@@ -45,6 +45,7 @@ int main(int argc,char **argv)
fprintf(stderr,"usage: dbAsciiToMenuH file.ascii\n");
exit(-1);
}
/*remove path so that outFile is created where program is executed*/
plastSlash = strrchr(argv[1],'/');
plastSlash = (plastSlash ? plastSlash+1 : argv[1]);
outFilename = dbCalloc(1,strlen(plastSlash)+1);

View File

@@ -84,7 +84,7 @@ static unsigned short hash( char *pname, int length)
return((ind1<<dbPvdHashTableShift) ^ ind0);
}
int dbPvdTableSize(DBBASE *pdbBase,int size)
int dbPvdTableSize(DBBASE *pdbbase,int size)
{
int i;
@@ -100,7 +100,7 @@ int dbPvdTableSize(DBBASE *pdbBase,int size)
}
void dbPvdInitPvt(dbBase *pdbBase)
void dbPvdInitPvt(dbBase *pdbbase)
{
ELLLIST **ppvd;
int i;
@@ -115,14 +115,14 @@ void dbPvdInitPvt(dbBase *pdbBase)
}
}
ppvd = dbCalloc(dbPvdHashTableSize, sizeof(ELLLIST *));
pdbBase->ppvd = (void *) ppvd;
pdbbase->ppvd = (void *) ppvd;
return;
}
PVDENTRY *dbPvdFind(dbBase *pdbBase,char *name,int lenName)
PVDENTRY *dbPvdFind(dbBase *pdbbase,char *name,int lenName)
{
unsigned short hashInd;
ELLLIST **ppvd = (ELLLIST **) pdbBase->ppvd;
ELLLIST **ppvd = (ELLLIST **) pdbbase->ppvd;
ELLLIST *pvdlist;
PVDENTRY *ppvdNode;
@@ -137,10 +137,10 @@ PVDENTRY *dbPvdFind(dbBase *pdbBase,char *name,int lenName)
return (NULL);
}
PVDENTRY *dbPvdAdd(dbBase *pdbBase,dbRecDes *precdes,dbRecordNode *precnode)
PVDENTRY *dbPvdAdd(dbBase *pdbbase,dbRecDes *precdes,dbRecordNode *precnode)
{
unsigned short hashInd;
ELLLIST **ppvd = (ELLLIST **) pdbBase->ppvd;
ELLLIST **ppvd = (ELLLIST **) pdbbase->ppvd;
ELLLIST *ppvdlist;
PVDENTRY *ppvdNode;
int lenName;
@@ -165,11 +165,11 @@ PVDENTRY *dbPvdAdd(dbBase *pdbBase,dbRecDes *precdes,dbRecordNode *precnode)
return (ppvdNode);
}
void dbPvdDelete(dbBase *pdbBase,dbRecordNode *precnode)
void dbPvdDelete(dbBase *pdbbase,dbRecordNode *precnode)
{
char *name=precnode->recordname;
unsigned short hashInd;
ELLLIST **ppvd = (ELLLIST **) pdbBase->ppvd;
ELLLIST **ppvd = (ELLLIST **) pdbbase->ppvd;
ELLLIST *ppvdlist;
PVDENTRY *ppvdNode;
int lenName;
@@ -191,10 +191,10 @@ void dbPvdDelete(dbBase *pdbBase,dbRecordNode *precnode)
return;
}
void dbPvdFreeMem(dbBase *pdbBase)
void dbPvdFreeMem(dbBase *pdbbase)
{
unsigned short hashInd;
ELLLIST **ppvd = (ELLLIST **) pdbBase->ppvd;
ELLLIST **ppvd = (ELLLIST **) pdbbase->ppvd;
ELLLIST *ppvdlist;
PVDENTRY *ppvdNode;
PVDENTRY *next;
@@ -215,10 +215,10 @@ void dbPvdFreeMem(dbBase *pdbBase)
free((void *)ppvd);
}
void dbPvdDump(dbBase *pdbBase,int verbose)
void dbPvdDump(dbBase *pdbbase,int verbose)
{
unsigned short hashInd;
ELLLIST **ppvd = (ELLLIST **) pdbBase->ppvd;
ELLLIST **ppvd = (ELLLIST **) pdbbase->ppvd;
ELLLIST *ppvdlist;
PVDENTRY *ppvdNode;
int number;

View File

@@ -469,14 +469,14 @@ long dbWriteRecords(DBBASE *pdbbase,FILE *fp,char *precdesname,int level)
return(0);
}
void dbWriteMenu(DBBASE *pdbbase,FILE *fp,char *menuName)
void dbWriteMenu(DBBASE *pdbbase,char *menuName)
{
dbMenu *pdbMenu;
int gotMatch;
int i;
if(!pdbbase) {
printf("pdbBase not specified\n");
printf("pdbbase not specified\n");
return;
}
pdbMenu = (dbMenu *)ellFirst(&pdbbase->menuList);
@@ -487,19 +487,19 @@ void dbWriteMenu(DBBASE *pdbbase,FILE *fp,char *menuName)
gotMatch=TRUE;
}
if(gotMatch) {
fprintf(fp,"menu(%s) {\n",pdbMenu->name);
fprintf(stdout,"menu(%s) {\n",pdbMenu->name);
for(i=0; i<pdbMenu->nChoice; i++) {
fprintf(fp,"\tchoice(%s,\"%s\")\n",pdbMenu->papChoiceName[i],
fprintf(stdout,"\tchoice(%s,\"%s\")\n",pdbMenu->papChoiceName[i],
pdbMenu->papChoiceValue[i]);
}
fprintf(fp,"}\n");
fprintf(stdout,"}\n");
if(menuName) break;
}
pdbMenu = (dbMenu *)ellNext(&pdbMenu->node);
}
}
void dbWriteRecDes(DBBASE *pdbbase,FILE *fp,char *recdesName)
void dbWriteRecDes(DBBASE *pdbbase,char *recdesName)
{
dbRecDes *pdbRecDes;
dbFldDes *pdbFldDes;
@@ -507,7 +507,7 @@ void dbWriteRecDes(DBBASE *pdbbase,FILE *fp,char *recdesName)
int i;
if(!pdbbase) {
printf("pdbBase not specified\n");
printf("pdbbase not specified\n");
return;
}
for(pdbRecDes = (dbRecDes *)ellFirst(&pdbbase->recDesList);
@@ -518,27 +518,27 @@ void dbWriteRecDes(DBBASE *pdbbase,FILE *fp,char *recdesName)
gotMatch=TRUE;
}
if(!gotMatch) continue;
fprintf(fp,"recordtype(%s) {\n",pdbRecDes->name);
fprintf(stdout,"recordtype(%s) {\n",pdbRecDes->name);
for(i=0; i<pdbRecDes->no_fields; i++) {
int j;
pdbFldDes = pdbRecDes->papFldDes[i];
fprintf(fp,"\tfield(%s,",pdbFldDes->name);
fprintf(stdout,"\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);
else
fprintf(fp,"%s) {\n",pamapdbfType[j].strvalue);
fprintf(stdout,"%s) {\n",pamapdbfType[j].strvalue);
if(pdbFldDes->prompt)
fprintf(fp,"\t\tprompt(\"%s\")\n",pdbFldDes->prompt);
fprintf(stdout,"\t\tprompt(\"%s\")\n",pdbFldDes->prompt);
if(pdbFldDes->initial)
fprintf(fp,"\t\tinitial(\"%s\")\n",pdbFldDes->initial);
fprintf(stdout,"\t\tinitial(\"%s\")\n",pdbFldDes->initial);
if(pdbFldDes->promptgroup) {
for(j=0; j<GUI_NTYPES; j++) {
if(pamapguiGroup[j].value == pdbFldDes->promptgroup) {
fprintf(fp,"\t\tpromptgroup(%s)\n",
fprintf(stdout,"\t\tpromptgroup(%s)\n",
pamapguiGroup[j].strvalue);
break;
}
@@ -547,44 +547,44 @@ void dbWriteRecDes(DBBASE *pdbbase,FILE *fp,char *recdesName)
if(pdbFldDes->special) {
for(j=0; j<SPC_NTYPES; j++) {
if(pamapspcType[j].value == pdbFldDes->special) {
fprintf(fp,"\t\tspecial(%s)\n",
fprintf(stdout,"\t\tspecial(%s)\n",
pamapspcType[j].strvalue);
break;
}
}
}
if(pdbFldDes->extra)
fprintf(fp,"\t\textra(\"%s\")\n",pdbFldDes->extra);
fprintf(stdout,"\t\textra(\"%s\")\n",pdbFldDes->extra);
if(pdbFldDes->field_type==DBF_MENU) {
if(pdbFldDes->ftPvt)
fprintf(fp,"\t\tmenu(%s)\n",
fprintf(stdout,"\t\tmenu(%s)\n",
((dbMenu *)pdbFldDes->ftPvt)->name);
else
printf("\t\t menu: NOT FOUND\n");
}
if(pdbFldDes->field_type==DBF_STRING) {
fprintf(fp,"\t\tsize(%d)\n",
fprintf(stdout,"\t\tsize(%d)\n",
pdbFldDes->size);
}
if(pdbFldDes->process_passive) fprintf(fp,"\t\tpp(TRUE)\n");
if(pdbFldDes->base) fprintf(fp,"\t\tbase(HEX)\n");
if(pdbFldDes->process_passive) fprintf(stdout,"\t\tpp(TRUE)\n");
if(pdbFldDes->base) fprintf(stdout,"\t\tbase(HEX)\n");
if(pdbFldDes->interest)
fprintf(fp,"\t\tinterest(%d)\n",pdbFldDes->interest);
if(!pdbFldDes->as_level) fprintf(fp,"\t\tasl(ASL0)\n");
fprintf(fp,"\t}\n");
fprintf(stdout,"\t\tinterest(%d)\n",pdbFldDes->interest);
if(!pdbFldDes->as_level) fprintf(stdout,"\t\tasl(ASL0)\n");
fprintf(stdout,"\t}\n");
}
fprintf(fp,"}\n");
fprintf(stdout,"}\n");
if(recdesName) break;
}
}
void dbWriteDevice(DBBASE *pdbbase,FILE *fp)
void dbWriteDevice(DBBASE *pdbbase)
{
dbRecDes *pdbRecDes;
devSup *pdevSup;
if(!pdbbase) {
printf("pdbBase not specified\n");
printf("pdbbase not specified\n");
return;
}
for(pdbRecDes = (dbRecDes *)ellFirst(&pdbbase->recDesList);
@@ -597,10 +597,10 @@ void dbWriteDevice(DBBASE *pdbbase,FILE *fp)
if(pamaplinkType[j].value==pdevSup->link_type) break;
}
if(j>=LINK_NTYPES) {
fprintf(fp,"link_type not valid\n");
fprintf(stdout,"link_type not valid\n");
continue;
}
fprintf(fp,"device(%s,%s,%s,\"%s\")\n",
fprintf(stdout,"device(%s,%s,%s,\"%s\")\n",
pdbRecDes->name,
pamaplinkType[j].strvalue,
pdevSup->name,pdevSup->choice);
@@ -608,17 +608,17 @@ void dbWriteDevice(DBBASE *pdbbase,FILE *fp)
}
}
void dbWriteDriver(DBBASE *pdbbase,FILE *fp)
void dbWriteDriver(DBBASE *pdbbase)
{
drvSup *pdrvSup;
if(!pdbbase) {
printf("pdbBase not specified\n");
printf("pdbbase not specified\n");
return;
}
for(pdrvSup = (drvSup *)ellFirst(&pdbbase->drvList);
pdrvSup; pdrvSup = (drvSup *)ellNext(&pdrvSup->node)) {
fprintf(fp,"driver(%s)\n",pdrvSup->name);
fprintf(stdout,"driver(%s)\n",pdrvSup->name);
}
}
@@ -1703,20 +1703,20 @@ char *dbGetRange(DBENTRY *pdbentry)
return (message);
}
brkTable *dbFindBrkTable(dbBase *pdbBase,char *name)
brkTable *dbFindBrkTable(dbBase *pdbbase,char *name)
{
GPHENTRY *pgph;
pgph = gphFind(pdbBase->pgpHash,name,(void *)&pdbBase->bptList);
pgph = gphFind(pdbbase->pgpHash,name,(void *)&pdbbase->bptList);
if(!pgph) return(NULL);
return((brkTable *)pgph->userPvt);
}
dbMenu *dbFindMenu(dbBase *pdbBase,char *name)
dbMenu *dbFindMenu(dbBase *pdbbase,char *name)
{
GPHENTRY *pgph;
pgph = gphFind(pdbBase->pgpHash,name,(void *)&pdbBase->menuList);
pgph = gphFind(pdbbase->pgpHash,name,(void *)&pdbbase->menuList);
if(!pgph) return(NULL);
return((dbMenu *)pgph->userPvt);
}
@@ -2484,7 +2484,7 @@ void dbDumpMenu(DBBASE *pdbbase,char *menuName)
int i;
if(!pdbbase) {
printf("pdbBase not specified\n");
printf("pdbbase not specified\n");
return;
}
pdbMenu = (dbMenu *)ellFirst(&pdbbase->menuList);
@@ -2515,7 +2515,7 @@ void dbDumpRecDes(DBBASE *pdbbase,char *recdesName)
int i;
if(!pdbbase) {
printf("pdbBase not specified\n");
printf("pdbbase not specified\n");
return;
}
for(pdbRecDes = (dbRecDes *)ellFirst(&pdbbase->recDesList);
@@ -2556,7 +2556,7 @@ void dbDumpFldDes(DBBASE *pdbbase,char *recdesName,char *fname)
int i;
if(!pdbbase) {
printf("pdbBase not specified\n");
printf("pdbbase not specified\n");
return;
}
for(pdbRecDes = (dbRecDes *)ellFirst(&pdbbase->recDesList);
@@ -2634,7 +2634,7 @@ void dbDumpDevice(DBBASE *pdbbase,char *recdesName)
int gotMatch;
if(!pdbbase) {
printf("pdbBase not specified\n");
printf("pdbbase not specified\n");
return;
}
for(pdbRecDes = (dbRecDes *)ellFirst(&pdbbase->recDesList);
@@ -2662,7 +2662,7 @@ void dbDumpDriver(DBBASE *pdbbase)
drvSup *pdrvSup;
if(!pdbbase) {
printf("pdbBase not specified\n");
printf("pdbbase not specified\n");
return;
}
for(pdrvSup = (drvSup *)ellFirst(&pdbbase->drvList);
@@ -2674,7 +2674,7 @@ void dbDumpDriver(DBBASE *pdbbase)
void dbDumpRecords(dbBase *pdbbase,char *precdesname,int levl)
{
if(!pdbbase) {
printf("pdbBase not specified\n");
printf("pdbbase not specified\n");
return;
}
dbWriteRecords(pdbbase,stdout,precdesname,levl);

View File

@@ -54,11 +54,11 @@ typedef struct{
dbRecDes *precdes;
dbRecordNode *precnode;
}PVDENTRY;
int dbPvdTableSize(DBBASE *pdbBase,int size);
void dbPvdInitPvt(DBBASE *pdbBase);
PVDENTRY *dbPvdFind(DBBASE *pdbBase,char *name,int lenname);
PVDENTRY *dbPvdAdd(DBBASE *pdbBase,dbRecDes *precdes,dbRecordNode *precnode);
void dbPvdDelete(DBBASE *pdbBase,dbRecordNode *precnode);
void dbPvdFreeMem(DBBASE *pdbBase);
void dbPvdDump(DBBASE *pdbBase,int verbose);
int dbPvdTableSize(DBBASE *pdbbase,int size);
void dbPvdInitPvt(DBBASE *pdbbase);
PVDENTRY *dbPvdFind(DBBASE *pdbbase,char *name,int lenname);
PVDENTRY *dbPvdAdd(DBBASE *pdbbase,dbRecDes *precdes,dbRecordNode *precnode);
void dbPvdDelete(DBBASE *pdbbase,dbRecordNode *precnode);
void dbPvdFreeMem(DBBASE *pdbbase);
void dbPvdDump(DBBASE *pdbbase,int verbose);
#endif /*INCdbStaticPvth*/

View File

@@ -15,7 +15,7 @@
#include <symLib.h>
#include <dbStaticLib.h>
extern struct dbBase *pdbBase;
extern struct dbBase *pdbbase;
#else
#include <sys/time.h>
@@ -193,7 +193,7 @@ static void handle_reclist(BS* bs)
unsigned long names_len;
int s;
dbInitEntry(pdbBase,&db);
dbInitEntry(pdbbase,&db);
names_len=0;
for(rc=dbFirstRecdes(&db);rc==0;rc=dbNextRecdes(&db))

View File

@@ -65,7 +65,7 @@ static void sub_pvname(char*,char*);
#ifdef vxWorks
static DBENTRY* pdbentry;
extern struct dbBase *pdbBase;
extern struct dbBase *pdbbase;
#endif
%}
@@ -243,7 +243,7 @@ int dbLoadRecords(char* pfilename, char* pattern)
DB_APP_NODE* an;
#ifdef vxWorks
if(pdbBase==NULL)
if(pdbbase==NULL)
{
fprintf(stderr,"dbLoadRecords: default.dctsdr file not loaded\n");
return -1;
@@ -275,7 +275,7 @@ int dbLoadRecords(char* pfilename, char* pattern)
}
#ifdef vxWorks
pdbentry=dbAllocEntry(pdbBase);
pdbentry=dbAllocEntry(pdbbase);
#endif
yyparse();