~ubuntu-branches/ubuntu/vivid/inform/vivid

« back to all changes in this revision

Viewing changes to html/answers2/answer68.html

  • Committer: Bazaar Package Importer
  • Author(s): Jan Christoph Nordholz
  • Date: 2008-05-26 22:09:44 UTC
  • mfrom: (2.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080526220944-ba7phz0d1k4vo7wx
Tags: 6.31.1+dfsg-1
* Remove a considerable number of files from the package
  due to unacceptable licensing terms.
* Repair library symlinks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<HTML><HEAD><TITLE>Answer to Exercise 68</TITLE></HEAD>
2
 
<BODY BGCOLOR="#FFFFFF">
3
 
<TABLE><TR><TD Valign="top"><IMG SRC="../icons/exercise.gif" ALT="??"><TD bgcolor="#FAA89B"><B>ANSWER TO EXERCISE 68</B><TR><TD><TD>
4
 
<P>
5
 
 
6
 
<PRE>
7
 
Constant MAX_FOOTNOTES 10;
8
 
Array footnotes_seen -&#62; MAX_FOOTNOTES;
9
 
Global footnote_count;
10
 
[ Note n i pn;
11
 
    for (i=0:i&#60;footnote_count:i++)
12
 
        if (n==footnotes_seen-&#62;i) pn=i;
13
 
    if (footnote_count==MAX_FOOTNOTES) "** MAX_FOOTNOTES exceeded! **";
14
 
    if (pn==0) { pn=footnote_count++; footnotes_seen-&#62;pn=n; }
15
 
    print " [",pn+1,"]";
16
 
];
17
 
[ FootnoteSub n;
18
 
    if (noun&#62;footnote_count)
19
 
        "No footnote [", noun, "] has been mentioned.";
20
 
    if (noun==0) "Footnotes count upward from 1.";
21
 
    n=footnotes_seen-&#62;(noun-1);
22
 
    print "[",noun,"]  ";
23
 
    switch(n)
24
 
    {   0: "This is a footnote.";
25
 
        1: "D.G.REG.F.D is inscribed around English coins.";
26
 
        2: "~Jackdaws love my big sphinx of quartz~, for example.";
27
 
    }
28
 
];
29
 
Verb "footnote" "note" * number              -&#62; Footnote;
30
 
</PRE>
31
 
 
32
 
And then you can code, for instance,
33
 
<PRE>
34
 
    print "Her claim to the throne is in every pocket ", (Note) 1,
35
 
       ", her portrait in every wallet.";
36
 
</PRE>
37
 
 
38
 
</TABLE>
39
 
<HR>Back to <A HREF="../section27.html#ex68">the exercise in section 27</A><HR>
40
 
<SMALL><I>Mechanically translated to HTML from third edition as revised 16 May 1997. Copyright &#169; Graham Nelson 1993, 1994, 1995, 1996, 1997: all rights reserved.</I></SMALL></BODY></HTML>