]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - cpp.cfg
Enable mutator calls to take parameters
[xonotic/xonotic-data.pk3dir.git] / cpp.cfg
1 alias _dont        ""
2 alias _do          "$*"
3
4 set _ifstack       ""
5 alias #            "$_ifstack $*"
6
7 alias #ifeq        "set \"_ifnew_$1\" _dont; set \"_ifnew_$2\" _do; _ifeq_2 \"_ifnew_$1\""
8 alias #ifneq       "set \"_ifnew_$1\" _do; set \"_ifnew_$2\" _dont; _ifeq_2 \"_ifnew_$1\""
9 alias _ifeq_2      "set _ifstack \"${$1} $_ifstack\""
10 alias #else        "_else_2$_ifstack"
11 alias _else_2_do   "set _ifstack \"_dont ${* q?}\""
12 alias _else_2_dont "set _ifstack \"_do ${* q?}\""
13 alias #endif       "_endif_2 $_ifstack"
14 alias _endif_2     "set _ifstack \"${2- q?}\""
15
16 alias #ifdef       "#ifneq \"${$1 ?}\" \"\""
17 alias #ifndef      "#ifeq \"${$1 ?}\" \"\""
18
19 alias #include     "# exec $*"
20 alias #define      "# set $*"
21 alias #undef       "# unset $*"
22 alias #error       "# echo ERROR: $*; # quit"
23 alias #warning     "# echo WARNING: $*"
24
25 // EXAMPLE:
26 //      #ifeq "$a" "$b"
27 //      #ifeq "$a" "$c"
28 //      #       echo "a == b == c"
29 //      #else
30 //      #       echo "a == b != c"
31 //      #endif
32 //      #else
33 //      #ifeq "$a" "$c"
34 //      #       echo "a == c != b"
35 //      #else
36 //      #ifeq "$b" "$c"
37 //      #       echo "b == c != a"
38 //      #else
39 //      #       echo "a != b != c != a"
40 //      #endif
41 //      #endif
42 //      #endif