Compare commits

...

59 Commits

Author SHA1 Message Date
b0c8a14071 start Version 2.8 2018-05-23 11:05:27 +02:00
4feb14ea35 Merge branch 'master' into 2-8 2017-11-03 15:29:45 +01:00
2830f07324 update version number 2017-11-03 13:46:08 +01:00
abd8daafc3 escape all non-ascii chars to avoid problems with UTF terminals 2017-11-03 13:41:38 +01:00
489e783872 Don't change EOS if not necessary. And some improved diagnostics 2017-11-03 13:40:47 +01:00
10d1fa8b02 do not run exceprion handlers from @init 2017-11-02 09:18:24 +01:00
c8bffebfc6 fix version number 2017-11-02 09:17:47 +01:00
97f6beb3ae add rule to install PDF 2017-08-16 10:52:48 +02:00
b80261ba16 source code repo ignore generated pdf file 2017-06-14 17:10:15 +02:00
6a114b2c2c check if wkhtmltopdf is installed, else print message 2017-06-14 17:07:38 +02:00
bf29238762 fix page break in <pre> boxes 2017-06-14 17:07:03 +02:00
13d1fb2ca0 fix formatting problem 2017-06-14 17:06:38 +02:00
cc1ab5685c update documentation 2017-03-21 15:03:13 +01:00
370b3cd8c4 Merge branch 'master' of /tmp/StreamDevice 2017-01-30 16:47:53 +01:00
3a034f843d add examples for 3.14.8 and 3.13.10 to RELEASE 2017-01-30 16:43:27 +01:00
2de8e916b2 add standalone stuff for 3.13 build 2017-01-30 16:41:03 +01:00
6044edfdd9 Merge branch 'master' of github.com:paulscherrerinstitute/StreamDevice 2017-01-30 12:03:24 +01:00
836388cd22 Merge pull request #4 from hhslepicka/write_mbbo_fix
Removing conflict at write in devmmboDirectStream.c
2017-01-30 12:01:47 +01:00
2685a43760 Format %0s pads with null bytes instead of spaces 2017-01-30 11:58:04 +01:00
0eed3ee9c7 for 3.13 compatibility don't use epicsVsnprintf 2017-01-30 11:55:13 +01:00
c5e3e89e44 remove compiler warning 2017-01-30 11:54:43 +01:00
1f27983505 Removing conflict at write in devmmboDirectStream.c 2017-01-27 12:07:19 -08:00
146a8c895f old compilers complain about comma at end of enum list 2017-01-25 17:17:42 +01:00
efd5a0cbcd some compatibility work 2017-01-25 16:40:58 +01:00
2968231b60 renamed doc to documentation so that make distclean does not delete it 2017-01-25 16:13:18 +01:00
ea2238aa53 fix for previous change 2017-01-25 15:57:24 +01:00
d22e1a5f4a make compatible to 3.14.8- and remove duplicate code 2017-01-25 15:28:46 +01:00
31189ebecf move scalcout to src 2017-01-25 15:02:24 +01:00
d42e5a7a9e fixes for 3.13 2017-01-25 14:58:35 +01:00
e13aa2a96f add external modules 2017-01-25 14:42:35 +01:00
ae021ffeab update .gitignore with generated directories 2017-01-25 13:59:12 +01:00
5a9d89822f change macroname to simplify PSI GNUmakefile 2017-01-25 12:04:40 +01:00
054b0c0e3f remove compiler warning 2017-01-25 11:37:41 +01:00
ac07ac3dcf fix standard EPICS build system 2017-01-25 11:37:15 +01:00
0195386606 add format error checking to exec command 2017-01-25 10:35:58 +01:00
0026959b1e fix waveform records printing unsigned integer formats like %c 2017-01-25 10:35:17 +01:00
450e88d9a9 typo in docu fixed 2017-01-24 09:24:59 +01:00
a4888634b6 make compatible to standard EPICS build system 2017-01-19 16:55:28 +01:00
46a68831c2 get isnan and isinf for old 3.13 (vxWorks only) as well as for 3.14+ EPICS 2017-01-19 16:52:02 +01:00
537d573983 Windows does not like macros after strings without space 2017-01-19 16:43:43 +01:00
96450e7010 Merge branch 'master' of github.com:paulscherrerinstitute/StreamDevice 2017-01-19 09:49:49 +01:00
31e1243eed Merge pull request #2 from MarkRivers/master
Fixes to build on Visual Studio 2010
2017-01-19 09:44:40 +01:00
0a90eb3d9c fix ai/ao conversion when using LINR=NO CONVERSION together with ASLO or AOFF 2017-01-18 16:03:02 +01:00
65f46aec36 New file to ignore generated files 2017-01-13 11:12:37 -06:00
37d14caa5b Use epicsMath.h to define isnan and isinf if needed; would not compile on Visual Studio 2010 2017-01-13 11:11:58 -06:00
384474f6fd Merge pull request #1 from mesamike/patch-1
Add missing include in StreamBuffer.h
2016-11-22 09:20:49 +01:00
17d8592574 Update StreamBuffer.h 2016-11-17 14:24:08 -03:00
0936ac7840 version update 2016-08-05 12:04:07 +02:00
704ece6231 Disable error messages by default in order to prevent filling the log. Set variable streamDebug to 1 to enable error messages. 2016-08-05 12:03:50 +02:00
5c6e98127e typo fixed 2016-08-05 12:01:52 +02:00
8805437c68 remove unneeded file 2016-08-02 11:18:15 +02:00
3acf791409 make docu for %r converer more specific about %.2r versus %2r 2016-07-01 10:56:46 +02:00
0ba674a341 workaround for mbboDirect bug 2016-07-01 10:38:38 +02:00
40c33abac7 workaround for mbboDirect bug 2016-07-01 10:18:34 +02:00
bc67317b0b change the meaning of pre for regsub slightly 2016-06-15 14:52:45 +02:00
06e212c66e version macros updated 2016-06-14 12:06:30 +02:00
7b314ccffd bugfix in regsub 2016-06-14 12:00:02 +02:00
1d84986ee8 do not fill log files with lock errors 2016-06-14 11:43:30 +02:00
2ca8a129f7 regsub converter added 2016-06-14 11:36:36 +02:00
90 changed files with 1202 additions and 277 deletions

7
.cvsignore Normal file
View File

@ -0,0 +1,7 @@
O.*
*~
bin
lib
dbd
include
*.pdf

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
O.*
*~
bin
lib
dbd
include
*.pdf

View File

@ -1,38 +1,22 @@
# Remove this file if not using the PSI build system
ifeq ($(wildcard /ioc/tools/driver.makefile),)
$(warning It seems you do not have the PSI build environment. Remove GNUmakefile.)
include Makefile
else
include /ioc/tools/driver.makefile
EXCLUDE_VERSIONS = 3.13.2
PROJECT=stream
BUILDCLASSES += Linux
#DOCUDIR = doc
DOCUDIR = documentation
BUSSES += AsynDriver
BUSSES += Dummy
PCRE=1
ASYN=1
-include src/CONFIG_STREAM
FORMATS += Enum
FORMATS += BCD
FORMATS += Raw
FORMATS += RawFloat
FORMATS += Binary
FORMATS += Checksum
FORMATS += Regexp
FORMATS += MantissaExponent
FORMATS += Timestamp
RECORDTYPES += aai aao
RECORDTYPES += ao ai
RECORDTYPES += bo bi
RECORDTYPES += mbbo mbbi
RECORDTYPES += mbboDirect mbbiDirect
RECORDTYPES += longout longin
RECORDTYPES += stringout stringin
RECORDTYPES += waveform
SOURCES += $(RECORDTYPES:%=src/dev%Stream.c)
SOURCES += $(RECORDS:%=src/dev%Stream.c)
SOURCES += $(FORMATS:%=src/%Converter.cc)
SOURCES += $(BUSSES:%=src/%Interface.cc)
SOURCES += $(wildcard src/Stream*.cc)
SOURCES += src/StreamVersion.c
SOURCES += $(STREAM_SRCS:%=src/%)
HEADERS += devStream.h
HEADERS += StreamFormat.h
@ -40,10 +24,6 @@ HEADERS += StreamFormatConverter.h
HEADERS += StreamBuffer.h
HEADERS += StreamError.h
ifneq (${EPICS_BASETYPE},3.13)
RECORDTYPES += calcout
endif
StreamCore.o: streamReferences
streamReferences:
@ -54,3 +34,4 @@ export DBDFILES = streamSup.dbd
streamSup.dbd:
@echo Creating $@
perl ../src/makedbd.pl $(RECORDTYPES) > $@
endif

5
MODULE
View File

@ -1,5 +0,0 @@
# Please change the following email with yours.
Email: dirk.zimoch@psi.ch
Module-Name: StreamDevice2
Description: StreamDevice2
Project-Name:

View File

