%{ /*************************************************************************\ * Copyright (c) 2006 UChicago, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ #include #include #include #include #include "osiUnistd.h" #include "macLib.h" #include "dbAccess.h" #include "dbmf.h" #include "epicsVersion.h" #define epicsExportSharedSymbols #include "dbLoadTemplate.h" static int line_num; static int yyerror(); #define VAR_MAX_VAR_STRING 5000 #define VAR_MAX_VARS 100 static char *sub_collect = NULL; static char** vars = NULL; static char* db_file_name = NULL; static int var_count,sub_count; %} %start template %token WORD QUOTE %token DBFILE %token PATTERN %token EQUALS COMMA %left O_PAREN C_PAREN %left O_BRACE C_BRACE %union { int Int; char Char; char *Str; double Real; } %% template: templs | subst ; templs: templs templ | templ ; templ: templ_head O_BRACE subst C_BRACE | templ_head { if(db_file_name) dbLoadRecords(db_file_name,NULL); else fprintf(stderr,"Error: no db file name given\n"); } ; templ_head: DBFILE WORD { var_count=0; if(db_file_name) dbmfFree(db_file_name); db_file_name = dbmfMalloc(strlen($2)+1); strcpy(db_file_name,$2); dbmfFree($2); } | DBFILE QUOTE { var_count=0; if(db_file_name) dbmfFree(db_file_name); db_file_name = dbmfMalloc(strlen($2)+1); strcpy(db_file_name,$2); dbmfFree($2); } ; subst: PATTERN pattern subs | PATTERN pattern | var_subs ; pattern: O_BRACE vars C_BRACE { #ifdef ERROR_STUFF int i; for(i=0;i