diff --git a/.gitignore b/.gitignore index 13fecc0..6c38e62 100644 --- a/.gitignore +++ b/.gitignore @@ -18,11 +18,16 @@ *.tmp *.log *.chm +*.log +*.csv +*.html *.zip *.tar.gz *.avrsuo +*.vcxproj.user version-* +.vs/ html/ latex/ test_priv/ diff --git a/qcalc/README.md b/qcalc/README.md index 0a1171b..94d3ccb 100644 --- a/qcalc/README.md +++ b/qcalc/README.md @@ -14,21 +14,22 @@ for Windows and is typically included with other operating systems, such as Linux and MacOS. -Usage without Installation -========================== +Installation +============ The `qcalc.py` script can be used standalone, **without** any installation (see Using "qcalc" below). -Installing with `pip` -===================== -You can **install** `qcalc.py` with the standard `pip` package manager -from [PyPi package index](https://pypi.org) by executing the following command: +Alternatively, you can **install** `qcalc.py` with `pip` from PyPi by +executing the following command: + `pip install qcalc` + Or directly from the sources directory (e.g., `/qp/qtools/qcalc`): -`pip install /qp/qtools/qcalc/qcalc.tar.gz` + +`python setup.py install --install-dir=/qp/qtools/qcalc` Using "qcalc" @@ -69,7 +70,7 @@ supports all mathematical functions (`sin()`, `cos()`, `tan()`, - `((0xBEEF << 16) | 1280) & ~0xFF` -- binary operators, mixed hex and decimal numbers -- `($1011 << 24) | (1280 >> 8) ^ 0xFFF0` -- mixed binary, dec and hex numbers +- `($1011 << 24) | (1280 >> 8) ^ 0xFFF0` -- mixed @ref qcalc_bin "binary", dec and hex numbers - `(1234 % 55) + 4321//33` -- remainder, integer division (note the `//` integer division operator - `pi/6` -- pi-constant - `pow(sin(ans),2) + pow(cos(ans),2)` -- scientific floating-point calculations, **ans-variable** @@ -116,8 +117,8 @@ The ans Variable "qcalc" stores the result of the last computation in the `ans` variable. Here are some examples of expressions with the `ans` variable: -- `1/ans` -- find the inverse of the last computation -- `log(ans)/log(2)` -- find log-base-2 of the last computation +- `1/ans` -- find the inverse of the last computation@n +- `log(ans)/log(2)` -- find log-base-2 of the last computation@n 64-bit Range @@ -169,3 +170,5 @@ More information about the QTools collection is available online at: - https://www.state-machine.com/qtools/ + + diff --git a/qspy/include/pal.h b/qspy/include/pal.h index 626cb3f..f0ea219 100644 --- a/qspy/include/pal.h +++ b/qspy/include/pal.h @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2023-12-12 -* @version Last updated for version: 7.3.1 +* @date Last updated on: 2024-06-21 +* @version Last updated for version: 7.4.0 * * @file * @brief Platform Abstraction Layer (PAL) @@ -94,7 +94,7 @@ void PAL_updateReadySet(int targetConn); #define Q_ASSERT(test_) ((test_) \ ? (void)0 : Q_onError(__FILE__, __LINE__)) -void Q_onError(char const * const module, int const id); +_Noreturn void Q_onError(char const * const module, int const id); #endif #endif /* PAL_H_ */ diff --git a/qspy/include/qspy.h b/qspy/include/qspy.h index 3be3f93..24d8532 100644 --- a/qspy/include/qspy.h +++ b/qspy/include/qspy.h @@ -28,8 +28,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2024-02-16 -* @version Last updated for version: 7.3.3 +* @date Last updated on: 2024-06-21 +* @version Last updated for version: 7.4.0 * * @file * @brief Host API @@ -37,7 +37,7 @@ #ifndef QSPY_H_ #define QSPY_H_ -#define QSPY_VER "7.3.3" +#define QSPY_VER "7.4.0" #ifdef __cplusplus extern "C" { @@ -333,7 +333,7 @@ char const* QSPY_getMatDict(char const* s); void QSEQ_configFile(void *seqFile); bool QSEQ_isActive(void); -void QSEQ_config(void* seqFile, const char* seqList); +void QSEQ_config(void* seqFile, char const* seqList); void QSEQ_updateDictionary(char const* name, KeyType key); int QSEQ_find(KeyType key); void QSEQ_genHeader(void); diff --git a/qspy/include/safe_std.h b/qspy/include/safe_std.h index c752662..3aba5e5 100644 --- a/qspy/include/safe_std.h +++ b/qspy/include/safe_std.h @@ -22,8 +22,8 @@ // // //============================================================================ -//! @date Last updated on: 2022-07-30 -//! @version Last updated for: @ref qpc_7_1_3 +//! @date Last updated on: 2024-06-21 +//! @version Last updated for: @ref qtools_7_4_0 //! //! @file //! @brief "safe" and facilities @@ -37,29 +37,29 @@ #ifdef _WIN32 // Windows OS? #define MEMMOVE_S(dest_, num_, src_, count_) \ - memmove_s(dest_, num_, src_, count_) + (void)memmove_s(dest_, num_, src_, count_) #define STRNCPY_S(dest_, destsiz_, src_) \ - strncpy_s(dest_, destsiz_, src_, _TRUNCATE) + (void)strncpy_s(dest_, destsiz_, src_, _TRUNCATE) #define STRCAT_S(dest_, destsiz_, src_) \ - strcat_s(dest_, destsiz_, src_) + (void)strcat_s(dest_, destsiz_, src_) #define SNPRINTF_S(buf_, bufsiz_, format_, ...) \ _snprintf_s(buf_, bufsiz_, _TRUNCATE, format_, __VA_ARGS__) #define PRINTF_S(format_, ...) \ - printf_s(format_, __VA_ARGS__) + (void)printf_s(format_, __VA_ARGS__) #define FPRINTF_S(fp_, format_, ...) \ - fprintf_s(fp_, format_, __VA_ARGS__) + (void)fprintf_s(fp_, format_, __VA_ARGS__) #ifdef _MSC_VER #define FREAD_S(buf_, bufsiz_, elsiz_, count_, fp_) \ fread_s(buf_, bufsiz_, elsiz_, count_, fp_) #else #define FREAD_S(buf_, bufsiz_, elsiz_, count_, fp_) \ - fread(buf_, elsiz_, count_, fp_) + (void)fread(buf_, elsiz_, count_, fp_) #endif // _MSC_VER #define FOPEN_S(fp_, fName_, mode_) \ @@ -73,24 +73,24 @@ if (fopen_s(&fp_, fName_, mode_) != 0) { \ #else // other OS (Linux, MacOS, etc.) ..................................... #define MEMMOVE_S(dest_, num_, src_, count_) \ - memmove(dest_, src_, count_) + (void)memmove(dest_, src_, count_) #define STRNCPY_S(dest_, destsiz_, src_) do { \ - strncpy(dest_, src_, destsiz_); \ + (void)strncpy(dest_, src_, destsiz_); \ dest_[(destsiz_) - 1] = '\0'; \ } while (false) #define STRCAT_S(dest_, destsiz_, src_) \ - strcat(dest_, src_) + (void)strcat(dest_, src_) #define SNPRINTF_S(buf_, bufsiz_, format_, ...) \ snprintf(buf_, bufsiz_, format_, __VA_ARGS__) #define PRINTF_S(format_, ...) \ - printf(format_, __VA_ARGS__) + (void)printf(format_, __VA_ARGS__) #define FPRINTF_S(fp_, format_, ...) \ - fprintf(fp_, format_, __VA_ARGS__) + (void)fprintf(fp_, format_, __VA_ARGS__) #define FREAD_S(buf_, bufsiz_, elsiz_, count_, fp_) \ fread(buf_, elsiz_, count_, fp_) diff --git a/qspy/lint-plus/32bit/cpu.lnt b/qspy/lint-plus/32bit/cpu.lnt new file mode 100644 index 0000000..dbfc69e --- /dev/null +++ b/qspy/lint-plus/32bit/cpu.lnt @@ -0,0 +1,3 @@ +// Size Options for 32bit CPU (e.g., ARM Cortex-M) +-si8 -sl8 -sll8 -ss2 -sw8 -sp8 -sf8 -sd8 -sld8 + diff --git a/qspy/lint-plus/64bit/cpu.lnt b/qspy/lint-plus/64bit/cpu.lnt new file mode 100644 index 0000000..9281e89 --- /dev/null +++ b/qspy/lint-plus/64bit/cpu.lnt @@ -0,0 +1,3 @@ +// Size Options for 32bit CPU (e.g., ARM Cortex-M) +-si4 -sl4 -sll8 -ss2 -sw4 -sp4 -sf4 -sd8 -sld8 + diff --git a/qspy/lint-plus/au-ds.lnt b/qspy/lint-plus/au-ds.lnt new file mode 100644 index 0000000..38fcd67 --- /dev/null +++ b/qspy/lint-plus/au-ds.lnt @@ -0,0 +1,21 @@ +// au-ds.lnt -- Author options - Dan Saks + +/* + This options file can be used to explicitly activate those + checks advocated by Dan Saks in his series of presentations on + "C++ Gotchas". + + You can use this file directly when linting your programs as in: + + lin au-ds files + + */ + ++fsc // consider string constants as const char * ++e1933 // turn on "virtual call from member detection" + +// The rationale for the following two options are fully described +// in Dan Saks' article "const T vs. T const". Visit his web site +// at www.dansaks.com and click "Published Articles". +// +-fqb +e963 // require T const rather than const T diff --git a/qspy/lint-plus/co-gcc.h b/qspy/lint-plus/co-gcc.h new file mode 100644 index 0000000..c528983 --- /dev/null +++ b/qspy/lint-plus/co-gcc.h @@ -0,0 +1,757 @@ +#ifndef VECTOR_INFORMATIK_PCLP_CO_GCC_H +#define VECTOR_INFORMATIK_PCLP_CO_GCC_H +/* Compiler predefined macros for 'gcc' version '9.2.0'. + Using the options: + C specific options: + C++ specific options: + Generated on 2024-06-21 at 11:05:34 with pclp_config version '2.0' and database version '2.0'. + */ + +/* C macros */ +#ifndef __cplusplus +#define __DBL_MIN_EXP__ (-1021) +#define __FLT32X_MAX_EXP__ 1024 +#define __pentiumpro__ 1 +#define __UINT_LEAST16_MAX__ 0xffff +#define __ATOMIC_ACQUIRE 2 +#define __FLT128_MAX_10_EXP__ 4932 +#define __FLT_MIN__ 1.17549435082228750796873653722224568e-38F +#define __GCC_IEC_559_COMPLEX 2 +#define __UINT_LEAST8_TYPE__ unsigned char +#define __SIZEOF_FLOAT80__ 12 +#define _WIN32 1 +#define __INTMAX_C(c) c ## LL +#define __CHAR_BIT__ 8 +#define __UINT8_MAX__ 0xff +#define __WINT_MAX__ 0xffff +#define __FLT32_MIN_EXP__ (-125) +#define __ORDER_LITTLE_ENDIAN__ 1234 +#define __SIZE_MAX__ 0xffffffffU +#define __WCHAR_MAX__ 0xffff +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 +#define __DBL_DENORM_MIN__ ((double)4.94065645841246544176568792868221372e-324L) +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1 +#define __GCC_ATOMIC_CHAR_LOCK_FREE 2 +#define __GCC_IEC_559 2 +#define __FLT32X_DECIMAL_DIG__ 17 +#define __FLT_EVAL_METHOD__ 2 +#define __FLT64_DECIMAL_DIG__ 17 +#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2 +#define __UINT_FAST64_MAX__ 0xffffffffffffffffULL +#define __SIG_ATOMIC_TYPE__ int +#define __DBL_MIN_10_EXP__ (-307) +#define __FINITE_MATH_ONLY__ 0 +#define __GNUC_PATCHLEVEL__ 0 +#define __FLT32_HAS_DENORM__ 1 +#define __UINT_FAST8_MAX__ 0xff +#define _stdcall __attribute__((__stdcall__)) +#define __DEC64_MAX_EXP__ 385 +#define __INT8_C(c) c +#define __INT_LEAST8_WIDTH__ 8 +#define __UINT_LEAST64_MAX__ 0xffffffffffffffffULL +#define __SHRT_MAX__ 0x7fff +#define __LDBL_MAX__ 1.18973149535723176502126385303097021e+4932L +#define __FLT64X_MAX_10_EXP__ 4932 +#define __UINT_LEAST8_MAX__ 0xff +#define __GCC_ATOMIC_BOOL_LOCK_FREE 2 +#define __FLT128_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966F128 +#define __UINTMAX_TYPE__ long long unsigned int +#define __DEC32_EPSILON__ 1E-6DF +#define __FLT_EVAL_METHOD_TS_18661_3__ 2 +#define __UINT32_MAX__ 0xffffffffU +#define __LDBL_MAX_EXP__ 16384 +#define __FLT128_MIN_EXP__ (-16381) +#define __WINT_MIN__ 0 +#define __FLT128_MIN_10_EXP__ (-4931) +#define __INT_LEAST16_WIDTH__ 16 +#define __SCHAR_MAX__ 0x7f +#define __FLT128_MANT_DIG__ 113 +#define __WCHAR_MIN__ 0 +#define __INT64_C(c) c ## LL +#define __DBL_DIG__ 15 +#define __GCC_ATOMIC_POINTER_LOCK_FREE 2 +#define __FLT64X_MANT_DIG__ 64 +#define __SIZEOF_INT__ 4 +#define __SIZEOF_POINTER__ 4 +#define __USER_LABEL_PREFIX__ _ +#define __FLT64X_EPSILON__ 1.08420217248550443400745280086994171e-19F64x +#define __STDC_HOSTED__ 1 +#define __WIN32 1 +#define __LDBL_HAS_INFINITY__ 1 +#define __FLT32_DIG__ 6 +#define __FLT_EPSILON__ 1.19209289550781250000000000000000000e-7F +#define __SHRT_WIDTH__ 16 +#define __LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L +#define __STDC_UTF_16__ 1 +#define __DEC32_MAX__ 9.999999E96DF +#define __FLT64X_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951F64x +#define __MINGW32__ 1 +#define __FLT32X_HAS_INFINITY__ 1 +#define __INT32_MAX__ 0x7fffffff +#define __INT_WIDTH__ 32 +#define __SIZEOF_LONG__ 4 +#define __UINT16_C(c) c +#define __PTRDIFF_WIDTH__ 32 +#define __DECIMAL_DIG__ 21 +#define __FLT64_EPSILON__ 2.22044604925031308084726333618164062e-16F64 +#define __INTMAX_WIDTH__ 64 +#define __FLT64X_MIN_10_EXP__ (-4931) +#define __LDBL_HAS_QUIET_NAN__ 1 +#define __FLT64_MANT_DIG__ 53 +#define _REENTRANT 1 +#define __GNUC__ 9 +#define _cdecl __attribute__((__cdecl__)) +#define __FLT_HAS_DENORM__ 1 +#define __SIZEOF_LONG_DOUBLE__ 12 +#define __BIGGEST_ALIGNMENT__ 16 +#define __FLT64_MAX_10_EXP__ 308 +#define __i686 1 +#define __DBL_MAX__ ((double)1.79769313486231570814527423731704357e+308L) +#define _thiscall __attribute__((__thiscall__)) +#define __INT_FAST32_MAX__ 0x7fffffff +#define __WINNT 1 +#define __DBL_HAS_INFINITY__ 1 +#define __WINNT__ 1 +#define __HAVE_SPECULATION_SAFE_VALUE 1 +#define __DEC32_MIN_EXP__ (-94) +#define __INTPTR_WIDTH__ 32 +#define __FLT32X_HAS_DENORM__ 1 +#define __INT_FAST16_TYPE__ short int +#define _fastcall __attribute__((__fastcall__)) +#define __LDBL_HAS_DENORM__ 1 +#define __FLT128_HAS_INFINITY__ 1 +#define __DEC128_MAX__ 9.999999999999999999999999999999999E6144DL +#define __INT_LEAST32_MAX__ 0x7fffffff +#define __DEC32_MIN__ 1E-95DF +#define __DBL_MAX_EXP__ 1024 +#define __WCHAR_WIDTH__ 16 +#define __FLT32_MAX__ 3.40282346638528859811704183484516925e+38F32 +#define __DEC128_EPSILON__ 1E-33DL +#define __ATOMIC_HLE_RELEASE 131072 +#define __WIN32__ 1 +#define __PTRDIFF_MAX__ 0x7fffffff +#define __ATOMIC_HLE_ACQUIRE 65536 +#define __FLT32_HAS_QUIET_NAN__ 1 +#define __LONG_LONG_MAX__ 0x7fffffffffffffffLL +#define __SIZEOF_SIZE_T__ 4 +#define __FLT64X_MIN_EXP__ (-16381) +#define __SIZEOF_WINT_T__ 2 +#define __LONG_LONG_WIDTH__ 64 +#define __FLT32_MAX_EXP__ 128 +#define __GCC_HAVE_DWARF2_CFI_ASM 1 +#define __GXX_ABI_VERSION 1013 +#define __FLT_MIN_EXP__ (-125) +#define __i686__ 1 +#define __FLT64X_HAS_QUIET_NAN__ 1 +#define __INT_FAST64_TYPE__ long long int +#define __FLT64_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F64 +#define __DBL_MIN__ ((double)2.22507385850720138309023271733240406e-308L) +#define __FLT32X_EPSILON__ 2.22044604925031308084726333618164062e-16F32x +#define __DECIMAL_BID_FORMAT__ 1 +#define __FLT64_MIN_EXP__ (-1021) +#define __GXX_TYPEINFO_EQUALITY_INLINE 0 +#define __FLT64_MIN_10_EXP__ (-307) +#define __FLT64X_DECIMAL_DIG__ 21 +#define __DEC128_MIN__ 1E-6143DL +#define __REGISTER_PREFIX__ +#define __UINT16_MAX__ 0xffff +#define __DBL_HAS_DENORM__ 1 +#define __cdecl __attribute__((__cdecl__)) +#define __FLT32_MIN__ 1.17549435082228750796873653722224568e-38F32 +#define __UINT8_TYPE__ unsigned char +#define __NO_INLINE__ 1 +#define __i386 1 +#define __FLT_MANT_DIG__ 24 +#define __LDBL_DECIMAL_DIG__ 21 +#define __VERSION__ "9.2.0" +#define __UINT64_C(c) c ## ULL +#define __GCC_ATOMIC_INT_LOCK_FREE 2 +#define __FLT128_MAX_EXP__ 16384 +#define __FLT32_MANT_DIG__ 24 +#define _X86_ 1 +#define __FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__ +#define __FLT128_HAS_DENORM__ 1 +#define __FLT128_DIG__ 33 +#define __SCHAR_WIDTH__ 8 +#define __INT32_C(c) c +#define __DEC64_EPSILON__ 1E-15DD +#define __ORDER_PDP_ENDIAN__ 3412 +#define __DEC128_MIN_EXP__ (-6142) +#define __code_model_32__ 1 +#define __FLT32_MAX_10_EXP__ 38 +#define __INT_FAST32_TYPE__ int +#define __UINT_LEAST16_TYPE__ short unsigned int +#define __FLT64X_HAS_INFINITY__ 1 +#define __INT16_MAX__ 0x7fff +#define __i386__ 1 +#define __SIZE_TYPE__ unsigned int +#define __UINT64_MAX__ 0xffffffffffffffffULL +#define __FLT64X_DIG__ 18 +#define __INT8_TYPE__ signed char +#define __GCC_ASM_FLAG_OUTPUTS__ 1 +#define __FLT_RADIX__ 2 +#define __INT_LEAST16_TYPE__ short int +#define __LDBL_EPSILON__ 1.08420217248550443400745280086994171e-19L +#define __UINTMAX_C(c) c ## ULL +#define __SIG_ATOMIC_MAX__ 0x7fffffff +#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2 +#define __SIZEOF_PTRDIFF_T__ 4 +#define __FLT32X_MANT_DIG__ 53 +#define __FLT32X_MIN_EXP__ (-1021) +#define __DEC32_SUBNORMAL_MIN__ 0.000001E-95DF +#define __pentiumpro 1 +#define __MSVCRT__ 1 +#define __INT_FAST16_MAX__ 0x7fff +#define __FLT64_DIG__ 15 +#define __UINT_FAST32_MAX__ 0xffffffffU +#define __UINT_LEAST64_TYPE__ long long unsigned int +#define __FLT_HAS_QUIET_NAN__ 1 +#define __FLT_MAX_10_EXP__ 38 +#define __LONG_MAX__ 0x7fffffffL +#define __FLT64X_HAS_DENORM__ 1 +#define __DEC128_SUBNORMAL_MIN__ 0.000000000000000000000000000000001E-6143DL +#define __FLT_HAS_INFINITY__ 1 +#define __UINT_FAST16_TYPE__ short unsigned int +#define __DEC64_MAX__ 9.999999999999999E384DD +#define __INT_FAST32_WIDTH__ 32 +#define __CHAR16_TYPE__ short unsigned int +#define __PRAGMA_REDEFINE_EXTNAME 1 +#define __SIZE_WIDTH__ 32 +#define __SEG_FS 1 +#define __INT_LEAST16_MAX__ 0x7fff +#define __DEC64_MANT_DIG__ 16 +#define __INT64_MAX__ 0x7fffffffffffffffLL +#define __UINT_LEAST32_MAX__ 0xffffffffU +#define __SEG_GS 1 +#define __FLT32_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F32 +#define __GCC_ATOMIC_LONG_LOCK_FREE 2 +#define __SIG_ATOMIC_WIDTH__ 32 +#define __INT_LEAST64_TYPE__ long long int +#define __INT16_TYPE__ short int +#define __INT_LEAST8_TYPE__ signed char +#define __STDC_VERSION__ 201710L +#define __DEC32_MAX_EXP__ 97 +#define __INT_FAST8_MAX__ 0x7f +#define __FLT128_MAX__ 1.18973149535723176508575932662800702e+4932F128 +#define __INTPTR_MAX__ 0x7fffffff +#define __GXX_MERGED_TYPEINFO_NAMES 0 +#define __FLT64_HAS_QUIET_NAN__ 1 +#define __stdcall __attribute__((__stdcall__)) +#define __FLT32_MIN_10_EXP__ (-37) +#define __FLT32X_DIG__ 15 +#define __LDBL_MANT_DIG__ 64 +#define __DBL_HAS_QUIET_NAN__ 1 +#define __FLT64_HAS_INFINITY__ 1 +#define __FLT64X_MAX__ 1.18973149535723176502126385303097021e+4932F64x +#define __SIG_ATOMIC_MIN__ (-__SIG_ATOMIC_MAX__ - 1) +#define __INTPTR_TYPE__ int +#define __UINT16_TYPE__ short unsigned int +#define __WCHAR_TYPE__ short unsigned int +#define __SIZEOF_FLOAT__ 4 +#define __UINTPTR_MAX__ 0xffffffffU +#define __INT_FAST64_WIDTH__ 64 +#define __DEC64_MIN_EXP__ (-382) +#define __FLT32_DECIMAL_DIG__ 9 +#define __INT_FAST64_MAX__ 0x7fffffffffffffffLL +#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1 +#define __FLT_DIG__ 6 +#define __FLT32_HAS_INFINITY__ 1 +#define __FLT64X_MAX_EXP__ 16384 +#define __UINT_FAST64_TYPE__ long long unsigned int +#define __INT_MAX__ 0x7fffffff +#define WIN32 1 +#define __INT64_TYPE__ long long int +#define __FLT_MAX_EXP__ 128 +#define __DBL_MANT_DIG__ 53 +#define __SIZEOF_FLOAT128__ 16 +#define __INT_LEAST64_MAX__ 0x7fffffffffffffffLL +#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2 +#define __DEC64_MIN__ 1E-383DD +#define __WINT_TYPE__ short unsigned int +#define __UINT_LEAST32_TYPE__ unsigned int +#define __SIZEOF_SHORT__ 2 +#define __LDBL_MIN_EXP__ (-16381) +#define __FLT64_MAX__ 1.79769313486231570814527423731704357e+308F64 +#define __WINT_WIDTH__ 16 +#define __INT_LEAST8_MAX__ 0x7f +#define __FLT32X_MAX_10_EXP__ 308 +#define __LDBL_MAX_10_EXP__ 4932 +#define __ATOMIC_RELAXED 0 +#define __DBL_EPSILON__ ((double)2.22044604925031308084726333618164062e-16L) +#define __thiscall __attribute__((__thiscall__)) +#define __FLT128_MIN__ 3.36210314311209350626267781732175260e-4932F128 +#define __UINT8_C(c) c +#define __FLT64_MAX_EXP__ 1024 +#define __INT_LEAST32_TYPE__ int +#define __SIZEOF_WCHAR_T__ 2 +#define __UINT64_TYPE__ long long unsigned int +#define __FLT128_HAS_QUIET_NAN__ 1 +#define __INT_FAST8_TYPE__ signed char +#define __fastcall __attribute__((__fastcall__)) +#define __FLT64X_MIN__ 3.36210314311209350626267781732175260e-4932F64x +#define __GNUC_STDC_INLINE__ 1 +#define __FLT64_HAS_DENORM__ 1 +#define __FLT32_EPSILON__ 1.19209289550781250000000000000000000e-7F32 +#define __DBL_DECIMAL_DIG__ 17 +#define __STDC_UTF_32__ 1 +#define __INT_FAST8_WIDTH__ 8 +#define __DEC_EVAL_METHOD__ 2 +#define __FLT32X_MAX__ 1.79769313486231570814527423731704357e+308F32x +#define __ORDER_BIG_ENDIAN__ 4321 +#define __UINT32_C(c) c ## U +#define __INTMAX_MAX__ 0x7fffffffffffffffLL +#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ +#define WINNT 1 +#define __FLT_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F +#define __INT8_MAX__ 0x7f +#define __LONG_WIDTH__ 32 +#define __UINT_FAST32_TYPE__ unsigned int +#define __CHAR32_TYPE__ unsigned int +#define __FLT_MAX__ 3.40282346638528859811704183484516925e+38F +#define __INT32_TYPE__ int +#define __SIZEOF_DOUBLE__ 8 +#define __FLT_MIN_10_EXP__ (-37) +#define __FLT64_MIN__ 2.22507385850720138309023271733240406e-308F64 +#define __INT_LEAST32_WIDTH__ 32 +#define __INTMAX_TYPE__ long long int +#define i386 1 +#define _INTEGRAL_MAX_BITS 64 +#define __DEC128_MAX_EXP__ 6145 +#define __FLT32X_HAS_QUIET_NAN__ 1 +#define __ATOMIC_CONSUME 1 +#define __GNUC_MINOR__ 2 +#define __INT_FAST16_WIDTH__ 16 +#define __UINTMAX_MAX__ 0xffffffffffffffffULL +#define __DEC32_MANT_DIG__ 7 +#define __FLT32X_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F32x +#define __DBL_MAX_10_EXP__ 308 +#define __LDBL_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951L +#define __INT16_C(c) c +#define __STDC__ 1 +#define __PTRDIFF_TYPE__ int +#define __ATOMIC_SEQ_CST 5 +#define __UINT32_TYPE__ unsigned int +#define __FLT32X_MIN_10_EXP__ (-307) +#define __UINTPTR_TYPE__ unsigned int +#define __DEC64_SUBNORMAL_MIN__ 0.000000000000001E-383DD +#define __DEC128_MANT_DIG__ 34 +#define __LDBL_MIN_10_EXP__ (-4931) +#define __FLT128_EPSILON__ 1.92592994438723585305597794258492732e-34F128 +#define __SIZEOF_LONG_LONG__ 8 +#define __FLT128_DECIMAL_DIG__ 36 +#define __GCC_ATOMIC_LLONG_LOCK_FREE 2 +#define __FLT32X_MIN__ 2.22507385850720138309023271733240406e-308F32x +#define __LDBL_DIG__ 18 +#define __FLT_DECIMAL_DIG__ 9 +#define __UINT_FAST16_MAX__ 0xffff +#define __GCC_ATOMIC_SHORT_LOCK_FREE 2 +#define __INT_LEAST64_WIDTH__ 64 +#define __UINT_FAST8_TYPE__ unsigned char +#define __ATOMIC_ACQ_REL 4 +#define __ATOMIC_RELEASE 3 +#define __declspec(x) __attribute__((x)) +#endif /* ifndef __cplusplus */ +/* End of C macros */ + +/* C++ macros */ +#ifdef __cplusplus +#define __DBL_MIN_EXP__ (-1021) +#define __FLT32X_MAX_EXP__ 1024 +#define __cpp_attributes 200809 +#define __pentiumpro__ 1 +#define __UINT_LEAST16_MAX__ 0xffff +#define __ATOMIC_ACQUIRE 2 +#define __FLT128_MAX_10_EXP__ 4932 +#define __FLT_MIN__ 1.17549435082228750796873653722224568e-38F +#define __GCC_IEC_559_COMPLEX 2 +#define __cpp_aggregate_nsdmi 201304 +#define __UINT_LEAST8_TYPE__ unsigned char +#define __SIZEOF_FLOAT80__ 12 +#define _WIN32 1 +#define __INTMAX_C(c) c ## LL +#define __CHAR_BIT__ 8 +#define __UINT8_MAX__ 0xff +#define __WINT_MAX__ 0xffff +#define __FLT32_MIN_EXP__ (-125) +#define __cpp_static_assert 200410 +#define __ORDER_LITTLE_ENDIAN__ 1234 +#define __SIZE_MAX__ 0xffffffffU +#define __WCHAR_MAX__ 0xffff +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 +#define __DBL_DENORM_MIN__ double(4.94065645841246544176568792868221372e-324L) +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1 +#define __GCC_ATOMIC_CHAR_LOCK_FREE 2 +#define __GCC_IEC_559 2 +#define __FLT32X_DECIMAL_DIG__ 17 +#define __FLT_EVAL_METHOD__ 2 +#define __cpp_binary_literals 201304 +#define __FLT64_DECIMAL_DIG__ 17 +#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2 +#define __cpp_variadic_templates 200704 +#define __UINT_FAST64_MAX__ 0xffffffffffffffffULL +#define __SIG_ATOMIC_TYPE__ int +#define __DBL_MIN_10_EXP__ (-307) +#define __FINITE_MATH_ONLY__ 0 +#define __cpp_variable_templates 201304 +#define __GNUC_PATCHLEVEL__ 0 +#define __FLT32_HAS_DENORM__ 1 +#define __UINT_FAST8_MAX__ 0xff +#define _stdcall __attribute__((__stdcall__)) +#define __DEC64_MAX_EXP__ 385 +#define __INT8_C(c) c +#define __INT_LEAST8_WIDTH__ 8 +#define __UINT_LEAST64_MAX__ 0xffffffffffffffffULL +#define __SHRT_MAX__ 0x7fff +#define __LDBL_MAX__ 1.18973149535723176502126385303097021e+4932L +#define __FLT64X_MAX_10_EXP__ 4932 +#define __UINT_LEAST8_MAX__ 0xff +#define __GCC_ATOMIC_BOOL_LOCK_FREE 2 +#define __FLT128_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966F128 +#define __UINTMAX_TYPE__ long long unsigned int +#define __DEC32_EPSILON__ 1E-6DF +#define __FLT_EVAL_METHOD_TS_18661_3__ 2 +#define __UINT32_MAX__ 0xffffffffU +#define __GXX_EXPERIMENTAL_CXX0X__ 1 +#define __LDBL_MAX_EXP__ 16384 +#define __FLT128_MIN_EXP__ (-16381) +#define __WINT_MIN__ 0 +#define __FLT128_MIN_10_EXP__ (-4931) +#define __INT_LEAST16_WIDTH__ 16 +#define __SCHAR_MAX__ 0x7f +#define __FLT128_MANT_DIG__ 113 +#define __WCHAR_MIN__ 0 +#define __INT64_C(c) c ## LL +#define __DBL_DIG__ 15 +#define __GCC_ATOMIC_POINTER_LOCK_FREE 2 +#define __FLT64X_MANT_DIG__ 64 +#define __SIZEOF_INT__ 4 +#define __SIZEOF_POINTER__ 4 +#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2 +#define __USER_LABEL_PREFIX__ _ +#define __FLT64X_EPSILON__ 1.08420217248550443400745280086994171e-19F64x +#define __STDC_HOSTED__ 1 +#define __WIN32 1 +#define __LDBL_HAS_INFINITY__ 1 +#define __FLT32_DIG__ 6 +#define __FLT_EPSILON__ 1.19209289550781250000000000000000000e-7F +#define __GXX_WEAK__ 1 +#define __SHRT_WIDTH__ 16 +#define __LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L +#define __DEC32_MAX__ 9.999999E96DF +#define __cpp_threadsafe_static_init 200806 +#define __FLT64X_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951F64x +#define __MINGW32__ 1 +#define __FLT32X_HAS_INFINITY__ 1 +#define __INT32_MAX__ 0x7fffffff +#define __INT_WIDTH__ 32 +#define __SIZEOF_LONG__ 4 +#define __UINT16_C(c) c +#define __PTRDIFF_WIDTH__ 32 +#define __DECIMAL_DIG__ 21 +#define __FLT64_EPSILON__ 2.22044604925031308084726333618164062e-16F64 +#define __INTMAX_WIDTH__ 64 +#define __FLT64_MIN_EXP__ (-1021) +#define __FLT64X_MIN_10_EXP__ (-4931) +#define __LDBL_HAS_QUIET_NAN__ 1 +#define __FLT64_MANT_DIG__ 53 +#define _REENTRANT 1 +#define __GNUC__ 9 +#define _cdecl __attribute__((__cdecl__)) +#define __GXX_RTTI 1 +#define __cpp_delegating_constructors 200604 +#define __FLT_HAS_DENORM__ 1 +#define __SIZEOF_LONG_DOUBLE__ 12 +#define __BIGGEST_ALIGNMENT__ 16 +#define __STDC_UTF_16__ 1 +#define __FLT64_MAX_10_EXP__ 308 +#define __i686 1 +#define __FLT32_HAS_INFINITY__ 1 +#define __DBL_MAX__ double(1.79769313486231570814527423731704357e+308L) +#define _thiscall __attribute__((__thiscall__)) +#define __cpp_raw_strings 200710 +#define __INT_FAST32_MAX__ 0x7fffffff +#define __WINNT 1 +#define __DBL_HAS_INFINITY__ 1 +#define __WINNT__ 1 +#define __HAVE_SPECULATION_SAFE_VALUE 1 +#define __DEC32_MIN_EXP__ (-94) +#define __INTPTR_WIDTH__ 32 +#define __FLT32X_HAS_DENORM__ 1 +#define __INT_FAST16_TYPE__ short int +#define _fastcall __attribute__((__fastcall__)) +#define __LDBL_HAS_DENORM__ 1 +#define __cpp_ref_qualifiers 200710 +#define __DEC128_MAX__ 9.999999999999999999999999999999999E6144DL +#define __INT_LEAST32_MAX__ 0x7fffffff +#define __DEC32_MIN__ 1E-95DF +#define __DEPRECATED 1 +#define __cpp_rvalue_references 200610 +#define __DBL_MAX_EXP__ 1024 +#define __WCHAR_WIDTH__ 16 +#define __FLT32_MAX__ 3.40282346638528859811704183484516925e+38F32 +#define __DEC128_EPSILON__ 1E-33DL +#define __ATOMIC_HLE_RELEASE 131072 +#define __WIN32__ 1 +#define __PTRDIFF_MAX__ 0x7fffffff +#define __ATOMIC_HLE_ACQUIRE 65536 +#define __FLT32_HAS_QUIET_NAN__ 1 +#define __GNUG__ 9 +#define __LONG_LONG_MAX__ 0x7fffffffffffffffLL +#define __SIZEOF_SIZE_T__ 4 +#define __cpp_nsdmi 200809 +#define __FLT64X_MIN_EXP__ (-16381) +#define __SIZEOF_WINT_T__ 2 +#define __LONG_LONG_WIDTH__ 64 +#define __cpp_initializer_lists 200806 +#define __FLT32_MAX_EXP__ 128 +#define __cpp_hex_float 201603 +#define __GCC_HAVE_DWARF2_CFI_ASM 1 +#define __GXX_ABI_VERSION 1013 +#define __FLT128_HAS_INFINITY__ 1 +#define __FLT_MIN_EXP__ (-125) +#define __i686__ 1 +#define __cpp_lambdas 200907 +#define __FLT64X_HAS_QUIET_NAN__ 1 +#define __INT_FAST64_TYPE__ long long int +#define __FLT64_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F64 +#define __DBL_MIN__ double(2.22507385850720138309023271733240406e-308L) +#define __FLT32X_EPSILON__ 2.22044604925031308084726333618164062e-16F32x +#define __DECIMAL_BID_FORMAT__ 1 +#define __GXX_TYPEINFO_EQUALITY_INLINE 0 +#define __FLT64_MIN_10_EXP__ (-307) +#define __FLT64X_DECIMAL_DIG__ 21 +#define __DEC128_MIN__ 1E-6143DL +#define __REGISTER_PREFIX__ +#define __UINT16_MAX__ 0xffff +#define __cdecl __attribute__((__cdecl__)) +#define __FLT32_MIN__ 1.17549435082228750796873653722224568e-38F32 +#define __UINT8_TYPE__ unsigned char +#define __NO_INLINE__ 1 +#define __i386 1 +#define __FLT_MANT_DIG__ 24 +#define __LDBL_DECIMAL_DIG__ 21 +#define __VERSION__ "9.2.0" +#define __UINT64_C(c) c ## ULL +#define __cpp_unicode_characters 200704 +#define __cpp_decltype_auto 201304 +#define __GCC_ATOMIC_INT_LOCK_FREE 2 +#define __FLT128_MAX_EXP__ 16384 +#define __FLT32_MANT_DIG__ 24 +#define _X86_ 1 +#define __FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__ +#define __FLT128_HAS_DENORM__ 1 +#define __FLT128_DIG__ 33 +#define __SCHAR_WIDTH__ 8 +#define __INT32_C(c) c +#define __DEC64_EPSILON__ 1E-15DD +#define __ORDER_PDP_ENDIAN__ 3412 +#define __DEC128_MIN_EXP__ (-6142) +#define __code_model_32__ 1 +#define __FLT32_MAX_10_EXP__ 38 +#define __INT_FAST32_TYPE__ int +#define __UINT_LEAST16_TYPE__ short unsigned int +#define __FLT64X_HAS_INFINITY__ 1 +#define __DBL_HAS_DENORM__ 1 +#define __INT16_MAX__ 0x7fff +#define __i386__ 1 +#define __cpp_rtti 199711 +#define __SIZE_TYPE__ unsigned int +#define __UINT64_MAX__ 0xffffffffffffffffULL +#define __FLT64X_DIG__ 18 +#define __INT8_TYPE__ signed char +#define __cpp_digit_separators 201309 +#define __GCC_ASM_FLAG_OUTPUTS__ 1 +#define __FLT_RADIX__ 2 +#define __INT_LEAST16_TYPE__ short int +#define __LDBL_EPSILON__ 1.08420217248550443400745280086994171e-19L +#define __UINTMAX_C(c) c ## ULL +#define __SIG_ATOMIC_MAX__ 0x7fffffff +#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2 +#define __SIZEOF_PTRDIFF_T__ 4 +#define __FLT32X_MANT_DIG__ 53 +#define __FLT32X_MIN_EXP__ (-1021) +#define __DEC32_SUBNORMAL_MIN__ 0.000001E-95DF +#define __pentiumpro 1 +#define __MSVCRT__ 1 +#define __INT_FAST16_MAX__ 0x7fff +#define __FLT64_DIG__ 15 +#define __UINT_FAST32_MAX__ 0xffffffffU +#define __UINT_LEAST64_TYPE__ long long unsigned int +#define __FLT_HAS_QUIET_NAN__ 1 +#define __FLT_MAX_10_EXP__ 38 +#define __LONG_MAX__ 0x7fffffffL +#define __FLT64X_HAS_DENORM__ 1 +#define __DEC128_SUBNORMAL_MIN__ 0.000000000000000000000000000000001E-6143DL +#define __FLT_HAS_INFINITY__ 1 +#define __cpp_unicode_literals 200710 +#define __UINT_FAST16_TYPE__ short unsigned int +#define __DEC64_MAX__ 9.999999999999999E384DD +#define __INT_FAST32_WIDTH__ 32 +#define __CHAR16_TYPE__ short unsigned int +#define __PRAGMA_REDEFINE_EXTNAME 1 +#define __SIZE_WIDTH__ 32 +#define __SEG_FS 1 +#define __INT_LEAST16_MAX__ 0x7fff +#define __DEC64_MANT_DIG__ 16 +#define __INT64_MAX__ 0x7fffffffffffffffLL +#define __UINT_LEAST32_MAX__ 0xffffffffU +#define __SEG_GS 1 +#define __FLT32_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F32 +#define __GCC_ATOMIC_LONG_LOCK_FREE 2 +#define __SIG_ATOMIC_WIDTH__ 32 +#define __INT_LEAST64_TYPE__ long long int +#define __INT16_TYPE__ short int +#define __INT_LEAST8_TYPE__ signed char +#define __DEC32_MAX_EXP__ 97 +#define __INT_FAST8_MAX__ 0x7f +#define __FLT128_MAX__ 1.18973149535723176508575932662800702e+4932F128 +#define __INTPTR_MAX__ 0x7fffffff +#define __cpp_sized_deallocation 201309 +#define __GXX_MERGED_TYPEINFO_NAMES 0 +#define __cpp_range_based_for 200907 +#define __FLT64_HAS_QUIET_NAN__ 1 +#define __stdcall __attribute__((__stdcall__)) +#define __FLT32_MIN_10_EXP__ (-37) +#define __EXCEPTIONS 1 +#define __LDBL_MANT_DIG__ 64 +#define __DBL_HAS_QUIET_NAN__ 1 +#define __FLT64_HAS_INFINITY__ 1 +#define __FLT64X_MAX__ 1.18973149535723176502126385303097021e+4932F64x +#define __SIG_ATOMIC_MIN__ (-__SIG_ATOMIC_MAX__ - 1) +#define __cpp_return_type_deduction 201304 +#define __INTPTR_TYPE__ int +#define __UINT16_TYPE__ short unsigned int +#define __WCHAR_TYPE__ short unsigned int +#define __SIZEOF_FLOAT__ 4 +#define __UINTPTR_MAX__ 0xffffffffU +#define __INT_FAST64_WIDTH__ 64 +#define __DEC64_MIN_EXP__ (-382) +#define __cpp_decltype 200707 +#define __FLT32_DECIMAL_DIG__ 9 +#define __INT_FAST64_MAX__ 0x7fffffffffffffffLL +#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1 +#define __FLT_DIG__ 6 +#define __FLT64X_MAX_EXP__ 16384 +#define __UINT_FAST64_TYPE__ long long unsigned int +#define __INT_MAX__ 0x7fffffff +#define WIN32 1 +#define __INT64_TYPE__ long long int +#define __FLT_MAX_EXP__ 128 +#define __DBL_MANT_DIG__ 53 +#define __cpp_inheriting_constructors 201511 +#define __SIZEOF_FLOAT128__ 16 +#define __INT_LEAST64_MAX__ 0x7fffffffffffffffLL +#define __DEC64_MIN__ 1E-383DD +#define __WINT_TYPE__ short unsigned int +#define __UINT_LEAST32_TYPE__ unsigned int +#define __SIZEOF_SHORT__ 2 +#define __LDBL_MIN_EXP__ (-16381) +#define __FLT64_MAX__ 1.79769313486231570814527423731704357e+308F64 +#define __WINT_WIDTH__ 16 +#define __INT_LEAST8_MAX__ 0x7f +#define __FLT32X_MAX_10_EXP__ 308 +#define __WCHAR_UNSIGNED__ 1 +#define __LDBL_MAX_10_EXP__ 4932 +#define __ATOMIC_RELAXED 0 +#define __DBL_EPSILON__ double(2.22044604925031308084726333618164062e-16L) +#define __thiscall __attribute__((__thiscall__)) +#define __FLT128_MIN__ 3.36210314311209350626267781732175260e-4932F128 +#define __UINT8_C(c) c +#define __FLT64_MAX_EXP__ 1024 +#define __INT_LEAST32_TYPE__ int +#define __SIZEOF_WCHAR_T__ 2 +#define __FLT128_HAS_QUIET_NAN__ 1 +#define __INT_FAST8_TYPE__ signed char +#define __fastcall __attribute__((__fastcall__)) +#define __FLT64X_MIN__ 3.36210314311209350626267781732175260e-4932F64x +#define __GNUC_STDC_INLINE__ 1 +#define __FLT64_HAS_DENORM__ 1 +#define __FLT32_EPSILON__ 1.19209289550781250000000000000000000e-7F32 +#define __DBL_DECIMAL_DIG__ 17 +#define __STDC_UTF_32__ 1 +#define __INT_FAST8_WIDTH__ 8 +#define __DEC_EVAL_METHOD__ 2 +#define __FLT32X_MAX__ 1.79769313486231570814527423731704357e+308F32x +#define __ORDER_BIG_ENDIAN__ 4321 +#define __UINT64_TYPE__ long long unsigned int +#define __UINT32_C(c) c ## U +#define __INTMAX_MAX__ 0x7fffffffffffffffLL +#define __cpp_alias_templates 200704 +#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ +#define WINNT 1 +#define __FLT_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F +#define __INT8_MAX__ 0x7f +#define __LONG_WIDTH__ 32 +#define __UINT_FAST32_TYPE__ unsigned int +#define __CHAR32_TYPE__ unsigned int +#define __FLT_MAX__ 3.40282346638528859811704183484516925e+38F +#define __cpp_constexpr 201304 +#define __INT32_TYPE__ int +#define __SIZEOF_DOUBLE__ 8 +#define __cpp_exceptions 199711 +#define __FLT_MIN_10_EXP__ (-37) +#define __FLT64_MIN__ 2.22507385850720138309023271733240406e-308F64 +#define __INT_LEAST32_WIDTH__ 32 +#define __INTMAX_TYPE__ long long int +#define i386 1 +#define _INTEGRAL_MAX_BITS 64 +#define __DEC128_MAX_EXP__ 6145 +#define __FLT32X_HAS_QUIET_NAN__ 1 +#define __ATOMIC_CONSUME 1 +#define __GNUC_MINOR__ 2 +#define __INT_FAST16_WIDTH__ 16 +#define __UINTMAX_MAX__ 0xffffffffffffffffULL +#define __DEC32_MANT_DIG__ 7 +#define __FLT32X_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F32x +#define __DBL_MAX_10_EXP__ 308 +#define __LDBL_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951L +#define __INT16_C(c) c +#define __cpp_generic_lambdas 201304 +#define __STDC__ 1 +#define __FLT32X_DIG__ 15 +#define __PTRDIFF_TYPE__ int +#define __ATOMIC_SEQ_CST 5 +#define __UINT32_TYPE__ unsigned int +#define __FLT32X_MIN_10_EXP__ (-307) +#define __UINTPTR_TYPE__ unsigned int +#define __DEC64_SUBNORMAL_MIN__ 0.000000000000001E-383DD +#define __DEC128_MANT_DIG__ 34 +#define __LDBL_MIN_10_EXP__ (-4931) +#define __FLT128_EPSILON__ 1.92592994438723585305597794258492732e-34F128 +#define __SIZEOF_LONG_LONG__ 8 +#define __cpp_user_defined_literals 200809 +#define __FLT128_DECIMAL_DIG__ 36 +#define __GCC_ATOMIC_LLONG_LOCK_FREE 2 +#define __FLT32X_MIN__ 2.22507385850720138309023271733240406e-308F32x +#define __LDBL_DIG__ 18 +#define __FLT_DECIMAL_DIG__ 9 +#define __UINT_FAST16_MAX__ 0xffff +#define __GCC_ATOMIC_SHORT_LOCK_FREE 2 +#define __INT_LEAST64_WIDTH__ 64 +#define __UINT_FAST8_TYPE__ unsigned char +#define __cpp_init_captures 201304 +#define __ATOMIC_ACQ_REL 4 +#define __ATOMIC_RELEASE 3 +#define __declspec(x) __attribute__((x)) +#endif /* ifdef __cplusplus */ +/* End of C++ macros */ + +/* C decls */ +#ifndef __cplusplus +typedef __float128 _Float128; +#endif /* ifndef __cplusplus */ +/* End of C decls */ + +/* C++ decls */ +#ifdef __cplusplus +#if defined(__cpp_char8_t) && __cplusplus >= 202002L +//lint +rw(char8_t) +#endif +#endif /* ifdef __cplusplus */ +/* End of C++ decls */ + +#endif /* ifndef VECTOR_INFORMATIK_PCLP_CO_GCC_H */ diff --git a/qspy/lint-plus/co-gcc.lnt b/qspy/lint-plus/co-gcc.lnt new file mode 100644 index 0000000..a0ef131 --- /dev/null +++ b/qspy/lint-plus/co-gcc.lnt @@ -0,0 +1,80 @@ +/* Compiler configuration for 'gcc' version '9.2.0'. + Using the options: + C specific options: + C++ specific options: + Generated on 2024-06-21 at 11:05:34 with pclp_config version '2.0' and database version '2.0'. + */ + +// Base Options +// Extensions ++fdi // Starts its #include search in the directory of the including file ++fgi // Enable GNU inline semantics ++fld // Enable support for gcc label designators ++ppw(include_next) // Enable support for #include_next ++ppw(ident) // Enable support for #ident ++ppw(warning) // Enable support for #warning ++ppw(import) // Enable support for #import ++ppw(sccs) // Enable support for #sccs ++ppw(unassert) // Enable support for #unassert ++cpp(.cc) // Make .cc a C++ file extension in addition to the default of .cpp and .cxx ++rw(__typeof__) ++rw(_Decimal32) ++rw(_Decimal64) ++rw(_Decimal128) ++rw(__alignof) ++rw(__attribute) ++rw(__builtin_choose_expr) ++rw(__builtin_offsetof) ++rw(__builtin_types_compatible_p) ++rw(__builtin_va_arg) ++rw(__extension__) ++rw(__imag) ++rw(__label__) ++rw(__real) ++rw(__thread) ++rw(__PRETTY_FUNCTION__) ++rw(typeof) +-rw_asgn(__inline,inline) +-rw_asgn(__inline__,inline) +-rw_asgn(__signed__,signed) +-rw_asgn(__signed,signed) +-rw_asgn(__volatile__,volatile) +-rw_asgn(__volatile,volatile) +-rw_asgn(__alignof__,__alignof) +-rw_asgn(__const,const) +-rw_asgn(asm,_up_to_brackets) +-rw_asgn(__asm,_up_to_brackets) +-rw_asgn(__asm__,_up_to_brackets) +++dassert(x)=__lint_assert(!!(x)) +++d__attr_dealloc(dealloc,argno)= // Avoid use of argument-accepting malloc attribute +++d__attr_dealloc_free= // Avoid use of __builtin_free + +// Suppressions +-emacro(530, va_start) +-emacro(530, va_end) +-emacro(413, offsetof) +-emacro(160 523 505 866,assert) + +// Transformed compiler options + +// Size Options +-si4 -sl4 -sll8 -ss2 -sw2 -sp4 -sf4 -sd8 -sld12 +fzl + +// Include Options +--i"C:/qp/qtools/MinGW32/bin/../lib/gcc/i686-w64-mingw32/9.2.0/../../../../include/c++/9.2.0" ++libdir("C:/qp/qtools/MinGW32/bin/../lib/gcc/i686-w64-mingw32/9.2.0/../../../../include/c++/9.2.0") +--i"C:/qp/qtools/MinGW32/bin/../lib/gcc/i686-w64-mingw32/9.2.0/../../../../include/c++/9.2.0/i686-w64-mingw32" ++libdir("C:/qp/qtools/MinGW32/bin/../lib/gcc/i686-w64-mingw32/9.2.0/../../../../include/c++/9.2.0/i686-w64-mingw32") +--i"C:/qp/qtools/MinGW32/bin/../lib/gcc/i686-w64-mingw32/9.2.0/../../../../include/c++/9.2.0/backward" ++libdir("C:/qp/qtools/MinGW32/bin/../lib/gcc/i686-w64-mingw32/9.2.0/../../../../include/c++/9.2.0/backward") +--i"C:/qp/qtools/MinGW32/bin/../lib/gcc/i686-w64-mingw32/9.2.0/include" ++libdir("C:/qp/qtools/MinGW32/bin/../lib/gcc/i686-w64-mingw32/9.2.0/include") +--i"C:/qp/qtools/MinGW32/bin/../lib/gcc/i686-w64-mingw32/9.2.0/../../../../include" ++libdir("C:/qp/qtools/MinGW32/bin/../lib/gcc/i686-w64-mingw32/9.2.0/../../../../include") +--i"C:/qp/qtools/MinGW32/bin/../lib/gcc/i686-w64-mingw32/9.2.0/include-fixed" ++libdir("C:/qp/qtools/MinGW32/bin/../lib/gcc/i686-w64-mingw32/9.2.0/include-fixed") +--i"C:/qp/qtools/MinGW32/bin/../lib/gcc/i686-w64-mingw32/9.2.0/../../../../i686-w64-mingw32/include" ++libdir("C:/qp/qtools/MinGW32/bin/../lib/gcc/i686-w64-mingw32/9.2.0/../../../../i686-w64-mingw32/include") + ++libh(co-gcc.h) +-header(co-gcc.h) diff --git a/qspy/lint-plus/make.bat b/qspy/lint-plus/make.bat new file mode 100644 index 0000000..d23f87d --- /dev/null +++ b/qspy/lint-plus/make.bat @@ -0,0 +1,51 @@ +@echo off +:: =========================================================================== +:: Batch script for linting QP/C with PC-Lint-Plus2 +:: Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved. +:: +:: SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial +:: +:: This software is dual-licensed under the terms of the open source GNU +:: General Public License version 3 (or any later version), or alternatively, +:: under the terms of one of the closed source Quantum Leaps commercial +:: licenses. +:: +:: The terms of the open source GNU General Public License version 3 +:: can be found at: +:: +:: The terms of the closed source Quantum Leaps commercial licenses +:: can be found at: +:: +:: Redistributions in source code must retain this top-level comment block. +:: Plagiarizing this software to sidestep the license obligations is illegal. +:: +:: Contact information: +:: +:: +:: =========================================================================== +@setlocal + +:: usage of make.bat +@echo Usage: make [-d...] +@echo examples: +@echo make -uQ_SPY -uQ_UTEST : undefine Q_SPY/Q_UTEST +@echo. + +:: NOTE: adjust to for your installation directory of PC-Lint-Plus +@set PCLP=C:\tools\lint-plus2\windows\pclp64.exe + +if NOT exist "%PCLP%" ( + @echo The PC-Lint-Plus toolset not found. Please adjust make.bat + @goto end +) + +set LINTFLAGS=-i64bit -i%GCC_INC% -dQSPY_APP options.lnt %1 %2 %3 %4 + +:: cleanup +@del *.log + +:: linting ------------------------------------------------------------------- +%PCLP% -os(lint.log) std.lnt %LINTFLAGS% ..\source\*.c + +:end +@endlocal diff --git a/qspy/lint-plus/options.lnt b/qspy/lint-plus/options.lnt new file mode 100644 index 0000000..79dd9b9 --- /dev/null +++ b/qspy/lint-plus/options.lnt @@ -0,0 +1,60 @@ +//============================================================================ +// QP/C Real-Time Embedded Framework (RTEF) +// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved. +// +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial +// +// This software is dual-licensed under the terms of the open source GNU +// General Public License version 3 (or any later version), or alternatively, +// under the terms of one of the closed source Quantum Leaps commercial +// licenses. +// +// The terms of the open source GNU General Public License version 3 +// can be found at: +// +// The terms of the closed source Quantum Leaps commercial licenses +// can be found at: +// +// Redistributions in source code must retain this top-level comment block. +// Plagiarizing this software to sidestep the license obligations is illegal. +// +// Contact information: +// +// +//============================================================================ +//! @date Last updated on: 2024-06-21 +//! @version Last updated for version: 7.4.0 +//! +//! @file +//! @brief PC-Lint-Plus option file for linting QSPY source code + +//============================================================================ +// general options +-unit_check // perform only subset check (suppresses Global Wrapup) +-max_threads=1 // suppress message "no '-max_threads=N' option" +++efreeze(686) // never suppress (see PC-Lint-Plus in Safety-Critical) +//-vf // print names of all source files (for debugging linting) + +// include directories +-i. // compiler config +-i../include // QSPY includes + +// standards +// language standard... +co-gcc.lnt // GCC config + +au-ds.lnt // Dan Saks recommendations +cpu.lnt // size/alignment options for the chosen CPU + +//============================================================================ +// "no return" semantics for error/failure callbacks +-sem(Q_onError, r_no) + +//============================================================================ +-e786 // string concatenation within initializer +-e641 // implicit conversion of enum to integral type +//-e534 // ignoring return value of function +-e834 // operator '-' followed '-' could be confusing without parentheses +-e816 // non-ISO format specification '%I64d' +-e705 // format '%I64d' specifies type '__int64' (aka 'long long') + // which is nominally inconsistent with argument 'uint64_t' \ No newline at end of file diff --git a/qspy/lint-plus/std.lnt b/qspy/lint-plus/std.lnt new file mode 100644 index 0000000..722f710 --- /dev/null +++ b/qspy/lint-plus/std.lnt @@ -0,0 +1,44 @@ +//============================================================================ +// QP/C Real-Time Embedded Framework (RTEF) +// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved. +// +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial +// +// This software is dual-licensed under the terms of the open source GNU +// General Public License version 3 (or any later version), or alternatively, +// under the terms of one of the closed source Quantum Leaps commercial +// licenses. +// +// The terms of the open source GNU General Public License version 3 +// can be found at: +// +// The terms of the closed source Quantum Leaps commercial licenses +// can be found at: +// +// Redistributions in source code must retain this top-level comment block. +// Plagiarizing this software to sidestep the license obligations is illegal. +// +// Contact information: +// +// +//============================================================================ +//! @date Last updated on: 2023-06-06 +//! @version Last updated for version: 7.3.0 +//! +//! @file +//! @brief PC-Lint-Plus standard option file + +// message formatting options... +-hF1 // output: a single line ++ffn // use full path names +-width(120,4) // break lines after 99 characters with 4 characters indent ++flm // make sure no foreign includes change the format + +-zero(99) // don't stop because of warnings +-passes(2) // make two passes (for better error messages) +-restore_at_end // don't let -e options bleed to other files +-summary() // output a summary of all produced messages + +// globally suppress the following warnings: +-e546 // explicitly taking address of function +-e717 // monocarpic do-while used to group statements diff --git a/qspy/source/getopt.c b/qspy/source/getopt.c index 0f9cb74..95ca102 100644 --- a/qspy/source/getopt.c +++ b/qspy/source/getopt.c @@ -82,8 +82,8 @@ static int permute_argv_once(void) { char *tmp = prev_argv[argv_index]; /* Move the data */ - memmove(&prev_argv[argv_index], &prev_argv[argv_index+1], - sizeof(char**) * (prev_argc - argv_index - 1)); + (void)memmove(&prev_argv[argv_index], &prev_argv[argv_index + 1], + sizeof(char**) * (size_t)(prev_argc - (argv_index + 1))); prev_argv[prev_argc - 1] = tmp; nonopt++; diff --git a/qspy/source/qspy.c b/qspy/source/qspy.c index d06eb74..bc84489 100644 --- a/qspy/source/qspy.c +++ b/qspy/source/qspy.c @@ -22,8 +22,8 @@ // // //============================================================================ -//! @date Last updated on: 2024-02-23 -//! @version Last updated for version: 7.3.3 +//! @date Last updated on: 2024-06-21 +//! @version Last updated for version: 7.4.0 //! //! @file //! @brief QSPY host utility: main parser @@ -333,7 +333,7 @@ QSpyStatus QSpyRecord_OK(QSpyRecord * const me) { SNPRINTF_APPEND("%d bytes unused in ", me->len); } else { - SNPRINTF_APPEND("%d bytes needed in ", (-me->len)); + SNPRINTF_APPEND("%d bytes needed in ", -(int)me->len); } /* is this a pre-defined QS record? */ @@ -705,9 +705,11 @@ static void QSpyRecord_processUser(QSpyRecord * const me) { } case QS_MEM_T: { uint8_t const *mem = QSpyRecord_getMem(me, 1, &u32); - for (; u32 > 0U; --u32, ++mem) { - SNPRINTF_APPEND(" %02X", (unsigned int)*mem); - FPRINF_MATFILE(" %03d", (unsigned int)*mem); + if (mem) { + for (; u32 > 0U; --u32, ++mem) { + SNPRINTF_APPEND(" %02X", (unsigned int)*mem); + FPRINF_MATFILE(" %03d", (unsigned int)*mem); + } } break; } @@ -799,7 +801,7 @@ static void QSpyRecord_process(QSpyRecord * const me) { /* QEP records .....................................................*/ case QS_QEP_STATE_ENTRY: s = "St-Entry"; - /* fall through */ + //lint -fallthrough case QS_QEP_STATE_EXIT: { if (s == 0) s = "St-Exit "; p = QSpyRecord_getUint64(me, QSPY_conf.objPtrSize); @@ -817,13 +819,13 @@ static void QSpyRecord_process(QSpyRecord * const me) { } case QS_QEP_STATE_INIT: s = "St-Init "; - /* fall through */ + //lint -fallthrough case QS_QEP_TRAN_HIST: if (s == 0) s = "St-Hist "; - /* fall through */ + //lint -fallthrough case QS_QEP_TRAN_EP: if (s == 0) s = "St-EP "; - /* fall through */ + //lint -fallthrough case QS_QEP_TRAN_XP: { if (s == 0) s = "St-XP "; p = QSpyRecord_getUint64(me, QSPY_conf.objPtrSize); @@ -961,7 +963,7 @@ static void QSpyRecord_process(QSpyRecord * const me) { else { /* former QS_QF_ACTIVE_ADD */ s = "Add "; } - /* fall through */ + //lint -fallthrough case QS_QF_ACTIVE_RECALL: { if (QSPY_conf.version >= 620U) { if (s == 0) s = "RCall"; @@ -1052,7 +1054,7 @@ static void QSpyRecord_process(QSpyRecord * const me) { case QS_QF_ACTIVE_SUBSCRIBE: s = "Subsc"; - /* fall through */ + //lint -fallthrough case QS_QF_ACTIVE_UNSUBSCRIBE: { if (s == 0) s = "Unsub"; t = QSpyRecord_getUint32(me, QSPY_conf.tstampSize); @@ -1072,7 +1074,7 @@ static void QSpyRecord_process(QSpyRecord * const me) { } case QS_QF_ACTIVE_POST: s = "Post "; - /* fall through */ + //lint -fallthrough case QS_QF_ACTIVE_POST_ATTEMPT: { if (s == 0) s = "PostA"; t = QSpyRecord_getUint32(me, QSPY_conf.tstampSize); @@ -1162,7 +1164,7 @@ static void QSpyRecord_process(QSpyRecord * const me) { } case QS_QF_ACTIVE_GET: s = "AO-Get "; - /* fall through */ + //lint -fallthrough case QS_QF_EQUEUE_GET: { if (s == 0) s = "EQ-Get "; t = QSpyRecord_getUint32(me, QSPY_conf.tstampSize); @@ -1194,7 +1196,7 @@ static void QSpyRecord_process(QSpyRecord * const me) { } case QS_QF_ACTIVE_GET_LAST: s = "AO-GetL "; - /* fall through */ + //lint -fallthrough case QS_QF_EQUEUE_GET_LAST: { if (s == 0) s = "EQ-GetL "; t = QSpyRecord_getUint32(me, QSPY_conf.tstampSize); @@ -1226,11 +1228,11 @@ static void QSpyRecord_process(QSpyRecord * const me) { case QS_QF_EQUEUE_POST: s = "Post "; w = "Min"; - /* fall through */ + //lint -fallthrough case QS_QF_EQUEUE_POST_ATTEMPT: if (s == 0) s = "PostA"; if (w == 0) w = "Mar"; - /* fall through */ + //lint -fallthrough case QS_QF_EQUEUE_POST_LIFO: { if (s == 0) s = "LIFO"; if (w == 0) w = "Min"; @@ -1270,7 +1272,7 @@ static void QSpyRecord_process(QSpyRecord * const me) { case QS_QF_MPOOL_GET: s = "Get "; w = "Min"; - /* fall through */ + //lint -fallthrough case QS_QF_MPOOL_GET_ATTEMPT: { if (s == 0) s = "GetA "; if (w == 0) w = "Mar"; @@ -1311,7 +1313,7 @@ static void QSpyRecord_process(QSpyRecord * const me) { /* QF */ case QS_QF_NEW_ATTEMPT: s = "QF-NewA "; - /* fall through */ + //lint -fallthrough case QS_QF_NEW: { if (s == 0) s = "QF-New "; t = QSpyRecord_getUint32(me, QSPY_conf.tstampSize); @@ -1428,7 +1430,7 @@ static void QSpyRecord_process(QSpyRecord * const me) { case QS_QF_GC_ATTEMPT: s = "QF-gcA "; - /* fall through */ + //lint -fallthrough case QS_QF_GC: { if (s == 0) s = "QF-gc "; t = QSpyRecord_getUint32(me, QSPY_conf.tstampSize); @@ -1478,7 +1480,7 @@ static void QSpyRecord_process(QSpyRecord * const me) { } case QS_QF_TIMEEVT_ARM: s = "Arm "; - /* fall through */ + //lint -fallthrough case QS_QF_TIMEEVT_DISARM: { if (s == 0) s = "Dis "; t = QSpyRecord_getUint32(me, QSPY_conf.tstampSize); @@ -1601,7 +1603,7 @@ static void QSpyRecord_process(QSpyRecord * const me) { } case QS_QF_CRIT_ENTRY: s = "QF-CritE"; - /* fall through */ + //lint -fallthrough case QS_QF_CRIT_EXIT: { if (s == 0) s = "QF-CritX"; t = QSpyRecord_getUint32(me, QSPY_conf.tstampSize); @@ -1619,7 +1621,7 @@ static void QSpyRecord_process(QSpyRecord * const me) { } case QS_QF_ISR_ENTRY: s = "QF-IsrE"; - /* fall through */ + //lint -fallthrough case QS_QF_ISR_EXIT: { if (s == 0) s = "QF-IsrX"; t = QSpyRecord_getUint32(me, QSPY_conf.tstampSize); @@ -1646,7 +1648,7 @@ static void QSpyRecord_process(QSpyRecord * const me) { else { if (s == 0) s = "Sch-Pre "; } - /* fall through */ + //lint -fallthrough case QS_SCHED_RESTORE: { t = QSpyRecord_getUint32(me, QSPY_conf.tstampSize); a = QSpyRecord_getUint32(me, 1); @@ -1675,7 +1677,7 @@ static void QSpyRecord_process(QSpyRecord * const me) { case QS_SCHED_LOCK: if (s == 0) s = "Sch-Lock"; - /* fall through */ + //lint -fallthrough case QS_SCHED_UNLOCK: { if (s == 0) s = "Sch-Unlk"; t = QSpyRecord_getUint32(me, QSPY_conf.tstampSize); @@ -2087,7 +2089,7 @@ static void QSpyRecord_process(QSpyRecord * const me) { a = QSpyRecord_getUint32(me, 2); /* offset */ b = QSpyRecord_getUint32(me, 1); /* data size */ w = (char const *)QSpyRecord_getMem(me, (uint8_t)b, &c); - if (QSpyRecord_OK(me)) { + if (QSpyRecord_OK(me) && w) { SNPRINTF_LINE("%010u Trg-Peek Offs=%d,Size=%d,Num=%d,Data=<", t, a, b, c); for (; c > 1U; --c, w += b) { @@ -2151,13 +2153,13 @@ static void QSpyRecord_process(QSpyRecord * const me) { /* Semaphore records ...............................................*/ case QS_SEM_TAKE: if (s == 0) s = "Sem-Take"; - /* fall through */ + //lint -fallthrough case QS_SEM_BLOCK: if (s == 0) s = "Sem-Blk "; - /* fall through */ + //lint -fallthrough case QS_SEM_SIGNAL: if (s == 0) s = "Sem-Sgnl"; - /* fall through */ + //lint -fallthrough case QS_SEM_BLOCK_ATTEMPT: { if (s == 0) s = "Sem-BlkA"; t = QSpyRecord_getUint32(me, QSPY_conf.tstampSize); @@ -2180,13 +2182,13 @@ static void QSpyRecord_process(QSpyRecord * const me) { /* Mutex records ...............................................*/ case QS_MTX_LOCK: if (s == 0) s = "Mtx-Lock"; - /* fall through */ + //lint -fallthrough case QS_MTX_UNLOCK: if (s == 0) s = "Mtx-Unlk"; - /* fall through */ + //lint -fallthrough case QS_MTX_LOCK_ATTEMPT: if (s == 0) s = "Mtx-LckA"; - /* fall through */ + //lint -fallthrough case QS_MTX_UNLOCK_ATTEMPT: { if (s == 0) s = "Mtx-UlkA"; t = QSpyRecord_getUint32(me, QSPY_conf.tstampSize); @@ -2207,7 +2209,7 @@ static void QSpyRecord_process(QSpyRecord * const me) { } case QS_MTX_BLOCK: if (s == 0) s = "Mtx-Blk "; - /* fall through */ + //lint -fallthrough case QS_MTX_BLOCK_ATTEMPT: { if (s == 0) s = "Mtx-BlkA"; t = QSpyRecord_getUint32(me, QSPY_conf.tstampSize); @@ -2331,13 +2333,13 @@ void QSPY_parse(uint8_t const *buf, uint32_t nBytes) { } QSPY_printError(); } - else { /* a healty record received */ + else { /* a healthy record received */ QSpyRecord qrec; int parse = 1; ++l_seq; /* increment with natural wrap-around */ if (!isJustStarted) { - /* data discountinuity found? + /* data discontinuity found? * but not for the QS_EMPTY record? */ if ((l_seq != l_record[0]) diff --git a/qspy/source/qspy_be.c b/qspy/source/qspy_be.c index c8dc040..538e337 100644 --- a/qspy/source/qspy_be.c +++ b/qspy/source/qspy_be.c @@ -22,8 +22,8 @@ // // //============================================================================ -//! @date Last updated on: 2024-02-23 -//! @version Last updated for version: 7.3.3 +//! @date Last updated on: 2024-06-21 +//! @version Last updated for version: 7.4.0 //! //! @file //! @brief Back-End connection point for the external Front-Ends @@ -49,8 +49,8 @@ static uint8_t l_txBeSeq; /* transmit Back-End sequence number */ static uint8_t l_channels; /* channels of the output (bitmask) */ enum Channels { - BINARY_CH = (1 << 0), - TEXT_CH = (1 << 1) + BINARY_CH = 1U, // (1U << 0U) + TEXT_CH = (1U << 1U) }; /* send a packet to Front-End */ @@ -120,16 +120,11 @@ void BE_parse(unsigned char *buf, uint32_t nBytes) { uint32_t len = QSPY_encode(qbuf, sizeof(qbuf), buf, nBytes); if (len > 0U) { if ((*PAL_vtbl.send2Target)(qbuf, len) != QSPY_SUCCESS) { - SNPRINTF_LINE(" ERROR Sedning Data " + SNPRINTF_LINE(" ERROR Sending Data " "to the Target Rec=%d,Len=%d", (int)buf[1], (int)len); QSPY_printError(); } -#ifndef NDEBUG - if (l_testFile != (FILE *)0) { - fwrite(qbuf, 1, len, l_testFile); - } -#endif } else { SNPRINTF_LINE(" ERROR Target packet too big Len=%d", @@ -275,7 +270,7 @@ int BE_parseRecFromTarget(QSpyRecord * const qrec) { } /*--------------------------------------------------------------------------*/ -void BE_sendShortPkt(int pktId) { +static void BE_sendShortPkt(int pktId) { if ((pktId >= 128) || ((l_channels & BINARY_CH) != 0)) { uint8_t buf[4]; uint8_t *pos = &buf[0]; diff --git a/qspy/source/qspy_main.c b/qspy/source/qspy_main.c index d6736af..c110ce8 100644 --- a/qspy/source/qspy_main.c +++ b/qspy/source/qspy_main.c @@ -22,14 +22,13 @@ // // //============================================================================ -//! @date Last updated on: 2024-02-23 -//! @version Last updated for version: 7.3.3 +//! @date Last updated on: 2024-06-21 +//! @version Last updated for version: 7.4.0 //! //! @file //! @brief main for QSPY host utility #include -#include #include #include #include @@ -78,7 +77,7 @@ extern char const * const l_lightPalette[]; static char const * const *l_colorPalette = l_darkPalette; static char const l_introStr[] = \ - "QSPY %s Copyright (c) 2005-2023 Quantum Leaps\n" \ + "QSPY %s Copyright (c) 2005-2024 Quantum Leaps\n" \ "Documentation: https://www.state-machine.com/qtools/qspy.html\n" \ "Current timestamp: %s\n"; @@ -158,6 +157,7 @@ int main(int argc, char *argv[]) { /* get the event from the PAL... */ nBytes = sizeof(l_buf); QSPYEvtType evt = (*PAL_vtbl.getEvt)(l_buf, &nBytes); + Q_ASSERT(nBytes <= sizeof(l_buf)); switch (evt) { case QSPY_NO_EVT: /* all intputs timed-out this time around */ @@ -167,7 +167,7 @@ int main(int argc, char *argv[]) { if (nBytes > 0) { QSPY_parse(l_buf, (uint32_t)nBytes); if (l_savFile != (FILE *)0) { - fwrite(l_buf, 1, nBytes, l_savFile); + (void)fwrite(l_buf, 1, nBytes, l_savFile); } } break; @@ -205,10 +205,10 @@ void QSPY_cleanup(void) { PAL_closeKbd(); /* close the keyboard input (if open) */ if (l_savFile != (FILE *)0) { - fclose(l_savFile); + (void)fclose(l_savFile); } if (l_outFile != (FILE *)0) { - fclose(l_outFile); + (void)fclose(l_outFile); } QSEQ_configFile((void*)0); @@ -237,8 +237,8 @@ void Q_onError(char const * const module, int const id) { void QSPY_onPrintLn(void) { if (l_outFile != (FILE *)0) { /* output file receives all trace records, regardles of -q mode */ - fputs(&QSPY_output.buf[QS_LINE_OFFSET], l_outFile); - fputc('\n', l_outFile); + (void)fputs(&QSPY_output.buf[QS_LINE_OFFSET], l_outFile); + (void)fputc('\n', l_outFile); } if (QSPY_output.type < BE_OUT) { /* message to be forwarded to BE? */ @@ -250,28 +250,28 @@ void QSPY_onPrintLn(void) { colorPrintLn(); } else { - fputs(&QSPY_output.buf[QS_LINE_OFFSET], stdout); - fputc('\n', stdout); + (void)fputs(&QSPY_output.buf[QS_LINE_OFFSET], stdout); + (void)fputc('\n', stdout); } } else if (l_quiet > 0) { if ((l_quiet_ctr == 0U) || (QSPY_output.type != REG_OUT)) { if ((l_quiet < 99) || (QSPY_output.type != REG_OUT)) { if (l_quiet_ctr != l_quiet - 1) { - fputc('\n', stdout); + (void)fputc('\n', stdout); } if (l_colorPalette) { colorPrintLn(); } else { - fputs(&QSPY_output.buf[QS_LINE_OFFSET], stdout); - fputc('\n', stdout); + (void)fputs(&QSPY_output.buf[QS_LINE_OFFSET], stdout); + (void)fputc('\n', stdout); } l_quiet_ctr = l_quiet; } } else { - fputc('.', stdout); + (void)fputc('.', stdout); } --l_quiet_ctr; } @@ -376,19 +376,19 @@ static QSpyStatus configure(int argc, char *argv[]) { break; } case 'o': { /* save screen output to a file */ - SNPRINTF_S(l_outFileName, sizeof(l_outFileName) - 1U, + (void)SNPRINTF_S(l_outFileName, sizeof(l_outFileName) - 1U, "qspy%s.txt", l_tstampStr); PRINTF_S("-o (%s)\n", l_outFileName); break; } case 's': { /* save binary data to a file */ - SNPRINTF_S(l_savFileName, sizeof(l_savFileName) - 1U, + (void)SNPRINTF_S(l_savFileName, sizeof(l_savFileName) - 1U, "qspy%s.bin", l_tstampStr); PRINTF_S("-s (%s)\n", l_savFileName); break; } case 'm': { /* Matlab/Octave file output */ - SNPRINTF_S(l_matFileName, sizeof(l_matFileName) - 1U, + (void)SNPRINTF_S(l_matFileName, sizeof(l_matFileName) - 1U, "qspy%s.mat", l_tstampStr); PRINTF_S("-m (%s)\n", l_matFileName); break; @@ -402,7 +402,7 @@ static QSpyStatus configure(int argc, char *argv[]) { "empty object-list for sequence diagram"); return QSPY_ERROR; } - SNPRINTF_S(l_seqFileName, sizeof(l_seqFileName) - 1U, + (void)SNPRINTF_S(l_seqFileName, sizeof(l_seqFileName) - 1U, "qspy%s.seq", l_tstampStr); PRINTF_S("-g %s (%s)\n", l_seqList, l_seqFileName); break; @@ -614,7 +614,7 @@ static QSpyStatus configure(int argc, char *argv[]) { /* NOTE: dictionary file must be set and read AFTER configuring QSPY */ if (l_dicFileName[0] != 'O') { /* not "OFF" ? */ QSPY_setExternDict(l_dicFileName); - QSPY_readDict(); + (void)QSPY_readDict(); } return QSPY_SUCCESS; @@ -674,7 +674,7 @@ bool QSPY_command(uint8_t cmdId, uint8_t opt) { break; case 'd': /* save Dictionaries to a file */ - QSPY_writeDict(); + (void)QSPY_writeDict(); break; case 'c': /* clear the screen */ @@ -695,7 +695,7 @@ bool QSPY_command(uint8_t cmdId, uint8_t opt) { case 'o': /* text output file open/close/toggle */ if (l_outFile != (FILE *)0) { - fclose(l_outFile); + (void)fclose(l_outFile); l_outFile = (FILE *)0; STRNCPY_S(l_outFileName, sizeof(l_outFileName), "OFF"); if (opt == CMD_OPT_TOGGLE) { @@ -704,7 +704,7 @@ bool QSPY_command(uint8_t cmdId, uint8_t opt) { } if ((opt == CMD_OPT_ON) || (opt == CMD_OPT_TOGGLE)) { STRNCPY_S(l_tstampStr, sizeof(l_tstampStr), QSPY_tstampStr()); - SNPRINTF_S(l_outFileName, sizeof(l_outFileName), + (void)SNPRINTF_S(l_outFileName, sizeof(l_outFileName), "qspy%s.txt", l_tstampStr); FOPEN_S(l_outFile, l_outFileName, "w"); if (l_outFile != (FILE *)0) { @@ -723,7 +723,7 @@ bool QSPY_command(uint8_t cmdId, uint8_t opt) { case 'b': case 's': /* binary output file open/close/toggle */ if (l_savFile != (FILE *)0) { - fclose(l_savFile); + (void)fclose(l_savFile); l_savFile = (FILE *)0; STRNCPY_S(l_savFileName, sizeof(l_savFileName), "OFF"); if (opt == CMD_OPT_TOGGLE) { @@ -731,7 +731,7 @@ bool QSPY_command(uint8_t cmdId, uint8_t opt) { } } if ((opt == CMD_OPT_ON) || (opt == CMD_OPT_TOGGLE)) { - SNPRINTF_S(l_savFileName, sizeof(l_savFileName), + (void)SNPRINTF_S(l_savFileName, sizeof(l_savFileName), "qspy%s.bin", QSPY_tstampStr()); FOPEN_S(l_savFile, l_savFileName, "wb"); if (l_savFile == (FILE *)0) { @@ -754,7 +754,7 @@ bool QSPY_command(uint8_t cmdId, uint8_t opt) { } } if ((opt == CMD_OPT_ON) || (opt == CMD_OPT_TOGGLE)) { - SNPRINTF_S(l_matFileName, sizeof(l_matFileName), + (void)SNPRINTF_S(l_matFileName, sizeof(l_matFileName), "qspy%s.mat", QSPY_tstampStr()); FOPEN_S(l_matFile, l_matFileName, "w"); if (l_matFile != (FILE *)0) { @@ -786,7 +786,7 @@ bool QSPY_command(uint8_t cmdId, uint8_t opt) { } } if ((opt == CMD_OPT_ON) || (opt == CMD_OPT_TOGGLE)) { - SNPRINTF_S(l_seqFileName, sizeof(l_seqFileName), + (void)SNPRINTF_S(l_seqFileName, sizeof(l_seqFileName), "qspy%s.seq", QSPY_tstampStr()); FOPEN_S(l_seqFile, l_seqFileName, "w"); if (l_seqFile != (FILE *)0) { @@ -817,9 +817,9 @@ char const* QSPY_tstampStr(void) { struct tm tstamp; static char tstampStr[64]; - LOCALTIME_S(&tstamp, &rawtime); + (void)LOCALTIME_S(&tstamp, &rawtime); - SNPRINTF_S(tstampStr, sizeof(tstampStr), "%02d%02d%02d_%02d%02d%02d", + (void)SNPRINTF_S(tstampStr, sizeof(tstampStr), "%02d%02d%02d_%02d%02d%02d", (tstamp.tm_year + 1900) % 100, (tstamp.tm_mon + 1), tstamp.tm_mday, @@ -928,44 +928,44 @@ static void colorPrintLn(void) { /* timestamp */ char ch = QSPY_output.buf[QS_LINE_OFFSET + COL_TSTAMP]; QSPY_output.buf[QS_LINE_OFFSET + COL_TSTAMP] = '\0'; - fputs(l_colorPalette[PALETTE_TSTAMP], stdout); - fputs(&QSPY_output.buf[QS_LINE_OFFSET], stdout); + (void)fputs(l_colorPalette[PALETTE_TSTAMP], stdout); + (void)fputs(&QSPY_output.buf[QS_LINE_OFFSET], stdout); QSPY_output.buf[QS_LINE_OFFSET + COL_TSTAMP] = ch; switch (QSPY_getGroup(QSPY_output.rec)) { case GRP_ERR: { - fputs(l_colorPalette[PALETTE_ERR_OUT], stdout); - fputs(&QSPY_output.buf[QS_LINE_OFFSET + COL_TSTAMP], stdout); + (void)fputs(l_colorPalette[PALETTE_ERR_OUT], stdout); + (void)fputs(&QSPY_output.buf[QS_LINE_OFFSET + COL_TSTAMP], stdout); break; } case GRP_INF: { /* description section */ ch = QSPY_output.buf[QS_LINE_OFFSET + COL_DESC]; QSPY_output.buf[QS_LINE_OFFSET + COL_DESC] = '\0'; - fputs(l_colorPalette[PALETTE_DSC_INF], stdout); - fputs(&QSPY_output.buf[QS_LINE_OFFSET + COL_TSTAMP], stdout); + (void)fputs(l_colorPalette[PALETTE_DSC_INF], stdout); + (void)fputs(&QSPY_output.buf[QS_LINE_OFFSET + COL_TSTAMP], stdout); QSPY_output.buf[QS_LINE_OFFSET + COL_DESC] = ch; if (QSPY_output.len > COL_DESC) { - fputs(l_colorPalette[PALETTE_INF_TXT], stdout); - fputs(&QSPY_output.buf[QS_LINE_OFFSET + COL_DESC], stdout); + (void)fputs(l_colorPalette[PALETTE_INF_TXT], stdout); + (void)fputs(&QSPY_output.buf[QS_LINE_OFFSET + COL_DESC], stdout); } break; } case GRP_DIC: { - fputs(l_colorPalette[PALETTE_DIC_TXT], stdout); - fputs(&QSPY_output.buf[QS_LINE_OFFSET + COL_TSTAMP], stdout); + (void)fputs(l_colorPalette[PALETTE_DIC_TXT], stdout); + (void)fputs(&QSPY_output.buf[QS_LINE_OFFSET + COL_TSTAMP], stdout); break; } case GRP_TST: { /* description section */ ch = QSPY_output.buf[QS_LINE_OFFSET + COL_DESC]; QSPY_output.buf[QS_LINE_OFFSET + COL_DESC] = '\0'; - fputs(l_colorPalette[PALETTE_DSC_TST], stdout); - fputs(&QSPY_output.buf[QS_LINE_OFFSET + COL_TSTAMP], stdout); + (void)fputs(l_colorPalette[PALETTE_DSC_TST], stdout); + (void)fputs(&QSPY_output.buf[QS_LINE_OFFSET + COL_TSTAMP], stdout); QSPY_output.buf[QS_LINE_OFFSET + COL_DESC] = ch; if (QSPY_output.len > COL_DESC) { - fputs(l_colorPalette[PALETTE_TST_TXT], stdout); - fputs(&QSPY_output.buf[QS_LINE_OFFSET + COL_DESC], stdout); + (void)fputs(l_colorPalette[PALETTE_TST_TXT], stdout); + (void)fputs(&QSPY_output.buf[QS_LINE_OFFSET + COL_DESC], stdout); } break; } @@ -973,12 +973,12 @@ static void colorPrintLn(void) { /* description section */ ch = QSPY_output.buf[QS_LINE_OFFSET + COL_DESC]; QSPY_output.buf[QS_LINE_OFFSET + COL_DESC] = '\0'; - fputs(l_colorPalette[PALETTE_DSC_SM], stdout); - fputs(&QSPY_output.buf[QS_LINE_OFFSET + COL_TSTAMP], stdout); + (void)fputs(l_colorPalette[PALETTE_DSC_SM], stdout); + (void)fputs(&QSPY_output.buf[QS_LINE_OFFSET + COL_TSTAMP], stdout); QSPY_output.buf[QS_LINE_OFFSET + COL_DESC] = ch; if (QSPY_output.len > COL_DESC) { - fputs(l_colorPalette[PALETTE_SM_TXT], stdout); - fputs(&QSPY_output.buf[QS_LINE_OFFSET + COL_DESC], stdout); + (void)fputs(l_colorPalette[PALETTE_SM_TXT], stdout); + (void)fputs(&QSPY_output.buf[QS_LINE_OFFSET + COL_DESC], stdout); } break; } @@ -993,42 +993,42 @@ static void colorPrintLn(void) { /* description section */ ch = QSPY_output.buf[QS_LINE_OFFSET + COL_DESC]; QSPY_output.buf[QS_LINE_OFFSET + COL_DESC] = '\0'; - fputs(l_colorPalette[PALETTE_DSC_QP], stdout); - fputs(&QSPY_output.buf[QS_LINE_OFFSET + COL_TSTAMP], stdout); + (void)fputs(l_colorPalette[PALETTE_DSC_QP], stdout); + (void)fputs(&QSPY_output.buf[QS_LINE_OFFSET + COL_TSTAMP], stdout); QSPY_output.buf[QS_LINE_OFFSET + COL_DESC] = ch; if (QSPY_output.len > COL_DESC) { - fputs(l_colorPalette[PALETTE_QP_TXT], stdout); - fputs(&QSPY_output.buf[QS_LINE_OFFSET + COL_DESC], stdout); + (void)fputs(l_colorPalette[PALETTE_QP_TXT], stdout); + (void)fputs(&QSPY_output.buf[QS_LINE_OFFSET + COL_DESC], stdout); } break; } case GRP_USR: /* intentionally fall through */ default: { - fputs(l_colorPalette[PALETTE_USR_TXT], stdout); - fputs(&QSPY_output.buf[QS_LINE_OFFSET + COL_TSTAMP], stdout); + (void)fputs(l_colorPalette[PALETTE_USR_TXT], stdout); + (void)fputs(&QSPY_output.buf[QS_LINE_OFFSET + COL_TSTAMP], stdout); break; } } - fputs(B_DFLT "\n", stdout); + (void)fputs(B_DFLT "\n", stdout); } else if (QSPY_output.type == INF_OUT) { - fputs(l_colorPalette[PALETTE_INF_OUT], stdout); - fputs(&QSPY_output.buf[QS_LINE_OFFSET], stdout); - fputs(B_DFLT_EOL "\n", stdout); + (void)fputs(l_colorPalette[PALETTE_INF_OUT], stdout); + (void)fputs(&QSPY_output.buf[QS_LINE_OFFSET], stdout); + (void)fputs(B_DFLT_EOL "\n", stdout); } else if (QSPY_output.type == ERR_OUT) { - fputs(l_colorPalette[PALETTE_ERR_OUT], stdout); - fputs(&QSPY_output.buf[QS_LINE_OFFSET], stdout); - fputs(B_DFLT_EOL "\n", stdout); + (void)fputs(l_colorPalette[PALETTE_ERR_OUT], stdout); + (void)fputs(&QSPY_output.buf[QS_LINE_OFFSET], stdout); + (void)fputs(B_DFLT_EOL "\n", stdout); } else if (QSPY_output.type == TST_OUT) { - fputs(l_colorPalette[PALETTE_TST_OUT], stdout); - fputs(&QSPY_output.buf[QS_LINE_OFFSET], stdout); - fputs(B_DFLT_EOL "\n", stdout); + (void)fputs(l_colorPalette[PALETTE_TST_OUT], stdout); + (void)fputs(&QSPY_output.buf[QS_LINE_OFFSET], stdout); + (void)fputs(B_DFLT_EOL "\n", stdout); } else { /* USR_OUT */ - fputs(l_colorPalette[PALETTE_USR_OUT], stdout); - fputs(&QSPY_output.buf[QS_LINE_OFFSET], stdout); - fputs(B_DFLT_EOL "\n", stdout); + (void)fputs(l_colorPalette[PALETTE_USR_OUT], stdout); + (void)fputs(&QSPY_output.buf[QS_LINE_OFFSET], stdout); + (void)fputs(B_DFLT_EOL "\n", stdout); } } diff --git a/qspy/source/qspy_seq.c b/qspy/source/qspy_seq.c index de04f28..d831d2a 100644 --- a/qspy/source/qspy_seq.c +++ b/qspy/source/qspy_seq.c @@ -22,8 +22,8 @@ // // //============================================================================ -//! @date Last updated on: 2024-02-23 -//! @version Last updated for version: 7.3.3 +//! @date Last updated on: 2024-06-21 +//! @version Last updated for version: 7.4.0 //! //! @file //! @brief QSPY host utility: sequence diagram generation @@ -42,6 +42,7 @@ enum { static FILE* l_seqFile; static char l_seqList[QS_SEQ_LIST_LEN_MAX]; static char l_seqNames[SEQ_ITEMS_MAX][QS_DNAME_LEN_MAX]; +static char l_seqTokens[QS_SEQ_LIST_LEN_MAX]; static int l_seqNum; static int l_seqLines; static int l_seqSystem; @@ -76,7 +77,7 @@ char const *my_strtok(char *str, char delim) { return token; } /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ -void QSEQ_config(void* seqFile, const char* seqList) { +void QSEQ_config(void* seqFile, char const * seqList) { l_seqFile = (FILE *)seqFile; l_seqNum = 0; l_seqSystem = -1; @@ -84,10 +85,9 @@ void QSEQ_config(void* seqFile, const char* seqList) { STRNCPY_S(l_seqList, sizeof(l_seqList), seqList); /* split the comma-separated 'seqList' into string array l_seqNames[] */ - char seqTokens[QS_SEQ_LIST_LEN_MAX]; /* local mutable copy */ - STRNCPY_S(seqTokens, sizeof(seqTokens), l_seqList); + STRNCPY_S(l_seqTokens, sizeof(l_seqTokens), l_seqList); char const *token; - for (token = my_strtok(seqTokens, ','); + for (token = my_strtok(l_seqTokens, ','); (token != (char*)0) && (l_seqNum < SEQ_ITEMS_MAX); token = my_strtok((char *)0, ','), ++l_seqNum) { @@ -124,7 +124,7 @@ enum { /*..........................................................................*/ void QSEQ_configFile(void* seqFile) { if (l_seqFile != (FILE*)0) { - fclose(l_seqFile); + (void)fclose(l_seqFile); } l_seqFile = (FILE*)seqFile; l_seqLines = 0; @@ -170,12 +170,12 @@ void QSEQ_genHeader(void) { static uint32_t seq_header_len = 0; if (seq_header_len == 0) { /* not initialized yet? */ int n; - int i = 0; + int i; int left_box_edge; char *seq_line = &seq_header[0]; /* clear the whole header */ - for (i = 0; (unsigned)i < sizeof(seq_header); ++i) { + for (i = 0; i < (int)sizeof(seq_header); ++i) { seq_header[i] = ' '; } @@ -235,7 +235,7 @@ void QSEQ_genHeader(void) { if (l_seqLines == 0) { FPRINTF_S(l_seqFile, "-g %s\n\n", l_seqList); } - fwrite(seq_header, 1, seq_header_len, l_seqFile); + (void)fwrite(seq_header, 1, seq_header_len, l_seqFile); l_seqLines += 3; } /*..........................................................................*/ @@ -266,7 +266,8 @@ void QSEQ_genPost(uint32_t tstamp, int src, int dst, char const* sig, int i = 0; int j; - SNPRINTF_S(&seq_line[i], sizeof(seq_line), "%010u", (unsigned)tstamp); + (void)SNPRINTF_S(&seq_line[i], (int)sizeof(seq_line), "%010u", + (unsigned)tstamp); i += 10; for (; i < SEQ_LEFT_OFFSET + (l_seqNum - 1)*SEQ_LANE_WIDTH; ++i) { seq_line[i] = ((i - SEQ_LEFT_OFFSET)%SEQ_LANE_WIDTH) == 0 @@ -297,7 +298,6 @@ void QSEQ_genPost(uint32_t tstamp, int src, int dst, char const* sig, } } else if (src > dst) { - i = SEQ_LEFT_OFFSET + dst*SEQ_LANE_WIDTH; for (i = SEQ_LEFT_OFFSET + dst*SEQ_LANE_WIDTH; i < SEQ_LEFT_OFFSET + src* SEQ_LANE_WIDTH; ++i) { @@ -340,7 +340,7 @@ void QSEQ_genPost(uint32_t tstamp, int src, int dst, char const* sig, } seq_line[SEQ_LEFT_OFFSET + src*SEQ_LANE_WIDTH] = isAttempt ? 'A' : '*'; Q_ASSERT(seq_line_len <= sizeof(seq_line)); - fwrite(seq_line, 1, seq_line_len, l_seqFile); + (void)fwrite(seq_line, 1, seq_line_len, l_seqFile); l_seqLines += 1; } /*..........................................................................*/ @@ -357,7 +357,8 @@ void QSEQ_genPostLIFO(uint32_t tstamp, int src, char const* sig) { int i = 0; int j; - SNPRINTF_S(&seq_line[i], sizeof(seq_line), "%010u", (unsigned)tstamp); + (void)SNPRINTF_S(&seq_line[i], sizeof(seq_line), "%010u", + (unsigned)tstamp); i += 10; for (; i < SEQ_LEFT_OFFSET + (l_seqNum - 1)*SEQ_LANE_WIDTH; ++i) { seq_line[i] = ((i - SEQ_LEFT_OFFSET) % SEQ_LANE_WIDTH) == 0 @@ -388,7 +389,7 @@ void QSEQ_genPostLIFO(uint32_t tstamp, int src, char const* sig) { } seq_line[SEQ_LEFT_OFFSET + src * SEQ_LANE_WIDTH] = '*'; Q_ASSERT(seq_line_len <= sizeof(seq_line)); - fwrite(seq_line, 1, seq_line_len, l_seqFile); + (void)fwrite(seq_line, 1, seq_line_len, l_seqFile); l_seqLines += 1; } /*..........................................................................*/ @@ -411,7 +412,8 @@ void QSEQ_genPublish(uint32_t tstamp, int obj, char const* sig) { int i = 0; int j; - SNPRINTF_S(&seq_line[i], sizeof(seq_line), "%010u", (unsigned)tstamp); + (void)SNPRINTF_S(&seq_line[i], sizeof(seq_line), "%010u", + (unsigned)tstamp); i += 10; for (; i < SEQ_LEFT_OFFSET - SEQ_LANE_WIDTH + SEQ_BOX_WIDTH/2 @@ -449,7 +451,7 @@ void QSEQ_genPublish(uint32_t tstamp, int obj, char const* sig) { } seq_line[SEQ_LEFT_OFFSET + obj * SEQ_LANE_WIDTH] = '*'; Q_ASSERT(seq_line_len <= sizeof(seq_line)); - fwrite(seq_line, 1, seq_line_len, l_seqFile); + (void)fwrite(seq_line, 1, seq_line_len, l_seqFile); l_seqLines += 1; } /*..........................................................................*/ @@ -466,7 +468,8 @@ void QSEQ_genTran(uint32_t tstamp, int obj, char const* state) { int i = 0; int j; - SNPRINTF_S(&seq_line[i], sizeof(seq_line), "%010u", (unsigned)tstamp); + (void)SNPRINTF_S(&seq_line[i], sizeof(seq_line), "%010u", + (unsigned)tstamp); i += 10; for (; i < SEQ_LEFT_OFFSET + (l_seqNum - 1)*SEQ_LANE_WIDTH; ++i) { seq_line[i] = ((i - SEQ_LEFT_OFFSET) % SEQ_LANE_WIDTH) == 0 @@ -476,7 +479,6 @@ void QSEQ_genTran(uint32_t tstamp, int obj, char const* state) { seq_line[i] = '|'; i += 1; seq_line[i] = '\n'; seq_line_len = i + 1; - i = SEQ_LEFT_OFFSET + obj* SEQ_LANE_WIDTH; /* write the state annotation... */ /* 1. scan the "state" string for special char and find its length */ @@ -521,7 +523,7 @@ void QSEQ_genTran(uint32_t tstamp, int obj, char const* state) { seq_line[SEQ_LEFT_OFFSET + l_seqSystem*SEQ_LANE_WIDTH] = '/'; } Q_ASSERT(seq_line_len <= sizeof(seq_line)); - fwrite(seq_line, 1, seq_line_len, l_seqFile); + (void)fwrite(seq_line, 1, seq_line_len, l_seqFile); l_seqLines += 1; } /*..........................................................................*/ @@ -538,7 +540,8 @@ void QSEQ_genAnnotation(uint32_t tstamp, int obj, char const* ann) { int i = 0; int j; - SNPRINTF_S(&seq_line[i], sizeof(seq_line), "%010u", (unsigned)tstamp); + (void)SNPRINTF_S(&seq_line[i], sizeof(seq_line), "%010u", + (unsigned)tstamp); i += 10; for (; i < SEQ_LEFT_OFFSET + (l_seqNum - 1)*SEQ_LANE_WIDTH; ++i) { seq_line[i] = ((i - SEQ_LEFT_OFFSET)%SEQ_LANE_WIDTH) == 0 @@ -548,7 +551,6 @@ void QSEQ_genAnnotation(uint32_t tstamp, int obj, char const* ann) { seq_line[i] = '|'; i += 1; seq_line[i] = '\n'; seq_line_len = i + 1; - i = SEQ_LEFT_OFFSET + obj*SEQ_LANE_WIDTH; /* write the annotation */ int len = (int)strlen(ann); if (len > SEQ_LABEL_MAX) { @@ -569,7 +571,7 @@ void QSEQ_genAnnotation(uint32_t tstamp, int obj, char const* ann) { seq_line[SEQ_LEFT_OFFSET + l_seqSystem*SEQ_LANE_WIDTH] = '/'; } Q_ASSERT(seq_line_len <= sizeof(seq_line)); - fwrite(seq_line, 1, seq_line_len, l_seqFile); + (void)fwrite(seq_line, 1, seq_line_len, l_seqFile); l_seqLines += 1; } /*..........................................................................*/ @@ -585,7 +587,7 @@ void QSEQ_genTick(uint32_t rate, uint32_t nTick) { uint32_t seq_line_len; int i = 0; - SNPRINTF_S(&seq_line[i], sizeof(seq_line), + (void)SNPRINTF_S(&seq_line[i], sizeof(seq_line), "########## Tick<%1u> Ctr=%010u", (unsigned)rate, (unsigned)nTick); i += 34; @@ -603,7 +605,7 @@ void QSEQ_genTick(uint32_t rate, uint32_t nTick) { seq_line[i] = '\n'; seq_line_len = i + 1; Q_ASSERT(seq_line_len <= sizeof(seq_line)); - fwrite(seq_line, 1, seq_line_len, l_seqFile); + (void)fwrite(seq_line, 1, seq_line_len, l_seqFile); l_seqLines += 1; } diff --git a/qspy/source/qspy_tx.c b/qspy/source/qspy_tx.c index 42f3d78..2343e37 100644 --- a/qspy/source/qspy_tx.c +++ b/qspy/source/qspy_tx.c @@ -82,7 +82,7 @@ uint32_t QSPY_encode(uint8_t *dstBuf, uint32_t dstSize, /* supply the sequence number */ ++l_txTargetSeq; uint8_t b = l_txTargetSeq; - QSPY_INSERT_ESC_BYTE(b); /* insert esceped sequence */ + QSPY_INSERT_ESC_BYTE(b); /* insert escaped sequence */ for (; srcBytes > 0U; ++src, --srcBytes) { b = *src; diff --git a/qspy/win32/qspy.vcxproj b/qspy/win32/qspy.vcxproj index cdd724c..6bc4884 100644 --- a/qspy/win32/qspy.vcxproj +++ b/qspy/win32/qspy.vcxproj @@ -77,6 +77,7 @@ QSPY_APP;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true ../include + stdc11 Console @@ -93,6 +94,7 @@ QSPY_APP;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true ../include + stdc11 Console diff --git a/qutest/qutest.py b/qutest/qutest.py index e1c7fc9..611883c 100644 --- a/qutest/qutest.py +++ b/qutest/qutest.py @@ -57,7 +57,7 @@ class QUTest: # public class constants - VERSION = 734 + VERSION = 740 TIMEOUT = 1.000 # timeout value [seconds] # private class variables @@ -126,15 +126,16 @@ def __init__(self): self._is_inter = False self._test_fname = "" self._test_dname = "" + self._context = Context_() # The following _dsl_dict dictionary defines the QUTest testing # DSL (Domain Specific Language), which is documented separately # in the file "qutest_dsl.py". # self._dsl_dict = { + "required": self.required, "include": self.include, "test": self.test, - "scenario": self.test, # alias for 'test' for BDD "skip": self.skip, "expect": self.expect, "glb_filter": self.glb_filter, @@ -157,7 +158,10 @@ def __init__(self): "poke": self.poke, "fill": self.fill, "note": self.note, - "tag": self.note, # alias for 'note' for BDD + "scenario": scenario, # for BDD + "given": given, # for BDD + "when": when, # for BDD + "then": then, # for BDD "pack": struct.pack, "test_file": self._test_fname, "test_dir": self._test_dname, @@ -266,6 +270,11 @@ def test(self, title, opt=0): self._fail("on_setup() failed") return + # SCENARIO DSL command ....................................................... + def SCENARIO(self, title="", opt=0): + self.context = Context_() # reset the context + self.test(f"SCENARIO: {title}", opt) + # expect DSL command ..................................................... def expect(self, exp, ignore=False): if self._to_skip > 0: @@ -749,6 +758,13 @@ def skip(self, n_tests = 9999): if self._to_skip == 0: # not skipping already? self._to_skip = n_tests + # required DSL command .................................................... + def required(self, cond, msg = ""): + if not cond: + self.note(msg) + QUTest_inst._fail() + raise ExitOnFailException + # include DSL command .................................................... def include(self, fname): path = os.path.normcase(os.path.join(self._test_dname, fname)) @@ -779,6 +795,22 @@ def note(self, msg, dest=0x3): if (dest & QUTest._OPT_TRACE) != 0: QSpy.qspy_show(msg, kind=0x0) + # GIVEN DSL command ..................................................... + def GIVEN(self, msg="", dest=0x3): + self.note(f"\n GIVEN: {msg}") + + # WHEN DSL command ..................................................... + def WHEN(self, msg="", dest=0x3): + self.note(f" WHEN: {msg}") + + # THEN DSL command ..................................................... + def THEN(self, msg="", dest=0x3): + self.note(f" THEN: {msg}") + + # AND DSL command ..................................................... + def AND(self, msg="", dest=0x3): + self.note(f" AND: {msg}") + # dummy callbacks -------------------------------------------------------- def _dummy_on_reset(self): #print("_dummy_on_reset") @@ -800,6 +832,7 @@ def _run_script(fname): with open(fname, encoding="utf-8") as script_file: # pylint: disable=protected-access + global QUTest_inst QUTest_inst = QUTest() QUTest_inst._test_fname = fname QUTest_inst._test_dname = os.path.dirname(fname) @@ -1050,6 +1083,89 @@ def display(msg, color1='', color2='', eol=True): else: print(msg, end='') +#============================================================================= +# BDD support... + +class Context_: + pass + +class scenario: + def __init__(self, title, opt=0): + self.title = title + self.opt = opt + + def __call__(self, action): + def wrapper(): + pass + + QUTest_inst.test(f"Scenario: {self.title}", self.opt) + QUTest_inst._context = action(Context_()) # clear the context! + return wrapper + +class given: + def __init__(self, *msgs): + self.msgs = msgs + + def __call__(self, action): + def wrapper(): + pass + + global QUTest_inst + if QUTest_inst._state == QUTest._SKIP: + return wrapper + + if len(self.msgs) > 0: + QUTest_inst.note(f"\n Given: {self.msgs[0]}") + for msg in self.msgs[1:]: + QUTest_inst.note(f" And: {msg}") + else: + QUTest_inst.note("\n Given:") + QUTest_inst._context = action(QUTest_inst._context) + return wrapper + +class when: + def __init__(self, *msgs): + self.msgs = msgs + + def __call__(self, action): + def wrapper(): + pass + + global QUTest_inst + if QUTest_inst._state == QUTest._SKIP: + return wrapper + + if len(self.msgs) > 0: + QUTest_inst.note(f" When: {self.msgs[0]}") + for msg in self.msgs[1:]: + QUTest_inst.note(f" And: {msg}") + else: + QUTest_inst.note(" When:") + action(QUTest_inst._context) + return wrapper + +class then: + def __init__(self, *msgs): + self.msgs = msgs + + def __call__(self, action): + def wrapper(): + pass + + global QUTest_inst + if QUTest_inst._state == QUTest._SKIP: + return wrapper + + if len(self.msgs) > 0: + QUTest_inst.note(f" Then: {self.msgs[0]}") + for msg in self.msgs[1:]: + QUTest_inst.note(f" And: {msg}") + else: + QUTest_inst.note(" Then:") + action(QUTest_inst._context) + return wrapper + +#============================================================================= class ExitOnFailException(Exception): # test failed and exit-on-fail (-x) is set pass diff --git a/qutest/qutest_dsl.py b/qutest/qutest_dsl.py deleted file mode 100644 index db07069..0000000 --- a/qutest/qutest_dsl.py +++ /dev/null @@ -1,669 +0,0 @@ -#============================================================================= -# QUTest Python scripting support -# Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved. -# -# SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial -# -# This software is dual-licensed under the terms of the open source GNU -# General Public License version 3 (or any later version), or alternatively, -# under the terms of one of the closed source Quantum Leaps commercial -# licenses. -# -# The terms of the open source GNU General Public License version 3 -# can be found at: -# -# The terms of the closed source Quantum Leaps commercial licenses -# can be found at: -# -# Redistributions in source code must retain this top-level comment block. -# Plagiarizing this software to sidestep the license obligations is illegal. -# -# Contact information: -# -# -#============================================================================= -## -# @date Last updated on: 2023-12-19 -# @version Last updated for version: 7.3.2 -# -# @file -# @brief QUTest Python scripting support (documentation) - -## @brief current version of the Python QUTest interface -VERSION = 732 - -## @brief include python code in a test script -# @description -# This @ref qutest_dsl-preamble "preamble command" includes python code -# in a specified file into the test script. The included file can contain -# any code that you would put into test scripts (see Example below). -# -# @param[in] fname name of the file to include. May contain a path -# **relative** to the test script. -# -# @usage -# @code{py} -# include("test_include.pyi") # file in the same directory as the script -# ~ ~ ~ -# include("../my_include/test_include.pyi") # relative directory -# @endcode -# -# __Example__
-# file to be included:
-# @include inc_file.py -# -# test script calling `include()`:
-# @include inc_test.py -# -def include(fname): - -## @brief get the test file name with path -# @description -# This command returns a string containing the file name of the currently -# executed test script ("test group"). -# -# @usage -# @code{py} -# file_name = test_file() -# @endcode -def test_file(): - -## @brief get the test directory (relative to the current directory) -# @description -# This @ref qutest_complex "complex command" returns a string containing -# the directory name of the currently executed test script ("test group"). -# -# @usage -# @code{py} -# dir_name = test_dir() -# @endcode -def test_dir(): - -## @brief start a new test -# @description -# This @ref qutest_complex "complex command" starts a new test -# and gives it a name. -# -# @param[in] title title of the test -# @param[in] opt options {0=default, NORESET} -# -# @usage -# @code{py} -# test("my first test") # test with title and with full target reset -# ~ ~ ~ -# test("my second test", NORESET) # test without target reset -# ~ ~ ~ -# @endcode -# -# @sa skip() -# -def test(title, opt=0): - -## @brief start a new scenario -# @description -# This is an alias for the test() command for the BDD-style -# testing. -# -def scenario(title, opt=0): - -## @brief skip the tests following this command. -# -# @param[in] nTests number of tests to skip (default-all remaining tests) -# e.g., skip(1) will skip one test following this command. -# @note -# The skipped tests are not executed, but they **are** checked for syntax -# errors, such as commands and parameters coded in the skipped tests. -# -# @usage -# @code{py} -# test("my first test") -# ~ ~ ~ -# skip(1) # skip one subsequent test -# test("my second test") -# ~ ~ ~ -# skip() # skip all subsequent tests -# test("my second test") -# ~ ~ ~ -# @endcode -# -# @sa -# test() -# -def skip(nTests=9999): - -## @brief defines an expectation for the current test -# -# @description -# This command defines a new expecation for the textual output produced -# by QSPY. -# -# @param[in] match the expected match for the QSPY output -# The @p match string can contain special characters, such as: -# `*`, `?` and `[chars]`, which are matched according to the -# Python command -# [fnmatch.fnmatchcase()](https://docs.python.org/2/library/fnmatch.html) -# @note -# The @p match string can be the -# [printf-style %-subsitution string](https://docs.python.org/2/library/stdtypes.html#string-formatting-operations) -# (compatible with Python 2 and Python 3), or the new -# ["f-string"](https://realpython.com/python-f-strings/) -# (compatible only with Python 3). -# -# @note -# The special string "@timestamp" (or "%timestamp") at the beginning -# of the @p match parameter will be automatically replaced with the current -# numerical value of the test sequence-counter. -# -# @usage -# @include expect.py -# -def expect(match): - -## @brief ensures that the provided Boolean expression is true -# -# @description -# This command performs checking of a condition, which is believed to be true -# in order for a test to pass. If the provided Boolean expression evaluates -# to false, the test is failed in the usual way. -# -# @param[in] bool_expr the Boolean expression to check -# -# @usage -# @include ensure.py -# -def ensure(bool_expr): - -## @brief Send the QS Global Filter to the Target -# -# @description -# This @ref qutest_simple "simple command" sends the complete -# @ref qs_global "QS Global Filter" to the Target. -# Any existing Global Filter setting inside the Target will be overwritten. -# -# @param[in] args list of Record-Type groups or individual Record-Types -# to set or clear. A given filter-group or an individual filter is set when -# it is positive, and cleared with it is preceded with the minus (`-`) sign. -#
-# The filter list can contain the following: -# @code{py} -# GRP_ALL # all Record-Types -# GRP_SM # State Machine Record-Types -# GRP_AO # Active Object Record-Types -# GRP_MP # Memory Pool Record-Types -# GRP_EQ # Event Queue Record-Types -# GRP_TE # Time Events Record-Types -# GRP_QF # Framework Record-Types (e.g., post/publish/..) -# GRP_SC # Scheduler Record-Types (e.g., scheduler lock/unlock) -# GRP_SEM # Semaphore Record-Types (e.g., Semaphore take/signal) -# GRP_MTX # Mutex Record-Types (e.g., Mutex lock/unlock) -# GRP_U0 # User group 0 (Record-Types 100-104) -# GRP_U1 # User group 1 (Record-Types 105-109) -# GRP_U2 # User group 2 (Record-Types 110-114) -# GRP_U3 # User group 3 (Record-Types 115-119) -# GRP_U4 # User group 0 (Record-Types 120-124) -# GRP_UA # All user records (Record-Types 100-124) -# # Specific QS trace Record-Type in the range 0..127 -# @endcode -# -# @returns -# The 128-bit filter bitmask sent to the target. For each enabled filter -# with the QS record-ID `recID` the bitmask has a '1' in the position -# (`1 << recID`). -# -# @usage -# @include glb_filter.py -# -# @sa -# loc_filter() -# -def glb_filter(*args): - -## @brief Send the Local Filter to the Target -# -# @description -# This @ref qutest_simple "simple command" sends the complete -# @ref qs_local "QS Local Filter" to the Target. -# Any existing Local Filter setting inside the Target will be overwritten. -# -# @param[in] args list of QS-ID groups or individual QS-IDs to set or clear. -# A given filter-group or an individual filter is set when it is positive, and -# cleared with it is preceded with the minus (`-`) sign.
-# -# This parameter can take one of the following values: -# @code{py} -# IDS_ALL # all QS-IDs -# IDS_AO # Active Object QS-IDs (1..64) -# IDS_EP # Event Pool QS-IDs (65-80) -# IDS_EQ # Event Queue QS-IDs (81-96) -# IDS_AP # Application-Specific QS-IDs (97-127) -# @endcode -# -# @returns -# The 128-bit filter bitmask sent to the target. For each enabled filter -# with the QS-ID `qsID` the bitmask has a '1' in the position -# (`1 << qsID`). -# -# @usage -# @include loc_filter.py -# -# @sa -# glb_filter() -# -def loc_filter(*args): - -## @brief Updates the Local Filter for a given AO in the Target -# -# @description -# This @ref qutest_simple "simple command" sets or clears the -# @ref qs_local "QS Local Filter" corresponding to the given AO in the Target. -# Unlike loc_filter(), this facility changes **only** the QS-ID -# (AO's priority) of the given AO in the Target. -# All other Local Filters will be left unchanged. -# -# @param[in] obj_id active object to set/clear the local filter -# for in the Target
-# -# This parameter can be either a string (name of the AO) or the AO's priority. -# Also, it can be either positive (to set) or negative (to clear) the QS -# local filter. -# -# @usage -# @include ao_filter.py -# -# @sa -# loc_filter() -# -def ao_filter(obj_id): - -## @brief Set the Current-Object in the Target -# -# @description -# This @ref qutest_simple "simple command" sets the "current object" -# in the Target. -# -# @param[in] obj_kind Kind of object to set
-# -# This parameter can take one of the following values: -# @code{py} -# OBJ_SM # State Machine object -# OBJ_AO # Active Object object -# OBJ_MP # Memory Pool object -# OBJ_EQ # Event Queue object -# OBJ_TE # Time Event object -# OBJ_AP # Application-Specific object -# OBJ_SM_AO # Both, State Machine and Active Object -# @endcode -# -# @param[in] obj_id Name or addres of the object -# -# @usage -# @include current_obj.py -# -# @sa -# - query_curr() -# - init() -# - dispatch() -# -def current_obj(obj_kind, obj_id): - -## @brief query the @ref current_obj() "current object" in the Target -# -# @description -# This @ref qutest_complex "complex command" queries the current object -# in the Target. -# -# @param[in] obj_kind Kind of object to query -# -# This parameter can take one of the following values: -# @code{py} -# OBJ_SM # State Machine object -# OBJ_AO # Active Object object -# OBJ_MP # Memory Pool object -# OBJ_EQ # Event Queue object -# OBJ_TE # Time Event object -# @endcode -# -# @usage -# The queries for various objects generate the following QS trace records -# from the Target -# @code{py} -# query_curr(OBJ_SM) -# "@timestamp Query-SM Obj=,State=" -# query_curr(OBJ_AO) -# "@timestamp Query-AO Obj=,Queue,Min=>" -# query_curr(OBJ_EQ) -# "@timestamp Query-EQ Obj=,Queue,Min=>" -# query_curr(OBJ_MP) -# "@timestamp Query-MP Obj=,Free=,Min=" -# query_curr(OBJ_TE) -# "@timestamp Query-TE Obj=,Rate=,Sig=,Tim=,Int=,Flags=" -# @endcode -# -# @sa -# current_obj() -# -def query_curr(obj_kind): - -## @brief trigger system clock tick in the Target -# -# @description -# This @ref qutest_complex "complex command" triggers the following actions -# in the Target:
-# 1. If the @ref current_obj() "current TE object" is defined and -# the TE is armed, the TE is disarmed (if one-shot) and then -# posted to the recipient AO. -# 2. The linked-list of all armed Time Events is updated. -# -# @param[in] tick_rate the tick rate (0..QF_MAX_TICK_RATE) -# -# @usage -# @include tick.py -# -# @sa -# current_obj() -# -def tick(tick_rate=0): - -## @brief defines expectation for a Test Pause -# -# @description -# This is a special expectation that must match the macro -# QS_TEST_PAUSE() inside the test fixture. -# -# @note -# If QS_TEST_PAUSE() is called before QF_run(), the `expect_pause()` -# expectation must be placed in the on_reset() callback. -# -# @usage -# @include expect_pause.py -# -# @sa -# continue_test() -# -def expect_pause(): - -## @brief defines expectation for calling QF_run()/QF::run() -# -# @description -# This is a special expectation for the target calling the QF_run()/QF::run() -# function. -# -# @note -# This expectation must be placed at the right place in the -# on_reset() callback. -# -# @usage -# @include expect_run.py -# -# @sa -# on_reset() -# -def expect_run(): - -## @brief sends the CONTINUE packet to the Target to continue a test -# -# @description -# This command continues the test after QS_TEST_PAUSE(). -# -# @usage -# @include continue_test.py -# -# @sa -# expect_pause() -# -def continue_test(): - -## @brief executes a given command in the Target -# @description -# This @ref qutest_complex "complex command" causes execution of the -# @ref QS_rx::QS_onCommand() "QS_onCommand()" callback in the test fixture. -# -# @param[in] cmdId the first `cmdId` argument for the -# @ref QS_rx::QS_onCommand() "QS_onCommand()" callback -# function in the test fixture. -# @note -# The `cmdId` parameter could be either the raw number or a name -# that is delivered by QS_ENUM_DICTIONARY(enum, group), where the -# second `group` argument is ::QS_CMD (numerical value 7). -# -# @param[in] param1 the "param1" argument to `QS_onCommand()` (optional) -# @param[in] param2 the "param2" argument to `QS_onCommand()` (optional) -# @param[in] param3 the "param3" argument to `QS_onCommand()` (optional) -# -# @usage -# @include command.py -# -def command(cmdId, param1=0, param2=0, param3=0): - -## @brief take the top-most initial transition in the -# current SM object in the Target -# -# @description -# This command takes the top-most initial transition in the -# @ref current_obj() "current SM object" in the Target. -# -# @param[in] signal the event signal of the "initialization event" -# @param[in] params the parameters of the "initialization event" -# -# @usage -# @code{py} -# init() -# init("MY_SIG") -# init("MY_SIG", pack("