function replaced by registrar

This commit is contained in:
Marty Kraimer
2003-03-21 19:41:50 +00:00
parent 57a22dab4d
commit e808742fe1
14 changed files with 96 additions and 66 deletions
+4 -4
View File
@@ -17,8 +17,9 @@ LIBRARY_IOC += _APPNAME_Ioc
_APPNAME_Ioc_SRCS += xxxRecord.c
_APPNAME_Ioc_SRCS += devXxxSoft.c
_APPNAME_Ioc_SRCS += dbSubExample.c
_APPNAME_Ioc_LIBS += $(EPICS_BASE_IOC_LIBRARIES)
_APPNAME_Ioc_LIBS += $(EPICS_BASE_IOC_LIBS)
_APPNAME_Ioc_SYS_LIBS_solaris += c
#=============================
@@ -27,7 +28,6 @@ PROD_IOC = _APPNAME_
# <name>_registerRecordDeviceDriver.cpp will be created from <name>.dbd
_APPNAME__SRCS += _APPNAME__registerRecordDeviceDriver.cpp
_APPNAME__SRCS += dbSubExample.c
_APPNAME__SRCS_DEFAULT += _APPNAME_Main.cpp
_APPNAME__SRCS_vxWorks += -nil-
@@ -46,7 +46,7 @@ _APPNAME__LIBS += _APPNAME_Ioc
#_APPNAME__LIBS += seq
#_APPNAME__LIBS += pv
_APPNAME__LIBS += $(EPICS_BASE_IOC_LIBRARIES)
_APPNAME__LIBS += $(EPICS_BASE_IOC_LIBS)
#The following builds sncExample as a standalone application
#PROD_HOST += sncExample
@@ -54,7 +54,7 @@ _APPNAME__LIBS += $(EPICS_BASE_IOC_LIBRARIES)
#sncExample_SRCS += sncExample.stt
#sncExample_LIBS += seq
#sncExample_LIBS += pv
#sncExample_LIBS += $(EPICS_BASE_IOC_LIBRARIES)
#sncExample_LIBS += $(EPICS_BASE_HOST_LIBS)
#===========================
@@ -1,5 +1,4 @@
include "base.dbd"
include "xxxRecord.dbd"
device(xxx,CONSTANT,devXxxSoft,"SoftChannel")
function("mySubInit")
function("mySubProcess")
registrar("mySub")
@@ -1,18 +1,33 @@
#include <stdio.h>
#include "subRecord.h"
#include <registryFunction.h>
#include <subRecord.h>
#define epicsExportSharedSymbols
#include "shareLib.h"
typedef long (*processMethod)(subRecord *precord);
long mySubInit(subRecord *precord,processMethod process)
static long mySubInit(subRecord *precord,processMethod process)
{
printf("Record %s called mySubInit(%p, %p)\n",
precord->name, (void*) precord, (void*) process);
return(0);
}
long mySubProcess(subRecord *precord)
static long mySubProcess(subRecord *precord)
{
printf("Record %s called mySubProcess(%p)\n",
precord->name, (void*) precord);
return(0);
}
static registryFunctionRef mySubRef[] = {
{"mySubInit",(REGISTRYFUNCTION)mySubInit},
{"mySubProcess",(REGISTRYFUNCTION)mySubProcess}
};
epicsShareFunc void epicsShareAPI mySub(void)
{
registryFunctionRefAdd(mySubRef,registryFunctionRefNumber(mySubRef));
}