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

@ -34,8 +34,6 @@
#include <util.h>
#include <main.h>
extern Context context;
////////////////////////////////////////////////////////////////////////////////
CmdColumns::CmdColumns ()
{
@ -57,20 +55,20 @@ int CmdColumns::execute (std::string& output)
{
// Obtain the arguments from the description. That way, things like '--'
// have already been handled.
auto words = context.cli2.getWords ();
auto words = Context::getContext ().cli2.getWords ();
if (words.size () > 1)
throw std::string ("You can only specify one search string.");
// Include all columns in the table.
std::vector <std::string> names;
for (const auto& col : context.columns)
for (const auto& col : Context::getContext ().columns)
names.push_back (col.first);
std::sort (names.begin (), names.end ());
// Render a list of column names, formats and examples.
Table formats;
formats.width (context.getWidth ());
formats.width (Context::getContext ().getWidth ());
formats.add ("Columns");
formats.add ("Type");
formats.add ("Modifiable");
@ -83,15 +81,15 @@ int CmdColumns::execute (std::string& output)
if (words.size () == 0 ||
find (name, words[0], false) != std::string::npos)
{
auto styles = context.columns[name]->styles ();
auto examples = context.columns[name]->examples ();
auto styles = Context::getContext ().columns[name]->styles ();
auto examples = Context::getContext ().columns[name]->examples ();
for (unsigned int i = 0; i < styles.size (); ++i)
{
auto row = formats.addRow ();
formats.set (row, 0, i == 0 ? name : "");
formats.set (row, 1, i == 0 ? context.columns[name]->type () : "");
formats.set (row, 2, i == 0 ? (context.columns[name]->modifiable () ? "Modifiable" : "Read Only") : "");
formats.set (row, 1, i == 0 ? Context::getContext ().columns[name]->type () : "");
formats.set (row, 2, i == 0 ? (Context::getContext ().columns[name]->modifiable () ? "Modifiable" : "Read Only") : "");
formats.set (row, 3, styles[i] + (i == 0 ? "*" : ""));
formats.set (row, 4, i < examples.size () ? examples[i] : "");
}
@ -137,7 +135,7 @@ int CmdCompletionColumns::execute (std::string& output)
{
// Include all columns.
std::vector <std::string> names;
for (const auto& col : context.columns)
for (const auto& col : Context::getContext ().columns)
names.push_back (col.first);
std::sort (names.begin (), names.end ());