large array changes
This commit is contained in:
+70
-36
@@ -14,13 +14,15 @@
|
||||
* 505 665 1831
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "iocinf.h"
|
||||
|
||||
#include "oldAccess.h"
|
||||
|
||||
oldCAC::oldCAC ( bool enablePreemptiveCallback ) :
|
||||
clientCtx ( * new cac ( *this, enablePreemptiveCallback ) ),
|
||||
ca_exception_func ( ca_default_exception_handler ), ca_exception_arg ( 0 ),
|
||||
ca_exception_func ( 0 ), ca_exception_arg ( 0 ),
|
||||
pVPrintfFunc ( errlogVprintf ), fdRegFunc ( 0 ), fdRegArg ( 0 )
|
||||
{
|
||||
if ( ! & this->clientCtx ) {
|
||||
@@ -36,14 +38,8 @@ oldCAC::~oldCAC ()
|
||||
void oldCAC::changeExceptionEvent ( caExceptionHandler *pfunc, void *arg )
|
||||
{
|
||||
epicsAutoMutex autoMutex ( this->mutex );
|
||||
if ( pfunc ) {
|
||||
this->ca_exception_func = pfunc;
|
||||
this->ca_exception_arg = arg;
|
||||
}
|
||||
else {
|
||||
this->ca_exception_func = ca_default_exception_handler;
|
||||
this->ca_exception_arg = NULL;
|
||||
}
|
||||
this->ca_exception_func = pfunc;
|
||||
this->ca_exception_arg = arg;
|
||||
// should block here until releated callback in progress completes
|
||||
}
|
||||
|
||||
@@ -67,8 +63,21 @@ void oldCAC::registerForFileDescriptorCallBack ( CAFDHANDLER *pFunc, void *pArg
|
||||
// should block here until releated callback in progress completes
|
||||
}
|
||||
|
||||
int oldCAC::printf ( const char *pformat, ... ) const
|
||||
{
|
||||
va_list theArgs;
|
||||
int status;
|
||||
|
||||
int oldCAC::vPrintf ( const char *pformat, va_list args )
|
||||
va_start ( theArgs, pformat );
|
||||
|
||||
status = this->oldCAC::vPrintf ( pformat, theArgs );
|
||||
|
||||
va_end ( theArgs );
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int oldCAC::vPrintf ( const char *pformat, va_list args ) const
|
||||
{
|
||||
caPrintfFunc *pFunc;
|
||||
{
|
||||
@@ -79,18 +88,12 @@ int oldCAC::vPrintf ( const char *pformat, va_list args )
|
||||
return ( *pFunc ) ( pformat, args );
|
||||
}
|
||||
else {
|
||||
return vfprintf ( stderr, pformat, args );
|
||||
return ::vfprintf ( stderr, pformat, args );
|
||||
}
|
||||
}
|
||||
|
||||
void oldCAC::exception ( int stat, const char *pCtx, const char *pFile, unsigned lineNo )
|
||||
{
|
||||
this->exception ( stat, pCtx, UINT_MAX, 0, pFile, lineNo );
|
||||
}
|
||||
|
||||
void oldCAC::exception ( int stat, const char *ctx,
|
||||
unsigned type, unsigned long count,
|
||||
const char *pFile, unsigned lineNo )
|
||||
void oldCAC::exception ( int stat, const char *pCtx,
|
||||
const char *pFile, unsigned lineNo )
|
||||
{
|
||||
struct exception_handler_args args;
|
||||
caExceptionHandler *pFunc;
|
||||
@@ -104,17 +107,54 @@ void oldCAC::exception ( int stat, const char *ctx,
|
||||
// NOOP if they disable exceptions
|
||||
if ( pFunc ) {
|
||||
args.chid = NULL;
|
||||
args.type = type;
|
||||
args.count = count;
|
||||
args.type = TYPENOTCONN;
|
||||
args.count = 0;
|
||||
args.addr = NULL;
|
||||
args.stat = stat;
|
||||
args.op = CA_OP_OTHER;
|
||||
args.ctx = ctx;
|
||||
args.ctx = pCtx;
|
||||
args.pFile = pFile;
|
||||
args.lineNo = lineNo;
|
||||
args.usr = pArg;
|
||||
( *pFunc ) ( args );
|
||||
}
|
||||
else {
|
||||
this->clientCtx.signal ( stat, pFile, lineNo, pCtx );
|
||||
}
|
||||
}
|
||||
|
||||
void oldCAC::exception ( int status, const char *pContext,
|
||||
const char *pFileName, unsigned lineNo, oldChannelNotify &chan,
|
||||
unsigned type, arrayElementCount count, unsigned op )
|
||||
{
|
||||
struct exception_handler_args args;
|
||||
caExceptionHandler *pFunc;
|
||||
void *pArg;
|
||||
{
|
||||
epicsAutoMutex autoMutex ( this->mutex );
|
||||
pFunc = this->ca_exception_func;
|
||||
pArg = this->ca_exception_arg;
|
||||
}
|
||||
|
||||
// NOOP if they disable exceptions
|
||||
if ( pFunc ) {
|
||||
args.chid = &chan;
|
||||
args.type = type;
|
||||
args.count = count;
|
||||
args.addr = NULL;
|
||||
args.stat = status;
|
||||
args.op = op;
|
||||
args.ctx = pContext;
|
||||
args.pFile = pFileName;
|
||||
args.lineNo = lineNo;
|
||||
args.usr = pArg;
|
||||
( *pFunc ) ( args );
|
||||
}
|
||||
else {
|
||||
this->clientCtx.signal ( status, pFileName, lineNo,
|
||||
"op=%u, channel=%s, type=%s, count=lu, ctx=\"%s\"",
|
||||
op, ca_name ( &chan ), dbr_type_to_text ( type ), count, pContext );
|
||||
}
|
||||
}
|
||||
|
||||
void oldCAC::fdWasCreated ( int fd )
|
||||
@@ -145,20 +185,6 @@ void oldCAC::fdWasDestroyed ( int fd )
|
||||
}
|
||||
}
|
||||
|
||||
int oldCAC::printf ( const char *pformat, ... )
|
||||
{
|
||||
va_list theArgs;
|
||||
int status;
|
||||
|
||||
va_start ( theArgs, pformat );
|
||||
|
||||
status = this->vPrintf ( pformat, theArgs );
|
||||
|
||||
va_end ( theArgs );
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
void oldCAC::show ( unsigned level ) const
|
||||
{
|
||||
::printf ( "oldCAC at %p\n",
|
||||
@@ -179,3 +205,11 @@ void oldCAC::show ( unsigned level ) const
|
||||
}
|
||||
}
|
||||
|
||||
void oldCAC::attachToClientCtx ()
|
||||
{
|
||||
int status = ca_attach_context ( this );
|
||||
SEVCHK ( status, "error in virtual attach to client context" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user