libpulsar
A modular compiler for the pulsar programming language
Loading...
Searching...
No Matches
print.h
Go to the documentation of this file.
1// Copyright (C) 2023 Ethan Uppal. All rights reserved.
2
3#pragma once
4
5#include <stdio.h>
6
7#include "def.h"
8
9#define PS_PRINT_DECL(T) void T##_print(const struct T* self, char terminator)
10#define PS_PRINT_IMPL(T, ...) \
11 PS_PRINT_DECL(T) { \
12 {__VA_ARGS__}; \
13 if (terminator != 0) { \
14 putchar(terminator); \
15 } \
16 }
17
18#define PS_IPRINT_DECL(T) \
19 void T##_print(const struct T* self, char terminator, int indent)
20#define PS_IPRINT_IMPL(T, ...) \
21 PS_IPRINT_DECL(T) { \
22 {__VA_ARGS__}; \
23 if (terminator != 0) { \
24 putchar(terminator); \
25 } \
26 }
27#define ps_print_indent() printf("%*s", indent, "")
28#define ps_next_indent() indent + 2
Base definitions.