remove db_addr
This commit is contained in:
@@ -10,7 +10,7 @@ INC += dbConvert.h
|
||||
INC += dbEvent.h
|
||||
INC += dbScan.h
|
||||
INC += db_access.h
|
||||
INC += db_addr.h
|
||||
INC += dbAddr.h
|
||||
INC += db_field_log.h
|
||||
INC += fast_lock.h
|
||||
INC += initHooks.h
|
||||
|
||||
+20
-43
@@ -51,52 +51,11 @@
|
||||
#include <callback.h>
|
||||
#include <ellLib.h>
|
||||
#include <caeventmask.h>
|
||||
#include "dbAddr.h"
|
||||
|
||||
|
||||
typedef struct dbAddr{
|
||||
struct dbCommon *precord;/* address of record */
|
||||
void *pfield; /* address of field */
|
||||
void *pfldDes; /* address of struct fldDes */
|
||||
void *asPvt; /* Access Security Private */
|
||||
long no_elements; /* number of elements (arrays) */
|
||||
short field_type; /* type of database field */
|
||||
short field_size; /* size (bytes) of the field being accessed */
|
||||
short special; /* special processing */
|
||||
short dbr_field_type; /* field type as seen by database request*/
|
||||
/*DBR_STRING,...,DBR_ENUM,DBR_NOACCESS*/
|
||||
}DBADDR;
|
||||
|
||||
/*If the following structures changes then db_access.h must also be changed*/
|
||||
typedef struct pnRestartNode {
|
||||
ELLNODE node;
|
||||
struct putNotify *ppn;
|
||||
struct putNotify *ppnrestartList; /*ppn with restartList*/
|
||||
}PNRESTARTNODE;
|
||||
|
||||
|
||||
typedef struct putNotify{
|
||||
/*The following members MUST be set by user*/
|
||||
#ifdef __STDC__
|
||||
void (*userCallback)(struct putNotify *); /*callback provided by user*/
|
||||
#else
|
||||
void (*userCallback)(); /*callback provided by user*/
|
||||
#endif
|
||||
struct dbAddr *paddr; /*dbAddr set by dbNameToAddr*/
|
||||
void *pbuffer; /*address of data*/
|
||||
long nRequest; /*number of elements to be written*/
|
||||
short dbrType; /*database request type*/
|
||||
void *usrPvt; /*for private use of user*/
|
||||
/*The following is status of request. Set by dbPutNotify*/
|
||||
long status;
|
||||
/*The following are private to database access*/
|
||||
CALLBACK callback;
|
||||
ELLLIST waitList; /*list of records for which to wait*/
|
||||
ELLLIST restartList; /*list of PUTNOTIFYs to restart*/
|
||||
PNRESTARTNODE restartNode;
|
||||
short restart;
|
||||
short callbackState;
|
||||
void *waitForCallback;
|
||||
}PUTNOTIFY;
|
||||
|
||||
/* The database field and request types are defined in dbFldTypes.h*/
|
||||
/* Data Base Request Options */
|
||||
#define DBR_STATUS 0x00000001
|
||||
@@ -313,6 +272,21 @@ long dbCaGetSevr(struct link *plink,short *severity);
|
||||
long dbCaGetUnits(struct link *plink,char *units,int unitsSize);
|
||||
int dbCaIsLinkConnected(struct link *plink);
|
||||
|
||||
short db_name_to_addr_mess(char *pname, struct dbAddr *paddr);
|
||||
short db_get_field_mess(
|
||||
struct dbAddr *paddr,
|
||||
short buffer_type,
|
||||
char *pbuffer,
|
||||
unsigned short no_elements,
|
||||
void *pfl
|
||||
);
|
||||
short db_put_field_mess(
|
||||
struct dbAddr *paddr, /* where to put it */
|
||||
short src_type,
|
||||
short no_elements,
|
||||
char *psrc /* where to get it from */
|
||||
);
|
||||
|
||||
#else
|
||||
struct rset *dbGetRset();
|
||||
int dbIsValueField();
|
||||
@@ -338,6 +312,9 @@ void dbCaAddLink();
|
||||
void dbCaRemoveLink();
|
||||
long dbCaGetLink();
|
||||
long dbCaPutLink();
|
||||
short db_name_to_addr_mess();
|
||||
short db_get_field_mess();
|
||||
short db_put_field_mess();
|
||||
#endif /*__STDC__*/
|
||||
|
||||
#endif /*INCdbAccessh*/
|
||||
|
||||
+2
-2
@@ -176,7 +176,7 @@ long dbCaGetLink(struct link *plink,short dbrType, char *pdest,
|
||||
(*(pconvert))(pca->pgetNative, pdest, 0);
|
||||
}else{
|
||||
unsigned long ntoget = *nelements;
|
||||
struct db_addr dbAddr;
|
||||
struct dbAddr dbAddr;
|
||||
|
||||
if(ntoget > pca->nelements) ntoget = pca->nelements;
|
||||
*nelements = ntoget;
|
||||
@@ -242,7 +242,7 @@ long dbCaPutLink(struct link *plink,short dbrType,
|
||||
[dbrType][dbDBRoldToDBFnew[pca->dbrType]];
|
||||
status = (*(pconvert))(psource,pca->pputNative, 0);
|
||||
}else{
|
||||
struct db_addr dbAddr;
|
||||
struct dbAddr dbAddr;
|
||||
pconvert = dbPutConvertRoutine
|
||||
[dbrType][dbDBRoldToDBFnew[pca->dbrType]];
|
||||
memset((void *)&dbAddr,0,sizeof(dbAddr));
|
||||
|
||||
+16
-16
@@ -131,16 +131,16 @@ FASTUNLOCK(&(RECPTR)->mlok);
|
||||
*/
|
||||
int db_event_list(char *name)
|
||||
{
|
||||
struct db_addr addr;
|
||||
struct dbAddr addr;
|
||||
int status;
|
||||
struct event_block *pevent;
|
||||
struct dbCommon *precord;
|
||||
|
||||
status = db_name_to_addr(name, &addr);
|
||||
status = dbNameToAddr(name, &addr);
|
||||
if(status==ERROR)
|
||||
return ERROR;
|
||||
|
||||
precord = (struct dbCommon *) addr.precord;
|
||||
precord = addr.precord;
|
||||
pevent = (struct event_block *) precord->mlis.node.next;
|
||||
|
||||
if(pevent)
|
||||
@@ -255,16 +255,16 @@ unsigned db_sizeof_event_block(void)
|
||||
*/
|
||||
int db_add_event(
|
||||
struct event_user *evuser,
|
||||
struct db_addr *paddr,
|
||||
struct dbAddr *paddr,
|
||||
void (*user_sub)(),
|
||||
void *user_arg,
|
||||
unsigned int select,
|
||||
struct event_block *pevent /* ptr to event blk (not required) */
|
||||
)
|
||||
{
|
||||
struct dbCommon *precord;
|
||||
struct event_que *ev_que;
|
||||
struct event_que *tmp_que;
|
||||
struct dbCommon *precord;
|
||||
struct event_que *ev_que;
|
||||
struct event_que *tmp_que;
|
||||
|
||||
/* (MDA) in LANL stuff, this used to taskSuspend if invalid address
|
||||
in new code, the mechanism to help do this checking has been removed
|
||||
@@ -272,7 +272,7 @@ struct event_block *pevent /* ptr to event blk (not required) */
|
||||
|
||||
PADDRCHK(paddr);
|
||||
*/
|
||||
precord = (struct dbCommon *) paddr->precord;
|
||||
precord = paddr->precord;
|
||||
|
||||
/*
|
||||
* Don't add events which will not be triggered
|
||||
@@ -322,7 +322,7 @@ struct event_block *pevent /* ptr to event blk (not required) */
|
||||
* there upon wakeup)
|
||||
*/
|
||||
if( paddr->no_elements == 1 &&
|
||||
dbr_size[paddr->field_type] <= sizeof(union native_value))
|
||||
paddr->field_size <= sizeof(union native_value))
|
||||
pevent->valque = TRUE;
|
||||
else
|
||||
pevent->valque = FALSE;
|
||||
@@ -475,7 +475,7 @@ int db_cancel_event(struct event_block *pevent)
|
||||
*/
|
||||
LOCAL void wake_cancel(
|
||||
void *user_arg,
|
||||
struct db_addr *paddr,
|
||||
struct dbAddr *paddr,
|
||||
int eventsRemaing,
|
||||
db_field_log *pfl)
|
||||
{
|
||||
@@ -591,13 +591,13 @@ int db_post_single_event(struct event_block *pevent)
|
||||
ev_que->valque[putix].sevr = sevr;
|
||||
ev_que->valque[putix].time = precord->time;
|
||||
/*
|
||||
* use memcpy to avoid a bus error on
|
||||
* union copy of char in the db at an odd
|
||||
* address
|
||||
*/
|
||||
* use memcpy to avoid a bus error on
|
||||
* union copy of char in the db at an odd
|
||||
* address
|
||||
*/
|
||||
memcpy( (char *)&ev_que->valque[putix].field,
|
||||
pevent->paddr->pfield,
|
||||
dbr_size[pevent->paddr->field_type]);
|
||||
pevent->paddr->field_size);
|
||||
}
|
||||
/* notify the event handler */
|
||||
semGive(ev_que->evuser->ppendsem);
|
||||
@@ -677,7 +677,7 @@ unsigned int select
|
||||
*/
|
||||
memcpy( (char *)&ev_que->valque[putix].field,
|
||||
(char *)event->paddr->pfield,
|
||||
dbr_size[event->paddr->field_type]);
|
||||
event->paddr->field_size);
|
||||
|
||||
}
|
||||
/* notify the event handler */
|
||||
|
||||
+4
-4
@@ -44,10 +44,10 @@
|
||||
|
||||
struct event_block{
|
||||
ELLNODE node;
|
||||
struct db_addr *paddr;
|
||||
struct dbAddr *paddr;
|
||||
void (*user_sub)(
|
||||
void *user_arg,
|
||||
struct db_addr *paddr,
|
||||
struct dbAddr *paddr,
|
||||
int eventsRemaining,
|
||||
db_field_log *pfl);
|
||||
void *user_arg;
|
||||
@@ -59,7 +59,7 @@ struct event_block{
|
||||
|
||||
typedef void EVENTFUNC(
|
||||
void *user_arg,
|
||||
struct db_addr *paddr,
|
||||
struct dbAddr *paddr,
|
||||
int eventsRemaining,
|
||||
db_field_log *pfl);
|
||||
|
||||
@@ -118,7 +118,7 @@ unsigned db_sizeof_event_block(void);
|
||||
|
||||
int db_add_event(
|
||||
struct event_user *evuser,
|
||||
struct db_addr *paddr,
|
||||
struct dbAddr *paddr,
|
||||
EVENTFUNC *user_sub,
|
||||
void *user_arg,
|
||||
unsigned int select,
|
||||
|
||||
+17
-21
@@ -35,6 +35,7 @@
|
||||
* .05 02-28-92 jba ANSI C changes
|
||||
* .06 07-21-92 jba ANSI C changes
|
||||
* .07 02-02-94 mrk added dbPutNotifyMapType
|
||||
* .08 10-10-96 joh eliminated the dbAddr/db_addr mess
|
||||
*/
|
||||
|
||||
|
||||
@@ -123,11 +124,6 @@ extern unsigned short dbDBRnewToDBRold[DBR_ENUM+1];
|
||||
|
||||
/* function declarations */
|
||||
|
||||
/*
|
||||
* database access address structure
|
||||
*/
|
||||
#include <db_addr.h>
|
||||
|
||||
#ifndef MAX_STRING_SIZE
|
||||
#define MAX_STRING_SIZE 40
|
||||
#endif
|
||||
@@ -504,8 +500,7 @@ struct dbr_ctrl_double{
|
||||
*
|
||||
* process database records
|
||||
*/
|
||||
void db_process(pdb_addr)
|
||||
register struct db_addr *pdb_addr;
|
||||
void db_process(struct dbAddr *pdb_addr)
|
||||
{
|
||||
long status;
|
||||
|
||||
@@ -575,14 +570,12 @@ void fill(pbuffer,size,fillchar)
|
||||
/*
|
||||
* DB_NAME_TO_ADDR
|
||||
*/
|
||||
short db_name_to_addr(pname,paddr)
|
||||
char *pname;
|
||||
struct dbAddr *paddr;
|
||||
int db_name_to_addr(char *pname, struct dbAddr *paddr)
|
||||
{
|
||||
long status;
|
||||
short ftype;
|
||||
|
||||
status=dbNameToAddr(pname,paddr);
|
||||
status=dbNameToAddr(pname, paddr);
|
||||
if(!status) {
|
||||
ftype = paddr->dbr_field_type;
|
||||
if(INVALID_DB_REQ(ftype)) {
|
||||
@@ -598,12 +591,13 @@ short db_name_to_addr(pname,paddr)
|
||||
|
||||
typedef char DBSTRING[MAX_STRING_SIZE];
|
||||
|
||||
short db_get_field(paddr,buffer_type,pbuffer,no_elements,pfl)
|
||||
struct dbAddr *paddr;
|
||||
short buffer_type;
|
||||
char *pbuffer;
|
||||
unsigned short no_elements;
|
||||
void *pfl;
|
||||
int db_get_field(
|
||||
struct dbAddr *paddr,
|
||||
int buffer_type,
|
||||
void *pbuffer,
|
||||
int no_elements,
|
||||
void *pfl
|
||||
)
|
||||
{
|
||||
long status;
|
||||
long options;
|
||||
@@ -1420,10 +1414,12 @@ void *pfl;
|
||||
|
||||
/* DB_PUT_FIELD put a field and convert it to the desired type */
|
||||
|
||||
short db_put_field(paddr,src_type,psrc,no_elements)
|
||||
struct dbAddr *paddr; /* where to put it */
|
||||
short src_type,no_elements;
|
||||
char *psrc; /* where to get it from */
|
||||
int db_put_field(
|
||||
struct dbAddr *paddr, /* where to put it */
|
||||
int src_type,
|
||||
void *psrc, /* where to get it from */
|
||||
int no_elements
|
||||
)
|
||||
{
|
||||
long status;
|
||||
|
||||
|
||||
+8
-47
@@ -76,6 +76,7 @@
|
||||
* .26 05-17-95 joh conversion between epics core types
|
||||
* and dbr types
|
||||
* .27 05-26-95 joh added const
|
||||
* .28 10-10-96 joh eliminated the dbAddr/db_addr mess
|
||||
*
|
||||
* NOTES:
|
||||
* .01 06-04-91 joh the value must always be the last item
|
||||
@@ -98,45 +99,7 @@ extern "C" {
|
||||
#include <tsDefs.h>
|
||||
#include <callback.h>
|
||||
#include <ellLib.h>
|
||||
|
||||
/*
|
||||
*database access address structure
|
||||
*/
|
||||
#ifndef INC_db_addrh
|
||||
#include <db_addr.h>
|
||||
#endif
|
||||
|
||||
/*definitions for db_put_notify */
|
||||
/*the following structure is identical*/
|
||||
/*except for struct dbAddr -> struct db_addr*/
|
||||
struct putNotify;
|
||||
typedef struct pnRestartNode {
|
||||
ELLNODE node;
|
||||
struct putNotify *ppn;
|
||||
struct putNotify *ppnrestartList; /*ppn with restartList*/
|
||||
}PNRESTARTNODE;
|
||||
|
||||
typedef struct putNotify{
|
||||
/*The following members MUST be set by user*/
|
||||
void (*userCallback)(); /*callback provided by user*/
|
||||
struct db_addr *paddr; /*dbAddr set by dbNameToAddr*/
|
||||
void *pbuffer; /*address of data*/
|
||||
long nRequest; /*number of elements to be written*/
|
||||
short dbrType; /*database request type*/
|
||||
void *usrPvt; /*for private use of user*/
|
||||
/*The following is status of request. Set by dbPutNotify*/
|
||||
long status;
|
||||
/*The following are private to database access*/
|
||||
CALLBACK callback;
|
||||
ELLLIST waitList; /*list of records for which to wait*/
|
||||
ELLLIST restartList; /*list of PUTNOTIFYs to restart*/
|
||||
PNRESTARTNODE restartNode; /*node of on restartLlist*/
|
||||
short restart;
|
||||
short callbackState;
|
||||
void *waitForCallback;
|
||||
}PUTNOTIFY;
|
||||
/* dbPutNotify can be called after calling dbPutNotifyMapType(ppn,oldtype)*/
|
||||
int dbPutNotifyMapType();
|
||||
#include "dbAddr.h"
|
||||
|
||||
#define MAX_UNITS_SIZE 8
|
||||
#define MAX_ENUM_STRING_SIZE 26
|
||||
@@ -251,11 +214,11 @@ epicsShareExtern READONLY int epicsTypeToDBR_XXXX [lastEpicsType+1];
|
||||
void *dbCalloc(size_t nobj,size_t size);
|
||||
void *dbMalloc(size_t size);
|
||||
extern long (*dbGetConvertRoutine[newDBF_DEVICE+1][newDBR_ENUM+1])
|
||||
(struct db_addr *paddr, void *pbuffer,long nRequest,
|
||||
long no_elements, long offset);
|
||||
(struct dbAddr *paddr, void *pbuffer,long nRequest,
|
||||
long no_elements, long offset);
|
||||
extern long (*dbPutConvertRoutine[newDBR_ENUM+1][newDBF_DEVICE+1])
|
||||
(struct db_addr *paddr, void *pbuffer,long nRequest,
|
||||
long no_elements, long offset);
|
||||
(struct dbAddr *paddr, void *pbuffer,long nRequest,
|
||||
long no_elements, long offset);
|
||||
extern long (*dbFastGetConvertRoutine[newDBF_DEVICE+1][newDBR_ENUM+1])();
|
||||
extern long (*dbFastPutConvertRoutine[newDBR_ENUM+1][newDBF_DEVICE+1])();
|
||||
#else
|
||||
@@ -263,6 +226,8 @@ extern long (*dbGetConvertRoutine[newDBF_DEVICE+1][newDBR_ENUM+1]) ();
|
||||
extern long (*dbPutConvertRoutine[newDBR_ENUM+1][newDBF_DEVICE+1]) ();
|
||||
extern long (*dbFastGetConvertRoutine[newDBF_DEVICE+1][newDBR_ENUM+1])();
|
||||
extern long (*dbFastPutConvertRoutine[newDBR_ENUM+1][newDBF_DEVICE+1])();
|
||||
void *dbCalloc();
|
||||
void *dbMalloc();
|
||||
#endif /*__STDC__*/
|
||||
|
||||
/*Conversion between old and new DBR types*/
|
||||
@@ -1183,10 +1148,6 @@ union db_access_val{
|
||||
READONLY short dbr_text_dim = (sizeof dbr_text)/(sizeof (char *));
|
||||
#endif
|
||||
|
||||
short db_name_to_addr();
|
||||
short db_put_field();
|
||||
short db_get_field();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
/* $Id$
|
||||
*
|
||||
* Author: Bob Dalesio
|
||||
* Date: 4-4-88
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
*/
|
||||
#ifndef INC_db_addrh
|
||||
#define INC_db_addrh
|
||||
/*
|
||||
*database access address structure
|
||||
*/
|
||||
struct db_addr{
|
||||
char *precord; /* record number of specified type */
|
||||
char *pfield; /* offset from the record origin */
|
||||
char *pad0; /* not used by old */
|
||||
void *asPvt; /*Access Security Private */
|
||||
short pad1; /*not used by old */
|
||||
short no_elements; /* number of elements in arrays of data */
|
||||
short new_field_type; /* field type for new database access*/
|
||||
short field_size; /* size of the field being accessed */
|
||||
/* from database for values of waveforms */
|
||||
short special; /* special processing */
|
||||
short field_type; /* field type as seen by database request*/
|
||||
/*DBR_STRING,...,DBR_ENUM,DBR_NOACCESS*/
|
||||
};
|
||||
#endif
|
||||
+19
-24
@@ -45,13 +45,11 @@ static void print_returned();
|
||||
|
||||
|
||||
#define MAX_ELEMS 10
|
||||
int gft(pname,index)
|
||||
char *pname;
|
||||
short index;
|
||||
int gft(char *pname)
|
||||
{
|
||||
char tgf_buffer[MAX_ELEMS*MAX_STRING_SIZE+sizeof(struct dbr_ctrl_double)];
|
||||
struct db_addr addr;
|
||||
struct db_addr *paddr = &addr;
|
||||
struct dbAddr addr;
|
||||
struct dbAddr *paddr = &addr;
|
||||
short number_elements;
|
||||
int i;
|
||||
int status;
|
||||
@@ -61,22 +59,22 @@ short index;
|
||||
return(1);
|
||||
}
|
||||
/* convert name to database address */
|
||||
status=db_name_to_addr(pname,&addr,index);
|
||||
status=db_name_to_addr(pname,&addr);
|
||||
if(status) {
|
||||
printf("db_name_to_addr failed\n");
|
||||
return(1);
|
||||
}
|
||||
printf(" Record Name: %s\n",pname);
|
||||
printf("Record Address: 0x%p\n",addr.precord);
|
||||
printf(" Field Type: %d\n",addr.field_type);
|
||||
printf(" Field Type: %d\n",addr.dbr_field_type);
|
||||
printf(" Field Address: 0x%p\n",addr.pfield);
|
||||
printf(" Field Size: %d\n",addr.field_size);
|
||||
printf(" No Elements: %d\n",addr.no_elements);
|
||||
printf(" No Elements: %ld\n",addr.no_elements);
|
||||
number_elements =
|
||||
((addr.no_elements > MAX_ELEMS)?MAX_ELEMS:addr.no_elements);
|
||||
|
||||
for(i=0; i<=LAST_BUFFER_TYPE; i++) {
|
||||
if(addr.field_type==0) {
|
||||
if(addr.dbr_field_type==0) {
|
||||
if( (i!=DBR_STRING)
|
||||
&& (i!=DBR_STS_STRING)
|
||||
&& (i!=DBR_TIME_STRING)
|
||||
@@ -95,13 +93,10 @@ short index;
|
||||
* TPF
|
||||
* Test put field
|
||||
*/
|
||||
int pft(pname,pvalue,index)
|
||||
char *pname;
|
||||
char *pvalue;
|
||||
short index;
|
||||
int pft(char *pname,char *pvalue)
|
||||
{
|
||||
struct db_addr addr;
|
||||
struct db_addr *paddr = &addr;
|
||||
struct dbAddr addr;
|
||||
struct dbAddr *paddr = &addr;
|
||||
char buffer[500];
|
||||
short shortvalue;
|
||||
long longvalue;
|
||||
@@ -120,21 +115,21 @@ short index;
|
||||
/* convert name to database address */
|
||||
|
||||
/* convert name to database address */
|
||||
status=db_name_to_addr(pname,&addr,index);
|
||||
status=db_name_to_addr(pname,&addr);
|
||||
if(status) {
|
||||
printf("db_name_to_addr failed\n");
|
||||
return(1);
|
||||
}
|
||||
printf(" Record Name: %s\n",pname);
|
||||
printf("Record Address: 0x%p\n",addr.precord);
|
||||
printf(" Field Type: %d\n",addr.field_type);
|
||||
printf(" Field Type: %d\n",addr.dbr_field_type);
|
||||
printf(" Field Address: 0x%p\n",addr.pfield);
|
||||
printf(" Field Size: %d\n",addr.field_size);
|
||||
printf(" No Elements: %d\n",addr.no_elements);
|
||||
printf(" No Elements: %ld\n",addr.no_elements);
|
||||
if (db_put_field(paddr,DBR_STRING,pvalue,1) < 0) printf("\n\t failed ");
|
||||
if (db_get_field(paddr,DBR_STRING,buffer,1,NULL) < 0) printf("\n\tfailed");
|
||||
else print_returned(DBR_STRING,buffer,1);
|
||||
if(addr.field_type<=DBF_STRING || addr.field_type==DBF_ENUM)
|
||||
if(addr.dbr_field_type<=DBF_STRING || addr.dbr_field_type==DBF_ENUM)
|
||||
return(0);
|
||||
if(sscanf(pvalue,"%hd",&shortvalue)==1) {
|
||||
if (db_put_field(paddr,DBR_SHORT,&shortvalue,1) < 0)
|
||||
@@ -240,7 +235,7 @@ static void print_returned(type,pbuffer,count)
|
||||
long *pvalue = (long *)pbuffer;
|
||||
for (i = 0; i < count; i++,pvalue++){
|
||||
if(count!=1 && (i%10 == 0)) printf("\n");
|
||||
printf("0x%x ",*pvalue);
|
||||
printf("0x%lx ", (unsigned long)*pvalue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -315,7 +310,7 @@ static void print_returned(type,pbuffer,count)
|
||||
if(count==1) printf("\tValue: ");
|
||||
for (i = 0; i < count; i++,plong++){
|
||||
if(count!=1 && (i%10 == 0)) printf("\n");
|
||||
printf("0x%lx ",*plong);
|
||||
printf("0x%x ",(unsigned)*plong);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -641,7 +636,7 @@ static void print_returned(type,pbuffer,count)
|
||||
|
||||
static void tpnCallback(PUTNOTIFY *ppn)
|
||||
{
|
||||
struct db_addr *pdbaddr = (struct db_addr *)ppn->paddr;
|
||||
struct dbAddr *pdbaddr = (struct dbAddr *)ppn->paddr;
|
||||
long status = ppn->status;
|
||||
|
||||
if(status==0)
|
||||
@@ -655,14 +650,14 @@ static void tpnCallback(PUTNOTIFY *ppn)
|
||||
long tpn(char *pname,char *pvalue)
|
||||
{
|
||||
long status;
|
||||
struct db_addr *pdbaddr=NULL;
|
||||
struct dbAddr *pdbaddr=NULL;
|
||||
PUTNOTIFY *ppn=NULL;
|
||||
char *psavevalue;
|
||||
int len;
|
||||
|
||||
len = strlen(pvalue);
|
||||
/*allocate space for value immediately following DBADDR*/
|
||||
pdbaddr = calloc(1,sizeof(struct db_addr) + len+1);
|
||||
pdbaddr = calloc(1,sizeof(struct dbAddr) + len+1);
|
||||
if(!pdbaddr) {
|
||||
printf("calloc failed\n");
|
||||
return(-1);
|
||||
|
||||
Reference in New Issue
Block a user