~ chicken-core (chicken-5) e7baf2b93fae5f4546c61fe14ec54126ce9e3953
commit e7baf2b93fae5f4546c61fe14ec54126ce9e3953 Author: Evan Hanson <evhan@foldling.org> AuthorDate: Tue Apr 4 22:35:27 2017 +1200 Commit: Peter Bex <peter@more-magic.net> CommitDate: Thu Apr 6 21:10:14 2017 +0200 Move C_process_sleep into runtime.c The C_process_sleep macro, introduced in 0493e29, depends on <windows.h> for access to Sleep() on Windows, so this converts it into a procedure in runtime.c where we already include that header. It also renames the procedure to reflect the fact that it's an inline call. Signed-off-by: Peter Bex <peter@more-magic.net> diff --git a/chicken.h b/chicken.h index 35f9845b..d6da434b 100644 --- a/chicken.h +++ b/chicken.h @@ -1579,12 +1579,6 @@ typedef void (C_ccall *C_proc)(C_word, C_word *) C_noret; #define C_ub_i_pointer_f32_set(p, n) (*((float *)(p)) = (n)) #define C_ub_i_pointer_f64_set(p, n) (*((double *)(p)) = (n)) -#if defined(_WIN32) && !defined(__CYGWIN__) -# define C_process_sleep(n) (Sleep(C_unfix(n) * 1000), C_fix(0)) -#else -# define C_process_sleep(n) C_fix(sleep(C_unfix(n))) -#endif - #ifdef C_PRIVATE_REPOSITORY # define C_private_repository() C_use_private_repository(C_executable_dirname()) #else @@ -2117,6 +2111,7 @@ C_fctexport C_word C_fcall C_putprop(C_word **a, C_word sym, C_word prop, C_word C_fctexport C_word C_fcall C_i_persist_symbol(C_word sym) C_regparm; C_fctexport C_word C_fcall C_i_unpersist_symbol(C_word sym) C_regparm; C_fctexport C_word C_fcall C_i_get_keyword(C_word key, C_word args, C_word def) C_regparm; +C_fctexport C_word C_fcall C_i_process_sleep(C_word n) C_regparm; C_fctexport C_u64 C_fcall C_milliseconds(void) C_regparm; C_fctexport C_u64 C_fcall C_cpu_milliseconds(void) C_regparm; C_fctexport double C_fcall C_bignum_to_double(C_word bignum) C_regparm; diff --git a/library.scm b/library.scm index 8a654a0d..3caba429 100644 --- a/library.scm +++ b/library.scm @@ -5214,7 +5214,7 @@ EOF ;;; Sleeping: (define (##sys#sleep-hook n) ; modified by scheduler.scm - (##core#inline "C_process_sleep" n)) + (##core#inline "C_i_process_sleep" n)) (define (sleep n) (##sys#check-fixnum n 'sleep) diff --git a/posix-common.scm b/posix-common.scm index d12edeba..e3e67393 100644 --- a/posix-common.scm +++ b/posix-common.scm @@ -688,7 +688,7 @@ EOF (define (process-sleep n) (##sys#check-fixnum n 'process-sleep) - (##core#inline "C_process_sleep" n)) + (##core#inline "C_i_process_sleep" n)) (define process-wait (lambda args diff --git a/runtime.c b/runtime.c index d80301fe..e85b397f 100644 --- a/runtime.c +++ b/runtime.c @@ -13280,6 +13280,15 @@ void C_ccall C_filter_heap_objects(C_word c, C_word *av) C_reclaim((void *)filter_heap_objects_2, c); } +C_regparm C_word C_fcall C_i_process_sleep(C_word n) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + Sleep(C_unfix(n) * 1000); + return C_fix(0); +#else + return C_fix(sleep(C_unfix(n))); +#endif +} C_regparm C_word C_fcall C_i_file_exists_p(C_word name, C_word file, C_word dir)Trap