1
2[ TestGivenInput ix inbufvar;
3
4  print "This tests whether your interpreter supports being handed
5    input by the game file. (For example, after a function key is hit
6    in Beyond Zork, the command prompt appears with text already in
7    place -- whatever text you had typed before you interrupted it
8    with the function key.)^^";
9
10  print "The command prompt below should appear with the word
11    ~Given~ already visible after it. You should be able to type
12    more characters, or go back and edit the given character as if
13    you had typed them yourself.^^";
14
15  print "If you see the word ~Given~ twice, your interpreter is
16    printing the given characters, which it shouldn't (that's
17    the responsibility of the game file.)^^";
18
19  print "Preload> Given";
20  inbuf->0 = (INBUFSIZE-3);
21  inbuf->1 = 5;
22
23  inbuf->2 = 'G';
24  inbuf->3 = 'i';
25  inbuf->4 = 'v';
26  inbuf->5 = 'e';
27  inbuf->6 = 'n';
28
29  inbufvar = inbuf;
30  ix = 0;
31  @aread inbufvar ix;
32
33    if (inbuf->1 == 0)
34      print "You just typed a blank line.^";
35    else {
36      print "You just typed ~";
37      for (ix=0: ix<inbuf->1: ix++)
38      	print (char)(inbuf->(2+ix));
39      print "~.^";
40    }
41
42];
43