# imafancydev/42-libft architecture

> Architecture diagram of the GitHub repository imafancydev/42-libft, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/imafancydev/42-libft
- Repository: https://github.com/imafancydev/42-libft

## Overview

##### Project type and purpose
- This is a C static-library project (“libft”) that re-implements common C standard and utility functions.
- Purpose: to compile multiple self-contained modules into a single archive (libft.a) that client programs can link against.

##### File structure
- Root files:
- Makefile — build script
- libft.h — public header exposing all function prototypes
- *.c — each implements one function or one linked-list routine
- Categories (inferred by function behavior):
- ctype-style: ft_isalpha, ft_isdigit, etc.
- stdlib-style: ft_atoi, ft_calloc
- memory: ft_memset, ft_memcpy, ft_memmove, ft_bzero, etc.
- string: ft_strlen, ft_strlcpy, ft_strchr, ft_strdup, ft_strlcat, ft_strncmp, ft_strnstr, ft_strrchr
- non-standard utilities: ft_itoa, ft_split, ft_strjoin, ft_substr, ft_strtrim, ft_strmapi, ft_put*
- linked lists (bonus): ft_lstnew, ft_lstadd_front/back, ft_lstdelone, ft_lstclear, ft_lstiter, ft_lstmap, ft_lstsize

##### README for additional insights
- Describes the library’s purpose, list of functions by category, and usage instructions:
- make → builds libft.a
- link libft.a + example.c → executable

