00001 00002 #include <basix/int.hpp> 00003 #include <basix/vector.hpp> 00004 #include <basix/port.hpp> 00005 #include <basix/literal.hpp> 00006 #include <numerix/integer.hpp> 00007 #include <numerix/modular.hpp> 00008 #include <numerix/modular_integer.hpp> 00009 #include <numerix/rational.hpp> 00010 #include <numerix/floating.hpp> 00011 #include <shape/axel_glue.hpp> 00012 #include <shape/point_glue.hpp> 00013 #include <basix/tuple.hpp> 00014 #include <basix/alias.hpp> 00015 #include <basix/glue.hpp> 00016 00017 #define int_literal(x) as_int (as_string (x)) 00018 #define is_generic_literal is<literal> 00019 #define gen_literal_apply(f,v) gen (as<generic> (f), v) 00020 #define gen_literal_access(f,v) access (as<generic> (f), v) 00021 #define shape_point shape::point 00022 00023 namespace mmx { 00024 static shape_axel 00025 GLUE_1 () { 00026 return shape_axel (); 00027 } 00028 00029 static shape_axel 00030 GLUE_2 (const string &arg_1) { 00031 return shape_axel_string (arg_1); 00032 } 00033 00034 static void 00035 GLUE_3 (const shape_axel &arg_1) { 00036 shape_axel_view (arg_1); 00037 } 00038 00039 static shape_point<mmx_floating> 00040 GLUE_4 (const tuple<mmx_floating> &arg_1) { 00041 return shape_point_tuple<mmx_floating > (as_vector (arg_1)); 00042 } 00043 00044 static mmx_floating 00045 GLUE_5 (const shape_point<mmx_floating> &arg_1, const int &arg_2) { 00046 return arg_1[arg_2]; 00047 } 00048 00049 static alias<mmx_floating> 00050 GLUE_6 (const alias<shape_point<mmx_floating> > &arg_1, const int &arg_2) { 00051 return alias_access<mmx_floating > (arg_1, arg_2); 00052 } 00053 00054 static shape_point<mmx_floating> 00055 GLUE_7 (const shape_point<mmx_floating> &arg_1, const shape_point<mmx_floating> &arg_2) { 00056 return arg_1 - arg_2; 00057 } 00058 00059 static alias<shape_axel> 00060 GLUE_8 (const alias<shape_axel> &arg_1, const shape_point<mmx_floating> &arg_2) { 00061 return alias_write (arg_1, arg_2); 00062 } 00063 00064 static vector<mmx_floating> 00065 GLUE_9 (const tuple<mmx_floating> &arg_1) { 00066 return vector<mmx_floating > (as_vector (arg_1)); 00067 } 00068 00069 static vector<mmx_floating> 00070 GLUE_10 (const tuple<mmx_floating> &arg_1) { 00071 return vector<mmx_floating > (as_vector (arg_1)); 00072 } 00073 00074 static iterator<generic> 00075 GLUE_11 (const vector<mmx_floating> &arg_1) { 00076 return as<iterator<generic> > (iterate (arg_1)); 00077 } 00078 00079 static int 00080 GLUE_12 (const vector<mmx_floating> &arg_1) { 00081 return N (arg_1); 00082 } 00083 00084 static mmx_floating 00085 GLUE_13 (const vector<mmx_floating> &arg_1, const int &arg_2) { 00086 return arg_1[arg_2]; 00087 } 00088 00089 static alias<mmx_floating> 00090 GLUE_14 (const alias<vector<mmx_floating> > &arg_1, const int &arg_2) { 00091 return alias_access<mmx_floating > (arg_1, arg_2); 00092 } 00093 00094 static vector<mmx_floating> 00095 GLUE_15 (const vector<mmx_floating> &arg_1, const int &arg_2, const int &arg_3) { 00096 return range (arg_1, arg_2, arg_3); 00097 } 00098 00099 static vector<mmx_floating> 00100 GLUE_16 (const vector<mmx_floating> &arg_1) { 00101 return reverse (arg_1); 00102 } 00103 00104 static vector<mmx_floating> 00105 GLUE_17 (const vector<mmx_floating> &arg_1, const vector<mmx_floating> &arg_2) { 00106 return append (arg_1, arg_2); 00107 } 00108 00109 static alias<vector<mmx_floating> > 00110 GLUE_18 (const alias<vector<mmx_floating> > &arg_1, const vector<mmx_floating> &arg_2) { 00111 return alias_write (arg_1, arg_2); 00112 } 00113 00114 static vector<mmx_floating> 00115 GLUE_19 (const mmx_floating &arg_1, const vector<mmx_floating> &arg_2) { 00116 return cons (arg_1, arg_2); 00117 } 00118 00119 static mmx_floating 00120 GLUE_20 (const vector<mmx_floating> &arg_1) { 00121 return car (arg_1); 00122 } 00123 00124 static vector<mmx_floating> 00125 GLUE_21 (const vector<mmx_floating> &arg_1) { 00126 return cdr (arg_1); 00127 } 00128 00129 static bool 00130 GLUE_22 (const vector<mmx_floating> &arg_1) { 00131 return is_nil (arg_1); 00132 } 00133 00134 static bool 00135 GLUE_23 (const vector<mmx_floating> &arg_1) { 00136 return is_atom (arg_1); 00137 } 00138 00139 static vector<mmx_floating> 00140 GLUE_24 (const vector<mmx_floating> &arg_1, const mmx_floating &arg_2) { 00141 return insert (arg_1, arg_2); 00142 } 00143 00144 static int 00145 GLUE_25 (const vector<mmx_floating> &arg_1, const mmx_floating &arg_2) { 00146 return find (arg_1, arg_2); 00147 } 00148 00149 static bool 00150 GLUE_26 (const vector<mmx_floating> &arg_1, const mmx_floating &arg_2) { 00151 return contains (arg_1, arg_2); 00152 } 00153 00154 static vector<generic> 00155 GLUE_27 (const vector<mmx_floating> &arg_1) { 00156 return as<vector<generic> > (arg_1); 00157 } 00158 00159 static shape_point<mmx_floating> 00160 GLUE_28 (const shape_point<mmx_floating> &arg_1, const vector<mmx_floating> &arg_2) { 00161 return arg_1 + arg_2; 00162 } 00163 00164 void 00165 glue_point_floating () { 00166 static bool done = false; 00167 if (done) return; 00168 done = true; 00169 call_glue (string ("glue_floating")); 00170 define_type<shape_axel > (lit ("Axel")); 00171 define ("axel", GLUE_1); 00172 define ("axel", GLUE_2); 00173 define ("view", GLUE_3); 00174 define_type<shape_point<mmx_floating> > (gen (lit ("Point"), lit ("Floating"))); 00175 define ("point", GLUE_4); 00176 define (".[]", GLUE_5); 00177 define (".[]", GLUE_6); 00178 define ("-", GLUE_7); 00179 define ("<<", GLUE_8); 00180 define_type<vector<mmx_floating> > (gen (lit ("Vector"), lit ("Floating"))); 00181 define ("vector", GLUE_9); 00182 define ("[]", GLUE_10); 00183 define_converter (":>", GLUE_11, PENALTY_CAST); 00184 define ("#", GLUE_12); 00185 define (".[]", GLUE_13); 00186 define (".[]", GLUE_14); 00187 define (".[]", GLUE_15); 00188 define ("reverse", GLUE_16); 00189 define ("><", GLUE_17); 00190 define ("<<", GLUE_18); 00191 define ("cons", GLUE_19); 00192 define ("car", GLUE_20); 00193 define ("cdr", GLUE_21); 00194 define ("nil?", GLUE_22); 00195 define ("atom?", GLUE_23); 00196 define ("insert", GLUE_24); 00197 define ("find", GLUE_25); 00198 define ("contains?", GLUE_26); 00199 define_converter (":>", GLUE_27, PENALTY_PROMOTE_GENERIC); 00200 define ("+", GLUE_28); 00201 } 00202 }