exception

来自「source of perl for linux application,」· 代码 · 共 75 行

TXT
75
字号
####################################################################################  $Revision: 5 $##  $Author: mhx $##  $Date: 2007/01/02 12:32:31 +0100 $######################################################################################  Version 3.x, Copyright (C) 2004-2007, Marcus Holland-Moritz.##  Version 2.x, Copyright (C) 2001, Paul Marquess.##  Version 1.x, Copyright (C) 1999, Kenneth Albanowski.####  This program is free software; you can redistribute it and/or##  modify it under the same terms as Perl itself.##################################################################################=providesdXCPTXCPT_TRY_STARTXCPT_TRY_ENDXCPT_CATCHXCPT_RETHROW=implementation#ifdef NO_XSLOCKS#  ifdef dJMPENV#    define dXCPT             dJMPENV; int rEtV = 0#    define XCPT_TRY_START    JMPENV_PUSH(rEtV); if (rEtV == 0)#    define XCPT_TRY_END      JMPENV_POP;#    define XCPT_CATCH        if (rEtV != 0)#    define XCPT_RETHROW      JMPENV_JUMP(rEtV)#  else#    define dXCPT             Sigjmp_buf oldTOP; int rEtV = 0#    define XCPT_TRY_START    Copy(top_env, oldTOP, 1, Sigjmp_buf); rEtV = Sigsetjmp(top_env, 1); if (rEtV == 0)#    define XCPT_TRY_END      Copy(oldTOP, top_env, 1, Sigjmp_buf);#    define XCPT_CATCH        if (rEtV != 0)#    define XCPT_RETHROW      Siglongjmp(top_env, rEtV)#  endif#endif=xsmisc/* defined in module3.c */int exception(int throw_e);=xsubsintexception(throw_e)  int throw_e  OUTPUT:    RETVAL=tests plan => 7my $rv;$Devel::PPPort::exception_caught = undef;$rv = eval { &Devel::PPPort::exception(0) };ok($@, '');ok(defined $rv);ok($rv, 42);ok($Devel::PPPort::exception_caught, 0);$Devel::PPPort::exception_caught = undef;$rv = eval { &Devel::PPPort::exception(1) };ok($@, "boo\n");ok(not defined $rv);ok($Devel::PPPort::exception_caught, 1);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?