]> git.saurik.com Git - cycript.git/blob - Replace.hpp
Instance's toPointer() should return as CFTypeRef.
[cycript.git] / Replace.hpp
1 /* Cycript - The Truly Universal Scripting Language
2 * Copyright (C) 2009-2016 Jay Freeman (saurik)
3 */
4
5 /* GNU Affero General Public License, Version 3 {{{ */
6 /*
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
16
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 **/
20 /* }}} */
21
22 #ifndef CYCRIPT_REPLACE_HPP
23 #define CYCRIPT_REPLACE_HPP
24
25 #include "Syntax.hpp"
26
27 #define $ new($pool)
28
29 #define $D(args...) \
30 ($ CYNumber(args))
31 #define $E(args...) \
32 ($ CYExpress(args))
33 #define $F(args...) \
34 ($ CYFunctionExpression(args))
35 #define $I(args...) \
36 ($ CYIdentifier(args))
37 #define $M(args...) \
38 ($ CYDirectMember(args))
39 #define $P(args...) \
40 ($ CYFunctionParameter(args))
41 #define $S(args...) \
42 ($ CYString(args))
43 #define $U \
44 $V($I("undefined"))
45 #define $V(name) \
46 ($ CYVariable(name))
47
48 #define $T(value) \
49 if (this == NULL) \
50 return value;
51 #define $$ \
52 CYStatements()
53
54 #define $P1(arg0, args...) \
55 $P(arg0, ##args)
56 #define $P2(arg0, arg1, args...) \
57 $P(arg0, $P1(arg1, ##args))
58 #define $P3(arg0, arg1, arg2, args...) \
59 $P(arg0, $P2(arg1, arg2, ##args))
60 #define $P4(arg0, arg1, arg2, arg3, args...) \
61 $P(arg0, $P3(arg1, arg2, arg3, ##args))
62 #define $P5(arg0, arg1, arg2, arg3, arg4, args...) \
63 $P(arg0, $P4(arg1, arg2, arg3, arg4, ##args))
64 #define $P6(arg0, arg1, arg2, arg3, arg4, arg5, args...) \
65 $P(arg0, $P5(arg1, arg2, arg3, arg4, arg5, ##args))
66
67 #define $C(args...) \
68 ($ CYCall(args))
69 #define $C_(args...) \
70 ($ CYArgument(args))
71 #define $N(args...) \
72 ($ cy::Syntax::New(args))
73
74 #define $C1_(arg0, args...) \
75 $C_(arg0, ##args)
76 #define $C2_(arg0, arg1, args...) \
77 $C_(arg0, $C1_(arg1, ##args))
78 #define $C3_(arg0, arg1, arg2, args...) \
79 $C_(arg0, $C2_(arg1, arg2, ##args))
80 #define $C4_(arg0, arg1, arg2, arg3, args...) \
81 $C_(arg0, $C3_(arg1, arg2, arg3, ##args))
82 #define $C5_(arg0, arg1, arg2, arg3, arg4, args...) \
83 $C_(arg0, $C4_(arg1, arg2, arg3, arg4, ##args))
84 #define $C6_(arg0, arg1, arg2, arg3, arg4, arg5, args...) \
85 $C_(arg0, $C5_(arg1, arg2, arg3, arg4, arg5, ##args))
86
87 #define $C0(func, args...) \
88 $C(func, ##args)
89 #define $C1(func, args...) \
90 $C(func, $C1_(args))
91 #define $C2(func, args...) \
92 $C(func, $C2_(args))
93 #define $C3(func, args...) \
94 $C(func, $C3_(args))
95 #define $C4(func, args...) \
96 $C(func, $C4_(args))
97 #define $C5(func, args...) \
98 $C(func, $C5_(args))
99
100 #define $N0(func, args...) \
101 $N(func, ##args)
102 #define $N1(func, args...) \
103 $N(func, $C1_(args))
104 #define $N2(func, args...) \
105 $N(func, $C2_(args))
106 #define $N3(func, args...) \
107 $N(func, $C3_(args))
108 #define $N4(func, args...) \
109 $N(func, $C4_(args))
110 #define $N5(func, args...) \
111 $N(func, $C5_(args))
112
113 #define $B(args...) \
114 $ CYBinding(args)
115 #define $B1(arg0) \
116 $ CYBindings(arg0)
117 #define $B2(arg0, args...) \
118 $ CYBindings(arg0, $B1(args))
119 #define $B3(arg0, args...) \
120 $ CYBindings(arg0, $B2(args))
121 #define $B4(arg0, args...) \
122 $ CYBindings(arg0, $B3(args))
123 #define $B5(arg0, args...) \
124 $ CYBindings(arg0, $B4(args))
125
126 #endif/*CYCRIPT_REPLACE_HPP*/