@ -1,24 +1,29 @@
TOP = ..
DIRS = src
streamApp_DEPEND_DIRS = src
# Look if we have EPICS R3.13 or R3.14
ifeq ($(wildcard $(TOP)/configure),)
# EPICS R3.13
include $(TOP)/config/CONFIG_APP
CONFIG = $(TOP)/config
else
ifneq ($(wildcard $(TOP)/configure),)
# EPICS R3.14
DIRS = configure
include $(TOP)/configure/CONFIG
else ifneq ($(wildcard $(TOP)/config),)
# EPICS R3.13
CONFIG = $(TOP)/config
DIRS = config
include $(TOP)/config/CONFIG_APP
else
TOP = .
DIRS = configure
include $(TOP)/configure/CONFIG
ifneq ($(words $(CALC) $(SYNAPPS)), 0)
# with synApps calc module (contains scalcout)
DIRS += srcSynApps
srcSynApps_DEPEND_DIRS = src
streamApp_DEPEND_DIRS += srcSynApps
endif
endif
DIRS += src
src_DEPEND_DIRS = configure
DIRS += streamApp
streamApp_DEPEND_DIRS = src
include $(CONFIG)/RULES_DIRS
include $(CONFIG)/RULES_TOP
documentation/stream.pdf: documentation/*.html documentation/*.css documentation/*.png
cd documentation; makepdf
install: documentation/stream.pdf

3
config/CONFIG Normal file
View File

@ -0,0 +1,3 @@
#CONFIG
# Add any changes to make rules here
#CROSS_COMPILER_TARGET_ARCHS = mv167

20
config/CONFIG_APP Normal file
View File

@ -0,0 +1,20 @@
#CONFIG_APP
include $(TOP)/config/RELEASE
-include $(TOP)/config/RELEASE.$(HOST_ARCH)
include $(EPICS_BASE)/config/CONFIG
INSTALL_LOCATION = $(TOP)
ifdef INSTALL_LOCATION_APP
INSTALL_LOCATION = $(INSTALL_LOCATION_APP)
endif
ifdef T_A
-include $(TOP)/config/O.$(T_A)/CONFIG_APP_INCLUDE
endif
# Where to install databases
INSTALL_DB = $(INSTALL_LOCATION)/db
# dbst based database optimization (default: NO)
DB_OPT = NO
# May be overridden if not all databases should be installed
INSTALLDB = $(DB)
include $(TOP)/config/CONFIG

9
config/Makefile Normal file
View File

@ -0,0 +1,9 @@
#
# Makefile,v 1.1.2.1 1999/07/15 19:55:30 jba Exp
#
TOP=..
include $(TOP)/config/CONFIG_APP
include $(TOP)/config/RULES_ARCHS

21
config/Makefile.Host Normal file
View File

@ -0,0 +1,21 @@
#
# Makefile.Host,v 1.1.2.3 2001/09/14 19:39:14 anj Exp
#
TOP=../..
include $(TOP)/config/CONFIG_APP
TARGETS = checkRelease CONFIG_APP_INCLUDE
include $(TOP)/config/RULES.Host
inc:: $(TARGETS)
CONFIG_APP_INCLUDE: $(wildcard $(TOP)/config/RELEASE*) $(TOP)/config/CONFIG_APP
$(PERL) $(TOP)/config/convertRelease.pl $@
checkRelease:
$(PERL) $(TOP)/config/convertRelease.pl $@
.PHONY :: checkRelease

15
config/Makefile.Vx Normal file
View File

@ -0,0 +1,15 @@
#
# Makefile.Vx,v 1.1.2.3 2001/09/14 19:39:15 anj Exp
#
TOP=../..
include $(TOP)/config/CONFIG_APP
TARGETS = CONFIG_APP_INCLUDE
include $(TOP)/config/RULES.Vx
inc:: $(TARGETS)
CONFIG_APP_INCLUDE: $(wildcard $(TOP)/config/RELEASE*) $(TOP)/config/CONFIG_APP
$(PERL) $(TOP)/config/convertRelease.pl -h $(HOST_ARCH) $@

1
config/RELEASE Normal file
View File

@ -0,0 +1 @@
include $(TOP)/configure/RELEASE

203
config/RULES.Db Normal file
View File

@ -0,0 +1,203 @@
# RULES.Db,v 1.9.6.6 2003/03/25 23:13:22 jba Exp
#
# Rules for making things related to databases
#
MAKEBPT = $(EPICS_BASE_HOST_BIN)/makeBpt$(EXE)
DBLOADTEMPLATE = $(EPICS_BASE_HOST_BIN)/dbLoadTemplate$(EXE)
DBEXPAND = $(EPICS_BASE_HOST_BIN)/dbExpand$(EXE)
DBST = dbst
MAKEDBDEPENDS = $(PERL) $(TOP)/config/makeDbDepends.pl
REPLACEVAR = $(PERL) $(TOP)/config/replaceVAR.pl
ifndef WIN32
TOUCH = touch
else
TOUCH = $(PERL) $(TOP)/config/touch.pl
endif
#-----------------------------------------------------------------
# if we are not building base add base dbd dirs
ifneq ($(EPICS_BASE),$(TOP))
ifneq ($(EPICS_BASE),$(INSTALL_LOCATION))
EPICS_DBDFLAGS += -I $(EPICS_BASE)/dbd
endif
endif
#---------------------------------------------------------------
# ----------------------------------------------------
# create names (lists) for installed things
# ----------------------------------------------------
INSTALL_BPTS = $(BPTS:%= $(INSTALL_DBD)/%)
INSTALL_DBDS = $(DBDINSTALL:%= $(INSTALL_DBD)/%)
INSTALL_DBDNAME = $(DBDNAME:%= $(INSTALL_DBD)/%)
INSTALL_DATA = $(INSTALLDB:%=$(INSTALL_DB)/%)
INSTALL_TEMPLATES = $(filter %.template,$(INSTALL_DATA))
#---------------------------------------------------------------
# Main targets
all:: install
inc:: $(INSTALL_DBDS) $(INSTALL_BPTS) $(INSTALL_TEMPLATES)
rebuild:: clean install
install:: inc buildInstall
buildInstall:: build $(INSTALL_DATA)
depends::
clean::
@echo "Cleaning"
@$(RM) $(DB) $(DBDNAME) *.template *.substitutions *.db.raw \
*.db-stamp *.edf esiread.cnf
##################################################### "Foreign" templates
TEMPLATE_LINKS = $(filter-out $(notdir $(USES_TEMPLATE)), $(USES_TEMPLATE))
TEMPLATE_FILES = $(filter $(notdir $(USES_TEMPLATE)), $(USES_TEMPLATE))
DB_STAMP = $(patsubst %.db, %.db-stamp, $(DB))
DB_REALTARGET = $(patsubst %.db-stamp, %.db, $@)
ifneq '$(TEMPLATE_LINKS)' ''
build:: $(notdir $(TEMPLATE_LINKS))
endif
build:: $(INSTALL_DBDNAME) $(TEMPLATE_FILES) $(DB_STAMP)
$(notdir $(TEMPLATE_LINKS)): %.template:
ifndef WIN32
@$(RM) $(notdir $(TEMPLATE_LINKS))
ln -s $(TEMPLATE_LINKS) .
# Workaround for dbLoadTemplate bug: terminate here if link target doesn't exist
@cat $(TEMPLATE_LINKS) > /dev/null
else
@$(RM) $(notdir $(TEMPLATE_LINKS))
$(CP) $(TEMPLATE_LINKS) .
endif
##################################################### Inflated or plain databases
$(INSTALL_DB)/%.db: %.db-stamp
@echo "Installing database $@"
@$(INSTALL) -d -m 644 $(patsubst %.db-stamp, %.db, $<) $(@D)
# Must have DBDNAME defined to use dbst optimization
ifndef DBDNAME
DB_OPT = NO
endif
# dbst based database optimization
ifeq '$(DB_OPT)' 'YES'
.PRECIOUS: %.db.raw
%.db-stamp: %.db.raw $(INSTALL_DBD)/$(DBDNAME)
@echo "Optimizing database $@"
$(DBST) $(INSTALL_DBD)/$(DBDNAME) $< -d > $(DB_REALTARGET)
@$(TOUCH) $@
%.db-stamp: %.t.db.raw $(INSTALL_DBD)/$(DBDNAME)
@echo "Optimizing database $@"
$(DBST) $(INSTALL_DBD)/$(DBDNAME) $< -d > $(DB_REALTARGET)
@$(TOUCH) $@
else
# NO optimization => move it and keep a stamp
%.db-stamp: %.db.raw
@$(MV) $< $(DB_REALTARGET)
@$(TOUCH) $@
@$(TOUCH) $<
%.db-stamp: %.t.db.raw
@$(MV) $< $(DB_REALTARGET)
@$(TOUCH) $@
@$(TOUCH) $<
endif
%.t.db.raw: %.substitutions
@echo "Inflating database from $<"
@$(RM) $@
@$(DBLOADTEMPLATE) $< > $@
##################################################### CapFast filter
%.edf:: ../%.sch $(DEPSCHS)
@if [ ! -f cad.rc -a -r ../cad.rc ] ; then ln -s ../cad.rc ; fi
$(SCH2EDIF) $(SCH2EDIF_SYSFLAGS) $(SCH2EDIF_FLAGS) $<
##################################################### Substitution files
$(INSTALL_DB)/%.substitutions: %.substitutions
@echo "Installing $@"
@$(INSTALL) -d -m 644 $(@F) $(@D)
%.substitutions:: ../%.substitutions
@$(CP) $< $@
ifdef CREATESUBSTITUTIONS
%.substitutions:: $(word $(words $(CREATESUBSTITUTIONS)),$(CREATESUBSTITUTIONS))
@$(CREATESUBSTITUTIONS) $*
endif
# Better make it PRECIOUS (to get around make bug)
.PRECIOUS: %.substitutions
##################################################### Template databases
# Installed template files (dbLoadTemplate() on IOC side)
$(INSTALL_DB)/%.template: %.template
@echo "Installing $@"
@$(INSTALL) -d -m 644 $(@F) $(@D)
%.template:: ../%.template
@$(CP) $< $@
%.template: %.edf
$(E2DB) $(E2DB_SYSFLAGS) $(E2DB_FLAGS) -n $@.VAR $<
@$(REPLACEVAR) < $@.VAR > $@
@$(RM) $@.VAR
##################################################### Flat databases
%.db.raw:: ../%.db
$(CP) $< $@
%.db.raw: %.edf
$(E2DB) $(E2DB_SYSFLAGS) $(E2DB_FLAGS) -n $@.VAR $<
@$(REPLACEVAR) < $@.VAR > $@
@$(RM) $@.VAR
##################################################### DBD stuff
$(INSTALL_DBD)/%: %
@echo "Installing $@"
@$(INSTALL) -d -m 644 $< $(@D)
$(INSTALL_DBD)/%:: ../%
@echo "Installing $@"
@$(INSTALL) -d -m 644 $< $(@D)
bpt%.dbd: bpt%.data
$(RM) $@
$(MAKEBPT) $<
bpt%.dbd:: ../bpt%.data
$(RM) $@
$(MAKEBPT) $<
# Patch for old applications
ifdef USER_DBDFLAGS
DBDFLAGS = $(USER_DBDFLAGS)
endif
ifdef DBDEXPAND
$(DBDNAME): ../$(DBDEXPAND)
@echo "Expanding dbd"
@$(RM) $@
$(DBEXPAND) $(DBDFLAGS) $< > dbExpand.tmp
$(MV) dbExpand.tmp $@
endif
##################################################### Dependencies
DEPENDS: $(filter $(patsubst %.db, %.substitutions, $(DB)), $(wildcard *.substitutions))
@$(MAKEDBDEPENDS) $^
-include DEPENDS

3
config/RULES.Host Normal file
View File

@ -0,0 +1,3 @@
#RULES.Host
include $(EPICS_BASE)/config/RULES.Host

7
config/RULES.Vx Normal file
View File

@ -0,0 +1,7 @@
#RULES.Vx
include $(EPICS_BASE)/config/RULES.Vx
inc:: $(INSTALL_INCREC)
# Library should be rebuilt because LIBOBJS may have changed.
$(LIBNAME): ../Makefile.Vx

9
config/RULES.ioc Normal file
View File

@ -0,0 +1,9 @@
#RULES.ioc
include $(EPICS_BASE)/config/RULES_DIRS
buildInstall:: cdCommands
cdCommands: Makefile $(wildcard $(TOP)/config/RELEASE*)
@$(PERL) $(TOP)/config/convertRelease.pl -a $(ARCH) -h $(HOST_ARCH) $@
clean::
@$(RM) cdCommands

4
config/RULES.iocBoot Normal file
View File

@ -0,0 +1,4 @@
#RULES.iocBoot
DIRS += $(wildcard ioc*)
DIRS += $(wildcard as*)
include $(EPICS_BASE)/config/RULES_DIRS

14
config/RULES.munch Normal file
View File

@ -0,0 +1,14 @@
MUNCH = $(PERL) $(INSTALL_LOCATION)/bin/$(HOST_ARCH)/munch.pl
# The original 3.13.10 munching rule does not really work well
build:: $(LIBNAME).munch
buildInstall:: $(INSTALL_BIN)/$(LIBNAME).munch
%.munch: %
$(RM) $*_ctct.o $*_ctdt.c
$(NM) $< | $(MUNCH) > $*_ctdt.c
$(GCC) -traditional $(CFLAGS) -fdollars-in-identifiers -c $(SOURCE_FLAG) $*_ctdt.c
$(LINK.c) $@ $< $*_ctdt.o

2
config/RULES_ARCHS Normal file
View File

@ -0,0 +1,2 @@
#RULES_ARCHS
include $(EPICS_BASE)/config/RULES_ARCHS

2
config/RULES_DIRS Normal file
View File

@ -0,0 +1,2 @@
#RULES_DIRS
include $(EPICS_BASE)/config/RULES_DIRS

5
config/RULES_TOP Normal file
View File

@ -0,0 +1,5 @@
#RULES_TOP
include $(EPICS_BASE)/config/RULES_TOP
uninstall::
@$(RMDIR) $(INSTALL_DB)

186
config/convertRelease.pl Normal file
View File

@ -0,0 +1,186 @@
eval 'exec perl -S $0 ${1+"$@"}' # -*- Mode: perl -*-
if $running_under_some_shell; # convertRelease.pl
#
# convertRelease.pl,v 1.1.2.1 2001/09/14 19:39:15 anj Exp
#
# Parse config/RELEASE file(s) and generate a derived output file.
#
# This tool replaces makeConfigAppInclude.pl and makeIocCdCommands.pl
# and adds consistency checks for RELEASE files.
#
use Cwd;
use Getopt::Std;
$cwd = cwd();
$cwd =~ s/\/tmp_mnt//; # hack for sun4
$cwd =~ s/\\/\//g; # hack for win32
getopt "aht";
if ($opt_a) {
$arch = $opt_a;
} else { # Look for O.<arch> in current path
$_ = $cwd;
($arch) = /.*\/O.([\w-]+)$/;
}
$hostarch = $arch;
$hostarch = $opt_h if ($opt_h);
if ($opt_t) {
$top = $opt_t;
} else { # Find $top from current path
$top = $cwd;
$top =~ s/\/iocBoot.*//;
$top =~ s/\/config\/O\..*//;
}
unless (@ARGV == 1) {
print "Usage: convertRelease.pl [-a arch] [-h hostarch] [-t top] outfile\n";
print " where outfile is be one of:\n";
print "\tcheckRelease - checks consistency with support apps\n";
print "\tcdCommands - generate cd path strings for IOC use\n";
print "\tCONFIG_APP_INCLUDE - additional build variables\n";
exit 2;
}
$outfile = $ARGV[0];
# TOP refers to this application
%macros = (TOP => $top);
@apps = (TOP); # Provides the order of apps in RELEASE file
# Read the RELEASE file(s)
$relfile = "$top/config/RELEASE";
die "Can't find config/RELEASE file" unless (-r $relfile);
&readRelease($relfile, \%macros, \@apps);
if ($hostarch) {
$relfile .= ".$hostarch";
&readRelease($relfile, \%macros, \@apps) if (-r $relfile);
}
# This is a perl switch statement:
for ($outfile) {
/CONFIG_APP_INCLUDE/ and do { &configAppInclude; last; };
/cdCommands/ and do { &cdCommands; last; };
/checkRelease/ and do { &checkRelease; last; };
die "Output file type \'$outfile\' not supported";
}
sub readRelease {
my ($file, $Rmacros, $Rapps) = @_;
# $Rmacros is a reference to a hash, $Rapps a ref to an array
my ($pre, $macro, $post, $path);
local *IN;
open(IN, $file) or die "Can't open $file: $!\n";
while (<IN>) {
chomp;
s/\s*#.*$//; # Remove trailing comments
next if /^\s*$/; # Skip blank lines
# Expand all macros in the line:
while (($pre,$macro,$post) = /(.*)\$\((\w+)\)(.*)/, $macro ne "") {
$_ = $pre . $Rmacros->{$macro} . $post;
}
# Handle "<macro> = <path>"
($macro, $path) = /^\s*(\w+)\s*=\s*(.*)/;
if ($macro ne "") {
$Rmacros->{$macro} = $path;
push @$Rapps, $macro;
next;
}
# Handle "include <path>" syntax
($path) = /^\s*include\s+(.*)/;
&readRelease($path, $Rmacros, $Rapps) if (-r $path);
}
close IN;
}
sub configAppInclude {
@includes = grep !/^(TOP|TEMPLATE_TOP)$/, @apps;
unlink($outfile);
open(OUT,">$outfile") or die "$! creating $outfile";
print OUT "# Do not modify this file, changes made here will\n";
print OUT "# be lost when the application is next rebuilt.\n\n";
if ($arch) {
foreach $app (@includes) {
$path = $macros{$app};
next unless (-d "$path/bin/$arch");
print OUT "${app}_BIN = \$($app)/bin/$arch\n";
}
foreach $app (@includes) {
$path = $macros{$app};
next unless (-d "$path/lib/$arch");
print OUT "${app}_LIB = \$($app)/lib/$arch\n";
}
}
foreach $app (@includes) {
$path = $macros{$app};
next unless (-d "$path/include");
print OUT "EPICS_INCLUDES += -I\$($app)/include\n";
}
foreach $app (@includes) {
$path = $macros{$app};
next unless (-d "$path/dbd");
print OUT "EPICS_DBDFLAGS += -I \$($app)/dbd\n";
}
close OUT;
}
sub cdCommands {
die "Architecture not set (use -a option)" unless ($arch);
@includes = grep !/^TEMPLATE_TOP$/, @apps;
# if -t <top> was given, substitute it in the startup path
$startup = $cwd;
$startup =~ s/.*(\/iocBoot\/.*)/$top$1/ if ($opt_t);
unlink($outfile);
open(OUT,">$outfile") or die "$! creating $outfile";
print OUT "startup = \"$startup\"\n";
print OUT "appbin = \"$top/bin/$arch\"\n"; # compatibility with R3.13.1
foreach $app (@includes) {
$path = $macros{$app};
$lcapp = lc($app);
print OUT "$lcapp = \"$path\"\n" if (-d $path);
print OUT "${lcapp}bin = \"$path/bin/$arch\"\n" if (-d "$path/bin/$arch");
}
close OUT;
}
sub checkRelease {
$status = 0;
delete $macros{TOP};
delete $macros{TEMPLATE_TOP};
while (($app, $path) = each %macros) {
%check = (TOP => $path);
@order = ();
$relfile = "$path/config/RELEASE";
&readRelease($relfile, \%check, \@order) if (-r $relfile);
if ($hostarch) {
$relfile .= ".$hostarch";
&readRelease($relfile, \%check, \@order) if (-r $relfile);
}
delete $check{TOP};
while (($parent, $ppath) = each %check) {
if (exists $macros{$parent} && ($macros{$parent} ne $ppath)) {
print "\n" unless ($status);
print "Definition of $parent conflicts with $app support.\n";
print "In this application config/RELEASE defines\n";
print "\t$parent = $macros{$parent}\n";
print "but $app at $path has\n";
print "\t$parent = $ppath\n";
$status = 1;
}
}
}
print "\n" if ($status);
exit $status;
}

