xtandard/README.md
2024-02-23 14:52:02 -05:00

2.3 KiB

xtandard

xtandard -- Xolatile-style "header-only" library for commonly used functions.

  • This library was written mainly for my own projects, but you can repurpose it for your own needs...
  • Intended usage is writing simple programs, which can fit it one source file, often only in 'main' function.
  • I'm not scared of using global variables, but there's not many of them, also rare "C-style" namespaces.

Compile:

$ sh compile.sh

Install:

$ sudo sh install.sh

If you want to make a project that's separated in more files, you can link with '.o' or include '.c' instead of '.h' in main file. If your project consists of only 1 file, which is the intent behind this library, just include '.c' and that's it. I'm a lazy person, and I do what every lazy person does, for good reference look at Raylib, which is quite decent library.

void in  (void * data, int size);
void out (void * data, int size);

void log_in  (int type, int flag, char * data);
void log_out (char * name);

void echo (char * data);
void dump (char * name, char * data);

void echo_byte (int byte);

void fatal_failure (int condition, char * message);

void limit (int * value, int minimum, int maximum);

void * allocate   (int size);
void * reallocate (void * data, int size);
void * deallocate (void * data);

void * record (void);

int    file_open (char * name, int mode);
...
void   file_export (char * name, void * data);

void file_list_import (char * name);
...
void file_list_delete (void);

int character_is_uppercase (char character);
...
int character_is_hexadecimal (char character);

int character_compare_array (char character, char * character_array);

int character_count (char * string, char this, int from, int to, char stop);

int string_length (char * string);
...
char * string_realign (char * string, int amount, char character);

void memory_delete (void * memory, int length);

int  memory_compare (void * memory, void * source, int length);
void memory_copy    (void * memory, void * source, int length);

void terminal_clear       (void);
void terminal_colour      (int colour, int effect);
void terminal_cancel      (void);
void terminal_show_cursor (int show);

int    encode_byte (char * byte);
char * decode_byte (int    byte);

There's more, but reading the actual source code is better than opening this in your internet browser.