summaryrefslogtreecommitdiff
path: root/tnslc/vector.tnsl
diff options
context:
space:
mode:
Diffstat (limited to 'tnslc/vector.tnsl')
-rw-r--r--tnslc/vector.tnsl32
1 files changed, 32 insertions, 0 deletions
diff --git a/tnslc/vector.tnsl b/tnslc/vector.tnsl
new file mode 100644
index 0000000..1377938
--- /dev/null
+++ b/tnslc/vector.tnsl
@@ -0,0 +1,32 @@
+struct Vector {
+ ~void data,
+ int
+ size,
+ count,
+ _elsz
+}
+
+int VECT_DEFAULT_SIZE = 4
+
+/; method Vector
+
+ /; init (int elsz)
+ self._elsz = elsz
+ self.size = VECT_DEFAULT_SIZE
+ self.data = _alloc(elsz * self.size)
+ self.count = 0
+ ;/
+
+ /; get (int index) [~void]
+ return self.data
+ ;/
+
+ /; end
+ _delete(self.data)
+ self.size = 0
+ self._elsz = 0
+ self.count = 0
+ ;/
+
+;/
+