diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2022-10-06 12:26:42 -0400 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2022-10-06 12:26:42 -0400 |
commit | f4bc4570be7a51b00bf44d5bd4be99108dd94a30 (patch) | |
tree | abb6b32ac979d7dc0bdf1792d86b0daca8818525 /libtnsl/box/list.tnsl | |
parent | a58e2685b815a5a0d2d5f07bc3ae53016ba6f52b (diff) |
Libtnsl additions
Diffstat (limited to 'libtnsl/box/list.tnsl')
-rw-r--r-- | libtnsl/box/list.tnsl | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/libtnsl/box/list.tnsl b/libtnsl/box/list.tnsl new file mode 100644 index 0000000..ed9c4b7 --- /dev/null +++ b/libtnsl/box/list.tnsl @@ -0,0 +1,66 @@ +/## + Copyright 2021 Kyle Gunger + + Dual licensed under the CDDL 1.0 and BSD 3-Clause licenses. + + This file may only be used in accordance with one of the two + licenses. You should have received a copy of each license with + the source code. In the event that you did not recieve a copy + of the licenses, they may be found at the following URLs: + + CDDL 1.0: + https://opensource.org/licenses/CDDL-1.0 + + BSD 3-Clause: + https://opensource.org/licenses/BSD-3-Clause + + THIS SOFTWARE/SOURCE CODE IS PROVIDED "AS IS" WITH NO + WARRANTY, GUARANTEE, OR CLAIM OF FITNESS FOR ANY PURPOSE + EXPRESS OR IMPLIED +#/ + +;struct LNode (type T) { + T data, + ~void next +} + +/; method LNode + /; get_next_type (type B) [LNode(B)] + ;return (self.next)[~LNode(B)]` + ;/ + + /; get_next [LNode(T)] + ;return (self.next)[~LNode(T)]` + ;/ +;/ + +;struct DLNode (type T) extends LNode(T) { + super, + ~void prev +} + +/; method DLNode + /; get_prev_type (type B) [LNode(B)] + ;return (self.prev)[~LNode(B)]` + ;/ + + /; get_prev [LNode(T)] + ;return (self.prev)[~LNode(T)]` + ;/ +;/ + +;struct List { + uint length, + + LNode + first, + last +} + +;struct DList { + uint length, + + DLNode + first, + last +}
\ No newline at end of file |