Changeset 35664ec in git


Ignore:
Timestamp:
May 3, 2005, 4:30:09 PM (19 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
762bfd45c4210aff6f5f912140dfdf36131213c9
Parents:
2e6eac218988a6cdb89b0be44b0a24dd62ac41a7
Message:
*hannes: help for packages,xx::yy, proc from dyn. modules


git-svn-id: file:///usr/local/Singular/svn/trunk@8021 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/fehelp.cc

    r2e6eac2 r35664ec  
    44/*
    55* ABSTRACT: help system
    6 * versin $Id: fehelp.cc,v 1.41 2005-05-02 16:31:55 Singular Exp $
     6* versin $Id: fehelp.cc,v 1.42 2005-05-03 14:30:09 Singular Exp $
    77*/
    88
     
    637637}
    638638
     639// test for h being a string and print it
     640static void hePrintHelpStr(const idhdl hh,const char *id,const char *pa)
     641{
     642  if ((hh!=NULL) && (IDTYP(hh)==STRING_CMD))
     643  {
     644    PrintS(IDSTRING(hh));
     645    PrintLn();
     646  }
     647  else
     648    Print("`%s` not found in package %s\n",id,pa);
     649}
    639650// try to find the help string as a loaded procedure or library
    640651// if found, display the help and return TRUE
     
    642653static BOOLEAN heOnlineHelp(char* s)
    643654{
    644 #ifdef HAVE_NS
    645655  idhdl h=IDROOT->get(s,myynest);
    646 #else
    647   idhdl h=idroot->get(s,myynest);
    648 #endif /* HAVE_NS */
     656  char *ss;
    649657
    650658  // try help for a procedure
    651   if ((h!=NULL) && (IDTYP(h)==PROC_CMD))
    652   {
    653     char *lib=iiGetLibName(IDPROC(h));
    654     if((lib!=NULL)&&(*lib!='\0'))
    655     {
    656       Print("// proc %s from lib %s\n",s,lib);
    657       s=iiGetLibProcBuffer(IDPROC(h), 0);
    658       if (s!=NULL)
    659       {
    660         PrintS(s);
    661         omFree((ADDRESS)s);
    662       }
    663       return TRUE;
     659  if (h!=NULL)
     660  {
     661    if  (IDTYP(h)==PROC_CMD)
     662    {
     663      char *lib=iiGetLibName(IDPROC(h));
     664      if((lib!=NULL)&&(*lib!='\0'))
     665      {
     666        Print("// proc %s from lib %s\n",s,lib);
     667        s=iiGetLibProcBuffer(IDPROC(h), 0);
     668        if (s!=NULL)
     669        {
     670          PrintS(s);
     671          omFree((ADDRESS)s);
     672        }
     673        return TRUE;
     674      }
     675      else
     676      {
     677        char s_help[200];
     678        strcpy(s_help,s);
     679        strcat(s_help,"_help");
     680        idhdl hh=IDROOT->get(s_help,0);
     681        hePrintHelpStr(hh,s_help,"Top");
     682      }
     683    }
     684    else if (IDTYP(h)==PACKAGE_CMD)
     685    {
     686      idhdl hh=IDPACKAGE(h)->idroot->get("info",0);
     687      hePrintHelpStr(hh,"info",s);
     688    }
     689    else if ((ss=strstr(s,"::"))!=NULL)
     690    {
     691      *ss='\0';
     692      ss+=2;
     693      h=ggetid(s);
     694      if (h!=NULL)
     695      {     
     696        Print("help for %s from package %\n",ss,s);
     697        char s_help[200];
     698        strcpy(s_help,ss);
     699        strcat(s_help,"_help");
     700        idhdl hh=IDPACKAGE(h)->idroot->get(s_help,0);
     701        hePrintHelpStr(hh,s_help,s);
     702      }
     703      else Print("package %s not found\n",s);
    664704    }
    665705    return FALSE;
Note: See TracChangeset for help on using the changeset viewer.