Compare commits

..

8 Commits

9 changed files with 81 additions and 60 deletions

View File

@ -534,15 +534,6 @@ lockHandler()
debug("AsynDriverInterface::lockHandler(%s)\n",
clientName());
pasynManager->blockProcessCallback(pasynUser, false);
#ifndef ASYN_VERSION // asyn < 4.14
asynStatus status;
status = pasynManager->lockPort(pasynUser);
if(status!=asynSuccess) {
debug("Failed locking port");
}
#endif
connected = connectToAsynPort();
lockCallback(connected ? StreamIoSuccess : StreamIoFault);
}
@ -553,15 +544,6 @@ unlock()
{
debug("AsynDriverInterface::unlock(%s)\n",
clientName());
#ifndef ASYN_VERSION // asyn < 4.14
asynStatus status;
status = pasynManager->unlockPort(pasynUser);
if (status != asynSuccess) {
debug("Failed unlocking port");
}
#endif
pasynManager->unblockProcessCallback(pasynUser, false);
return true;
}

View File

@ -65,7 +65,8 @@ ifdef PCRE
LIB_LIBS += pcre
else
ifneq ($(words $(PCRE_LIB) $(PCRE_INCLUDE)),0)
LIB_SYS_LIBS += pcre
LIB_SYS_LIBS_DEFAULT += pcre
LIB_SYS_LIBS_WIN32 += $(PCRE_LIB)\\pcre
SHRLIB_DEPLIB_DIRS += $(PCRE_LIB)
endif
endif
@ -86,22 +87,11 @@ FORCE:
StreamCore$(OBJ): streamReferences
streamReferences: ../CONFIG_STREAM
@for i in $(BUSSES); \
do echo "extern void* ref_$${i}Interface;"; \
echo "void* p$$i = ref_$${i}Interface;"; \
done > $@
@for i in $(FORMATS); \
do echo "extern void* ref_$${i}Converter;"; \
echo "void* p$$i = ref_$${i}Converter;"; \
done >> $@
$(PERL) ../makeref.pl Interface $(BUSSES) > $@
$(PERL) ../makeref.pl Converter $(FORMATS) >> $@
# create stream.dbd from all RECORDS
$(COMMON_DIR)/$(LIBRARY_DEFAULT).dbd: ../CONFIG_STREAM
@for r in $(RECORDS); \
do echo "device($$r,INST_IO,dev$${r}Stream,\"stream\")"; \
done > $@
@echo "driver(stream)" >> $@
@echo "variable(streamDebug, int)" >> $@
@echo "registrar(streamRegistrar)" >> $@
$(PERL) ../makedbd.pl $(RECORDS) > $@
endif

6
src/makedbd.pl Normal file
View File

@ -0,0 +1,6 @@
for (@ARGV) {
print "device($_,INST_IO,dev${_}Stream,\"stream\")\n";
}
print "driver(stream)\n";
print "variable(streamDebug, int)\n";
print "registrar(streamRegistrar)\n";

6
src/makeref.pl Normal file
View File

@ -0,0 +1,6 @@
$t=@ARGV[0];
shift;
for (@ARGV) {
print "extern void* ref_${_}$t;\n";
print "void* p$_ = ref_${_}$t;\n";
}

View File

@ -25,21 +25,10 @@ PROD_SRCS_vxWorks = -nil-
PROD_LIBS = stream
ifdef PCRE
# With local PCRE package
PROD_LIBS += pcre
else
ifneq ($(words $(PCRE_LIB) $(PCRE_INCLUDE)),0)
# With system wide PCRE installation
PROD_SYS_LIBS += pcre
PROD_DEPLIB_DIRS += $(PCRE_LIB)
endif
endif
ifdef ASYN
# Which types of asyn busses do you have?
ifneq ($(OS_CLASS), WIN32)
# asynDriver up to version 4-8 does not support serial port for Windows!
# asynDriver up to version 4-16 does not support serial port for Windows!
streamApp_DBD += drvAsynSerialPort.dbd
endif
streamApp_DBD += drvAsynIPPort.dbd
@ -69,7 +58,7 @@ include $(TOP)/configure/RULES
clean:: myclean
myclean:
rm -f core* StreamDebug.log
$(RM) core* StreamDebug.log
endif

