Changed strtok_r to epicsStrtok_r and int8_t to epicsInt8 for portability to Windows

This commit is contained in:
MarkRivers
2008-01-11 21:53:05 +00:00
parent 3b6041d465
commit 271d25f008
5 changed files with 62 additions and 52 deletions
+9 -7
View File
@@ -2,9 +2,9 @@
FILENAME... devOmsCom.cc
USAGE... Data and functions common to all OMS device level support.
Version: $Revision: 1.11 $
Modified By: $Author: sluiter $
Last Modified: $Date: 2007-02-16 20:21:47 $
Version: $Revision: 1.12 $
Modified By: $Author: rivers $
Last Modified: $Date: 2008-01-11 21:53:05 $
*/
/*
@@ -62,9 +62,11 @@ Last Modified: $Date: 2007-02-16 20:21:47 $
*/
#include <string.h>
#include <stdio.h>
#include <errlog.h>
#include <math.h>
#include <epicsThread.h>
#include <epicsString.h>
#include <dbAccess.h>
#include "motorRecord.h"
@@ -300,7 +302,7 @@ RTN_STATUS oms_build_trans(motor_cmnd command, double *parms, struct motorRecord
/* Point "start" to PV name argument. */
tail = NULL;
start = strtok_r(&prem_buff[5], ",", &tail);
start = epicsStrtok_r(&prem_buff[5], ",", &tail);
if (tail == NULL)
goto errorexit;
@@ -311,12 +313,12 @@ RTN_STATUS oms_build_trans(motor_cmnd command, double *parms, struct motorRecord
}
/* Point "start" to PV value argument. */
start = strtok_r(NULL, ",", &tail);
start = epicsStrtok_r(NULL, ",", &tail);
if (tail == NULL)
{
delay = 0.0;
tail = start;
start = strtok_r(NULL, ")", &tail);
start = epicsStrtok_r(NULL, ")", &tail);
if (tail == NULL)
goto errorexit;
}
@@ -324,7 +326,7 @@ RTN_STATUS oms_build_trans(motor_cmnd command, double *parms, struct motorRecord
{
char *last;
last = strtok_r(NULL, ")", &tail);
last = epicsStrtok_r(NULL, ")", &tail);
if (last == NULL)
goto errorexit;
delay = atof(last);
+14 -12
View File
@@ -2,9 +2,9 @@
FILENAME... drvMAXv.cc
USAGE... Motor record driver level support for OMS model MAXv.
Version: $Revision: 1.15 $
Modified By: $Author: sluiter $
Last Modified: $Date: 2007-10-17 19:23:17 $
Version: $Revision: 1.16 $
Modified By: $Author: rivers $
Last Modified: $Date: 2008-01-11 21:53:05 $
*/
/*
@@ -66,9 +66,11 @@ Last Modified: $Date: 2007-10-17 19:23:17 $
*/
#include <string.h>
#include <stdio.h>
#include <dbCommon.h>
#include <drvSup.h>
#include <epicsVersion.h>
#include <epicsString.h>
#include <devLib.h>
#include <dbAccess.h>
#include <epicsThread.h>
@@ -308,8 +310,8 @@ static int set_status(int card, int signal)
got_encoder = false;
}
for (index = 0, p = strtok_r(q_buf, ",", &tok_save); p;
p = strtok_r(NULL, ",", &tok_save), index++)
for (index = 0, p = epicsStrtok_r(q_buf, ",", &tok_save); p;
p = epicsStrtok_r(NULL, ",", &tok_save), index++)
{
switch (index)
{
@@ -421,7 +423,7 @@ static int set_status(int card, int signal)
/* Point "start" to PV name argument. */
tail = NULL;
start = strtok_r(&buffer[5], ",", &tail);
start = epicsStrtok_r(&buffer[5], ",", &tail);
if (tail == NULL)
goto errorexit;
@@ -432,7 +434,7 @@ static int set_status(int card, int signal)
}
/* Point "start" to PV value argument. */
start = strtok_r(NULL, ")", &tail);
start = epicsStrtok_r(NULL, ")", &tail);
if (dbPutField(&addr, DBR_STRING, start, 1L))
{
errPrintf(-1, __FILE__, __LINE__, "invalid value: %s", start);
@@ -947,13 +949,13 @@ static int motor_init()
for (card_index = 0; card_index < MAXv_num_cards; card_index++)
{
int8_t *startAddr;
int8_t *endAddr;
epicsInt8 *startAddr;
epicsInt8 *endAddr;
Debug(2, "motor_init: card %d\n", card_index);
probeAddr = MAXv_addrs + (card_index * MAXv_BRD_SIZE);
startAddr = (int8_t *) probeAddr;
startAddr = (epicsInt8 *) probeAddr;
endAddr = startAddr + MAXv_BRD_SIZE;
Debug(9, "motor_init: devNoResponseProbe() on addr 0x%x\n",
@@ -1017,8 +1019,8 @@ static int motor_init()
send_mess(card_index, ALL_POS, (char) NULL);
recv_mess(card_index, axis_pos, 1);
for (total_axis = 0, pos_ptr = strtok_r(axis_pos, ",", &tok_save);
pos_ptr; pos_ptr = strtok_r(NULL, ",", &tok_save), total_axis++)
for (total_axis = 0, pos_ptr = epicsStrtok_r(axis_pos, ",", &tok_save);
pos_ptr; pos_ptr = epicsStrtok_r(NULL, ",", &tok_save), total_axis++)
{
pmotorState->motor_info[total_axis].motor_motion = NULL;
pmotorState->motor_info[total_axis].status.All = 0;
+14 -12
View File
@@ -2,9 +2,9 @@
FILENAME... drvOms.cc
USAGE... Driver level support for OMS models VME8, VME44 and VS4.
Version: $Revision: 1.25 $
Modified By: $Author: sluiter $
Last Modified: $Date: 2006-01-27 23:56:09 $
Version: $Revision: 1.26 $
Modified By: $Author: rivers $
Last Modified: $Date: 2008-01-11 21:53:05 $
*/
/*
@@ -90,8 +90,10 @@ Last Modified: $Date: 2006-01-27 23:56:09 $
========================stepper motor driver ========================*/
#include <string.h>
#include <stdio.h>
#include <drvSup.h>
#include <epicsVersion.h>
#include <epicsString.h>
#include <devLib.h>
#include <dbAccess.h>
#include <epicsThread.h>
@@ -266,8 +268,8 @@ static int set_status(int card, int signal)
Debug(5, "info = (%s)\n", q_buf);
for (index = 0, p = strtok_r(q_buf, ",", &tok_save); p;
p = strtok_r(NULL, ",", &tok_save), index++)
for (index = 0, p = epicsStrtok_r(q_buf, ",", &tok_save); p;
p = epicsStrtok_r(NULL, ",", &tok_save), index++)
{
switch (index)
{
@@ -385,7 +387,7 @@ static int set_status(int card, int signal)
/* Point "start" to PV name argument. */
tail = NULL;
start = strtok_r(&buffer[5], ",", &tail);
start = epicsStrtok_r(&buffer[5], ",", &tail);
if (tail == NULL)
goto errorexit;
@@ -396,7 +398,7 @@ static int set_status(int card, int signal)
}
/* Point "start" to PV value argument. */
start = strtok_r(NULL, ")", &tail);
start = epicsStrtok_r(NULL, ")", &tail);
if (dbPutField(&addr, DBR_STRING, start, 1L))
{
errPrintf(-1, __FILE__, __LINE__, "invalid value: %s", start);
@@ -1061,13 +1063,13 @@ static int motor_init()
for (card_index = 0; card_index < oms44_num_cards; card_index++)
{
int8_t *startAddr;
int8_t *endAddr;
epicsInt8 *startAddr;
epicsInt8 *endAddr;
Debug(2, "motor_init: card %d\n", card_index);
probeAddr = oms_addrs + (card_index * OMS_BRD_SIZE);
startAddr = (int8_t *) probeAddr + 1;
startAddr = (epicsInt8 *) probeAddr + 1;
endAddr = startAddr + OMS_BRD_SIZE;
Debug(9, "motor_init: devNoResponseProbe() on addr 0x%x\n",
@@ -1125,9 +1127,9 @@ static int motor_init()
send_mess(card_index, ALL_POS, (char) NULL);
recv_mess(card_index, axis_pos, 1);
for (total_axis = 0, pos_ptr = strtok_r(axis_pos, ",", &tok_save);
for (total_axis = 0, pos_ptr = epicsStrtok_r(axis_pos, ",", &tok_save);
pos_ptr;
pos_ptr = strtok_r(NULL, ",", &tok_save), total_axis++)
pos_ptr = epicsStrtok_r(NULL, ",", &tok_save), total_axis++)
{
pmotorState->motor_info[total_axis].motor_motion = NULL;
pmotorState->motor_info[total_axis].status.All = 0;
+15 -13
View File
@@ -2,9 +2,9 @@
FILENAME... drvOms58.cc
USAGE... Motor record driver level support for OMS model VME58.
Version: $Revision: 1.20 $
Modified By: $Author: sluiter $
Last Modified: $Date: 2007-08-16 18:48:12 $
Version: $Revision: 1.21 $
Modified By: $Author: rivers $
Last Modified: $Date: 2008-01-11 21:53:05 $
*/
/*
@@ -99,9 +99,11 @@ Last Modified: $Date: 2007-08-16 18:48:12 $
*/
#include <string.h>
#include <stdio.h>
#include <dbCommon.h>
#include <drvSup.h>
#include <epicsVersion.h>
#include <epicsString.h>
#include <devLib.h>
#include <dbAccess.h>
#include <epicsThread.h>
@@ -406,8 +408,8 @@ static int set_status(int card, int signal)
got_encoder = false;
}
for (index = 0, p = strtok_r(q_buf, ",", &tok_save); p;
p = strtok_r(NULL, ",", &tok_save), index++)
for (index = 0, p = epicsStrtok_r(q_buf, ",", &tok_save); p;
p = epicsStrtok_r(NULL, ",", &tok_save), index++)
{
switch (index)
{
@@ -556,7 +558,7 @@ static int set_status(int card, int signal)
/* Point "start" to PV name argument. */
tail = NULL;
start = strtok_r(&buffer[5], ",", &tail);
start = epicsStrtok_r(&buffer[5], ",", &tail);
if (tail == NULL)
goto errorexit;
@@ -567,7 +569,7 @@ static int set_status(int card, int signal)
}
/* Point "start" to PV value argument. */
start = strtok_r(NULL, ")", &tail);
start = epicsStrtok_r(NULL, ")", &tail);
if (dbPutField(&addr, DBR_STRING, start, 1L))
{
errPrintf(-1, __FILE__, __LINE__, "invalid value: %s", start);
@@ -1010,7 +1012,7 @@ static int motor_init()
volatile struct controller *pmotorState;
volatile struct vmex_motor *pmotor;
STATUS_REG statusReg;
int8_t omsReg;
epicsInt8 omsReg;
long status;
int card_index, motor_index;
char axis_pos[50], encoder_pos[50];
@@ -1042,13 +1044,13 @@ static int motor_init()
for (card_index = 0; card_index < oms58_num_cards; card_index++)
{
int8_t *startAddr;
int8_t *endAddr;
epicsInt8 *startAddr;
epicsInt8 *endAddr;
Debug(2, "motor_init: card %d\n", card_index);
probeAddr = oms_addrs + (card_index * OMS_BRD_SIZE);
startAddr = (int8_t *) probeAddr;
startAddr = (epicsInt8 *) probeAddr;
endAddr = startAddr + OMS_BRD_SIZE;
Debug(9, "motor_init: devNoResponseProbe() on addr 0x%x\n", (epicsUInt32) probeAddr);
@@ -1098,8 +1100,8 @@ static int motor_init()
send_mess(card_index, ALL_POS, (char) NULL);
recv_mess(card_index, axis_pos, 1);
for (total_axis = 0, pos_ptr = strtok_r(axis_pos, ",", &tok_save);
pos_ptr; pos_ptr = strtok_r(NULL, ",", &tok_save), total_axis++)
for (total_axis = 0, pos_ptr = epicsStrtok_r(axis_pos, ",", &tok_save);
pos_ptr; pos_ptr = epicsStrtok_r(NULL, ",", &tok_save), total_axis++)
{
pmotorState->motor_info[total_axis].motor_motion = NULL;
pmotorState->motor_info[total_axis].status.All = 0;
+10 -8
View File
@@ -2,9 +2,9 @@
FILENAME... drvOmsPC68.cc
USAGE... Motor record driver level support for OMS PC68 serial device.
Version: $Revision: 1.6 $
Version: $Revision: 1.7 $
Modified By: $Author: rivers $
Last Modified: $Date: 2007-04-23 20:45:38 $
Last Modified: $Date: 2008-01-11 21:53:05 $
*/
/*
@@ -54,7 +54,9 @@ Last Modified: $Date: 2007-04-23 20:45:38 $
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <epicsThread.h>
#include <epicsString.h>
#include <dbAccess.h>
#include <drvSup.h>
#include <iocsh.h>
@@ -268,8 +270,8 @@ static int set_status(int card, int signal)
Debug(5, "info = (%s)\n", q_buf);
for (index = 0, p = strtok_r(q_buf, ",", &tok_save); p;
p = strtok_r(NULL, ",", &tok_save), index++)
for (index = 0, p = epicsStrtok_r(q_buf, ",", &tok_save); p;
p = epicsStrtok_r(NULL, ",", &tok_save), index++)
{
switch (index)
{
@@ -394,7 +396,7 @@ static int set_status(int card, int signal)
/* Point "start" to PV name argument. */
tail = NULL;
start = strtok_r(&buffer[5], ",", &tail);
start = epicsStrtok_r(&buffer[5], ",", &tail);
if (tail == NULL)
goto errorexit;
@@ -406,7 +408,7 @@ static int set_status(int card, int signal)
}
/* Point "start" to PV value argument. */
start = strtok_r(NULL, ")", &tail);
start = epicsStrtok_r(NULL, ")", &tail);
if (dbPutField(&addr, DBR_STRING, start, 1L))
{
errPrintf(-1, __FILE__, __LINE__, "invalid value: %s",
@@ -776,8 +778,8 @@ static int motor_init()
send_mess (card_index, ALL_POS, (char) NULL);
recv_mess (card_index, axis_pos, 1);
for (total_axis = 0, pos_ptr = strtok_r(axis_pos, ",", &tok_save);
pos_ptr; pos_ptr = strtok_r(NULL, ",", &tok_save),
for (total_axis = 0, pos_ptr = epicsStrtok_r(axis_pos, ",", &tok_save);
pos_ptr; pos_ptr = epicsStrtok_r(NULL, ",", &tok_save),
total_axis++)
{
pmotorState->motor_info[total_axis].motor_motion = NULL;