EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: ???registrar(function_name)
From: Tim Mooney <[email protected]>
To: [email protected]
Cc: "Liyu, Andrei" <[email protected]>
Date: Fri, 08 Apr 2005 05:55:52 -0500
Andrew Johnson wrote:
Liyu, Andrei wrote:

    As I understand Application Developer's Guide 6.8 I can register
function and call it from iocsh (ioc shell).

    Ok. I build IOC (windows, epics 3.14.7, MVC++.NET) from example
template. Start it ... get

">epics"
type "asSub" or "asSub()"

and read
"command asSub not found"

What is wrong?


A registrar(function) entry in a DBD file does not automatically register a command with the IOC shell itself, it just arranges for the named function to be called during the IOC's startup process. The registrar function can then perform any actions you wish to take place at that time, including registering new iocsh commands (for which you have to provide additional information in C code).

See the various files in the <base>/src/iocsh/ directory for examples of the command tables and the related call to iocshRegister() that you have to make to add a new command. We really should have an example of how to do all this in the example template, but we don't appear to at present.

There are tons of examples in synApps. Here's an excerpt from save_restore.c:


#include <epicsExport.h>
#include <iocsh.h>
...
int request_manual_restore(char *filename, int file_type); {
<code that implements the function>
}
...
IOCSH_ARG request_manual_restore_Arg0 = {"filename",iocshArgString};
IOCSH_ARG request_manual_restore_Arg1 = {"file_type",iocshArgInt};
IOCSH_ARG_ARRAY request_manual_restore_Args[2] = {&request_manual_restore_Arg0,&request_manual_restore_Arg1};
IOCSH_FUNCDEF request_manual_restore_FuncDef = {"request_manual_restore",2,request_manual_restore_Args};
static void request_manual_restore_CallFunc(const iocshArgBuf *args) {request_manual_restore(args[0].sval,args[1].iva
...
void save_restoreRegister(void)
{
...
iocshRegister(&request_manual_restore_FuncDef,
request_manual_restore_CallFunc);
...
}


epicsExportRegistrar(save_restoreRegister);

-------------------

The .dbd file specifies the registrar function as follows:

registrar(save_restoreRegister)

--
Tim Mooney ([email protected]; 630-252-5417)
Advanced Photon Source
APS Operations Division
Beamline Controls & Data Acquisition Group


References:
???registrar(function_name) Liyu, Andrei
Re: ???registrar(function_name) Andrew Johnson

Navigate by Date:
Prev: Re: building libraries from only objs and libs in 3.14 Benjamin Franksen
Next: Re: Arbitrary Function Generator Steven Hartman
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: ???registrar(function_name) Andrew Johnson
Next: Re: Arbitrary Function Generator Steven Hartman
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·