Compare commits

..

6 Commits

17 changed files with 77 additions and 71 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ include
*.pdf *.pdf
*.*log *.*log
StreamVersion.h StreamVersion.h
*.local

View File

@ -25,6 +25,10 @@ HEADERS += src/StreamFormatConverter.h
HEADERS += src/StreamBuffer.h HEADERS += src/StreamBuffer.h
HEADERS += src/StreamError.h HEADERS += src/StreamError.h
HEADERS += src/StreamVersion.h HEADERS += src/StreamVersion.h
HEADERS += src/StreamProtocol.h
HEADERS += src/StreamBusInterface.h
HEADERS += src/StreamCore.h
HEADERS += src/MacroMagic.h
CPPFLAGS += -DSTREAM_INTERNAL -I$(COMMON_DIR) CPPFLAGS += -DSTREAM_INTERNAL -I$(COMMON_DIR)

View File

@ -21,21 +21,10 @@
# along with StreamDevice. If not, see https://www.gnu.org/licenses/. # along with StreamDevice. If not, see https://www.gnu.org/licenses/.
#########################################################################/ #########################################################################/
TOP = .. TOP = .
ifneq ($(wildcard ../configure),) DIRS = configure
# We are in an EPICS R3.14+ <TOP> location src_DEPEND_DIRS := $(DIRS)
include $(TOP)/configure/CONFIG include $(TOP)/configure/CONFIG
else ifneq ($(wildcard ../config),)
# We are in an EPICS R3.13 <TOP> location
CONFIG = $(TOP)/config
include $(TOP)/config/CONFIG_APP
else
# Using our own local configuration
TOP = .
DIRS = configure
src_DEPEND_DIRS := $(DIRS)
include $(TOP)/configure/CONFIG
endif
DIRS += src DIRS += src
DIRS += streamApp DIRS += streamApp

View File

@ -54,15 +54,17 @@ git clone https://github.com/paulscherrerinstitute/StreamDevice.git
<p class="new"> <p class="new">
<em>StreamDevice</em> now comes with a standard <em>StreamDevice</em> now comes with a standard
<kbd>configure</kbd> directory. <kbd>configure</kbd> directory.
But it can still be built in an external <em>&lt;top&gt;</em> <del>But it can still be built in an external <em>&lt;top&gt;</em>
directory as in previous versions. directory as in previous versions.
It will automatically detect <em>&lt;top&gt;</em> locations It will automatically detect <em>&lt;top&gt;</em> locations
from the presence of <kbd>../configure</kbd> or <kbd>../config</kbd> from the presence of <kbd>../configure</kbd> or <kbd>../config</kbd>
directories. directories.</del> Using an upper level <kbd>../configure</kbd> is
no longer supported due to compatibility issues with <em>SynApps</em>.
</p> </p>
<p class="new"> <p class="new">
Edit the <kbd>configure/RELEASE</kbd> file to specify the install location Edit the <kbd>configure/RELEASE</kbd> file to specify the install location
of EPICS base and of additional software modules, for example: of EPICS base and of additional software modules or add a
<kbd>configure/RELEASE.local</kbd> file to overwrite, for example:
<pre> <pre>
EPICS_BASE=/home/epics/base-3.16.1 EPICS_BASE=/home/epics/base-3.16.1
</pre> </pre>

View File

@ -24,8 +24,15 @@
#include "StreamError.h" #include "StreamError.h"
#include <ctype.h> #include <ctype.h>
#if defined(__vxworks) || defined(vxWorks) #if defined(__vxworks) || defined(vxWorks)
#include <version.h>
#if defined(_WRS_VXWORKS_MAJOR) && _WRS_VXWORKS_MAJOR > 6 || (_WRS_VXWORKS_MAJOR == 6 && _WRS_VXWORKS_MINOR > 8)
#include <stdint.h>
#define PRIX32 "X"
#define PRIu32 "u"
#else
#define PRIX32 "lX" #define PRIX32 "lX"
#define PRIu32 "lu" #define PRIu32 "lu"
#endif
#define PRIX8 "X" #define PRIX8 "X"
#define SCNx8 "hhx" #define SCNx8 "hhx"
#define uint_fast8_t uint8_t #define uint_fast8_t uint8_t

View File

