Compare commits

..

No commits in common. "18a66011efb92304418622bf912e42aeb8ec68b4" and "7da96cb5c91c14acd004e3169b195c6f6bc49ccc" have entirely different histories.

8 changed files with 0 additions and 143 deletions

View File

@ -1,47 +0,0 @@
#ifndef CARROT_LOGGING_H
#define CARROT_LOGGING_H
#include <utility.h>
typedef enum
{
CARROT_PARSER_ERROR_SEVERITY_NOTE,
CARROT_PARSER_ERROR_SEVERITY_WARNING,
CARROT_PARSER_ERROR_SEVERITY_ERROR,
CARROT_PARSER_ERROR_SEVERITY_UNRECOVERABLE_ERROR
} carrot_error_severity_e;
typedef enum
{
CARROT_PARSER_LOG_ITEM,
CARROT_SYNTAX_LOG_ITEM
} carrot_log_item_type_e;
typedef struct carrot_log carrot_log_s;
typedef struct carrot_log_item carrot_log_item_s;
typedef struct carrot_log_message carrot_log_message_s;
struct carrot_log_message
{
carrot_error_severity_e severity;
cstr_s text;
};
struct carrot_log
{
u32_t capacity;
u32_t length;
carrot_log_message_s *items;
};
carrot_log_s carrot_create_log ();
void carrot_issue_note (carrot_log_s *log, char *message);
void carrot_issue_warning (carrot_log_s *log, char *message);
void carrot_issue_error (carrot_log_s *log, char *message);
void carrot_issue_unrecoverable_error (carrot_log_s *log, char *message);
#endif // CARROT_LOGGING_H

View File

@ -1,36 +0,0 @@
#ifndef CARROT_UTILITY_H
#define CARROT_UTILITY_H
#define FALSE ((bool_t) 0)
#define TRUE ((bool_t) 1)
#define NULL ((void *) 0)
typedef signed char s8_t;
typedef signed short s16_t;
typedef signed int s32_t;
typedef signed long s64_t;
typedef unsigned char u8_t;
typedef unsigned short u16_t;
typedef unsigned int u32_t;
typedef unsigned long u64_t;
typedef u8_t bool_t;
typedef struct str_s
{
u32_t len_text;
char *text;
} cstr_s;
// Not implemented
cstr_s cstr_join (cstr_s string1, cstr_s string2);
// Not implemented
bool_t cstr_split (cstr_s string, u32_t middle, cstr_s *first, cstr_s *second);
cstr_s carrot_wrap_chars (char *chars)
#endif

View File

@ -1,37 +0,0 @@
#include <logging.h>
carrot_log_s carrot_create_log()
{
carrot_log_s logger;
logger.capacity = 8192;
logger.length = 0;
logger.items = calloc(sizeof(carrot_log_message_s), logger.capacity);
return logger;
}
void carrot_issue_note(carrot_log_s *log, char *message)
{
log->items[log->length].text = carrot_wrap_chars(message);
log->items[log->length].severity = CARROT_PARSER_ERROR_SEVERITY_NOTE;
}
void carrot_issue_warning(carrot_log_s *log, char *message)
{
log->items[log->length].text = carrot_wrap_chars(message);
log->items[log->length].severity = CARROT_PARSER_ERROR_SEVERITY_WARNING;
}
void carrot_issue_error(carrot_log_s *log, char *message)
{
log->items[log->length].text = carrot_wrap_chars(message);
log->items[log->length].severity = CARROT_PARSER_ERROR_SEVERITY_ERROR;
}
void carrot_issue_unrecoverable_error(carrot_log_s *log, char *message)
{
log->items[log->length].text = carrot_wrap_chars(message);
log->items[log->length].severity = CARROT_PARSER_ERROR_SEVERITY_UNRECOVERABLE_ERROR;
}

View File

@ -1,3 +0,0 @@
#include <definition.h>

View File

@ -1,3 +0,0 @@
#include <definition.h>

View File

@ -1,3 +0,0 @@
#include <definition.h>

View File

@ -1,3 +0,0 @@
#include <definition.h>

View File

@ -1,11 +0,0 @@
#include <utility.h>
cstr_s carrot_wrap_chars(char *chars)
{
cstr_s result;
result.len_text = strlen(chars);
result.text = malloc(result.len_text);
memcpy(result.text, chars, result.len_text);
return result;
}