File size: 736 Bytes
806d4b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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

//WARNING: Don't return out of a catch{}.  This
//might get fixed.

//You can use PutExcept() in a catch stmt
//and it will report args.
Bool Prompt(I64 i)
{
  "%d ",i;
  return YorN;
}

U0 D1()
{
  "D1\n";
  if (Prompt(1)) throw('Point1');
  if (Prompt(2)) throw('Point2');
}

U0 D2()
{
  "D2\n";
  try {
    D1;
    if (Prompt(4)) throw('Point4');
  } catch {
    "D2 hndlr\n"
          "Ch:%c:%P\n",Fs->except_ch,Fs->except_callers[0];
    if (Fs->except_ch=='Point1') {
      "Caught in D2\n";
      Fs->catch_except=TRUE;
    }
  }
}

U0 Demo()
{
  try {
    D2;
    if (Prompt(3)) throw('Point3');
  } catch {
    "Demo hndlr\n"
          "Ch:%c:%P\n",Fs->except_ch,Fs->except_callers[0];
    Fs->catch_except=TRUE;
  }
}

Demo;