Update README.md
[nemesis.git] / Platform / Finally.h
1 /*
2  Copyright (c) 2008-2009 TrueCrypt Developers Association. All rights reserved.
3
4  Governed by the TrueCrypt License 3.0 the full text of which is contained in
5  the file License.txt included in TrueCrypt binary and source code distribution
6  packages.
7 */
8
9 #ifndef TC_HEADER_Platform_Finally
10 #define TC_HEADER_Platform_Finally
11
12 #include "PlatformBase.h"
13
14 // Execute code when leaving scope
15 #define finally_do(code) \
16 struct TC_JOIN(Finally,__LINE__) \
17 { \
18         TC_JOIN(~Finally,__LINE__) () { try { code } catch (...) { } } \
19 } \
20 TC_UNUSED_VAR \
21 TC_JOIN(finally,__LINE__)
22
23 // Execute code with argument 'finally_arg' when leaving scope 
24 #define finally_do_arg(argType, arg, code) \
25 struct TC_JOIN(Finally,__LINE__) \
26 { \
27         TC_JOIN(Finally,__LINE__) (argType a) : finally_arg (a) { } \
28         TC_JOIN(~Finally,__LINE__) () { try { code } catch (...) { } } \
29         argType finally_arg; \
30 } \
31 TC_UNUSED_VAR \
32 TC_JOIN(finally,__LINE__) (arg)
33
34 #define finally_do_arg2(argType, arg, argType2, arg2, code) \
35 struct TC_JOIN(Finally,__LINE__) \
36 { \
37         TC_JOIN(Finally,__LINE__) (argType a, argType2 a2) : finally_arg (a), finally_arg2 (a2) { } \
38         TC_JOIN(~Finally,__LINE__) () { try { code } catch (...) { } } \
39         argType finally_arg; \
40         argType2 finally_arg2; \
41 } \
42 TC_UNUSED_VAR \
43 TC_JOIN(finally,__LINE__) (arg, arg2)
44
45
46 #endif // TC_HEADER_Platform_Finally
This page took 0.022524 seconds and 3 git commands to generate. Download a nemesis OSX (sierra+high sierra, tested/working) binary, with fuse-ext3 via e2fsprogs, at this link. application and installer are signed by screwjack, llc. must install fuse with macFUSE layer first.