# modoglu/42_libft architecture

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

- Interactive diagram: https://gitdiagram.com/modoglu/42_libft
- Repository: https://github.com/modoglu/42_libft

## Overview

##### Project type and purpose
- This is a C utility library (“libft”) that re-implements and extends common C standard-library functions (ctype, string, stdlib) plus linked-list helpers.
- Its purpose is to provide a consistent, pedagogical, and self-contained set of low-level routines for use in later projects at École 42.

##### File structure
- Top level:
- LICENSE, README.md – legal and documentation
- libft/ – all source files and a Makefile
- Inside libft/:
- Makefile – build rules for compiling sources into a static library (libft.a)
- *.c – individual implementations, grouped implicitly by category (ctype, string, stdlib, non-standard, linked-list)
- libft.h – exposes all function prototypes and the t_list struct definition

##### README for additional insights
- Describes each function’s origin (standard header or non-standard)
- Mentions a tester (francinette) to validate compliance

a. Main components
- Client Code – any user program that links against libft.a
- Build System – Makefile + GCC toolchain
- Modules (inside libft):
– Ctype Functions
– String Functions
– Stdlib Functions
– Non-standard String Utilities
– Linked-List Utilities
- Public Interface – libft.h
- Static Library Archive – libft.a
- Testing Harness – francinette (external)

b. Relationships and interactions
- Client Code → links → libft.a
- Build System → compiles → each *.c → creates object files → archives → libft.a
- libft.h → included by both client code and test suite → binds to implementations
- Test Harness → includes libft.h → links against libft.a → runs automatic compliance checks

c. Architectural patterns / design principles
- Modular grouping by function category
- Single-responsibility: each .c implements one function
- Data abstraction: t_list struct manipulated only via provided API
- Static linking via archive for simplicity and portability

d. Key technologies / frameworks
- C99 (gcc)
- Make (GNU Make)
- POSIX file descriptors for I/O functions (_fd variants)
- Static library (.a) format

##### Detailed capture of essential elements
- If desired, note any dependencies (none external beyond standard C/POSIX)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Project Documentation"
        README["README.md"]:::doc
        LICENSE["LICENSE"]:::doc
    end

    subgraph "Build System"
        Makefile["Makefile"]:::build
    end

    subgraph "Library Modules"
        Ctype["Ctype Functions"]:::ctype
        String["String Functions"]:::string
        Memory["Memory Utilities"]:::memory
        Stdlib["Stdlib Functions"]:::stdlib
        IO["I/O Helpers"]:::io

        subgraph "Public API Surface"
            Header["libft.h"]:::header
        end
    end

    Archive["libft.a"]:::archive

    subgraph "Consumers"
        Client["Client Code"]:::client
        Tester["francinette Tester"]:::external
    end

    %% Build workflow
    Makefile -->|"gcc -c"| Ctype
    Makefile -->|"gcc -c"| String
    Makefile -->|"gcc -c"| Memory
    Makefile -->|"gcc -c"| Stdlib
    Makefile -->|"gcc -c"| IO

    Ctype -->|"ar rcs"| Archive
    String -->|"ar rcs"| Archive
    Memory -->|"ar rcs"| Archive
    Stdlib -->|"ar rcs"| Archive
    IO -->|"ar rcs"| Archive

    Header --> Archive

    Client -->|"#include"| Header
    Client -->|"gcc -lft"| Archive

    Tester -->|"#include"| Header
    Tester -->|"gcc -lft"| Archive

    %% Click Events
    click README "https://github.com/modoglu/42_libft/blob/main/README.md"
    click LICENSE "https://github.com/modoglu/42_libft/tree/main/LICENSE"
    click Makefile "https://github.com/modoglu/42_libft/tree/main/libft/Makefile"
    click Header "https://github.com/modoglu/42_libft/blob/main/libft/libft.h"

    %% Styling
    classDef doc fill:#f9f,stroke:#333,stroke-width:1px
    classDef build fill:#ddd,stroke:#333,stroke-width:1px
    classDef ctype fill:#ccf,stroke:#333,stroke-width:1px
    classDef string fill:#cfc,stroke:#333,stroke-width:1px
    classDef memory fill:#fcf,stroke:#333,stroke-width:1px
    classDef stdlib fill:#fea,stroke:#333,stroke-width:1px
    classDef io fill:#ffc,stroke:#333,stroke-width:1px
    classDef header fill:#eee,stroke-dasharray:5 5
    classDef archive fill:#fff,stroke:#333,stroke-width:2px,shape:cylinder
    classDef client fill:#eef,stroke:#333,stroke-width:1px
    classDef external fill:#eef,stroke-dasharray:5 5,stroke:#333,stroke-width:1px
```
