File: comsub.tex

package info (click to toggle)
kimwitu-doc 10a-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 1,192 kB
  • ctags: 341
  • sloc: makefile: 166; yacc: 125; ansic: 40; lex: 18; sh: 2
file content (37 lines) | stat: -rw-r--r-- 1,584 bytes parent folder | download | duplicates (2)
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
% Remember to use the lgrind style

\File{comsub.k},{15:30},{Jul 19 1996}
\L{\LB{\C{}\1\* A very simple tree structure \*\1\CE{}}}
\L{\LB{\V{funnytree}_\{\K{uniq}\}:}\Tab{24}{\V{Str}(\K{casestring})}}
\L{\LB{\|_}\Tab{24}{\V{Cons}(\V{funnytree}_\V{funnytree})}}
\L{\LB{\{}\Tab{24}{\K{int}_\V{ocs}_=_0;}}
\L{\LB{}\Tab{24}{\V{funnytree}_\V{next}_;}}
\L{\LB{}\Tab{24}{\{_\V{\$0}\-\!\>\V{next}_=_\V{alltrees};}}
\L{\LB{}\Tab{24}{__\V{alltrees}_=_\V{\$0};_\}}}
\L{\LB{\}}}
\L{\LB{;}}
\L{\LB{}}
\L{\LB{\K{void}_\V{occurs}(\V{funnytree}_\V{\$f})_\{}}
\L{\LB{____\V{Str}:}\Tab{24}{\{_\V{f}\-\!\>\V{ocs}++;_\}}}
\L{\LB{____\V{Cons}(\V{f1},_\V{f2}):}\Tab{24}{\{_\V{f}\-\!\>\V{ocs}++;_\V{occurs}(\V{f1});_\V{occurs}(\V{f2});_\}}}
\L{\LB{\}}}
\L{\LB{}}
\L{\LB{\%\{_\V{KC\_TYPES\_HEADER}}}
\L{\LB{\V{funnytree}_\V{alltrees};}}
\L{\LB{\%\}}}
\L{\LB{}}
\L{\LB{\K{int}_\V{main}()_\{}}
\L{\LB{____\V{funnytree}_\V{ft},_\V{it};}}
\L{\LB{}}
\L{\LB{____\V{alltrees}_=_(\V{funnytree})0;}}
\L{\LB{____\V{ft}_=_\V{Str}(\V{mkcasestring}(\S{}\"foo\"\SE{}));}}
\L{\LB{____\V{ft}_=_\V{Cons}(\V{ft},_\V{ft});}}
\L{\LB{____\V{ft}_=_\V{Cons}(\V{ft},_\V{Str}(\V{mkcasestring}(\S{}\"bar\"\SE{})));}}
\L{\LB{____\V{ft}_=_\V{Cons}(\V{ft},_\V{ft});}}
\L{\LB{____\V{it}_=_\V{alltrees};}}
\L{\LB{____\V{occurs}(\V{it});}}
\L{\LB{____\K{for}(;_\V{it}!=_(\V{funnytree})0;_\V{it}=_\V{it}\-\!\>\V{next})_\{}}
\L{\LB{}\Tab{8}{\K{if}_(\V{it}\-\!\>\V{ocs}\>1)_\{}}
\L{\LB{}\Tab{8}{____\V{printf}(\S{}\"occurs_\%d_times:\2n\"\SE{},_\V{it}\-\!\>\V{ocs});}}
\L{\LB{}\Tab{8}{____\V{print\_funnytree}(\V{it});}}
\L{\LB{\}___\}___\}}}