View File

@ -158,19 +158,22 @@ proc assure {args} {
}
proc escape {string} {
while {![string is print -failindex index $string]} {
set char [string index $string $index]
scan $char "%c" code
switch $char {
"\r" { set escaped "\\r" }
"\n" { set escaped "\\n" }
"\a" { set escaped "\\a" }
"\t" { set escaped "\\t" }
default { set escaped [format "<%02x>" $code] }
set result ""
set length [string length $string]
for {set i 0} {$i < $length} {incr i} {
set c [string index $string $i]
scan $c %c n
if {$n == 13} {
append result "\\r"
} elseif {$n == 10} {
append result "\\n"
} elseif {($n & 127) < 32} {
append result [format "<%02x>" $n]
} else {
append result $c
}
set string [string replace $string $index $index $escaped]
}
return $string
return $result
}
proc finish {} {

View File

@ -45,6 +45,9 @@ set debug 0
startioc
set inf [format %f inf]
set nan [format %f nan]
ioccmd {dbpf DZ:test1.PROC 1}
send "3.14159265359\n"
assure "|3.141593| 3.141593|3.14| 3.14159 | 3.141593|+3.141593|3.1 |3.141593|\n"
@ -56,10 +59,10 @@ send "0\n"
assure "|0.000000| 0.000000|0.00| 0.00000 | 0.000000|+0.000000|0.0 |0.000000|\n"
ioccmd {dbpf DZ:test1.PROC 1}
send "NAN\n"
assure "|nan| nan|nan| nan | nan|+nan|nan |nan|\n"
assure "|$nan| $nan|$nan| $nan | $nan|+$nan|$nan |$nan|\n"
ioccmd {dbpf DZ:test1.PROC 1}
send "-Inf\n"
assure "|-inf| -inf|-inf|-inf |-inf|-inf|-inf |-inf|\n"
assure "|-$inf| -$inf|-$inf|-$inf |-$inf|-$inf|-$inf |-$inf|\n"
ioccmd {dbpf DZ:test1.PROC 1}
send "1e6\n"
assure "|1000000.000000|1000000.000000|1000000.00| 1000000.00000| 1000000.000000|+1000000.000000|1000000.0|1000000.000000|\n"

View File

@ -0,0 +1,41 @@
#!/usr/bin/env tclsh
source streamtestlib.tcl
# Define records, protocol and startup (text goes to files)
# The asynPort "device" is connected to a network TCP socket
# Talk to the socket with send/receive/assure
# Send commands to the ioc shell with ioccmd
set records {
record (ao, "DZ:slow")
{
field (DTYP, "stream")
field (OUT, "@test.proto slow device")
}
record (ao, "DZ:fast")
{
field (DTYP, "stream")
field (OUT, "@test.proto fast device")
}
}
set protocol {
Terminator = LF;
slow { out "slow start"; wait 1000; out "slow finished";}
fast { out "fast"; }
}
set startup {
}
set debug 0
startioc
ioccmd {dbpf DZ:slow 1}
ioccmd {dbpf DZ:fast 1}
assure "slow start\n"
assure "slow finished\n"
assure "fast\n"
finish

View File

@ -1,3 +1,4 @@
rm -f test.* *.out *.ioclog StreamDebug.log
for i in test*
do
if [ $i != testall -a -x $i ]
@ -6,7 +7,7 @@ do
if ! $i "$@"
then
echo -e "\033[31;7mFailed.\033[0m"
(( fail++ ))
(( fail+=1 ))
fi
fi
done