-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
log: improve logging by impelementing a string formatter
The strutils now provides the `strformat` routine that can format a string with parameters passed on the stack. Thanks to it, we can simplify other components when it comes to logging messages.
- Loading branch information
Showing
7 changed files
with
188 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,42 @@ | ||
; SPDX-FileCopyrightText: 2023 Zeal 8-bit Computer <[email protected]> | ||
; SPDX-FileCopyrightText: 2023-2024 Zeal 8-bit Computer <[email protected]> | ||
; | ||
; SPDX-License-Identifier: Apache-2.0 | ||
|
||
IFNDEF STRUTILS_H | ||
DEFINE STRUTILS_H | ||
IFNDEF STRUTILS_H | ||
DEFINE STRUTILS_H | ||
|
||
; Public routines. The descriptions are given in the implementation file. | ||
EXTERN strltrim | ||
EXTERN strrtrim | ||
EXTERN strcmp | ||
EXTERN strchrnul | ||
EXTERN strncmp | ||
EXTERN memsep | ||
EXTERN strsep | ||
EXTERN strlen | ||
EXTERN strcpy | ||
EXTERN strcpy_unsaved | ||
EXTERN strncpy | ||
EXTERN strncat | ||
EXTERN strtolower | ||
EXTERN strtoupper | ||
EXTERN parse_int | ||
EXTERN parse_hex | ||
EXTERN parse_dec | ||
EXTERN is_print | ||
EXTERN is_alpha_numeric | ||
EXTERN is_digit | ||
EXTERN to_lower | ||
EXTERN to_upper | ||
EXTERN byte_to_ascii | ||
DEFC FORMAT_SPECIFIER = 0x80 | ||
DEFC FORMAT_SPECIFIER_MASK = 0xf | ||
|
||
ENDIF ; STRUTILS_H | ||
; Replace with 4 characters (char array) | ||
DEFC FORMAT_4_CHAR = FORMAT_SPECIFIER | 0 | (4 << 4) | ||
DEFC FORMAT_STRING = FORMAT_SPECIFIER | 1 | ||
DEFC FORMAT_U8_HEX = FORMAT_SPECIFIER | 2 | ||
DEFC FORMAT_CHAR = FORMAT_SPECIFIER | 3 | ||
|
||
; Public routines. The descriptions are given in the implementation file. | ||
EXTERN strformat | ||
EXTERN strltrim | ||
EXTERN strcmp | ||
EXTERN strchrnul | ||
EXTERN strncmp | ||
EXTERN memsep | ||
EXTERN strsep | ||
EXTERN strlen | ||
EXTERN strcpy | ||
EXTERN strcpy_unsaved | ||
EXTERN strncpy | ||
EXTERN strncat | ||
EXTERN strtolower | ||
EXTERN strtoupper | ||
EXTERN parse_int | ||
EXTERN parse_hex | ||
EXTERN parse_dec | ||
EXTERN is_print | ||
EXTERN is_alpha_numeric | ||
EXTERN is_digit | ||
EXTERN to_lower | ||
EXTERN to_upper | ||
EXTERN byte_to_ascii | ||
|
||
ENDIF ; STRUTILS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.