91 lines
3.0 KiB
C
91 lines
3.0 KiB
C
tree chad/
|
|
file chad.h {
|
|
#ifndef CHAD_H
|
|
#define CHAD_H
|
|
|
|
#include <stdbool.h>
|
|
#include <iso646>
|
|
|
|
#define UNUSED(x) ((void)x)
|
|
|
|
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
|
|
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
|
|
|
|
#endif
|
|
}
|
|
file terminal.h {
|
|
// XXX
|
|
#define VT100_RESET "\033[0m"
|
|
|
|
#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"
|
|
|
|
#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()
|