Team Ai
Datasetpublic

hschumann2/TempleOS-Source-Code

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes847downloads
Exceptions.txt49 linesDownload Raw Back to Demo
1 2//WARNING: Don't return out of a catch{}.  This3//might get fixed.4 5//You can use PutExcept() in a catch stmt6//and it will report args.7Bool Prompt(I64 i)8{9  "%d ",i;10  return YorN;11}12 13U0 D1()14{15  "D1\n";16  if (Prompt(1)) throw('Point1');17  if (Prompt(2)) throw('Point2');18}19 20U0 D2()21{22  "D2\n";23  try {24    D1;25    if (Prompt(4)) throw('Point4');26  } catch {27    "D2 hndlr\n"28          "Ch:%c:%P\n",Fs->except_ch,Fs->except_callers[0];29    if (Fs->except_ch=='Point1') {30      "Caught in D2\n";31      Fs->catch_except=TRUE;32    }33  }34}35 36U0 Demo()37{38  try {39    D2;40    if (Prompt(3)) throw('Point3');41  } catch {42    "Demo hndlr\n"43          "Ch:%c:%P\n",Fs->except_ch,Fs->except_callers[0];44    Fs->catch_except=TRUE;45  }46}47 48Demo;49