-
Notifications
You must be signed in to change notification settings - Fork 10
/
demo.c
33 lines (26 loc) · 828 Bytes
/
demo.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "print.h"
int main() {
// basic usage
print("number:", 25, "fractional number:", 1.2345, "expression:", (2.0 + 5) / 3);
// variables can be passed
char *s = "abc";
void *p = main;
long l = 1234567890123456789;
print("string:", s, "pointer:", p, "long:", l);
// some basic C arrays are supported
int x[] = { 1, 2, 3 };
char *args[] = { "gcc", "hello.c", "-o", "hello" };
print(x, args);
// char/byte are handled with extra love
unsigned char byte = 222;
char ch = 'A';
print(byte, ch);
// you can setup your own colors
// arguments are: (normal, number, string, hex, fractional)
// defaults are (-1, 4, 1, 2, 5)
__print_setup_colors(249,236,239,244,232);
// or disable colors completely
__print_enable_color = 0;
// printing to fd is possible with fprintf
fprint(stderr, "Warning:", 42);
}