With the patch attached, all tests pass on Win32. Well, except for the fact that classes\intclass.obj gets created as .\intclass.obj, forcing you to manually copy it to the right place. Ugh. And examples\assembly\mops.obj has the same problem. And there are 11 warnings in intclass.c that I don't want to bother to fix. ("classes\intclass.c(16) : warning C4716: 'Parrot_int_type' : must return a value" and such.) Other than that, though, it works fine.
--Brent Dax [EMAIL PROTECTED] Configure pumpking for Perl 6 When I take action, I’m not going to fire a $2 million missile at a $10 empty tent and hit a camel in the butt. --Dubya
--- ..\..\parrot-cvs\parrot\make_vtable_ops.pl Sun Oct 21 09:47:10 2001 +++ make_vtable_ops.pl Thu Oct 25 17:00:10 2001 @@ -1,35 +1,52 @@ use Parrot::Vtable; my %vtable = parse_vtable(); +print "#define VTABLE_CALL_TYPE(func, type) ((op_func_t)((INTVAL)func + +(INTVAL)type))\n\n"; + while (<DATA>) { next if /^#/ or /^$/; my @params = split; my $op = $params[1]; my $vtable_entry = $params[2] || $op; + die "Can't find $vtable_entry in vtable, line $.\n" unless exists $vtable{$vtable_entry}; + print "AUTO_OP $params[1] (".(join ", ", ("p")x$params[0]).") {\n"; - print "\t(\$2->vtable->$vtable_entry"; - print multimethod($vtable_entry); + + print "\t".multimethod($vtable_entry); + if ($params[0] == 3) { # Three-address function - print ')($2,$3,$1);'; + print '($2,$3,$1);'; } elsif ($params[0] == 2) { # Unary function - print ')($2,$1);'; + print '($2,$1);'; } + print "\n}\n"; } + sub multimethod { - my $type = $vtable{$_[0]}{meth_type}; - return "" if $type eq "unique"; - return '_1 + $3->vtable->num_type' if $type eq "num"; - return '_1 + $3->vtable->string_type' if $type eq "str"; + my $vtable_entry=shift; + my $type = $vtable{$vtable_entry}{meth_type}; + my $firstarg="\$2->vtable->$vtable_entry"; + + return "(${firstarg})" + if $type eq "unique"; + + return "VTABLE_CALL_TYPE(${firstarg}_1, \$3->vtable->num_type)" + if $type eq "num"; + + return "VTABLE_CALL_TYPE(${firstarg}_1, \$3->vtable->string_type)" + if $type eq "str"; + die "Coding error - undefined type $type\n"; } + __DATA__ # Three-address functions 3 add --- ..\..\parrot-cvs\parrot\core.ops Wed Oct 24 07:54:54 2001 +++ core.ops Thu Oct 25 14:27:46 2001 @@ -3,8 +3,16 @@ */ #include <math.h> -#include <sys/time.h> +#ifdef HAS_HEADER_SYSTIME + #include <sys/time.h> +#else + #ifdef WIN32 + #include <time.h> + __declspec(dllimport) void __stdcall Sleep(unsigned long); + #endif /* WIN32 */ +#endif /* HAS_HEADER_SYSTIME */ + =head1 NAME core.ops @@ -95,9 +103,19 @@ =cut AUTO_OP time(n) { +#ifdef HAS_HEADER_SYSTIME + struct timeval t; gettimeofday(&t, NULL); $1 = (FLOATVAL)t.tv_sec + ((FLOATVAL)t.tv_usec / 1000000.0); + +#else + + /* Win32 doesn't have gettimeofday or <sys/time.h>, so just use normal time w/o +microseconds + XXX Is there a Win32 equivalent to gettimeoday? */ + $1 = (FLOATVAL)time(NULL); + +#endif } @@ -1786,7 +1804,11 @@ =cut AUTO_OP sleep(i|ic) { - sleep($1); + #ifdef WIN32 + Sleep($1*1000); + #else + sleep($1); + #endif } ###############################################################################