[BACK]Return to genhelp.k CVS log [TXT][DIR] Up to [local] / OpenXM / src / k097 / Doc

Diff for /OpenXM/src/k097/Doc/genhelp.k between version 1.1 and 1.2

version 1.1, 2001/01/04 12:29:32 version 1.2, 2001/01/08 05:26:50
Line 1 
Line 1 
 /* $OpenXM$ */  /* $OpenXM: OpenXM/src/k097/Doc/genhelp.k,v 1.1 2001/01/04 12:29:32 takayama Exp $ */
   
 /* Todo  /* Todo
   
   * Helplist should be sorted.    * Example should be rewrited to Ex.
   * Ex. should be removed.  
   * Args and references should be given in the Helplist.    * Args and references should be given in the Helplist.
       See slib.k for the format of Helplist.
       [ , , null, null,"short description"] No arg and no ( ), no reference.
       [ , , ["a","b"],["Load_sm1"],"short description"]
       [ , , [ ], null,"short description"]  No arg, no reference.
   
 */  */
   
   /* It is for category == null */
 def foo() {  def foo() {
   local n,i,key,s,aaa,ref;    local n,i,j,key,s,aaa,ref,keys,shortDesc,category;
   
   Println("DO NOT EDIT THIS FILE. ");    Println("DO NOT EDIT THIS FILE. ");
   Println("It is AUTHOMATICALLY GENERATED.");    Println("It is AUTHOMATICALLY GENERATED.");
   sm1(" (cat standard-0.texi) system ");    sm1(" (cat standard-0.texi) system ");
   n = Length(Helplist);    n = Length(Helplist);
     keys = [" "];  /* This is a gate keeper for shell. */
     for (i=0; i< n; i++ ) {
       category = Helplist[i,0];
       if (Tag(category) == 0) {
         keys = Append(keys,Helplist[i,1,0]);
       }
     }
     keys = sm1(keys," shell ");
     n = Length(keys);
   
   Println("/*&C ");    Println("/*&C ");
   Println("@menu ");    Println("@menu ");
   for (i=0; i<n; i++) {    for (i=1; i<n; i++) {
     Print("* "); Print(Helplist[i,0]); Println("::");      Print("* "); Print(keys[i]); Println("::");
   }    }
   Println("@end menu"); Ln();    Println("@end menu"); Ln();
   Println(" */"); Ln();    Println(" */"); Ln();
   
   n = Length(Helplist);    for (j=1; j<n; j++) {
   for (i=0; i<n; i++) {       Print("//&C @c "); Print(j); Print("/"); Println(n-1);
      Print("//&C @c "); Println(i);       Stderr.Print(j/(n-1)); Stderr.Print(" ");
      key = Helplist[i,0];       Stderr.Flush();
      s = Helplist[i,1];       i = 0;
      if (Length(Helplist[i]) > 2) {       while (i < n-1) {
        aaa = Helplist[i,2];         if (keys[j] == Helplist[i,1,0]) {
        ref = Helplist[i,3];           key = Helplist[i,1,0];
      }else{           s = Helplist[i,1,1];
        aaa = " (?) ";           if (Length(Helplist[i,1]) > 2) {
        ref = "Not yet written.";             if (Length(Helplist[i,1]) != 5) {
                 Stderr.Print(Helplist[i,1]);
                 Stderr.Println(" has a bad format. ");
                 Error("Stop by an error.");
              }
              aaa = Helplist[i,1,2];
              ref = Helplist[i,1,3];
              shortDesc = Helplist[i,1,4];
            }else{
              aaa = " (?) ";
              ref = "Not yet written.";
              shortDesc = " ";
            }
            break;
          }
          i++;
      }       }
      printItem(key,s,aaa,ref);       printItem(key,s,aaa,ref,shortDesc);
   }    }
   
   sm1(" (cat standard-1.texi) system ");    sm1(" (cat standard-1.texi) system ");
   
 }  }
   
 def printItem(key,s,aaa,ref) {  def printItem(key,s,aaa,ref,shortDesc) {
   local desc,example;    local desc,example,i,shortDesc;
   desc = splitExample(s);    desc = splitExample(s);
   
   Println("/*&en ");    Println("/*&en ");
Line 56  def printItem(key,s,aaa,ref) {
Line 85  def printItem(key,s,aaa,ref) {
   Print("@subsection @code{"); Print(key); Println("}");    Print("@subsection @code{"); Print(key); Println("}");
   Print("@findex "); Println(key);    Print("@findex "); Println(key);
   Println("@table @t");    Println("@table @t");
   Print("@item "); Print(key);  Println(aaa);    Print("@item "); Print(key);
   Print(":: "); Println(desc[0]);    if (Tag(aaa) != 0) {
       if (IsArray(aaa)) {
         Print(AsciiToString(LeftBracket)); /* ( */
         if (Length(aaa) >0) {
           for (i=0; i<Length(aaa)-1; i++) {
             Print("@var{"); Print(aaa[i]);
             Print("},");
           }
           Print("@var{"); Print(aaa[Length(aaa)-1]);
           Print("}");
         }
         Print(AsciiToString(RightBracket)); /* ) */
       }else{
         Println(aaa);
       }
     }else{
       Ln();
     }
     Print(":: "); Println(shortDesc);
   Println("@end table");    Println("@end table");
   Ln();    Ln();
   Println(" */");    Println(" */");
Line 76  def printItem(key,s,aaa,ref) {
Line 123  def printItem(key,s,aaa,ref) {
     Ln();      Ln();
     Println(" */ ");      Println(" */ ");
   }    }
   Println("/*&C ");    if (Tag(ref) != 0) {
   Println("@table @t");      Println("/*&C ");
   Println("@item Reference");      Println("@table @t");
   Println(ref);      Println("@item See also");
   Println("@end table");      if (IsArray(ref)) {
   Ln();        if (Length(ref) > 0) {
   Println(" */ ");          for (i=0; i<Length(ref)-1; i++) {
             Print("@code{");
             Print(ref[i]); Print("}"); Print(", ");
           }
           Print("@code{");
           Print(ref[Length(ref)-1]); Println("} ");
         }
       }else{
         Println(ref);
       }
       Println("@end table");
       Ln();
       Println(" */ ");
     }
 }  }
   
 def findKey(keys,s) {  def findKey(keys,s) {
Line 162  def splitExample(s) {
Line 222  def splitExample(s) {
 }  }
   
 def addEscape(s) {  def addEscape(s) {
   local i,n,ans,leftCurryBrace,rightCurryBrace,at;    local i,n,ans,leftCurryBrace,rightCurryBrace,at,leftIneq,rightIneq,
           ex0;
   leftCurryBrace = 123;    leftCurryBrace = 123;
   rightCurryBrace = 125;    rightCurryBrace = 125;
   at = 64;    leftIneq = 60; /* < */
     rightIneq = 62; /* > */
     at = 64; /* @ */
     ex0 = StringToAsciiArray("Ex.");
   s = StringToAsciiArray(s);    s = StringToAsciiArray(s);
   n = Length(s);    n = Length(s);
     s = Join(s,[0,0,0,0]);
   ans = [ ];    ans = [ ];
   for (i=0; i<n; i++) {    i = 0;
     while (i < n) {
     if (s[i] == leftCurryBrace) {      if (s[i] == leftCurryBrace) {
       ans = Join(ans,[64,leftCurryBrace]);        ans = Join(ans,[64,leftCurryBrace]);
     }else if (s[i] == rightCurryBrace) {      }else if (s[i] == rightCurryBrace) {
       ans = Join(ans,[64,rightCurryBrace]);        ans = Join(ans,[64,rightCurryBrace]);
     }else{      }else if (s[i] == leftIneq && s[i+1] == leftIneq) {
         ans = Join(ans,Append(StringToAsciiArray("@var"),leftCurryBrace));
         i++;
       }else if (s[i] == rightIneq && s[i+1] == rightIneq) {
         ans = Join(ans,[rightCurryBrace]);
         i++;
       }else if ([s[i],s[i+1],s[i+2]] == ex0) {
         i = i+2;
       }else {
       ans = Append(ans,s[i]);        ans = Append(ans,s[i]);
     }      }
       i++;
   }    }
   return(AddString(Map(ans,"AsciiToString")));    return(AddString(Map(ans,"AsciiToString")));
 }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>