Author: nickg
Date: Wed Jan 11 03:31:33 2006
New Revision: 11082
Added:
branches/nci/config/inter/nci/
branches/nci/config/inter/nci.pm (contents, props changed)
branches/nci/config/inter/nci/nci_ffcall.in (contents, props changed)
Modified:
branches/nci/Configure.pl
branches/nci/MANIFEST
Log:
NCI #3. Initial test to determine which NCI backend to compile in.
Modified: branches/nci/Configure.pl
==============================================================================
--- branches/nci/Configure.pl (original)
+++ branches/nci/Configure.pl Wed Jan 11 03:31:33 2006
@@ -404,6 +404,7 @@ my @steps = qw(
inter::ops
inter::exp
inter::pmc
+ inter::nci
auto::alignptrs
auto::headers
auto::sizes
Modified: branches/nci/MANIFEST
==============================================================================
--- branches/nci/MANIFEST (original)
+++ branches/nci/MANIFEST Wed Jan 11 03:31:33 2006
@@ -259,6 +259,8 @@ config/inter/exp.pm
config/inter/lex.pm []
config/inter/libparrot.pm []
config/inter/make.pm []
+config/inter/nci.pm []
+config/inter/nci/nci_ffcall.in []
config/inter/ops.pm []
config/inter/pmc.pm []
config/inter/progs.pm []
Added: branches/nci/config/inter/nci.pm
==============================================================================
--- (empty file)
+++ branches/nci/config/inter/nci.pm Wed Jan 11 03:31:33 2006
@@ -0,0 +1,89 @@
+# Copyright: 2001-2005 The Perl Foundation. All Rights Reserved.
+# $Id$
+
+=head1 NAME
+
+config/inter/nci.pm - Determine which NCI implementation to use
+
+=head1 DESCRIPTION
+
+Determines whether to use the builtin NCI implementation, or one provided
+by ffcall.
+
+=cut
+
+package inter::nci;
+
+use strict;
+use vars qw($description $result @args);
+
+use base qw(Parrot::Configure::Step::Base);
+
+use Parrot::Configure::Step ':inter', ':auto';
+
+$description = "Determining which NCI implementation to use...";
+
[EMAIL PROTECTED] = qw(ask verbose);
+
+sub runstep
+{
+ my ($self, $config) = @_;
+
+ # TODO: Allow implementation to be selected through command-line flag
+
+ my @nci_implementations = ('builtin');
+
+ cc_gen('config/inter/nci/nci_ffcall.in');
+
+ eval { cc_build('', '-lavcall -lcallback'); };
+
+ if (! $@) {
+ my $test = cc_run ();
+
+ unshift @nci_implementations, 'ffcall'
+ if $test eq 'Received: It worked!';
+ }
+
+ my $nci_implementation = $nci_implementations[0];
+
+ my $ask = $config->options->get ('ask');
+
+ if ($ask)
+ {
+ print <<'END';
+
+
+ You can choose between a number of diffferent backend implementations
+ for making calls to external libraries:
+
+ * builtin: The original implementation which doesn't require
+ additional libraries
+
+ * ffcall: Requires the ffcall library, and is more functional
+
+END
+ $nci_implementation =
+ prompt ("\nWhich NCI implementation shall I use? (" .
+ join (',', @nci_implementations) . ")",
+ $nci_implementation);
+
+ $nci_implementation = $nci_implementations[0]
+ unless grep { $_ eq $nci_implementation } @nci_implementations;
+
+ }
+
+ $result = $nci_implementation;
+
+ # This makes conditionals in the root makefile possible
+ $nci_implementation = "" if $nci_implementation eq 'builtin';
+
+ $config->data->set( nci_impl => $nci_implementation );
+
+ $config->data->add(' ', 'libs', '-lavcall -lcallback')
+ if $nci_implementation eq 'ffcall';
+
+
+
+}
+
+1;
Added: branches/nci/config/inter/nci/nci_ffcall.in
==============================================================================
--- (empty file)
+++ branches/nci/config/inter/nci/nci_ffcall.in Wed Jan 11 03:31:33 2006
@@ -0,0 +1,22 @@
+/* Test to determine if ffcall is available for NCI */
+
+#include <avcall.h>
+
+void function (char * str)
+{
+ printf ("Received: %s", str);
+
+}
+
+int main ()
+{
+ av_alist alist;
+
+ char* message = "It worked!";
+
+ av_start_void (alist, &function);
+ av_ptr (alist, char *, message);
+
+ av_call (alist);
+
+}