This work! Amazing!! We have coroutines! Note in particular branch-and-link is just a library function!!!!
proc branch-and-link (target:&LABEL, save:&LABEL) { save <- label_address next; goto-indirect *target; next:> } // Coroutine test! // // We're going to have two procedures which just // oscilate between each other. The tricky bit // is initialisation of the variables. // We can branch-and-link between labels but // the entry point of a procedure isn't a label. var p1 : LABEL; var p2 : LABEL; proc co1 () { // start here println$ "ONE"; // set our restart point &p1 <- label_address entry1; // now call the other coroutine co2; // we want it to come back to here entry1:> println$ "THREE"; // now we can zig-zag branch-and-link (&p2, &p1); println$ "FIVE"; // end properly } proc co2 () { // here we got started by co1 println$ "TWO"; // since p1 is already set we can just do this now: branch-and-link (&p1, &p2); // and we're back from co1 again println$ "FOUR"; // now just jump out goto-indirect p1; // no way to ever get here } // run coroutines co1; -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ WatchGuard Dimension instantly turns raw network data into actionable security intelligence. It gives you real-time visual feedback on key security issues and trends. Skip the complicated setup - simply import a virtual appliance and go from zero to informed in seconds. http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language