hobbes
a language, embedded compiler, and runtime for efficient dynamic expression evaluation, data storage and analysis
Classes | Typedefs | Functions | Variables
hi Namespace Reference

Classes

struct  Args
 
struct  clearline
 
struct  clearscr
 
struct  eraseToEOL
 
class  evaluator
 
struct  movecursor
 
struct  resetfmt
 
struct  setbgc
 
struct  setbold
 
struct  setcursor
 
struct  setfgc
 
struct  setfont
 
struct  setunderline
 
class  WWWServer
 

Typedefs

typedef unsigned char color
 
typedef std::vector< std::string > ModuleFiles
 
typedef std::pair< int, int > PIO
 
typedef std::pair< std::string, std::string > CmdDesc
 
typedef std::vector< CmdDescCmdDescs
 
typedef hobbes::array< char > cstr
 
typedef std::pair< const cstr *, const cstr * > cstrpair
 

Functions

 DEFINE_STRUCT (ConsoleColors,(color, promptfg),(color, stdtextfg),(color, errorfg),(color, hlfg),(color, divfg),(color, evalfg),(color, unsweetfg),(color, typefg),(color, llvmfg),(color, instfg),(color, argdelimfg),(color, registerfg),(color, xnumfg),(color, xvalfg),(color, linenumfg),(color, linenumdelimfg),(color, evenlinebg),(color, oddlinebg))
 
bool extConsoleCmdsEnabled ()
 
void sendCmd (std::ostream &out, char c)
 
void sendCmd (std::ostream &out, int n0, char c)
 
void sendCmd (std::ostream &out, int n0, int n1, char c)
 
void sendCmd (std::ostream &out, int n0, int n1, int n2, char c)
 
std::ostream & operator<< (std::ostream &lhs, const setbold &)
 
std::ostream & operator<< (std::ostream &lhs, const setunderline &)
 
std::ostream & operator<< (std::ostream &lhs, const setfont &f)
 
std::ostream & operator<< (std::ostream &lhs, const setfgc &c)
 
std::ostream & operator<< (std::ostream &lhs, const setbgc &c)
 
std::ostream & operator<< (std::ostream &lhs, const resetfmt &c)
 
std::ostream & operator<< (std::ostream &lhs, const clearscr &c)
 
std::ostream & operator<< (std::ostream &lhs, const setcursor &sc)
 
std::ostream & operator<< (std::ostream &lhs, const movecursor &mc)
 
std::ostream & operator<< (std::ostream &lhs, const eraseToEOL &)
 
std::ostream & operator<< (std::ostream &lhs, const clearline &)
 
hobbes::array< char > * allocGlobalStr (const char *x, size_t len)
 
hobbes::array< char > * allocGlobalStr (const std::string &x)
 
void bindArguments (hobbes::cc &ctx, const Args::NameVals &args)
 
bool hiddenFileName (const std::string &fname)
 
bool loadSilently (const std::string &mfile)
 
void printConstraint (const hobbes::ConstraintPtr &c)
 
void printQualType (const hobbes::Constraints &cs, const hobbes::MonoTypePtr &ty)
 
void writefile (const hobbes::array< char > *fname, const hobbes::array< char > *fdata)
 
int openfd (const hobbes::array< char > *fname, int flags)
 
void closefd (int fd)
 
void removefile (const hobbes::array< char > *fname)
 
const hobbes::array< char > * showTick (long x)
 
void enableConsoleCmds (bool f)
 
const PIOpexec (const hobbes::array< char > *cmd)
 
const hobbes::array< char > * fdReadLine (int fd)
 
const hobbes::array< char > * runPath ()
 
void bindHiDefs (hobbes::cc &c)
 
void setDefaultColorScheme ()
 
void printAnnotatedText (const hobbes::LexicalAnnotation &la)
 
void printAnnotatedError (const hobbes::annotated_error &ae)
 
void printASM (void *, size_t)
 
void showShellHelp (const CmdDescs &cds)
 
void showShellHelp ()
 
std::string prompttext ()
 
char * completionStep (const char *pfx, int state)
 
char ** completions (const char *pfx, int start, int end)
 
void evalLine (char *)
 
void repl (evaluator *ev)
 
std::string saveData (void *, size_t)
 
void runProcess (const std::string &, std::ostream &)
 
unsigned int digitLen (unsigned int x)
 
template<typename C >
unsigned int sumSize (const C &cs)
 
bool isNum (const std::string &x)
 
bool isRegister (const std::string &x)
 
void printASMArg (const std::string &x)
 
unsigned int fmtLen (const str::seq &args)
 
void printASMTable (const str::seq &insts, const str::seqs &args, unsigned int maxlen)
 
void write (int fd, const char *s)
 
void write (int fd, const std::string &s)
 
bool fileExists (const std::string &x)
 
std::string readLink (const std::string &path)
 
std::string exeDir ()
 
bool catPathToFSPath (const std::string &cat, const std::string &cpath, std::string *fsPath)
 
