Portability: Updated to make main re-entrant()

- New INSTALL instructions to emscripten, and AUTHORS for contribution.
This commit is contained in:
Mark Scannell
2018-01-31 19:45:07 -05:00
committed by Paul Beckingham
parent cae3f06b7d
commit 7af6db4c17
112 changed files with 960 additions and 1147 deletions

View File

@@ -32,8 +32,6 @@
#include <format.h>
#include <shared.h>
extern Context context;
////////////////////////////////////////////////////////////////////////////////
CmdPurge::CmdPurge ()
{
@@ -57,7 +55,7 @@ CmdPurge::CmdPurge ()
// - child tasks
void CmdPurge::purgeTask (Task& task, int& count)
{
context.tdb2.purge (task);
Context::getContext ().tdb2.purge (task);
handleDeps (task);
handleChildren (task, count);
count++;
@@ -70,14 +68,14 @@ void CmdPurge::handleDeps (Task& task)
{
std::string uuid = task.get ("uuid");
for (auto& blockedConst: context.tdb2.all_tasks ())
for (auto& blockedConst: Context::getContext ().tdb2.all_tasks ())
{
Task& blocked = const_cast<Task&>(blockedConst);
if (blocked.has ("depends") &&
blocked.get ("depends").find (uuid) != std::string::npos)
{
blocked.removeDependency (uuid);
context.tdb2.modify (blocked);
Context::getContext ().tdb2.modify (blocked);
}
}
}
@@ -95,7 +93,7 @@ void CmdPurge::handleChildren (Task& task, int& count)
std::vector<Task> children;
// Find all child tasks
for (auto& childConst: context.tdb2.all_tasks ())
for (auto& childConst: Context::getContext ().tdb2.all_tasks ())
{
Task& child = const_cast<Task&> (childConst);
@@ -120,8 +118,8 @@ void CmdPurge::handleChildren (Task& task, int& count)
task.get ("description"),
children.size ());
if (context.config.getBoolean ("recurrence.confirmation") ||
(context.config.get ("recurrence.confirmation") == "prompt"
if (Context::getContext ().config.getBoolean ("recurrence.confirmation") ||
(Context::getContext ().config.get ("recurrence.confirmation") == "prompt"
&& confirm (question)))
{
for (auto& child: children)
@@ -145,7 +143,7 @@ int CmdPurge::execute (std::string&)
filter.subset (filtered);
if (filtered.size () == 0)
{
context.footnote ("No tasks specified.");
Context::getContext ().footnote ("No tasks specified.");
return 1;
}