Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c1625c53f4 | |||
| fb55f42d0e |
+1
-1
@@ -57,7 +57,7 @@ int hookStandard(Interpreter* interpreter, Literal identifier, Literal alias) {
|
|||||||
|
|
||||||
//load the dict with functions
|
//load the dict with functions
|
||||||
for (int i = 0; natives[i].name; i++) {
|
for (int i = 0; natives[i].name; i++) {
|
||||||
Literal name = TO_STRING_LITERAL(createRefStringLength(natives[i].name, strlen(natives[i].name)));
|
Literal name = TO_STRING_LITERAL(createRefString(natives[i].name));
|
||||||
Literal func = TO_FUNCTION_LITERAL((void*)natives[i].fn, 0);
|
Literal func = TO_FUNCTION_LITERAL((void*)natives[i].fn, 0);
|
||||||
func.type = LITERAL_FUNCTION_NATIVE;
|
func.type = LITERAL_FUNCTION_NATIVE;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -374,7 +374,7 @@ int hookTimer(Interpreter* interpreter, Literal identifier, Literal alias) {
|
|||||||
|
|
||||||
//load the dict with functions
|
//load the dict with functions
|
||||||
for (int i = 0; natives[i].name; i++) {
|
for (int i = 0; natives[i].name; i++) {
|
||||||
Literal name = TO_STRING_LITERAL(createRefStringLength(natives[i].name, strlen(natives[i].name)));
|
Literal name = TO_STRING_LITERAL(createRefString(natives[i].name));
|
||||||
Literal func = TO_FUNCTION_LITERAL((void*)natives[i].fn, 0);
|
Literal func = TO_FUNCTION_LITERAL((void*)natives[i].fn, 0);
|
||||||
func.type = LITERAL_FUNCTION_NATIVE;
|
func.type = LITERAL_FUNCTION_NATIVE;
|
||||||
|
|
||||||
|
|||||||
+3
-6
@@ -57,17 +57,14 @@ int lengthRefString(RefString* refString) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RefString* copyRefString(RefString* refString) {
|
RefString* copyRefString(RefString* refString) {
|
||||||
|
//Cheaty McCheater Face
|
||||||
refString->refcount++;
|
refString->refcount++;
|
||||||
return refString;
|
return refString;
|
||||||
}
|
}
|
||||||
|
|
||||||
RefString* deepCopyRefString(RefString* refString) {
|
RefString* deepCopyRefString(RefString* refString) {
|
||||||
//deep copy, which can be modified immediately
|
//create a new string, with a new refcount
|
||||||
RefString* newRefString = (RefString*)allocate(NULL, 0, sizeof(int) * 2 + refString->length + 1);
|
return createRefStringLength(refString->data, refString->length);
|
||||||
|
|
||||||
memcpy(newRefString, refString, refString->length + 1);
|
|
||||||
|
|
||||||
return newRefString;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char* toCString(RefString* refString) {
|
char* toCString(RefString* refString) {
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#define TOY_VERSION_MAJOR 0
|
#define TOY_VERSION_MAJOR 0
|
||||||
#define TOY_VERSION_MINOR 6
|
#define TOY_VERSION_MINOR 6
|
||||||
#define TOY_VERSION_PATCH 3
|
#define TOY_VERSION_PATCH 4
|
||||||
#define TOY_VERSION_BUILD __DATE__ " " __TIME__
|
#define TOY_VERSION_BUILD __DATE__ " " __TIME__
|
||||||
|
|
||||||
//platform exports/imports
|
//platform exports/imports
|
||||||
|
|||||||
Reference in New Issue
Block a user