@ -21,16 +21,8 @@
# along with StreamDevice. If not, see https://www.gnu.org/licenses/. # along with StreamDevice. If not, see https://www.gnu.org/licenses/.
#########################################################################/ #########################################################################/
TOP = ../.. TOP= ..
ifneq ($(wildcard ../../configure),) include $(TOP)/configure/CONFIG
include $(TOP)/configure/CONFIG
else ifneq ($(wildcard ../../config),)
include $(TOP)/config/CONFIG_APP
include $(TOP)/config/RULES_ARCHS
else
TOP= ..
include $(TOP)/configure/CONFIG
endif
-include CONFIG_STREAM -include CONFIG_STREAM
-include ../CONFIG_STREAM -include ../CONFIG_STREAM
@ -79,6 +71,10 @@ INC += StreamFormatConverter.h
INC += StreamBuffer.h INC += StreamBuffer.h
INC += StreamError.h INC += StreamError.h
INC += StreamVersion.h INC += StreamVersion.h
INC += StreamProtocol.h
INC += StreamBusInterface.h
INC += StreamCore.h
INC += MacroMagic.h
# switch off annoying rset warnings in 3.16+ # switch off annoying rset warnings in 3.16+
CPPFLAGS += -DUSE_TYPED_RSET CPPFLAGS += -DUSE_TYPED_RSET
@ -89,7 +85,7 @@ CPPFLAGS += -DSTREAM_INTERNAL
# Update version string whenever something changed. # Update version string whenever something changed.
StreamVersion$(OBJ): $(COMMON_DIR)/StreamVersion.h $(filter-out StreamVersion$(OBJ),$(LIBOBJS) $(LIBRARY_OBJS)) ../CONFIG_STREAM StreamVersion$(OBJ): $(COMMON_DIR)/StreamVersion.h $(filter-out StreamVersion$(OBJ),$(LIBOBJS) $(LIBRARY_OBJS)) ../CONFIG_STREAM
$(COMMON_DIR)/StreamVersion.h: $(SRCS) $(filter-out StreamVersion.h, $(INC)) $(COMMON_DIR)/StreamVersion.h: ../../.VERSION $(SRCS) $(filter-out StreamVersion.h, $(INC))
@echo Creating $@ @echo Creating $@
$(PERL) ../makeStreamVersion.pl $@ $(PERL) ../makeStreamVersion.pl $@

View File

