1 # Read in commands.c and add texinfo commands. See Makefile.am.
7 if ($
0 ~
/!
BEGIN-HELP
-TEXT!
/) {
12 if ($
0 ~
/!
END-HELP
-TEXT!
/) {
15 else if ($
0 ~
/new_command\
(/) {
19 idx = index($0,"\\n
")+7;
20 chapter = substr($0,idx,length())
21 sub(/ \*\//,"",chapter)
24 name = sub(/^[^ ]*/,"&")
26 if (length($name) > name_length)
27 name_length = length($name)
29 info = "@node
" $name ", !
NEXT!
, !PREV!
, Commands
\n"
30 info = info "@chapter
" chapter "\n"
31 info = info "@cindex
" $name " command
\n"
32 info = info "Syntax
:\n"
33 info = info "@example
\n"
35 info = info "@
end example
\n"
36 list[list_total "," "name
"] = $name
50 list[list_total "," "chapter
"] = chapter
51 list[list_total "," "info
"] = info
52 list[list_total "," "desc
"] = desc
60 # Borrowed from http://awk.info/?TenLiners
62 function qsort(A, left, right, i, last) {
65 swap(A, left, left+int((right-left+1)*rand()))
67 for (i = left+1; i <= right; i++)
68 if (A[i "," "name
"] < A[left "," "name
"])
71 qsort(A, left, last-1)
72 qsort(A, last+1, right)
75 function swap(A, i, j, hrm) {
76 name = A[i "," "name
"];
77 chapter = A[i "," "chapter
"];
78 info = A[i "," "info
"];
79 desc = A[i "," "desc
"];
80 A[i "," "name
"] = A[j "," "name
"]
81 A[i "," "chapter
"] = A[j "," "chapter
"]
82 A[i "," "info
"] = A[j "," "info
"]
83 A[i "," "desc
"] = A[j "," "desc
"]
84 A[j "," "name
"] = name;
85 A[j "," "chapter
"] = chapter;
86 A[j "," "info
"] = info;
87 A[j "," "desc
"] = desc;
91 qsort(list, 1, list_total-1)
93 print "@menu
" > "menu.texi
"
94 for (t = 1; t < list_total; t++) {
96 sub(/!PREV!/, "", list[t "," "info
"])
99 sub(/!PREV!/, list[t-1 "," "name
"], list[t "," "info
"])
102 if (t == list_total-1) {
103 sub(/!NEXT!/, "", list[t "," "info
"])
106 sub(/!NEXT!/, list[t+1 "," "name
"], list[t "," "info
"])
109 print list[t "," "info
"] "\n" list[t "," "desc
"]
111 n = name_length - length(list[t "," "name
"])
116 print "* " list[t "," "name
"] "::" sp list[t "," "chapter
"] >> "menu.texi
"
119 print "@
end menu
" > "menu.texi
"