|
1 | 1 | # Rix |
| 2 | + |
| 3 | +Rix is the unified userland library layer for Vix.cpp. |
| 4 | + |
| 5 | +It gives Vix C++ projects a single optional facade object: |
| 6 | + |
| 7 | +```cpp |
| 8 | +#include <rix.hpp> |
| 9 | + |
| 10 | +int main() |
| 11 | +{ |
| 12 | + rix.debug.print("Hello {}", "Rix"); |
| 13 | + auto table = rix.csv.parse("name,language\nAda,C++\n"); |
| 14 | + rix.debug.log("loaded {} rows", table.size()); |
| 15 | +} |
| 16 | +``` |
| 17 | + |
| 18 | +Rix does not replace Vix. |
| 19 | + |
| 20 | +Vix provides the runtime, CLI, build workflow, registry integration, and core foundations. |
| 21 | + |
| 22 | +Rix provides optional userland packages and a unified facade over them. |
| 23 | + |
| 24 | +## Design |
| 25 | + |
| 26 | +Rix is built around two levels. |
| 27 | + |
| 28 | +```txt |
| 29 | +@rix/csv |
| 30 | +@rix/debug |
| 31 | +@rix/config |
| 32 | +@rix/table |
| 33 | +``` |
| 34 | + |
| 35 | +These are independent packages. |
| 36 | + |
| 37 | +```txt |
| 38 | +@rix/rix |
| 39 | +``` |
| 40 | + |
| 41 | +This is the unified facade package. |
| 42 | + |
| 43 | +The facade mounts independent packages into one object-style API: |
| 44 | + |
| 45 | +```cpp |
| 46 | +rix.csv.parse(...) |
| 47 | +rix.debug.print(...) |
| 48 | +rix.debug.format(...) |
| 49 | +rix.debug.log(...) |
| 50 | +rix.debug.inspect(...) |
| 51 | +``` |
| 52 | + |
| 53 | +## Install |
| 54 | + |
| 55 | +```bash |
| 56 | +vix add @rix/rix |
| 57 | +vix install |
| 58 | +``` |
| 59 | + |
| 60 | +## Use |
| 61 | + |
| 62 | +```cpp |
| 63 | +#include <rix.hpp> |
| 64 | + |
| 65 | +int main() |
| 66 | +{ |
| 67 | + rix.debug.print("Hello {}", "Rix"); |
| 68 | + |
| 69 | + const auto message = rix.debug.format("Package: {}", "rix/rix"); |
| 70 | + |
| 71 | + rix.debug.log("message: {}", message); |
| 72 | + |
| 73 | + return 0; |
| 74 | +} |
| 75 | +``` |
| 76 | + |
| 77 | +## Current modules |
| 78 | + |
| 79 | +| Package | Facade API | Description | |
| 80 | +| ------------ | ----------- | -------------------------------------------------------------- | |
| 81 | +| `@rix/csv` | `rix.csv` | Small CSV reader and writer for Vix C++ projects. | |
| 82 | +| `@rix/debug` | `rix.debug` | Debug printing, formatting, logging, and inspection utilities. | |
| 83 | + |
| 84 | +## CSV example |
| 85 | + |
| 86 | +```cpp |
| 87 | +#include <rix.hpp> |
| 88 | +#include <string> |
| 89 | + |
| 90 | +int main() |
| 91 | +{ |
| 92 | + const std::string input = |
| 93 | + "name,language\n" |
| 94 | + "Ada,C++\n" |
| 95 | + "Gaspard,Vix\n"; |
| 96 | + |
| 97 | + const auto table = rix.csv.parse(input); |
| 98 | + rix.debug.log("loaded {} rows", table.size()); |
| 99 | + |
| 100 | + for (const auto &row : table) |
| 101 | + { |
| 102 | + for (const auto &field : row) |
| 103 | + { |
| 104 | + rix.debug.print.inline_text("{} ", field); |
| 105 | + } |
| 106 | + |
| 107 | + rix.debug.print(); |
| 108 | + } |
| 109 | + |
| 110 | + return 0; |
| 111 | +} |
| 112 | +``` |
| 113 | + |
| 114 | +## Debug example |
| 115 | + |
| 116 | +```cpp |
| 117 | +#include <rix.hpp> |
| 118 | + |
| 119 | +int main() |
| 120 | +{ |
| 121 | + rix.debug.print("Hello {}", "Rix"); |
| 122 | + |
| 123 | + auto text = rix.debug.format("Package: {}", "rix/rix"); |
| 124 | + |
| 125 | + rix.debug.log("loaded {} APIs", 4); |
| 126 | + rix.debug.log.warn("slow path: {}ms", 120); |
| 127 | + |
| 128 | + rix.debug.inspect(text); |
| 129 | + |
| 130 | + return 0; |
| 131 | +} |
| 132 | +``` |
| 133 | + |
| 134 | +## Independent packages |
| 135 | + |
| 136 | +Each Rix module can also be used independently. |
| 137 | + |
| 138 | +For example: |
| 139 | + |
| 140 | +```bash |
| 141 | +vix add @rix/csv |
| 142 | +vix install |
| 143 | +``` |
| 144 | + |
| 145 | +```cpp |
| 146 | +#include <rix/csv.hpp> |
| 147 | + |
| 148 | +int main() |
| 149 | +{ |
| 150 | + rixlib::csv::Csv csv; |
| 151 | + auto table = csv.parse("name,language\nAda,C++\n"); |
| 152 | + |
| 153 | + return 0; |
| 154 | +} |
| 155 | +``` |
| 156 | + |
| 157 | +And: |
| 158 | + |
| 159 | +```bash |
| 160 | +vix add @rix/debug |
| 161 | +vix install |
| 162 | +``` |
| 163 | + |
| 164 | +```cpp |
| 165 | +#include <rix/debug.hpp> |
| 166 | + |
| 167 | +int main() |
| 168 | +{ |
| 169 | + rixlib::debug::Debug debug; |
| 170 | + debug.print("Hello {}", "Rix"); |
| 171 | + |
| 172 | + return 0; |
| 173 | +} |
| 174 | +``` |
| 175 | + |
| 176 | +## Repository layout |
| 177 | + |
| 178 | +```txt |
| 179 | +rix/ |
| 180 | +├── include/ |
| 181 | +│ └── rix.hpp |
| 182 | +├── examples/ |
| 183 | +│ ├── basic.cpp |
| 184 | +│ ├── csv.cpp |
| 185 | +│ └── debug.cpp |
| 186 | +├── tests/ |
| 187 | +│ └── rix_tests.cpp |
| 188 | +├── packages/ |
| 189 | +│ ├── csv/ |
| 190 | +│ │ ├── README.md |
| 191 | +│ │ └── vix.json |
| 192 | +│ └── debug/ |
| 193 | +│ ├── README.md |
| 194 | +│ └── vix.json |
| 195 | +├── CMakeLists.txt |
| 196 | +├── vix.json |
| 197 | +├── vix.lock |
| 198 | +└── README.md |
| 199 | +``` |
| 200 | + |
| 201 | +## Role of this repository |
| 202 | + |
| 203 | +This repository has two roles. |
| 204 | + |
| 205 | +First, it is the source package for the unified facade: |
| 206 | + |
| 207 | +```txt |
| 208 | +@rix/rix |
| 209 | +``` |
| 210 | + |
| 211 | +Second, it is the official human-readable index of Rix packages: |
| 212 | + |
| 213 | +```txt |
| 214 | +packages/csv |
| 215 | +packages/debug |
| 216 | +``` |
| 217 | + |
| 218 | +The real source code of each independent package lives in its own repository: |
| 219 | + |
| 220 | +```txt |
| 221 | +https://github.com/rixcpp/csv |
| 222 | +https://github.com/rixcpp/debug |
| 223 | +``` |
| 224 | + |
| 225 | +## Build |
| 226 | + |
| 227 | +```bash |
| 228 | +vix install |
| 229 | +vix build --build-target all -v |
| 230 | +``` |
| 231 | + |
| 232 | +## Run examples |
| 233 | + |
| 234 | +Because this repository contains multiple examples, run one explicitly: |
| 235 | + |
| 236 | +```bash |
| 237 | +vix run rix_basic |
| 238 | +vix run rix_csv_example |
| 239 | +vix run rix_debug_example |
| 240 | +``` |
| 241 | + |
| 242 | +## Tests |
| 243 | + |
| 244 | +```bash |
| 245 | +vix tests |
| 246 | +``` |
| 247 | + |
| 248 | +## Package model |
| 249 | + |
| 250 | +```txt |
| 251 | +Vix -> runtime, CLI, build workflow, registry client |
| 252 | +Rix -> userland libraries and unified facade |
| 253 | +Registry -> package metadata and version resolution |
| 254 | +``` |
| 255 | + |
| 256 | +Rix keeps packages modular while still offering one clean entry point for users who want the full standard userland layer. |
| 257 | + |
| 258 | +## Current facade API |
| 259 | + |
| 260 | +```cpp |
| 261 | +rix.csv.parse(...) |
| 262 | +rix.csv.write(...) |
| 263 | + |
| 264 | +rix.debug.print(...) |
| 265 | +rix.debug.format(...) |
| 266 | +rix.debug.log(...) |
| 267 | +rix.debug.inspect(...) |
| 268 | +``` |
| 269 | + |
| 270 | +## License |
| 271 | + |
| 272 | +MIT |
0 commit comments