Refactor stack to now use ints instead of long ints
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Dominic Grimm 2023-08-06 11:20:14 +02:00
parent 7490439223
commit 03a9b46e33
7 changed files with 62 additions and 24 deletions

View file

@ -117,7 +117,7 @@ struct hf__result shell(const struct arguments *const arguments) {
.cap = HF__INTERPRETER__WORDS_CAP,
},
.stack = malloc(sizeof(long) * 10),
.stack = malloc(sizeof(int) * 10),
.stack_len = 0,
.stack_size = 10,
@ -177,7 +177,7 @@ struct hf__result shell(const struct arguments *const arguments) {
printf("stack:");
SET_8_VALUE_COLOUR(TXT_YELLOW);
for (size_t i = 0; i < interpreter.stack_len; i++) {
printf(" %li", interpreter.stack[i]);
printf(" %i", interpreter.stack[i]);
}
SET_8_VALUE_COLOUR(TXT_DEFAULT);
putchar('\n');
@ -267,7 +267,7 @@ int main(int argc, char *argv[]) {
.cap = HF__INTERPRETER__WORDS_CAP,
},
.stack = malloc(sizeof(long) * 10),
.stack = malloc(sizeof(int) * 10),
.stack_len = 0,
.stack_size = 10,
@ -314,7 +314,7 @@ int main(int argc, char *argv[]) {
printf("stack:");
SET_8_VALUE_COLOUR(TXT_YELLOW);
for (size_t i = 0; i < interpreter.stack_len; i++) {
printf(" %li", interpreter.stack[i]);
printf(" %i", interpreter.stack[i]);
}
SET_8_VALUE_COLOUR(TXT_DEFAULT);
putchar('\n');