aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile14
-rw-r--r--asm/parser.c6
2 files changed, 10 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 020d43a..1c37a4a 100644
--- a/Makefile
+++ b/Makefile
@@ -56,38 +56,38 @@ examples: $(EXAMPLES_DIST) $(EXAMPLES)
$(LIB_DIST)/%.o: $(LIB_SRC)/%.c
@$(CC) $(LIB_CFLAGS) -MMD -c $< -o $@ $(LIBS)
- @echo -e "$(TERM_YELLOW)$@$(TERM_RESET): $<"
+ @echo "$(TERM_YELLOW)$@$(TERM_RESET): $<"
## VM Recipes
$(VM_OUT): $(LIB_OBJECTS) $(VM_OBJECTS) $(VM_DIST)/main.o
@$(CC) $(VM_CFLAGS) $^ -o $@ $(LIBS)
- @echo -e "$(TERM_GREEN)$@$(TERM_RESET): $^"
+ @echo "$(TERM_GREEN)$@$(TERM_RESET): $^"
-include $(VM_DEPS)
$(VM_DIST)/%.o: $(VM_SRC)/%.c
@$(CC) $(VM_CFLAGS) -MMD -c $< -o $@ $(LIBS)
- @echo -e "$(TERM_YELLOW)$@$(TERM_RESET): $<"
+ @echo "$(TERM_YELLOW)$@$(TERM_RESET): $<"
## ASSEMBLY Recipes
$(ASM_OUT): $(LIB_OBJECTS) $(ASM_OBJECTS) $(ASM_DIST)/main.o
@$(CC) $(ASM_CFLAGS) $^ -o $@ $(LIBS)
- @echo -e "$(TERM_GREEN)$@$(TERM_RESET): $^"
+ @echo "$(TERM_GREEN)$@$(TERM_RESET): $^"
-include $(ASM_DEPS)
$(ASM_DIST)/%.o: $(ASM_SRC)/%.c
@$(CC) $(ASM_CFLAGS) -MMD -c $< -o $@ $(LIBS)
- @echo -e "$(TERM_YELLOW)$@$(TERM_RESET): $<"
+ @echo "$(TERM_YELLOW)$@$(TERM_RESET): $<"
## EXAMPLES recipes
$(EXAMPLES_DIST)/%.out: $(EXAMPLES_SRC)/%.asm $(ASM_OUT)
@$(ASM_OUT) $< $@
- @echo -e "$(TERM_GREEN)$@$(TERM_RESET): $<"
+ @echo "$(TERM_GREEN)$@$(TERM_RESET): $<"
.PHONY: run-examples
run-examples: $(EXAMPLES)
- $(foreach example,$(EXAMPLES),$(MAKE) interpret BYTECODE=$(example);)
+ @$(foreach example,$(EXAMPLES), echo "$(TERM_YELLOW)$(example)$(TERM_RESET)"; $(MAKE) -s interpret BYTECODE=$(example);)
OUT=
ARGS=
diff --git a/asm/parser.c b/asm/parser.c
index d976e67..d326d14 100644
--- a/asm/parser.c
+++ b/asm/parser.c
@@ -379,7 +379,7 @@ perr_t preprocess_use_blocks(token_stream_t *stream, token_stream_t *new)
DARR_AT(token_t, stream->data, i + 1).type != TOKEN_LITERAL_STRING)
{
stream->used = i + 1 >= stream->available ? i : i + 1;
- for (size_t i = 0; i < (new_stream.available / sizeof(token_t)); ++i)
+ for (size_t i = 0; i < (new_stream.used / sizeof(token_t)); ++i)
free(TOKEN_STREAM_AT(new_stream.data, i).str);
free(new_stream.data);
return PERR_PREPROCESSOR_EXPECTED_STRING;
@@ -390,7 +390,7 @@ perr_t preprocess_use_blocks(token_stream_t *stream, token_stream_t *new)
FILE *fp = fopen(t.str, "rb");
if (!fp)
{
- for (size_t i = 0; i < new_stream.available; ++i)
+ for (size_t i = 0; i < (new_stream.used / sizeof(token_t)); ++i)
free(TOKEN_STREAM_AT(new_stream.data, i).str);
free(new_stream.data);
stream->used = i;
@@ -410,7 +410,7 @@ perr_t preprocess_use_blocks(token_stream_t *stream, token_stream_t *new)
free(TOKEN_STREAM_AT(fstream.data, i).str);
free(fstream.data);
}
- for (size_t i = 0; i < new_stream.available; ++i)
+ for (size_t i = 0; i < (new_stream.used / sizeof(token_t)); ++i)
free(TOKEN_STREAM_AT(new_stream.data, i).str);
free(new_stream.data);
stream->used = i;