Initial commit: HTab spreadsheet engine and GemUI X11 frontend

This commit is contained in:
Luxferre committed 2026-11-30 17:45:17 +02:00
commit 395f458fee
55 files changed
+12682

No files matched your search

+50
View File
@@ -0,0 +1,50 @@
#pragma once
#include "engine/address.hpp"
#include "engine/parser.hpp"
#include "engine/value.hpp"
#include <vector>
namespace htab {
class Workbook;
struct EvalResult {
bool is_ref = false;
Value value;
std::vector<CellRange> ranges;
static EvalResult from_value(Value v) {
EvalResult r;
r.is_ref = false;
r.value = std::move(v);
return r;
}
static EvalResult from_range(CellRange rng) {
EvalResult r;
r.is_ref = true;
r.ranges.push_back(rng);
return r;
}
static EvalResult from_ranges(std::vector<CellRange> rngs) {
EvalResult r;
r.is_ref = true;
r.ranges = std::move(rngs);
return r;
}
};
struct EvalContext {
const Workbook* wb = nullptr;
int current_sheet = 0;
int current_row = 0;
int current_col = 0;
};
Value deref_to_value(const EvalResult& res, const Workbook& wb);
EvalResult evaluate_ast(const Expr* expr, const EvalContext& ctx);
} // namespace htab