egtui: added "M-U" undo keybind
[iv.d.git] / sdpy / compat.d
blob94873b70028409ed0baf83b03db69f0e26b9d0ca
1 /*
2 * Pixel Graphics Library
3 * coded by Ketmar // Invisible Vector <ketmar@ketmar.no-ip.org>
4 * Understanding is not required. Only obedience.
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, version 3 of the License ONLY.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 module iv.sdpy.compat /*is aliced*/;
19 import iv.alice;
22 // ////////////////////////////////////////////////////////////////////////// //
23 version(GNU) {
24 static import gcc.attribute;
25 package enum gcc_inline = gcc.attribute.attribute("forceinline");
26 package enum gcc_noinline = gcc.attribute.attribute("noinline");
27 package enum gcc_flatten = gcc.attribute.attribute("flatten");
28 } else {
29 // hackery for non-gcc compilers
30 package enum gcc_inline;
31 package enum gcc_noinline;
32 package enum gcc_flatten;
36 // ////////////////////////////////////////////////////////////////////////// //
37 static if (__traits(compiles, () { throw new NamedException!"FLF-WGDParser"("test"); })) {}
38 else {
39 mixin template ExceptionCtorMixinTpl() {
40 this (string msg, string file=__FILE__, usize line=__LINE__, Throwable next=null) @safe pure nothrow @nogc {
41 super(msg, file, line, next);
46 // usage:
47 // mixin(NewExceptionClass!"MyEx");
48 // mixin(NewExceptionClass!("MyEx1", "MyEx"));
49 enum NewExceptionClass(string name, string base="Exception") = `class `~name~` : `~base~` { mixin ExceptionCtorMixinTpl; }`;
52 mixin(NewExceptionClass!("NamedExceptionBase", "Exception"));
53 mixin(NewExceptionClass!("NamedException(string name)", "NamedExceptionBase"));