paul@773 | 1 | /* Native functions for tuple operations. |
paul@773 | 2 | |
paul@773 | 3 | Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk> |
paul@773 | 4 | |
paul@773 | 5 | This program is free software; you can redistribute it and/or modify it under |
paul@773 | 6 | the terms of the GNU General Public License as published by the Free Software |
paul@773 | 7 | Foundation; either version 3 of the License, or (at your option) any later |
paul@773 | 8 | version. |
paul@773 | 9 | |
paul@773 | 10 | This program is distributed in the hope that it will be useful, but WITHOUT |
paul@773 | 11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
paul@773 | 12 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
paul@773 | 13 | details. |
paul@773 | 14 | |
paul@773 | 15 | You should have received a copy of the GNU General Public License along with |
paul@773 | 16 | this program. If not, see <http://www.gnu.org/licenses/>. |
paul@773 | 17 | */ |
paul@773 | 18 | |
paul@773 | 19 | #include "native/common.h" |
paul@773 | 20 | #include "types.h" |
paul@773 | 21 | #include "exceptions.h" |
paul@773 | 22 | #include "ops.h" |
paul@773 | 23 | #include "progconsts.h" |
paul@773 | 24 | #include "progops.h" |
paul@773 | 25 | #include "progtypes.h" |
paul@773 | 26 | #include "main.h" |
paul@773 | 27 | |
paul@773 | 28 | /* Tuple operations. */ |
paul@773 | 29 | |
paul@773 | 30 | static __fragment __empty_fragment = {.size=0, .capacity=0}; |
paul@773 | 31 | |
paul@773 | 32 | __attr __fn_native_tuple_tuple_init(__attr __self, __attr size) |
paul@773 | 33 | { |
paul@773 | 34 | /* size interpreted as int */ |
paul@783 | 35 | int n = __TOINT(size); |
paul@773 | 36 | |
paul@773 | 37 | /* Return the __data__ attribute. */ |
paul@773 | 38 | if (n) return (__attr) {.seqvalue=__new_fragment(n)}; |
paul@773 | 39 | else return (__attr) {.seqvalue=&__empty_fragment}; |
paul@773 | 40 | } |
paul@773 | 41 | |
paul@773 | 42 | /* Module initialisation. */ |
paul@773 | 43 | |
paul@773 | 44 | void __main_native_tuple() |
paul@773 | 45 | { |
paul@773 | 46 | } |