Compare commits
23 Commits
Author | SHA1 | Date | |
---|---|---|---|
e6b2944c67 | |||
ea8873becd | |||
cf7e7bd6ee | |||
e36ee60ba7 | |||
e7f36a71af | |||
ce4b14c611 | |||
7c55d7bdfa | |||
6afa4828eb | |||
75bbb1a252 | |||
227bb83f60 | |||
4edff374d0 | |||
9273476135 | |||
8b9359723a | |||
bf55d4c202 | |||
1cace82a70 | |||
85e8632b02 | |||
1994912271 | |||
98fa595753 | |||
f6640b3418 | |||
4747bb5bc7 | |||
bd9ee1c660 | |||
1c9278812b | |||
2ea014ae46 |
3
.VERSION
Normal file
3
.VERSION
Normal file
@ -0,0 +1,3 @@
|
||||
COMMIT: $Format:%H$
|
||||
REFS: $Format:%D$
|
||||
DATE: $Format:%ci$
|
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
GNUmakefile export-ignore
|
||||
.VERSION export-subst
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,3 +7,4 @@ include
|
||||
*.pdf
|
||||
*.*log
|
||||
StreamVersion.h
|
||||
*.local
|
||||
|
20
GNUmakefile
20
GNUmakefile
@ -5,7 +5,7 @@ else
|
||||
include /ioc/tools/driver.makefile
|
||||
EXCLUDE_VERSIONS = 3.13.2
|
||||
PROJECT=stream
|
||||
BUILDCLASSES += Linux
|
||||
BUILDCLASSES += vxWorks Linux WIN32
|
||||
|
||||
DOCUDIR = docs
|
||||
|
||||
@ -25,17 +25,19 @@ HEADERS += src/StreamFormatConverter.h
|
||||
HEADERS += src/StreamBuffer.h
|
||||
HEADERS += src/StreamError.h
|
||||
HEADERS += src/StreamVersion.h
|
||||
HEADERS += src/StreamProtocol.h
|
||||
HEADERS += src/StreamBusInterface.h
|
||||
HEADERS += src/StreamCore.h
|
||||
HEADERS += src/MacroMagic.h
|
||||
|
||||
CPPFLAGS += -DSTREAM_INTERNAL
|
||||
CPPFLAGS += -DSTREAM_INTERNAL -I$(COMMON_DIR)
|
||||
|
||||
# Update version string (contains __DATE__ and __TIME__)
|
||||
# each time anything changed.
|
||||
StreamVersion$(OBJ): StreamVersion.h $(filter-out StreamVersion$(OBJ) stream_exportAddress$(OBJ),$(LIBOBJS) $(LIBRARY_OBJS))
|
||||
# Update version string each time anything changes
|
||||
StreamVersion$(OBJ) StreamVersion$(DEP): $(COMMON_DIR)/StreamVersion.h $(filter-out StreamVersion$(OBJ) stream_exportAddress$(OBJ),$(LIBOBJS) $(LIBRARY_OBJS))
|
||||
|
||||
MAKE_FIRST=src/StreamVersion.h
|
||||
src/StreamVersion.h: $(SOURCES) $(filter-out %StreamVersion.h, $(HEADERS))
|
||||
@echo Creating $@ from git tag
|
||||
$(PERL) src/makeStreamVersion.pl > $@
|
||||
$(COMMON_DIR)/StreamVersion.h: $(filter-out StreamVersion.h,$(notdir $(SOURCES) $(HEADERS)))
|
||||
@echo Creating $@
|
||||
$(PERL) ../src/makeStreamVersion.pl $@
|
||||
|
||||
StreamCore$(OBJ) StreamCore$(DEP): streamReferences
|
||||
streamReferences:
|
||||
|
19
Makefile
19
Makefile
@ -21,21 +21,10 @@
|
||||
# along with StreamDevice. If not, see https://www.gnu.org/licenses/.
|
||||
#########################################################################/
|
||||
|
||||
TOP = ..
|
||||
ifneq ($(wildcard ../configure),)
|
||||
# We are in an EPICS R3.14+ <TOP> location
|
||||
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
|
||||
TOP = .
|
||||
DIRS = configure
|
||||
src_DEPEND_DIRS := $(DIRS)
|
||||
include $(TOP)/configure/CONFIG
|
||||
|
||||
DIRS += src
|
||||
DIRS += streamApp
|
||||
|
@ -24,4 +24,3 @@ endif
|
||||
|
||||
# dbst based database optimization (default: NO)
|
||||
DB_OPT = NO
|
||||
HOST_OPT=NO
|
||||
|
@ -54,15 +54,17 @@ git clone https://github.com/paulscherrerinstitute/StreamDevice.git
|
||||
<p class="new">
|
||||
<em>StreamDevice</em> now comes with a standard
|
||||
<kbd>configure</kbd> directory.
|
||||
But it can still be built in an external <em><top></em>
|
||||
<del>But it can still be built in an external <em><top></em>
|
||||
directory as in previous versions.
|
||||
It will automatically detect <em><top></em> locations
|
||||
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 class="new">
|
||||
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>
|
||||
EPICS_BASE=/home/epics/base-3.16.1
|
||||
</pre>
|
||||
|
@ -24,10 +24,16 @@
|
||||
#include "StreamError.h"
|
||||
#include <ctype.h>
|
||||
#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 PRIu32 "lu"
|
||||
#endif
|
||||
#define PRIX8 "X"
|
||||
#define SCNx8 "hhx"
|
||||
#define uint_fast8_t uint8_t
|
||||
#define int_fast8_t int8_t
|
||||
#elif defined(_MSC_VER) && _MSC_VER < 1700 /* Visual Studio 2010 does not have inttypes.h */
|
||||
@ -35,7 +41,6 @@
|
||||
#define PRIX32 "X"
|
||||
#define PRIu32 "u"
|
||||
#define PRIX8 "X"
|
||||
#define SCNx8 "hhx"
|
||||
#else
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <stdint.h>
|
||||
@ -747,7 +752,7 @@ scanPseudo(const StreamFormat& format, StreamBuffer& input, size_t& cursor)
|
||||
debug("ChecksumConverter %s: input checksum is 0x%0*" PRIX32 "\n",
|
||||
checksumMap[fnum].name, 2*checksumMap[fnum].bytes, sum);
|
||||
|
||||
uint_fast8_t inchar;
|
||||
unsigned int inchar;
|
||||
|
||||
if (format.flags & sign_flag) // decimal
|
||||
{
|
||||
@ -774,7 +779,7 @@ scanPseudo(const StreamFormat& format, StreamBuffer& input, size_t& cursor)
|
||||
{
|
||||
if (format.flags & zero_flag) // ASCII
|
||||
{
|
||||
if (sscanf(input(cursor+2*i), "%2" SCNx8, (int8_t *) &inchar) != 1)
|
||||
if (sscanf(input(cursor+2*i), "%2x", &inchar) != 1)
|
||||
{
|
||||
debug("ChecksumConverter %s: Input byte '%s' is not a hex byte\n",
|
||||
checksumMap[fnum].name, input.expand(cursor+2*i,2)());
|
||||
@ -818,7 +823,7 @@ scanPseudo(const StreamFormat& format, StreamBuffer& input, size_t& cursor)
|
||||
{
|
||||
if (format.flags & zero_flag) // ASCII
|
||||
{
|
||||
sscanf(input(cursor+2*i), "%2" SCNx8, (int8_t *) &inchar);
|
||||
sscanf(input(cursor+2*i), "%2x", &inchar);
|
||||
}
|
||||
else
|
||||
if (format.flags & left_flag) // poor man's hex: 0x30 - 0x3F
|
||||
|
22
src/Makefile
22
src/Makefile
@ -21,16 +21,8 @@
|
||||
# along with StreamDevice. If not, see https://www.gnu.org/licenses/.
|
||||
#########################################################################/
|
||||
|
||||
TOP = ../..
|
||||
ifneq ($(wildcard ../../configure),)
|
||||
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
|
||||
TOP= ..
|
||||
include $(TOP)/configure/CONFIG
|
||||
|
||||
-include CONFIG_STREAM
|
||||
-include ../CONFIG_STREAM
|
||||
@ -79,6 +71,10 @@ INC += StreamFormatConverter.h
|
||||
INC += StreamBuffer.h
|
||||
INC += StreamError.h
|
||||
INC += StreamVersion.h
|
||||
INC += StreamProtocol.h
|
||||
INC += StreamBusInterface.h
|
||||
INC += StreamCore.h
|
||||
INC += MacroMagic.h
|
||||
|
||||
# switch off annoying rset warnings in 3.16+
|
||||
CPPFLAGS += -DUSE_TYPED_RSET
|
||||
@ -89,9 +85,9 @@ CPPFLAGS += -DSTREAM_INTERNAL
|
||||
|
||||
# Update version string whenever something changed.
|
||||
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))
|
||||
@echo Creating $@ from git tag
|
||||
$(PERL) ../makeStreamVersion.pl > $@
|
||||
$(COMMON_DIR)/StreamVersion.h: ../../.VERSION $(SRCS) $(filter-out StreamVersion.h, $(INC))
|
||||
@echo Creating $@
|
||||
$(PERL) ../makeStreamVersion.pl $@
|
||||
|
||||
# Add references to all registrars to main file to avoid
|
||||
# missing initialization.
|
||||
|
@ -341,7 +341,10 @@ StreamBuffer StreamBuffer::expand(ssize_t start, ssize_t length) const
|
||||
{
|
||||
c = buffer[i];
|
||||
if (c < 0x20 || c >= 0x7f)
|
||||
result.print("\033[7m<%02x>\033[27m", c & 0xff);
|
||||
result.print("%s<%02x>%s",
|
||||
ansiEscape(ANSI_REVERSE_VIDEO),
|
||||
c & 0xff,
|
||||
ansiEscape(ANSI_NOT_REVERSE_VIDEO));
|
||||
else
|
||||
result.append(c);
|
||||
}
|
||||
@ -354,18 +357,21 @@ dump() const
|
||||
StreamBuffer result;
|
||||
size_t i;
|
||||
result.print("%" P "d,%" P "d,%" P "d:", offs, len, cap);
|
||||
if (offs) result.print("\033[47m");
|
||||
if (offs) result.print(ansiEscape(ANSI_BG_WHITE));
|
||||
char c;
|
||||
for (i = 0; i < cap; i++)
|
||||
{
|
||||
c = buffer[i];
|
||||
if (offs && i == offs) result.append("\033[0m");
|
||||
if (offs && i == offs) result.append(ansiEscape(ANSI_RESET));
|
||||
if (c < 0x20 || c >= 0x7f)
|
||||
result.print("\033[7m<%02x>\033[27m", c & 0xff);
|
||||
result.print("%s<%02x>%s",
|
||||
ansiEscape(ANSI_REVERSE_VIDEO),
|
||||
c & 0xff,
|
||||
ansiEscape(ANSI_NOT_REVERSE_VIDEO));
|
||||
else
|
||||
result.append(c);
|
||||
if (i == offs+len-1) result.append("\033[47m");
|
||||
if (i == offs+len-1) result.append(ansiEscape(ANSI_BG_WHITE));
|
||||
}
|
||||
result.append("\033[0m");
|
||||
result.append(ansiEscape(ANSI_RESET));
|
||||
return result;
|
||||
}
|
||||
|
@ -72,9 +72,9 @@ printCommands(StreamBuffer& buffer, const char* c)
|
||||
buffer.append(" disconnect;\n");
|
||||
break;
|
||||
default:
|
||||
buffer.append("\033[31;1mGARBAGE: ");
|
||||
buffer.append(ansiEscape(ANSI_RED_BOLD)).append("GARBAGE: ");
|
||||
c = StreamProtocolParser::printString(buffer, c-1);
|
||||
buffer.append("\033[0m\n");
|
||||
buffer.append(ansiEscape(ANSI_RESET)).append("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -187,9 +187,12 @@ bool StreamCore::
|
||||
parse(const char* filename, const char* _protocolname)
|
||||
{
|
||||
protocolname = _protocolname;
|
||||
// extract substitutions from protocolname "name(sub1,sub2)"
|
||||
// extract substitutions from protocolname "name ( sub1, sub2 ) "
|
||||
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())
|
||||
{
|
||||
|
@ -198,6 +198,7 @@ public:
|
||||
extern "C" { // needed for Windows
|
||||
epicsExportAddress(int, streamDebug);
|
||||
epicsExportAddress(int, streamError);
|
||||
epicsExportAddress(int, streamDebugColored);
|
||||
}
|
||||
|
||||
// for subroutine record
|
||||
|
@ -23,7 +23,10 @@
|
||||
#include "StreamError.h"
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <io.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif /* _WIN32 */
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
@ -46,18 +49,36 @@ FILE *StreamDebugFile = NULL;
|
||||
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
|
||||
#endif
|
||||
|
||||
/* Enable ANSI colors in Windows console */
|
||||
static int win_console_init() {
|
||||
DWORD dwMode = 0;
|
||||
HANDLE hCons = GetStdHandle(STD_ERROR_HANDLE);
|
||||
GetConsoleMode(hCons, &dwMode);
|
||||
dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
|
||||
SetConsoleMode(hCons, dwMode);
|
||||
return 0;
|
||||
/* Enable ANSI color support in Windows console */
|
||||
static bool win_console_init() {
|
||||
HANDLE hCons[] = { GetStdHandle(STD_ERROR_HANDLE),
|
||||
GetStdHandle(STD_OUTPUT_HANDLE) };
|
||||
for(int i=0; i < sizeof(hCons) / sizeof(HANDLE); ++i)
|
||||
{
|
||||
DWORD dwMode = 0;
|
||||
if (hCons[i] == NULL ||
|
||||
hCons[i] == INVALID_HANDLE_VALUE ||
|
||||
!GetConsoleMode(hCons[i], &dwMode))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
|
||||
if (!SetConsoleMode(hCons[i], dwMode))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
static int s = win_console_init();
|
||||
|
||||
#endif
|
||||
/* do isatty() call second as always want to run win_console_init() */
|
||||
int streamDebugColored = win_console_init() && _isatty(_fileno(stdout));
|
||||
|
||||
#else
|
||||
|
||||
int streamDebugColored = isatty(fileno(stdout));
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/* You can globally change the printTimestamp function
|
||||
by setting the StreamPrintTimestampFunction variable
|
||||
@ -106,14 +127,13 @@ void StreamVError(int line, const char* file, const char* fmt, va_list args)
|
||||
va_end(args2);
|
||||
}
|
||||
#endif
|
||||
fprintf(stderr, "\033[31;1m");
|
||||
fprintf(stderr, "%s ", timestamp);
|
||||
fprintf(stderr, "%s%s ", ansiEscape(ANSI_RED_BOLD), timestamp);
|
||||
if (file)
|
||||
{
|
||||
fprintf(stderr, "%s line %d: ", file, line);
|
||||
}
|
||||
vfprintf(stderr, fmt, args);
|
||||
fprintf(stderr, "\033[0m");
|
||||
fprintf(stderr, "%s", ansiEscape(ANSI_RESET));
|
||||
}
|
||||
|
||||
int StreamDebugClass::
|
||||
@ -133,3 +153,13 @@ print(const char* fmt, ...)
|
||||
va_end(args);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an ANSI escape code if coloured debug output is enabled
|
||||
*/
|
||||
const char* ansiEscape(AnsiMode mode)
|
||||
{
|
||||
static const char* AnsiEscapes[] = { "\033[7m", "\033[27m", "\033[47m",
|
||||
"\033[0m", "\033[31;1m" };
|
||||
return streamDebugColored ? AnsiEscapes[mode] : "";
|
||||
}
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
extern int streamDebug;
|
||||
extern int streamError;
|
||||
extern int streamDebugColored;
|
||||
extern void (*StreamPrintTimestampFunction)(char* buffer, size_t size);
|
||||
|
||||
void StreamError(int line, const char* file, const char* fmt, ...)
|
||||
@ -66,4 +67,11 @@ StreamDebugObject(const char* file, int line)
|
||||
#define error StreamError
|
||||
#define debug (!streamDebug)?0:StreamDebugObject(__FILE__,__LINE__).print
|
||||
|
||||
/*
|
||||
* ANSI escape sequences for terminal output
|
||||
*/
|
||||
enum AnsiMode { ANSI_REVERSE_VIDEO, ANSI_NOT_REVERSE_VIDEO, ANSI_BG_WHITE,
|
||||
ANSI_RESET, ANSI_RED_BOLD };
|
||||
extern const char* ansiEscape(AnsiMode mode);
|
||||
|
||||
#endif
|
||||
|
@ -157,7 +157,7 @@ StreamProtocolParser* StreamProtocolParser::
|
||||
readFile(const char* filename)
|
||||
{
|
||||
FILE* file;
|
||||
#ifdef windows
|
||||
#ifdef _WIN32
|
||||
const char pathseparator = ';';
|
||||
const char dirseparator = '\\';
|
||||
#else
|
||||
|
@ -25,8 +25,17 @@
|
||||
#define STR2(x) #x
|
||||
#define STR(x) STR2(x)
|
||||
const char StreamVersion [] =
|
||||
"StreamDevice " STR(STREAM_MAJOR)
|
||||
"StreamDevice"
|
||||
#ifdef STREAM_MAJOR
|
||||
" " STR(STREAM_MAJOR)
|
||||
"." STR(STREAM_MINOR)
|
||||
"." STR(STREAM_PATCHLEVEL)
|
||||
STREAM_DEV
|
||||
" built " __DATE__ " " __TIME__;
|
||||
#endif
|
||||
#ifdef STREAM_COMMIT_DATE
|
||||
" " STREAM_COMMIT_DATE
|
||||
#endif
|
||||
#ifdef STREAM_COMMIT_HASH
|
||||
"\n commit: " STREAM_COMMIT_HASH
|
||||
#endif
|
||||
;
|
||||
|
@ -171,10 +171,10 @@ static long writeData(dbCommon *record, format_t *format)
|
||||
break;
|
||||
#ifdef DBR_INT64
|
||||
case DBF_INT64:
|
||||
dval = ((epicsInt64 *)aai->bptr)[nowd];
|
||||
dval = (double)((epicsInt64 *)aai->bptr)[nowd];
|
||||
break;
|
||||
case DBF_UINT64:
|
||||
dval = ((epicsUInt64 *)aai->bptr)[nowd];
|
||||
dval = (double)((epicsUInt64 *)aai->bptr)[nowd];
|
||||
break;
|
||||
#endif
|
||||
case DBF_LONG:
|
||||
@ -214,10 +214,10 @@ static long writeData(dbCommon *record, format_t *format)
|
||||
{
|
||||
#ifdef DBR_INT64
|
||||
case DBF_INT64:
|
||||
lval = ((epicsInt64 *)aai->bptr)[nowd];
|
||||
lval = (long)((epicsInt64 *)aai->bptr)[nowd];
|
||||
break;
|
||||
case DBF_UINT64:
|
||||
lval = ((epicsUInt64 *)aai->bptr)[nowd];
|
||||
lval = (long)((epicsUInt64 *)aai->bptr)[nowd];
|
||||
break;
|
||||
#endif
|
||||
case DBF_LONG:
|
||||
|
@ -200,10 +200,10 @@ static long writeData(dbCommon *record, format_t *format)
|
||||
break;
|
||||
#ifdef DBR_INT64
|
||||
case DBF_INT64:
|
||||
dval = ((epicsInt64 *)aao->bptr)[nowd];
|
||||
dval = (double)((epicsInt64 *)aao->bptr)[nowd];
|
||||
break;
|
||||
case DBF_UINT64:
|
||||
dval = ((epicsUInt64 *)aao->bptr)[nowd];
|
||||
dval = (double)((epicsUInt64 *)aao->bptr)[nowd];
|
||||
break;
|
||||
#endif
|
||||
case DBF_LONG:
|
||||
@ -243,10 +243,10 @@ static long writeData(dbCommon *record, format_t *format)
|
||||
{
|
||||
#ifdef DBR_INT64
|
||||
case DBF_INT64:
|
||||
lval = ((epicsInt64 *)aao->bptr)[nowd];
|
||||
lval = (long)((epicsInt64 *)aao->bptr)[nowd];
|
||||
break;
|
||||
case DBF_UINT64:
|
||||
lval = ((epicsUInt64 *)aao->bptr)[nowd];
|
||||
lval = (long)((epicsUInt64 *)aao->bptr)[nowd];
|
||||
break;
|
||||
#endif
|
||||
case DBF_LONG:
|
||||
|
@ -73,7 +73,7 @@ static long readData(dbCommon *record, format_t *format)
|
||||
if (record->pact) return DO_NOT_CONVERT;
|
||||
/* In @init handler, no processing, enforce monitor updates. */
|
||||
ao->omod = ao->oval != val;
|
||||
ao->orbv = ao->oval = val;
|
||||
ao->orbv = (epicsInt32)(ao->oval = val);
|
||||
monitor_mask = recGblResetAlarms(record);
|
||||
if (!(fabs(ao->mlst - val) <= ao->mdel))
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ static long readData(dbCommon *record, format_t *format)
|
||||
{
|
||||
lsi->val[length] = 0;
|
||||
}
|
||||
lsi->len = length;
|
||||
lsi->len = (epicsUInt32)length;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ static long readData(dbCommon *record, format_t *format)
|
||||
{
|
||||
lso->val[length] = 0;
|
||||
}
|
||||
lso->len = length;
|
||||
lso->len = (epicsUInt32)length;
|
||||
if (record->pact) return OK;
|
||||
/* In @init handler, no processing, enforce monitor updates. */
|
||||
monitor_mask = recGblResetAlarms(record);
|
||||
|
@ -172,10 +172,10 @@ static long writeData(dbCommon *record, format_t *format)
|
||||
break;
|
||||
#ifdef DBR_INT64
|
||||
case DBF_INT64:
|
||||
dval = ((epicsInt64 *)wf->bptr)[nowd];
|
||||
dval = (double)((epicsInt64 *)wf->bptr)[nowd];
|
||||
break;
|
||||
case DBF_UINT64:
|
||||
dval = ((epicsUInt64 *)wf->bptr)[nowd];
|
||||
dval = (double)((epicsUInt64 *)wf->bptr)[nowd];
|
||||
break;
|
||||
#endif
|
||||
case DBF_LONG:
|
||||
@ -215,10 +215,10 @@ static long writeData(dbCommon *record, format_t *format)
|
||||
{
|
||||
#ifdef DBR_INT64
|
||||
case DBF_INT64:
|
||||
lval = ((epicsInt64 *)wf->bptr)[nowd];
|
||||
lval = (long)((epicsInt64 *)wf->bptr)[nowd];
|
||||
break;
|
||||
case DBF_UINT64:
|
||||
lval = ((epicsUInt64 *)wf->bptr)[nowd];
|
||||
lval = (long)((epicsUInt64 *)wf->bptr)[nowd];
|
||||
break;
|
||||
#endif
|
||||
case DBF_LONG:
|
||||
|
@ -22,29 +22,56 @@
|
||||
|
||||
use strict;
|
||||
|
||||
my $dir = "O.Common";
|
||||
my $versionfile = "StreamVersion.h";
|
||||
|
||||
my $version = `git describe --tags --dirty --match "[0-9]*"`
|
||||
or die "Cannot run git.\n";
|
||||
my ( $major, $minor, $patch, $dev, $date, $hash );
|
||||
|
||||
my ( $major, $minor, $patch, $dev );
|
||||
if (my $version = `git describe --tags --abbrev=0 --dirty --match "[0-9]*" 2>/dev/null`) {
|
||||
if ($version =~ m/(\d+)\.(\d+)\.(\d+)?(.*)?/) {
|
||||
$major = $1; $minor = $2; $patch = $3; $dev = $4;
|
||||
}
|
||||
if (`git log -1 --format="%H %ci"`=~ m/([[:xdigit:]]+) (.+)/) {
|
||||
$hash = $1; $date = $2;
|
||||
}
|
||||
}
|
||||
if (!$major) {
|
||||
if (open(my $fh, '<', '../../.VERSION')) {
|
||||
while (my $line = <$fh>) {
|
||||
if ($line =~ m/COMMIT: *([[:xdigit:]]+)/) {
|
||||
$hash = $1;
|
||||
}
|
||||
if ($line =~ m/REFS: .*tag: *(\d+)\.(\d+)\.?(\d+)?/) {
|
||||
$major = $1; $minor = $2; $patch = $3 or $patch = 0;
|
||||
}
|
||||
if ($line =~ m/DATE: *([-0-9:+ ]*)/) {
|
||||
$date = $1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print "neither git repo nor .VERSION file found\n";
|
||||
}
|
||||
}
|
||||
|
||||
$version =~ m/(\d+)\.(\d+)\.(\d+)?(.*)?/
|
||||
or die "Unexpected git tag format $version\n";
|
||||
|
||||
$major = $1; $minor=$2; $patch=$3; $dev=$4;
|
||||
|
||||
print << "EOF";
|
||||
/* Generated file $versionfile */
|
||||
open my $out, '>', @ARGV or die $!;
|
||||
print $out <<EOF;
|
||||
/* Generated file */
|
||||
|
||||
#ifndef StreamVersion_h
|
||||
#define StreamVersion_h
|
||||
|
||||
EOF
|
||||
if ($major) {
|
||||
print $out <<EOF;
|
||||
#define STREAM_MAJOR $major
|
||||
#define STREAM_MINOR $minor
|
||||
#define STREAM_PATCHLEVEL $patch
|
||||
#define STREAM_DEV "$dev"
|
||||
|
||||
#endif /* StreamVersion_h */
|
||||
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
|
||||
|
@ -32,6 +32,7 @@ if (@ARGV[0] eq "-3.13") {
|
||||
} else {
|
||||
print "variable(streamDebug, int)\n";
|
||||
print "variable(streamError, int)\n";
|
||||
print "variable(streamDebugColored, int)\n";
|
||||
print "registrar(streamRegistrar)\n";
|
||||
if ($asyn) { print "registrar(AsynDriverInterfaceRegistrar)\n"; }
|
||||
}
|
||||
|
@ -21,16 +21,8 @@
|
||||
# along with StreamDevice. If not, see https://www.gnu.org/licenses/.
|
||||
#########################################################################/
|
||||
|
||||
TOP = ../..
|
||||
ifneq ($(wildcard ../../configure),)
|
||||
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
|
||||
TOP= ..
|
||||
include $(TOP)/configure/CONFIG
|
||||
|
||||
PROD = streamApp
|
||||
DBD = streamApp.dbd
|
||||
@ -68,6 +60,10 @@ PROD_LIBS += sscan
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(words $(SNCSEQ) $(SYNAPPS)), 0)
|
||||
PROD_LIBS += seq pv
|
||||
endif
|
||||
|
||||
streamApp_DBD += stream.dbd
|
||||
|
||||
ifdef PCRE
|
||||
|
@ -22,20 +22,20 @@
|
||||
record (stringout, "$(P):cmd")
|
||||
{
|
||||
field (DTYP, "stream")
|
||||
field (OUT, "@test.proto command terminal")
|
||||
field (OUT, "@test.proto command terminal")
|
||||
field (PRIO, "HIGH")
|
||||
field (VAL, "")
|
||||
}
|
||||
record (stringout, "$(P):info")
|
||||
{
|
||||
field (DTYP, "stream")
|
||||
field (OUT, "@test.proto info terminal")
|
||||
field (OUT, "@test.proto info terminal ")
|
||||
field (PRIO, "HIGH")
|
||||
}
|
||||
record (stringout, "$(P):request")
|
||||
{
|
||||
field (DTYP, "stream")
|
||||
field (OUT, "@test.proto request($(P):reply.VAL) terminal")
|
||||
field (OUT, "@test.proto request ($(P):reply.VAL) terminal")
|
||||
field (PRIO, "HIGH")
|
||||
}
|
||||
record (stringin, "$(P):reply")
|
||||
@ -44,7 +44,7 @@ record (stringin, "$(P):reply")
|
||||
record (stringout, "$(P):checksum")
|
||||
{
|
||||
field (DTYP, "stream")
|
||||
field (OUT, "@test.proto checksum($(CHKSUM=sum)) terminal")
|
||||
field (OUT, "@test.proto checksum ($(CHKSUM=sum)) terminal")
|
||||
}
|
||||
record (stringin, "$(P):spy")
|
||||
{
|
||||
|
Reference in New Issue
Block a user