bool sysPathToFSPath (const std::string &sysPath, std::string *fsPath)
 
bool urlPathToFSPath (const std::string &urlPath, std::string *fsPath)
 
void translateHxpFile (std::istream &in, std::ostream &out)
 
time_t lastModification (const std::string &fpath)
 
const cstrlinkTarget (const cstr *p)
 
const cstrslurpFile (const cstr *fpath)
 
const hobbes::array< const cstr *> * csplit (const cstr *s, const cstr *ss)
 
long unixTime ()
 
const cstrformatJSTime (long x)
 
const cstrjsEscape (const cstr *x)
 
std::string urlDecode (const std::string &x)
 
std::string htmlEncode (const std::string &x)
 
std::string showType (hobbes::cc &c, const hobbes::QualTypePtr &t)
 
void print404 (int fd, const std::string &fpath)
 

Variables

ConsoleColors colors
 
bool consoleCmdsEnabled = true
 
evaluatoreval = 0
 
str::seq completionMatches
 

Typedef Documentation

◆ CmdDesc

typedef std::pair<std::string, std::string> hi::CmdDesc

◆ CmdDescs

typedef std::vector<CmdDesc> hi::CmdDescs

◆ color

typedef unsigned char hi::color

◆ cstr

typedef hobbes::array<char> hi::cstr

◆ cstrpair

typedef std::pair<const cstr*, const cstr*> hi::cstrpair

◆ ModuleFiles

typedef std::vector<std::string> hi::ModuleFiles

◆ PIO

typedef std::pair<int, int> hi::PIO

Function Documentation

◆ allocGlobalStr() [1/2]

hobbes::array<char>* hi::allocGlobalStr ( const char *  x,
size_t  len 
)

◆ allocGlobalStr() [2/2]

hobbes::array<char>* hi::allocGlobalStr ( const std::string &  x)

◆ bindArguments()

void hi::bindArguments ( hobbes::cc ctx,
const Args::NameVals args 
)

◆ bindHiDefs()

void hi::bindHiDefs ( hobbes::cc c)

◆ catPathToFSPath()

bool hi::catPathToFSPath ( const std::string &  cat,
const std::string &  cpath,
std::string *  fsPath 
)

◆ closefd()

void hi::closefd ( int  fd)

◆ completions()

char** hi::completions ( const char *  pfx,
int  start,
int  end 
)

◆ completionStep()

char* hi::completionStep ( const char *  pfx,
int  state 
)

◆ csplit()

const hobbes::array< const cstr* >* hi::csplit ( const cstr s,
const cstr ss 
)

◆ DEFINE_STRUCT()

hi::DEFINE_STRUCT ( ConsoleColors  ,
(color, promptfg)  ,
(color, stdtextfg)  ,
(color, errorfg)  ,
(color, hlfg)  ,
(color, divfg)  ,
(color, evalfg)  ,
(color, unsweetfg)  ,
(color, typefg)  ,
(color, llvmfg)  ,
(color, instfg)  ,
(color, argdelimfg)  ,
(color, registerfg)  ,
(color, xnumfg)  ,
(color, xvalfg)  ,
(color, linenumfg)  ,
(color, linenumdelimfg)  ,
(color, evenlinebg)  ,
(color, oddlinebg)   
)

◆ digitLen()

unsigned int hi::digitLen ( unsigned int  x)

◆ enableConsoleCmds()

void hi::enableConsoleCmds ( bool  f)

◆ evalLine()

void hi::evalLine ( char *  x)

◆ exeDir()

std::string hi::exeDir ( )

◆ extConsoleCmdsEnabled()

bool hi::extConsoleCmdsEnabled ( )

◆ fdReadLine()

const hobbes::array<char>* hi::fdReadLine ( int  fd)

◆ fileExists()

bool hi::fileExists ( const std::string &  x)

◆ fmtLen()

unsigned int hi::fmtLen ( const str::seq args)

◆ formatJSTime()

const cstr* hi::formatJSTime ( long  x)

◆ hiddenFileName()

bool hi::hiddenFileName ( const std::string &  fname)

◆ htmlEncode()

std::string hi::htmlEncode ( const std::string &  x)

◆ isNum()

bool hi::isNum ( const std::string &  x)

◆ isRegister()

bool hi::isRegister ( const std::string &  x)

◆ jsEscape()

const cstr* hi::jsEscape ( const cstr x)

◆ lastModification()

time_t hi::lastModification ( const std::string &  fpath)

◆ linkTarget()

const cstr* hi::linkTarget ( const cstr p)

◆ loadSilently()

bool hi::loadSilently ( const std::string &  mfile)

◆ openfd()

int hi::openfd ( const hobbes::array< char > *  fname,
int  flags 
)

◆ operator<<() [1/11]

std::ostream& hi::operator<< ( std::ostream &  lhs,
const setbold  
)
inline

◆ operator<<() [2/11]

std::ostream& hi::operator<< ( std::ostream &  lhs,
const setunderline  
)
inline

