# pondahai/mbcwjfx architecture

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

- Interactive diagram: https://gitdiagram.com/pondahai/mbcwjfx
- Repository: https://github.com/pondahai/mbcwjfx

## Overview

##### Project type and purpose
- From the README and file names, this is “MbcWJFX,” a standalone Palm-OS application written in C (built under CodeWarrior) that implements a LabVIEW-style flowchart/programming language on Palm devices. The app provides a visual “block” editor (flowchart UI), a runtime engine to interpret those flowcharts, and persistence to load/save user programs.

##### File structure
- Top level
- README.md, .gitattributes, Stationery Read Me.txt, Thumbs.db – docs and metadata
- Starter.prc, Starter.tmp, VPL.mcp – Palm OS resource binary and CodeWarrior project workspace
- Resource.frk/ – resource compiler/frk files for UI resources
- Src/ – all core C source files organized flat but by function (UI, engine, I/O, utils)
- VPL_Data/ – runtime settings (CWSettingsWindows.stg) and TargetDataWindows.tdt for build/deployment
- Inside Src/
- panel.c, paneltools.c – code for the on-screen flowchart editor UI
- block.c, blocktools.c, functions.c – representations and operations on flowchart blocks
- run.c – the interpreter/execution engine for running the user’s flowcharts
- load.c, save.c, db.c, testdata.c – persistence layer handling program I/O and data storage
- linklist.c, tools.c, misc.c – general utilities and data structures
- mbcwjfx.c – likely the main entry point/glue for startup and environment setup
- StarterRsc.{c,h} – generated resource headers for Palm UI dialogs and controls

##### README for additional insights
- Confirms this is a flowchart-based programming language inspired by LabVIEW, supporting arithmetic, loops, basic logic.
- No external services or microservices—entire app runs on Palm OS as a single binary.

a. Main components to show
1. User Interface Layer (Panel UI, Resource Manager)
2. Flowchart Model / Block Library (block.c, functions.c)
3. Execution Engine (run.c)
4. Persistence / Storage (load.c, save.c, db.c, testdata.c)
5. Utilities (linklist, tools, misc)
6. Palm OS Platform (OS APIs for memory, UI, file system)
b. Relationships and interactions
- UI Layer ↔ Flowchart Model: users add/move blocks; paneltools invoke blocktools
- Flowchart Model → Execution Engine: model serialized into runtime instructions
- Execution Engine ↔ Persistence Layer: engine can save current program state or load prior flows
- Any component → Utilities: common data structures and helper functions
- All components → Palm OS Platform: calls to OS APIs for drawing, event loop, file I/O
c. Architectural patterns
- Layered structure: UI → Model → Engine → Storage
- Separation of concerns: block management separate from execution, separate from persistence
- Resource abstraction: all GUI assets generated via Resource.frk/StarterRsc
d. Key technologies/frameworks
- C/C++ on Palm OS SDK
- CodeWarrior project file (.mcp) for build
- Palm OS PRC binary (Starter.prc) as deployment artifact

