diff options
| author | Mel <mel@rnrd.eu> | 2026-01-22 03:55:02 +0100 |
|---|---|---|
| committer | Mel <mel@rnrd.eu> | 2026-01-22 03:55:02 +0100 |
| commit | 7f5d765c929a4dc2deddb7b68a41a3a841940837 (patch) | |
| tree | c442166ede9f6b4c3a82621a39d754dde8c407ac /boot/common.c | |
| parent | 30b04e4b2a90981570ae04095aeccd746ccdea6a (diff) | |
| download | catskill-7f5d765c929a4dc2deddb7b68a41a3a841940837.tar.zst catskill-7f5d765c929a4dc2deddb7b68a41a3a841940837.zip | |
LLVM clang compiler backend
Signed-off-by: Mel <mel@rnrd.eu>
Diffstat (limited to 'boot/common.c')
| -rw-r--r-- | boot/common.c | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/boot/common.c b/boot/common.c index e453065..095aaa6 100644 --- a/boot/common.c +++ b/boot/common.c @@ -3,7 +3,7 @@ * are used throughout the bootstrap compiler. * allocation done purely statically. * - * Copyright (c) 2025, Mel G. <mel@rnrd.eu> + * Copyright (c) 2025-2026, Mel G. <mel@rnrd.eu> * * SPDX-License-Identifier: MPL-2.0 */ @@ -127,6 +127,54 @@ unreachable() failure("unreachable code reached"); } +// log out a message with a debug prefix. +// does not print additional \n at the end. +void +log_debug(const ascii* message, ...) +{ + fflush(stdout); + fprintf(stderr, ANSI_BOLD ANSI_CYAN "debug. " ANSI_NO_BOLD); + + va_list args; + va_start(args, message); + vfprintf(stderr, message, args); + va_end(args); + + fprintf(stderr, ANSI_RESET); +} + +// log out a message with a warning prefix. +// does not print additional \n at the end. +void +log_warning(const ascii* message, ...) +{ + fflush(stdout); + fprintf(stderr, ANSI_BOLD ANSI_YELLOW "warning? " ANSI_NO_BOLD); + + va_list args; + va_start(args, message); + vfprintf(stderr, message, args); + va_end(args); + + fprintf(stderr, ANSI_RESET); +} + +// log out a message with an error prefix. +// does not print additional \n at the end. +void +log_error(const ascii* message, ...) +{ + fflush(stdout); + fprintf(stderr, ANSI_BOLD ANSI_RED "error! " ANSI_NO_BOLD); + + va_list args; + va_start(args, message); + vfprintf(stderr, message, args); + va_end(args); + + fprintf(stderr, ANSI_RESET); +} + // for each entry in a linked list. #define FOR_EACH(type, cursor, head) for (type cursor = head; cursor != nil; cursor = cursor->next) |
