From 90c9865cfbfb3c4c08437dcd27bd9a090028ff99 Mon Sep 17 00:00:00 2001 From: Providence Salumu Date: Fri, 19 Feb 2021 18:39:03 -0500 Subject: [PATCH] series: export core functions for App usage (#397) --- include/hobbes/db/series.H | 11 +++++++++++ lib/hobbes/db/series.C | 10 +++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/include/hobbes/db/series.H b/include/hobbes/db/series.H index 24023d525..48f82acd5 100644 --- a/include/hobbes/db/series.H +++ b/include/hobbes/db/series.H @@ -17,6 +17,17 @@ namespace hobbes { typedef uint64_t ufileref; +// A -> (A) +MonoTypePtr entuple(const MonoTypePtr&); +// A N -> carray A N +MonoTypePtr carrayty(const MonoTypePtr&, const MonoTypePtr&); +// A -> ^x.(()+(A*x@?)) +MonoTypePtr storedListOf(const MonoTypePtr&); +// A N -> fseq A N +MonoTypePtr storedStreamOf(const MonoTypePtr&, size_t); +// A -- StoredAs A B --> B +MonoTypePtr storeAs(cc* c, const MonoTypePtr&); + class RawStoredSeries { public: RawStoredSeries(cc*, writer*, const std::string&, const MonoTypePtr&, size_t); diff --git a/lib/hobbes/db/series.C b/lib/hobbes/db/series.C index 5b2549f7a..382b856f7 100644 --- a/lib/hobbes/db/series.C +++ b/lib/hobbes/db/series.C @@ -154,14 +154,14 @@ void StoredSeries::clear(bool signal) { *******/ // A -> (A) -static MonoTypePtr entuple(const MonoTypePtr& ty) { +MonoTypePtr entuple(const MonoTypePtr& ty) { Record::Members ms; ms.push_back(Record::Member(".f0", ty)); return MonoTypePtr(Record::make(ms)); } // A N -> carray A N -static MonoTypePtr carrayty(const MonoTypePtr& ty, const MonoTypePtr& n) { +MonoTypePtr carrayty(const MonoTypePtr& ty, const MonoTypePtr& n) { Record::Members ms; ms.push_back(Record::Member("avail", primty("long"))); ms.push_back(Record::Member("buffer", FixedArray::make(tvar("t"), tvar("c")))); @@ -169,7 +169,7 @@ static MonoTypePtr carrayty(const MonoTypePtr& ty, const MonoTypePtr& n) { } // A -> ^x.(()+(A*x@?)) -static MonoTypePtr storedListOf(const MonoTypePtr& ty) { +MonoTypePtr storedListOf(const MonoTypePtr& ty) { Record::Members pms; pms.push_back(Record::Member(".f0", ty)); pms.push_back(Record::Member(".f1", fileRefTy(tvar("x")))); @@ -182,12 +182,12 @@ static MonoTypePtr storedListOf(const MonoTypePtr& ty) { } // A N -> fseq A N -static MonoTypePtr storedStreamOf(const MonoTypePtr& ty, size_t n) { +MonoTypePtr storedStreamOf(const MonoTypePtr& ty, size_t n) { return tapp(primty("fseq", tabs(str::strings("t", "c"), fileRefTy(storedListOf(fileRefTy(carrayty(tvar("t"), tvar("c"))))))), list(ty, tlong(n))); } // A -- StoredAs A B --> B -static MonoTypePtr storeAs(cc* c, const MonoTypePtr& ty) { +MonoTypePtr storeAs(cc* c, const MonoTypePtr& ty) { // construct the constraint that the input type stores to some output type MonoTypeUnifier u(c->typeEnv()); MonoTypePtr sty = freshTypeVar();