1 #include <stdlib.h> 2 #include "types.h" 3 #include "exceptions.h" 4 #include "ops.h" 5 #include "progconsts.h" 6 #include "progops.h" 7 #include "progtypes.h" 8 #include "main.h" 9 10 __attr __fn_native__is(__attr __args[]) 11 { 12 #define x (__args[1]) 13 #define y (__args[2]) 14 15 return x.value == y.value ? __builtins___boolean_True : __builtins___boolean_False; 16 #undef x 17 #undef y 18 } 19 20 __attr __fn_native__is_not(__attr __args[]) 21 { 22 #define x (__args[1]) 23 #define y (__args[2]) 24 25 return x.value != y.value ? __builtins___boolean_True : __builtins___boolean_False; 26 #undef x 27 #undef y 28 } 29 30 __attr __fn_native__int_add(__attr __args[]) 31 { 32 #define self (__args[1]) 33 #define other (__args[2]) 34 35 /* NOTE: To be written. */ 36 return __builtins___none_None; 37 #undef self 38 #undef other 39 } 40 41 __attr __fn_native__int_sub(__attr __args[]) 42 { 43 #define self (__args[1]) 44 #define other (__args[2]) 45 46 /* NOTE: To be written. */ 47 return __builtins___none_None; 48 #undef self 49 #undef other 50 } 51 52 __attr __fn_native__int_mul(__attr __args[]) 53 { 54 #define self (__args[1]) 55 #define other (__args[2]) 56 57 /* NOTE: To be written. */ 58 return __builtins___none_None; 59 #undef self 60 #undef other 61 } 62 63 __attr __fn_native__int_div(__attr __args[]) 64 { 65 #define self (__args[1]) 66 #define other (__args[2]) 67 68 /* NOTE: To be written. */ 69 return __builtins___none_None; 70 #undef self 71 #undef other 72 } 73 74 __attr __fn_native__int_mod(__attr __args[]) 75 { 76 #define self (__args[1]) 77 #define other (__args[2]) 78 79 /* NOTE: To be written. */ 80 return __builtins___none_None; 81 #undef self 82 #undef other 83 } 84 85 __attr __fn_native__int_pow(__attr __args[]) 86 { 87 #define self (__args[1]) 88 #define other (__args[2]) 89 90 /* NOTE: To be written. */ 91 return __builtins___none_None; 92 #undef self 93 #undef other 94 } 95 96 __attr __fn_native__int_and(__attr __args[]) 97 { 98 #define self (__args[1]) 99 #define other (__args[2]) 100 101 /* NOTE: To be written. */ 102 return __builtins___none_None; 103 #undef self 104 #undef other 105 } 106 107 __attr __fn_native__int_or(__attr __args[]) 108 { 109 #define self (__args[1]) 110 #define other (__args[2]) 111 112 /* NOTE: To be written. */ 113 return __builtins___none_None; 114 #undef self 115 #undef other 116 } 117 118 __attr __fn_native__int_xor(__attr __args[]) 119 { 120 #define self (__args[1]) 121 #define other (__args[2]) 122 123 /* NOTE: To be written. */ 124 return __builtins___none_None; 125 #undef self 126 #undef other 127 } 128 129 __attr __fn_native__int_rsub(__attr __args[]) 130 { 131 #define self (__args[1]) 132 #define other (__args[2]) 133 134 /* NOTE: To be written. */ 135 return __builtins___none_None; 136 #undef self 137 #undef other 138 } 139 140 __attr __fn_native__int_rdiv(__attr __args[]) 141 { 142 #define self (__args[1]) 143 #define other (__args[2]) 144 145 /* NOTE: To be written. */ 146 return __builtins___none_None; 147 #undef self 148 #undef other 149 } 150 151 __attr __fn_native__int_rmod(__attr __args[]) 152 { 153 #define self (__args[1]) 154 #define other (__args[2]) 155 156 /* NOTE: To be written. */ 157 return __builtins___none_None; 158 #undef self 159 #undef other 160 } 161 162 __attr __fn_native__int_rpow(__attr __args[]) 163 { 164 #define self (__args[1]) 165 #define other (__args[2]) 166 167 /* NOTE: To be written. */ 168 return __builtins___none_None; 169 #undef self 170 #undef other 171 } 172 173 __attr __fn_native__int_lt(__attr __args[]) 174 { 175 #define self (__args[1]) 176 #define other (__args[2]) 177 178 /* NOTE: To be written. */ 179 return __builtins___none_None; 180 #undef self 181 #undef other 182 } 183 184 __attr __fn_native__int_gt(__attr __args[]) 185 { 186 #define self (__args[1]) 187 #define other (__args[2]) 188 189 /* NOTE: To be written. */ 190 return __builtins___none_None; 191 #undef self 192 #undef other 193 } 194 195 __attr __fn_native__int_eq(__attr __args[]) 196 { 197 #define self (__args[1]) 198 #define other (__args[2]) 199 200 /* NOTE: To be written. */ 201 return __builtins___none_None; 202 #undef self 203 #undef other 204 } 205 206 __attr __fn_native__str_add(__attr __args[]) 207 { 208 #define self (__args[1]) 209 #define other (__args[2]) 210 211 /* NOTE: To be written. */ 212 return __builtins___none_None; 213 #undef self 214 #undef other 215 } 216 217 __attr __fn_native__str_lt(__attr __args[]) 218 { 219 #define self (__args[1]) 220 #define other (__args[2]) 221 222 /* NOTE: To be written. */ 223 return __builtins___none_None; 224 #undef self 225 #undef other 226 } 227 228 __attr __fn_native__str_gt(__attr __args[]) 229 { 230 #define self (__args[1]) 231 #define other (__args[2]) 232 233 /* NOTE: To be written. */ 234 return __builtins___none_None; 235 #undef self 236 #undef other 237 } 238 239 __attr __fn_native__str_eq(__attr __args[]) 240 { 241 #define self (__args[1]) 242 #define other (__args[2]) 243 244 /* NOTE: To be written. */ 245 return __builtins___none_None; 246 #undef self 247 #undef other 248 } 249 250 __attr __fn_native__str_len(__attr __args[]) 251 { 252 #define self (__args[1]) 253 254 /* NOTE: To be written. */ 255 return __builtins___none_None; 256 #undef self 257 } 258 259 __attr __fn_native__str_nonempty(__attr __args[]) 260 { 261 #define self (__args[1]) 262 263 /* NOTE: To be written. */ 264 return __builtins___none_None; 265 #undef self 266 } 267 268 __attr __fn_native__list_init(__attr __args[]) 269 { 270 #define size (__args[1]) 271 /* size.__data__ interpreted as int */ 272 __fragment *data = calloc(__load_via_object(size.value, __pos___data__).intvalue, sizeof(__attr)); 273 __attr attr = {0, .data=data}; 274 275 return attr; 276 #undef size 277 } 278 279 __attr __fn_native__list_len(__attr __args[]) 280 { 281 #define self (__args[1]) 282 283 /* NOTE: To be written. */ 284 return __builtins___none_None; 285 #undef self 286 } 287 288 __attr __fn_native__list_nonempty(__attr __args[]) 289 { 290 #define self (__args[1]) 291 292 return __load_via_object(self.value, __pos___data__).data->size ? __builtins___boolean_True : __builtins___boolean_False; 293 #undef self 294 } 295 296 __attr __fn_native__list_element(__attr __args[]) 297 { 298 #define self (__args[1]) 299 #define index (__args[2]) 300 301 /* NOTE: To be written. */ 302 return __builtins___none_None; 303 #undef self 304 #undef index 305 } 306 307 __attr __fn_native__list_to_tuple(__attr __args[]) 308 { 309 #define l (__args[1]) 310 311 /* NOTE: To be written. */ 312 return __builtins___none_None; 313 #undef l 314 } 315 316 __attr __fn_native__tuple_init(__attr __args[]) 317 { 318 #define size (__args[1]) 319 /* size.__data__ interpreted as int */ 320 __fragment *data = calloc(__load_via_object(size.value, __pos___data__).intvalue, sizeof(__attr)); 321 __attr attr = {0, .data=data}; 322 323 return attr; 324 #undef size 325 } 326 327 __attr __fn_native__tuple_len(__attr __args[]) 328 { 329 #define self (__args[1]) 330 331 /* NOTE: To be written. */ 332 return __builtins___none_None; 333 #undef self 334 } 335 336 __attr __fn_native__tuple_element(__attr __args[]) 337 { 338 #define self (__args[1]) 339 #define index (__args[2]) 340 341 /* NOTE: To be written. */ 342 return __builtins___none_None; 343 #undef self 344 #undef index 345 } 346 347 __attr __fn_native__isinstance(__attr __args[]) 348 { 349 #define obj (__args[1]) 350 #define cls (__args[2]) 351 352 if (__HASATTR(obj.value, __TYPEPOS(cls.value), __TYPECODE(cls.value))) 353 return obj; 354 else 355 return __builtins___none_None; 356 #undef obj 357 #undef cls 358 } 359 360 void __main_native() 361 { 362 }