Skip to content

Commit

Permalink
Split reference in several pages
Browse files Browse the repository at this point in the history
  • Loading branch information
agagniere committed Sep 1, 2024
1 parent 6ceb5a1 commit 32982fd
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 15 deletions.
1 change: 1 addition & 0 deletions book/Doxyfile.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ QT_AUTOBRIEF = YES
HIDE_UNDOC_MEMBERS = YES
HIDE_UNDOC_CLASSES = YES
MAX_INITIALIZER_LINES = 0
PREDEFINED = LOG_LEVEL=LOG_LEVEL_TRACE
2 changes: 1 addition & 1 deletion book/pages/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ Black Magic
04_default
05_range
quotes
reference
reference/index
6 changes: 6 additions & 0 deletions book/pages/reference/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Reference

:::{toctree}
token
log
:::
4 changes: 4 additions & 0 deletions book/pages/reference/log.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Logging Library

:::{doxygenfile} log.h
:::
8 changes: 4 additions & 4 deletions book/pages/reference.md → book/pages/reference/token.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Reference
# Token manipulation

## Token manipulation
## Create a string literal

### Create a string literal
:::{doxygendefine} LITERAL_STRINGIZE
:::
:::{doxygendefine} STRINGIZE
:::

### Combine tokens
## Combine tokens

:::{doxygendefine} LITERAL_CONCAT
:::
:::{doxygendefine} CONCAT
Expand Down
50 changes: 42 additions & 8 deletions include/blackmagic/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,53 @@
LEVEL, __func__ __VA_OPT__(,) __VA_ARGS__)
#elif LOG_FORMAT == LOG_FORMAT_MARKDOWN
# define log_log(LEVEL, IGNORED, MESSAGE, ...) \
fprintf(LOG_FILE, "|" LEVEL "|`" __FILE__ "`|`%s`|" STRINGIZE(__LINE__) "|" MESSAGE "\n", \
fprintf(LOG_FILE, "|" LEVEL "|`" __FILE__ "`|`%s`|" STRINGIZE(__LINE__) "|" MESSAGE "|\n", \
__func__ __VA_OPT__(,) __VA_ARGS__)
#endif

#define log_fatal(MESSAGE, ...) \
#if LOG_LEVEL >= LOG_LEVEL_FATAL
/** Report a condition that forces to program to terminate */
# define log_fatal(MESSAGE, ...) \
log_log("FATAL", COLOR(BOLD, WHITE, BG_RED), MESSAGE __VA_OPT__(,) __VA_ARGS__)
#define log_error(MESSAGE, ...) \
#else
# define log_fatal(M, ...)
#endif

#if LOG_LEVEL >= LOG_LEVEL_ERROR
/** Report a condition that forces the current operation to be aborted */
# define log_error(MESSAGE, ...) \
log_log("ERROR", COLOR(BOLD, RED), MESSAGE __VA_OPT__(,) __VA_ARGS__)
#define log_warning(MESSAGE, ...) \
#else
# define log_error(M, ...)
#endif


#if LOG_LEVEL >= LOG_LEVEL_WARNING
/** Report an abnormal condition */
# define log_warning(MESSAGE, ...) \
log_log("WARN", COLOR(BOLD, YELLOW), MESSAGE __VA_OPT__(,) __VA_ARGS__)
#define log_info(MESSAGE, ...) \
#else
# define log_warning(M, ...)
#endif

#if LOG_LEVEL >= LOG_LEVEL_INFO
/** Report significant information */
# define log_info(MESSAGE, ...) \
log_log("INFO", COLOR(BOLD, GREEN), MESSAGE __VA_OPT__(,) __VA_ARGS__)
#define log_debug(MESSAGE, ...) \
#else
# define log_info(M, ...)
#endif

#if LOG_LEVEL >= LOG_LEVEL_DEBUG
# define log_debug(MESSAGE, ...) \
log_log("DEBUG", COLOR(BOLD, BLUE), MESSAGE __VA_OPT__(,) __VA_ARGS__)
#define log_trace(MESSAGE, ...) \
log_log("DEBUG", COLOR(NORMAL), MESSAGE __VA_OPT__(,) __VA_ARGS__)
#else
# define log_debug(M, ...)
#endif

#if LOG_LEVEL >= LOG_LEVEL_TRACE
# define log_trace(MESSAGE, ...) \
log_log("TRACE", COLOR(NORMAL), MESSAGE __VA_OPT__(,) __VA_ARGS__)
#else
# define log_trace(M, ...)
#endif
6 changes: 4 additions & 2 deletions include/blackmagic/token.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

/**
* Evaluates as a string literal containing @p TEXT, without performing macro expansion.
* # Example
*
* __Example__
* ```
* LITERAL_STRINGIZE(__LINE__)
* ```
Expand All @@ -22,7 +23,8 @@

/**
* Evaluates as a string literal containing @p EXPRESSION with its macros expanded.
* # Example
*
* __Example__
* ```
* STRINGIZE(__LINE__)
* ```
Expand Down

0 comments on commit 32982fd

Please sign in to comment.