From bac913254cd6ce77ab67ddf06c2dfbdc7d477541 Mon Sep 17 00:00:00 2001 From: zimoch Date: Thu, 14 Apr 2005 11:25:49 +0000 Subject: [PATCH] add breakpoint tabled to menu convert --- updateMenuConvert.c | 89 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 updateMenuConvert.c diff --git a/updateMenuConvert.c b/updateMenuConvert.c new file mode 100644 index 0000000..91d440e --- /dev/null +++ b/updateMenuConvert.c @@ -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 +#include +#include +#include + +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; inChoice; 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; inChoice; i++) + { + papChoiceName[i] = menuConvert->papChoiceName[i]; + papChoiceValue[i] = menuConvert->papChoiceValue[i]; + } + for (; iname; + 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; +}