# shabiel/fis-gtm architecture

> Architecture diagram of the GitHub repository shabiel/fis-gtm, 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/shabiel/fis-gtm
- Repository: https://github.com/shabiel/fis-gtm

## Overview

##### Overview of the Build and Deployment Pipeline
- Step-by-step process: source unpacking, build directory staging (the “fis-gtm-build” directory), generation of Makefiles via CMake → compiling → staging the install files → execution of the final “configure” script for installation.

##### Main Components and Their Roles
– sr_i386, sr_x86_64, sr_linux, sr_unix, sr_unix_cm, sr_unix_gnp, sr_unix_nsb, and sr_x86_regs.
Within these, many files are written in C and assembly (such as op_* files for operations, linkage, error handling, and interrupt code) that implement low‑level functionality such as system calls, memory management, and process control.
- Portability Layer: Represent the “sr_port” directory as a central module that provides abstracted interfaces for things like file I/O, signal handling, memory management, interprocess communication, and other OS-dependent tasks.
- Core Engine and Runtime:
– Include the modules that implement the language/interpreter operations (files named op_* and m_*), error trapping, and intrinsic functions.
– Illustrate specific components like the compiler/interpreter core, runtime support for M language execution, and internal state management.

##### Relationships and Interactions
- “portability layer” as the mediator between the low-level, platform‑specific code (for instance, in sr_unix or sr_x86_64) and the engine’s core logic; this emphasizes the design principle of separating OS‑dependent functionality from core algorithm implementations.
- Data flows that exist between core processing routines (which rely on internal modules for operations, error checking, interrupt processing, and so on) and the modules that handle system interactions (file I/O, journaling, shared memory, and so forth).

##### Architectural Patterns and Design Principles
- Modularity and Separation of Concerns: The source is finely divided into platform-specific directories versus “common” functionality provided by sr_port. This separation should be clearly depicted.
- Layered Architecture: Illustrate a layered approach – with a front-end build and dependency layer (CMake, external libraries) at the top, then the portability layer, then the core engine modules, and native code (assembly/C routines) at the bottom.
- Emphasis on Performance and Low-Level Control: Several modules are implemented in assembly (e.g., op_* files) indicating careful design for high-performance execution.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Build System and Documentation
    BS["Build System (CMake, GNU make, Compiler Toolchain)"]:::build
    DOC["Documentation"]:::build
    ED["External Dependencies (libz, Unicode, OpenSSL, GPG, ICU, ncurses)"]:::external

    %% Build Pipeline Process
    SP["Source Unpacking"]:::pipeline
    BD["Build Directory Staging (fis-gtm-build)"]:::pipeline
    MG["Makefile Generation (CMake)"]:::pipeline
    CP["Compilation"]:::pipeline
    LK["Linking"]:::pipeline
    SI["Staging Install Files"]:::pipeline
    FC["Final Configure Script"]:::pipeline

    %% Core Engine and Portability Layer
    CORE["Core GT.M Engine (op_*, m_*, Runtime)"]:::core
    PL["Portability Layer (sr_port)"]:::portability

    %% Platform-Specific Code Nodes
    PI["sr_i386"]:::platform
    X64["sr_x86_64"]:::platform
    LNX["sr_linux"]:::platform
    UNIX["sr_unix (incl. sr_unix_cm, sr_unix_gnp, sr_unix_nsb)"]:::platform
    X86R["sr_x86_regs"]:::platform

    %% Build Pipeline Flow
    BS --> SP
    SP --> BD
    BD --> MG
    MG --> CP
    CP --> LK
    LK --> SI
    SI --> FC

    %% Build System interconnections
    BS --> DOC
    ED --> BS
    ED --> PL

    %% Build Pipeline to Components
    MG --> CORE
    CP --> PI
    CP --> X64
    CP --> LNX
    CP --> UNIX
    CP --> X86R

    %% Core Engine and Portability interactions
    CORE -->|"mediates"| PL
    PL -->|"abstracts"| PI
    PL -->|"abstracts"| X64
    PL -->|"abstracts"| LNX
    PL -->|"abstracts"| UNIX
    PL -->|"abstracts"| X86R

    %% Styles
    classDef build fill:#ffccf0,stroke:#333,stroke-width:2px;
    classDef external fill:#b3e5fc,stroke:#333,stroke-width:2px;
    classDef pipeline fill:#fff9c4,stroke:#333,stroke-width:2px;
    classDef core fill:#ffe0b2,stroke:#333,stroke-width:2px;
    classDef portability fill:#c8e6c9,stroke:#333,stroke-width:2px;
    classDef platform fill:#d1c4e9,stroke:#333,stroke-width:2px;

    %% Click Events
    click BS "https://github.com/shabiel/fis-gtm/blob/master/CMakeLists.txt"
    click DOC "https://github.com/shabiel/fis-gtm/tree/master/README"
    click PI "https://github.com/shabiel/fis-gtm/tree/master/sr_i386"
    click X64 "https://github.com/shabiel/fis-gtm/tree/master/sr_x86_64"
    click LNX "https://github.com/shabiel/fis-gtm/tree/master/sr_linux"
    click UNIX "https://github.com/shabiel/fis-gtm/tree/master/sr_unix"
    click X86R "https://github.com/shabiel/fis-gtm/tree/master/sr_x86_regs"
    click PL "https://github.com/shabiel/fis-gtm/tree/master/sr_port"
```
