From ddc2e327e046d8fae9d2be2394c64f4149b51f9d Mon Sep 17 00:00:00 2001 From: Waozi Date: Sat, 26 Sep 2026 23:14:13 -0300 Subject: [PATCH] Make Plot a locked Ziran package depending on Kryon --- .gitignore | 1 + Makefile | 23 ++++++++++++----------- README.md | 18 ++++++++++++------ kryon.toml | 5 ----- src/Plot/module.zi | 4 ++++ src/app.zi | 8 +------- src/candle_chart.zi | 9 +-------- src/line_chart.zi | 7 +------ tests/indicator_test.zi | 2 +- ziran.lock | 24 ++++++++++++++++++++++++ ziran.toml | 22 ++++++++++++++++++++++ 11 files changed, 79 insertions(+), 44 deletions(-) delete mode 100644 kryon.toml create mode 100644 src/Plot/module.zi create mode 100644 ziran.lock create mode 100644 ziran.toml diff --git a/.gitignore b/.gitignore index 84c048a..9560f56 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /build/ +/ziran.local.toml diff --git a/Makefile b/Makefile index d64115d..73183fa 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,21 @@ -.DEFAULT_GOAL := run +.DEFAULT_GOAL := build + +ZIRAN ?= ziran +CC ?= cc +ZIRAN_INCLUDE := $(shell $(ZIRAN) pkg path ziran)/include .PHONY: run build check run build: - @$(MAKE) --silent --no-print-directory -C ../kryon build/bin/kryon - @../kryon/build/bin/kryon $@ + $(ZIRAN) tool Kryon $@ check: - @$(MAKE) --silent --no-print-directory -C ../kryon build/bin/kryon - @../kryon/build/bin/kryon check - @mkdir -p build/indicator-test-c - @../ziran/build/bin/ziran build --target=c --entry indicator_test:main \ - --root tests --module-path src --module-path ../kryon/src/plot \ - --module-path ../kryon/src/ui -o build/indicator-test-c \ + $(ZIRAN) tool Kryon check + mkdir -p build/indicator-test-c + $(ZIRAN) build --project --target=c --entry indicator_test:main \ + -o build/indicator-test-c \ tests/indicator_test.zi - @$(CC) -std=c99 -pedantic-errors -I../ziran/include \ + $(CC) -std=c99 -pedantic-errors -I$(ZIRAN_INCLUDE) \ -Ibuild/indicator-test-c build/indicator-test-c/*.c -lm \ -o build/indicator-test - @build/indicator-test + build/indicator-test diff --git a/README.md b/README.md index e68a15d..2235dc4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Plot -Plot is a reusable Ziran chart project for Kryon applications. Its candle +Plot is a Ziran app package that depends on the separate Kryon package. Its candle chart draws OHLC bodies and wicks, volume, SMA 20, SMA 50, and EMA 20 over Kryon's generic `Plot` surface. `ChartMarker` and `CandleMarkers` add dated, clickable markers while leaving each marker's meaning to the caller. It also @@ -8,8 +8,14 @@ has a simple line chart. Both accept caller-owned values and colors; market data, networking, price formatting, and time labels stay in the application. -`make run` opens a small demo on the Cairo backend; `make check` checks the -Ziran source without opening a window. Use `src/candle_chart.zi` or -`src/line_chart.zi` from a project that already includes Kryon's UI modules. -Atr links these sources from its `src/` directory so its existing build rules -notice changes to Plot. +Install the Ziran launcher once with `make install-user` in Ziran, then run +`ziran fetch` and `make build` here. `make run` opens a small demo on the Cairo +backend; `make check` checks the source and runs the nonvisual indicator test. +The checked-in `ziran.lock` pins both Ziran and Kryon to exact commits. Plot +exports `Plot/module.zi` for other packages. That module re-exports Plot's +charts and Kryon's public UI surface; app code can use +`using Charts :: #import "Plot";`. + +Other applications can still use `src/candle_chart.zi` and +`src/line_chart.zi` while packaging of reusable chart modules is being +finished. Atr currently links those sources from its `src/` directory. diff --git a/kryon.toml b/kryon.toml deleted file mode 100644 index c3340db..0000000 --- a/kryon.toml +++ /dev/null @@ -1,5 +0,0 @@ -[project] -default_profile = "cairo" - -[profiles.cairo] -backend = "desktop" diff --git a/src/Plot/module.zi b/src/Plot/module.zi new file mode 100644 index 0000000..9c4029d --- /dev/null +++ b/src/Plot/module.zi @@ -0,0 +1,4 @@ +// Plot's reusable chart API, independent of the demo application's entry. +using UI :: #import "Kryon"; +using Candle :: #import "candle_chart"; +using Line :: #import "line_chart"; diff --git a/src/app.zi b/src/app.zi index f0dfacb..5ea3a22 100644 --- a/src/app.zi +++ b/src/app.zi @@ -1,10 +1,4 @@ -#import "candle_chart" -#import "drawing_props" -#import "geometry" -#import "paint_queue" -#import "session" -#import "text_props" -#import "text_widget" +using Charts :: #import "Plot"; #program_export Frame :: (session: Session, viewport: Rectangle) -> s32 { diff --git a/src/candle_chart.zi b/src/candle_chart.zi index 1f0c1c1..1c0d991 100644 --- a/src/candle_chart.zi +++ b/src/candle_chart.zi @@ -1,11 +1,4 @@ -#import "drawing_props" -#import "button_props" -#import "button_widget" -#import "geometry" -#import "paint_queue" -#import "plot_props" -#import "plot_widget" -#import "session" +using UI :: #import "Kryon"; using PlotMode; diff --git a/src/line_chart.zi b/src/line_chart.zi index 8413a13..54843da 100644 --- a/src/line_chart.zi +++ b/src/line_chart.zi @@ -1,9 +1,4 @@ -#import "drawing_props" -#import "geometry" -#import "paint_queue" -#import "plot_props" -#import "plot_widget" -#import "session" +using UI :: #import "Kryon"; using PlotMode; diff --git a/tests/indicator_test.zi b/tests/indicator_test.zi index 96196e5..f464f60 100644 --- a/tests/indicator_test.zi +++ b/tests/indicator_test.zi @@ -1,5 +1,5 @@ #import "candle_chart" -#import "geometry" +using UI :: #import "Kryon"; #program_export main :: () -> s32 { diff --git a/ziran.lock b/ziran.lock new file mode 100644 index 0000000..030d878 --- /dev/null +++ b/ziran.lock @@ -0,0 +1,24 @@ +{ + "format": 1, + "packages": [ + { + "commit": "4235447bbd0fa9bf42dcc276381cb1c3dd55f5a2", + "dependencies": {}, + "id": "pc63f351f658a1a15", + "name": "Kryon", + "ref": "master", + "url": "https://github.com/kryonlabs/kryon.git" + } + ], + "root": { + "dependencies": { + "Kryon": "pc63f351f658a1a15" + }, + "name": "Plot" + }, + "toolchain": { + "commit": "f3374188260b7c2fc497f0abed1d38fcb822547a", + "ref": "master", + "url": "https://github.com/ziranlang/ziran.git" + } +} diff --git a/ziran.toml b/ziran.toml new file mode 100644 index 0000000..df6d722 --- /dev/null +++ b/ziran.toml @@ -0,0 +1,22 @@ +[package] +name = "Plot" +entry = "src/app.zi" +module_roots = ["src", "tests"] +bridge_modules = ["app"] + +[toolchain] +git = "https://github.com/ziranlang/ziran.git" +ref = "master" + +[dependencies.Kryon] +git = "https://github.com/kryonlabs/kryon.git" +ref = "master" + +[exports] +Plot = "src/Plot/module.zi" + +[tool.kryon] +default_profile = "cairo" + +[tool.kryon.profiles.cairo] +backend = "desktop"