23
config/makeDbDepends.pl Normal file
View File

@ -0,0 +1,23 @@
eval 'exec perl -S $0 ${1+"$@"}' # -*- Mode: perl -*-
if $running_under_some_shell; # makeDbDepends.pl
# Called from within the object directory.
# Searches the .substitutions files (from the command line) for
# "file xxx {" entries to create a .DEPENDS file
open(OUT, ">.DEPENDS") or die "Cannot open .DEPENDS: $!";
foreach $file (@ARGV) {
open(IN, "<$file") or die "Cannot open $file: $!";
@substfile = <IN>;
close IN or die "Cannot close $file: $!";
@depends = grep { s/^\s*file\s*(.*)\s*\{.*$/\1/ } @substfile;
chomp @depends;
if (@depends) {
$file =~ s/\.substitutions/\.t.db.raw/;
print OUT "${file}:: @depends\n";
}
}
close OUT or die "Cannot close $file: $!";

12
config/replaceVAR.pl Normal file
View File

@ -0,0 +1,12 @@
eval 'exec perl -S $0 ${1+"$@"}' # -*- Mode: perl -*-
if $running_under_some_shell; # replaceVAR.pl
# Called from within the object directory
# Replaces VAR(xxx) with $(xxx)
# and VAR_xxx_ with $(xxx)
while (<STDIN>) {
s/VAR\(/\$\(/g;
s/VAR_([^_]*)_/\$\($1\)/g;
print;
}

31
config/touch.pl Normal file
View File

@ -0,0 +1,31 @@
#!/usr/bin/perl
#
# unix touch in Perl
use File::Copy;
use File::Basename;
sub Usage
{
my ($txt) = @_;
print "Usage:\n";
print "\ttouch file [ file2 file3 ...]\n";
print "\nError: $txt\n" if $txt;
exit 2;
}
# need at least one arg: ARGV[0]
Usage("need more args") if $#ARGV < 0;
@targets=@ARGV[0..$#ARGV];
foreach $file ( @targets )
{
open(OUT,">$file") or die "$! creating $file";
#print OUT "NUL\n";
close OUT;
}
# EOF touch.pl

14
configure/CONFIG Normal file
View File

@ -0,0 +1,14 @@
#CONFIG
include $(TOP)/configure/CONFIG_APP
# Add any changes to make definitions here
#CROSS_COMPILER_TARGET_ARCHS = vxWorks-68040
#CROSS_COMPILER_TARGET_ARCHS =
# Use this when your IOC and the host use different paths
# to access the application. Typically this will be
# used with the Microsoft FTP server or with NFS mounts. Use
# is indicated by failure of the cdCommands script on
# vxWorks. You must rebuild in the iocBoot directory
# before this takes effect.
#IOCS_APPL_TOP = <the top of the application as seen by the IOC>

27
configure/CONFIG_APP Normal file
View File

@ -0,0 +1,27 @@
# CONFIG_APP
include $(TOP)/configure/RELEASE
-include $(TOP)/configure/RELEASE.$(EPICS_HOST_ARCH)
-include $(TOP)/configure/RELEASE.Common.$(T_A)
-include $(TOP)/configure/RELEASE.$(EPICS_HOST_ARCH).$(T_A)
ifneq ($(wildcard $(EPICS_BASE)/configure),)
CONFIG=$(EPICS_BASE)/configure
else
CONFIG=$(EPICS_BASE)/config
DIRS += config
endif
include $(CONFIG)/CONFIG
INSTALL_LOCATION = $(TOP)
ifdef INSTALL_LOCATION_APP
INSTALL_LOCATION = $(INSTALL_LOCATION_APP)
endif
ifdef T_A
-include $(TOP)/configure/O.$(T_A)/CONFIG_APP_INCLUDE
endif
# dbst based database optimization (default: NO)
DB_OPT = NO
HOST_OPT=NO

15
configure/Makefile Normal file
View File

@ -0,0 +1,15 @@
# Makefile
TOP=..
include $(TOP)/configure/CONFIG
# Set the following to NO to disable consistency checking of
# the support applications defined in $(TOP)/configure/RELEASE
CHECK_RELEASE = YES
TARGETS = $(CONFIG_TARGETS)
CONFIGS += $(subst ../,,$(wildcard $(CONFIG_INSTALLS)))
include $(TOP)/configure/RULES

29
configure/RELEASE Normal file
View File

@ -0,0 +1,29 @@
#RELEASE Location of external products
# Run "gnumake clean uninstall install" in the application
# top directory each time this file is changed.
#
# NOTE: The build does not check dependancies on files
# external to this application. Thus you should run
# "gnumake clean uninstall install" in the top directory
# each time EPICS_BASE, SNCSEQ, or any other external
# module defined in the RELEASE file is rebuilt.
TEMPLATE_TOP=$(EPICS_BASE)/templates/makeBaseApp/top
# If you don't want to install into $(TOP) then
# define INSTALL_LOCATION_APP here
#INSTALL_LOCATION_APP=<fullpathname>
EPICS_BASE=/usr/local/epics/base-3.14.12
ASYN=~/top/asyn4-30
CALC=~/top/SynApps/calc-2-8
PCRE=~/top/pcre-7.2
#3.14.8 does not understand ~
#EPICS_BASE=/usr/local/epics/base-3.14.8
#ASYN=/afs/psi.ch/user/z/zimoch/top/asyn-4.10
##Example 3.13 build
#EPICS_BASE=/usr/local/epics/base-3.13.10
#ASYN=/afs/psi.ch/user/z/zimoch/top_3.13/4-6
#COMPAT=/afs/psi.ch/user/z/zimoch/top_3.13

9
configure/RULES Normal file
View File

@ -0,0 +1,9 @@
#CONFIG
ifneq ($(wildcard $(EPICS_BASE)/configure),)
include $(EPICS_BASE)/configure/RULES
else
include $(EPICS_BASE)/config/RULES_ARCHS
endif
# Library should be rebuilt because LIBOBJS may have changed.
$(LIBNAME): ../Makefile

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 187 B

After

Width:  |  Height:  |  Size: 187 B

View File

Before

Width:  |  Height:  |  Size: 187 B

After

Width:  |  Height:  |  Size: 187 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -266,6 +266,11 @@ The empty string matches.
With the <code>#</code> flag <code>%s</code> matches a sequence of not-null
characters instead of non-whitespace characters.
</p>
<p>
With the <code>0</code> flag <code>%s</code> pads with 0 bytes instead of
spaces.
</p>
<a name="cset"></a>
<h2>6. Standard Charset STRING Converter (<code>%[<em>charset</em>]</code>)</h2>
@ -367,9 +372,12 @@ endian</em>, i.e. least significant byte first.
With the <code>0</code> flag, the value is unsigned, otherwise signed.
</p>
<p>
In output, the <em>prec</em> (or sizeof(long) whatever is less) least
In output, the <em>precision</em> (or sizeof(long) whatever is less) least
significant bytes of the value are sign extended or zero extended
(depending on the <code>0</code> flag) to <em>width</em> bytes.
The default for <em>precision</em> is 1. Thus if you do not specify
the <em>precision</em>, only the least significant byte is written!
It is common error to write <code>out "%2r";</code> instead of <code>out "%.2r";</code>.
</p>
<p>
In input, <em>width</em> bytes are read and put into the value.
@ -380,7 +388,7 @@ the value is sign extended or zero extended, depending on the
<code>0</code> flag.
</p>
<p>
Example: <code>out "%.2r"</code>
Examples: <code>out "%.2r"; in "%02r";</code>
</p>
<a name="rawdouble"></a>
@ -434,7 +442,7 @@ The <em>width</em> field is the byte number from which to start
calculating the checksum.
Default is 0, i.e. the first byte of the input or output of the current
command.
The last byte is <em>prec</em> bytes before the checksum (default 0).
The last byte is <em>precision</em> bytes before the checksum (default 0).
For example in <code>"abcdefg%&lt;xor&gt;"</code> the checksum is calculated
from <code>abcdefg</code>,
but in <code>"abcdefg%2.1&lt;xor&gt;"</code> only from <code>cdef</code>.
@ -446,8 +454,17 @@ With the <code>#</code> flag, the byte order is changed to <em>little
endian</em>, i.e. least significant byte first.
</p>
<p>
The <code>0</code> flag changes the checksum representation from
binary to hexadecimal ASCII (2 bytes per checksum byte).
The <code>0</code> flag changes the checksum representation to
to hexadecimal ASCII (2 chars per checksum byte).
</p>
<p>
The <code>-</code> flag changes the checksum representation to
"poor man's hex": 0x30 ... 0x3f (2 chars per checksum byte).
</p>
<p>
The <code>+</code> flag changes the checksum representation to
decimal ASCII (formatted with %d).
</p>
<!--
In output, the case of the ASCII checksum matches the case of first
letter of the function name.
@ -528,41 +545,49 @@ In input, the next byte or bytes must match the checksum.
</dl>
<a name="regex"></a>
<h2>12. Regular Expresion STRING Converter (<code>%/<em>regex</em>/</code>)</h2>
<h2>13. Regular Expresion STRING Converter (<code>%/<em>regex</em>/</code>)</h2>
<p>
This input-only format matches <a target="ex"
href="http://www.pcre.org/" >Perl compatible regular expressions (PCRE)</a>.
It is only available if a PCRE library is installed.
</p>
<div class="box">
<p>
If PCRE is not available for your host or cross architecture, download
the sourcecode from <a target="ex" href="http://www.pcre.org/">www.pcre.org</a>
and try my EPICS compatible <a target="ex"
href="http://epics.web.psi.ch/software/streamdevice/pcre/Makefile">Makefile</a>
to compile it like a normal EPICS application.
to compile it like a normal EPICS support module.
The Makefile is known to work with EPICS 3.14.8 and PCRE 7.2.
In your RELEASE file define the variable <code>PCRE</code> so that
it points to the install location of PCRE.
</p>
<p>
If PCRE is already installed on your system, use the variables
<code>PCRE_INCLUDE</code> and <code>PCRE_LIB</code> instead to provide
the install directories of <code>pcre.h</code> and the library.
</p>
<p>
If you have PCRE installed in different locations for different (cross)
architectures, define the variables in RELEASE.Common.&lt;architecture&gt;
instead of the global RELEASE file.
If PCRE is already installed on (some of) your systems, you may add
architectures where PCRE can be found in standard include and library
locations to the variable <code>WITH_SYSTEM_PCRE</code>.
If either the header file or the library are in a non-standard place,
set in your RELEASE file the variables <code>PCRE_INCLUDE_<em>arch</em></code>
and/or <code>PCRE_LIB_<em>arch</em></code> for the respective architectures
to the correct directories or set
<code>PCRE_INCLUDE</code> and/or <code>PCRE_LIB</code>
in architecture specific RELEASE.Common.<em>arch</em> files.
</p>
</div>
<p>
If the regular expression is not anchored, i.e. does not start with
<code>^</code>, leading non-matching input is skipped.
<code>^</code>, leading non-matching input is skipped.
To match in multiline mode (across newlines) add <code>(?m)</code>
at the beginning of the pattern.
To match case insensitive, add <code>(?i)</code>.
</p>
<p>
A maximum of <em>width</em> bytes is matched, if specified.
If <em>prec</em> is given, it specifies the sub-expression whose match
is retuned.
If <em>precision</em> is given, it specifies the sub-expression whose match
is returned.
Otherwise the complete match is returned.
In any case, the complete match is consumed from the input buffer.
If the expression contains a <code>/</code> it must be escaped.
If the expression contains a <code>/</code> it must be escaped like <code>\/</code>.
</p>
<p>
Example: <code>%.1/&lt;title&gt;(.*)&lt;\/title&gt;/</code> returns
@ -570,8 +595,74 @@ the title of an HTML page, skipps anything before the
<code>&lt;title&gt</code> tag and leaves anything after the
<code>&lt;/title&gt;</code> tag in the input buffer.
</p>
<a name="regsub"></a>
<h2>14. Regular Expresion Substitution Pseudo-Converter (<code>%#/<em>regex</em>/<em>subst</em>/</code>)</h2>
<p>
This is a variant of the previous converter (note the <code>#</code>)
but instead of returning the matching string,
it can be used as a pre-processor for input or
as a post-processor for output.
</p>
<p>
Matches of the <em>regex</em> are replaced by the string <em>subst</em> with all
<code>&</code> or <code>\0</code> in <em>subst</em> replaced with the match itself and all
<code>\1</code> through <code>\9</code> replaced with the match of the corresponding sub-expression.
To get a literal <code>&</code> or <code>\</code> or <code>/</code> in the substitution write
<code>\&</code> or <code>\\</code> or <code>\/</code>.
There is no way to specify literal bytes with values less or equal to 9 in the
substitution!
</p>
<p>
If <em>width</em> is specified, it limits the number of characters processed.
If the <code>-</code> flag is used (i.e. <em>width</em> looks like a negative number)
only the last <em>width</em> characters are processed, else the first.
Without <em>width</em> (or 0) all available characters are processed.
</p>
<p>
If <em>precision</em> is specified, it indicates which matches to replace.
With the <code>+</code> flag given, <em>precision</em> is the maximum
number of matches to replace.
Otherwise <em>precision</em> is the index (counting from 1) of the match to replace.
Without <em>precision</em> (or 0), all matches are replaced.
</p>
<p>
In input this converter pre-processes data received from the device before
following converters read it.
Converters preceding this one will read unmodified input.
Thus place this converter before those whose input should be pre-processed.
</p>
<p>
In output it post-processes data already formatted by preceding converters
before sending it to the device.
Converters following this one will send their output unmodified.
Thus place this converter after those whose output should be post-processed.
</p>
<p>
Examples:
<div class="indent">
<code>%#+-10.2/ab/X/</code> replaces the string <code>ab</code> with <code>X</code>
maximal 2 times in the last 10 characters.
(<code>abcabcabcabc</code> becomes <code>abcXcXcabc</code>)
</div>
<div class="indent">
<code>%#/\\/\//</code> replaces all <code>\</code> with <code>/</code>
(<code>\dir\file</code> becomes <code>/dir/file</code>)
</div>
<div class="indent">
<code>%#/..\B/&:/</code> inserts <code>:</code> after every second character
which is not at the end of a word.
(<code>0b19353134</code> becomes <code>0b:19:35:31:34</code>)
</div>
<div class="indent">
<code>%#/://</code> removes all <code>:</code> characters.
(<code>0b:19:35:31:34</code> becomes <code>0b19353134</code>)
</div>
<div class="indent">
<code>%#/([^+-])*([+-])/\2\1/</code> moves a postfix sign to the front.
(<code>1.23-</code> becomes <code>-1.23</code>)<br>
</div>
<a name="mantexp"></a>
<h2>13. MantissaExponent DOUBLE converter (<code>%m</code>)</h2>
<h2>15. MantissaExponent DOUBLE converter (<code>%m</code>)</h2>
<p>
This exotic and experimental format matches numbers in the format
<i>[sign] mantissa sign exponent</i>, e.g <code>+123-4</code> meaning
@ -591,7 +682,7 @@ the usual way (always sign, left justified, space instead of + sign).
Flags <code>#</code> and <code>0</code> are unsupported.
</p>
<a name="timestamp"></a>
<h2>14. Timestamp DOUBLE converter (<code>%T(<em>timeformat</em>)</code>)</h2>
<h2>16. Timestamp DOUBLE converter (<code>%T(<em>timeformat</em>)</code>)</h2>
<p>
This format reads or writes timestamps and converts them to a double number.
The value represents the number of seconds since 1970 (the UNIX epoch).
@ -628,7 +719,7 @@ In output, the system function <em>strftime()</em> is used to format the time.
There may be differences in the implementation between operating systems.
</p>
<p>
In input, <em>StreamDevice</em> used its own implementation because many
In input, <em>StreamDevice</em> uses its own implementation because many
systems are missing the <em>strptime()</em> function and additional formats
are supported.
</p>

View File

@ -1,3 +1,11 @@
#/bin/sh
if ! wkhtmltopdf -V >/dev/null 2>&1
then
echo "wkhtmltopdf not installed."
echo "See https://wkhtmltopdf.org"
exit 1
fi >&2
PAGES="
index.html
setup.html

View File

@ -132,6 +132,7 @@ div div div a {list-style-type:circle;}
<a target="_parent" href="formats.html#bcd" title="Binary coded decimal LONG converter">%D</a>
<a target="_parent" href="formats.html#chksum" title="Checksum pseudo converter">%&lt;<em>checksum</em>&gt;</a>
<a target="_parent" href="formats.html#regex" title="Perl regular expression STRING converter">%/<em>regex</em>/</a>
<a target="_parent" href="formats.html#regsub" title="Perl regular expression substitution pseudo converter">%#/<em>regex</em>/<em>subst</em>/</a>
<a target="_parent" href="formats.html#mantexp" title="MantissaExponent DOUBLE converter">%m</a>
<a target="_parent" href="formats.html#timestamp" title="Timestamp DOUBLE converter">%T</a>
</div>

View File

@ -29,7 +29,7 @@ before the final <code>return(0)</code>:
</p>
<pre class="box">
if(pscalcoutDSET->init_record ) {
return (*pscalcoutDSET->init_record)(pcalc);
return (*pscalcoutDSET->init_record)(pcalc);
}
</pre>

View File

@ -20,6 +20,7 @@ pre {
border:1px solid #000000;
white-space:pre;
margin:2ex;
page-break-inside:avoid;
}
kbd {
@ -88,6 +89,16 @@ code {
text-align:left;
}
.box {
margin-left:1ex;
margin-right:1ex;
margin-top:0.5ex;
padding: 0 1ex;
border: 1px solid black;
text-align:left;
background-color:#f0f0f0;
}
#navleft {
position:fixed;
left:0;

View File

@ -260,7 +260,7 @@ When asked "<code>CURRENT?</code>", the device send something like
</p>
<p>
<code>
read_current {out "CURRENT?"; in "CURRENT %f A"; @mismatch {in "%(\1)39c";}}
read_current {out "CURRENT?"; in "CURRENT %f A"; @mismatch {in "%(\$1)39c";}}
</code>
</p>
<p>

View File

@ -718,13 +718,19 @@ writeHandler()
pasynOctet->setOutputEos(pvtOctet, pasynUser,
NULL, 0);
}
pasynUser->errorMessage[0] = 0;
status = pasynOctet->write(pvtOctet, pasynUser,
outputBuffer, outputSize, &written);
#ifndef NO_TEMPORARY
debug("AsynDriverInterface::writeHandler(%s): "
"write(..., outputSize=%ld, written=%ld) "
"[timeout=%g sec] = %s\n",
clientName(), (long)outputSize, (long)written,
pasynUser->timeout, asynStatusStr[status]);
"write(..., \"%s\", outputSize=%ld, written=%ld) "
"[timeout=%g sec] = %s (%s)\n",
clientName(),
StreamBuffer(outputBuffer, outputSize).expand()(),
(long)outputSize, (long)written,
pasynUser->timeout, asynStatusStr[status],
pasynUser->errorMessage);
#endif
if (oldeoslen >= 0) // restore asyn terminator
{
@ -769,34 +775,34 @@ writeHandler()
writeCallback(StreamIoSuccess);
return;
case asynTimeout:
error("%s: asynTimeout (%g sec) in write. Asyn says: %s\n",
error("%s: asynTimeout (%g sec) in write. Asyn driver says: \"%s\"\n",
clientName(), pasynUser->timeout, pasynUser->errorMessage);
writeCallback(StreamIoTimeout);
return;
case asynOverflow:
error("%s: asynOverflow in write. Asyn driver says: %s\n",
error("%s: asynOverflow in write. Asyn driver says: \"%s\"\n",
clientName(), pasynUser->errorMessage);
writeCallback(StreamIoFault);
return;
case asynError:
error("%s: asynError in write. Asyn driver says: %s\n",
error("%s: asynError in write. Asyn driver says: \"%s\"\n",
clientName(), pasynUser->errorMessage);
writeCallback(StreamIoFault);
return;
#ifdef ASYN_VERSION // asyn >= 4.14
case asynDisconnected:
error("%s: asynDisconnected in write. Asyn driver says: %s\n",
error("%s: asynDisconnected in write. Asyn driver says: \"%s\"\n",
clientName(), pasynUser->errorMessage);
writeCallback(StreamIoFault);
return;
case asynDisabled:
error("%s: asynDisconnected in write. Asyn driver says: %s\n",
error("%s: asynDisconnected in write. Asyn driver says: \"%s\"\n",
clientName(), pasynUser->errorMessage);
writeCallback(StreamIoFault);
return;
#endif
default:
error("%s: unknown asyn error in write. Asyn driver says: %s\n",
error("%s: unknown asyn error in write. Asyn driver says: \"%s\"\n",
clientName(), pasynUser->errorMessage);
writeCallback(StreamIoFault);
return;
@ -887,6 +893,11 @@ readHandler()
oldeoslen = -1;
} else do {
// device (e.g. GPIB) might not accept full eos length
if ((int)deveoslen == oldeoslen && strcmp(deveos, oldeos) == 0)
{
// nothing to do: old and new eos are the same
break;
}
if (pasynOctet->setInputEos(pvtOctet, pasynUser,
deveos, deveoslen) == asynSuccess)
{
@ -894,8 +905,9 @@ readHandler()
if (ioAction != AsyncRead)
{
debug("AsynDriverInterface::readHandler(%s) "
"input EOS set to %s\n",
"input EOS changed from \"%s\" to \"%s\"\n",
clientName(),
StreamBuffer(oldeos, oldeoslen).expand()(),
StreamBuffer(deveos, deveoslen).expand()());
}
#endif
@ -951,6 +963,7 @@ readHandler()
readMore = 0;
received = 0;
eomReason = 0;
pasynUser->errorMessage[0] = 0;
debug("AsynDriverInterface::readHandler(%s): ioAction=%s "
"read(..., bytesToRead=%ld, ...) "
@ -959,12 +972,13 @@ readHandler()
bytesToRead, pasynUser->timeout);
status = pasynOctet->read(pvtOctet, pasynUser,
buffer, bytesToRead, &received, &eomReason);
#ifndef NO_TEMPORARY
debug("AsynDriverInterface::readHandler(%s): "
"read returned %s: ioAction=%s received=%ld, eomReason=%s, buffer=\"%s\"\n",
clientName(), asynStatusStr[status], ioActionStr[ioAction],
(long)received,eomReasonStr[eomReason&0x7],
StreamBuffer(buffer, received).expand()());
#endif
pasynManager->isConnected(pasynUser, &connected);
debug("AsynDriverInterface::readHandler(%s): "
"device is now %sconnected\n",
@ -1094,29 +1108,29 @@ readHandler()
}
peeksize = inputBuffer.capacity();
// deliver whatever we could save
error("%s: asynOverflow in read. Asyn driver says: %s\n",
error("%s: asynOverflow in read. Asyn driver says: \"%s\"\n",
clientName(), pasynUser->errorMessage);
readCallback(StreamIoFault, buffer, received);
break;
case asynError:
error("%s: asynError in read. Asyn driver says: %s\n",
error("%s: asynError in read. Asyn driver says: \"%s\"\n",
clientName(), pasynUser->errorMessage);
readCallback(StreamIoFault, buffer, received);
break;
#ifdef ASYN_VERSION // asyn >= 4.14
case asynDisconnected:
error("%s: asynDisconnected in read. Asyn driver says: %s\n",
error("%s: asynDisconnected in read. Asyn driver says: \"%s\"\n",
clientName(), pasynUser->errorMessage);
readCallback(StreamIoFault);
return;
case asynDisabled:
error("%s: asynDisconnected in read. Asyn driver says: %s\n",
error("%s: asynDisconnected in read. Asyn driver says: \"%s\"\n",
clientName(), pasynUser->errorMessage);
readCallback(StreamIoFault);
return;
#endif
default:
error("%s: unknown asyn error in read. Asyn driver says: %s\n",
error("%s: unknown asyn error in read. Asyn driver says: \"%s\"\n",
clientName(), pasynUser->errorMessage);
readCallback(StreamIoFault);
return;
@ -1138,10 +1152,16 @@ readHandler()
}
// restore original EOS
if (oldeoslen >= 0)
if (oldeoslen >= 0 && oldeoslen != (int)deveoslen && strcmp(deveos, oldeos) != 0)
{
pasynOctet->setInputEos(pvtOctet, pasynUser,
oldeos, oldeoslen);
#ifndef NO_TEMPORARY
debug("AsynDriverInterface::readHandler(%s) "
"input EOS restored to \"%s\"\n",
clientName(),
StreamBuffer(oldeos, oldeoslen).expand()());
#endif
}
}

View File

@ -3,17 +3,17 @@
# You may add more record interfaces
# This requires the naming conventions
# dev$(RECORD)Stream.c
# dev$(RECORDTYPE)Stream.c
RECORDS += ao ai
RECORDS += bo bi
RECORDS += mbbo mbbi
RECORDS += mbboDirect mbbiDirect
RECORDS += longout longin
RECORDS += stringout stringin
RECORDS += waveform
RECORDS += calcout
RECORDS += aai aao
RECORDTYPES += ao ai
RECORDTYPES += bo bi
RECORDTYPES += mbbo mbbi
RECORDTYPES += mbboDirect mbbiDirect
RECORDTYPES += longout longin
RECORDTYPES += stringout stringin
RECORDTYPES += waveform
RECORDTYPES += calcout
RECORDTYPES += aai aao
# Do you have synApps and want support for scalcout?
# Then define CALC or SYNAPPS in your RELEASE file
@ -21,18 +21,23 @@ RECORDS += aai aao
# Due to strange cross dependencies in synApps
# you have to build the 'sscan' and 'genSub'
# modules before building 'calc'.
# See doc/scalcout.html for a required fix in scalcout.
SYNAPPS_RECORDS += scalcout
# The 'calc' version must be 2-4 or higher.
# Up to version 2-6 (synApps 5.1) the 'calc' module needs a fix.
# See doc/scalcout.html for details.
ifneq ($(words $(CALC) $(SYNAPPS)), 0)
RECORDTYPES += scalcout
endif
# You may add more bus interfaces
# This requires the naming convention
# $(BUS)Interface.cc
# asynDriver interface is added automatically
# if ASYN is defined in your RELEASE file.
# asynDriver interface is added if ASYN is defined in your RELEASE file.
BUSSES += Debug
BUSSES += Dummy
ifdef ASYN
BUSSES += AsynDriver
endif
# You may add more format converters
# This requires the naming convention

View File

@ -18,7 +18,7 @@
# #
################################################################
TOP=../..
TOP:=../$(TOP)
# Look if we have EPICS R3.13 or R3.14
ifeq ($(wildcard $(TOP)/configure),)
@ -40,13 +40,8 @@ DBD += $(LIBRARY_DEFAULT).dbd
ifdef ASYN
LIB_LIBS += asyn
BUSSES += AsynDriver
endif
ifdef T_A
ifndef BUSSES
$(error No bus interface defined! Didn't you set ASYN in your RELEASE file?)
endif
else
$(warning Asyn not included! Didn't you set ASYN in your RELEASE file?)
endif
ifeq ($(LOADABLE_MODULE),YES)
@ -54,7 +49,7 @@ SRCS += $(LIBRARY_DEFAULT)_registerRecordDeviceDriver.cpp
endif
SRCS += $(BUSSES:%=%Interface.cc)
SRCS += $(FORMATS:%=%Converter.cc)
SRCS += $(RECORDS:%=dev%Stream.c)
SRCS += $(RECORDTYPES:%=dev%Stream.c)
SRCS += $(STREAM_SRCS)
# find system wide or local PCRE header and library
@ -89,9 +84,9 @@ streamReferences: ../CONFIG_STREAM
$(PERL) ../makeref.pl Interface $(BUSSES) > $@
$(PERL) ../makeref.pl Converter $(FORMATS) >> $@
# create stream.dbd from all RECORDS
# create stream.dbd from all RECORDTYPES
$(COMMON_DIR)/$(LIBRARY_DEFAULT).dbd: ../CONFIG_STREAM
$(PERL) ../makedbd.pl $(RECORDS) > $@
$(PERL) ../makedbd.pl $(RECORDTYPES) > $@
$(LIBRARY_DEFAULT).dbd$(DEP): ../CONFIG_STREAM
echo $(LIBRARY_DEFAULT).dbd: $< > $@

View File

@ -18,14 +18,11 @@
# #
################################################################
TOP = ../../..
TOP := ../../$(TOP)
include $(TOP)/config/CONFIG_APP
include ../CONFIG_STREAM
# In 3.13, calcout has no device support
RECORDS_3_13 = $(filter-out calcout,$(RECORDS))
DBDNAME = stream.dbd
INC += devStream.h
@ -35,8 +32,9 @@ INC += devStream.h
CONFIGS = RULES.munch
SCRIPTS = munch.pl
include $(TOP)/config/RULES.Host
include $(EPICS_BASE)/config/RULES.Host
# create stream.dbd from all RECORDS
# create stream.dbd from all RECORDTYPES
# In 3.13, calcout has no device support
stream.dbd: ../CONFIG_STREAM
$(PERL) ../makedbd.pl -3.13 $(RECORDS_3_13) > $@
$(PERL) ../makedbd.pl -3.13 $(filter-out calcout,$(RECORDTYPES)) > $@

View File

@ -18,29 +18,23 @@
# #
################################################################
TOP = ../../..
TOP := ../../$(TOP)
include $(TOP)/config/CONFIG_APP
include ../CONFIG_STREAM
LIBNAME = streamLib
# In 3.13, calcout has no device support
RECORDS_3_13 = $(filter-out calcout,$(RECORDS))
ifdef ASYN
BUSSES += AsynDriver
endif
SRCS.cc += $(patsubst %,../%,$(filter %.cc,$(STREAM_SRCS)))
SRCS.cc += $(BUSSES:%=../%Interface.cc)
SRCS.cc += $(FORMATS:%=../%Converter.cc)
SRCS.c += $(patsubst %,../%,$(filter %.c,$(STREAM_SRCS)))
SRCS.c += $(RECORDS_3_13:%=../dev%Stream.c)
# In 3.13, calcout has no device support
SRCS.c += $(patsubst %,../dev%Stream.c,$(filter-out calcout,$(RECORDTYPES)))
LIBOBJS = $(patsubst ../%,%.o,$(basename $(SRCS.cc) $(SRCS.c)))
include $(TOP)/config/RULES.Vx
include $(EPICS_BASE)/config/RULES.Vx
include $(TOP)/config/RULES.munch
build:: depends

View File

@ -23,7 +23,7 @@
#include "string.h"
#include "pcre.h"
// Perl regular expressions (PCRE) %/regexp/
// Perl regular expressions (PCRE) %/regexp/ and %#/regexp/subst/
/* Notes:
- Memory for compiled regexp is allocated in parse but never freed.
@ -37,15 +37,17 @@
class RegexpConverter : public StreamFormatConverter
{
int parse (const StreamFormat&, StreamBuffer&, const char*&, bool);
int scanString(const StreamFormat&, const char*, char*, size_t);
int parse (const StreamFormat& fmt, StreamBuffer&, const char*&, bool);
int scanString(const StreamFormat& fmt, const char*, char*, size_t);
int scanPseudo(const StreamFormat& fmt, StreamBuffer& input, long& cursor);
bool printPseudo(const StreamFormat& fmt, StreamBuffer& output);
};
int RegexpConverter::
parse(const StreamFormat& fmt, StreamBuffer& info,
const char*& source, bool scanFormat)
{
if (!scanFormat)
if (!scanFormat && !(fmt.flags & alt_flag))
{
error("Format conversion %%/regexp/ is only allowed in input formats\n");
return false;
@ -55,28 +57,31 @@ parse(const StreamFormat& fmt, StreamBuffer& info,
error("Subexpression index %d too big (>9)\n", fmt.prec);
return false;
}
if (fmt.flags & (left_flag|space_flag|zero_flag|alt_flag))
{
error("Use of modifiers '-', ' ', '0', '#'"
"not allowed with %%/regexp/ conversion\n");
return false;
}
StreamBuffer pattern;
while (*source != '/')
{
if (!*source) {
error("Missing closing '/' after %%/ format conversion\n");
error("Missing closing '/' after %%/%s format conversion\n", pattern());
return false;
}
if (*source == esc) {
source++;
pattern.print("\\x%02x", *source++ & 0xFF);
continue;
if (*source == esc) { // handle escaped chars
if (*++source != '/') // just un-escape /
{
pattern.append('\\');
if ((*source & 0x7f) < 0x30) // handle control chars
{
pattern.print("x%02x", *source++);
continue;
}
// fall through for PCRE codes like \B
}
}
pattern.append(*source++);
}
source++;
debug("regexp = \"%s\"\n", pattern());
debug("regexp = \"%s\"\n", pattern.expand()());
const char* errormsg;
int eoffset;
pcre* code = pcre_compile(pattern(), 0,
@ -87,6 +92,26 @@ parse(const StreamFormat& fmt, StreamBuffer& info,
return false;
}
info.append(&code, sizeof(code));
if (fmt.flags & alt_flag)
{
StreamBuffer subst;
debug("check for subst in \"%s\"\n", StreamBuffer(source).expand()());
while (*source != '/')
{
if (!*source) {
error("Missing closing '/' after %%#/%s/%s format conversion\n", pattern(), subst());
return false;
}
if (*source == esc)
subst.append(*source++);
subst.append(*source++);
}
source++;
debug("subst = \"%s\"\n", subst.expand()());
info.append(subst).append('\0');
return pseudo_format;
}
return string_format;
}
@ -94,32 +119,130 @@ int RegexpConverter::
scanString(const StreamFormat& fmt, const char* input,
char* value, size_t maxlen)
{
pcre* code;
size_t len;
int ovector[30];
int rc;
int subexpr = 0;
unsigned int l;
memcpy (&code, fmt.info, sizeof(code));
const char* info = fmt.info;
pcre* code = extract<pcre*>(info);
int length = fmt.width > 0 ? fmt.width : strlen(input);
int subexpr = fmt.prec > 0 ? fmt.prec : 0;
len = fmt.width > 0 ? fmt.width : strlen(input);
subexpr = fmt.prec > 0 ? fmt.prec : 0;
rc = pcre_exec(code, NULL, input, len, 0, 0, ovector, 30);
if (rc < 1) return -1;
if (fmt.flags & skip_flag) return ovector[1];
len = ovector[subexpr*2+1] - ovector[subexpr*2];
if (len >= maxlen) {
debug("input = \"%s\"\n", input);
debug("length=%d\n", length);
rc = pcre_exec(code, NULL, input, length, 0, 0, ovector, 30);
debug("pcre_exec match \"%.*s\" result = %d\n", length, input, rc);
if ((subexpr && rc <= subexpr) || rc < 0)
{
// error or no match or not enough sub-expressions
return -1;
}
if (fmt.flags & skip_flag) return ovector[subexpr*2+1];
l = ovector[subexpr*2+1] - ovector[subexpr*2];
if (l >= maxlen) {
if (!(fmt.flags & sign_flag)) {
error("Regexp: Matching string \"%s\" too long (%d>%d bytes). You may want to try the + flag: \"%%+/.../\"\n",
StreamBuffer(input+ovector[subexpr*2], len).expand()(),
(int)len, (int)maxlen-1);
error("Regexp: Matching string \"%s\" too long (%d>%ld bytes). You may want to try the + flag: \"%%+/.../\"\n",
StreamBuffer(input + ovector[subexpr*2],l).expand()(),
l, (long)maxlen-1);
return -1;
}
len = maxlen-1;
l = maxlen-1;
}
memcpy(value, input+ovector[subexpr*2], len);
value[len]=0;
return ovector[1];
memcpy(value, input + ovector[subexpr*2], l);
value[l] = '\0';
return ovector[1]; // consume input until end of match
}
static void regsubst(const StreamFormat& fmt, StreamBuffer& buffer, long start)
{
const char* subst = fmt.info;
pcre* code = extract<pcre*>(subst);
long length;
int rc, l, c, r, rl, n;
int ovector[30];
StreamBuffer s;
length = buffer.length() - start;
if (fmt.width && fmt.width < length)
length = fmt.width;
if (fmt.flags & sign_flag)
start = buffer.length() - length;
debug("regsubst buffer=\"%s\", start=%ld, length=%ld, subst = \"%s\"\n",
buffer.expand()(), start, length, subst);
for (c = 0, n = 1; c < length; n++)
{
rc = pcre_exec(code, NULL, buffer(start+c), length-c, 0, 0, ovector, 30);
debug("pcre_exec match \"%.*s\" result = %d\n", (int)length-c, buffer(start+c), rc);
if (rc < 0) // no match
return;
if (!(fmt.flags & sign_flag) && n < fmt.prec) // without + flag
{
// do not yet replace this match
c += ovector[1];
continue;
}
// replace & by match in subst
l = ovector[1] - ovector[0];
debug("start = \"%s\"\n", buffer(start+c));
debug("match = \"%.*s\"\n", l, buffer(start+c+ovector[0]));
for (r = 1; r < rc; r++)
debug("sub%d = \"%.*s\"\n", r, ovector[r*2+1]-ovector[r*2], buffer(start+c+ovector[r*2]));
debug("rest = \"%s\"\n", buffer(start+c+ovector[1]));
s = subst;
debug("subs = \"%s\"\n", s.expand()());
for (r = 0; r < s.length(); r++)
{
debug("check \"%s\"\n", s.expand(r)());
if (s[r] == esc)
{
unsigned char ch = s[r+1];
if (ch < 9) // escaped 0 - 9 : replace with subexpr
{
ch *= 2;
rl = ovector[ch+1] - ovector[ch];
debug("replace \\%d: \"%.*s\"\n", ch/2, rl, buffer(start+c+ovector[ch]));
s.replace(r, 2, buffer(start+c+ovector[ch]), rl);
r += rl - 1;
}
else
s.remove(r, 1); // just remove escape
}
else if (s[r] == '&') // unescaped & : replace with match
{
debug("replace &: \"%.*s\"\n", l, buffer(start+c+ovector[0]));
s.replace(r, 1, buffer(start+c+ovector[0]), l);
r += l - 1;
}
else continue;
debug("subs = \"%s\"\n", s());
}
buffer.replace(start+c+ovector[0], l, s);
length += s.length() - l;
c += s.length();
if (n == fmt.prec) // max match reached
return;
}
}
int RegexpConverter::
scanPseudo(const StreamFormat& fmt, StreamBuffer& input, long& cursor)
{
/* re-write input buffer */
regsubst(fmt, input, cursor);
return 0;
}
bool RegexpConverter::
printPseudo(const StreamFormat& fmt, StreamBuffer& output)
{
/* re-write output buffer */
regsubst(fmt, output, 0);
return true;
}
RegisterConverter (RegexpConverter, "/");

View File

@ -26,8 +26,7 @@
#if defined(__vxworks) || defined(vxWorks) || defined(_WIN32) || defined(__rtems__)
// These systems have no vsnprintf
#include <epicsStdio.h>
#define vsnprintf epicsVsnprintf
#define vsnprintf(p,l,f,v) vsprintf(p,f,v)
#endif
#define P PRINTF_SIZE_T_PREFIX
@ -296,7 +295,7 @@ StreamBuffer StreamBuffer::expand(ssize_t start, ssize_t length) const
for (i = start; i < end; i++)
{
c = buffer[i];
if ((c & 0x7f) < 0x20 || (c & 0x7f) == 0x7f)
if (c < 0x20 || c >= 0x7f)
{
result.print("<%02x>", c & 0xff);
}
@ -314,7 +313,7 @@ dump() const
StreamBuffer result(256+cap*5);
result.append("\033[0m");
size_t i;
result.print("%"P"d,%"P"d,%"P"d:\033[37m", offs, len, cap);
result.print("%" P "d,%" P "d,%" P "d:\033[37m", offs, len, cap);
for (i = 0; i < cap; i++)
{
if (i == offs) result.append("\033[34m[\033[0m");

View File

@ -23,6 +23,8 @@
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#ifndef __GNUC__
#define __attribute__(x)
#endif

View File

@ -460,7 +460,7 @@ finishProtocol(ProtocolResult status)
status = Fault;
}
//// flags &= ~(AcceptInput|AcceptEvent);
if (runningHandler)
if (runningHandler || flags & InitRun)
{
// get original error status
if (status == Success) status = runningHandler;
@ -832,7 +832,7 @@ lockCallback(StreamIoStatus status)
case StreamIoSuccess:
break;
case StreamIoTimeout:
error("%s: Cannot lock device within %ld ms, device seems to be busy\n",
debug("%s: Cannot lock device within %ld ms, device seems to be busy\n",
name(), lockTimeout);
flags &= ~BusOwner;
finishProtocol(LockTimeout);
@ -997,7 +997,7 @@ readCallback(StreamIoStatus status,
finishProtocol(ReplyTimeout);
return 0;
case StreamIoFault:
error("%s: I/O error after reading %"P"d byte%s: \"%s%s\"\n",
error("%s: I/O error after reading %" P "d byte%s: \"%s%s\"\n",
name(),
inputBuffer.length(), inputBuffer.length()==1 ? "" : "s",
inputBuffer.length() > 20 ? "..." : "",
@ -1006,7 +1006,7 @@ readCallback(StreamIoStatus status,
return 0;
}
inputBuffer.append(input, size);
debug("StreamCore::readCallback(%s) inputBuffer=\"%s\", size %"P"d\n",
debug("StreamCore::readCallback(%s) inputBuffer=\"%s\", size %" P "d\n",
name(), inputBuffer.expand()(), inputBuffer.length());
if (*activeCommand != in_cmd)
{
@ -1657,7 +1657,11 @@ timerCallback()
bool StreamCore::
evalExec()
{
formatOutput();
if (!formatOutput())
{
finishProtocol(FormatError);
return false;
}
debug ("StreamCore::evalExec: command = \"%s\"\n", outputLine.expand()());
// release bus
if (flags & BusOwner)

View File

@ -180,6 +180,7 @@ public:
#ifndef EPICS_3_13
extern "C" {
epicsExportAddress(int, streamDebug);
epicsExportAddress(int, streamError);
}
#endif
@ -1120,7 +1121,7 @@ bool Stream::
matchValue(const StreamFormat& format, const void* fieldaddress)
{
// this function must increase consumedInput
long consumed;
long consumed = 0;
long lval;
double dval;
char* buffer;

View File

@ -23,6 +23,7 @@
#include <stdio.h>
int streamDebug = 0;
int streamError = 0;
extern "C" {
#ifdef _WIN32
__declspec(dllexport)
@ -74,6 +75,7 @@ void StreamError(int line, const char* file, const char* fmt, ...)
void StreamVError(int line, const char* file, const char* fmt, va_list args)
{
char timestamp[40];
if (!streamError) return; // Error logging disabled
StreamPrintTimestampFunction(timestamp, 40);
#ifdef va_copy
if (StreamDebugFile)

View File

@ -28,6 +28,7 @@
#endif
extern int streamDebug;
extern int streamError;
extern void (*StreamPrintTimestampFunction)(char* buffer, int size);
void StreamError(int line, const char* file, const char* fmt, ...)

View File

@ -31,7 +31,7 @@ typedef enum {
skip_flag = 0x20,
default_flag = 0x40,
compare_flag = 0x80,
fix_width_flag = 0x100,
fix_width_flag = 0x100
} StreamFormatFlag;
typedef enum {

View File

@ -442,10 +442,11 @@ int StdStringConverter::
parse(const StreamFormat& fmt, StreamBuffer& info,
const char*& source, bool scanFormat)
{
if (fmt.flags & (sign_flag|zero_flag))
if (fmt.flags & sign_flag)
{
error("Use of modifiers '+', '0'"
"not allowed with %%s conversion\n");
error("Use of modifier '+'"
"not allowed with %%%c conversion\n",
fmt.conv);
return false;
}
if (scanFormat && fmt.prec >= 0)
@ -463,7 +464,22 @@ parse(const StreamFormat& fmt, StreamBuffer& info,
bool StdStringConverter::
printString(const StreamFormat& fmt, StreamBuffer& output, const char* value)
{
output.print(fmt.info, value);
if (fmt.flags & zero_flag && fmt.width)
{
size_t l;
if (fmt.prec > -1)
{
char* p = (char*)memchr(value, 0, fmt.prec);
if (p) l = p - value;
else l = fmt.prec;
}
else l = strlen(value);
if (!(fmt.flags & left_flag)) output.append('\0', fmt.width-l);
output.append(value, l);
if (fmt.flags & left_flag) output.append('\0', fmt.width-l);
}
else
output.print(fmt.info, value);
return true;
}

View File

@ -22,8 +22,8 @@
#define devStream_h
#define STREAM_MAJOR 2
#define STREAM_MINOR 7
#define STREAM_PATCHLEVEL 1
#define STREAM_MINOR 8
#define STREAM_PATCHLEVEL 0
#if defined(__vxworks) || defined(vxWorks)
#include <vxWorks.h>
@ -58,7 +58,6 @@ extern "C" {
#include <dbCommon.h>
#include <dbScan.h>
#include <devSup.h>
/* #include <dbFldTypes.h> */
#include <dbAccess.h>
#ifdef devStream_epicsExportSharedSymbols

View File

@ -18,34 +18,28 @@
* *
***************************************************************/
#include <math.h>
#include <menuConvert.h>
#include <aiRecord.h>
#include "devStream.h"
#include <epicsExport.h>
#ifdef vxWorks
#ifdef EPICS_3_13
#include <private/mathP.h>
#define isinf(x) isInf(x)
#define isnan(x) isNan(x)
#else
#include <epicsMath.h>
#endif
#include <epicsExport.h>
static long readData (dbCommon *record, format_t *format)
{
aiRecord *ai = (aiRecord *) record;
double val;
switch (format->type)
{
case DBF_DOUBLE:
{
double val;
if (streamScanf (record, format, &val)) return ERROR;
if (ai->aslo != 0.0 && ai->aslo != 1.0) val *= ai->aslo;
val += ai->aoff;
if (!(ai->smoo == 0.0 || ai->init || ai->udf || isinf(ai->val) || isnan(ai->val)))
val = ai->val * ai->smoo + val * (1.0 - ai->smoo);
ai->val = val;
return DO_NOT_CONVERT;
break;
}
case DBF_ULONG:
case DBF_LONG:
@ -53,48 +47,56 @@ static long readData (dbCommon *record, format_t *format)
long rval;
if (streamScanf (record, format, &rval)) return ERROR;
ai->rval = rval;
if (ai->linr == menuConvertNO_CONVERSION)
if (ai->linr == 0)
{
/* allow more bits than 32 */
/* allow integers with more than 32 bits */
if (format->type == DBF_ULONG)
ai->val = (unsigned long)rval;
val = (unsigned long)rval;
else
ai->val = rval;
return DO_NOT_CONVERT;
val = rval;
break;
}
return OK;
}
default:
return ERROR;
}
return ERROR;
if (ai->aslo != 0.0 && ai->aslo != 1.0) val *= ai->aslo;
val += ai->aoff;
if (!(ai->smoo == 0.0 || ai->init || ai->udf || isinf(ai->val) || isnan(ai->val)))
val = ai->val * ai->smoo + val * (1.0 - ai->smoo);
ai->val = val;
return DO_NOT_CONVERT;
}
static long writeData (dbCommon *record, format_t *format)
{
aiRecord *ai = (aiRecord *) record;
double val = ai->val - ai->aoff;
if (ai->aslo != 0.0 && ai->aslo != 1.0) val /= ai->aslo;
switch (format->type)
{
case DBF_DOUBLE:
{
double val = ai->val - ai->aoff;
if (ai->aslo != 0.0 && ai->aslo != 1.0) val /= ai->aslo;
return streamPrintf (record, format, val);
}
case DBF_ULONG:
{
if (ai->linr == menuConvertNO_CONVERSION)
if (ai->linr == 0)
{
/* allow more bits than 32 */
return streamPrintf (record, format, (unsigned long)ai->val);
return streamPrintf (record, format, (unsigned long)val);
}
return streamPrintf (record, format, (unsigned long)ai->rval);
}
case DBF_LONG:
{
if (ai->linr == menuConvertNO_CONVERSION)
if (ai->linr == 0)
{
/* allow more bits than 32 */
return streamPrintf (record, format, (long)ai->val);
return streamPrintf (record, format, (long)val);
}
return streamPrintf (record, format, (long)ai->rval);
}

View File

@ -18,7 +18,6 @@
* *
***************************************************************/
#include <menuConvert.h>
#include <aoRecord.h>
#include "devStream.h"
#include <epicsExport.h>
@ -26,16 +25,14 @@
static long readData (dbCommon *record, format_t *format)
{
aoRecord *ao = (aoRecord *) record;
double val;
switch (format->type)
{
case DBF_DOUBLE:
{
double val;
if (streamScanf (record, format, &val)) return ERROR;
if (ao->aslo != 0.0 && ao->aslo != 1.0) val *= ao->aslo;
ao->val = val + ao->aoff;
return DO_NOT_CONVERT;
break;
}
case DBF_ULONG:
case DBF_LONG:
@ -44,48 +41,53 @@ static long readData (dbCommon *record, format_t *format)
if (streamScanf (record, format, &rval)) return ERROR;
ao->rbv = rval;
ao->rval = rval;
if (ao->linr == menuConvertNO_CONVERSION)
if (ao->linr == 0)
{
/* allow more bits than 32 */
/* allow integers with more than 32 bits */
if (format->type == DBF_ULONG)
ao->val = (unsigned long)rval;
val = (unsigned long)rval;
else
ao->val = rval;
return DO_NOT_CONVERT;
val = rval;
break;
}
return OK;
}
default:
return ERROR;
}
return ERROR;
if (ao->aslo != 0.0 && ao->aslo != 1.0) val *= ao->aslo;
ao->val = val + ao->aoff;
return DO_NOT_CONVERT;
}
static long writeData (dbCommon *record, format_t *format)
{
aoRecord *ao = (aoRecord *) record;
double val = (INIT_RUN ? ao->val : ao->oval) - ao->aoff;
if (ao->aslo != 0.0 && ao->aslo != 1.0) val /= ao->aslo;
switch (format->type)
{
case DBF_DOUBLE:
{
double val = (INIT_RUN ? ao->val : ao->oval) - ao->aoff;
if (ao->aslo != 0.0 && ao->aslo != 1.0) val /= ao->aslo;
return streamPrintf (record, format, val);
}
case DBF_ULONG:
{
if (ao->linr == menuConvertNO_CONVERSION)
if (ao->linr == 0)
{
/* allow more bits than 32 */
return streamPrintf (record, format, (unsigned long)(INIT_RUN ? ao->val : ao->oval));
/* allow integers with more than 32 bits */
return streamPrintf (record, format, (unsigned long)val);
}
return streamPrintf (record, format, (unsigned long)ao->rval);
}
case DBF_LONG:
{
if (ao->linr == menuConvertNO_CONVERSION)
if (ao->linr == 0)
{
/* allow more bits than 32 */
return streamPrintf (record, format, (long)(INIT_RUN ? ao->val : ao->oval));
/* allow integers with more than 32 bits */
return streamPrintf (record, format, (long)val);
}
return streamPrintf (record, format, (long)ao->rval);
}

View File

@ -20,6 +20,7 @@
***************************************************************/
#include <mbboDirectRecord.h>
#include "alarm.h"
#include "devStream.h"
#include <epicsExport.h>
@ -67,9 +68,27 @@ static long initRecord (dbCommon *record)
mbboDirectRecord *mbboD = (mbboDirectRecord *) record;
mbboD->mask <<= mbboD->shft;
/* Workaround for bug in mbboDirect record:
Put to VAL overwrites value to 0 if SEVR is INVALID_ALARM
Thus first write may send a wrong value.
*/
mbboD->sevr = 0;
return streamInitRecord (record, &mbboD->out, readData, writeData);
}
/* Unfortunately the bug also corrupts the next write to VAL after an I/O error.
Thus make sure the record is never left in INVALID_ALARM status.
*/
static long write_mbbo(dbCommon *record)
{
long status = streamWrite(record);
if (record->nsev == INVALID_ALARM) record->nsev = MAJOR_ALARM;
return status;
}
struct {
long number;
DEVSUPFUN report;
@ -83,7 +102,7 @@ struct {
streamInit,
initRecord,
streamGetIointInfo,
streamWrite
write_mbbo
};
epicsExportAddress(dset,devmbboDirectStream);

View File

@ -193,6 +193,7 @@ static long writeData (dbCommon *record, format_t *format)
break;
}
case DBF_LONG:
case DBF_ULONG:
case DBF_ENUM:
{
switch (wf->ftvl)

View File

@ -2,6 +2,7 @@ if (@ARGV[0] == "-3.13") {
shift;
} else {
print "variable(streamDebug, int)\n";
print "variable(streamError, int)\n";
print "registrar(streamRegistrar)\n";
}
print "driver(stream)\n";

View File

@ -1,23 +0,0 @@
TOP=../..
include $(TOP)/configure/CONFIG
-include ../src/CONFIG_STREAM
-include ../../src/CONFIG_STREAM
LIBRARY_DEFAULT = streamSynApps
DBD += $(LIBRARY_DEFAULT).dbd
ifeq ($(LOADABLE_MODULE),YES)
SRCS += $(LIBRARY_DEFAULT)_registerRecordDeviceDriver.cpp
endif
SRCS += $(SYNAPPS_RECORDS:%=dev%Stream.c)
LIB_LIBS += stream $(EPICS_BASE_IOC_LIBS)
include $(TOP)/configure/RULES
# create streamSynApps.dbd from all SYNAPPS_RECORDS
$(COMMON_DIR)/$(LIBRARY_DEFAULT).dbd: ../../src/CONFIG_STREAM
$(PERL) ../../src/makedbd.pl $(SYNAPPS_RECORDS) > $@

View File

@ -1,4 +1,4 @@
TOP=../..
TOP:=../$(TOP)
# Look if we have EPICS R3.13 or R3.14
ifeq ($(wildcard $(TOP)/configure),)
@ -20,7 +20,7 @@ streamApp_DBD += base.dbd
# In 3.14.12 aaiRecord.dbd and aaoRecord.dbd are part of base.dbd
# In earlier versions, these records are buggy and not included by default
#streamApp_DBD += aaiRecord.dbd aaoRecord.dbd
streamApp_DBD += aaiRecord.dbd aaoRecord.dbd
PROD_SRCS += streamApp_registerRecordDeviceDriver.cpp
PROD_SRCS_DEFAULT = streamAppMain.cc
@ -41,11 +41,9 @@ endif
ifneq ($(words $(CALC) $(SYNAPPS)), 0)
# With synApps scalcout record
streamApp_DBD += calcSupport.dbd
streamApp_DBD += streamSynApps.dbd
PROD_LIBS += calc
# older calc versions require sscan
#PROD_LIBS += sscan
PROD_LIBS_DEFAULT += streamSynApps
endif
streamApp_DBD += stream.dbd
@ -68,13 +66,7 @@ CPPFLAGS += -DDEBUGFILE=StreamDebug.log
include $(TOP)/configure/RULES
ifeq ($(BASE_3_14), YES)
clean:: myclean
else
clean: myclean
endif
myclean:
clean::
$(RM) core* StreamDebug.log
endif

View File

@ -1,8 +1,5 @@
TOP = ../../..
TOP := ../../$(TOP)
include $(TOP)/config/CONFIG_APP
DBDEXPAND = streamAppInclude-3-13.dbd
DBDNAME = streamApp.dbd
include $(TOP)/config/RULES.Host
include $(EPICS_BASE)/config/RULES.Host

View File

@ -1,19 +1,24 @@
TOP = ../../..
TOP := ../../$(TOP)
include $(TOP)/config/CONFIG_APP
LIBNAME = streamApp
LDLIBS += $(COMPAT_BIN)/compatLib
LDLIBS += $(ASYN_BIN)/asynLib
LDLIBS += $(INSTALL_BIN)/streamLib
LDLIBS += $(TOP)/bin/$(T_A)/streamLib
LDLIBS += $(ASYN)/bin/$(T_A)/asynLib
LDLIBS += $(COMPAT)/bin/$(T_A)/compatLib
include ../base-3-13LIBOBJS
# Write StreamDevice debug output to this file
CPPFLAGS += -DDEBUGFILE=StreamDebug.log
streamApp_DBD += base-3-13.dbd
streamApp_DBD += stream.dbd
DBDNAME = streamApp.dbd
DBDEXPAND = streamAppInclude-3-13.dbd
include $(TOP)/config/RULES.Vx
# Write StreamDevice debug output to this file
#CPPFLAGS += -DDEBUGFILE=StreamDebug.log
include $(EPICS_BASE)/config/RULES.Vx
include $(TOP)/config/RULES.munch
# Rebuild when LIBOBJS change