Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,25 @@
void
throwing(void)
{
o_text("throwing...\n");
error("now!");
}
void
catching(void)
{
o_text("ready to catch\n");
if (trap(throwing)) {
o_text("caught!\n");
} else {
# nothing was thrown
}
}
integer
main(void)
{
catching();
return 0;
}

View file

@ -0,0 +1,39 @@
void
ft(integer a, text &s)
{
if (a & 1) {
s = "odd";
error("bad number");
} elif (a & a - 1) {
s = "not a power of two";
error("bad number");
}
}
void
fc(integer a)
{
text e;
if (trap(ft, a, e)) {
v_text("exception of type `");
v_text(e);
v_text("' thrown for ");
v_integer(a);
v_newline();
} else {
v_text("no exception thrown for ");
v_integer(a);
v_newline();
}
}
integer
main(void)
{
fc(5);
fc(6);
fc(8);
return 0;
}