Merge Freddie Akeroyd's Windows fixes
This commit is contained in:
@ -28,6 +28,12 @@
|
||||
#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 */
|
||||
#include <stdint.h>
|
||||
#define PRIX32 "X"
|
||||
#define PRIu32 "u"
|
||||
#define PRIX8 "X"
|
||||
#define SCNx8 "hhx"
|
||||
#else
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <stdint.h>
|
||||
|
@ -37,28 +37,35 @@ _ENUM_CAST(type)
|
||||
|
||||
#define _NTH_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, N, ...) N
|
||||
|
||||
/*
|
||||
* we need to use _EXPAND below to work around a problem in Visual Studio 2010
|
||||
* where __VA_ARGS__ is treated as a single argument
|
||||
* See https://stackoverflow.com/questions/5134523/msvc-doesnt-expand-va-args-correctly
|
||||
*/
|
||||
#define _EXPAND( x ) x
|
||||
|
||||
#define _fe_0(_call, ...)
|
||||
#define _fe_1(_call, x) _call(x)
|
||||
#define _fe_2(_call, x, ...) _call(x) _fe_1(_call, __VA_ARGS__)
|
||||
#define _fe_3(_call, x, ...) _call(x) _fe_2(_call, __VA_ARGS__)
|
||||
#define _fe_4(_call, x, ...) _call(x) _fe_3(_call, __VA_ARGS__)
|
||||
#define _fe_5(_call, x, ...) _call(x) _fe_4(_call, __VA_ARGS__)
|
||||
#define _fe_6(_call, x, ...) _call(x) _fe_5(_call, __VA_ARGS__)
|
||||
#define _fe_7(_call, x, ...) _call(x) _fe_6(_call, __VA_ARGS__)
|
||||
#define _fe_8(_call, x, ...) _call(x) _fe_7(_call, __VA_ARGS__)
|
||||
#define _fe_9(_call, x, ...) _call(x) _fe_8(_call, __VA_ARGS__)
|
||||
#define _fe_10(_call, x, ...) _call(x) _fe_9(_call, __VA_ARGS__)
|
||||
#define _fe_2(_call, x, ...) _call(x) _EXPAND(_fe_1(_call, __VA_ARGS__))
|
||||
#define _fe_3(_call, x, ...) _call(x) _EXPAND(_fe_2(_call, __VA_ARGS__))
|
||||
#define _fe_4(_call, x, ...) _call(x) _EXPAND(_fe_3(_call, __VA_ARGS__))
|
||||
#define _fe_5(_call, x, ...) _call(x) _EXPAND(_fe_4(_call, __VA_ARGS__))
|
||||
#define _fe_6(_call, x, ...) _call(x) _EXPAND(_fe_5(_call, __VA_ARGS__))
|
||||
#define _fe_7(_call, x, ...) _call(x) _EXPAND(_fe_6(_call, __VA_ARGS__))
|
||||
#define _fe_8(_call, x, ...) _call(x) _EXPAND(_fe_7(_call, __VA_ARGS__))
|
||||
#define _fe_9(_call, x, ...) _call(x) _EXPAND(_fe_8(_call, __VA_ARGS__))
|
||||
#define _fe_10(_call, x, ...) _call(x) _EXPAND(_fe_9(_call, __VA_ARGS__))
|
||||
|
||||
#define MACRO_FOR_EACH(x, ...) \
|
||||
_NTH_ARG(_, ##__VA_ARGS__, \
|
||||
_EXPAND(_NTH_ARG(_, ##__VA_ARGS__, \
|
||||
_fe_10, _fe_9, _fe_8, _fe_7, _fe_6, _fe_5, _fe_4, _fe_3, _fe_2, _fe_1, _fe_0) \
|
||||
(x, ##__VA_ARGS__)
|
||||
(x, ##__VA_ARGS__))
|
||||
|
||||
/* Enum to string magic */
|
||||
|
||||
#define ENUM(type,...) \
|
||||
enum type { __VA_ARGS__ }; \
|
||||
static inline const char* type##ToStr(int x) {switch(x){MACRO_FOR_EACH(_CASE_LINE,__VA_ARGS__) default: return "invalid";}} \
|
||||
static inline const char* type##ToStr(int x) {switch(x){_EXPAND(MACRO_FOR_EACH(_CASE_LINE,__VA_ARGS__)) default: return "invalid";}} \
|
||||
_ENUM_CAST(type)
|
||||
#endif
|
||||
|
||||
|
@ -110,7 +110,7 @@ endif
|
||||
|
||||
# create stream.dbd for all record types
|
||||
$(COMMON_DIR)/$(LIBRARY_DEFAULT).dbd: $(addprefix $(COMMON_DIR)/, $(STREAM_DBD_FILES))
|
||||
cat $? > $@
|
||||
$(CAT) $? > $@
|
||||
|
||||
$(LIBRARY_DEFAULT).dbd$(DEP):
|
||||
echo "$(LIBRARY_DEFAULT).dbd: $(STREAM_DBD_FILES)" > $@
|
||||
|
@ -85,6 +85,8 @@ extern "C" epicsShareFunc int epicsShareAPI iocshCmd(const char *command);
|
||||
#include <sysSymTbl.h>
|
||||
#endif
|
||||
|
||||
#include "epicsExport.h"
|
||||
|
||||
#include "devStream.h"
|
||||
|
||||
#define Z PRINTF_SIZE_T_PREFIX
|
||||
|
@ -43,6 +43,11 @@ FILE *StreamDebugFile = NULL;
|
||||
#ifdef _WIN32
|
||||
#define localtime_r(timet,tm) localtime_s(tm,timet)
|
||||
|
||||
/* this may not be defined if using older Windows SDKs */
|
||||
#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
|
||||
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
|
||||
#endif
|
||||
|
||||
/* Enable ANSI colors in Windows console */
|
||||
static int win_console_init() {
|
||||
DWORD dwMode = 0;
|
||||
|
@ -52,6 +52,7 @@ extern "C" {
|
||||
#ifdef epicsExportSharedSymbols
|
||||
# define devStream_epicsExportSharedSymbols
|
||||
# undef epicsExportSharedSymbols
|
||||
# include <shareLib.h>
|
||||
#endif
|
||||
|
||||
#include "dbCommon.h"
|
||||
@ -65,7 +66,9 @@ extern "C" {
|
||||
#include "epicsMath.h"
|
||||
|
||||
#ifdef devStream_epicsExportSharedSymbols
|
||||
# undef devStream_epicsExportSharedSymbols
|
||||
# define epicsExportSharedSymbols
|
||||
# include <shareLib.h>
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
Reference in New Issue
Block a user