Skip to content

LucaSforza/Utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Utilities for C

Utilities implemented in style stb-style single-file library.

To compile the project with these header files, simply include them in the files, without specifying a source file to the compiler.

To achieve this, here's an example of main.c:

#define STRINGS_IMPLEMENTATION
#define ARENA_IMPLEMENTATION
#define LOGGING_IMPLEMENTATION

#include "utils/macros.h"
#include "utils/strings.h"
#include "utils/arena.h"
#include "utils/logging.h"

int main(void) {
    Arena a = {0};
    String_Builder sb = arena_sb_from_cstr(&a,"foo");
    arena_sb_append_cstr(&sb, &a,"bar");
    sb_to_uppercase(&sb);
    append(&sb, 'c');
    arena_sb_to_cstr(&sb, &a);
    log_info("%s", sb.data);
    arena_free(&a);
}

Note: you need the firts two macros for importing the implementation.

Move the include directory on your project and run:

$ gcc -Wall -Wextra -o main -I ./include main.c 

Inspired by: nob.h ,arena.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published