8 hours ago

its undocumented leaving this code as an example

import std.stdio;
import std.random;
import core.sys.posix.setjmp;

jmp_buf jump;
void main(){
	final switch(setjmp(jump)){//mandated pattern, idk how c knows, cant be s implied to 0
		case 0:
			"starting".writeln;
			a(); break;
		case 1:
			"ending".writeln; break;
}}

void a(){
	"a".writeln;
	if(uniform(0,2)){
		b();
	} else {
		c();
	}
	assert(0);
}

void b(){
	"b".writeln;
	if(uniform(0,2)){
		a();
	} else {
		c();
	}
	assert(0);
}
void c(){
	"c".writeln;
	switch(uniform(0,10)){
		case 0:
			"end".writeln;
			longjmp(jump,1); break;
		default:
			if(uniform(0,2)){
					a();
				} else {
					b();
			}
}}