From 08e65445760a453a95f9039f9ea6ab626789a12d Mon Sep 17 00:00:00 2001 From: schodet Date: Wed, 19 Apr 2006 18:49:31 +0000 Subject: Ajout de la gestion de l'aide dans l'interpreteur. --- i/marvin/src/interpreter/interpreter.hh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'i/marvin/src/interpreter/interpreter.hh') 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 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 Funcs; + typedef std::map 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 static Func *memFunc (T &i, F f); -- cgit v1.2.3