# likle/cwalk architecture

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

- Interactive diagram: https://gitdiagram.com/likle/cwalk
- Repository: https://github.com/likle/cwalk

## Overview

**┌─ Public Interface Layer ─────────────────┐**
- (include/cwalk.h)             │
- ┤
- Core Implementation Layer        │
- (src/cwalk.c)               │
- ┤
- Platform Abstraction Layer       │
- ┘

##### Component Details

a) Public Interface Layer:
- Public API functions (grouped by functionality):
- Path Manipulation (join, normalize)
- Path Analysis (get_basename, get_extension)
- Path Navigation (get_segments)
- Style Management (get_style, set_style)

b) Core Implementation Layer:
- Internal utilities and helpers
- Path parsing engine
- Style-specific handlers (Windows/UNIX)

c) Platform Abstraction Layer:
- Cross-platform compatibility layer
- OS-specific implementations

##### Interaction Flows

- API call flow from public interface to implementation
- Platform-specific branching for Windows/UNIX paths
- Data transformation pipeline for path operations

##### Modularity
- Clear separation between public API and implementation
- Platform-independent core with platform-specific handlers

##### API Categories
- Path Manipulation Functions
- Path Analysis Functions
- Path Navigation Functions
- Style Management Functions

##### Cross-Platform Architecture
- Windows Path Style Handler
- UNIX Path Style Handler
- Style Detection System

Key Elements to Include:

**┌─ Public API ──────────────────────┐**
- ┌─ Path Operations ─────────────┐ │
- Join                        │ │
- Normalize                   │ │
- Get Relative/Absolute      │ │
- ┘ │
- ┌─ Path Analysis ──────────────┐  │
- Extensions                 │  │
- Basename/Dirname          │  │
- Segments                  │  │
- ┘ │
- ┘

- ▼
**┌─ Core Engine ────────────────────┐**
- ┌─ Path Parser ───────────────┐  │
- ┘ │
- ┌─ Style Handlers ────────────┐  │
- ┌─ Windows ─┐ ┌─ UNIX ────┐ │  │
- ┘ └──────────┘ │  │
- ┘ │
- ┘

Remember to:
- Use consistent symbols and notation
- Version information
- Document cross-platform support
- Build system integration points

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Public Interface Layer"
        API["Public API (cwalk.h)"]:::api
        PathOps["Path Operations"]:::api
        PathAnalysis["Path Analysis"]:::api
        PathNav["Path Navigation"]:::api
        StyleMgmt["Style Management"]:::api
        
        API --> PathOps
        API --> PathAnalysis
        API --> PathNav
        API --> StyleMgmt
    end

    subgraph "Core Implementation Layer"
        Core["Core Implementation"]:::core
        Parser["Path Parser"]:::core
        StyleHandlers["Style Handlers"]:::core
        
        WinHandler["Windows Handler"]:::platform
        UnixHandler["Unix Handler"]:::platform
        
        Core --> Parser
        Core --> StyleHandlers
        StyleHandlers --> WinHandler
        StyleHandlers --> UnixHandler
    end

    subgraph "Testing Infrastructure"
        Tests["Test Suite"]:::test
        PathTests["Path Tests"]:::test
        AnalysisTests["Analysis Tests"]:::test
        PlatformTests["Platform Tests"]:::test
        
        Tests --> PathTests
        Tests --> AnalysisTests
        Tests --> PlatformTests
    end

    subgraph "Build System"
        CMake["CMake Build"]:::build
        Meson["Meson Build"]:::build
    end

    subgraph "Documentation"
        Docs["API Documentation"]:::docs
        BuildDocs["Build Instructions"]:::docs
        EmbedDocs["Embedding Guidelines"]:::docs
    end

    subgraph "CI/CD"
        CI["CI/CD Pipeline"]:::cicd
        Linux["Linux Build"]:::cicd
        MacOS["MacOS Build"]:::cicd
        Windows["Windows Build"]:::cicd
        FreeBSD["FreeBSD Build"]:::cicd
        
        CI --> Linux
        CI --> MacOS
        CI --> Windows
        CI --> FreeBSD
    end

    PathOps --> Core
    PathAnalysis --> Core
    PathNav --> Core
    StyleMgmt --> StyleHandlers

    %% Click events for component mapping
    click API "https://github.com/likle/cwalk/blob/master/include/cwalk.h"
    click Core "https://github.com/likle/cwalk/blob/master/src/cwalk.c"
    click Tests "https://github.com/likle/cwalk/tree/master/test/"
    click PathTests "https://github.com/likle/cwalk/blob/master/test/join_test.c"
    click AnalysisTests "https://github.com/likle/cwalk/blob/master/test/basename_test.c"
    click PlatformTests "https://github.com/likle/cwalk/blob/master/test/windows_test.c"
    click CMake "https://github.com/likle/cwalk/blob/master/CMakeLists.txt"
    click Meson "https://github.com/likle/cwalk/blob/master/meson.build"
    click Docs "https://github.com/likle/cwalk/tree/master/docs/reference/"
    click BuildDocs "https://github.com/likle/cwalk/blob/master/docs/build.md"
    click EmbedDocs "https://github.com/likle/cwalk/blob/master/docs/embed.md"
    click Linux "https://github.com/likle/cwalk/blob/master/.github/workflows/build-linux.yml"
    click MacOS "https://github.com/likle/cwalk/blob/master/.github/workflows/build-macos.yml"
    click Windows "https://github.com/likle/cwalk/blob/master/.github/workflows/build-win.yml"
    click FreeBSD "https://github.com/likle/cwalk/blob/master/.github/workflows/build-freebsd.yml"

    %% Styling
    classDef api fill:#2374ab,stroke:#2374ab,color:#fff
    classDef core fill:#2a9d8f,stroke:#2a9d8f,color:#fff
    classDef platform fill:#e9c46a,stroke:#e9c46a,color:#000
    classDef test fill:#808080,stroke:#808080,color:#fff
    classDef build fill:#f4a261,stroke:#f4a261,color:#000
    classDef docs fill:#264653,stroke:#264653,color:#fff
    classDef cicd fill:#e76f51,stroke:#e76f51,color:#fff
```
