Revert the in prog commit that was lost, as the scoping branch is now handeling it

This commit is contained in:
Nathan Braswell
2014-12-19 18:45:29 -05:00
parent 5fb40c3bd1
commit f35b4a8d48
11 changed files with 81 additions and 153 deletions

View File

@@ -2,10 +2,6 @@ __if_comp__ __C__ __simple_passthrough__ """
#include <stdio.h>
"""
/*
*import string;
*/
|void| println() {
print("\n");
}
@@ -24,17 +20,6 @@ __if_comp__ __C__ __simple_passthrough__ """
println();
}
/*
*|void| print(|String| toPrint) {
* print(toPrint.c_str());
*}
*
*|void| println(|String| toPrint) {
* print(toPrint);
* println();
*}
*/
|void| print(|int| toPrint) {
__if_comp__ __C__ {
__simple_passthrough__ """

View File

@@ -1,49 +0,0 @@
import vector;
import mem;
typedef String (Destructable) {
|vector<char>| charVec;
|String*| construct() {
charVec.construct();
return this;
}
|void| destruct() {
charVec.destruct();
}
|String*| construct(|char*| stringInput) {
charVec.construct();
append(stringInput);
return this;
}
|char| operator[](|int| index) {
return charVec[index];
}
|void| append(|String| toAppend) {
for (|int| i = 0; i < toAppend.size(); i++;)
charVec.addEnd(toAppend[i]);
}
|void| append(|char*| toAppend) {
while(toAppend)
charVec.addEnd(toAppend++);
}
|String| operator+(|String| other) {
|String| self = clone();
self.append(other);
return self;
}
|char*| c_str() {
|char*| toReturn = new<char>(charVec.size()+1);
for (|int| i = 0; i < charVec.size(); i++;)
toReturn[i] = charVec[i];
toReturn[charVec.size()] = 0;
return toReturn;
}
};

View File

@@ -27,12 +27,12 @@ typedef template<T> vector (Destructable) {
delete<T>(data, 0);
return true;
}
|T| operator[](|int| index) {
return at(index);
}
|T| at(|int| index) {
return get(index);
}
|T| get(|int| index) {
if (index < 0 || index >= size) {
println("Vector access out of bounds! Retuning 0th element as sanest option");
return data[0];