~ chicken-core (chicken-5) a1bae03fe303457d7463bba83e6045ad2a9f4410
commit a1bae03fe303457d7463bba83e6045ad2a9f4410
Author: felix <felix@call-with-current-continuation.org>
AuthorDate: Wed Dec 22 04:34:14 2010 -0500
Commit: felix <felix@call-with-current-continuation.org>
CommitDate: Wed Dec 22 04:34:14 2010 -0500
removed remaining MSVC support, deprecated c-runtime procedure
diff --git a/chicken-bug.scm b/chicken-bug.scm
index 60fb0cc0..e3d8c6e2 100644
--- a/chicken-bug.scm
+++ b/chicken-bug.scm
@@ -35,7 +35,7 @@
(define (user-id)
(cond-expand
- ((or mingw32 msvc) "<not available>")
+ (mingw32 "<not available>")
(else (user-information (current-user-id)))))
(define (collect-info)
diff --git a/chicken.h b/chicken.h
index f6bac20f..8d5cb46c 100644
--- a/chicken.h
+++ b/chicken.h
@@ -83,7 +83,7 @@
# define C_GNU_ENV
#endif
-#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__WATCOMC__) || defined(__MWERKS__) || defined(__DJGPP__)
+#if defined(__MINGW32__) || defined(__WATCOMC__) || defined(__MWERKS__)
# define C_NONUNIX
#endif
@@ -135,22 +135,12 @@
# include <sys/byteorder.h>
#endif
-#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__WATCOMC__)
+#if defined(__MINGW32__) || defined(__WATCOMC__)
# include <malloc.h>
#endif
-#ifdef _MSC_VER
-# include <io.h>
-#endif
-
/* Much better with stack allocation API */
-#if defined(_MSC_VER)
-# if HAVE_ALLOCA_H
-# define alloca _alloca
-# endif
-#endif
-
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
#elif !defined(alloca) /* predefined by HP cc +Olibcalls */
@@ -182,20 +172,6 @@ void *alloca ();
/* Make sure some common C identifiers are availble w/ Windows */
-#ifdef _MSC_VER
-# define strncasecmp strnicmp
-# define isatty _isatty
-typedef __int8 int8_t;
-typedef unsigned __int8 uint8_t;
-typedef __int16 int16_t;
-typedef unsigned __int16 uint16_t;
-typedef __int32 int32_t;
-typedef unsigned __int32 uint32_t;
-typedef __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-# pragma warning(disable: 4101)
-#endif
-
/* Could be used by C++ source */
#ifdef __cplusplus
@@ -223,23 +199,6 @@ typedef unsigned __int64 uint64_t;
# undef C_varextern
# define C_varextern C_extern __declspec(dllimport)
# endif
-# elif defined(_MSC_VER)
-# undef C_fctimport
-# define C_fctimport __declspec(dllexport)
-# undef C_externimport
-# undef C_externexport
-# define C_externexport C_extern __declspec(dllexport)
-# undef C_varextern
-# undef C_fctexport
-# ifdef C_BUILDING_LIBCHICKEN
-# define C_varextern C_extern __declspec(dllexport)
-# define C_fctexport __declspec(dllexport)
-# define C_externimport C_extern __declspec(dllexport)
-# else
-# define C_varextern C_extern __declspec(dllimport)
-# define C_fctexport __declspec(dllimport)
-# define C_externimport C_extern __declspec(dllimport)
-# endif
# elif defined(__WATCOMC__)
# undef C_fctimport
# define C_fctimport __declspec(dllexport)
@@ -276,8 +235,6 @@ typedef unsigned __int64 uint64_t;
# if defined(__i386__) && !defined(__clang__)
# define C_regparm __attribute__ ((regparm(3)))
# endif
-#elif defined(_MSC_VER)
-# define C_fcall __fastcall
#elif defined(__WATCOMC__)
# define C_ccall __cdecl
#endif
@@ -317,8 +274,6 @@ typedef unsigned __int64 uint64_t;
#ifdef C_ENABLE_TLS
# if defined(__GNUC__)
# define C_TLS __thread
-# elif defined(_MSC_VER)
-# define C_TLS __declspec(thread)
# endif
#endif
@@ -535,7 +490,7 @@ typedef unsigned __int64 uint64_t;
# define C_s32 int
#endif
-#if defined(_MSC_VER) || defined (__MINGW32__)
+#if defined (__MINGW32__)
# define C_s64 __int64
# define C_u64 unsigned __int64
#else
@@ -640,8 +595,6 @@ typedef unsigned __int64 uint64_t;
#if defined(__CYGWIN__)
# define C_BUILD_PLATFORM "cygwin"
-#elif defined(_MSC_VER)
-# define C_BUILD_PLATFORM "msvc"
#elif defined(__SUNPRO_C)
# define C_BUILD_PLATFORM "sun"
#elif defined(__MINGW32__)
@@ -660,16 +613,6 @@ typedef unsigned __int64 uint64_t;
# define C_BUILD_PLATFORM "unknown"
#endif
-#if defined(_MSC_VER)
-# if defined(_DLL)
-# define C_RUNTIME_VERSION "dynamic"
-# else
-# define C_RUNTIME_VERSION "static"
-# endif
-#else
-# define C_RUNTIME_VERSION "unknown"
-#endif
-
#if defined(__linux__)
# define C_SOFTWARE_VERSION "linux"
#elif defined(__FreeBSD__)
@@ -1715,7 +1658,6 @@ C_fctexport void C_ccall C_machine_type(C_word c, C_word closure, C_word k) C_no
C_fctexport void C_ccall C_machine_byte_order(C_word c, C_word closure, C_word k) C_noret;
C_fctexport void C_ccall C_software_version(C_word c, C_word closure, C_word k) C_noret;
C_fctexport void C_ccall C_build_platform(C_word c, C_word closure, C_word k) C_noret;
-C_fctexport void C_ccall C_c_runtime(C_word c, C_word closure, C_word k) C_noret;
C_fctexport void C_ccall C_register_finalizer(C_word c, C_word closure, C_word k, C_word x, C_word proc) C_noret;
C_fctexport void C_ccall C_set_dlopen_flags(C_word c, C_word closure, C_word k, C_word now, C_word global) C_noret;
C_fctexport void C_ccall C_dload(C_word c, C_word closure, C_word k, C_word name, C_word entry, C_word reloadable) C_noret;
diff --git a/csc.scm b/csc.scm
index d57ca083..b0f5f59d 100644
--- a/csc.scm
+++ b/csc.scm
@@ -66,9 +66,8 @@
;;; Parameters:
(define mingw (eq? (build-platform) 'mingw32))
-(define msvc (eq? (build-platform) 'msvc))
(define osx (eq? (software-version) 'macosx))
-(define win (or mingw msvc))
+(define win mingw)
(define netbsd (eq? (software-version) 'netbsd))
(define cygwin (eq? (build-platform) 'cygwin))
@@ -106,24 +105,22 @@
(define compiler (quotewrap (if host-mode INSTALL_CC TARGET_CC)))
(define c++-compiler (quotewrap (if host-mode INSTALL_CXX TARGET_CXX)))
(define rc-compiler (quotewrap (if host-mode INSTALL_RC_COMPILER TARGET_RC_COMPILER)))
-(define linker (quotewrap (if msvc "link" (if host-mode INSTALL_CC TARGET_CC))))
-(define c++-linker (quotewrap (if msvc "link" (if host-mode INSTALL_CXX TARGET_CXX))))
-(define object-extension (if msvc "obj" "o"))
-(define library-extension (if msvc "lib" "a"))
-(define link-output-flag (if msvc "-out:" "-o "))
-(define executable-extension (if msvc "exe" ""))
-(define compile-output-flag (if msvc "-Fo" "-o "))
+(define linker (quotewrap (if host-mode INSTALL_CC TARGET_CC)))
+(define c++-linker (quotewrap (if host-mode INSTALL_CXX TARGET_CXX)))
+(define object-extension "o")
+(define library-extension "a")
+(define link-output-flag "-o ")
+(define executable-extension "")
+(define compile-output-flag "-o ")
(define nonstatic-compilation-options '())
(define shared-library-extension ##sys#load-dynamic-extension)
(define default-translation-optimization-options '())
-(define pic-options (if (or mingw msvc cygwin) '("-DPIC") '("-fPIC" "-DPIC")))
+(define pic-options (if (or mingw cygwin) '("-DPIC") '("-fPIC" "-DPIC")))
(define windows-shell WINDOWS_SHELL)
(define generate-manifest #f)
(define default-library
- (string-append
- (if msvc "libchicken-static." "libchicken.")
- library-extension))
+ (string-append "libchicken." library-extension))
(define default-compilation-optimization-options (string-split (if host-mode INSTALL_CFLAGS TARGET_CFLAGS)))
(define best-compilation-optimization-options default-compilation-optimization-options)
diff --git a/csi.scm b/csi.scm
index f09d6d07..3e2cc4e7 100644
--- a/csi.scm
+++ b/csi.scm
@@ -31,7 +31,7 @@
(disable-interrupts)
(compile-syntax)
(foreign-declare #<<EOF
-#if (defined(_MSC_VER) && defined(_WIN32)) || defined(HAVE_DIRECT_H)
+#if defined(HAVE_DIRECT_H)
# include <direct.h>
#else
# define _getcwd(buf, len) NULL
diff --git a/extras.scm b/extras.scm
index 8c534721..ee9cf78e 100644
--- a/extras.scm
+++ b/extras.scm
@@ -343,7 +343,6 @@
(out (if (fx> code #xffff) "U" "u") col)
(out (number->string code 16) col) ]
[else (out (make-string 1 obj) col)] ) ) ) )
- ((eof-object? obj) (out "#<eof>" col))
((##core#inline "C_undefinedp" obj) (out "#<unspecified>" col))
((##core#inline "C_anypointerp" obj) (out (##sys#pointer->string obj) col))
((eq? obj (##sys#slot '##sys#arbitrary-unbound-symbol 0))
diff --git a/files.scm b/files.scm
index 52bd0d87..7ee5195c 100644
--- a/files.scm
+++ b/files.scm
@@ -348,7 +348,7 @@ EOF
;;; normalize pathname for a particular platform
(define normalize-pathname
- (let ((bldplt (if (memq (build-platform) '(msvc mingw32)) 'windows 'unix)) )
+ (let ((bldplt (if (eq? (build-platform) 'mingw32) 'windows 'unix)) )
(define (addpart part parts)
(cond ((string=? "." part) parts)
((string=? ".." part)
diff --git a/library.scm b/library.scm
index 1c73a3d5..cb2223cb 100644
--- a/library.scm
+++ b/library.scm
@@ -47,9 +47,7 @@
# include <sysexits.h>
#endif
-#if !defined(_MSC_VER)
-# include <unistd.h>
-#endif
+#include <unistd.h>
#ifndef EX_SOFTWARE
# define EX_SOFTWARE 70
@@ -3469,9 +3467,7 @@ EOF
(let ([sym (string->symbol ((##core#primitive "C_build_platform")))])
(lambda () sym) ) )
-(define c-runtime
- (let ([sym (string->symbol ((##core#primitive "C_c_runtime")))])
- (lambda () sym) ) )
+(define (c-runtime) 'unknown) ; DEPRECATED
(define ##sys#windows-platform
(and (eq? 'windows (software-type))
diff --git a/posixwin.scm b/posixwin.scm
index f4de4ad7..27013588 100644
--- a/posixwin.scm
+++ b/posixwin.scm
@@ -72,7 +72,7 @@
# define WIN32_LEAN_AND_MEAN
#endif
-#if (_MSC_VER > 1300) || (defined(HAVE_WINSOCK2_H) && defined(HAVE_WS2TCPIP_H))
+#if (defined(HAVE_WINSOCK2_H) && defined(HAVE_WS2TCPIP_H))
# include <winsock2.h>
# include <ws2tcpip.h>
#else
diff --git a/profiler.scm b/profiler.scm
index c07817a3..453a5022 100644
--- a/profiler.scm
+++ b/profiler.scm
@@ -32,9 +32,7 @@
(fixnum) )
(foreign-declare #<<EOF
-#if !defined(_MSC_VER)
-# include <unistd.h>
-#endif
+#include <unistd.h>
EOF
)
diff --git a/runtime.c b/runtime.c
index ca3392b0..2b37d8cd 100644
--- a/runtime.c
+++ b/runtime.c
@@ -110,23 +110,12 @@ static C_TLS int timezone;
# endif
#endif
-#ifdef _MSC_VER
-# define S_IFMT _S_IFMT
-# define S_IFDIR _S_IFDIR
-# define timezone _timezone
-# if defined(_M_IX86)
-# ifndef C_HACKED_APPLY
-# define C_HACKED_APPLY
-# endif
-# endif
-#else
-# ifdef C_HACKED_APPLY
-# if defined(__MACH__) || defined(__MINGW32__) || defined(__CYGWIN__)
-extern void C_do_apply_hack(void *proc, C_word *args, int count) C_noret;
-# else
-extern void _C_do_apply_hack(void *proc, C_word *args, int count) C_noret;
-# define C_do_apply_hack _C_do_apply_hack
-# endif
+#ifdef C_HACKED_APPLY
+# if defined(__MACH__) || defined(__MINGW32__) || defined(__CYGWIN__)
+etern void C_do_apply_hack(void *proc, C_word *args, int count) C_noret;
+# else
+etern void _C_do_apply_hack(void *proc, C_word *args, int count) C_noret;
+# define C_do_apply_hack _C_do_apply_hack
# endif
#endif
@@ -596,7 +585,7 @@ int CHICKEN_initialize(int heap, int stack, int symbols, void *toplevel)
/*FIXME Should have C_tzset in chicken.h? */
#ifdef C_NONUNIX
C_startup_time_seconds = (time_t)0;
-# if defined(_MSC_VER) || defined(__MINGW32__)
+# if defined(__MINGW32__)
/* Make sure _tzname, _timezone, and _daylight are set */
_tzset();
# endif
@@ -728,7 +717,7 @@ int CHICKEN_initialize(int heap, int stack, int symbols, void *toplevel)
static C_PTABLE_ENTRY *create_initial_ptable()
{
/* hardcoded table size - this must match the number of C_pte calls! */
- C_PTABLE_ENTRY *pt = (C_PTABLE_ENTRY *)C_malloc(sizeof(C_PTABLE_ENTRY) * 65);
+ C_PTABLE_ENTRY *pt = (C_PTABLE_ENTRY *)C_malloc(sizeof(C_PTABLE_ENTRY) * 62);
int i = 0;
if(pt == NULL)
@@ -741,7 +730,6 @@ static C_PTABLE_ENTRY *create_initial_ptable()
C_pte(call_cc_wrapper);
C_pte(C_gc);
C_pte(C_allocate_vector);
- C_pte(C_get_argv); /* OBSOLETE */
C_pte(C_make_structure);
C_pte(C_ensure_heap_reserve);
C_pte(C_return_to_host);
@@ -767,7 +755,6 @@ static C_PTABLE_ENTRY *create_initial_ptable()
C_pte(C_quotient);
C_pte(C_flonum_fraction);
C_pte(C_expt);
- C_pte(C_exact_to_inexact); /* OBSOLETE */
C_pte(C_string_to_number);
C_pte(C_number_to_string);
C_pte(C_make_symbol);
@@ -783,7 +770,6 @@ static C_PTABLE_ENTRY *create_initial_ptable()
C_pte(C_machine_byte_order);
C_pte(C_software_version);
C_pte(C_build_platform);
- C_pte(C_c_runtime);
C_pte(C_make_pointer);
C_pte(C_make_tagged_pointer);
C_pte(C_peek_signed_integer);
@@ -4174,11 +4160,7 @@ C_regparm C_word C_fcall C_fudge(C_word fudge_factor)
return C_fix(C_trace_buffer_size);
case C_fix(30):
-#ifdef _MSC_VER
- return C_fix(_MSC_VER);
-#else
return C_SCHEME_FALSE;
-#endif
case C_fix(31):
tgc = timer_accumulated_gc_ms;
@@ -5808,18 +5790,12 @@ void C_ccall C_apply(C_word c, C_word closure, C_word k, C_word fn, ...)
buf[ 2 ] = k;
C_memcpy(&buf[ 3 ], C_temporary_stack_limit, n * sizeof(C_word));
proc = (void *)C_block_item(fn2, 0);
-# ifdef _MSC_VER
- __asm {
- mov eax, proc
- mov esp, buf
- call eax
- }
-# elif defined(__GNUC__)
+# ifdef __GNUC__
C_do_apply_hack(proc, buf, n + 3);
+# else
+ C_do_apply(n, fn2, k);
# endif
#endif
-
- C_do_apply(n, fn2, k);
}
@@ -7732,12 +7708,7 @@ void file_info_2(void *dummy)
t, f1, f2, f3;
int len = C_header_size(name);
char *buffer2;
-
-#ifdef _MSC_VER
- struct _stat buf;
-#else
struct stat buf;
-#endif
buffer2 = buffer;
if(len >= sizeof(buffer)) {
@@ -7747,19 +7718,13 @@ void file_info_2(void *dummy)
C_strncpy(buffer2, C_c_string(name), len);
buffer2[ len ] = '\0';
-#ifdef _MSC_VER
- if(_stat(buffer2, &buf) != 0) v = C_SCHEME_FALSE;
-#else
if(stat(buffer2, &buf) != 0) v = C_SCHEME_FALSE;
-#endif
else {
switch(buf.st_mode & S_IFMT) {
case S_IFDIR: t = 1; break;
-#if !defined(_MSC_VER)
case S_IFIFO: t = 3; break;
-# if !defined(__MINGW32__)
+#if !defined(__MINGW32__)
case S_IFSOCK: t = 4; break;
-# endif
#endif
default: t = 0;
}
@@ -7778,37 +7743,8 @@ void file_info_2(void *dummy)
}
-/* The following code was contributed by Sergey Khorev: */
-#if defined(_MSC_VER) && !defined(_DLL)
-/* we're using static C runtime
- * each module has its own environment block
- * use WinAPI to have consistent look to environment */
-
-# define ENV_SIZE 32767
-static char *envbuf;
-static char *C_do_getenv(const char *var)
-{
- envbuf = (char *)malloc(ENV_SIZE);
- if(!envbuf)
- return NULL;
- if(!GetEnvironmentVariable(var, envbuf, ENV_SIZE))
- {
- free(envbuf);
- return NULL;
- }
- else
- return envbuf;
-}
-
-
-static void C_free_envbuf()
-{
- free(envbuf);
-}
-#else
-# define C_do_getenv(v) C_getenv(v)
-# define C_free_envbuf() {}
-#endif
+#define C_do_getenv(v) C_getenv(v)
+#define C_free_envbuf() {}
void C_ccall C_get_environment_variable(C_word c, C_word closure, C_word k, C_word name)
@@ -8011,20 +7947,6 @@ void C_ccall C_build_platform(C_word c, C_word closure, C_word k)
}
-/* By Sergey Khorev: */
-void C_ccall C_c_runtime(C_word c, C_word closure, C_word k)
-{
- C_word *a, s;
-
- if(c != 2) C_bad_argc(c, 2);
-
- a = C_alloc(2 + C_bytestowords(strlen(C_RUNTIME_VERSION)));
- s = C_string2(&a, C_RUNTIME_VERSION);
-
- C_kontinue(k, s);
-}
-
-
void C_ccall C_software_version(C_word c, C_word closure, C_word k)
{
C_word *a, s;
diff --git a/scheduler.scm b/scheduler.scm
index d2505daf..84177de7 100644
--- a/scheduler.scm
+++ b/scheduler.scm
@@ -46,11 +46,11 @@
#endif
#ifdef _WIN32
-# if _MSC_VER > 1300
-# include <winsock2.h>
-# include <ws2tcpip.h>
+# if (defined(HAVE_WINSOCK2_H) && defined(HAVE_WS2TCPIP_H))
+# include <winsock2.h>
+# include <ws2tcpip.h>
# else
-# include <winsock.h>
+# include <winsock.h>
# endif
/* Beware: winsock2.h must come BEFORE windows.h */
# define C_msleep(n) (Sleep(C_unfix(n)), C_SCHEME_TRUE)
diff --git a/srfi-18.scm b/srfi-18.scm
index 1bdc6de1..36b4addd 100644
--- a/srfi-18.scm
+++ b/srfi-18.scm
@@ -445,14 +445,13 @@
;;; Don't block in the repl: (by Chris Double)
-(unless (eq? (build-platform) 'msvc)
- (set! ##sys#read-prompt-hook
- (let ([old ##sys#read-prompt-hook])
- (lambda ()
- (when (or (##sys#fudge 12) (##sys#tty-port? ##sys#standard-input))
- (old)
- (##sys#thread-block-for-i/o! ##sys#current-thread 0 #:input)
- (thread-yield!)))) ) )
+(set! ##sys#read-prompt-hook
+ (let ([old ##sys#read-prompt-hook])
+ (lambda ()
+ (when (or (##sys#fudge 12) (##sys#tty-port? ##sys#standard-input))
+ (old)
+ (##sys#thread-block-for-i/o! ##sys#current-thread 0 #:input)
+ (thread-yield!)))) )
;;; Waiting for I/O on file-descriptor
diff --git a/tcp.scm b/tcp.scm
index 64d1a474..bcca5229 100644
--- a/tcp.scm
+++ b/tcp.scm
@@ -34,11 +34,11 @@
(foreign-declare #<<EOF
#include <errno.h>
#ifdef _WIN32
-# if _MSC_VER > 1300
-# include <winsock2.h>
-# include <ws2tcpip.h>
+# if (defined(HAVE_WINSOCK2_H) && defined(HAVE_WS2TCPIP_H))
+# include <winsock2.h>
+# include <ws2tcpip.h>
# else
-# include <winsock.h>
+# include <winsock.h>
# endif
/* Beware: winsock2.h must come BEFORE windows.h */
# define socklen_t int
diff --git a/utils.scm b/utils.scm
index 882cb524..7a9cb8fd 100644
--- a/utils.scm
+++ b/utils.scm
@@ -60,7 +60,7 @@
(define (qs str #!optional (platform (build-platform)))
(case platform
- ((mingw32 msvc)
+ ((mingw32)
(string-append "\"" str "\""))
(else
(if (zero? (string-length str))
@@ -86,7 +86,7 @@
(lambda (filename #!key (options '()) output-file (load #t))
(let ((cscpath (or (file-exists? (make-pathname path csc)) "csc"))
(tmpfile (and (not output-file) (create-temporary-file "so")))
- (crapshell (memq (build-platform) '(mingw32 msvc))))
+ (crapshell (eq? (build-platform) 'mingw32)))
(print "; compiling " filename " ...")
(system*
"~a~a -s ~a ~a -o ~a~a"
Trap