On Wed, 19 Sep 2001, Dan Sugalski wrote:

> At 01:37 PM 9/19/2001 -0400, Andy Dougherty wrote:

> >Of course it doesn't help that perl doesn't have a pack() flag for IV :-).
> 
> Definitely a pain. :) We need to figure out the size and use the 
> appropriate thingie. That should be a mild amount of fun... :)

This might help a bit.

diff -r -u parrot/Configure.pl parrot-andy/Configure.pl
--- parrot/Configure.pl Tue Sep 18 14:05:48 2001
+++ parrot-andy/Configure.pl    Wed Sep 19 14:36:21 2001
@@ -61,7 +61,10 @@
 #XXX Figure out better defaults
 my(%c)=(
        iv =>                   ($Config{ivtype}||'long'),
+       ivsize =>               ($Config{ivsize}||'4'),
+       longsize =>             ($Config{longsize}||'4'),
        nv =>                   ($Config{nvtype}||'double'),
+       nvsize =>               ($Config{nvsize}||'8'),
        cc =>                   $Config{cc},
        #ADD C COMPILER FLAGS HERE
        ccflags =>              $Config{ccflags}." -I./include",
@@ -96,7 +99,9 @@
 prompt("What flags would you like passed to your C compiler?", 'ccflags');
 prompt("Which libraries would you like your C compiler to include?", 'libs');
 prompt("How big would you like integers to be?", 'iv');
+prompt("And what is sizeof(iv)?", 'ivsize');
 prompt("And your floats?", 'nv');
+prompt("And what is sizeof(nv)?", 'nvsize');
 
 unless( $c{debugging} ) {
        $c{ld_debug} = ' ';
diff -r -u parrot/assemble.pl parrot-andy/assemble.pl
--- parrot/assemble.pl  Mon Sep 17 20:32:15 2001
+++ parrot-andy/assemble.pl     Wed Sep 19 14:44:49 2001
@@ -7,6 +7,7 @@
 use strict;
 use Getopt::Long;
 use Parrot::Opcode;
+use Parrot::Config;
 
 my %options;
 GetOptions(\%options,('checksyntax',
@@ -44,8 +45,21 @@
     exit;
 }
 
-# define data types
-my(%pack_type)=('i'=>'l','n'=>'d');
+# define data types for pack.
+my %pack_type;
+# Alas perl5.7.2 doesn't have an IV flag for pack().
+if ($PConfig{ivsize} == $PConfig{longsize}) {
+    %pack_type = ('i'=>'l!','n'=>'d');
+}
+elsif ($PConfig{ivsize} == 8) {
+    %pack_type = ('i'=>'q','n'=>'d');
+}
+elsif ($PConfig{ivsize} == 4) {
+    %pack_type = ('i'=>'l','n'=>'d');
+}
+else {
+    die("I don't know how to pack an IV!\n");
+}
 my(%real_type)=('I'=>'i','i'=>'i',
                 'N'=>'i','n'=>'n',
                 'S'=>'i','s'=>'i',

-- 
    Andy Dougherty              [EMAIL PROTECTED]
    Dept. of Physics
    Lafayette College, Easton PA 18042

Reply via email to