/* 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; }