mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[poincare] Init Poincare by creating a shared TreePool
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
#include "apps_container_storage.h"
|
||||
#include "global_preferences.h"
|
||||
#include <poincare/init.h>
|
||||
|
||||
void ion_main(int argc, char * argv[]) {
|
||||
// Initialize Poincare::TreePool::sharedPool
|
||||
Poincare::init();
|
||||
|
||||
#if EPSILON_GETOPT
|
||||
for (int i=1; i<argc; i++) {
|
||||
if (argv[i][0] != '-' || argv[i][1] != '-') {
|
||||
|
||||
@@ -33,6 +33,10 @@ objs += $(addprefix poincare/src/,\
|
||||
vertical_offset_layout_node.o\
|
||||
)
|
||||
|
||||
objs += $(addprefix poincare/src/,\
|
||||
init.o\
|
||||
)
|
||||
|
||||
objs += $(addprefix poincare/src/,\
|
||||
absolute_value.o\
|
||||
addition.o\
|
||||
|
||||
@@ -20,7 +20,8 @@ class TreePool {
|
||||
public:
|
||||
static constexpr int NoNodeIdentifier = -1;
|
||||
|
||||
static TreePool * sharedPool();
|
||||
static TreePool * sharedPool() { assert(SharedPool != nullptr); return SharedPool; }
|
||||
void registerPool(TreePool * pool) { assert(SharedPool == nullptr); SharedPool = pool; }
|
||||
|
||||
// Node
|
||||
TreeNode * node(int identifier) const {
|
||||
@@ -128,6 +129,7 @@ private:
|
||||
constexpr static int BufferSize = 32768;
|
||||
constexpr static int MaxNumberOfNodes = BufferSize/sizeof(TreeNode);
|
||||
constexpr static int MaxNumberOfStaticNodes = 200; // TODO: count how may are needed
|
||||
static TreePool * SharedPool = nullptr;
|
||||
|
||||
// TreeNode
|
||||
void discardTreeNode(TreeNode * node) {
|
||||
|
||||
@@ -5,11 +5,6 @@
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
TreePool * TreePool::sharedPool() {
|
||||
static TreePool pool;
|
||||
return &pool;
|
||||
}
|
||||
|
||||
static void memmove32(uint32_t * dst, uint32_t * src, size_t len) {
|
||||
if (src < dst && dst < src + len) {
|
||||
/* Copy backwards to avoid overwrites */
|
||||
|
||||
Reference in New Issue
Block a user