Skip to content

rphii/rlso

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧵 So - String Object

Dynamically Allocatable String in C.

🛠️ Installation

git clone https://github.com/rphii/so && cd so
setup build && meson install -C build

Installation features:

  • librlso.so the So library
  • man pages (WIP)

📊 Tests & Coverage

There are various tests.

Recommended dependencies

  • lcov (coverage)
  • gcovr (coverage)
  • valgrind (recommended)

Gentoo

emerge -a gcovr lcov valgrind

Arch

pacman -S gcovr lcov valgrind

Run

See the provided run-tests.sh script.

Results

See output of where the last command put the .html file.

✨ Features

*Byte counts are assuming a 64 bit machine/architecture.

  1. Any substring has a footprint of 16 bytes
  2. Any program-lifetime / data-segment string has a footprint of 16 bytes
  3. Operations on the stack, if length is <=15 bytes (operations without dynamically allocating!)
  4. Dynamically resizable to a heap string, with a maximum length of 2^56-1

Notes:

  • Endian doesn't matter (we need to know it to compile / set up TWO structs, and after that it doesn't matter)
  • Doesn't matter if machine/architecture is 64 bits or not, it still works (it should! XD)
  • Strings are not 0-terminated. Appropriate functions/macros for printing and other opterations shall be provided
  • Automatically converts any (sub-) string into a dynamic one, if manipulated

🔌 API

Things that are not linked are planned but not yet implemented.

part description .h .c
so-core.md core string so.h so.c
so-cmp.md comparison so-cmp.h so-cmp.c
so-find.md find within so-find.h so-find.c
so-count.md count things so-count.h so-count.c
so-split.md split into parts so-split.h so-split.c
so-splice.md splice repeatedly so-splice.h so-splice.c
so-as.md string to type conversions so-as.h so-as.c
so-uc.md utf8 + unicode conversions so-uc.h so-uc.c
so-fx.md formatting (bold, it, ul, rgb)
so-file.md read + write files so-file.h so-file.c
so-env.md environment variables so-env.h so-env.c
so-trim.md trimming so-trim.h so-trim.c
so-path.md handling as path so-path.h so-path.c
so-print.md printing so-print.h so-print.c
so-input.md user input so-input.h so-input.c