Last change
on this file since 270 was 270, checked in by coas-nagasima, 7 years ago |
mruby版ECNLプロトタイピング・ツールを追加
|
-
Property svn:eol-style
set to
native
-
Property svn:keywords
set to
Id
-
Property svn:mime-type
set to
text/x-chdr
|
File size:
832 bytes
|
Rev | Line | |
---|
[270] | 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 | #ifdef MRB_ENABLE_CXX_EXCEPTION
|
---|
| 11 |
|
---|
| 12 | #define MRB_TRY(buf) do { try {
|
---|
| 13 | #define MRB_CATCH(buf) } catch(mrb_jmpbuf_impl e) { if (e != (buf)->impl) { throw e; }
|
---|
| 14 | #define MRB_END_EXC(buf) } } while(0)
|
---|
| 15 |
|
---|
| 16 | #define MRB_THROW(buf) throw((buf)->impl)
|
---|
| 17 | typedef mrb_int mrb_jmpbuf_impl;
|
---|
| 18 |
|
---|
| 19 | #else
|
---|
| 20 |
|
---|
| 21 | #include <setjmp.h>
|
---|
| 22 |
|
---|
| 23 | #define MRB_TRY(buf) do { if (setjmp((buf)->impl) == 0) {
|
---|
| 24 | #define MRB_CATCH(buf) } else {
|
---|
| 25 | #define MRB_END_EXC(buf) } } while(0)
|
---|
| 26 |
|
---|
| 27 | #define MRB_THROW(buf) longjmp((buf)->impl, 1);
|
---|
| 28 | #define mrb_jmpbuf_impl jmp_buf
|
---|
| 29 |
|
---|
| 30 | #endif
|
---|
| 31 |
|
---|
| 32 | struct mrb_jmpbuf {
|
---|
| 33 | mrb_jmpbuf_impl impl;
|
---|
| 34 |
|
---|
| 35 | #ifdef MRB_ENABLE_CXX_EXCEPTION
|
---|
| 36 | static mrb_int jmpbuf_id;
|
---|
| 37 | mrb_jmpbuf() : impl(jmpbuf_id++) {}
|
---|
| 38 | #endif
|
---|
| 39 | };
|
---|
| 40 |
|
---|
| 41 | #endif /* MRB_THROW_H */
|
---|
Note:
See
TracBrowser
for help on using the repository browser.