aboutsummaryrefslogtreecommitdiff
path: root/src/hyper/search.pamphlet
blob: 7033b0078bae8205709d6b4b226318b18be8d4a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
\documentclass{article}
\usepackage{axiom}
\begin{document}
\title{\$SPAD/src/search}
\author{The Axiom Team}
\maketitle
\begin{abstract}
\end{abstract}
\eject
\tableofcontents
\eject
\section{search.h}
Construct a page with a menu of references to the word.
The syntax of the command is:
\begin{verbatim}
htsearch word
\end{verbatim}
<<htsearch>>=
#!/bin/sh

htbindir=$AXIOM/lib
htpagedir=$AXIOM/share/hypertex/pages


if test -z "$1"
then 
	echo ""|$htbindir/presea case=1 -
else
( cd $htpagedir; $htbindir/hthits "$1" $htpagedir/ht.db |sort -r -n +0.22 |$htbindir/presea case=0 expr="$1" -)
fi
@ 
<<presea>>=
#!/bin/awk -f
BEGIN {n=0;m=0
}

{
	a[n] = $0;
	n=n+1;
        j=split($0,b,"{");
        m=m+substr(b[j],1,length(b[j])-1);
}

END {
 	if (case==1)  
		printf ("\\begin{page}{staticsearchpage}{No matches found}\n")
	else if ( n==0 || m==0 ) 
		printf ("\\begin{page}{staticsearchpage}{No matches found for {\\em %s}}\n",expr)
	     else 
		printf ("\\begin{page}{staticsearchpage}{%d matches found in %d pages for {\\em %s}}\n",m,n,expr);
	printf ("Matches\\tab{8}in Page\n");
	printf "\\beginscroll\n";
	printf "\\beginmenu\n";
        for(i=0;i<n;i++) printf ("%s\n",a[i]);
	printf "\\endmenu\n";
	printf "\\endscroll\n";
	printf "\\end{page}\n";
}
	
@
<<*>>=
@
\eject
\begin{thebibliography}{99}
\bibitem{1} nothing
\end{thebibliography}
\end{document}