Compare commits

..

4 Commits

Author SHA1 Message Date
22deae23e5 change quotes for Windows 2020-05-15 16:42:27 +02:00
7f22d5bdc6 generate version file from git tag 2020-05-07 11:08:20 +02:00
e4087a9244 cleanup whitespace 2020-05-05 13:58:44 +02:00
cede631c8d fix bug affecting EPICS 7 introduced in commit 8000f41 2020-05-04 09:39:32 +02:00
14 changed files with 127 additions and 49 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ dbd
include
*.pdf
*.*log
StreamVersion.h

View File

@ -19,18 +19,25 @@ SOURCES += $(FORMATS:%=src/%Converter.cc)
SOURCES += $(BUSSES:%=src/%Interface.cc)
SOURCES += $(STREAM_SRCS:%=src/%)
HEADERS += devStream.h
HEADERS += StreamFormat.h
HEADERS += StreamFormatConverter.h
HEADERS += StreamBuffer.h
HEADERS += StreamError.h
HEADERS += src/devStream.h
HEADERS += src/StreamFormat.h
HEADERS += src/StreamFormatConverter.h
HEADERS += src/StreamBuffer.h
HEADERS += src/StreamError.h
HEADERS += src/StreamVersion.h
StreamCore.o StreamCore.d: streamReferences
CPPFLAGS += -DSTREAM_INTERNAL
# Update version string (contains __DATE__ and __TIME__)
# each time anything changes.
StreamVersion.o: $(filter-out StreamVersion.o stream_exportAddress.o,$(LIBOBJS))
# each time anything changed.
StreamVersion$(OBJ): 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 > $@
StreamCore$(OBJ) StreamCore$(DEP): streamReferences
streamReferences:
$(PERL) ../src/makeref.pl Interface $(BUSSES) > $@
$(PERL) ../src/makeref.pl Converter $(FORMATS) >> $@

View File

@ -51,7 +51,7 @@ endif
ifeq ($(LOADABLE_MODULE),YES)
SRCS += $(LIBRARY_DEFAULT)_registerRecordDeviceDriver.cpp
endif
endif
SRCS += $(BUSSES:%=%Interface.cc)
SRCS += $(FORMATS:%=%Converter.cc)
SRCS += $(RECORDTYPES:%=dev%Stream.c)
@ -74,14 +74,24 @@ endif
LIB_LIBS += $(EPICS_BASE_IOC_LIBS)
INC += devStream.h
INC += StreamFormat.h
INC += StreamFormatConverter.h
INC += StreamBuffer.h
INC += StreamError.h
INC += StreamVersion.h
# switch off annoying rset warnings in 3.16+
CPPFLAGS += -DUSE_TYPED_RSET
CPPFLAGS += -DSTREAM_INTERNAL
-include $(TOP)/configure/RULES
# Update version string whenever something changes
StreamVersion$(OBJ): $(filter-out StreamVersion.o,$(LIBOBJS)$(LIBRARY_OBJS))
# 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 > $@
# Add references to all registrars to main file to avoid
# missing initialization.

View File

@ -29,11 +29,4 @@ endif
include $(TOP)/config/CONFIG_APP
include ../CONFIG_STREAM
DBDNAME = stream.dbd
INC += devStream.h
include $(EPICS_BASE)/config/RULES.Host
# create stream.dbd from all RECORDTYPES
stream.dbd: ../CONFIG_STREAM
$(PERL) ../makedbd.pl -3.13 $(RECORDTYPES) > $@

View File

