anon prototyping stuff out

This commit is contained in:
anon 2025-02-07 23:02:23 +01:00
parent ca11dc6f3e
commit 43b1ba4f76
3 changed files with 94 additions and 25 deletions

4
TODO.md Normal file

@ -0,0 +1,4 @@
# TODO
- [ ] finish the standard library
- [ ] EAX
- [ ] automake configure alternative / package manager ?

108
chad.h

@ -1,32 +1,90 @@
#ifndef CHAD_H
#define CHAD_H
tree chad/
file chad.h {
#ifndef CHAD_H
#define CHAD_H
#define UNUSED(x) ((void)x)
#include <stdbool.h>
#include <iso646>
// Terminal manipulation
#define TERMINAL_RESET "\033[0m"
#define UNUSED(x) ((void)x)
#define TERMINAL_COLOR_FG_BLACK "\033[30m"
#define TERMINAL_COLOR_FG_RED "\033[31m"
#define TERMINAL_COLOR_FG_GREEN "\033[32m"
#define TERMINAL_COLOR_FG_YELLOW "\033[33m"
#define TERMINAL_COLOR_FG_BLUE "\033[34m"
#define TERMINAL_COLOR_FG_MAGENTA "\033[35m"
#define TERMINAL_COLOR_FG_CYAN "\033[36m"
#define TERMINAL_COLOR_FG_WHITE "\033[37m"
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
#define TERMINAL_COLOR_BG_BLACK "\033[40m"
#define TERMINAL_COLOR_BG_RED "\033[41m"
#define TERMINAL_COLOR_BG_GREEN "\033[42m"
#define TERMINAL_COLOR_BG_YELLOW "\033[43m"
#define TERMINAL_COLOR_BG_BLUE "\033[44m"
#define TERMINAL_COLOR_BG_MAGENTA "\033[45m"
#define TERMINAL_COLOR_BG_CYAN "\033[46m"
#define TERMINAL_COLOR_BG_WHITE "\033[47m"
#endif
}
file terminal.h {
// XXX
#define VT100_RESET "\033[0m"
#define TERMINAL_STYLE_BOLD "\033[1m"
#define TERMINAL_STYLE_ITALICS "\033[3m"
#define TERMINAL_STYLE_REVERSE "\033[7m"
#define VT100_BOLD "\033[1m"
#define VT100_ITALICS "\033[3m"
#define VT100_REVERSE "\033[7m"
#define VT100_FG_BLACK "\033[30m"
#define VT100_FG_RED "\033[31m"
#define VT100_FG_GREEN "\033[32m"
#define VT100_FG_YELLOW "\033[33m"
#define VT100_FG_BLUE "\033[34m"
#define VT100_FG_MAGENTA "\033[35m"
#define VT100_FG_CYAN "\033[36m"
#define VT100_FG_WHITE "\033[37m"
#endif
#define VT100_BG_BLACK "\033[40m"
#define VT100_BG_RED "\033[41m"
#define VT100_BG_GREEN "\033[42m"
#define VT100_BG_YELLOW "\033[43m"
#define VT100_BG_BLUE "\033[44m"
#define VT100_BG_MAGENTA "\033[45m"
#define VT100_BG_CYAN "\033[46m"
#define VT100_BG_WHITE "\033[47m"
#define VT100_SAVE_CUR "\033[s"
#define VT100_RESTORE_CUR "\033[u"
}
link ${INC}/dictate.h -> dictate.h # add debug_* to dictate (using just macros)
file path.h {
char * basename(char * p);
char * dirname(char * p);
char * realpath(char * p); // XXX
}
file filesystem.h {
int touch_file(const char * p);
int touch_directory(const char * p);
int touch(const char * p); // wrapper based on whether the last char is '/'
int copy_file(const char * s, const char * d);
int copy(const char * s, const char * d);
int copy_ex(const char * s, const char * d, int flags);
int remove(const char * p);
int remove_all(const char * p);
int rename(const char * s, const char * d);
}
file arena.h {
arena_t new_arena(size_t n_bytes);
void * arenaloc(arena_t * a, size_t n_bytes);
int free_arena(arena_t * a);
}
link ${INC}/kvec.h -> vec.h
link ${INC}/sds.h -> sds.h
link ${INC}/narg.h -> narg.h # the vararg hack
file nargs.h { // for narg hack functions?
#define coalesce_env() // char * _coalesce_env(char * mydefault, size_t argc, ...)
// maybe just coalesce()? that means every argument is eval-ed; maybe both
#define max()
#define min()
// all(), any()
// ?! i cant think of a single instance where its preferable over plain logic,
// but it would be consistent
}
# something addressing math.h
# gcd(), lcm()
# something for printing an array?
# ino map()
# n-dimensional array using a single arena
# and the "head" containing pointers inside the area,
# so that a[h][i] works
# trim() even tho its a meme
# something mimicing perl's qx()

7
gigachad.h Normal file

@ -0,0 +1,7 @@
tree gigachad/
link ${INC}/ministach.h -> ministach.h
link ${INC}/caret.h -> caret.h
link ${INC}/dyrect.h -> dyrect.h
file sun.h {
// planned A* library
}