Mercurial > hg > octave-nkf
comparison src/unwind-prot.cc @ 10066:2cd940306a06
make unwind_protect frames local
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 06 Jan 2010 13:18:41 +0100 |
parents | b3ab22ee8544 |
children | cd96d29c5efa |
comparison
equal
deleted
inserted
replaced
10065:64a06079cae4 | 10066:2cd940306a06 |
---|---|
31 | 31 |
32 #include "error.h" | 32 #include "error.h" |
33 #include "unwind-prot.h" | 33 #include "unwind-prot.h" |
34 #include "utils.h" | 34 #include "utils.h" |
35 | 35 |
36 std::stack<unwind_protect::elem *> unwind_protect::elt_list; | 36 void unwind_protect_safe::gripe_exception (void) |
37 | |
38 std::stack<std::pair <std::string, unwind_protect::frame_id_t> > unwind_protect::tag_list; | |
39 | |
40 void | |
41 unwind_protect::begin_frame (const std::string& tag) | |
42 { | 37 { |
43 tag_list.push (std::make_pair (tag, begin_frame ())); | 38 // FIXME: can this throw an exception? |
44 } | 39 error ("internal: unhandled exception in unwind_protect handler"); |
45 | |
46 void | |
47 unwind_protect::run_frame (const std::string& tag) | |
48 { | |
49 while (! tag_list.empty ()) | |
50 { | |
51 std::pair<std::string, frame_id_t> top = tag_list.top (); | |
52 tag_list.pop (); | |
53 | |
54 run_frame (top.second); | |
55 if (top.first == tag) | |
56 break; | |
57 } | |
58 } | |
59 | |
60 void | |
61 unwind_protect::discard_frame (const std::string& tag) | |
62 { | |
63 while (! tag_list.empty ()) | |
64 { | |
65 std::pair<std::string, frame_id_t> top = tag_list.top (); | |
66 tag_list.pop (); | |
67 | |
68 run_frame (top.second); | |
69 if (top.first == tag) | |
70 break; | |
71 } | |
72 } | 40 } |
73 | 41 |
74 /* | 42 /* |
75 ;;; Local Variables: *** | 43 ;;; Local Variables: *** |
76 ;;; mode: C++ *** | 44 ;;; mode: C++ *** |