@ -42,17 +42,37 @@ SRCS.c += $(filter %.c,$(STREAM_SRCS:%=%../%))
LIBOBJS = $(patsubst ../%,%.o,$(basename $(SRCS.cc) $(SRCS.c)))
DBDNAME = stream.dbd
INC += devStream.h
INC += StreamFormat.h
INC += StreamFormatConverter.h
INC += StreamBuffer.h
INC += StreamError.h
INC += StreamVersion.h
include $(EPICS_BASE)/config/RULES.Vx
include ../../config/RULES.munch
DEPENDS: depends
-include DEPENDS
CPPFLAGS += -DSTREAM_INTERNAL
# Update version string whenever something changes
StreamVersion.o: ../*.c ../*.h ../*.cc ../CONFIG_STREAM
$(LIBNAME): StreamVersion.o
StreamVersion.o: StreamVersion.h $(filter-out StreamVersion.o,$(LIBOBJS)) ../CONFIG_STREAM
StreamVersion.h: $(SRCS.cc) $(SRCS.c) $(add-prefix ../,$(filter-out StreamVersion.h, $(INC)))
@echo Creating $@ from git tag
$(PERL) ../makeStreamVersion.pl > $@
StreamCore.o: streamReferences
streamReferences:
touch $@
# create stream.dbd from all RECORDTYPES
stream.dbd: ../CONFIG_STREAM
$(PERL) ../makedbd.pl -3.13 $(RECORDTYPES) > $@

View File

@ -79,15 +79,15 @@ printDouble(const StreamFormat& format, StreamBuffer& output, double value)
if (!(format.flags & alt_flag) ^ (endian == 4321))
{
// swap if byte orders differ
for (n = nbOfBytes-1; n >= 0; n--)
{
for (n = nbOfBytes-1; n >= 0; n--)
{
output.append(buffer.bytes[n]);
}
}
} else {
for (n = 0; n < nbOfBytes; n++)
{
for (n = 0; n < nbOfBytes; n++)
{
output.append(buffer.bytes[n]);
}
}
}
return true;
}
@ -116,15 +116,15 @@ scanDouble(const StreamFormat& format, const char* input, double& value)
if (!(format.flags & alt_flag) ^ (endian == 4321))
{
// swap if byte orders differ
for (n = nbOfBytes-1, i = 0; n >= 0; n--, i++)
{
for (n = nbOfBytes-1, i = 0; n >= 0; n--, i++)
{
buffer.bytes[n] = input[i];
}
}
} else {
for (n = 0; n < nbOfBytes; n++)
{
for (n = 0; n < nbOfBytes; n++)
{
buffer.bytes[n] = input[n];
}
}
}
if (nbOfBytes == 4)

View File

@ -1115,11 +1115,7 @@ getFieldAddress(const char* fieldname, StreamBuffer& address)
}
static const unsigned char dbfMapping[] =
#ifdef DBR_INT64
{0, DBF_UINT64, DBF_INT64, DBF_ENUM, DBF_DOUBLE, DBF_STRING};
#else
{0, DBF_ULONG, DBF_LONG, DBF_ENUM, DBF_DOUBLE, DBF_STRING};
#endif
bool Stream::
formatValue(const StreamFormat& format, const void* fieldaddress)

View File

@ -48,12 +48,12 @@ FILE *StreamDebugFile = NULL;
/* Enable ANSI colors in Windows console */
static int win_console_init() {
DWORD dwMode = 0;
DWORD dwMode = 0;
HANDLE hCons = GetStdHandle(STD_ERROR_HANDLE);
GetConsoleMode(hCons, &dwMode);
dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
SetConsoleMode(hCons, dwMode);
return 0;
GetConsoleMode(hCons, &dwMode);
dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
SetConsoleMode(hCons, dwMode);
return 0;
}
static int s = win_console_init();

View File

@ -20,7 +20,7 @@
* along with StreamDevice. If not, see https://www.gnu.org/licenses/.
*************************************************************************/
#include "devStream.h"
#include "StreamVersion.h"
#define STR2(x) #x
#define STR(x) STR2(x)
@ -28,4 +28,5 @@ const char StreamVersion [] =
"StreamDevice " STR(STREAM_MAJOR)
"." STR(STREAM_MINOR)
"." STR(STREAM_PATCHLEVEL)
STREAM_DEV
" built " __DATE__ " " __TIME__;

View File

@ -42,7 +42,7 @@ value can also be gained from tm_gmtoff of the tm-structure.
defined(__DragonFly__)
static int timezone_bsd=0;
#define timezone timezone_bsd
#define tzset() { struct tm tm; time_t timet; tzset(); time(&timet); \
#define tzset() { struct tm tm; time_t timet; tzset(); time(&timet); \
localtime_r(&timet, &tm); timezone=tm.tm_gmtoff; }
#endif

View File

@ -28,9 +28,9 @@
#include <string.h>
#include <sys/types.h>
#define STREAM_MAJOR 2
#define STREAM_MINOR 8
#define STREAM_PATCHLEVEL 12
#ifndef STREAM_INTERNAL
#include "StreamVersion.h"
#endif
#ifndef OK
#define OK 0

View File

@ -126,7 +126,7 @@ static long readData(dbCommon *record, format_t *format)
}
aai->nord = (long)length;
return OK;
}
}
default:
errlogSevPrintf(errlogFatal,
"readData %s: can't convert from string to %s\n",

View File

@ -52,16 +52,16 @@ static long readData(dbCommon *record, format_t *format)
break;
val += ao->roff;
if (ao->linr == menuConvertNO_CONVERSION) {
; /*do nothing*/
; /*do nothing*/
} else if ((ao->linr == menuConvertLINEAR)
#ifndef EPICS_3_13
|| (ao->linr == menuConvertSLOPE)
|| (ao->linr == menuConvertSLOPE)
#endif
) {
val = val * ao->eslo + ao->eoff;
} else {
if (cvtRawToEngBpt(&val, ao->linr, 0,
(void *)&ao->pbrk, &ao->lbrk) == ERROR) return ERROR;
(void *)&ao->pbrk, &ao->lbrk) == ERROR) return ERROR;
}
}
default:

50
src/makeStreamVersion.pl Normal file
View File

@ -0,0 +1,50 @@
##########################################################################
# This is a helper script for StreamDevice.
# It generates a version file from git tags.
#
# (C) 2020 Dirk Zimoch (dirk.zimoch@psi.ch)
#
# This file is part of StreamDevice.
#
# StreamDevice is free software: You can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# StreamDevice is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with StreamDevice. If not, see https://www.gnu.org/licenses/.
#########################################################################/
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 );
$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 */
#ifndef StreamVersion_h
#define StreamVersion_h
#define STREAM_MAJOR $major
#define STREAM_MINOR $minor
#define STREAM_PATCHLEVEL $patch
#define STREAM_DEV "$dev"
#endif /* StreamVersion_h */
EOF