+added a SYS statement to the shell.
This commit is contained in:
parent
a786ec13c3
commit
65f50ebeca
1
HISTORY
1
HISTORY
@ -1,5 +1,6 @@
|
|||||||
Feb. 18 2016
|
Feb. 18 2016
|
||||||
Added a generic iterator type
|
Added a generic iterator type
|
||||||
|
Added a SYS statement to the shell
|
||||||
Fixed a wrong list linkage bug with list sorting
|
Fixed a wrong list linkage bug with list sorting
|
||||||
|
|
||||||
Feb. 16 2016
|
Feb. 16 2016
|
||||||
|
21
shell/main.c
21
shell/main.c
@ -1102,7 +1102,7 @@ static int_t _ticks(void) {
|
|||||||
|
|
||||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||||
|
|
||||||
return ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
|
return (int_t)(ts.tv_sec * 1000 + ts.tv_nsec / 1000000);
|
||||||
}
|
}
|
||||||
#else /* _MSC_VER */
|
#else /* _MSC_VER */
|
||||||
# undef _HAS_TICKS
|
# undef _HAS_TICKS
|
||||||
@ -1171,6 +1171,24 @@ static int set_importing_dirs(struct mb_interpreter_t* s, void** l) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int sys(struct mb_interpreter_t* s, void** l) {
|
||||||
|
int result = MB_FUNC_OK;
|
||||||
|
char* arg = 0;
|
||||||
|
|
||||||
|
mb_assert(s && l);
|
||||||
|
|
||||||
|
mb_check(mb_attempt_open_bracket(s, l));
|
||||||
|
|
||||||
|
mb_check(mb_pop_string(s, l, &arg));
|
||||||
|
|
||||||
|
mb_check(mb_attempt_close_bracket(s, l));
|
||||||
|
|
||||||
|
if(arg)
|
||||||
|
system(arg);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
static int trace(struct mb_interpreter_t* s, void** l) {
|
static int trace(struct mb_interpreter_t* s, void** l) {
|
||||||
int result = MB_FUNC_OK;
|
int result = MB_FUNC_OK;
|
||||||
char* frames[16];
|
char* frames[16];
|
||||||
@ -1300,6 +1318,7 @@ static void _on_startup(void) {
|
|||||||
#endif /* _HAS_TICKS */
|
#endif /* _HAS_TICKS */
|
||||||
mb_reg_fun(bas, now);
|
mb_reg_fun(bas, now);
|
||||||
mb_reg_fun(bas, set_importing_dirs);
|
mb_reg_fun(bas, set_importing_dirs);
|
||||||
|
mb_reg_fun(bas, sys);
|
||||||
mb_reg_fun(bas, trace);
|
mb_reg_fun(bas, trace);
|
||||||
mb_reg_fun(bas, gc);
|
mb_reg_fun(bas, gc);
|
||||||
mb_reg_fun(bas, beep);
|
mb_reg_fun(bas, beep);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user