this patch adds support for the freely availabe borland c++ 5.5.1 compiler

depends on: 
- josh's patch to remove ssize_t from CPrederef.pm
- working borland compiler (compiler must know where to find headers and libs)
- Perl's Config.pm modified to use cc='bcc32.exe' not of cc='cl.exe'
- a working make utility (borland make doesn't work, nmake does)

changes:
- add bcc in hints/mswin32.pl
- clean up for msvc++ in hints/mswin32.pl
- remove a space from Configure.pl (very very important for bcc)
- add a O_BINARY flag to open() in pdump.c, embed.c (required by bcc)
- define O_BINARY 0 when it's not defined (win32 knows it, linux not)

and the why:
- parrot is MUCH faster when compiled with borland c (make test on p2-450, 320MB):
  * msvc++: 313 seconds
  * bcc: 251 seconds



Index: Configure.pl
===================================================================
RCS file: /cvs/public/parrot/Configure.pl,v
retrieving revision 1.92
diff -u -r1.92 Configure.pl
--- Configure.pl 15 Feb 2002 23:20:31 -0000 1.92
+++ Configure.pl 20 Feb 2002 23:05:29 -0000
@@ -876,7 +876,7 @@
 sub compiletestc {
     my ($name) = @_;
 
-    my $cmd = "$c{cc} $c{ccflags} -I./include -c $c{ld_out} $name$c{o} $name.c";
+    my $cmd = "$c{cc} $c{ccflags} -I./include -c $c{ld_out}$name$c{o} $name.c";
     system($cmd) and die "C compiler died!  Command was '$cmd'\n";
 
     $cmd = "$c{ld} $c{ldflags} $name$c{o} $c{cc_exe_out}$name$c{exe} $c{libs}";
Index: embed.c
===================================================================
RCS file: /cvs/public/parrot/embed.c,v
retrieving revision 1.11
diff -u -r1.11 embed.c
--- embed.c 18 Feb 2002 08:26:03 -0000 1.11
+++ embed.c 20 Feb 2002 23:05:30 -0000
@@ -96,7 +96,7 @@
             return NULL;
         }
         
-        fd = open(filename, O_RDONLY);
+        fd = open(filename, O_RDONLY | O_BINARY);
         if (!fd) {
              fprintf(stderr, "Parrot VM: Can't open %s, code %i.\n", filename, errno);
              return NULL;
Index: pdump.c
===================================================================
RCS file: /cvs/public/parrot/pdump.c,v
retrieving revision 1.10
diff -u -r1.10 pdump.c
--- pdump.c 18 Feb 2002 08:26:03 -0000 1.10
+++ pdump.c 20 Feb 2002 23:05:30 -0000
@@ -30,7 +30,7 @@
         printf("can't stat %s, code %i\n", argv[1], errno);
         return 1;
     }
-    fd = open(argv[1], O_RDONLY);
+    fd = open(argv[1], O_RDONLY | O_BINARY);
     if (!fd) {
         printf("Can't open, error %i\n", errno);
         return 1;
Index: hints/mswin32.pl
===================================================================
RCS file: /cvs/public/parrot/hints/mswin32.pl,v
retrieving revision 1.9
diff -u -r1.9 mswin32.pl
--- hints/mswin32.pl 31 Jan 2002 21:46:43 -0000 1.9
+++ hints/mswin32.pl 20 Feb 2002 23:05:30 -0000
@@ -1,6 +1,7 @@
 {
  my $is_msvc = grep { $c{cc} eq $_ } ( qw(cl cl.exe) );
  my $is_mingw = grep { $c{cc} eq $_ } ( qw(gcc gcc.exe) );
+ my $is_bcc = grep { $c{cc} eq $_ } ( qw(bcc32 bcc32.exe) );
 
  $c{rm_f} = '$(PERL) -MExtUtils::Command -e rm_f';
  $c{rm_rf} = '$(PERL) -MExtUtils::Command -e rm_rf';
@@ -9,8 +10,6 @@
   $c{o} = '.obj';
   $c{cc_o_out} = '-Fo';
   $c{cc_exe_out} = '-Fe';
-  $c{ld_out} = '/OUT:';
-  $c{cc_ldflags} = '/link';
   $c{cc_ldflags} = '/link';
   $c{cc_debug} = '-Zi';
   $c{ld_debug} = '-debug';
@@ -27,6 +26,25 @@
   # The logo gets printed to STDERR; hence the redirection.
   my $cc_output = `$c{cc} 2>&1`;
   $c{ccflags} =~ s/-O1 // if $cc_output =~ m/Standard/;
+ }
+  if( $is_bcc ) {
+  $c{o} = '.obj';
+    $c{ccflags} = '-O2 -w-8066 -DWIN32 -DNO_STRICT -DNDEBUG -D_CONSOLE';
+  $c{cc_o_out} = '-o';
+  $c{cc_exe_out} = '-e';
+  $c{cc_debug} = '-v';
+
+    $c{ld} = 'bcc32.exe';
+    $c{ldflags} = '';
+  $c{ld_out} = '-e';
+  $c{cc_ldflags} = '';
+  $c{ld_debug} = '-v';
+  $c{ld_shard} = '-WD';
+    $c{libs} = 'import32.lib cw32.lib';
+
+  $c{platform} = 'win32';
+  $c{cp} = 'copy';
+  $c{slash} = '\\';
  }
  elsif( $is_mingw ) {
   $c{ld} = 'gcc';
Index: include/parrot/parrot.h
===================================================================
RCS file: /cvs/public/parrot/include/parrot/parrot.h,v
retrieving revision 1.26
diff -u -r1.26 parrot.h
--- include/parrot/parrot.h 18 Feb 2002 08:26:10 -0000 1.26
+++ include/parrot/parrot.h 20 Feb 2002 23:05:30 -0000
@@ -92,6 +92,12 @@
     #endif
 #endif
 
+/* On Win32 we need the constant O_BINARY for open() (at least for Borland C), 
+   but on UNIX it doesn't exist, so set it to 0 if it's not defined
+ */
+#ifndef O_BINARY
+    #define O_BINARY 0
+#endif
 
 /* define a macro to acknowledge an unused argument, and silence a "helpful"
    compiler warning. gcc will emit a warning on an empty if body unless {} is



Reply via email to