summaryrefslogtreecommitdiff
path: root/i/marvin/src/interpreter/interpreter.hh
diff options
context:
space:
mode:
Diffstat (limited to 'i/marvin/src/interpreter/interpreter.hh')
-rw-r--r--i/marvin/src/interpreter/interpreter.hh13
1 files changed, 12 insertions, 1 deletions
diff --git a/i/marvin/src/interpreter/interpreter.hh b/i/marvin/src/interpreter/interpreter.hh
index 4164c28..1f6e688 100644
--- a/i/marvin/src/interpreter/interpreter.hh
+++ b/i/marvin/src/interpreter/interpreter.hh
@@ -51,14 +51,23 @@ class Interpreter
template<class T, typename F>
class MemFunc;
private:
+ struct FuncDesc
+ {
+ Func *func;
+ std::string desc;
+ FuncDesc (Func *func_, const std::string &desc_)
+ : func (func_), desc (desc_) { }
+ };
/// Type of the private function map.
- typedef std::map<std::string, Func *> Funcs;
+ typedef std::map<std::string, FuncDesc> Funcs;
/// The function map itself.
Funcs funcs_;
public:
/// Destructor.
~Interpreter (void);
/// Add a function, Interpreter owns f.
+ void add (const std::string &s, Func *f, const std::string &desc);
+ /// Add a function without description, Interpreter owns f.
void add (const std::string &s, Func *f);
/// Call a function by name.
void call (const std::string &s, const Args &a,
@@ -67,6 +76,8 @@ class Interpreter
void interpretString (const std::string &s, bool dryrun = false);
/// Interpret a file.
void interpretFile (const std::string &file, bool dryrun = false);
+ /// Return an help string.
+ std::string help (void) const;
/// Take all the template sophistications out of the programmer hands.
template<class T, typename F>
static Func *memFunc (T &i, F f);