mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
Namespaces | Macros | Typedefs | Functions
shell.cpp File Reference
#include "util/glyphs.hpp"
#include <cerrno>
#include <cstdlib>
#include <dlfcn.h>
#include <filesystem>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <mutable/catalog/CostModel.hpp>
#include <mutable/mutable.hpp>
#include <mutable/Options.hpp>
#include <mutable/util/terminal.hpp>
#include <regex>
#include <replxx.hxx>
#include <vector>
#include <mutable/tables/Keywords.tbl>
Include dependency graph for shell.cpp:

Go to the source code of this file.

Namespaces

namespace  m
 

‍mutable namespace


 

Macros

#define M_KEYWORD(tt, name)   #name,
 
#define M_KEYWORD(tt, name)    { #name, Replxx::Color::BROWN },
 
#define M_KEYWORD(tt, name)   #name,
 
#define ADD(TYPE, VAR, INIT, SHORT, LONG, DESCR, CALLBACK)
 
#define KEY_BIND(BUTTON, RESULT)    rx.bind_key(Replxx::KEY::BUTTON, std::bind(&Replxx::invoke, &rx, Replxx::ACTION::RESULT, std::placeholders::_1));
 

Typedefs

using Replxx = replxx::Replxx
 

Functions

void usage (std::ostream &out, const char *name)
 
void load_plugins (std::string list)
 
std::string prompt (bool is_editing, Timer::duration dur=Timer::duration())
 
int utf8str_codepoint_len (const char *s, int utf8_len)
 Determine codepoint length of utf-8 string.
 
int context_len (const std::string &prefix)
 Determines the amount of chars after a word breaker (i.e.
 
Replxx::completions_t hook_completion (const std::string &prefix, int &context_len)
 
void hook_highlighter (const std::string &context, Replxx::colors_t &colors)
 
Replxx::hints_t hook_hint (const std::string &prefix, int &context_len, Replxx::Color &color)
 
int main (int argc, const char **argv)
 

Macro Definition Documentation

◆ ADD

#define ADD (   TYPE,
  VAR,
  INIT,
  SHORT,
  LONG,
  DESCR,
  CALLBACK 
)
Value:
VAR = INIT;\
{\
AP.add<TYPE>(SHORT, LONG, DESCR, CALLBACK);\
}
#define CALLBACK(NAME, FUNC)

◆ KEY_BIND

#define KEY_BIND (   BUTTON,
  RESULT 
)     rx.bind_key(Replxx::KEY::BUTTON, std::bind(&Replxx::invoke, &rx, Replxx::ACTION::RESULT, std::placeholders::_1));

◆ M_KEYWORD [1/3]

#define M_KEYWORD (   tt,
  name 
)    #name,

◆ M_KEYWORD [2/3]

#define M_KEYWORD (   tt,
  name 
)     { #name, Replxx::Color::BROWN },

◆ M_KEYWORD [3/3]

#define M_KEYWORD (   tt,
  name 
)    #name,

Typedef Documentation

◆ Replxx

using Replxx = replxx::Replxx

Definition at line 35 of file shell.cpp.

Function Documentation

◆ context_len()

int context_len ( const std::string &  prefix)

Determines the amount of chars after a word breaker (i.e.

a non-alphanumeric character).

Definition at line 119 of file shell.cpp.

References m::is_alnum().

Referenced by hook_completion(), and hook_hint().

◆ hook_completion()

Replxx::completions_t hook_completion ( const std::string &  prefix,
int &  context_len 
)

Definition at line 131 of file shell.cpp.

References context_len(), and m::strneq().

Referenced by main().

◆ hook_highlighter()

void hook_highlighter ( const std::string &  context,
Replxx::colors_t &  colors 
)

Definition at line 151 of file shell.cpp.

References utf8str_codepoint_len().

Referenced by main().

◆ hook_hint()

Replxx::hints_t hook_hint ( const std::string &  prefix,
int &  context_len,
Replxx::Color &  color 
)

Definition at line 199 of file shell.cpp.

References context_len(), and m::strneq().

Referenced by main().

◆ load_plugins()

void load_plugins ( std::string  list)

Definition at line 45 of file shell.cpp.

References m::and, and m::Options::Get().

Referenced by main().

◆ main()

int main ( int  argc,
const char **  argv 
)

Definition at line 221 of file shell.cpp.

References ADD, m::and, m::Catalog::arg_parser(), m::ArgParser::args(), args, m::Options::ast, m::Options::astdot, m::Catalog::backends_cbegin(), m::Catalog::backends_cend(), m::Options::benchmark, m::Catalog::cardinality_estimators_cbegin(), m::Catalog::cardinality_estimators_cend(), m::Catalog::cost_functions_cbegin(), m::Catalog::cost_functions_cend(), m::Catalog::data_layouts_cbegin(), m::Catalog::data_layouts_cend(), m::Catalog::default_cost_function(), m::Catalog::Destroy(), m::Options::dryrun, m::Options::echo, m::Diagnostic::err(), m::term::fg(), m::term::FG_WHITE, m::Catalog::Get(), m::Options::Get(), m::version::get(), m::CostModelFactory::get_cost_function(), m::get_home_path(), m::Options::graph, m::Options::graph2sql, m::Options::graphdot, m::Options::has_color, m::term::has_color(), hook_completion(), hook_highlighter(), hook_hint(), m::isspace(), m::term::ITALIC, KEY_BIND, m::Options::list_backends, m::Options::list_cardinality_estimators, m::Options::list_cost_functions, m::Options::list_data_layouts, m::Options::list_plan_enumerators, m::Options::list_schedulers, m::Options::list_table_properties, load_plugins(), M_insist, m::Diagnostic::num_errors(), m::Options::output_partial_plans_file, m::ArgParser::parse_args(), m::Options::physplan, m::Options::plan, m::Catalog::plan_enumerators_cbegin(), m::Catalog::plan_enumerators_cend(), m::Options::plan_table_type, m::Options::plandot, m::Catalog::pool(), m::process_stream(), prompt(), m::Options::PT_auto, m::Options::PT_LargeAndSparse, m::Options::PT_SmallOrDense, m::Options::quiet, m::Catalog::register_cost_function(), m::term::RESET, m::Catalog::schedulers_cbegin(), m::Catalog::schedulers_cend(), m::Options::show_help, show_help, m::Options::show_prompt, m::Options::show_version, m::Options::statistics, m::streq(), m::Catalog::table_properties_cbegin(), m::Catalog::table_properties_cend(), m::Options::times, m::Options::train_cost_models, and usage().

◆ prompt()

std::string prompt ( bool  is_editing,
Timer::duration  dur = Timer::duration() 
)

◆ usage()

void usage ( std::ostream &  out,
const char *  name 
)

Definition at line 38 of file shell.cpp.

Referenced by main().

◆ utf8str_codepoint_len()

int utf8str_codepoint_len ( const char *  s,
int  utf8_len 
)

Determine codepoint length of utf-8 string.

Definition at line 101 of file shell.cpp.

Referenced by hook_highlighter().