/* $OpenXM: OpenXM/src/k097/Doc/genhelp.k,v 1.2 2001/01/08 05:26:50 takayama Exp $ */ /* Todo * Example should be rewrited to Ex. * 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() { local n,i,j,key,s,aaa,ref,keys,shortDesc,category; Println("DO NOT EDIT THIS FILE. "); Println("It is AUTHOMATICALLY GENERATED."); sm1(" (cat standard-0.texi) system "); 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("@menu "); for (i=1; i 2) { 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,shortDesc); } sm1(" (cat standard-1.texi) system "); } def printItem(key,s,aaa,ref,shortDesc) { local desc,example,i,shortDesc; desc = splitExample(s); Println("/*&en "); Print("@c "); Print(" ------------- start of "); Print(key); Println(" --------------"); Println("@menu"); Print("* "); Print(key); Println("::"); Println("@end menu"); Print("@node "); Print(key); Println(",,, STANDARD function"); Print("@subsection @code{"); Print(key); Println("}"); Print("@findex "); Println(key); Println("@table @t"); Print("@item "); Print(key); if (Tag(aaa) != 0) { if (IsArray(aaa)) { Print(AsciiToString(LeftBracket)); /* ( */ if (Length(aaa) >0) { for (i=0; i 0) { for (i=0; i 0) { tt = Map(tt,"AsciiToString"); tt = AddString(tt); }else{ tt = AsciiToString(10); } news = Append(news,tt); tt = [ ]; } } if (Length(tt) > 0) { tt = Map(tt,"AsciiToString"); tt = AddString(tt); news = Append(news, tt); } s = news; } n = Length(s); inExample = false; newl = AsciiToString(10); desc = " "; example = " "; i = 0; while (i */ at = 64; /* @ */ ex0 = StringToAsciiArray("Ex."); s = StringToAsciiArray(s); n = Length(s); s = Join(s,[0,0,0,0]); ans = [ ]; i = 0; while (i < n) { if (s[i] == leftCurryBrace) { ans = Join(ans,[64,leftCurryBrace]); }else if (s[i] == rightCurryBrace) { ans = Join(ans,[64,rightCurryBrace]); }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]); } i++; } return(AddString(Map(ans,"AsciiToString"))); } foo();