Re: Gnucap Comprehensive Help System Implementation Details

Felix Salfelder <[email protected]>
Newsgroups gmane.comp.gnu.gnucap.devel
Message-ID <[email protected]>
On Sun, May 25, 2014 at 04:46:42PM +0200, Rishabh Yadav wrote:
> On Sun, May 25, 2014 at 4:14 PM, Felix Salfelder <[email protected]>wrote:
> What I am able to understand from your model is that you want to have a
> module embedded in each source file that contains the documentation and
> examples and then we need a plugin which gives a call to that module to
> present the help manual to the user.Correct me,if I am wrong.

not a module in each source file, but a procedure in each card.

the basic idea (very rough sketch, actually)

class CMD_HELP: public CARD {
  do_it(){
    string what;
    cmd >> what;
    const CARD* thing = find(what);
    out = <some stream>;
    out << "help on " << what << ":" << endl;
    what.help(out);
  }

  static string helptext;
  void help(stream out){
    out << helptext
  }
}c;

string CMD_HELP::helptext = "helptext on help";

DISPATCHER<CMD>::INSTALL d0(&command_dispatcher, "help", &c);

and then:
gnucap> help help
help on help:
helptext on help

cheers
felix
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.