Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
9ef1653e73 | |||
d1d65344af | |||
a76adc31ab | |||
a2fcbc81c8 | |||
fa51c376c1 | |||
483530f053 | |||
8f34dd2c84 |
@ -86,10 +86,7 @@ streamReferences: ../CONFIG_STREAM
|
|||||||
|
|
||||||
# create stream.dbd from all RECORDTYPES
|
# create stream.dbd from all RECORDTYPES
|
||||||
$(COMMON_DIR)/$(LIBRARY_DEFAULT).dbd: ../CONFIG_STREAM
|
$(COMMON_DIR)/$(LIBRARY_DEFAULT).dbd: ../CONFIG_STREAM
|
||||||
$(PERL) ../makedbd.pl $(RECORDTYPES) > $@
|
$(PERL) ../makedbd.pl $(if $(ASYN),--with-asyn) $(if $(BASE_3_14),,-3.13) $(RECORDTYPES) > $@
|
||||||
ifdef ASYN
|
|
||||||
echo "registrar(AsynDriverInterfaceRegistrar)" >> $@
|
|
||||||
endif
|
|
||||||
|
|
||||||
$(LIBRARY_DEFAULT).dbd$(DEP): ../CONFIG_STREAM
|
$(LIBRARY_DEFAULT).dbd$(DEP): ../CONFIG_STREAM
|
||||||
echo $(LIBRARY_DEFAULT).dbd: $< > $@
|
echo $(LIBRARY_DEFAULT).dbd: $< > $@
|
||||||
|
@ -17,6 +17,11 @@
|
|||||||
* *
|
* *
|
||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
|
// Make sure that vsnprintf is available
|
||||||
|
#ifndef _BSD_SOURCE
|
||||||
|
#define _BSD_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "StreamBuffer.h"
|
#include "StreamBuffer.h"
|
||||||
#include "StreamError.h"
|
#include "StreamError.h"
|
||||||
|
|
||||||
@ -24,10 +29,47 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#if defined(__vxworks) || defined(vxWorks) || defined(_WIN32) || defined(__rtems__)
|
#ifdef vxWorks
|
||||||
// These systems have no vsnprintf
|
#include <version.h>
|
||||||
#define vsnprintf(p,l,f,v) vsprintf(p,f,v)
|
#ifndef _WRS_VXWORKS_MAJOR
|
||||||
#endif
|
// VxWorks 5 has no vsnprintf
|
||||||
|
// Implementation taken from EPICS 3.14
|
||||||
|
|
||||||
|
#include <vxWorks.h>
|
||||||
|
#include <fioLib.h>
|
||||||
|
|
||||||
|
struct outStr_s {
|
||||||
|
char *str;
|
||||||
|
int free;
|
||||||
|
};
|
||||||
|
|
||||||
|
static STATUS outRoutine(char *buffer, int nchars, int outarg) {
|
||||||
|
struct outStr_s *poutStr = (struct outStr_s *) outarg;
|
||||||
|
int free = poutStr->free;
|
||||||
|
int len;
|
||||||
|
|
||||||
|
if (free < 1) { /*let fioFormatV continue to count length*/
|
||||||
|
return OK;
|
||||||
|
} else if (free > 1) {
|
||||||
|
len = min(free-1, nchars);
|
||||||
|
strncpy(poutStr->str, buffer, len);
|
||||||
|
poutStr->str += len;
|
||||||
|
poutStr->free -= len;
|
||||||
|
}
|
||||||
|
/*make sure final string is null terminated*/
|
||||||
|
*poutStr->str = 0;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int vsnprintf(char *str, size_t size, const char *format, va_list ap) {
|
||||||
|
struct outStr_s outStr;
|
||||||
|
|
||||||
|
outStr.str = str;
|
||||||
|
outStr.free = size;
|
||||||
|
return fioFormatV(format, ap, (FUNCPTR)outRoutine, (int)&outStr);
|
||||||
|
}
|
||||||
|
#endif // ! _WRS_VXWORKS_MAJOR
|
||||||
|
#endif // vxWorks
|
||||||
|
|
||||||
#define P PRINTF_SIZE_T_PREFIX
|
#define P PRINTF_SIZE_T_PREFIX
|
||||||
|
|
||||||
@ -296,7 +338,7 @@ StreamBuffer StreamBuffer::expand(ssize_t start, ssize_t length) const
|
|||||||
{
|
{
|
||||||
c = buffer[i];
|
c = buffer[i];
|
||||||
if (c < 0x20 || c >= 0x7f)
|
if (c < 0x20 || c >= 0x7f)
|
||||||
result.print("\033[1m<%02x>\033[22m", c & 0xff);
|
result.print("\033[7m<%02x>\033[27m", c & 0xff);
|
||||||
else
|
else
|
||||||
result.append(c);
|
result.append(c);
|
||||||
}
|
}
|
||||||
@ -316,7 +358,7 @@ dump() const
|
|||||||
c = buffer[i];
|
c = buffer[i];
|
||||||
if (offs && i == offs) result.append("\033[0m");
|
if (offs && i == offs) result.append("\033[0m");
|
||||||
if (c < 0x20 || c >= 0x7f)
|
if (c < 0x20 || c >= 0x7f)
|
||||||
result.print("\033[1m<%02x>\033[22m", c & 0xff);
|
result.print("\033[7m<%02x>\033[27m", c & 0xff);
|
||||||
else
|
else
|
||||||
result.append(c);
|
result.append(c);
|
||||||
if (i == offs+len-1) result.append("\033[47m");
|
if (i == offs+len-1) result.append("\033[47m");
|
||||||
|
@ -18,6 +18,9 @@
|
|||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
#include "StreamError.h"
|
#include "StreamError.h"
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -39,6 +42,18 @@ FILE *StreamDebugFile = NULL;
|
|||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define localtime_r(timet,tm) localtime_s(tm,timet)
|
#define localtime_r(timet,tm) localtime_s(tm,timet)
|
||||||
|
|
||||||
|
/* 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;
|
||||||
|
}
|
||||||
|
static int s = win_console_init();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* You can globally change the printTimestamp function
|
/* You can globally change the printTimestamp function
|
||||||
@ -115,4 +130,3 @@ print(const char* fmt, ...)
|
|||||||
va_end(args);
|
va_end(args);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,14 @@
|
|||||||
if (@ARGV[0] == "-3.13") {
|
if (@ARGV[0] eq "--with-asyn") {
|
||||||
|
shift;
|
||||||
|
$asyn = 1;
|
||||||
|
}
|
||||||
|
if (@ARGV[0] eq "-3.13") {
|
||||||
shift;
|
shift;
|
||||||
} else {
|
} else {
|
||||||
print "variable(streamDebug, int)\n";
|
print "variable(streamDebug, int)\n";
|
||||||
print "variable(streamError, int)\n";
|
print "variable(streamError, int)\n";
|
||||||
print "registrar(streamRegistrar)\n";
|
print "registrar(streamRegistrar)\n";
|
||||||
|
if ($asyn) { print "registrar(AsynDriverInterfaceRegistrar)\n"; }
|
||||||
}
|
}
|
||||||
print "driver(stream)\n";
|
print "driver(stream)\n";
|
||||||
for (@ARGV) {
|
for (@ARGV) {
|
||||||
|
Reference in New Issue
Block a user