diff options
| author | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-12-20 23:01:54 +0900 |
|---|---|---|
| committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-12-22 11:50:09 +0900 |
| commit | 112ca8677b9b024de5529712e559c968da40a67a (patch) | |
| tree | a8e93a0b05d61aeaab1dab3288c5fc518cdd05c6 /debian/uncrustify-trinity/uncrustify-trinity-0.72.0/src/log_rules.cpp | |
| parent | b37f44d6c7444ca20c48a07fdcaf7b2a812db5bd (diff) | |
| download | extra-dependencies-112ca8677b9b024de5529712e559c968da40a67a.tar.gz extra-dependencies-112ca8677b9b024de5529712e559c968da40a67a.zip | |
DEB uncrustify: added first version of uncrustify-trinity. This is basically the upstream 0.72.0 version of uncrustify, repackaged.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'debian/uncrustify-trinity/uncrustify-trinity-0.72.0/src/log_rules.cpp')
| -rw-r--r-- | debian/uncrustify-trinity/uncrustify-trinity-0.72.0/src/log_rules.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/src/log_rules.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/src/log_rules.cpp new file mode 100644 index 00000000..eead7924 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/src/log_rules.cpp @@ -0,0 +1,62 @@ +/** + * @file log_rules.cpp + * is an extract from space.cpp + * + * @author Guy Maurel + * @license GPL v2+ + */ + +#include "log_rules.h" +#include <string.h> + + +void log_rule2(const char *func, size_t line, const char *rule, chunk_t *first, chunk_t *second) +{ + LOG_FUNC_ENTRY(); + + if (second->type != CT_NEWLINE) + { + LOG_FMT(LSPACE, "%s(%zu): first->orig_line is %zu, first->orig_col is %zu, first->text() is '%s', [%s/%s] <===>\n", + func, line, first->orig_line, first->orig_col, first->text(), + get_token_name(first->type), get_token_name(get_chunk_parent_type(first))); + LOG_FMT(LSPACE, " second->orig_line is %zu, second->orig_col is %zu, second->text() '%s', [%s/%s] : rule %s[line %zu]\n", + second->orig_line, second->orig_col, second->text(), + get_token_name(second->type), get_token_name(get_chunk_parent_type(second)), + rule, line); + } +} + + +void log_rule3(const char *func, const char *rule) +{ + const char *where = nullptr; + +#ifdef WIN32 + // some Windows provide "ABC::XYZ::function_Name" as __func__ + // we look for the last ':' character + // a function rindex cannot be found + size_t length_of_string = strlen(func); + + for (int which = length_of_string - 1; which > 0; which--) + { + char oneChar = func[which]; + + if (oneChar == ':') + { + where = func + which; + break; + } + } +#else // not WIN32 + where = rindex(func, ':'); +#endif /* ifdef WIN32 */ + + if (where == nullptr) + { + LOG_FMT(LSPACE, "log_rule(%s): rule is '%s'\n", func, rule); + } + else + { + LOG_FMT(LSPACE, "log_rule(%s): rule is '%s'\n", where + 1, rule); + } +} |
