WOOO compiles all in one file! Dependencies resolved! Next up, C name mangeling for scoping

This commit is contained in:
Nathan Braswell
2015-03-11 01:58:10 -04:00
parent 9e9b4371da
commit 6a311fb237
14 changed files with 230 additions and 133 deletions

27
stdlib/string.krak Normal file
View File

@@ -0,0 +1,27 @@
import vector;
import mem;
typedef string (Destructable) {
|vector::vector<char>| data;
|string*| construct() {
data.construct();
return this;
}
|string*| construct(|char*| str) {
data.construct();
while(*str) {
data.addEnd(*str);
str += 1;
}
return this;
}
|char*| toCharArray() {
|char*| out = mem::new<char>(data.size);
for (|int| i = 0; i < data.size; i++;)
out[i] = data.get(i);
return out;
}
};