@ -187,9 +187,12 @@ bool StreamCore::
parse(const char* filename, const char* _protocolname) parse(const char* filename, const char* _protocolname)
{ {
protocolname = _protocolname; protocolname = _protocolname;
// extract substitutions from protocolname "name(sub1,sub2)" // extract substitutions from protocolname "name ( sub1, sub2 ) "
ssize_t i = protocolname.find('('); ssize_t i = protocolname.find('(');
if (i >= 0) if (i < 0) i = 0;
while (protocolname[i-1] == ' ')
protocolname.remove(--i, 1);
if (protocolname[i] == '(')
{ {
while (i < (ssize_t)protocolname.length()) while (i < (ssize_t)protocolname.length())
{ {

View File

@ -26,10 +26,16 @@
#define STR(x) STR2(x) #define STR(x) STR2(x)
const char StreamVersion [] = const char StreamVersion [] =
"StreamDevice" "StreamDevice"
#if STREAM_MAJOR+0 #ifdef STREAM_MAJOR
" " STR(STREAM_MAJOR) " " STR(STREAM_MAJOR)
"." STR(STREAM_MINOR) "." STR(STREAM_MINOR)
"." STR(STREAM_PATCHLEVEL) "." STR(STREAM_PATCHLEVEL)
STREAM_DEV STREAM_DEV
#endif #endif
" commit:" STREAM_COMMIT_HASH; #ifdef STREAM_COMMIT_DATE
" " STREAM_COMMIT_DATE
#endif
#ifdef STREAM_COMMIT_HASH
"\n commit: " STREAM_COMMIT_HASH
#endif
;

View File

@ -171,10 +171,10 @@ static long writeData(dbCommon *record, format_t *format)
break; break;
#ifdef DBR_INT64 #ifdef DBR_INT64
case DBF_INT64: case DBF_INT64:
dval = ((epicsInt64 *)aai->bptr)[nowd]; dval = (double)((epicsInt64 *)aai->bptr)[nowd];
break; break;
case DBF_UINT64: case DBF_UINT64:
dval = ((epicsUInt64 *)aai->bptr)[nowd]; dval = (double)((epicsUInt64 *)aai->bptr)[nowd];
break; break;
#endif #endif
case DBF_LONG: case DBF_LONG:
@ -214,10 +214,10 @@ static long writeData(dbCommon *record, format_t *format)
{ {
#ifdef DBR_INT64 #ifdef DBR_INT64
case DBF_INT64: case DBF_INT64:
lval = ((epicsInt64 *)aai->bptr)[nowd]; lval = (long)((epicsInt64 *)aai->bptr)[nowd];
break; break;
case DBF_UINT64: case DBF_UINT64:
lval = ((epicsUInt64 *)aai->bptr)[nowd]; lval = (long)((epicsUInt64 *)aai->bptr)[nowd];
break; break;
#endif #endif
case DBF_LONG: case DBF_LONG:

View File

@ -200,10 +200,10 @@ static long writeData(dbCommon *record, format_t *format)
break; break;
#ifdef DBR_INT64 #ifdef DBR_INT64
case DBF_INT64: case DBF_INT64:
dval = ((epicsInt64 *)aao->bptr)[nowd]; dval = (double)((epicsInt64 *)aao->bptr)[nowd];
break; break;
case DBF_UINT64: case DBF_UINT64:
dval = ((epicsUInt64 *)aao->bptr)[nowd]; dval = (double)((epicsUInt64 *)aao->bptr)[nowd];
break; break;
#endif #endif
case DBF_LONG: case DBF_LONG:
@ -243,10 +243,10 @@ static long writeData(dbCommon *record, format_t *format)
{ {
#ifdef DBR_INT64 #ifdef DBR_INT64
case DBF_INT64: case DBF_INT64:
lval = ((epicsInt64 *)aao->bptr)[nowd]; lval = (long)((epicsInt64 *)aao->bptr)[nowd];
break; break;
case DBF_UINT64: case DBF_UINT64:
lval = ((epicsUInt64 *)aao->bptr)[nowd]; lval = (long)((epicsUInt64 *)aao->bptr)[nowd];
break; break;
#endif #endif
case DBF_LONG: case DBF_LONG:

View File

@ -73,7 +73,7 @@ static long readData(dbCommon *record, format_t *format)
if (record->pact) return DO_NOT_CONVERT; if (record->pact) return DO_NOT_CONVERT;
/* In @init handler, no processing, enforce monitor updates. */ /* In @init handler, no processing, enforce monitor updates. */
ao->omod = ao->oval != val; ao->omod = ao->oval != val;
ao->orbv = ao->oval = val; ao->orbv = (epicsInt32)(ao->oval = val);
monitor_mask = recGblResetAlarms(record); monitor_mask = recGblResetAlarms(record);
if (!(fabs(ao->mlst - val) <= ao->mdel)) if (!(fabs(ao->mlst - val) <= ao->mdel))
{ {

View File

@ -37,7 +37,7 @@ static long readData(dbCommon *record, format_t *format)
{ {
lsi->val[length] = 0; lsi->val[length] = 0;
} }
lsi->len = length; lsi->len = (epicsUInt32)length;
return OK; return OK;
} }

View File

@ -39,7 +39,7 @@ static long readData(dbCommon *record, format_t *format)
{ {
lso->val[length] = 0; lso->val[length] = 0;
} }
lso->len = length; lso->len = (epicsUInt32)length;
if (record->pact) return OK; if (record->pact) return OK;
/* In @init handler, no processing, enforce monitor updates. */ /* In @init handler, no processing, enforce monitor updates. */
monitor_mask = recGblResetAlarms(record); monitor_mask = recGblResetAlarms(record);

View File

@ -172,10 +172,10 @@ static long writeData(dbCommon *record, format_t *format)
break; break;
#ifdef DBR_INT64 #ifdef DBR_INT64
case DBF_INT64: case DBF_INT64:
dval = ((epicsInt64 *)wf->bptr)[nowd]; dval = (double)((epicsInt64 *)wf->bptr)[nowd];
break; break;
case DBF_UINT64: case DBF_UINT64:
dval = ((epicsUInt64 *)wf->bptr)[nowd]; dval = (double)((epicsUInt64 *)wf->bptr)[nowd];
break; break;
#endif #endif
case DBF_LONG: case DBF_LONG:
@ -215,10 +215,10 @@ static long writeData(dbCommon *record, format_t *format)
{ {
#ifdef DBR_INT64 #ifdef DBR_INT64
case DBF_INT64: case DBF_INT64:
lval = ((epicsInt64 *)wf->bptr)[nowd]; lval = (long)((epicsInt64 *)wf->bptr)[nowd];
break; break;
case DBF_UINT64: case DBF_UINT64:
lval = ((epicsUInt64 *)wf->bptr)[nowd]; lval = (long)((epicsUInt64 *)wf->bptr)[nowd];
break; break;
#endif #endif
case DBF_LONG: case DBF_LONG:

View File

@ -23,7 +23,7 @@
use strict; use strict;
my ( $major, $minor, $patch, $dev, $branch, $date, $hash ); my ( $major, $minor, $patch, $dev, $date, $hash );
if (my $version = `git describe --tags --abbrev=0 --dirty --match "[0-9]*" 2>/dev/null`) { if (my $version = `git describe --tags --abbrev=0 --dirty --match "[0-9]*" 2>/dev/null`) {
if ($version =~ m/(\d+)\.(\d+)\.(\d+)?(.*)?/) { if ($version =~ m/(\d+)\.(\d+)\.(\d+)?(.*)?/) {
@ -39,10 +39,10 @@ if (!$major) {
if ($line =~ m/COMMIT: *([[:xdigit:]]+)/) { if ($line =~ m/COMMIT: *([[:xdigit:]]+)/) {
$hash = $1; $hash = $1;
} }
if ($line =~ m/REFS: *tag: *((\d+)\.(\d+)\.(\d+)?,)? *(.*)/) { if ($line =~ m/REFS: .*tag: *(\d+)\.(\d+)\.?(\d+)?/) {
$major = $2; $minor = $3; $patch = $4; $branch = $5; $major = $1; $minor = $2; $patch = $3 or $patch = 0;
} }
if ($line =~ m/DATE: *(.+)/) { if ($line =~ m/DATE: *([-0-9:+ ]*)/) {
$date = $1; $date = $1;
} }
} }
@ -58,14 +58,20 @@ print $out <<EOF;
#ifndef StreamVersion_h #ifndef StreamVersion_h
#define StreamVersion_h #define StreamVersion_h
EOF
if ($major) {
print $out <<EOF;
#define STREAM_MAJOR $major #define STREAM_MAJOR $major
#define STREAM_MINOR $minor #define STREAM_MINOR $minor
#define STREAM_PATCHLEVEL $patch #define STREAM_PATCHLEVEL $patch
#define STREAM_DEV "$dev" #define STREAM_DEV "$dev"
#define STREAM_COMMIT_HASH "$hash"
#define STREAM_COMMIT_DATE "$date"
#endif /* StreamVersion_h */
EOF EOF
}
if ($hash) {
print $out "#define STREAM_COMMIT_HASH \"$hash\"\n";
}
if ($date) {
print $out "#define STREAM_COMMIT_DATE \"$date\"\n";
}
print $out "#endif /* StreamVersion_h */\n";
close $out close $out

View File

@ -21,16 +21,8 @@
# along with StreamDevice. If not, see https://www.gnu.org/licenses/. # along with StreamDevice. If not, see https://www.gnu.org/licenses/.
#########################################################################/ #########################################################################/
TOP = ../.. TOP= ..
ifneq ($(wildcard ../../configure),) include $(TOP)/configure/CONFIG
include $(TOP)/configure/CONFIG
else ifneq ($(wildcard ../../config),)
include $(TOP)/config/CONFIG_APP
include $(TOP)/config/RULES_ARCHS
else
TOP= ..
include $(TOP)/configure/CONFIG
endif
PROD = streamApp PROD = streamApp
DBD = streamApp.dbd DBD = streamApp.dbd

View File

@ -22,20 +22,20 @@
record (stringout, "$(P):cmd") record (stringout, "$(P):cmd")
{ {
field (DTYP, "stream") field (DTYP, "stream")
field (OUT, "@test.proto command terminal") field (OUT, "@test.proto command terminal")
field (PRIO, "HIGH") field (PRIO, "HIGH")
field (VAL, "") field (VAL, "")
} }
record (stringout, "$(P):info") record (stringout, "$(P):info")
{ {
field (DTYP, "stream") field (DTYP, "stream")
field (OUT, "@test.proto info terminal") field (OUT, "@test.proto info terminal ")
field (PRIO, "HIGH") field (PRIO, "HIGH")
} }
record (stringout, "$(P):request") record (stringout, "$(P):request")
{ {
field (DTYP, "stream") field (DTYP, "stream")
field (OUT, "@test.proto request($(P):reply.VAL) terminal") field (OUT, "@test.proto request ($(P):reply.VAL) terminal")
field (PRIO, "HIGH") field (PRIO, "HIGH")
} }
record (stringin, "$(P):reply") record (stringin, "$(P):reply")
@ -44,7 +44,7 @@ record (stringin, "$(P):reply")
record (stringout, "$(P):checksum") record (stringout, "$(P):checksum")
{ {
field (DTYP, "stream") field (DTYP, "stream")
field (OUT, "@test.proto checksum($(CHKSUM=sum)) terminal") field (OUT, "@test.proto checksum ($(CHKSUM=sum)) terminal")
} }
record (stringin, "$(P):spy") record (stringin, "$(P):spy")
{ {