# ultroned/convi architecture

> Architecture diagram of the GitHub repository ultroned/convi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ultroned/convi
- Repository: https://github.com/ultroned/convi

## Overview

Convi is a macOS text calculator and converter pad. The user enters expressions line by line; the app refreshes each line’s result, trying registered converters and showing N/A when none recognizes the input. The documented converter capability is timezone conversion. Internally, the app loop dispatches input/update and drawing, while a custom raylib text-measurement helper supports layout. The excerpts establish the app entry, converter dispatch, timezone parsing, and drawing responsibilities; registry selection is documented in the README. Other possible converter types are not evidenced by this tree.

Main entry points: [`src/app.c`](https://github.com/ultroned/convi/blob/main/src/app.c) (Editor and results), [`src/main.c`](https://github.com/ultroned/convi/blob/main/src/main.c) (App loop), [`src/converter.c`](https://github.com/ultroned/convi/blob/main/src/converter.c) (Converter registry), [`src/raylib_custom.c`](https://github.com/ultroned/convi/blob/main/src/raylib_custom.c) (Text measurement)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Pad interface"]
  node_main["App loop<br/>[main.c]"]
  node_app["Editor and results<br/>[app.c]"]
  node_state["Pad state<br/>[app.h]"]
end

subgraph group_conversion["Conversion"]
  node_dispatcher["Converter registry<br/>[converter.c]"]
  node_timezone["Timezone converter<br/>[timezone.c]"]
end

subgraph group_rendering["Rendering"]
  node_raylib["raylib"]
  node_textmetrics["Text measurement<br/>[raylib_custom.c]"]
end

node_user(("User"))

node_user -->|"enters text"| node_main
node_main -->|"updates and draws"| node_app
node_main -->|"initializes"| node_state
node_app -->|"updates"| node_state
node_app -->|"converts lines"| node_dispatcher
node_dispatcher -->|"tries converter"| node_timezone
node_app -->|"draws interface"| node_raylib
node_app -->|"measures text"| node_textmetrics
node_textmetrics -->|"uses font metrics"| node_raylib

click node_main "https://github.com/ultroned/convi/blob/main/src/main.c"
click node_app "https://github.com/ultroned/convi/blob/main/src/app.c"
click node_state "https://github.com/ultroned/convi/blob/main/src/app.h"
click node_dispatcher "https://github.com/ultroned/convi/blob/main/src/converter.c"
click node_timezone "https://github.com/ultroned/convi/blob/main/src/converters/timezone.c"
click node_textmetrics "https://github.com/ultroned/convi/blob/main/src/raylib_custom.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_app,node_state,node_user toneBlue
class node_dispatcher,node_timezone toneAmber
class node_raylib,node_textmetrics toneMint
```

## Components

### Pad interface

- [App loop](https://github.com/ultroned/convi/blob/main/src/main.c): `src/main.c`
- [Editor and results](https://github.com/ultroned/convi/blob/main/src/app.c): `src/app.c`
- [Pad state](https://github.com/ultroned/convi/blob/main/src/app.h): `src/app.h`

### Conversion

- [Converter registry](https://github.com/ultroned/convi/blob/main/src/converter.c): `src/converter.c`
- [Timezone converter](https://github.com/ultroned/convi/blob/main/src/converters/timezone.c): `src/converters/timezone.c`

### Rendering

- **raylib**
- [Text measurement](https://github.com/ultroned/convi/blob/main/src/raylib_custom.c): `src/raylib_custom.c`

### Other components

- **User**

## Connections

- User → App loop: enters text (evidence: `README.md`)
- App loop → Editor and results: updates and draws (evidence: `src/main.c`)
- App loop → Pad state: initializes (evidence: `src/main.c`)
- Editor and results → Pad state: updates (evidence: `src/app.c`)
- Editor and results → Converter registry: converts lines (evidence: `src/app.c`)
- Converter registry → Timezone converter: tries converter (evidence: `README.md`)
- Editor and results → raylib: draws interface (evidence: `src/app.c`)
- Editor and results → Text measurement: measures text (evidence: `src/app.c`)
- Text measurement → raylib: uses font metrics (evidence: `src/raylib_custom.c`)
