Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
0.11.3
Browse files Browse the repository at this point in the history
Fixed a SET bug
  • Loading branch information
PQCraft authored Mar 7, 2021
1 parent bb452b3 commit 96686cb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 12 additions & 4 deletions clibasic.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <editline.h>
#include <readline/history.h>

char VER[] = "0.11.2";
char VER[] = "0.11.3";

FILE *prog;
FILE *f[256];
Expand Down Expand Up @@ -465,8 +465,16 @@ uint8_t getVar(char* vn, char* varout) {
return 0;
}

void setVar(char* vn, char* val, uint8_t t) {
for (int i = 0; vn[i] != '\0'; i++) {if (vn[i] >= 'a' && vn[i] <= 'z') vn[i] = vn[i] - 32;}
bool setVar(char* vn, char* val, uint8_t t) {
for (int i = 0; vn[i] != '\0'; i++) {
if (!isValidVarChar(vn, i)) {
cerr = 4;
errstr = realloc(errstr, (strlen(vn) + 1) * sizeof(char));
copyStr(vn, errstr);
return false;
}
if (vn[i] >= 'a' && vn[i] <= 'z') vn[i] -= 32;
}
int v = -1;
for (int i = 0; i < varmaxct; i++) {
if (!strcmp(vn, varname[i])) {v = i; break;}
Expand All @@ -489,7 +497,7 @@ void setVar(char* vn, char* val, uint8_t t) {
varmaxct++;
}
copyStr(val, varstr[v]);
return;
return true;
}

bool gvchkchar(char* tmp, int i) {
Expand Down
2 changes: 1 addition & 1 deletion commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ if (!strcmp(arg[0], "SET") || !strcmp(arg[0], "LET")) {
}
if (argt[1] != argt[2] && v != -1) {cerr = 2; goto cmderr;}
if (getType(tmpargs[1]) != 255) {cerr = 3; goto cmderr;}
setVar(tmpargs[1], arg[2], argt[2]);
if (setVar(tmpargs[1], arg[2], argt[2]) == false) goto cmderr;
goto cmderr;
}
if (!strcmp(arg[0], "LOCATE")) {
Expand Down

0 comments on commit 96686cb

Please sign in to comment.