Skip to content

Commit

Permalink
v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Jedlička committed Jul 1, 2019
1 parent 0e201ea commit 11dc1ad
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@
#include <stddef.h>
#include <stdint.h>

#define STRINGIFY(x) #x
#define STR(x) STRINGIFY(x)

#define BLU_VERSION_MAJOR 0
#define BLU_VERSION_MINOR 1
#define BLU_VERSION_PATCH 0

#define BLU_VERSION BLU_VERSION_MAJOR * 1000000 + BLU_VERSION_MINOR * 1000 + BLU_VERSION_MINOR

#define BLU_VERSION_STR "v" STR(BLU_VERSION_MAJOR) "." STR(BLU_VERSION_MINOR) "." STR(BLU_VERSION_PATCH)

#ifdef DEBUG
#define DEBUG_PRINT_CODE
#define DEBUG_TRACE_EXECUTION
Expand Down
10 changes: 9 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,21 @@ static void runFile(const char* path) {
if (result == INTERPRET_ASSERTION_ERROR) exit(75);
}

static void help() {
printf("%s %s\n", "blu", BLU_VERSION_STR);
}

int main(int argc, const char* argv[]) {
initVM();

if (argc == 1) {
repl();
} else if (argc == 2) {
runFile(argv[1]);
if (strcmp(argv[1], "--help") || strcmp(argv[1], "-h")) {
help();
} else {
runFile(argv[1]);
}
} else {
fprintf(stderr, "Usage: blu [path]\n");
exit(64);
Expand Down

0 comments on commit 11dc1ad

Please sign in to comment.