On Wed, 26 Sep 2001, Andy Dougherty wrote:
> I posted a patch last week to change the 'l' to a 'q', but more generally,
> the assumption that sizeof(opcode_t) == sizeof(IV) should probably be
> removed and each should be computed independently. Perhaps late today I'll
> have a chance to do that if nobody beats me to it.
Nobody beat me to it :-).
diff -r -u parrot/Configure.pl parrot-andy/Configure.pl
--- parrot/Configure.pl Sun Sep 23 10:50:48 2001
+++ parrot-andy/Configure.pl Wed Sep 26 15:55:59 2001
@@ -134,9 +134,10 @@
buildfile("test_c");
system("$c{cc} $c{ccflags} -o test_siz$c{exe} test.c") and die "C compiler died!";
-(@c{qw(ivsize longsize nvsize)})=split('/', `./test_siz$c{exe}`);
+(@c{qw(ivsize longsize nvsize opcode_t_size)})=split('/', `./test_siz$c{exe}`);
die "Something wicked happened!"
- unless defined $c{ivsize} and defined $c{longsize} and defined $c{nvsize};
+ unless defined $c{ivsize} and defined $c{longsize} and
+ defined $c{nvsize} and defined $c{opcode_t_size};
unlink('test.c', "test_siz$c{exe}", "test$c{o}");
print <<"END";
@@ -145,20 +146,23 @@
various Parrot internal types.
END
-my %pack_type;
+
# Alas perl5.7.2 doesn't have an IV flag for pack().
# The ! modifier only works for perl 5.6.x or greater.
-if (($] >= 5.006) && ($c{ivsize} == $c{longsize}) ) {
- $c{packtype_i} = 'l!';
- $c{packtype_op} = 'l!';
-}
-elsif ($c{ivsize} == 4) {
- $c{packtype_i} = 'l';
- $c{packtype_op} = 'l';
-}
-elsif ($c{ivsize} == 8) {
- $c{packtype_i} = 'q';
- $c{packtype_op} = 'l';
+foreach ('ivsize', 'opcode_t_size') {
+ my $which = $_ eq 'ivsize' ? 'packtype_i' : 'packtype_op';
+ if (($] >= 5.006) && ($c{$_} == $c{longsize}) ) {
+ $c{$which} = 'l!';
+ }
+ elsif ($c{$_} == 4) {
+ $c{$which} = 'l';
+ }
+ elsif ($c{$_} == 8) {
+ $c{$which} = 'q';
+ }
+ else {
+ die "Configure.pl: Unable to find a suitable packtype for $_.\n";
+ }
}
$c{packtype_n} = 'd';
diff -r -u parrot/test_c.in parrot-andy/test_c.in
--- parrot/test_c.in Sat Sep 22 21:03:59 2001
+++ parrot-andy/test_c.in Wed Sep 26 15:53:23 2001
@@ -8,7 +8,8 @@
#include <stdio.h>
int main(int argc, char **argv) {
- printf("%d/%d/%d", sizeof(${iv}), sizeof(long), sizeof(${nv}));
+ printf("%d/%d/%d/%d",
+ sizeof(${iv}), sizeof(long), sizeof(${nv}), sizeof(${opcode_t}));
return 0;
}
--
Andy Dougherty [EMAIL PROTECTED]
Dept. of Physics
Lafayette College, Easton PA 18042