From 7078e3041943ab961922ac6e01e469e7069c3844 Mon Sep 17 00:00:00 2001 From: Wang Renxin Date: Thu, 22 Oct 2015 11:18:40 +0800 Subject: [PATCH] +added TICKS() for Windows. --- shell/main.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/shell/main.c b/shell/main.c index 3c6faf5..1457941 100755 --- a/shell/main.c +++ b/shell/main.c @@ -33,6 +33,7 @@ #ifdef _MSC_VER # include # include +# include #elif !defined __BORLANDC__ && !defined __TINYC__ # include #endif /* _MSC_VER */ @@ -818,6 +819,21 @@ static int beep(struct mb_interpreter_t* s, void** l) { return result; } +#ifdef _MSC_VER +static int ticks(struct mb_interpreter_t* s, void** l) { + int result = MB_FUNC_OK; + + mb_assert(s && l); + + mb_check(mb_attempt_open_bracket(s, l)); + mb_check(mb_attempt_close_bracket(s, l)); + + mb_check(mb_push_int(s, l, (int_t)GetTickCount())); + + return result; +} +#endif /* _MSC_VER */ + /* ========================================================} */ /* @@ -865,6 +881,9 @@ static void _on_startup(void) { mb_set_error_handler(bas, _on_error); mb_reg_fun(bas, beep); +#ifdef _MSC_VER + mb_reg_fun(bas, ticks); +#endif /* _MSC_VER */ } static void _on_exit(void) {