diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2022-12-18 23:52:23 +0100 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2022-12-18 23:52:23 +0100 |
| commit | 85139c4208063a911d9ac8c871dc1052d2712c17 (patch) | |
| tree | 4de20c39435a94c24f08d7a777707377c0295a27 /lib | |
| parent | e0ec3f0a536fabe0c8c47dd64da77855c0824adc (diff) | |
first idea of ansi escape codes support
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/aec/.gitignore | 1 | ||||
| -rw-r--r-- | lib/aec/Makefile | 3 | ||||
| -rw-r--r-- | lib/aec/aec.c | 24 | ||||
| -rw-r--r-- | lib/aec/aec.h | 27 |
4 files changed, 55 insertions, 0 deletions
diff --git a/lib/aec/.gitignore b/lib/aec/.gitignore new file mode 100644 index 0000000..9daeafb --- /dev/null +++ b/lib/aec/.gitignore @@ -0,0 +1 @@ +test diff --git a/lib/aec/Makefile b/lib/aec/Makefile new file mode 100644 index 0000000..c7f78b6 --- /dev/null +++ b/lib/aec/Makefile @@ -0,0 +1,3 @@ +unit_test: + gcc aec.c ../io/io.c ../cstr/cstr.c ../env/env.c ../sys/start.S -o test -static -nostdlib -fno-stack-protector -Wno-implicit-function-declaration -fno-builtin -DAEC_UNIT_TEST -g + ./test diff --git a/lib/aec/aec.c b/lib/aec/aec.c new file mode 100644 index 0000000..d38e8d1 --- /dev/null +++ b/lib/aec/aec.c @@ -0,0 +1,24 @@ +#include "aec.h" + +#include "../io/io.h" + +#define csi() wstd("\033["); + +void sgr(const char *attrs) +{ + csi(); + wstd(attrs); + wstd("m"); +} + + +#ifdef AEC_UNIT_TEST + +int main() { + sgr(SGR_BOLD); + wstd("Hallo"); + sgr(SGR_RESET); + wstd("Welt\n"); +} + +#endif diff --git a/lib/aec/aec.h b/lib/aec/aec.h new file mode 100644 index 0000000..f304175 --- /dev/null +++ b/lib/aec/aec.h @@ -0,0 +1,27 @@ +#ifndef AEC_H +#define AEC_H + +#define SGR_RESET "0" +#define SGR_BOLD "1" +#define SGR_FAINT "2" +#define SGR_ITALIC "3" +#define SGR_UNDERLINE "4" +#define SGR_SLOW_BLINK "5" +#define SGR_RAPID_BLINK "6" +#define SGR_REVERSE "7" +#define SGR_CONCEAL "8" +#define SGR_CROSSED_OUT "9" +#define SGR_UNDERLINE_DOUBLE "21" +#define SGR_INTENSITY_OFF "22" +#define SGR_ITALIC_OFF "23" +#define SGR_UNDERLINE_OFF "24" +#define SGR_BLINK_OFF "25" +#define SGR_REVERSE_OFF "27" +#define SGR_CONCEAL_OFF "28" +#define SGR_CROSSED_OUT_OFF "29" +#define SGR_OVERLINED "53" +#define SGR_OVERLINED_OFF "55" + +void sgr(const char *attrs); + +#endif |