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

@@ -40,8 +40,6 @@
#include <shared.h>
#include <format.h>
extern Context context;
// Helper macro.
#define LOC(y,x) (((y) * (_width + 1)) + (x))
@@ -174,8 +172,8 @@ Chart::Chart (char type)
{
// How much space is there to render in? This chart will occupy the
// maximum space, and the width drives various other parameters.
_width = context.getWidth ();
_height = context.getHeight () - 1; // Allow for new line with prompt.
_width = Context::getContext ().getWidth ();
_height = Context::getContext ().getHeight () - 1; // Allow for new line with prompt.
_max_value = 0;
_max_label = 1;
_graph_height = _height - 7;
@@ -193,7 +191,7 @@ Chart::Chart (char type)
_net_fix_rate = 0.0;
// Set the title.
std::vector <std::string> words = context.cli2.getWords ();
std::vector <std::string> words = Context::getContext ().cli2.getWords ();
auto filter = join (" ", words);
_title = '(' + filter + ')';
}
@@ -396,7 +394,7 @@ std::string Chart::render ()
}
if (_max_value == 0)
context.footnote ("No matches.");
Context::getContext ().footnote ("No matches.");
// Create a grid, folded into a string.
_grid = "";
@@ -520,12 +518,12 @@ std::string Chart::render ()
optimizeGrid ();
if (context.color ())
if (Context::getContext ().color ())
{
// Colorize the grid.
Color color_pending (context.config.get ("color.burndown.pending"));
Color color_done (context.config.get ("color.burndown.done"));
Color color_started (context.config.get ("color.burndown.started"));
Color color_pending (Context::getContext ().config.get ("color.burndown.pending"));
Color color_done (Context::getContext ().config.get ("color.burndown.done"));
Color color_started (Context::getContext ().config.get ("color.burndown.started"));
// Replace DD, SS, PP with colored strings.
std::string::size_type i;
@@ -799,7 +797,7 @@ void Chart::calculateRates ()
<< ", with currently "
<< _current_count
<< " pending tasks";
context.debug (peak_message.str ());
Context::getContext ().debug (peak_message.str ());
// If there are no current pending tasks, then it is meaningless to find
// rates or estimated completion date.
@@ -824,16 +822,16 @@ void Chart::calculateRates ()
<< " = "
<< _net_fix_rate
<< " tasks/d";
context.debug (rate_message.str ());
Context::getContext ().debug (rate_message.str ());
Duration delta (static_cast <time_t> (_current_count / fix_rate));
Datetime end = now + delta.toTime_t ();
// Prefer dateformat.report over dateformat.
std::string format = context.config.get ("dateformat.report");
std::string format = Context::getContext ().config.get ("dateformat.report");
if (format == "")
{
format = context.config.get ("dateformat");
format = Context::getContext ().config.get ("dateformat");
if (format == "")
format = "Y-M-D";
}
@@ -852,7 +850,7 @@ void Chart::calculateRates ()
<< delta.format ()
<< " --> "
<< end.toISO ();
context.debug (completion_message.str ());
Context::getContext ().debug (completion_message.str ());
}
else
{