Cadabra
Computer algebra system for field theory problems
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Shell Class Reference

#include <cadabra2-cli.hh>

Public Types

enum class  Flags : unsigned int {
  None = 0x00 , NoBanner = 0x01 , IgnoreSemicolons = 0x02 , NoColour = 0x04 ,
  NoReadline = 0x08
}
 

Public Member Functions

 Shell (Flags flags)
 
 ~Shell ()
 
void restart ()
 
void interact ()
 
pybind11::object evaluate (const std::string &code, const std::string &filename="<stdin>")
 
void execute (const std::string &code, const std::string &filename="<stdin>")
 
void execute_file (const std::string &filename, bool preprocess=true)
 
void interact_file (const std::string &filename, bool preprocess=true)
 
void write_stdout (const std::string &text, const std::string &end="\n", bool flush=false)
 
void write_stderr (const std::string &text, const std::string &end="\n", bool flush=false)
 

Private Member Functions

void set_histfile ()
 
std::string str (const pybind11::handle &obj)
 
std::string repr (const pybind11::handle &obj)
 
std::string sanitize (std::string s)
 
void process_ps1 (const std::string &line)
 
void process_ps2 (const std::string &line)
 
void set_completion_callback (const char *buffer, std::vector< std::string > &completions)
 
std::string get_ps1 ()
 
std::string get_ps2 ()
 
void handle_error ()
 
void handle_error (pybind11::error_already_set &err)
 

Private Attributes

std::string histfile
 
std::string site_path
 
pybind11::dict globals
 
pybind11::object sys
 
pybind11::object py_stdout
 
pybind11::object py_stderr
 
std::string collect
 
const char * colour_error
 
const char * colour_warning
 
const char * colour_info
 
const char * colour_success
 
const char * colour_reset
 
Flags flags
 

Member Enumeration Documentation

◆ Flags

enum Shell::Flags : unsigned int
strong
Enumerator
None 
NoBanner 
IgnoreSemicolons 
NoColour 
NoReadline 

Constructor & Destructor Documentation

◆ Shell()

Shell::Shell ( Flags  flags)

◆ ~Shell()

Shell::~Shell ( )

Member Function Documentation

◆ evaluate()

pybind11::object Shell::evaluate ( const std::string &  code,
const std::string &  filename = "<stdin>" 
)

◆ execute()

void Shell::execute ( const std::string &  code,
const std::string &  filename = "<stdin>" 
)

◆ execute_file()

void Shell::execute_file ( const std::string &  filename,
bool  preprocess = true 
)

◆ get_ps1()

std::string Shell::get_ps1 ( )
private

◆ get_ps2()

std::string Shell::get_ps2 ( )
private

◆ handle_error() [1/2]

void Shell::handle_error ( )
private

◆ handle_error() [2/2]

void Shell::handle_error ( pybind11::error_already_set &  err)
private

◆ interact()

void Shell::interact ( )

◆ interact_file()

void Shell::interact_file ( const std::string &  filename,
bool  preprocess = true 
)

◆ process_ps1()

void Shell::process_ps1 ( const std::string &  line)
private

◆ process_ps2()

void Shell::process_ps2 ( const std::string &  line)
private

◆ repr()

std::string Shell::repr ( const pybind11::handle &  obj)
private

◆ restart()

void Shell::restart ( )

◆ sanitize()

std::string Shell::sanitize ( std::string  s)
private

◆ set_completion_callback()

void Shell::set_completion_callback ( const char *  buffer,
std::vector< std::string > &  completions 
)
private

◆ set_histfile()

void Shell::set_histfile ( )
private

◆ str()

std::string Shell::str ( const pybind11::handle &  obj)
private

◆ write_stderr()

void Shell::write_stderr ( const std::string &  text,
const std::string &  end = "\n",
bool  flush = false 
)

◆ write_stdout()

void Shell::write_stdout ( const std::string &  text,
const std::string &  end = "\n",
bool  flush = false 
)

Member Data Documentation

◆ collect

std::string Shell::collect
private

◆ colour_error

const char* Shell::colour_error
private

◆ colour_info

const char* Shell::colour_info
private

◆ colour_reset

const char* Shell::colour_reset
private

◆ colour_success

const char* Shell::colour_success
private

◆ colour_warning

const char* Shell::colour_warning
private

◆ flags

Flags Shell::flags
private

◆ globals

pybind11::dict Shell::globals
private

◆ histfile

std::string Shell::histfile
private

◆ py_stderr

pybind11::object Shell::py_stderr
private

◆ py_stdout

pybind11::object Shell::py_stdout
private

◆ site_path

std::string Shell::site_path
private

◆ sys

pybind11::object Shell::sys
private

The documentation for this class was generated from the following files: