diff options
| author | Mel <mel@rnrd.eu> | 2025-05-18 19:43:19 +0200 |
|---|---|---|
| committer | Mel <mel@rnrd.eu> | 2025-05-18 19:43:19 +0200 |
| commit | 8c8d65f026121b4d75a31bff8a91c3fbf969fca5 (patch) | |
| tree | 64ba811523b45c02c849c1655e83e54aba968ec5 /boot/common.c | |
| parent | 7a7446a6dfdfcf5e02358fdb34c193eb67068b93 (diff) | |
| download | catskill-8c8d65f026121b4d75a31bff8a91c3fbf969fca5.tar.zst catskill-8c8d65f026121b4d75a31bff8a91c3fbf969fca5.zip | |
Define basic syntax tree (mostly expressions), with simple debug printing
Signed-off-by: Mel <mel@rnrd.eu>
Diffstat (limited to 'boot/common.c')
| -rw-r--r-- | boot/common.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/boot/common.c b/boot/common.c index 388aea5..d814538 100644 --- a/boot/common.c +++ b/boot/common.c @@ -62,6 +62,10 @@ check(bool condition, const ascii* message) if (!condition) failure(message); } +// for each entry in a linked list. +#define FOR_EACH(type, cursor, head) \ + for (type cursor = head; cursor != nil; cursor = cursor->next) + // the common size of region memory blocks. #define REGION_SIZE 65536 @@ -156,6 +160,12 @@ string_length(struct String s) return s.length; } +void +string_print(struct String s) +{ + printf("%.*s", (int32)s.length, s.data); +} + // single iteration of the CRC32 checksum algorithm // described in POSIX. // see: https://pubs.opengroup.org/onlinepubs/9799919799/utilities/cksum.html |
