From ad9a0e13ac4ea272ed433781cddcddf6f5061386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kozakiewicz?= Date: Thu, 12 Jul 2018 21:50:23 +0200 Subject: [PATCH] Small improvements * Safer definitions in io.c * Easier to understand information in repl.wren * Added my e-mail; Contributing > Hacking on the VM --- AUTHORS | 1 + src/module/io.c | 10 ++++++++++ src/module/repl.wren | 2 +- src/module/repl.wren.inc | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index 41abe44e..080ba4b9 100644 --- a/AUTHORS +++ b/AUTHORS @@ -21,3 +21,4 @@ Max Ferguson Sven Bergström Kyle Charters Marshall Bowers +Michal Kozakiewicz diff --git a/src/module/io.c b/src/module/io.c index ee4ee895..7ef3d265 100644 --- a/src/module/io.c +++ b/src/module/io.c @@ -16,11 +16,21 @@ #include // Map to Windows permission flags. + #ifndef S_IRUSR #define S_IRUSR _S_IREAD + #endif + + #ifndef S_IWUSR #define S_IWUSR _S_IWRITE + #endif + #ifndef S_ISREG #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) + #endif + + #ifndef S_ISDIR #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) + #endif // Not supported on Windows. #define O_SYNC 0 diff --git a/src/module/repl.wren b/src/module/repl.wren index 6a77478e..eec22036 100644 --- a/src/module/repl.wren +++ b/src/module/repl.wren @@ -73,7 +73,7 @@ class Repl { insertChar(byte) } else { // TODO: Other shortcuts? - System.print("Unhandled byte: %(byte)") + System.print("Unhandled key-code [dec]: %(byte)") } return false diff --git a/src/module/repl.wren.inc b/src/module/repl.wren.inc index dcd923da..7ef78c5a 100644 --- a/src/module/repl.wren.inc +++ b/src/module/repl.wren.inc @@ -75,7 +75,7 @@ static const char* replModuleSource = " insertChar(byte)\n" " } else {\n" " // TODO: Other shortcuts?\n" -" System.print(\"Unhandled byte: %(byte)\")\n" +" System.print(\"Unhandled key-code [dec]: %(byte)\")\n" " }\n" "\n" " return false\n"