home *** CD-ROM | disk | FTP | other *** search
- /*
- * gosub.h
- * subroutine call 'gosub' & 'retsub' for Turbo C
- * usage : gosub(<tag>);
- * ・・・
- * return;
- * <tag>:
- * ・・・
- * retsub;
- * 1988/4/5 Sey
- */
- #include <setjmp.h>
-
- #ifndef _SUBLVLMAX_
- #define _SUBLVLMAX_ 10
- #endif
-
- static jmp_buf _GOSUBBUF_[_SUBLVLMAX_];
- static unsigned _SUBLVL_ = 0;
-
- #define gosub(tag) if(!setjmp(_GOSUBBUF_[_SUBLVL_++]))goto tag
- #define retsub longjmp(_GOSUBBUF_[--_SUBLVL_],1)