From 3e3aeddec840fed915b0fa748dcd2f56d6f682ef Mon Sep 17 00:00:00 2001 From: user Date: Mon, 9 Dec 2019 15:01:24 -0800 Subject: wip level1 allocation groups --- starts/meaning-vm/level-1/concepts.cpp | 1 + starts/meaning-vm/level-1/concepts.hpp | 1 + starts/meaning-vm/level-1/funcs.cpp | 8 ++++++++ starts/meaning-vm/level-1/memorystore.cpp | 33 +++++++++++++++++++++++++++++++ starts/meaning-vm/level-1/memorystore.hpp | 14 +++++++++++++ 5 files changed, 57 insertions(+) create mode 100644 starts/meaning-vm/level-1/memorystore.cpp create mode 100644 starts/meaning-vm/level-1/memorystore.hpp (limited to 'starts/meaning-vm/level-1') diff --git a/starts/meaning-vm/level-1/concepts.cpp b/starts/meaning-vm/level-1/concepts.cpp index 51cd693..890d8b2 100644 --- a/starts/meaning-vm/level-1/concepts.cpp +++ b/starts/meaning-vm/level-1/concepts.cpp @@ -9,6 +9,7 @@ ref is("is"); ref anonymous("anonymous"); ref link("link"); ref name("name"); +ref allocation("allocation"), part("part"), group("group"); } } diff --git a/starts/meaning-vm/level-1/concepts.hpp b/starts/meaning-vm/level-1/concepts.hpp index 6dfc64b..b75133e 100644 --- a/starts/meaning-vm/level-1/concepts.hpp +++ b/starts/meaning-vm/level-1/concepts.hpp @@ -12,6 +12,7 @@ extern ref name; // used as the link to value naming each concept extern ref is; // a link to define group relationships, links to the more general class extern ref anonymous; // a group given concepts with generated names extern ref link; // TODO: for concepts that are links, link them with is=link +extern ref allocation, part, group; // links structuring allocation groups //extern ref true, false; <-- casting provides as if these were declared } diff --git a/starts/meaning-vm/level-1/funcs.cpp b/starts/meaning-vm/level-1/funcs.cpp index 72d3c27..c1cf21a 100644 --- a/starts/meaning-vm/level-1/funcs.cpp +++ b/starts/meaning-vm/level-1/funcs.cpp @@ -29,6 +29,14 @@ static auto & namestruct() return namestruct; } +void givename(concept* con, std::string const & name) +{ + auto & ns = namestruct(); + level0::ref namestr = level0::alloc(name); + ns.conceptsByName.emplace(namestr.val(), con); + con.set(ns.nameref, namestr); +} + concept* getnamed(std::string const & name) { auto & ns = namestruct(); diff --git a/starts/meaning-vm/level-1/memorystore.cpp b/starts/meaning-vm/level-1/memorystore.cpp new file mode 100644 index 0000000..0bd109b --- /dev/null +++ b/starts/meaning-vm/level-1/memorystore.cpp @@ -0,0 +1,33 @@ +#include "memorystore.hpp" + +#include "concepts.hpp" + +#include "../level-0/memorystore.hpp" + +namespace intellect { +namespace level1 { + +ref allocation_group("allocation-group"); +ref allocation_part("allocation-part"); + +ref alloc(ref grp, std::any data) +{ + ref res = level0::alloc(data); + keep(res, grp); +} + +void keep(ref allocated, ref grp) +{ + allocated.link(allocation_group, grp); + grp.link(allocation_part, allocated); +} + +void dealloc(ref grp, ref metagroup) +{ + +//} + +std::size_t allocatedgroups(); + +} +} diff --git a/starts/meaning-vm/level-1/memorystore.hpp b/starts/meaning-vm/level-1/memorystore.hpp new file mode 100644 index 0000000..625dad9 --- /dev/null +++ b/starts/meaning-vm/level-1/memorystore.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include "common.hpp" + +namespace intellect { +namespace level1 { + +ref alloc(ref group, std::any data = {}); +void keep(ref allocated, ref group); +void dealloc(ref group, ref metagroup = concepts::nothing); +std::size_t allocatedgroups(); + +} +} -- cgit v1.2.3