- Labels: name each component (e.g., “Flowchart Editor Module (panel.c)”)
- Core engine components in another (e.g., green ovals)
- Platform boundary as a thick border around Palm OS

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Design Phase: Flowchart Editor
    subgraph "Design Phase: Flowchart Editor"
        PanelUI["Panel UI\n(panel.c)"]:::ui
        PanelTools["Panel Tools\n(paneltools.c)"]:::ui
        ResourceFRK["UI Resources\n(Resource.frk/)"]:::ui
        StarterRscC["StarterRsc.c"]:::ui
        StarterRscH["StarterRsc.h"]:::ui
    end

    %% Model Phase: Flowchart Model
    subgraph "Model Phase: Flowchart Model"
        BlockLib["Block Library\n(block.c)"]:::model
        BlockTools["Block Tools\n(blocktools.c)"]:::model
        Functions["Functions\n(functions.c)"]:::model
    end

    %% Execution Phase: Interpreter Engine
    subgraph "Execution Phase: Interpreter Engine"
        RunEngine["Engine\n(run.c)"]:::engine
    end

    %% Persistence Phase: Storage
    subgraph "Persistence Phase: Storage"
        Load["Load Module\n(load.c)"]:::persistence
        Save["Save Module\n(save.c)"]:::persistence
        DB["Database Layer\n(db.c)"]:::persistence
        TestData["Test Data\n(testdata.c)"]:::persistence
    end

    %% Utilities
    subgraph "Utilities"
        LinkList["LinkedList\n(linklist.c)"]:::utils
        Tools["Tools\n(tools.c)"]:::utils
        Misc["Misc Helpers\n(misc.c)"]:::utils
    end

    %% Build & Deployment Settings
    subgraph "Build & Deployment Settings"
        CWSettings["CW Settings\n(CWSettingsWindows.stg)"]:::build
        TargetData["Target Data\n(TargetDataWindows.tdt)"]:::build
    end

    %% Platform Glue
    subgraph "Platform Glue"
        Main["Entry Point\n(mbcwjfx.c)"]:::platform
        ProjectFile["Project File\n(VPL.mcp)"]:::platform
        Binary["Binary\n(Starter.prc)"]:::platform
    end

    %% Palm OS Platform Boundary
    subgraph "Palm OS Platform"
        PlatformAPI["Palm OS APIs"]:::platform
    end

    %% Control and Data Flows
    PanelUI -->|controls| BlockLib
    PanelTools -->|manages blocks| BlockTools
    BlockLib -->|defines blocks| RunEngine
    Functions -->|provides functions| RunEngine
    RunEngine -.->|save/load| Load
    RunEngine -.->|save/load| Save
    RunEngine -.->|db access| DB
    RunEngine -.->|test data| TestData

    %% Utilities usage
    PanelUI -->|uses| LinkList
    PanelTools -->|uses| Tools
    BlockLib -->|uses| LinkList
    BlockTools -->|uses| Tools
    Functions -->|uses| Misc
    RunEngine -->|uses| Misc
    Load -->|uses| Tools
    Save -->|uses| Tools
    DB -->|uses| LinkList
    TestData -->|uses| LinkList

    %% Platform API calls
    PanelUI -->|calls| PlatformAPI
    PanelTools -->|calls| PlatformAPI
    ResourceFRK -->|embedded via| PlatformAPI
    StarterRscC -->|embedded| PlatformAPI
    StarterRscH -->|embedded| PlatformAPI
    BlockLib -->|calls| PlatformAPI
    BlockTools -->|calls| PlatformAPI
    Functions -->|calls| PlatformAPI
    RunEngine -->|calls| PlatformAPI
    Load -->|calls| PlatformAPI
    Save -->|calls| PlatformAPI
    DB -->|calls| PlatformAPI
    TestData -->|calls| PlatformAPI
    LinkList -->|calls| PlatformAPI
    Tools -->|calls| PlatformAPI
    Misc -->|calls| PlatformAPI

    %% Main application flows
    Main -->|initializes| PanelUI
    Main -->|starts| RunEngine
    Main -->|manages| Load
    Main -->|configured by| CWSettings
    Main -->|targets| TargetData
    CWSettings -.-> ProjectFile
    TargetData -.-> ProjectFile
    ProjectFile -->|builds| Binary
    Main -->|runs on| PlatformAPI

    %% Click Events
    click PanelUI "https://github.com/pondahai/mbcwjfx/blob/master/Src/panel.c"
    click PanelTools "https://github.com/pondahai/mbcwjfx/blob/master/Src/paneltools.c"
    click ResourceFRK "https://github.com/pondahai/mbcwjfx/tree/master/Resource.frk/"
    click StarterRscC "https://github.com/pondahai/mbcwjfx/blob/master/Src/StarterRsc.c"
    click StarterRscH "https://github.com/pondahai/mbcwjfx/blob/master/Src/StarterRsc.h"
    click BlockLib "https://github.com/pondahai/mbcwjfx/blob/master/Src/block.c"
    click BlockTools "https://github.com/pondahai/mbcwjfx/blob/master/Src/blocktools.c"
    click Functions "https://github.com/pondahai/mbcwjfx/blob/master/Src/functions.c"
    click RunEngine "https://github.com/pondahai/mbcwjfx/blob/master/Src/run.c"
    click Load "https://github.com/pondahai/mbcwjfx/blob/master/Src/load.c"
    click Save "https://github.com/pondahai/mbcwjfx/blob/master/Src/save.c"
    click DB "https://github.com/pondahai/mbcwjfx/blob/master/Src/db.c"
    click TestData "https://github.com/pondahai/mbcwjfx/blob/master/Src/testdata.c"
    click LinkList "https://github.com/pondahai/mbcwjfx/blob/master/Src/linklist.c"
    click Tools "https://github.com/pondahai/mbcwjfx/blob/master/Src/tools.c"
    click Misc "https://github.com/pondahai/mbcwjfx/blob/master/Src/misc.c"
    click Main "https://github.com/pondahai/mbcwjfx/blob/master/Src/mbcwjfx.c"
    click ProjectFile "https://github.com/pondahai/mbcwjfx/blob/master/VPL.mcp"
    click Binary "https://github.com/pondahai/mbcwjfx/blob/master/Starter.prc"
    click CWSettings "https://github.com/pondahai/mbcwjfx/blob/master/VPL_Data/CWSettingsWindows.stg"
    click TargetData "https://github.com/pondahai/mbcwjfx/blob/master/VPL_Data/Starter/TargetDataWindows.tdt"

    %% Styles
    classDef ui fill:#BBDEFB,stroke:#1E88E5,color:#0D47A1
    classDef model fill:#C8E6C9,stroke:#43A047,color:#1B5E20
    classDef engine fill:#A5D6A7,stroke:#388E3C,color:#1B5E20
    classDef persistence fill:#FFF9C4,stroke:#FBC02D,color:#F57F17
    classDef utils fill:#FFE0B2,stroke:#FB8C00,color:#E65100
    classDef platform fill:#CFD8DC,stroke:#546E7A,color:#263238
    classDef build fill:#E1BEE7,stroke:#8E24AA,color:#4A148C
```
