%{ /************************************************************************** * * Author: Jim Kowalkowski * * Experimental Physics and Industrial Control System (EPICS) * * Copyright 1991, the Regents of the University of California, * and the University of Chicago Board of Governors. * * This software was produced under U.S. Government contracts: * (W-7405-ENG-36) at the Los Alamos National Laboratory, * and (W-31-109-ENG-38) at Argonne National Laboratory. * * Initial development by: * The Controls and Automation Group (AT-8) * Ground Test Accelerator * Accelerator Technology Division * Los Alamos National Laboratory * * Co-developed with * The Controls and Computing Group * Accelerator Systems Division * Advanced Photon Source * Argonne National Laboratory * * Modification Log: * ----------------- * .01 10-29-93 jbk initial version * ***********************************************************************/ #include #include #include #include #include "macLib.h" #include "dbmf.h" #include "epicsVersion.h" /* amazing, but true, WRS Tornado II defines _WIN32 ! */ #if !(defined(vxWorks) && defined(_WIN32) #include "getopt.h" #endif static int line_num; static int yyerror(); int dbLoadTemplate(char* sub_file); int dbLoadRecords(char* pfilename, char* pattern); #define VAR_MAX_VAR_STRING 5000 #define VAR_MAX_VARS 100 static char *sub_collect = NULL; static MAC_HANDLE *macHandle = 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 %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); } ; subst: PATTERN pattern subs | PATTERN pattern | var_subs ; pattern: O_BRACE vars C_BRACE { #ifdef ERROR_STUFF int i; for(i=0;i