1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 <2022> 2023 2024 2025 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 <2022> 2023 2024 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: Questions from the Static Database Access chapter of the Application Developer's Guide |
From: | "Wang, Andrew via Tech-talk" <tech-talk at aps.anl.gov> |
To: | EPICS tech-talk <tech-talk at aps.anl.gov> |
Date: | Thu, 3 Feb 2022 18:55:47 +0000 |
Hi Andrew, Thank you for asking and sorry for the inconvenience. My answer is two-fold, one being general and the other more specific. The first part is that after using EPICS for almost a year now, I am now curious about the API and hope to leverage its capabilities for future work that may arise in
my project at LLNL. I enjoy utilizing functions that are already available rather than having to duplicate work, which would lead to longer and unnecessary development time. The second part is that I am effectively wanting to create a way of parsing record instance files, replacing the macros with the appropriate text, and storing that information in my documentation. Ideally, I would like to update that documentation
with the most recent record instances every time I run make. My goal was to use dbNextRecord, dbGetRecordName, etc. to do that, however I encountered some issues with DBBASE. Thanks, Andy From: Wang, Andrew Hi Andrew, Thank you for asking and sorry for the inconvenience. My answer is two-fold, one being general and the other more specific. The first part is that after using EPICS for almost a year now, I am now curious about the API and hope to leverage its capabilities for future work that may arise in
my project at LLNL. I enjoy utilizing functions that are already available rather than having to duplicate work, which would lead to longer and unnecessary development time. The second part is that I am effectively wanting to create a way of parsing record instance files, replacing the macros with the appropriate text, and storing that information in my documentation. Ideally, I would like to update that documentation
with the most recent record instances every time I run make. My goal was to use dbNextRecord, dbGetRecordName, etc. to do that, however I encountered some issues with DBBASE. Thank you and I look forward to hearing back from you, Andy From: Andrew Johnson <anj at anl.gov>
Hi Andy, Are you trying to create your own program to edit or create db files? If you could explain what you want to do you might get better answers for your overall goal instead of our just pointing you to the path to another local maximum which might not get you
to where you're trying to get. We have not been updating the AppDevGuide for quite a few years now and it is now getting very out of date, although the reference sections are mostly still applicable. To answer your specific issue, yes you need to define a record type before you can load or create an instance of it using the dbStatic API, usually by loading a DBD file. If you wanted to set the DTYP field of that ao record, you would also need to have
loaded the device() definition which provides the specific choice for the ao record type. This requirement to define before use applies to any objects that the dbStatic API can manipulate.
Unfortunately I may have misled you earlier — it is no longer easy to use recent versions of this code outside of the IOC. Earlier versions of the library had two implementations of the routines that read and write record field values, one for the IOC to
use, and one for design tools that implemented record instances as an array of strings, one for each field. The IOC implementation is the only one left in Base now, and it requires that the structure of the record type (i.e. the sizes and offsets to all of
its fields) be known before a record instance can be created. The size & offset data is provided by the record type's implementation in a routine which is emitted into the generated *Record.h header file; for the ao record it's called aoRecordSizeOffset() and is run by the registrar routine. That means you can't write
a generic application which can manipulate any record type using the dbStatic API, your code must have been linked with object files compiled for each of the record types you want to load. The code fragments given in the (now old and not replaced) AppDevGuide haven't been updated or tested in a very long time, and they don't provide the full picture or the current status of the code. I think they could be made to work if you ran them inside
a suitably initialized IOC, but the dbStatic API isn't the best way to manipulate DBD and DB files any more. So, what are you trying to accomplish? The community can probably help you (there are newer ways to create DB files programmatically), but we need to see the bigger picture to give you suitable advice. - Andrew On 2/2/22 4:27 PM, Wang, Andrew wrote:
-- Complexity comes for free, Simplicity you have to work for. |