Hey all.
  This implements a platforms system similar to what we were discussing
earlier: each interface is a sepperate file, independent of the others, the
hints file specifies what interfaces we use.  This does create a large
number of files, but minimizes code copying.  All the peices are cated
(effectively) together into a platform.c file.  (We could make this a
platform.h, if we want stuff to inline more easily.)

It's given as a diff against Configure.pl, and tarballs of the hints and
platforms directories.

There should be a way for configure to check for what interfaces to use.
It shouldn't be that hard; it just needs to step through, and consider
anything that compiles without warnings and runs as good.  (By my
definition, each .c file should be able to compile and run independently.)
If more then one interface defines the same function and works, then we've
got a bit of a problem.

This is completly untested on anything but my the linux and winME sides of
my computer.  (The windows side gets errors in core_ops.c that I can't seem
to track down.)

          -=- James Mastros
Index: Configure.pl
===================================================================
RCS file: /home/perlcvs/parrot/Configure.pl,v
retrieving revision 1.32
diff -u -r1.32 Configure.pl
--- Configure.pl        2001/11/06 16:14:25     1.32
+++ Configure.pl        2001/11/16 02:35:08
@@ -8,6 +8,7 @@
 use Getopt::Long;
 use ExtUtils::Manifest qw(manicheck);
 use File::Copy;
+use IO::File;
 
 my($opt_debugging, $opt_defaults, $opt_version, $opt_help) = (0, 0, 0, 0);
 my(%opt_defines);
@@ -61,7 +62,7 @@
 #Some versions don't seem to have ivtype or nvtype--provide
 #defaults for them.
 #XXX Figure out better defaults
-my(%c)=(
+our(%c)=(
        iv =>                   ($Config{ivtype}   ||'long'),
        intvalsize =>       undef,
 
@@ -119,14 +120,29 @@
 prompt("And your floats?", 'nv');
 prompt("What is your native opcode type?", 'opcode_t');
 
-# Copy the appropriate platform-specific file over
-if (-e "platforms/$c{platform}.h") {
-    copy("platforms/$c{platform}.h", "include/parrot/platform.h");
-    copy("platforms/$c{platform}.c", "platform.c");
+if (not exists $c{cfiles}) {
+    print <<END;
+Nobody has rewritten the "hints" file for your platform yet,
+and nobody has written the configuration guesser yet.  Write a
+file hints/$c{platform}.pl, using the existing files as examples
+if your platform is fairly normal, it shouldn't be too hard.
+END
+    die "No hints"; 
 }
-else {
-    copy("platforms/generic.h", "include/parrot/platform.h");
-    copy("platforms/generic.c", "platform.c");
+
+# Create platform.c from $c{cfiles}
+# (This would be easier if I could just call cat.)
+my @cfiles = @{$c{cfiles}};
+my $platformc = new IO::File "platform.c", "w";
+my($filename);
+print "@cfiles\n";
+
+foreach $filename (@cfiles) {
+    my $fh = new IO::File $filename, "r" or
+      die "Can't open $filename.\n";
+    while (<$fh>) {
+       print $platformc $_;
+    }
 }
 
 unless( $c{debugging} ) {

Attachment: plathints.tar.gz
Description: Binary data

Reply via email to