Experimental Physics and
| |||||||||||||||||
|
The IOC's parser is written in flex and antelope (BSD-licensed versions of lex and yacc), the code for which you can find in base/src/dbStatic. Note that you need to parse a DBD file (to define the record types, fields, menu selections etc.) before you can completely understand a DB file. However rather than directly grabbing and trying to use our lex and yacc files I would strongly recommend that you make use of the dbStaticLib library API which permits you to load, manipulate and save DBD and DB files; if you stick with the dbStatic API (documented in Chapter 14 of the EPICS IOC Application Developer's Guide) you're more protected against future changes to the syntax of the DB and DBD files. O let me explain. I want to make some sort of .db file pre-processor that can do some modifications. Mainly macro expansion type stuff. And this I want to use so that some rule stuff can be written in Macro's and not in long complex records and hopefully make it easier to maintain and understand and change. And then maybe also handle some other stuff with the pre-processor to keep thing consistently linked ect... making it more reliable and less prone to human error. Plus the person working with it might not fully understand all the internal stuff of 'n db. I'm going to assume that you're aware of the dbLoadTemplate() facilties of the IOC, and I'd be interested to hear what you need beyond what that already provides. I want to try and stop you from reinventing the wheel unnecessarily, but I'm not saying that what we have is comprehensive. You should also be aware of the EPICS Extension MSI (Macro Substitution and Include) which implements dbLoadTemplate() expansion on a host machine and may speed up IOC boot time if you have lots of templates and macros to instantiate. If you haven't already done so, have a look at the template facilities provided by VDCT. Their use may not be completely obvious (and you should ignore the "grouping" features which are not useful) but they provide the ability to create template hierarchies and instantiate them. VDCT really is the best way to design complex databases at least for anyone from an electronics background who is used to schematic diagrams. In the language of the VDCT template expansion stuff, "macros" pass instance information from a parent to a child template, while "ports" pass information from a child to its parent; the "information" I'm talking about here are macro strings and are not directly related to database links although they will often be expanded in them. It is also relatively easy to write a DB file parser in modern scripting languages such as Perl and Python, but it is also easy to omit some obscure pieces of the syntax. You should be aware that future major releases of Base will probably replace the 'C' dbStatic library with tools written in Perl (which will have a similar Perl library for manipulating the underlying data). HTH, - Andrew -- When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong. -- Arthur C. Clarke
| ||||||||||||||||
ANJ, 10 Nov 2011 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing · |