source: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/throw.h@ 331

Last change on this file since 331 was 331, checked in by coas-nagasima, 6 years ago

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 1.2 KB
Line 
1/*
2** mruby/throw.h - mruby exception throwing handler
3**
4** See Copyright Notice in mruby.h
5*/
6
7#ifndef MRB_THROW_H
8#define MRB_THROW_H
9
10#if defined(MRB_ENABLE_CXX_ABI)
11# if !defined(__cplusplus)
12# error Trying to use C++ exception handling in C code
13# endif
14#endif
15
16#if defined(MRB_ENABLE_CXX_EXCEPTION) && defined(__cplusplus)
17
18#define MRB_TRY(buf) do { try {
19#define MRB_CATCH(buf) } catch(mrb_jmpbuf_impl e) { if (e != (buf)->impl) { throw e; }
20#define MRB_END_EXC(buf) } } while(0)
21
22#define MRB_THROW(buf) throw((buf)->impl)
23typedef mrb_int mrb_jmpbuf_impl;
24
25#else
26
27#include <setjmp.h>
28
29#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
30#define MRB_SETJMP _setjmp
31#define MRB_LONGJMP _longjmp
32#else
33#define MRB_SETJMP setjmp
34#define MRB_LONGJMP longjmp
35#endif
36
37#define MRB_TRY(buf) do { if (MRB_SETJMP((buf)->impl) == 0) {
38#define MRB_CATCH(buf) } else {
39#define MRB_END_EXC(buf) } } while(0)
40
41#define MRB_THROW(buf) MRB_LONGJMP((buf)->impl, 1);
42#define mrb_jmpbuf_impl jmp_buf
43
44#endif
45
46struct mrb_jmpbuf {
47 mrb_jmpbuf_impl impl;
48
49#if defined(MRB_ENABLE_CXX_EXCEPTION) && defined(__cplusplus)
50 static mrb_int jmpbuf_id;
51 mrb_jmpbuf() : impl(jmpbuf_id++) {}
52#endif
53};
54
55#endif /* MRB_THROW_H */
Note: See TracBrowser for help on using the repository browser.