# brni05/geomax architecture

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

- Interactive diagram: https://gitdiagram.com/brni05/geomax
- Repository: https://github.com/brni05/geomax

## Overview

##### Project Type and Purpose
- This is a university project written in C, focused on coordinate geometry operations in a console application.
- It uses a menu-driven interface (with key commands like W, A, S, D for navigation) to let users create, view, and save geometry, ensuring that the SVG output is correctly formatted.

##### Analyzing the File Structure
- Top-level structure: A flat file list (as opposed to a nested directory hierarchy), which already gives hints about a modular monolithic design.
- Key files:
- “menu_vezerlo.c” and “menu_vezerlo.h”: Underpin the menu and control flow of the user interface.
- “menu_helper_funcs.c/h” and “menu_structs.h”: Provide auxiliary functions and definitions improving code clarity for menu handling.
- “io_handler.c/h”: Manages input/output operations, probably dealing with file interactions especially for SVG operations.
- “svg_processor.c/h”: Dedicated to processing and generating SVG files from the current viewport and the geometric data.
- The presence of a “3rdparty” folder with “debugmalloc.h” indicates integration with an external memory debugging tool that wraps malloc/free functions, important for stability and debugging purposes.

##### Reviewing the README for Additional Insights
- The README clarifies the separation of concerns: It describes a console-based UI that interacts with a backend of geometric computations and SVG generation.
- It describes a layered approach: user inputs feed into the menu system, which then delegates to specific modules such as the SVG processor and IO handler.
- It also notes important technical aspects such as cross-platform compatibility (with specific handling for Windows console environments) and memory safety considerations (with debugmalloc).

##### Core Components
a. Main Components:
- User Interface (Menu System)
- Files: menu_vezerlo.c/h, menu_helper_funcs.c/h, menu_structs.h.
- Files: alakzatok.c/h, alakzatok_helper.c, alakzatok_precursor.h.
- I/O Handling Module
- File: io_handler.c/h.
- SVG Processing Module
- Files: svg_processor.c/h.
- Debug/Memory Management
- File: 3rdparty/debugmalloc.h.

b. Relationships and Interactions:
- The User Interface (menu system) acts as the entry point for user interactions.
- The resulting data is passed to the IO Handling Module for saving and loading.
- Memory allocation and safety are overseen by the integrated debugmalloc library.

c. Architectural Patterns and Design Principles:
- Modular design separating functional concerns (UI, business logic, I/O, SVG generation).
- Strict handling of global variables by using get/set patterns, ensuring stability.
- Cross-platform design leveraging conditional compilation (for Windows vs. POSIX).
- Integration of an external library to handle memory debugging, enhancing stability.

d. Recognize Relevant Technologies, Frameworks, or Libraries:
- Standard C libraries (stdio, stdlib, etc.).
- The provided debugmalloc.h from the “3rdparty” folder for memory tracking.
- The use of compiler flags (-Wall, -Werror) indicates a discipline in coding standards and robustness.

##### Final Assembly
- That any cross-platform considerations are noted, possibly with a side note specifying conditional paths for Windows versus POSIX where applicable.

## Diagram (Mermaid)

```mermaid
flowchart TD
    UI["Menu System"]:::ui
    GS["Geometric Shapes Engine"]:::logic
    IO["I/O Handler"]:::io
    SVG["SVG Processor"]:::svg
    MD["Memory Debugging"]:::debug

    UI -->|"sends_input"| GS
    GS -->|"for_IO"| IO
    GS -->|"for_SVG"| SVG

    UI ---|"monitored_by"| MD
    GS ---|"monitored_by"| MD
    IO ---|"monitored_by"| MD
    SVG ---|"monitored_by"| MD

    click UI "https://github.com/brni05/geomax/blob/main/menu_vezerlo.c"
    click GS "https://github.com/brni05/geomax/blob/main/alakzatok.c"
    click IO "https://github.com/brni05/geomax/blob/main/io_handler.c"
    click SVG "https://github.com/brni05/geomax/blob/main/svg_processor.c"
    click MD "https://github.com/brni05/geomax/blob/main/3rdparty/debugmalloc.h"

    classDef ui fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef logic fill:#A9DFBF,stroke:#196F3D,stroke-width:2px;
    classDef io fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef svg fill:#FAD7A0,stroke:#B9770E,stroke-width:2px;
    classDef debug fill:#F5B7B1,stroke:#922B21,stroke-width:2px;
```
