Skip to content

K1ngmar/libkm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“šlibkm

Inspired by the 42 project Libft where we had to rewrite a bunch of libc functions with a couple additional ones, this project improves upon my libft and aims to be safer, cleaner, more complete and performant!

πŸ“₯ Install

# clone the repository
$ git clone https://github.com/K1ngmar/libkm.git

# build the repo
$ make -C libkm

# link the headers with
$ cc -o $SOURCE -I$LIBKM_LOCATION/includes

# link it with your project
$ cc -o $OBJECTS -L$LIBKM_LOCATION/libkm.a -lkm

🐳 Test on ubuntu with docker

# build the image
$ docker build -t ubuntu_test tests

# run the image
$ docker run -it -v $PWD:/libkm ubuntu_test

πŸ“¦ CONTENTS

All the functionality contained in the library!

πŸ«™ Containers:

Vector
Like in c++ this vector is templated, only you have to register the types yourself using macros

For a more detailed description of vector check out this!

Here is a quick example on how to create a vector of type int

#include "libkm/containers/vector.h"

// put this in the .h 
REGISTER_KM_VECTOR_PROTOTYPES(int, integer)

// put this in the .c
REGISTER_KM_VECTOR_SOURCE(int, integer)

//after registering the vector you can initialise it like this:
km_vector_integer_initialise(&vec, NULL, NULL);

// and destroy it like this
km_vector_integer_destroy(&vec);

🧬 IO:

Printf family

For a more detailed description of the printf family check out this!

  • km_dprintf()
  • km_printf()
  • km_sprintf()
  • km_snprintf()

Get delim

For a more detailed description of the getdelim functions check out this!

  • getdelim
  • getline

πŸ“– String:

Ascii to integral conversions

For a more detailed description of the integral conversions check out this!

  • km_atoi()
  • km_atol()
  • km_strtoll()
  • km_strtol()

String

For a more detailed description of the string functions check out this!

  • km_strlcpy()
  • km_strlcat()
  • km_toupper()
  • km_tolower()
  • km_strchr()
  • km_strrchr()
  • km_strcmp()
  • km_strncmp()
  • km_strstr()
  • km_strnstr()
  • km_strcasestr()
  • km_strtok()
  • km_strdup()
  • km_strndup()
  • km_strlen()
  • km_strnlen()
  • km_isupper()
  • km_islower()
  • km_isalpha()
  • km_isdigit()
  • km_isascii()
  • km_isprint()

πŸƒ Memory:

For a more detailed description of the memory functions checkout this!

  • km_memmove()
  • km_bzero()
  • km_calloc()
  • km_stupid_realloc()
  • km_memchr()
  • km_memcmp()
  • km_memcpy()
  • km_memset()

πŸ’½ Sys:

For a more detailed description of the system functions checkout this!

  • get_cache_line_size()

βž• Additional:

IO

For a more detailed description about the additional IO functions checkout this!

  • km_putchar_fd()
  • km_putstr_fd()
  • km_putendl_fd()
  • km_putnbr_fd()

String

For a more detailed description about the additional String functions checkout this!

  • km_substr()
  • km_strjoin()
  • km_safe_strjoin()
  • km_strtrim()
  • km_ltoa()
  • km_itoa()
  • km_strmapi()
  • km_striteri()
  • km_split()

Releases

No releases published

Packages

No packages published

Languages