On Monday 01 May 2006 15:14, Liyu, Andrei wrote:
> It's fine but I have another question :) Both functions read
> file. I wouldn't catch your attention why I need something because it
> is another area of distributed control system. Let say - I need
> function dbLoadRecordsNew( char * records, char * substitutions),
> where records is usual db file.
What is the difference between your dbLoadRecordsNew and dbLoadRecords?
Giving a name for a routine does not necessarily specify its semantics
> I looked into code and was very unhappy. dbLoadRecords comes to
> dbReadDatabase( ... char * filename ...). That was written so far ...
> on yacc (???).
Yes. (Bison, to be accurate, which is the gnu version of yacc).
> Basically, code hasn't comments and isn't
I never had any difficulties understanding the code. I always found it
exceptionally clear and well-written.
> Application Development doesn't give information
> too. I couldn't find function like dbLoadRecordsNew. Is it correct?
Again, that depends on what you expect it should do.
> I thought a little and decided that way to write simple
> dbLoadSingleRecord( char * record) function can be easier (then
> understand dbReadDatabase() )
> I suppose that should be like
> 1. There is global variable DBBASE *pdbase that is root Epics DB.
> (Manual writes that IOC can have some DBs ... = some pdbase. Is it
> So first is allocation DB root dbAllocBase()
If you want to create a completely new database, yes. If you want to add
stuff to an existing database, just use existing pdbbase. Note that
dbAllocBase is currently called by dbLoadDatabase only.
> 2. Each record has entry in pdbase.
> Call DBENTRY * dbAllocEntry(DBBASE *pdbase). That allocates memory
> for entry (!= for record) (?) and link into root.
> 3. Allocate memory for record. Call malloc with according record?
Despite its name, DBENTRY is /not/ an entry in the database. Rather it
is a cursor with which to access a database.
If you look at base/src/dbStatic, there is a routine dbAllocRecord (in
dbStaticRun.c) that you can use to allocate a new record instance.
> 4. Fill record structure
You can use dbPutString for this. Generally, I recommend to look at the
code in base/src/dbStatic. For instance, the code that creates a record
instance is at the end of dbLexRoutines.c
(dbRecordHead,dbRecordField,dbRecordInfo,dbRecordBody). These get
called by the (yacc generated) parser. (You can find which routine gets
called for which syntactical construct by looking at the corresponding
rule in dbYacc.y; a $n argument is the nth token (as a string)
recognized by the rule.) dbRecordField in turn calls dbPutString,
- Who can help with dbLoadRecords()? Liyu, Andrei
- Navigate by Date:
Re: Digitizer needed for LCLS Till Straumann
Re: Digitizer needed for LCLS Peter Milne
- Navigate by Thread:
Who can help with dbLoadRecords()? Liyu, Andrei
Digitizer needed for LCLS Steve Lewis