◆ operator<<() [3/11]

std::ostream& hi::operator<< ( std::ostream &  lhs,
const setfont f 
)
inline

◆ operator<<() [4/11]

std::ostream& hi::operator<< ( std::ostream &  lhs,
const setfgc c 
)
inline

◆ operator<<() [5/11]

std::ostream& hi::operator<< ( std::ostream &  lhs,
const setbgc c 
)
inline

◆ operator<<() [6/11]

std::ostream& hi::operator<< ( std::ostream &  lhs,
const resetfmt c 
)
inline

◆ operator<<() [7/11]

std::ostream& hi::operator<< ( std::ostream &  lhs,
const clearscr c 
)
inline

◆ operator<<() [8/11]

std::ostream& hi::operator<< ( std::ostream &  lhs,
const setcursor sc 
)
inline

◆ operator<<() [9/11]

std::ostream& hi::operator<< ( std::ostream &  lhs,
const movecursor mc 
)
inline

◆ operator<<() [10/11]

std::ostream& hi::operator<< ( std::ostream &  lhs,
const eraseToEOL  
)
inline

◆ operator<<() [11/11]

std::ostream& hi::operator<< ( std::ostream &  lhs,
const clearline  
)
inline

◆ pexec()

const PIO* hi::pexec ( const hobbes::array< char > *  cmd)

◆ print404()

void hi::print404 ( int  fd,
const std::string &  fpath 
)

◆ printAnnotatedError()

void hi::printAnnotatedError ( const hobbes::annotated_error ae)

◆ printAnnotatedText()

void hi::printAnnotatedText ( const hobbes::LexicalAnnotation la)

◆ printASM()

void hi::printASM ( void *  p,
size_t  len 
)

◆ printASMArg()

void hi::printASMArg ( const std::string &  x)

◆ printASMTable()

void hi::printASMTable ( const str::seq insts,
const str::seqs args,
unsigned int  maxlen 
)

◆ printConstraint()

void hi::printConstraint ( const hobbes::ConstraintPtr c)

◆ printQualType()

void hi::printQualType ( const hobbes::Constraints cs,
const hobbes::MonoTypePtr ty 
)

◆ prompttext()

std::string hi::prompttext ( )

◆ readLink()

std::string hi::readLink ( const std::string &  path)

◆ removefile()

void hi::removefile ( const hobbes::array< char > *  fname)

◆ repl()

void hi::repl ( evaluator ev)

◆ runPath()

const hobbes::array<char>* hi::runPath ( )

◆ runProcess()

void hi::runProcess ( const std::string &  cmd,
std::ostream &  out 
)

◆ saveData()

std::string hi::saveData ( void *  d,
size_t  sz 
)

◆ sendCmd() [1/4]

void hi::sendCmd ( std::ostream &  out,
char  c 
)
inline

◆ sendCmd() [2/4]

void hi::sendCmd ( std::ostream &  out,
int  n0,
char  c 
)
inline

◆ sendCmd() [3/4]

void hi::sendCmd ( std::ostream &  out,
int  n0,
int  n1,
char  c 
)
inline

◆ sendCmd() [4/4]

void hi::sendCmd ( std::ostream &  out,
int  n0,
int  n1,
int  n2,
char  c 
)
inline

◆ setDefaultColorScheme()

void hi::setDefaultColorScheme ( )

◆ showShellHelp() [1/2]

void hi::showShellHelp ( const CmdDescs cds)

◆ showShellHelp() [2/2]

void hi::showShellHelp ( )

◆ showTick()

const hobbes::array<char>* hi::showTick ( long  x)

◆ showType()

std::string hi::showType ( hobbes::cc c,
const hobbes::QualTypePtr t 
)

◆ slurpFile()

const cstr* hi::slurpFile ( const cstr fpath)

◆ sumSize()

template<typename C >
unsigned int hi::sumSize ( const C &  cs)

◆ sysPathToFSPath()

bool hi::sysPathToFSPath ( const std::string &  sysPath,
std::string *  fsPath 
)

◆ translateHxpFile()

void hi::translateHxpFile ( std::istream &  in,
std::ostream &  out 
)

◆ unixTime()

long hi::unixTime ( )

◆ urlDecode()

std::string hi::urlDecode ( const std::string &  x)

◆ urlPathToFSPath()

bool hi::urlPathToFSPath ( const std::string &  urlPath,
std::string *  fsPath 
)

◆ write() [1/2]

void hi::write ( int  fd,
const char *  s 
)

◆ write() [2/2]

void hi::write ( int  fd,
const std::string &  s 
)

◆ writefile()

void hi::writefile ( const hobbes::array< char > *  fname,
const hobbes::array< char > *  fdata 
)

Variable Documentation

◆ colors

ConsoleColors hi::colors

◆ completionMatches

str::seq hi::completionMatches

◆ consoleCmdsEnabled

bool hi::consoleCmdsEnabled = true

◆ eval

evaluator* hi::eval = 0