123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- % helpunx.red
- %
- % interfacing reduce help file to unix GNU texinfo structure
- %
- % Author: Herbert Melenk, ZIB Berlin
- %
- % November 1992
- %
- % PSL dependent
- %-------------------- output ------------------------------------
- fluid '(outc newl par !*font !*newline nodechain
- prevnode upnodes !*terpri);
- symbolic procedure initoutput();
- <<
- upnodes := {"Top"};
- if null nodechain then
- nodechain:={{"dummy 2",nil,"dummy 1"}};
- prevnode :={nil};
- channellinelength(outfile!*,200);
- myprin2 bldmsg("@setfilename %w.info",package);
- myterpri();
- >>;
- symbolic procedure endoutput();
- nil;
- symbolic procedure verbatim(u);
- <<myterpri();
- if not u then toggle_line();
- myprin2 if u then "@example" else "@end example";
- myterpri();
- if u then toggle_line();
- if not u then
- <<myprin2t "@*"; myprin2t "@noindent"; >>;
- !*verbatim:=u;
- >>;
- symbolic procedure toggle_line();
- <<myterpri!*(); for i:=1:60 do myprin2 "_"; myterpri();>>;
- symbolic procedure newfont(f);
- if currentfont neq f then
- <<fontoff(); currentfont:=f; fonton()>>;
- symbolic procedure fontoff();
- <<%%% if !*font then channelprin2(outfile!*,"}");
- outc:=nil;
- !*font:=nil>>;
- symbolic procedure fonton();
- <<if not !*font then
- <<%%% channelprintf(outfile!*,"{\%w ",currentfont);
- outc := nil>>;
- !*font:=t>>;
- symbolic procedure myprin2 u;
- if not(u eq '!\) then
- <<!*newline:=nil; !*terpri :=nil; channelprin2(outfile!*,u)>>;
- fluid '(!*verbescape);
- symbolic procedure emit_start_verbatim();
- << myprin2 "@example"; myterpri();toggle_line()>>;
- symbolic procedure emit_end_verbatim();
- << toggle_line();myterpri();myprin2 "@end example"; myterpri();>>;
- symbolic procedure verbprin2 u; (textout u) where !*verbatim=t;
- symbolic procedure verbprin2 u;
- if u = '!\ then <<myprin2 '!@ ; !*verbescape :=t>>
- else
- if u=!$eol!$ then <<myprin2 " "; myterpri();!*verbescape := nil>>
- else
- if (u = '!&) then
- <<myprin2 " "; !*verbescape:=par:=newl:=outc:=nil>>
- else
- if u memq '(!{ !}) then
- <<if not !*verbescape then myprin2 "@"; myprin2 u;
- !*verbescape := nil>>
- else
- <<myprin2 u; !*verbescape := nil>>;
- symbolic procedure myprin2t u;
- <<!*newline:=t; channelprin2(outfile!*,u); channelterpri outfile!*;>>;
- symbolic procedure myterpri!*();
- !*terpri or myterpri();
- symbolic procedure myterpri();
- <<channelterpri outfile!*; !*terpri := t>>;
- symbolic procedure textout(u);
- if par and (u=!$eol!$ or u='! ) then nil else
- if u='!{ or u='!} then nil else
- <<fonton();
- if u=!$eol!$ and (!*verbatim or newl)
- then <<myprin2 u; %%% print_newline();
- outc:='! ;newl:=nil; par:=t>>
- else
- if (u = '!&) then
- <<myprin2 " "; par:=newl:=outc:=nil>>
- else
- if (u = '!$) then
- newfont(if currentfont = helvetica then courier else helvetica)
- else
- if (u neq '! ) or (outc neq '! ) or !*verbatim
- then
- <<myprin2(u); outc := u;
- if u=!$eol!$ then newl:=t else
- if u neq '! then newl:=nil;
- par:=nil;
- >>;
- >>;
- symbolic procedure textoutl(l);
- if null l then nil else
- if atom l then textout l else
- for each x in l do textout x;
- symbolic procedure textout2(l);
- if atom l then myprin2 l else
- for each x in l do myprin2
- if x='! then '!_ else x;
- % -------- paragraph heading ---------------------------
- symbolic procedure par_heading(type);
- <<verbprin2 !$eol!$;
- verbprin2 "@noindent"; verbprin2 !$eol!$;
- for each x in explode type do verbprin2 x;
- verbprin2 ":";
- verbprin2 !$eol!$; verbprin2 !$eol!$;
- >>;
- % -------- directory structure -------------------------
- fluid '(!*in!-directory actdir);
- symbolic procedure base_new_dir name;
- % initial call for new section
- <<% name := mycompress name;
- prevnode := nil . prevnode;
- upnodes:= name.upnodes;
- >>;
- symbolic procedure emit_dir_new();
- % closing a section.
- << if upnodes then
- <<actdir := car upnodes; upnodes:=cdr upnodes>>;
- if prevnode then prevnode:=cdr prevnode;
- >>;
- symbolic procedure emit_dir_key u; nil;
- symbolic procedure emit_dir_entry(name,lab);
- begin scalar n,alias;
- if not !*in!-directory then
- <<myterpri(); myprin2 "@menu"; myterpri();!*in!-directory:=t;>>;
- myprin2 "* ";
- textoutl if atom lab then name else lab;
- myprin2 "::";
- n:=length (if atom lab then name else lab)+2;
- for i:=n:25 do myprin2 " ";
- if (alias:=assoc(lab,aliases)) then
- <<myprin2 " "; textoutl cdr alias; myprin2 " ";>>;
- %%% Klappaltar textoutl name;
- if find_type(name) then textoutl find_type(name);
- myterpri();
- end;
- fluid '(typen);
- typen := for each x in
- '("package" "operator" "type" "variable" "concept"
- "switch" "command" "introduction" "declaration")
- collect explode2 x;
- symbolic procedure find_type(name);
- <<while memq('! ,name) do name:=cdr name;
- if name member typen then name else nil
- >>;
- symbolic procedure emit_dir_header(); nil;
- symbolic procedure emit_dir_separator();
- <<myprin2 "@end menu";
- myterpri(); myterpri();
- !*in!-directory:=nil;
- prevnode:=actdir . cdr prevnode;
- >>;
- symbolic procedure emit_dir_label u; nil;
- symbolic procedure emit_dir_title u;
- % emit_node_title (nil,u,'section);
- emit_node_title (u,u,'section);
- symbolic procedure emit_dir_browse(u,n); nil;
- % ---- node structure
- symbolic procedure emit_node_separator();
- <<
- myterpri(); myterpri();
- outc:='! ; par:=t;
- >>;
- symbolic procedure printem(s);
- begin
- fontoff();
- myprin2 "@titlefont{";
- mapc(s,'myprin2);
- myprin2 "}";
- end;
- symbolic procedure printem(s);
- <<mapc(raisestring s,'myprin2);
- myprin2 '! ;
- >>;
- symbolic procedure printref u;
- begin scalar l;
- l := get_label u;
- if l then
- <<myprin2 "[@pxref{";
- mapc(l,'myprin2);
- myprin2 "}] ";
- >>
- else
- <<mapc(u,'myprin2); myprin2 '! >>;
- end;
- symbolic procedure printnameref u;
- <<printref u>>;
- symbolic procedure emit_node_keys u; nil;
- symbolic procedure emit_node_key u;
- if !*verbatim then textoutl u else
- <<myprin2 "@cindex{";
- textoutl u;
- myprin2t "}";
- % textoutl u; das ist hier schon ausgegeben
- >>;
- symbolic procedure emit_hidden_node_key u;
- if !*verbatim then textoutl u else
- <<myprin2 "@cindex{";
- textoutl u;
- myprin2t "}";
- >>;
- symbolic procedure emit_node_label u; nil;
- %symbolic procedure emit_node_title (dummy,u,type);
- symbolic procedure emit_node_title (u,dummy,type);
- begin scalar slot,prev,next,up,cu,z;
- cu := u; % cu:=mycompress u;
- prev := if prevnode then car prevnode;
- slot := assoc(cu,nodechain);
- if null slot then
- <<slot := {cu,nil,prev};
- nodechain :=slot.nodechain;
- >>;
- if prevnode and car prevnode
- and (z:=assoc(car prevnode,nodechain)) then
- <<z:=cdr z; car z :=cu>>;
- up := if upnodes then car upnodes;
- fonton();
- myterpri();
- myprin2 "@node ";
- textoutl u; myprin2 ", ";
- textoutl cadr slot;myprin2 ", ";
- textoutl caddr slot;myprin2 ", ";
- textoutl (up or "(dir)");
- myterpri();
- if null up then <<myprin2 "@top"; myterpri()>>;
- if null prevnode then prevnode := {cu}
- else car prevnode := cu;
- end;
- symbolic procedure emit_node_browse(u,n);
- nil;
- symbolic procedure set_tab(); nil;
- symbolic procedure release_tab(); nil;
- symbolic procedure print_bold u;
- <<fontoff();
- myprin2 "@titlefont{";
- mapc(u,'myprin2);
- myprin2 "}";
- >>;
- symbolic procedure print_newline();
- <<if null !*newline then
- <<channelterpri outfile!*>>;
- !*newline:=t
- >>;
- symbolic procedure second_newline();
- <<!*newline :=nil; print_newline()>>;
- symbolic procedure print_tab (); textout " ";
- %--------------------------------------------------------------
- symbolic procedure tue();
- % job "c:\herbert\whelp\redindex.tex"$
- job("redindex.tex","hugo.x");
- %------------------- printstruct -------------------------------
- symbolic procedure printstruct();
- <<terpri(); printstruct1(car record,1)>>;
- symbolic procedure printstruct1(r,n);
- <<for i:=1:n do prin2 " ";
- mapc(name r,'prin2);
- terpri();
- for each x in reverse seq r do
- printstruct1(nil . x,n+1);
- >>;
- end;
|