Eliminated all warnings from splint standard error checking.
r1017 | ffr | 2006-06-02 16:44:02 +1000 (Fri, 02 Jun 2006) | 2 lines
This commit is contained in:
committed by
Douglas Clowes
parent
38b6e44306
commit
5f62768d59
@@ -38,7 +38,9 @@
|
||||
int readRS232(prs232 self, /*@out@*/void *data, /*@out@*/int *dataLen);
|
||||
int readRS232TillTerm(prs232 self, /*@out@*/void *data, int *datalen);
|
||||
void KillRS232(/*@only@*/ void *pData);
|
||||
/*@observer@*/ char *Tcl_GetVar2(Tcl_Interp *interp, char *name1, char *name2, int flags);
|
||||
/* Storage returned by Tcl_GetVar2 is owned by the Tcl interpreter and should not be modified */
|
||||
/*@observer@*//*@dependent@*/ char *Tcl_GetVar2(Tcl_Interp *interp, char *name1, char *name2, int flags);
|
||||
/* The pointer to the Tcl interpreter is owned by SICS and should not be modified */
|
||||
/*@observer@*//*@dependent@*/ Tcl_Interp *InterpGetTcl(SicsInterp *pSics);
|
||||
/*@+incondefs@*/
|
||||
/*-----------------------------------------------------------------------
|
||||
@@ -49,24 +51,22 @@ typedef struct __MoDriv {
|
||||
/* general motor driver interface
|
||||
fields. _REQUIRED!
|
||||
*/
|
||||
/*@-incondefs@*/
|
||||
float fUpper; /* upper limit */
|
||||
float fLower; /* lower limit */
|
||||
/*@owned@*/char *name;
|
||||
int (*GetPosition)(/*@dependent@*/void *self, float *fPos);
|
||||
int (*RunTo)(/*@dependent@*/void *self, float fNewVal);
|
||||
int (*GetStatus)(/*@dependent@*/void *self);
|
||||
void (*GetError)(/*@dependent@*/void *self, int *iCode, char *buffer, int iBufLen);
|
||||
int (*TryAndFixIt)(/*@dependent@*/void *self,int iError, float fNew);
|
||||
int (*Halt)(/*@dependent@*/void *self);
|
||||
int (*GetDriverPar)(/*@dependent@*/void *self, char *name,
|
||||
char *name;
|
||||
int (*GetPosition)(void *self, float *fPos);
|
||||
int (*RunTo)(void *self, float fNewVal);
|
||||
int (*GetStatus)(void *self);
|
||||
void (*GetError)(void *self, int *iCode, char *buffer, int iBufLen);
|
||||
int (*TryAndFixIt)(void *self,int iError, float fNew);
|
||||
int (*Halt)(void *self);
|
||||
int (*GetDriverPar)(void *self, char *name,
|
||||
float *value);
|
||||
int (*SetDriverPar)(/*@dependent@*/void *self,SConnection *pCon,
|
||||
int (*SetDriverPar)(void *self,SConnection *pCon,
|
||||
char *name, float newValue);
|
||||
void (*ListDriverPar)(/*@dependent@*/void *self, char *motorName,
|
||||
void (*ListDriverPar)(void *self, char *motorName,
|
||||
SConnection *pCon);
|
||||
void (*KillPrivate)(/*@dependent@*/void *self);
|
||||
/*@+incondefs@*/
|
||||
void (*KillPrivate)(/*@only@*/void *self);
|
||||
|
||||
|
||||
/* DMC-2280 specific fields */
|
||||
@@ -133,14 +133,14 @@ typedef struct __MoDriv {
|
||||
#define DECEL "decel"
|
||||
#define MAXDECEL "maxDecel"
|
||||
|
||||
static int DMC2280Receive(/*@dependent@*/pDMC2280Driv self, /*@out@*/ char *reply);
|
||||
static int DMC2280Receive(pDMC2280Driv self, /*@out@*/ char *reply);
|
||||
|
||||
/** \brief Convert motor speed from physical units to steps/sec
|
||||
* \param self (r) provides access to the motor's data structure
|
||||
* \param speed in physical units, eg mm/sec degrees/sec
|
||||
* \return the speed in motor steps/sec
|
||||
*/
|
||||
static int motSpeed(/*@dependent@*/pDMC2280Driv self, float speed) {
|
||||
static int motSpeed(pDMC2280Driv self, float speed) {
|
||||
int motSpeed;
|
||||
motSpeed = abs((int)(speed * self->stepsPerX + 0.5));
|
||||
return motSpeed;
|
||||
@@ -151,7 +151,7 @@ static int motSpeed(/*@dependent@*/pDMC2280Driv self, float speed) {
|
||||
* \param acceleration in physical units, eg mm/sec^2 degrees/sec^2
|
||||
* \return the acceleration in motor steps/sec^2
|
||||
*/
|
||||
static int motAccel(/*@dependent@*/pDMC2280Driv self, float accel) {
|
||||
static int motAccel(pDMC2280Driv self, float accel) {
|
||||
int motAccel;
|
||||
motAccel = abs((int)(accel * self->stepsPerX + 0.5));
|
||||
return motAccel;
|
||||
@@ -162,7 +162,7 @@ static int motAccel(/*@dependent@*/pDMC2280Driv self, float accel) {
|
||||
* \param deceleration in physical units, eg mm/sec^2 degrees/sec^2
|
||||
* \return the deceleration in motor steps/sec^2
|
||||
*/
|
||||
static int motDecel(/*@dependent@*/pDMC2280Driv self, float decel) {
|
||||
static int motDecel(pDMC2280Driv self, float decel) {
|
||||
int motDecel;
|
||||
motDecel = abs((int)(decel * self->stepsPerX + 0.5));
|
||||
return motDecel;
|
||||
@@ -178,7 +178,7 @@ static int motDecel(/*@dependent@*/pDMC2280Driv self, float decel) {
|
||||
* - FAILURE
|
||||
* \see SUCCESS FAILURE
|
||||
*/
|
||||
static int DMC2280ReadChar(/*@dependent@*/pDMC2280Driv self, /*@out@*/char *reply) {
|
||||
static int DMC2280ReadChar(pDMC2280Driv self, /*@out@*/char *reply) {
|
||||
int i, status, retries=20, dataLen=1;
|
||||
reply[0] = '\0';
|
||||
for (i=0; i<retries; i++) {
|
||||
@@ -213,12 +213,17 @@ static int DMC2280ReadChar(/*@dependent@*/pDMC2280Driv self, /*@out@*/char *repl
|
||||
/* First character returned by controller is
|
||||
'?' for an invalid command or
|
||||
':' or space for a valid command */
|
||||
static int DMC2280Send(/*@dependent@*/pDMC2280Driv self, /*@observer@*//*@dependent@*/char *command) {
|
||||
static int DMC2280Send(pDMC2280Driv self, char *command) {
|
||||
char cmdValid, pError[ERRLEN], reply[256];
|
||||
char *GetEMsg = "TC 1";
|
||||
int status;
|
||||
|
||||
strncpy(self->lastCmd, command, CMDLEN);
|
||||
if ((self->lastCmd) != command) {
|
||||
/*@-mayaliasunique@ this won't happen unless they overlap */
|
||||
strncpy(self->lastCmd, command, CMDLEN);
|
||||
/*@+mayaliasunique@*/
|
||||
}
|
||||
|
||||
/*@+matchanyintegral@ let size_t from strlen match int */
|
||||
status = writeRS232(self->controller, command, strlen(command));
|
||||
/*@-matchanyintegral@*/
|
||||
@@ -268,7 +273,7 @@ static int DMC2280Send(/*@dependent@*/pDMC2280Driv self, /*@observer@*//*@depend
|
||||
* - FAILURE
|
||||
* \see SUCCESS FAILURE
|
||||
*/
|
||||
static int DMC2280Receive(/*@dependent@*/pDMC2280Driv self, /*@out@*/char *reply) {
|
||||
static int DMC2280Receive(pDMC2280Driv self, /*@out@*/char *reply) {
|
||||
int i, status, retries=20, dataLen=255;
|
||||
reply[0] = '\0';
|
||||
for (i=0; i<retries; i++) {
|
||||
@@ -297,7 +302,7 @@ static int DMC2280Receive(/*@dependent@*/pDMC2280Driv self, /*@out@*/char *reply
|
||||
* - OKOK request succeeded
|
||||
* - HWFault request failed
|
||||
* */
|
||||
static int DMC2280GetPos(/*@dependent@*/void *pData, float *fPos){
|
||||
static int DMC2280GetPos(void *pData, float *fPos){
|
||||
pDMC2280Driv self = NULL;
|
||||
char reply[1024];
|
||||
char cmd[CMDLEN];
|
||||
@@ -335,7 +340,7 @@ static int DMC2280GetPos(/*@dependent@*/void *pData, float *fPos){
|
||||
* - OKOK request succeeded
|
||||
* - HWFault request failed
|
||||
* */
|
||||
static int DMC2280Run(/*@dependent@*/void *pData,float fValue){
|
||||
static int DMC2280Run(void *pData,float fValue){
|
||||
pDMC2280Driv self = NULL;
|
||||
char axis;
|
||||
char cmd[CMDLEN], SH[CMDLEN], BG[CMDLEN], absPosCmd[CMDLEN];
|
||||
@@ -386,7 +391,7 @@ static int DMC2280Run(/*@dependent@*/void *pData,float fValue){
|
||||
* - HWWarn There is a warning from the controller.
|
||||
* - HWIdle The motor has finished driving and is idle.
|
||||
*/
|
||||
static int DMC2280Status(/*@dependent@*/void *pData){
|
||||
static int DMC2280Status(void *pData){
|
||||
pDMC2280Driv self = NULL;
|
||||
char cmd[CMDLEN];
|
||||
int switches;
|
||||
@@ -467,7 +472,7 @@ static int DMC2280Status(/*@dependent@*/void *pData){
|
||||
* \param *error error message
|
||||
* \param errLen maximum error message length allowed by abstract motor
|
||||
*/
|
||||
static void DMC2280Error(/*@dependent@*/void *pData, int *iCode, char *error, int errLen){
|
||||
static void DMC2280Error(void *pData, int *iCode, char *error, int errLen){
|
||||
pDMC2280Driv self = NULL;
|
||||
self = (pDMC2280Driv)pData;
|
||||
assert(self != NULL);
|
||||
@@ -535,7 +540,7 @@ static void DMC2280Error(/*@dependent@*/void *pData, int *iCode, char *error, in
|
||||
* - MOTREDO try to redo the last move.
|
||||
* - MOTFAIL move failed, give up.
|
||||
*/
|
||||
static int DMC2280Fix(/*@dependent@*/void *pData, int iCode,/*@unused@*/ float fValue){
|
||||
static int DMC2280Fix(void *pData, int iCode,/*@unused@*/ float fValue){
|
||||
pDMC2280Driv self = NULL;
|
||||
|
||||
self = (pDMC2280Driv)pData;
|
||||
@@ -565,7 +570,7 @@ static int DMC2280Fix(/*@dependent@*/void *pData, int iCode,/*@unused@*/ float f
|
||||
*
|
||||
* XXX Does abstract motor use the return values?
|
||||
*/
|
||||
static int DMC2280Halt(/*@dependent@*/void *pData){
|
||||
static int DMC2280Halt(void *pData){
|
||||
pDMC2280Driv self = NULL;
|
||||
char cmd[CMDLEN];
|
||||
|
||||
@@ -598,7 +603,7 @@ static int DMC2280Halt(/*@dependent@*/void *pData){
|
||||
* - 1 request succeeded
|
||||
* - 0 request failed
|
||||
* */
|
||||
static int DMC2280GetPar(/*@dependent@*/void *pData, char *name,
|
||||
static int DMC2280GetPar(void *pData, char *name,
|
||||
float *fValue){
|
||||
pDMC2280Driv self = NULL;
|
||||
|
||||
@@ -656,7 +661,7 @@ static int DMC2280GetPar(/*@dependent@*/void *pData, char *name,
|
||||
* - 1 request succeeded
|
||||
* - 0 request failed
|
||||
* */
|
||||
static int DMC2280SetPar(/*@dependent@*/void *pData, SConnection *pCon,
|
||||
static int DMC2280SetPar(void *pData, SConnection *pCon,
|
||||
char *name, float newValue){
|
||||
pDMC2280Driv self = NULL;
|
||||
char pError[ERRLEN];
|
||||
@@ -754,7 +759,7 @@ static int DMC2280SetPar(/*@dependent@*/void *pData, SConnection *pCon,
|
||||
* \param *name (r) name of motor.
|
||||
* \param *pCon (r) connection object.
|
||||
*/
|
||||
static void DMC2280List(/*@dependent@*/void *self, char *name, SConnection *pCon){
|
||||
static void DMC2280List(void *self, char *name, SConnection *pCon){
|
||||
char buffer[BUFFLEN];
|
||||
|
||||
snprintf(buffer, BUFFLEN, "%s.axis = %c\n", name, ((pDMC2280Driv)self)->axisLabel);
|
||||
@@ -785,7 +790,7 @@ static void KillDMC2280(/*@only@*/void *pData){
|
||||
self = (pDMC2280Driv)pData;
|
||||
assert(self != NULL);
|
||||
free(self->name);
|
||||
/*@-temptrans@*/ free(self); /*@+temptrans@*/
|
||||
free(self);
|
||||
return;
|
||||
}
|
||||
/*@only@*/ prs232 createRS232(char *host, int iPort);
|
||||
@@ -831,9 +836,9 @@ static void KillDMC2280(/*@only@*/void *pData){
|
||||
* possible values
|
||||
* - _REQUIRED
|
||||
* - _OPTIONAL
|
||||
* \return a string with the parameter value
|
||||
* \return (r) a reference to a string representation of the parameter value
|
||||
*/
|
||||
/*@observer@*/static char *getParam(/*@dependent@*/SConnection *pCon, Tcl_Interp *pTcl, char *params, char *parName, int mustHave ) {
|
||||
/*@observer@*/ static char *getParam(/*@dependent@*/SConnection *pCon, Tcl_Interp *pTcl, char *params, char *parName, int mustHave ) {
|
||||
char *pPtr=NULL;
|
||||
char pError[ERRLEN];
|
||||
pPtr = Tcl_GetVar2(pTcl,params,parName,TCL_GLOBAL_ONLY);
|
||||
@@ -885,7 +890,7 @@ static void KillDMC2280(/*@only@*/void *pData){
|
||||
pNew->controller = NULL;
|
||||
pNew->name = NULL;
|
||||
pNew->errorCode = 0;
|
||||
pNew->lastCmd = NULL;
|
||||
pNew->lastCmd[0] = '\0';
|
||||
pNew->absEncHome = 0;
|
||||
pNew->cntsPerX = 0;
|
||||
/* Get hostname and port from the list of named parameters */
|
||||
|
||||
Reference in New Issue
Block a user