home *** CD-ROM | disk | FTP | other *** search
/ FreeWare Collection 2 / FreeSoftwareCollection2pd199x-jp.img / ms_dos / update / gosub.h < prev    next >
Text File  |  1990-06-14  |  441b  |  23 lines

  1. /*
  2.  *    gosub.h
  3.  *    subroutine call 'gosub' & 'retsub' for Turbo C
  4.  *    usage : gosub(<tag>);
  5.  *        ・・・
  6.  *        return;
  7.  *        <tag>:
  8.  *        ・・・
  9.  *        retsub;
  10.  *    1988/4/5    Sey
  11.  */
  12. #include    <setjmp.h>
  13.  
  14. #ifndef        _SUBLVLMAX_
  15. #define        _SUBLVLMAX_    10
  16. #endif
  17.  
  18. static jmp_buf    _GOSUBBUF_[_SUBLVLMAX_];
  19. static unsigned    _SUBLVL_ = 0;
  20.  
  21. #define    gosub(tag)    if(!setjmp(_GOSUBBUF_[_SUBLVL_++]))goto tag
  22. #define    retsub        longjmp(_GOSUBBUF_[--_SUBLVL_],1)
  23.