From 11dc1ad85399ee1f0f612688c321e5e5f8449bfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Jedli=C4=8Dka?= Date: Mon, 1 Jul 2019 10:05:09 +0200 Subject: [PATCH] v0.1.0 --- src/common.h | 11 +++++++++++ src/main.c | 10 +++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/common.h b/src/common.h index 7137c1b..b3d9b80 100644 --- a/src/common.h +++ b/src/common.h @@ -5,6 +5,17 @@ #include #include +#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 diff --git a/src/main.c b/src/main.c index affe6ee..142034a 100644 --- a/src/main.c +++ b/src/main.c @@ -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);