chad.h gets cucked
This commit is contained in:
parent
18b6128e60
commit
08c9f81f4d
@ -2,32 +2,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#define UNUSED(x) ((void)x)
|
||||
|
||||
// Terminal manipulation
|
||||
#define TERMINAL_RESET "\033[0m"
|
||||
|
||||
#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 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"
|
||||
|
||||
#define TERMINAL_STYLE_BOLD "\033[1m"
|
||||
#define TERMINAL_STYLE_ITALICS "\033[3m"
|
||||
#define TERMINAL_STYLE_REVERSE "\033[7m"
|
||||
#define UNUSED(x) ((void)x) /* much like this header */
|
||||
|
||||
#define CHAD_H
|
||||
#endif
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <uthash.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include "chad.h"
|
||||
#include "regex.h"
|
||||
|
||||
@ -248,8 +249,7 @@ int token_fits(const token_t * const token,
|
||||
const char * const to,
|
||||
const int string_offset,
|
||||
int * match_offset) {
|
||||
UNUSED(match_offset);
|
||||
|
||||
UNUSED(match_offset);
|
||||
//return regex_match(pattern, to, string_offset, match_offset);
|
||||
return regex_match(token->syntax, to + string_offset);
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
#ifndef REGEX_H
|
||||
#define REGEX_H
|
||||
|
||||
#include "chad.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "vector.h"
|
||||
|
||||
extern bool is_case_on;
|
||||
|
@ -1,5 +1,30 @@
|
||||
#include "hl.h"
|
||||
|
||||
// Terminal manipulation
|
||||
#define TERMINAL_RESET "\033[0m"
|
||||
|
||||
#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 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"
|
||||
|
||||
#define TERMINAL_STYLE_BOLD "\033[1m"
|
||||
#define TERMINAL_STYLE_ITALICS "\033[3m"
|
||||
#define TERMINAL_STYLE_REVERSE "\033[7m"
|
||||
|
||||
typedef struct {
|
||||
char * attribute;
|
||||
char * foreground_color;
|
||||
|
@ -1,10 +1,7 @@
|
||||
#ifndef VECTOR_H
|
||||
#define VECTOR_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
|
||||
// TODO: Handle error warnings?
|
||||
// TODO: Implement more useful functions?
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "terminal_hl.h"
|
||||
|
||||
#define ALLOCATION_CHUNK (10UL)
|
||||
@ -14,18 +15,12 @@
|
||||
static char * buffer = NULL;
|
||||
static size_t buffer_size = 0;
|
||||
|
||||
int main(int argc,
|
||||
char * * argv) {
|
||||
UNUSED(argc);
|
||||
UNUSED(argv);
|
||||
|
||||
int main(void) {
|
||||
// Buffer init
|
||||
buffer = realloc(buffer, ALLOCATION_CHUNK);
|
||||
|
||||
do {
|
||||
if (!((buffer_size + 1) % ALLOCATION_CHUNK)) {
|
||||
/* Linear incremental reallocation (advanced)!
|
||||
*/
|
||||
size_t chunks = (buffer_size + 1) / ALLOCATION_CHUNK;
|
||||
buffer = realloc(buffer, ++chunks * ALLOCATION_CHUNK);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
// ------------------
|
||||
// ### Char tests ###
|
||||
@ -32,8 +33,6 @@ bool is_magic(const char c) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ----------------------
|
||||
// ### Internal Types ###
|
||||
// ----------------------
|
||||
|
@ -4,6 +4,11 @@
|
||||
|
||||
#include "vector.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
void vector_init(vector_t * vector,
|
||||
size_t element_size,
|
||||
size_t element_count) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user