##### Elements
– Source modules (e.g., rectangles in blue)
– Build artifacts (.o and .a) (e.g., rectangles in orange)
– External actors (client app, compiler) (e.g., ellipses in green)
– from source to object files (compile)
– from object files to archive (package)
– from client to header and archive (link)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Source Modules Groups
    subgraph "Source Modules"
        subgraph "ctype modules"
            FT_ISALPHA["ft_isalpha.c"]:::source
            FT_ISDIGIT["ft_isdigit.c"]:::source
            FT_ISALNUM["ft_isalnum.c"]:::source
            FT_ISASCII["ft_isascii.c"]:::source
            FT_ISPRINT["ft_isprint.c"]:::source
            FT_TOLOWER["ft_tolower.c"]:::source
            FT_TOUPPER["ft_toupper.c"]:::source
        end
        subgraph "stdlib modules"
            FT_ATOI["ft_atoi.c"]:::source
            FT_CALLOC["ft_calloc.c"]:::source
            FT_ITOA["ft_itoa.c"]:::source
        end
        subgraph "memory modules"
            FT_MEMSET["ft_memset.c"]:::source
            FT_MEMCPY["ft_memcpy.c"]:::source
            FT_MEMMOVE["ft_memmove.c"]:::source
            FT_MEMCHR["ft_memchr.c"]:::source
            FT_MEMCMP["ft_memcmp.c"]:::source
            FT_BZERO["ft_bzero.c"]:::source
        end
        subgraph "string modules"
            FT_STRLEN["ft_strlen.c"]:::source
            FT_STRLCPY["ft_strlcpy.c"]:::source
            FT_STRLCAT["ft_strlcat.c"]:::source
            FT_STRCHR["ft_strchr.c"]:::source
            FT_STRRCHR["ft_strrchr.c"]:::source
            FT_STRNCMP["ft_strncmp.c"]:::source
            FT_STRNSTR["ft_strnstr.c"]:::source
            FT_STRDUP["ft_strdup.c"]:::source
            FT_STRJOIN["ft_strjoin.c"]:::source
            FT_STRTRIM["ft_strtrim.c"]:::source
            FT_SUBSTR["ft_substr.c"]:::source
            FT_SPLIT["ft_split.c"]:::source
            FT_STRITERI["ft_striteri.c"]:::source
            FT_STRMAPI["ft_strmapi.c"]:::source
        end
        subgraph "non-standard utils"
            FT_PUTCHAR["ft_putchar_fd.c"]:::source
            FT_PUTENDL["ft_putendl_fd.c"]:::source
            FT_PUTNBR["ft_putnbr_fd.c"]:::source
            FT_PUTSTR["ft_putstr_fd.c"]:::source
        end
    end

    %% Build Artifacts
    Objects["Object Files (.o)"]:::build
    Archive["libft.a"]:::build
    Header["libft.h"]:::build

    %% Build Tool and Client
    Makefile["Makefile"]:::external
    Client["Client Application"]:::external

    %% Compilation and Packaging Flow
    FT_ISALPHA -->|compile| Objects
    FT_ISDIGIT -->|compile| Objects
    FT_ISALNUM -->|compile| Objects
    FT_ISASCII -->|compile| Objects
    FT_ISPRINT -->|compile| Objects
    FT_TOLOWER -->|compile| Objects
    FT_TOUPPER -->|compile| Objects

    FT_ATOI -->|compile| Objects
    FT_CALLOC -->|compile| Objects
    FT_ITOA -->|compile| Objects

    FT_MEMSET -->|compile| Objects
    FT_MEMCPY -->|compile| Objects
    FT_MEMMOVE -->|compile| Objects
    FT_MEMCHR -->|compile| Objects
    FT_MEMCMP -->|compile| Objects
    FT_BZERO -->|compile| Objects

    FT_STRLEN -->|compile| Objects
    FT_STRLCPY -->|compile| Objects
    FT_STRLCAT -->|compile| Objects
    FT_STRCHR -->|compile| Objects
    FT_STRRCHR -->|compile| Objects
    FT_STRNCMP -->|compile| Objects
    FT_STRNSTR -->|compile| Objects
    FT_STRDUP -->|compile| Objects
    FT_STRJOIN -->|compile| Objects
    FT_STRTRIM -->|compile| Objects
    FT_SUBSTR -->|compile| Objects
    FT_SPLIT -->|compile| Objects
    FT_STRITERI -->|compile| Objects
    FT_STRMAPI -->|compile| Objects

    FT_PUTCHAR -->|compile| Objects
    FT_PUTENDL -->|compile| Objects
    FT_PUTNBR -->|compile| Objects
    FT_PUTSTR -->|compile| Objects

    Objects -->|archive| Archive
    Makefile -->|orchestrates| Objects
    Makefile -->|orchestrates| Archive

    %% Client Integration
    Client -->|include| Header
    Client -->|link| Archive

    %% Click Events for Component Mapping
    click Makefile "https://github.com/imafancydev/42-libft/tree/main/Makefile"
    click Header "https://github.com/imafancydev/42-libft/blob/main/libft.h"
    click FT_ISALPHA "https://github.com/imafancydev/42-libft/blob/main/ft_isalpha.c"
    click FT_ISDIGIT "https://github.com/imafancydev/42-libft/blob/main/ft_isdigit.c"
    click FT_ISALNUM "https://github.com/imafancydev/42-libft/blob/main/ft_isalnum.c"
    click FT_ISASCII "https://github.com/imafancydev/42-libft/blob/main/ft_isascii.c"
    click FT_ISPRINT "https://github.com/imafancydev/42-libft/blob/main/ft_isprint.c"
    click FT_TOLOWER "https://github.com/imafancydev/42-libft/blob/main/ft_tolower.c"
    click FT_TOUPPER "https://github.com/imafancydev/42-libft/blob/main/ft_toupper.c"
    click FT_ATOI "https://github.com/imafancydev/42-libft/blob/main/ft_atoi.c"
    click FT_CALLOC "https://github.com/imafancydev/42-libft/blob/main/ft_calloc.c"
    click FT_ITOA "https://github.com/imafancydev/42-libft/blob/main/ft_itoa.c"
    click FT_MEMSET "https://github.com/imafancydev/42-libft/blob/main/ft_memset.c"
    click FT_MEMCPY "https://github.com/imafancydev/42-libft/blob/main/ft_memcpy.c"
    click FT_MEMMOVE "https://github.com/imafancydev/42-libft/blob/main/ft_memmove.c"
    click FT_MEMCHR "https://github.com/imafancydev/42-libft/blob/main/ft_memchr.c"
    click FT_MEMCMP "https://github.com/imafancydev/42-libft/blob/main/ft_memcmp.c"
    click FT_BZERO "https://github.com/imafancydev/42-libft/blob/main/ft_bzero.c"
    click FT_STRLEN "https://github.com/imafancydev/42-libft/blob/main/ft_strlen.c"
    click FT_STRLCPY "https://github.com/imafancydev/42-libft/blob/main/ft_strlcpy.c"
    click FT_STRLCAT "https://github.com/imafancydev/42-libft/blob/main/ft_strlcat.c"
    click FT_STRCHR "https://github.com/imafancydev/42-libft/blob/main/ft_strchr.c"
    click FT_STRRCHR "https://github.com/imafancydev/42-libft/blob/main/ft_strrchr.c"
    click FT_STRNCMP "https://github.com/imafancydev/42-libft/blob/main/ft_strncmp.c"
    click FT_STRNSTR "https://github.com/imafancydev/42-libft/blob/main/ft_strnstr.c"
    click FT_STRDUP "https://github.com/imafancydev/42-libft/blob/main/ft_strdup.c"
    click FT_STRJOIN "https://github.com/imafancydev/42-libft/blob/main/ft_strjoin.c"
    click FT_STRTRIM "https://github.com/imafancydev/42-libft/blob/main/ft_strtrim.c"
    click FT_SUBSTR "https://github.com/imafancydev/42-libft/blob/main/ft_substr.c"
    click FT_SPLIT "https://github.com/imafancydev/42-libft/blob/main/ft_split.c"
    click FT_STRITERI "https://github.com/imafancydev/42-libft/blob/main/ft_striteri.c"
    click FT_STRMAPI "https://github.com/imafancydev/42-libft/blob/main/ft_strmapi.c"
    click FT_PUTCHAR "https://github.com/imafancydev/42-libft/blob/main/ft_putchar_fd.c"
    click FT_PUTENDL "https://github.com/imafancydev/42-libft/blob/main/ft_putendl_fd.c"
    click FT_PUTNBR "https://github.com/imafancydev/42-libft/blob/main/ft_putnbr_fd.c"
    click FT_PUTSTR "https://github.com/imafancydev/42-libft/blob/main/ft_putstr_fd.c"

    %% Styles
    classDef source fill:#cce5ff,stroke:#1f77b4,stroke-width:1px
    classDef build fill:#ffe5b4,stroke:#d58512,stroke-width:1px
    classDef external fill:#d4edda,stroke:#28a745,stroke-width:1px
```
