Commit Graph

25 Commits

Author SHA1 Message Date
Martin Pulec
c3b19d25da removed needless check/store of vsnprintf ret 2023-04-12 12:52:08 +02:00
Martin Pulec
602095e38a fixed some further snprintf warns
fixes warnings with Xcode 14.3 as in previous commit

+ allocate +1 in Log_output buffer - snprintf(MULL, 0...) returns number
  of bytes without terminating '\0'. std::string storage isn't guaranteed
  to be NULL-terminated (std::string("").at(0) throws an exception). The
  buffer is somewhere preallocated 256 which prevents problem but it's
  better not to rely upon it.
+ comment out some unused function in LDGM that also triggered the
  warning but looked a bit suspicious so it was not clear how to fix
2023-04-12 12:52:07 +02:00
Martin Pulec
579389cebc tool/convert: compilation fixes
- moved macros to utils/macros.h (not config_common.h that is not going
  to be included) and include in config_common.h the macros.h file
  instead (later it should be removed)
- avoid dependency of color_out.o on host.o if build outside UG (easiest
  for now)
- compile tools with '-g' (obviously for better debuggability)
2022-11-22 10:34:37 +01:00
Martin Pulec
eae114cf6d color_out.cpp: missing include <memory> 2022-10-13 10:34:41 +02:00
Martin Pulec
17056959f6 dummy: documentation
+ added indent_paragraph function
2022-10-13 09:16:07 +02:00
Martin Pulec
8a69aa54fb color_out_init: check if the output is terminal
In Windows, if output is not MSYS, check if output is a terminal and do
not relay on setWinTermAnsiColors() returning true.

+ check for MSYS terminal first (avoids attempt to set ansi color on
  MSYS terminal)

refers to #256
2022-10-03 08:59:08 +02:00
Martin Piatka
7e27491a2b logging: log_vprintf: prune ansi sequences when not interactive
Previously colored output using the inline TERM_* macros from color_out.h was
done only using the color_printf() function. Since there are now places
where they are used with log_msg(), we need to prune ansi codes here
too.
2022-09-27 14:12:18 +02:00
Martin Piatka
7b23d63a72 color_out: Add param log-nocolor to force disable ANSI codes 2022-09-27 13:26:53 +02:00
Martin Pulec
faa1afb720 added some missing includes
Added includes that are missing if config.h was not included.
2022-08-17 17:27:43 +02:00
Martin Pulec
e15e0f9cb9 color_out: removed isMsysPty from API
no longer used outside color_out.cpp
2022-08-17 17:24:35 +02:00
Martin Pulec
95b851eecb replaced \e with \033
'\e' is not standard C, see:
https://stackoverflow.com/questions/63255838/how-can-i-fix-warning-c4129-e-unrecognized-character-escape-sequence/63255920#63255920
2022-08-10 17:01:31 +02:00
Martin Pulec
6bbe8c4228 removed color_out function 2022-08-10 08:14:07 +02:00
Martin Pulec
812bcbfc78 logger: remove ANSI seqences if not terminal
This allows use of raw ANSI sequences instead of the rang stuff.
2022-08-10 08:14:07 +02:00
Martin Pulec
7719e8aa47 logger: get rid of rang references 2022-08-10 08:14:07 +02:00
Martin Pulec
d84b375165 color_out: removed color_stderr 2022-08-10 08:14:06 +02:00
Martin Piatka
c20b41dd2d color_out: simplify style resetting
The reset code seems to reset everything including boldness and colors,
so no need to reset each individually
2022-08-03 10:43:44 +02:00
Martin Piatka
e6d1a36409 color_out: output using Log_output
This makes the color functions work correctly when used together with
other log functions (will not overwrite the "Last msg repeated", etc.)
2022-08-03 10:43:43 +02:00
Martin Pulec
d8e9f5bd5c Set _IONBF for stdout in MSYS term
This partially reverts d4775e37 which changed the output buffering from
_IONBF to _IOLBF.
2022-07-27 09:05:55 +02:00
Martin Pulec
9e10a385b6 color_out: new API
Use inline ANSI escape sequences instead of modifiers.

This allows more convenient formatting without the need to use multiple
calls (possibly interleaving).

ANSI escape sequences are nowadays supported also in Windows terminals
(PS, cmd).
2022-07-27 09:05:55 +02:00
Martin Pulec
26f85aee9d color_out: support for background color + more cols
+ do not use std::flush at the end of stream
2022-06-30 16:41:40 +02:00
Martin Pulec
1b3b27eb7c Updated copyright dates for modified files 2021-11-08 15:43:14 +01:00
Martin Piatka
eab94c12c0 Remove some unused includes
Removes some unused includes reported by include-what-you-use
2021-06-08 15:22:25 +02:00
Martin Pulec
5f0ce56dc2 Color_out: flush output
Prevent interleaving formatting ESC sequences with different streams
when not flushed.
2019-11-21 13:48:06 +01:00
Martin Pulec
31d9809fcd Updated documentation
Updated authors, copyright to 3-clause BSD (where possible) and file-level Doxygen
2019-11-09 13:47:11 +01:00
Martin Pulec
f59c0aa87b Added a simple C rang wrapper 2018-12-17 10:58:03 +01:00