forked from epics_driver_modules/require
add breakpoint tabled to menu convert
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
/* updateMenuConvert.c
|
||||
*
|
||||
* add all breakpoint tables found on this ioc
|
||||
* to the menu convert (used by LINR field)
|
||||
*
|
||||
* $Author: zimoch $
|
||||
*
|
||||
* $Log: updateMenuConvert.c,v $
|
||||
* Revision 1.1 2005/04/14 11:25:49 zimoch
|
||||
* add breakpoint tabled to menu convert
|
||||
*
|
||||
*/
|
||||
|
||||
#include <dbStaticLib.h>
|
||||
#include <string.h>
|
||||
#include <ellLib.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
extern DBBASE *pdbbase;
|
||||
|
||||
typedef struct node {
|
||||
ELLNODE node;
|
||||
char *name;
|
||||
char *value;
|
||||
} node;
|
||||
|
||||
int epicsShareAPI updateMenuConvert ()
|
||||
{
|
||||
brkTable *pbrkTable;
|
||||
dbMenu *menuConvert;
|
||||
ELLLIST missing;
|
||||
node *pbtable;
|
||||
int l, i, found, nChoice;
|
||||
char **papChoiceName;
|
||||
char **papChoiceValue;
|
||||
|
||||
menuConvert = dbFindMenu(pdbbase,"menuConvert");
|
||||
ellInit(&missing);
|
||||
for(pbrkTable = (brkTable *)ellFirst(&pdbbase->bptList);
|
||||
pbrkTable;
|
||||
pbrkTable = (brkTable *)ellNext(&pbrkTable->node))
|
||||
{
|
||||
found=0;
|
||||
for(i=0; i<menuConvert->nChoice; i++)
|
||||
{
|
||||
if (strcmp(menuConvert->papChoiceValue[i],pbrkTable->name)==0)
|
||||
{
|
||||
found=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
pbtable = dbCalloc(1,sizeof(struct node));
|
||||
l=strlen(pbrkTable->name);
|
||||
pbtable->name = dbCalloc(l+12,1);
|
||||
pbtable->value = dbCalloc(l+1,1);
|
||||
strcpy(pbtable->name, "menuConvert");
|
||||
strcpy(pbtable->name+11, pbrkTable->name);
|
||||
strcpy(pbtable->value, pbrkTable->name);
|
||||
ellAdd(&missing, &pbtable->node);
|
||||
}
|
||||
}
|
||||
if (ellCount(&missing))
|
||||
{
|
||||
nChoice = menuConvert->nChoice + ellCount(&missing);
|
||||
|
||||
papChoiceName=dbCalloc(nChoice,sizeof(char*));
|
||||
papChoiceValue=dbCalloc(nChoice,sizeof(char*));
|
||||
for (i=0; i<menuConvert->nChoice; i++)
|
||||
{
|
||||
papChoiceName[i] = menuConvert->papChoiceName[i];
|
||||
papChoiceValue[i] = menuConvert->papChoiceValue[i];
|
||||
}
|
||||
for (; i<nChoice; i++)
|
||||
{
|
||||
pbtable = (node*)ellFirst(&missing);
|
||||
papChoiceName[i] = pbtable->name;
|
||||
papChoiceValue[i] = pbtable->value;
|
||||
ellDelete(&missing, &pbtable->node);
|
||||
}
|
||||
free(menuConvert->papChoiceName);
|
||||
free(menuConvert->papChoiceValue);
|
||||
menuConvert->papChoiceName=papChoiceName;
|
||||
menuConvert->papChoiceValue=papChoiceValue;
|
||||
menuConvert->nChoice = nChoice;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user