[svn:parrot] r45083 - in branches/pcc_hackathon_6Mar10: . compilers/imcc config/auto config/gen/makefiles config/init docs docs/dev docs/pdds docs/project ext/Parrot-Embed ext/Parrot-Embed/lib/Parrot ext/Parrot-Embed/t include/parrot lib/Parrot lib/Parrot/Configure/Options lib/Parrot/Configure/Options/Conf lib/Parrot/Ops2c lib/Parrot/Ops2pm runtime/parrot/library runtime/parrot/library/Config src src/gc src/io src/ops src/pmc src/runcore t/codingstd t/dynpmc t/pmc t/tools/ops2pm tools/dev
bacek at svn.parrot.org
bacek at svn.parrot.org
Sun Mar 21 10:14:53 UTC 2010
Author: bacek
Date: Sun Mar 21 10:14:48 2010
New Revision: 45083
URL: https://trac.parrot.org/parrot/changeset/45083
Log:
Sync branch with trunk.
Deleted:
branches/pcc_hackathon_6Mar10/src/pmc/cpointer.pmc
branches/pcc_hackathon_6Mar10/t/pmc/cpointer.t
Modified:
branches/pcc_hackathon_6Mar10/CREDITS
branches/pcc_hackathon_6Mar10/DEPRECATED.pod
branches/pcc_hackathon_6Mar10/MANIFEST
branches/pcc_hackathon_6Mar10/MANIFEST.generated
branches/pcc_hackathon_6Mar10/NEWS
branches/pcc_hackathon_6Mar10/compilers/imcc/instructions.c
branches/pcc_hackathon_6Mar10/compilers/imcc/pbc.c
branches/pcc_hackathon_6Mar10/compilers/imcc/symreg.c
branches/pcc_hackathon_6Mar10/config/auto/warnings.pm
branches/pcc_hackathon_6Mar10/config/gen/makefiles/root.in
branches/pcc_hackathon_6Mar10/config/init/defaults.pm
branches/pcc_hackathon_6Mar10/config/init/hints.pm
branches/pcc_hackathon_6Mar10/docs/dev/profiling.pod
branches/pcc_hackathon_6Mar10/docs/pdds/pdd30_install.pod
branches/pcc_hackathon_6Mar10/docs/project/release_manager_guide.pod
branches/pcc_hackathon_6Mar10/docs/running.pod
branches/pcc_hackathon_6Mar10/ext/Parrot-Embed/Build.PL
branches/pcc_hackathon_6Mar10/ext/Parrot-Embed/lib/Parrot/Embed.xs
branches/pcc_hackathon_6Mar10/ext/Parrot-Embed/t/interp.t
branches/pcc_hackathon_6Mar10/include/parrot/runcore_profiling.h
branches/pcc_hackathon_6Mar10/lib/Parrot/Configure/Options/Conf.pm
branches/pcc_hackathon_6Mar10/lib/Parrot/Configure/Options/Conf/Shared.pm
branches/pcc_hackathon_6Mar10/lib/Parrot/Ops2c/Utils.pm
branches/pcc_hackathon_6Mar10/lib/Parrot/Ops2pm/Base.pm
branches/pcc_hackathon_6Mar10/lib/Parrot/OpsRenumber.pm
branches/pcc_hackathon_6Mar10/runtime/parrot/library/Config/JSON.pir
branches/pcc_hackathon_6Mar10/runtime/parrot/library/distutils.pir
branches/pcc_hackathon_6Mar10/src/debug.c
branches/pcc_hackathon_6Mar10/src/embed.c
branches/pcc_hackathon_6Mar10/src/gc/alloc_resources.c
branches/pcc_hackathon_6Mar10/src/gc/gc_ms.c
branches/pcc_hackathon_6Mar10/src/gc/mark_sweep.c
branches/pcc_hackathon_6Mar10/src/hll.c
branches/pcc_hackathon_6Mar10/src/io/api.c
branches/pcc_hackathon_6Mar10/src/io/socket_api.c
branches/pcc_hackathon_6Mar10/src/main.c
branches/pcc_hackathon_6Mar10/src/multidispatch.c
branches/pcc_hackathon_6Mar10/src/oo.c
branches/pcc_hackathon_6Mar10/src/ops/pmc.ops
branches/pcc_hackathon_6Mar10/src/packfile.c
branches/pcc_hackathon_6Mar10/src/pmc.c
branches/pcc_hackathon_6Mar10/src/pmc/exception.pmc
branches/pcc_hackathon_6Mar10/src/pmc/orderedhash.pmc
branches/pcc_hackathon_6Mar10/src/pmc/parrotinterpreter.pmc
branches/pcc_hackathon_6Mar10/src/pmc/scheduler.pmc
branches/pcc_hackathon_6Mar10/src/runcore/cores.c
branches/pcc_hackathon_6Mar10/src/runcore/profiling.c
branches/pcc_hackathon_6Mar10/t/codingstd/c_parens.t
branches/pcc_hackathon_6Mar10/t/codingstd/pdd_format.t
branches/pcc_hackathon_6Mar10/t/dynpmc/rational.t
branches/pcc_hackathon_6Mar10/t/tools/ops2pm/05-renum_op_map_file.t
branches/pcc_hackathon_6Mar10/tools/dev/branch_status.pl
branches/pcc_hackathon_6Mar10/tools/dev/install_files.pl
Modified: branches/pcc_hackathon_6Mar10/CREDITS
==============================================================================
--- branches/pcc_hackathon_6Mar10/CREDITS Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/CREDITS Sun Mar 21 10:14:48 2010 (r45083)
@@ -573,7 +573,8 @@
D: Getopt/Obj.pir
N: Julian Albo
-U: julianalbo
+U: NotFound
+A: julianalbo
E: julian.notfound at gmail.com
N: Julian Fondren
@@ -767,10 +768,6 @@
N: Nigelsandever
D: Win32 patches
-N: Notfound
-D: Bugfixing and cage cleaning.
-E: julian.notfound at gmail.com
-
N: Nuno 'smash' Carvalho
U: smash
D: PGE/perl6/abc debugging and testing
Modified: branches/pcc_hackathon_6Mar10/DEPRECATED.pod
==============================================================================
--- branches/pcc_hackathon_6Mar10/DEPRECATED.pod Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/DEPRECATED.pod Sun Mar 21 10:14:48 2010 (r45083)
@@ -37,6 +37,12 @@
=over 4
+=item RetContinuation [eligible in 2.4]
+
+In future, just use Continuation.
+
+L<https://trac.parrot.org/parrot/ticket/1427>
+
=item moved to dynpmc [eligible in 1.1]
AddrRegistry, CodeString, Env, Eval, File, OS, PCCMETHOD_Test, StringHandle,
@@ -60,12 +66,6 @@
L<https://trac.parrot.org/parrot/ticket/103>
-=item CPointer PMC [eligible in 2.1]
-
-And all uses in the Parrot calling conventions.
-
-L<https://trac.parrot.org/parrot/ticket/1407>
-
=item Digest dynpmcs [eligible in 2.4]
The digest dynpmcs are, since the posting of this notice, available on
@@ -222,10 +222,6 @@
rename Parrot_string_cstring to Parrot_str_cstring
-=item STRING functions which don't have Parrot_str_ prefix
-
-The string subsytem is gradually getting an overhaul.
-
=back
=head1 Compiler tools
Modified: branches/pcc_hackathon_6Mar10/MANIFEST
==============================================================================
--- branches/pcc_hackathon_6Mar10/MANIFEST Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/MANIFEST Sun Mar 21 10:14:48 2010 (r45083)
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Mon Mar 15 13:04:03 2010 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Fri Mar 19 05:33:57 2010 UT
#
# See below for documentation on the format of this file.
#
@@ -1407,7 +1407,6 @@
src/pmc/complex.pmc [devel]src
src/pmc/continuation.pmc [devel]src
src/pmc/coroutine.pmc [devel]src
-src/pmc/cpointer.pmc [devel]src
src/pmc/default.pmc [devel]src
src/pmc/env.pmc [devel]src
src/pmc/eval.pmc [devel]src
@@ -1874,7 +1873,6 @@
t/pmc/context.t [test]
t/pmc/continuation.t [test]
t/pmc/coroutine.t [test]
-t/pmc/cpointer.t [test]
t/pmc/default.t [test]
t/pmc/env.t [test]
t/pmc/eval.t [test]
Modified: branches/pcc_hackathon_6Mar10/MANIFEST.generated
==============================================================================
--- branches/pcc_hackathon_6Mar10/MANIFEST.generated Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/MANIFEST.generated Sun Mar 21 10:14:48 2010 (r45083)
@@ -121,6 +121,7 @@
runtime/parrot/include/errors.pasm [main]
runtime/parrot/include/except_severity.pasm [main]
runtime/parrot/include/except_types.pasm [main]
+runtime/parrot/include/hash_key_type.pasm [main]
runtime/parrot/include/iglobals.pasm [main]
runtime/parrot/include/interpcores.pasm [main]
runtime/parrot/include/interpdebug.pasm [main]
Modified: branches/pcc_hackathon_6Mar10/NEWS
==============================================================================
--- branches/pcc_hackathon_6Mar10/NEWS Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/NEWS Sun Mar 21 10:14:48 2010 (r45083)
@@ -1,5 +1,19 @@
# $Id$
+New in 2.3.0
+- Features
+- Core
+- Compilers
+- Deprecations
+- API
+- Platforms
+ + Improved handling of new compilers
+- Bugfix
+- Tests
+- Tools
+- Documentation
+- Miscellaneous
+
New in 2.2.0
- Core changes
+ Most internal allocations now use the GC
Modified: branches/pcc_hackathon_6Mar10/compilers/imcc/instructions.c
==============================================================================
--- branches/pcc_hackathon_6Mar10/compilers/imcc/instructions.c Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/compilers/imcc/instructions.c Sun Mar 21 10:14:48 2010 (r45083)
@@ -275,7 +275,7 @@
{
ASSERT_ARGS(instruction_writes)
const int f = ins->flags;
- int i;
+ int j;
/* a get_results opcode occurs after the actual sub call */
if (ins->opnum == PARROT_OP_get_results_pc) {
@@ -332,9 +332,9 @@
return 0;
}
- for (i = 0; i < ins->symreg_count; i++)
- if (f & (1 << (16 + i)))
- if (ins->symregs[i] == r)
+ for (j = 0; j < ins->symreg_count; j++)
+ if (f & (1 << (16 + j)))
+ if (ins->symregs[j] == r)
return 1;
return 0;
Modified: branches/pcc_hackathon_6Mar10/compilers/imcc/pbc.c
==============================================================================
--- branches/pcc_hackathon_6Mar10/compilers/imcc/pbc.c Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/compilers/imcc/pbc.c Sun Mar 21 10:14:48 2010 (r45083)
@@ -1193,7 +1193,6 @@
ASSERT_ARGS(find_outer)
subs_t *s;
PMC *current;
- STRING *cur_name;
char *cur_name_str;
Parrot_Sub_attributes *sub;
size_t len;
@@ -1227,7 +1226,6 @@
unit->outer->name);
PMC_get_sub(interp, current, sub);
- cur_name = sub->name;
cur_name_str = Parrot_str_to_cstring(interp, sub->name);
if (strlen(cur_name_str) == len
Modified: branches/pcc_hackathon_6Mar10/compilers/imcc/symreg.c
==============================================================================
--- branches/pcc_hackathon_6Mar10/compilers/imcc/symreg.c Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/compilers/imcc/symreg.c Sun Mar 21 10:14:48 2010 (r45083)
@@ -860,7 +860,6 @@
int_overflows(ARGIN(const SymReg *r))
{
ASSERT_ARGS(int_overflows)
- INTVAL i;
int base;
const char *digits;
@@ -883,10 +882,10 @@
errno = 0;
if (base == 10) {
- i = strtol(digits, NULL, base);
+ (void)strtol(digits, NULL, base);
}
else {
- i = strtoul(digits + 2, NULL, base);
+ (void)strtoul(digits + 2, NULL, base);
}
return errno ? 1 : 0;
Modified: branches/pcc_hackathon_6Mar10/config/auto/warnings.pm
==============================================================================
--- branches/pcc_hackathon_6Mar10/config/auto/warnings.pm Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/config/auto/warnings.pm Sun Mar 21 10:14:48 2010 (r45083)
@@ -154,7 +154,7 @@
$gcc->{'basic'} = [ @gcc_or_gpp ];
$gpp->{'basic'} = [ @gcc_or_gpp ];
- # Add some gcc only warnings that would break g++
+ # Add some gcc-only warnings that would break g++
push @{$gcc->{'basic'}}, qw(
-Wbad-function-cast
-Wc++-compat
@@ -218,34 +218,38 @@
) ],
};
+ # Warning flags docs
+ # http://software.intel.com/sites/products/documentation/hpc/compilerpro/en-us/cpp/lin/compiler_c/index.htm
+
$icc->{'basic'} = [ qw(
- -wd269
- -wd1572
- -wd1599
- -wd181
- -wd869
- -wd981
- -wd1419
- -wd117
- -wd810
- -wd177
- -wd1296
- -Wall
- -Wcheck
-w2
-Wabi
+ -Wall
+ -Wcheck
-Wcomment
-Wdeprecated
+ -Weffc++
+ -Wextra-tokens
+ -Wformat
+ -Wformat-security
-Wmain
+ -Wmissing-declarations
-Wmissing-prototypes
-Wpointer-arith
+ -Wport
-Wreturn-type
+ -Wshadow
-Wstrict-prototypes
-Wuninitialized
-Wunknown-pragmas
-Wunused-function
-Wunused-variable
- )];
+ -Wwrite-strings
+ ),
+ # Disable some warnings and notifications that are overly noisy
+ '-diag-disable 981', # Operands are evaluated in unspecified order
+ '-diag-disable 2259', # Non-pointer conversion from "typeA" to "typeB" may lose significant bits
+ ];
$data->{'warnings'}{'gcc'} = $gcc;
$data->{'warnings'}{'g++'} = $gpp;
@@ -374,7 +378,7 @@
$verbose and print " output: $output\n";
- if ( $output !~ /error|warning|not supported/i ) {
+ if ( $output !~ /\berror|warning|not supported|ignoring (unknown )?option\b/i ) {
push @{$self->{'validated'}}, $warning;
$verbose and print " valid warning: '$warning'\n";
return 1;
Modified: branches/pcc_hackathon_6Mar10/config/gen/makefiles/root.in
==============================================================================
--- branches/pcc_hackathon_6Mar10/config/gen/makefiles/root.in Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/config/gen/makefiles/root.in Sun Mar 21 10:14:48 2010 (r45083)
@@ -2367,6 +2367,7 @@
--destdir=$(DESTDIR) \
--docdir=$(DOC_DIR) \
--versiondir=$(VERSION_DIR) \
+ --pkgconfigdir=@PKGCONFIG_DIR@ \
MANIFEST MANIFEST.generated
install-dev-only: installable
@@ -2406,6 +2407,8 @@
grep -v DEVELOPING MANIFEST.real > MANIFEST
$(PERL) -lane 'print"parrot-$(VERSION)/$$F[0]"unless!length||/#/' MANIFEST | \
tar -zcv -T - -f parrot-$(VERSION).tar.gz
+ $(PERL) -lane 'print"parrot-$(VERSION)/$$F[0]"unless!length||/#/' \
+ MANIFEST | tar -jcv -T - -f parrot-$(VERSION).tar.bz2
mv MANIFEST.real MANIFEST
rm parrot-$(VERSION)
Modified: branches/pcc_hackathon_6Mar10/config/init/defaults.pm
==============================================================================
--- branches/pcc_hackathon_6Mar10/config/init/defaults.pm Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/config/init/defaults.pm Sun Mar 21 10:14:48 2010 (r45083)
@@ -80,6 +80,7 @@
my $ccdlflags = $Config{ccdlflags};
$ccdlflags =~ s/\s*-Wl,-rpath,\S*//g if $conf->options->get('disable-rpath');
+ my $cc_option = $conf->options->get('cc');
# We need a Glossary somewhere!
$conf->data->set(
debugging => $conf->options->get('debugging') ? 1 : 0,
@@ -92,9 +93,10 @@
# Compiler -- used to turn .c files into object files.
# (Usually cc or cl, or something like that.)
- cc => $Config{cc},
- ccflags => $Config{ccflags},
- ccwarn => exists( $Config{ccwarn} ) ? $Config{ccwarn} : '',
+ cc => $cc_option ? $cc_option : $Config{cc},
+ # If we specify a compiler, we can't use existing ccflags and ccwarn.
+ ccflags => $cc_option ? '' : $Config{ccflags},
+ ccwarn => $cc_option ? '' : $Config{ccwarn},
# Flags used to indicate this object file is to be compiled
# with position-independent code suitable for dynamic loading.
@@ -249,6 +251,8 @@
no_lines_flag => $conf->options->get('no-line-directives') ? '--no-lines' : '',
tempdir => File::Spec->tmpdir,
+
+ PKGCONFIG_DIR => $conf->options->get('pkgconfigdir') || '',
);
# TT #855: Profiling options are too specific to GCC
Modified: branches/pcc_hackathon_6Mar10/config/init/hints.pm
==============================================================================
--- branches/pcc_hackathon_6Mar10/config/init/hints.pm Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/config/init/hints.pm Sun Mar 21 10:14:48 2010 (r45083)
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2003, Parrot Foundation.
+# Copyright (C) 2001-2010, Parrot Foundation.
# $Id$
=head1 NAME
Modified: branches/pcc_hackathon_6Mar10/docs/dev/profiling.pod
==============================================================================
--- branches/pcc_hackathon_6Mar10/docs/dev/profiling.pod Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/docs/dev/profiling.pod Sun Mar 21 10:14:48 2010 (r45083)
@@ -55,6 +55,19 @@
profiling runcore to run more slowly. By default, they are disabled. Set this
value to enable them.
+=item C<PARROT_PROFILING_CANONICAL_OUPUT>
+
+When this is set, the profiling runcore will record all addresses as a single
+constant value and all times as 1. This options is useful primarily for
+testing, where it's helpful to have a way to ensure that a given chunk of code
+will always produce exactly the same profile. If you want this feature
+enabled, you also probably want to pass a fixed hash seed to Parrot via
+C<--hash-seed 1324> to avoid any non-deterministic behavior that hash seed
+randomization may cause.
+
+This variable is not useful apart from testing the profiling runcore and will
+most certainly not help you find hotspots in your code.
+
=back
=cut
Modified: branches/pcc_hackathon_6Mar10/docs/pdds/pdd30_install.pod
==============================================================================
--- branches/pcc_hackathon_6Mar10/docs/pdds/pdd30_install.pod Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/docs/pdds/pdd30_install.pod Sun Mar 21 10:14:48 2010 (r45083)
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2009, Parrot Foundation.
+# Copyright (C) 2008-2010, Parrot Foundation.
# $Id$
=head1 PDD 30: Installation
@@ -7,8 +7,8 @@
This PDD outlines Parrot's installation system and support. Parrot's core
installation system will provide support for binary packages, a working C<make
-install> target, compiled installables, and FHS compliant search paths for the
-installables.
+install> target, compiled installables, and Filesystem Hierarchy Standard
+(FHS) compliant search paths for the installables.
=head2 Version
@@ -33,9 +33,8 @@
=head2 Description
-Parrot uses Filesystem Hierarchy Standard (FHS) compliant install directories
-by default. Each install location is configurable with options passed to the
-configure script.
+Parrot uses FHS compliant install directories by default. Each install
+location is configurable with options passed to the configure script.
=over
@@ -84,7 +83,7 @@
It is recommended that languages follow a standard pattern in installing their
libraries so a bytecode compiled version of a module in the C<mylang> HLL
named C<['Foo';'Bar']> is stored in
-F<usr/lib/parrot/E<lt>versionE<gt>/languages/E<lt>mylangE<gt>/library/Foo/Bar.pbc>
+F</usr/lib/parrot/E<lt>versionE<gt>/languages/E<lt>mylangE<gt>/library/Foo/Bar.pbc>
=item F</usr/lib/parrot/E<lt>versionE<gt>/tools/>
Modified: branches/pcc_hackathon_6Mar10/docs/project/release_manager_guide.pod
==============================================================================
--- branches/pcc_hackathon_6Mar10/docs/project/release_manager_guide.pod Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/docs/project/release_manager_guide.pod Sun Mar 21 10:14:48 2010 (r45083)
@@ -218,9 +218,10 @@
$ mkdir ~/ftp/releases/stable/a.b.c
-Copy the tarball from your machine into the new directory.
+Copy the different compressed tarballs from your machine into the new directory.
- $ scp parrot-a.b.c.tar.gz <USERNAME>@ftp-osl.osuosl.org:~/ftp/releases/devel/a.b.c/.
+ $ scp parrot-a.b.c.tar.gz parrot-a.b.c.tar.bz2 \
+ <USERNAME>@ftp-osl.osuosl.org:~/ftp/releases/devel/a.b.c/.
(Or using C<wget> or whatever tool you prefer.)
Modified: branches/pcc_hackathon_6Mar10/docs/running.pod
==============================================================================
--- branches/pcc_hackathon_6Mar10/docs/running.pod Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/docs/running.pod Sun Mar 21 10:14:48 2010 (r45083)
@@ -142,6 +142,7 @@
debugging GC problems)
switch switch core
trace bounds checking core w/ trace info (see 'parrot --help-debug')
+ profiling see F<docs/dev/profilling.pod>
The C<jit>, C<switch-jit>, and C<cgp-jit> options are currently aliases for the
C<fast>, C<switch>, and C<cgp> options, respectively. We do not recommend
Modified: branches/pcc_hackathon_6Mar10/ext/Parrot-Embed/Build.PL
==============================================================================
--- branches/pcc_hackathon_6Mar10/ext/Parrot-Embed/Build.PL Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/ext/Parrot-Embed/Build.PL Sun Mar 21 10:14:48 2010 (r45083)
@@ -1,3 +1,5 @@
+#! perl
+
use strict;
use warnings;
@@ -14,19 +16,19 @@
diag( my $path_sep = get_path_separator() );
my $class = Module::Build->subclass(
- code => <<"END_HERE",
- use File::Spec;
+ code => <<"END_HERE",
+ use File::Spec;
- sub ACTION_build
- {
- my \$self = shift;
- my \@cmd = ( qw( $parrot -o ),
- map { File::Spec->catfile( 't', "greet.\$_" ) } qw( pbc pir ) );
+ sub ACTION_build
+ {
+ my \$self = shift;
+ my \@cmd = ( qw( $parrot -o ),
+ map { File::Spec->catfile( 't', "greet.\$_" ) } qw( pbc pir ) );
- system( \@cmd ) == 0 or die "Cannot compile PBC for test: \$?";
+ system( \@cmd ) == 0 or die "Cannot compile PBC for test: \$?";
- \$self->SUPER::ACTION_build( \@_ );
- }
+ \$self->SUPER::ACTION_build( \@_ );
+ }
sub ACTION_test
{
@@ -42,27 +44,27 @@
);
my $builder = $class->new(
- module_name => 'Parrot::Embed',
- license => 'perl',
- dist_author => 'chromatic <chromatic at wgz.org>',
- dist_version_from => 'lib/Parrot/Embed.pm',
- build_requires =>
- {
- 'Test::More' => 0,
- 'ExtUtils::CBuilder' => 0,
- },
- add_to_cleanup => [ 'Parrot-Embed-*' ],
+ module_name => 'Parrot::Embed',
+ license => 'perl',
+ dist_author => 'chromatic <chromatic at wgz.org>',
+ dist_version_from => 'lib/Parrot/Embed.pm',
+ build_requires =>
+ {
+ 'Test::More' => 0,
+ 'ExtUtils::CBuilder' => 0,
+ },
+ add_to_cleanup => [ 'Parrot-Embed-*' ],
include_dirs => [ $incp ],
- extra_compiler_flags => $cflags,
- extra_linker_flags => $lflags,
+ extra_compiler_flags => $cflags,
+ extra_linker_flags => $lflags,
);
$builder->create_build_script();
sub in_parrot_tree
{
- my $cwd = cwd();
- return $cwd =~ /\bext\b.Parrot/;
+ my $cwd = cwd();
+ return $cwd =~ /\bext\b.Parrot/;
}
sub get_dl_env_var
@@ -81,46 +83,48 @@
sub get_compiler_flags
{
- my $in_parrot_tree = shift;
- return get_flags_from_parrot_src() if $in_parrot_tree;
- return get_flags_from_pkg_config() if $ENV{PKG_CONFIG_PATH};
+ my $in_parrot_tree = shift;
+ return get_flags_from_parrot_src() if $in_parrot_tree;
+ return get_flags_from_pkg_config() if $ENV{PKG_CONFIG_PATH};
}
sub get_flags_from_pkg_config
{
- require ExtUtils::PkgConfig;
- my %pkg_info = ExtUtils::PkgConfig->find( 'parrot' );
- return @pkg_info{qw( cflags libs )};
+ require ExtUtils::PkgConfig;
+ my %pkg_info = ExtUtils::PkgConfig->find( 'parrot' );
+ return @pkg_info{qw( cflags libs )};
}
sub get_flags_from_parrot_src
{
- my $updir = updir();
- my $file = catfile( $updir, $updir, 'parrot.pc' );
- open( my $fh, '<', $file ) or die "Cannot read $file: $!\n";
-
- my %vars;
- while (<$fh>)
- {
- chomp;
- last unless /\S/;
- my ($var, $value) = split(/=/, $_);
- $vars{$var} = $value;
- }
-
- while (<$fh>)
- {
- chomp;
- last unless /\S/;
- my ($var, $value) = split(/: /, $_);
- $value =~ s/\${(\w+)}/$vars{$1}/g;
- $vars{$var} = $value;
- }
+ my $updir = updir();
+ my $basedir = Cwd::realpath( catdir( cwd(), $updir, $updir ) );
+ my $file = catfile( $basedir, 'parrot.pc' );
+ open( my $fh, '<', $file ) or die "Cannot read $file: $!\n";
+
+ my %vars;
+ while (<$fh>)
+ {
+ chomp;
+ last unless /\S/;
+ }
+
+ $vars{libdir} = catdir( $basedir, 'lib' );
+ $vars{includedir} = catdir( $basedir, 'include' );
+
+ while (<$fh>)
+ {
+ chomp;
+ last unless /\S/;
+ my ($var, $value) = split(/: /, $_);
+ $value =~ s/\${(\w+)}/$vars{$1}/g;
+ $vars{$var} = $value;
+ }
$vars{Cflags} .= ' -I' . catdir( ($updir) x 2, 'include' );
$vars{Libs} .= $^O =~ /Win32/ ? ' ..\..\libparrot.lib' : " -L$libp";
- return @vars{qw( Cflags Libs )};
+ return @vars{qw( Cflags Libs )};
}
sub get_paths
@@ -135,42 +139,42 @@
sub get_parrot_path
{
- my $in_parrot_tree = shift;
- return get_parrot_path_internal() if $in_parrot_tree;
- return get_parrot_path_external();
+ my $in_parrot_tree = shift;
+ return get_parrot_path_internal() if $in_parrot_tree;
+ return get_parrot_path_external();
}
sub get_parrot_path_internal
{
- my $updir = updir();
- my $path = catfile(($updir) x 2, get_parrot_executable_name());
+ my $updir = updir();
+ my $path = catfile(($updir) x 2, get_parrot_executable_name());
- die "parrot apparently not built!\n" unless -e $path;
- return $path;
+ die "parrot apparently not built!\n" unless -e $path;
+ return $path;
}
sub get_parrot_path_external
{
- my $parrot = get_parrot_executable_name();
+ my $parrot = get_parrot_executable_name();
- for my $path ( path() )
- {
- my $file = catfile( $path, $parrot );
- next unless -e $file;
- return $file;
- }
+ for my $path ( path() )
+ {
+ my $file = catfile( $path, $parrot );
+ next unless -e $file;
+ return $file;
+ }
- die "parrot apparently not installed in \$PATH\n";
+ die "parrot apparently not installed in \$PATH\n";
}
sub get_parrot_executable_name
{
- return 'parrot' unless $^O =~ /Win32/;
- return 'parrot.exe';
+ return 'parrot' unless $^O =~ /Win32/;
+ return 'parrot.exe';
}
sub diag
{
- return unless $ENV{PE_DEBUG};
- print STDERR "<$_>\n" for @_;
+ return unless $ENV{PE_DEBUG};
+ print STDERR "<$_>\n" for @_;
}
Modified: branches/pcc_hackathon_6Mar10/ext/Parrot-Embed/lib/Parrot/Embed.xs
==============================================================================
--- branches/pcc_hackathon_6Mar10/ext/Parrot-Embed/lib/Parrot/Embed.xs Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/ext/Parrot-Embed/lib/Parrot/Embed.xs Sun Mar 21 10:14:48 2010 (r45083)
@@ -223,7 +223,7 @@
pmc_actual = pmc->pmc;
interp = get_interp( pmc->interp );
arg_string = Parrot_str_new_constant( interp, argument );
- Parrot_ext_call( interp, pmc_actual, signature, arg_string, &out_pmc );
+ Parrot_pcc_invoke_sub_from_c_args( interp, pmc_actual, signature, arg_string, &out_pmc );
RETVAL = make_pmc( aTHX_ pmc->interp, out_pmc );
OUTPUT:
RETVAL
Modified: branches/pcc_hackathon_6Mar10/ext/Parrot-Embed/t/interp.t
==============================================================================
--- branches/pcc_hackathon_6Mar10/ext/Parrot-Embed/t/interp.t Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/ext/Parrot-Embed/t/interp.t Sun Mar 21 10:14:48 2010 (r45083)
@@ -1,12 +1,12 @@
#!perl
-# Copyright (C) 2006-2009, Parrot Foundation.
+# Copyright (C) 2006-2010, Parrot Foundation.
# $Id$
use strict;
use warnings;
-use Test::More tests => 26;
+use Test::More tests => 23;
use File::Spec;
my $hello_pbc = File::Spec->catfile( 't', 'greet.pbc' );
@@ -45,7 +45,7 @@
'... but again, not if there is no global of that name there' );
can_ok( $global_greet, 'invoke' );
-my $pmc = $global_greet->invoke( 'PS', 'Bob' );
+my $pmc = $global_greet->invoke( 'S->P', 'Bob' );
ok( $pmc, 'invoke() should return a PMC, given that signature' );
is( $pmc->get_string(), 'Hello, Bob!', '... containing a string returned in the PMC' );
@@ -66,19 +66,22 @@
ok( $eval, 'compile() should compile PIR code and return a PMC' );
isa_ok( $eval, 'Parrot::PMC' );
+=cut
TODO:
{
local $TODO = 'compile_string() returns wrong results';
- ok( !$interp->compile('blah'), '... but only for valid PIR' );
+ # ok( !$interp->compile('blah'), '... but only for valid PIR' );
}
-$pmc = $else_greet->invoke( 'P', '' );
+$pmc = $else_greet->invoke( 'S->P', '' );
is( $pmc->get_string(), 'Hiya!', '... calling the passed-in subroutine' );
my $foo = $interp->find_global('foo');
-$pmc = $foo->invoke( 'PS', 'BAR' );
+$pmc = $foo->invoke( 'S->P', 'BAR' );
is( $pmc->get_string(), 'BAR FOO ',
'... and compiled sub should work just like any other Sub pmc' );
+=cut
+my $foo;
{
my $die_interp = $module->new($interp);
@@ -86,7 +89,7 @@
$foo = $die_interp->find_global('greet');
}
-$pmc = $foo->invoke( 'PS', 'out of scope' );
+$pmc = $foo->invoke( 'S->P', 'out of scope' );
is(
$pmc->get_string(),
'Hello, out of scope!',
Modified: branches/pcc_hackathon_6Mar10/include/parrot/runcore_profiling.h
==============================================================================
--- branches/pcc_hackathon_6Mar10/include/parrot/runcore_profiling.h Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/include/parrot/runcore_profiling.h Sun Mar 21 10:14:48 2010 (r45083)
@@ -27,8 +27,8 @@
PROFILING_EXIT_CHECK_FLAG = 1 << 0,
PROFILING_FIRST_LOOP_FLAG = 1 << 1,
PROFILING_HAVE_PRINTED_CLI_FLAG = 1 << 2,
- PROFILING_REPORT_ANNOTATIONS_FLAG = 1 << 3
-
+ PROFILING_REPORT_ANNOTATIONS_FLAG = 1 << 3,
+ PROFILING_CANONICAL_OUTPUT_FLAG = 1 << 4
} Parrot_profiling_flags;
typedef enum Parrot_profiling_line {
@@ -129,6 +129,13 @@
#define Profiling_report_annotations_CLEAR(o) \
Profiling_flag_CLEAR(o, PROFILING_REPORT_ANNOTATIONS_FLAG)
+#define Profiling_canonical_output_TEST(o) \
+ Profiling_flag_TEST(o, PROFILING_CANONICAL_OUTPUT_FLAG)
+#define Profiling_canonical_output_SET(o) \
+ Profiling_flag_SET(o, PROFILING_CANONICAL_OUTPUT_FLAG)
+#define Profiling_canonical_output_CLEAR(o) \
+ Profiling_flag_CLEAR(o, PROFILING_CANONICAL_OUTPUT_FLAG)
+
/* HEADERIZER BEGIN: src/runcore/profiling.c */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
Modified: branches/pcc_hackathon_6Mar10/lib/Parrot/Configure/Options/Conf.pm
==============================================================================
--- branches/pcc_hackathon_6Mar10/lib/Parrot/Configure/Options/Conf.pm Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/lib/Parrot/Configure/Options/Conf.pm Sun Mar 21 10:14:48 2010 (r45083)
@@ -157,6 +157,8 @@
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--infodir=DIR info documentation [PREFIX/info]
--mandir=DIR man documentation [PREFIX/man]
+ --pkgconfigdir=DIR subdirectory of <libdir> for pkgconfig
+ [<libdir>/pkgconfig/<version>]
EOT
return 1;
Modified: branches/pcc_hackathon_6Mar10/lib/Parrot/Configure/Options/Conf/Shared.pm
==============================================================================
--- branches/pcc_hackathon_6Mar10/lib/Parrot/Configure/Options/Conf/Shared.pm Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/lib/Parrot/Configure/Options/Conf/Shared.pm Sun Mar 21 10:14:48 2010 (r45083)
@@ -61,6 +61,7 @@
ops
optimize
parrot_is_shared
+ pkgconfigdir
prefix
profile
sbindir
Modified: branches/pcc_hackathon_6Mar10/lib/Parrot/Ops2c/Utils.pm
==============================================================================
--- branches/pcc_hackathon_6Mar10/lib/Parrot/Ops2c/Utils.pm Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/lib/Parrot/Ops2c/Utils.pm Sun Mar 21 10:14:48 2010 (r45083)
@@ -200,7 +200,7 @@
my ( $op_info, $op_func, $getop );
$op_info = $op_func = 'NULL';
- $getop = '( int (*)(PARROT_INTERP, const char *, int) )NULL';
+ $getop = 'NULL';
if ($self->{suffix} eq '') {
$op_func = $self->{bs} . "op_func_table";
Modified: branches/pcc_hackathon_6Mar10/lib/Parrot/Ops2pm/Base.pm
==============================================================================
--- branches/pcc_hackathon_6Mar10/lib/Parrot/Ops2pm/Base.pm Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/lib/Parrot/Ops2pm/Base.pm Sun Mar 21 10:14:48 2010 (r45083)
@@ -3,6 +3,8 @@
package Parrot::Ops2pm::Base;
use strict;
use warnings;
+use Cwd;
+use File::Spec;
use lib qw ( lib );
use Parrot::OpsFile;
@@ -94,6 +96,9 @@
$argsref->{argv} = \@argv;
$argsref->{num_file} = "src/ops/ops.num";
$argsref->{skip_file} = "src/ops/ops.skip";
+ $argsref->{opsenum_file} = File::Spec->catfile(
+ cwd(), qw( include parrot opsenum.h )
+ );
return bless $argsref, $class;
}
Modified: branches/pcc_hackathon_6Mar10/lib/Parrot/OpsRenumber.pm
==============================================================================
--- branches/pcc_hackathon_6Mar10/lib/Parrot/OpsRenumber.pm Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/lib/Parrot/OpsRenumber.pm Sun Mar 21 10:14:48 2010 (r45083)
@@ -134,7 +134,7 @@
# above the DYNAMIC line. For the purpose of renumbering, we create
# an index $n.
- my $opsenumfn = "include/parrot/opsenum.h";
+ my $opsenumfn = $self->{opsenum_file};
open my $OPSENUM, '>', $opsenumfn or die "Can't open $opsenumfn, error $!";
print $OPSENUM $OPSENUM_PREAMBLE;
open $OP, '>', $file
Modified: branches/pcc_hackathon_6Mar10/runtime/parrot/library/Config/JSON.pir
==============================================================================
--- branches/pcc_hackathon_6Mar10/runtime/parrot/library/Config/JSON.pir Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/runtime/parrot/library/Config/JSON.pir Sun Mar 21 10:14:48 2010 (r45083)
@@ -36,10 +36,11 @@
text = fh.'readall'()
# Convert the text to an object and return it.
- .local pmc json, code, config
- load_bytecode 'compilers/json/JSON.pbc'
- json = compreg 'JSON'
- .tailcall json(text)
+ .local pmc json, code
+ load_language 'data_json'
+ json = compreg 'data_json'
+ code = json.'compile'(text)
+ .tailcall code()
.end
=head2 WriteConfig(config, filename, ?:compact)
@@ -69,7 +70,7 @@
expanded = not compact
# render the object as a string.
- load_bytecode 'JSON.pir'
+ load_bytecode 'JSON.pbc'
.local string output
output = _json( config, expanded )
Modified: branches/pcc_hackathon_6Mar10/runtime/parrot/library/distutils.pir
==============================================================================
--- branches/pcc_hackathon_6Mar10/runtime/parrot/library/distutils.pir Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/runtime/parrot/library/distutils.pir Sun Mar 21 10:14:48 2010 (r45083)
@@ -558,6 +558,8 @@
$I0 = newer(pbc, src)
if $I0 goto L1
L4:
+ $S0 = dirname(pbc)
+ mkpath($S0, 1 :named('verbose'))
.local string cmd
cmd = get_parrot()
cmd .= " -o "
@@ -612,6 +614,8 @@
$I0 = newer(pir, src)
if $I0 goto L1
L4:
+ $S0 = dirname(pir)
+ mkpath($S0, 1 :named('verbose'))
.local string cmd
cmd = get_parrot()
cmd .= " "
@@ -657,6 +661,8 @@
tge = hash[pir]
$I0 = newer(pir, tge)
if $I0 goto L1
+ $S0 = dirname(pir)
+ mkpath($S0, 1 :named('verbose'))
.local string cmd
cmd = get_parrot()
cmd .= " "
@@ -704,6 +710,8 @@
nqp = hash[pir]
$I0 = newer(pir, nqp)
if $I0 goto L1
+ $S0 = dirname(pir)
+ mkpath($S0, 1 :named('verbose'))
.local string cmd
cmd = get_parrot()
cmd .= " "
@@ -754,6 +762,8 @@
nqp = hash[pir]
$I0 = newer(pir, nqp)
if $I0 goto L1
+ $S0 = dirname(pir)
+ mkpath($S0, 1 :named('verbose'))
.local string cmd
cmd = get_nqp()
cmd .= " --target=pir --output="
@@ -795,6 +805,8 @@
srcs = hash[pir]
$I0 = newer(pir, srcs)
if $I0 goto L1
+ $S0 = dirname(pir)
+ mkpath($S0, 1 :named('verbose'))
spew(pir, '', 1 :named('verbose'))
$P1 = iter srcs
L3:
@@ -833,19 +845,21 @@
$P0 = iter hash
L1:
unless $P0 goto L2
- .local string pbc, src
+ .local string pbc
pbc = shift $P0
.local pmc srcs
srcs = hash[pbc]
$I0 = newer(pbc, srcs)
if $I0 goto L1
- src = join ' ', srcs
+ $S0 = dirname(pbc)
+ mkpath($S0, 1 :named('verbose'))
.local string cmd
cmd = get_executable('pbc_merge')
cmd .= " -o "
cmd .= pbc
cmd .= " "
- cmd .= src
+ $S0 = join " ", srcs
+ cmd .= $S0
system(cmd, 1 :named('verbose'))
goto L1
L2:
@@ -1462,6 +1476,8 @@
pod = hash[html]
$I0 = newer(html, pod)
if $I0 goto L1
+ $S0 = dirname(html)
+ mkpath($S0, 1 :named('verbose'))
.local string cmd
cmd = "pod2html --infile "
cmd .= pod
@@ -2216,11 +2232,15 @@
=over 4
-=item inst_bin ???
+=item inst_bin (useful ?)
array of pathname or a single pathname
-=item inst_dynext ???
+=item inst_data
+
+array of pathname or a single pathname
+
+=item inst_dynext (useful ?)
array of pathname or a single pathname
@@ -2303,6 +2323,11 @@
$P0 = kv['inst_lib']
get_install_lib(files, "library", $P0)
L5:
+ $I0 = exists kv['inst_data']
+ unless $I0 goto L6
+ $P0 = kv['inst_data']
+ get_install_data(files, $P0)
+ L6:
.return (files)
.end
@@ -2328,6 +2353,28 @@
L2:
.end
+.sub 'get_install_data' :anon
+ .param pmc files
+ .param pmc array
+ $S1 = get_datadir()
+ $S1 .= "/"
+ $I0 = does array, 'array'
+ if $I0 goto L1
+ $S0 = array
+ $S2 = $S1 . $S0
+ files[$S2] = $S0
+ goto L2
+ L1:
+ $P0 = iter array
+ L3:
+ unless $P0 goto L2
+ $S0 = shift $P0
+ $S2 = $S1 . $S0
+ files[$S2] = $S0
+ goto L3
+ L2:
+.end
+
.sub 'get_install_lib' :anon
.param pmc files
.param string dirname
@@ -2738,7 +2785,7 @@
=item pbc_pir, pir_pge, pir_tge, pir_nqp, pir_nqp-rx, pir_nqprx, pir_pir
pbc_pbc, exe_pbc, installable_pbc, dynops, dynpmc, html_pod
-=item inst_bin, inst_dynext, inst_inc, inst_lang, inst_lib
+=item inst_bin, inst_data, inst_dynext, inst_inc, inst_lang, inst_lib
=item harness_files, prove_files
@@ -2782,7 +2829,7 @@
goto L1
L2:
- $P0 = split ' ', 'inst_bin inst_dynext inst_inc inst_lang inst_lib doc_files'
+ $P0 = split ' ', 'inst_bin inst_data inst_dynext inst_inc inst_lang inst_lib doc_files'
L3:
unless $P0 goto L4
$S0 = shift $P0
@@ -3176,7 +3223,7 @@
=item installable_pbc, dynops, dynpmc
-=item inst_bin, inst_dynext, inst_inc, inst_lang, inst_lib
+=item inst_bin, inst_data, inst_dynext, inst_inc, inst_lang, inst_lib
=item setup
@@ -3419,7 +3466,7 @@
=item installable_pbc, dynops, dynpmc
-=item inst_bin, inst_dynext, inst_inc, inst_lang, inst_lib
+=item inst_bin, inst_data, inst_dynext, inst_inc, inst_lang, inst_lib
=item setup
@@ -3909,7 +3956,7 @@
=item installable_pbc, dynops, dynpmc
-=item inst_bin, inst_dynext, inst_inc, inst_lang, inst_lib
+=item inst_bin, inst_data, inst_dynext, inst_inc, inst_lang, inst_lib
=item doc_files
@@ -4234,6 +4281,16 @@
.return ($S0)
.end
+=item get_datadir
+
+=cut
+
+.sub 'get_datadir'
+ $P0 = get_config()
+ $S0 = $P0['datadir']
+ .return ($S0)
+.end
+
=item get_exe
=cut
Modified: branches/pcc_hackathon_6Mar10/src/debug.c
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/debug.c Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/src/debug.c Sun Mar 21 10:14:48 2010 (r45083)
@@ -966,8 +966,6 @@
PDB_get_command(PARROT_INTERP)
{
ASSERT_ARGS(PDB_get_command)
- unsigned int i;
- int ch;
char *c;
PDB_t * const pdb = interp->pdb;
@@ -987,7 +985,7 @@
PARROT_ASSERT(pdb->cur_command);
if (interp->pdb->script_file) {
- FILE *fd = interp->pdb->script_file;
+ FILE * const fd = interp->pdb->script_file;
char buf[DEBUG_CMD_BUFFER_LENGTH+1];
const char *ptr;
@@ -1022,29 +1020,25 @@
if (pdb->cur_command[0] != '\0')
strcpy(pdb->last_command, pdb->cur_command);
- i = 0;
-
c = pdb->cur_command;
Parrot_io_eprintf(pdb->debugger, "\n");
{
- Interp *interpdeb = interp->pdb->debugger;
- STRING *readline = CONST_STRING(interpdeb, "readline_interactive");
- STRING *prompt = CONST_STRING(interpdeb, "(pdb) ");
- STRING *s = Parrot_str_new(interpdeb, NULL, 0);
- PMC *tmp_stdin = Parrot_io_stdhandle(interpdeb, 0, NULL);
+ Interp * const interpdeb = interp->pdb->debugger;
+ STRING * const readline = CONST_STRING(interpdeb, "readline_interactive");
+ STRING * const prompt = CONST_STRING(interpdeb, "(pdb) ");
+ STRING * const s = Parrot_str_new(interpdeb, NULL, 0);
+ PMC * const tmp_stdin = Parrot_io_stdhandle(interpdeb, 0, NULL);
Parrot_pcc_invoke_method_from_c_args(interpdeb,
tmp_stdin, readline,
- "S->S", prompt, & s);
+ "S->S", prompt, &s);
{
char * const aux = Parrot_str_to_cstring(interpdeb, s);
strcpy(c, aux);
Parrot_str_free_cstring(aux);
}
-
- ch = '\n';
}
}
}
@@ -1302,7 +1296,6 @@
char str[DEBUG_CMD_BUFFER_LENGTH + 1];
unsigned short cond_argleft;
unsigned short cond_type;
- unsigned char regleft;
int i, reg_number;
TRACEDEB_MSG("PDB_cond");
@@ -1322,7 +1315,7 @@
/* get the register number */
auxcmd = ++command;
- regleft = (unsigned char)get_uint(&command, 0);
+ get_uint(&command, 0);
if (auxcmd == command) {
Parrot_io_eprintf(interp->pdb->debugger, "Invalid register\n");
return NULL;
@@ -1953,7 +1946,7 @@
PDB_check_condition(PARROT_INTERP, ARGIN(const PDB_condition_t *condition))
{
ASSERT_ARGS(PDB_check_condition)
- PMC *ctx = CURRENT_CONTEXT(interp);
+ PMC * const ctx = CURRENT_CONTEXT(interp);
TRACEDEB_MSG("PDB_check_condition");
Modified: branches/pcc_hackathon_6Mar10/src/embed.c
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/embed.c Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/src/embed.c Sun Mar 21 10:14:48 2010 (r45083)
@@ -702,7 +702,7 @@
set_current_sub(PARROT_INTERP)
{
ASSERT_ARGS(set_current_sub)
- PMC *sub_pmc;
+ PMC *new_sub_pmc;
PackFile_ByteCode * const cur_cs = interp->code;
PackFile_FixupTable * const ft = cur_cs->fixups;
@@ -739,10 +739,10 @@
/* If we didn't find anything, put a dummy PMC into current_sub.
The default values set by SUb.init are appropiate for the
dummy, don't need additional settings. */
- sub_pmc = Parrot_pmc_new(interp, enum_class_Sub);
- Parrot_pcc_set_sub(interp, CURRENT_CONTEXT(interp), sub_pmc);
+ new_sub_pmc = Parrot_pmc_new(interp, enum_class_Sub);
+ Parrot_pcc_set_sub(interp, CURRENT_CONTEXT(interp), new_sub_pmc);
- return sub_pmc;
+ return new_sub_pmc;
}
Modified: branches/pcc_hackathon_6Mar10/src/gc/alloc_resources.c
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/gc/alloc_resources.c Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/src/gc/alloc_resources.c Sun Mar 21 10:14:48 2010 (r45083)
@@ -632,7 +632,7 @@
=item C<char * aligned_mem(const Buffer *buffer, char *mem)>
Returns a pointer to the aligned allocated storage for Buffer C<buffer>,
-which might not be the same as the pointer to C<buffeR> because of
+which might not be the same as the pointer to C<buffer> because of
memory alignment.
=cut
@@ -680,7 +680,7 @@
aligned_string_size(size_t len)
{
ASSERT_ARGS(aligned_string_size)
- len += sizeof (void*);
+ len += sizeof (void *);
len = (len + WORD_ALIGN_1) & WORD_ALIGN_MASK;
return len;
}
Modified: branches/pcc_hackathon_6Mar10/src/gc/gc_ms.c
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/gc/gc_ms.c Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/src/gc/gc_ms.c Sun Mar 21 10:14:48 2010 (r45083)
@@ -674,7 +674,7 @@
? interp->mem_pools->constant_string_header_pool
: interp->mem_pools->string_header_pool;
- return (STRING*)pool->get_free_object(interp, interp->mem_pools, pool);
+ return (STRING *)pool->get_free_object(interp, interp->mem_pools, pool);
}
@@ -888,9 +888,7 @@
Variable_Size_Pool * const pool = interp->mem_pools->memory_pool;
size_t new_size, needed, old_size;
- /*
- * we don't shrink buffers
- */
+ /* we don't shrink buffers */
if (newsize <= Buffer_buflen(buffer))
return;
Modified: branches/pcc_hackathon_6Mar10/src/gc/mark_sweep.c
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/gc/mark_sweep.c Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/src/gc/mark_sweep.c Sun Mar 21 10:14:48 2010 (r45083)
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2001-2009, Parrot Foundation.
+Copyright (C) 2001-2010, Parrot Foundation.
$Id$
=head1 NAME
Modified: branches/pcc_hackathon_6Mar10/src/hll.c
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/hll.c Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/src/hll.c Sun Mar 21 10:14:48 2010 (r45083)
@@ -217,7 +217,6 @@
{
ASSERT_ARGS(Parrot_register_HLL_lib)
PMC *hll_info = interp->HLL_info;
- PMC *entry, *name;
INTVAL nelements, i;
START_WRITE_HLL_INFO(interp, hll_info);
@@ -229,28 +228,30 @@
PMC * const lib_name = VTABLE_get_pmc_keyed_int(interp, entry, e_HLL_lib);
if (!PMC_IS_NULL(lib_name)) {
- const STRING * const name = VTABLE_get_string(interp, lib_name);
- if (Parrot_str_equal(interp, name, hll_lib))
+ const STRING * const lib_name_str = VTABLE_get_string(interp, lib_name);
+ if (Parrot_str_equal(interp, lib_name_str, hll_lib))
break;
}
}
if (i < nelements)
return i;
+ else {
+ PMC * const new_entry = new_hll_entry(interp, NULL);
+ PMC *name;
- entry = new_hll_entry(interp, NULL);
-
- VTABLE_set_pmc_keyed_int(interp, entry, e_HLL_name, PMCNULL);
+ VTABLE_set_pmc_keyed_int(interp, new_entry, e_HLL_name, PMCNULL);
- /* register dynlib */
- name = Parrot_pmc_new_constant(interp, enum_class_String);
+ /* register dynlib */
+ name = Parrot_pmc_new_constant(interp, enum_class_String);
- VTABLE_set_string_native(interp, name, hll_lib);
- VTABLE_set_pmc_keyed_int(interp, entry, e_HLL_lib, name);
+ VTABLE_set_string_native(interp, name, hll_lib);
+ VTABLE_set_pmc_keyed_int(interp, new_entry, e_HLL_lib, name);
- END_WRITE_HLL_INFO(interp, hll_info);
+ END_WRITE_HLL_INFO(interp, hll_info);
- return 0;
+ return 0;
+ }
}
/*
Modified: branches/pcc_hackathon_6Mar10/src/io/api.c
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/io/api.c Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/src/io/api.c Sun Mar 21 10:14:48 2010 (r45083)
@@ -369,9 +369,8 @@
if (length == 0)
result = Parrot_str_copy(interp, string_orig);
else {
- INTVAL orig_length, read_length;
- read_length = length;
- orig_length = Parrot_str_byte_length(interp, string_orig);
+ INTVAL read_length = length;
+ const INTVAL orig_length = Parrot_str_byte_length(interp, string_orig);
GETATTR_StringHandle_read_offset(interp, pmc, offset);
Modified: branches/pcc_hackathon_6Mar10/src/io/socket_api.c
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/io/socket_api.c Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/src/io/socket_api.c Sun Mar 21 10:14:48 2010 (r45083)
@@ -190,6 +190,7 @@
PIO_F_SOCKET|PIO_F_READ|PIO_F_WRITE);
else
new_socket = socket;
+ /* XXX new_socket is assigned, but never used. Probably a bug? */
return PIO_SOCKET(interp, socket, fam, type, proto);
}
Modified: branches/pcc_hackathon_6Mar10/src/main.c
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/main.c Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/src/main.c Sun Mar 21 10:14:48 2010 (r45083)
@@ -160,6 +160,7 @@
#define OPT_HELP_DEBUG 130
#define OPT_PBC_OUTPUT 131
#define OPT_RUNTIME_PREFIX 132
+#define OPT_HASH_SEED 133
#define SET_FLAG(flag) Parrot_set_flag(interp, (flag))
#define SET_DEBUG(flag) Parrot_set_debug(interp, (flag))
@@ -170,7 +171,7 @@
{ 'D', 'D', OPTION_optional_FLAG, { "--parrot-debug" } },
{ 'E', 'E', (OPTION_flags)0, { "--pre-process-only" } },
{ 'G', 'G', (OPTION_flags)0, { "--no-gc" } },
- { 'H', 'H', OPTION_required_FLAG, { "--hash-seed" } },
+ { '\0', OPT_HASH_SEED, OPTION_required_FLAG, { "--hash-seed" } },
{ 'I', 'I', OPTION_required_FLAG, { "--include" } },
{ 'L', 'L', OPTION_required_FLAG, { "--library" } },
{ 'O', 'O', OPTION_optional_FLAG, { "--optimize" } },
@@ -306,7 +307,7 @@
" -V --version\n"
" -I --include add path to include search\n"
" -L --library add path to library search\n"
- " -H --hash-seed F00F specify hex value to use as hash seed\n"
+ " --hash-seed F00F specify hex value to use as hash seed\n"
" -X --dynext add path to dynamic extension search\n"
" <Run core options>\n"
" -R --runcore slow|bounds|fast|cgoto|cgp\n"
@@ -405,12 +406,23 @@
}
break;
}
- else if (STREQ(arg, "--hash-seed")) {
- ++pos;
- arg = argv[pos];
+ else if (!strncmp(arg, "--hash-seed", 11)) {
+
+ arg = strrchr(arg, '=')+1;
+ if (!arg) {
+ ++pos;
+ arg = argv[pos];
+ }
if (is_all_hex_digits(arg)) {
interp->hash_seed = strtoul(arg, NULL, 16);
}
+ else {
+ fprintf(stderr, "error: invalid hash seed specified:"
+ "'%s'\n", arg);
+ exit(EXIT_FAILURE);
+ }
+ ++pos;
+ arg = argv[pos];
}
++pos;
}
@@ -512,7 +524,7 @@
help();
exit(EXIT_FAILURE);
break;
- case 'H':
+ case OPT_HASH_SEED:
/* handled in parseflags_minimal */
break;
case OPT_HELP_DEBUG:
Modified: branches/pcc_hackathon_6Mar10/src/multidispatch.c
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/multidispatch.c Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/src/multidispatch.c Sun Mar 21 10:14:48 2010 (r45083)
@@ -638,16 +638,23 @@
continue;
/* promote primitives to their PMC equivalents, as PCC will autobox
- * the distance penalty makes primitive variants look cheaper */
+ * them. If it's a direct autobox, int->Integer, str->String, or
+ * num->Num, the distance is 1 and we move to the next arg. If it's
+ * autoboxing to "any" PMC type, we increment the distance and continue
+ * weighing other things. A direct autobox should be cheaper than an
+ * autobox plus type conversion or implicit type acceptance. */
switch (type_call) {
case enum_type_INTVAL:
if (type_sig == enum_class_Integer) { dist++; continue; }
+ if (type_sig == enum_type_PMC) dist++;
break;
case enum_type_FLOATVAL:
if (type_sig == enum_class_Float) { dist++; continue; }
+ if (type_sig == enum_type_PMC) dist++;
break;
case enum_type_STRING:
if (type_sig == enum_class_String) { dist++; continue; }
+ if (type_sig == enum_type_PMC) dist++;
break;
default:
break;
Modified: branches/pcc_hackathon_6Mar10/src/oo.c
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/oo.c Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/src/oo.c Sun Mar 21 10:14:48 2010 (r45083)
@@ -1139,11 +1139,11 @@
/* Otherwise, remove what was accepted from the merge lists. */
for (i = 0; i < list_count; i++) {
- PMC * const list = VTABLE_get_pmc_keyed_int(interp, merge_list, i);
- const INTVAL list_count = VTABLE_elements(interp, list);
+ PMC * const list = VTABLE_get_pmc_keyed_int(interp, merge_list, i);
+ const INTVAL sublist_count = VTABLE_elements(interp, list);
INTVAL j;
- for (j = 0; j < list_count; j++) {
+ for (j = 0; j < sublist_count; j++) {
if (VTABLE_get_pmc_keyed_int(interp, list, j) == accepted) {
VTABLE_delete_keyed_int(interp, list, j);
break;
@@ -1191,7 +1191,7 @@
INTVAL parent_count;
/* Now get immediate parents list. */
- if (!immediate_parents)
+ if (PMC_IS_NULL(immediate_parents))
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_METHOD_NOT_FOUND,
"Failed to get parents list from class!");
Modified: branches/pcc_hackathon_6Mar10/src/ops/pmc.ops
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/ops/pmc.ops Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/src/ops/pmc.ops Sun Mar 21 10:14:48 2010 (r45083)
@@ -240,7 +240,7 @@
VTABLE_get_string(interp, VTABLE_get_class(interp, $2)));
goto ADDRESS(dest);
}
- restart ADDRESS(resume);
+ goto ADDRESS(resume);
}
########################################
Modified: branches/pcc_hackathon_6Mar10/src/packfile.c
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/packfile.c Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/src/packfile.c Sun Mar 21 10:14:48 2010 (r45083)
@@ -4442,9 +4442,8 @@
/* Allocate extra space for the group in the groups array. */
if (self->groups)
- self->groups =
- self->groups = mem_gc_realloc_n_typed_zeroed(interp, self->groups,
- 1 + self->num_groups, self->num_groups, PackFile_Annotations_Group *);
+ self->groups = mem_gc_realloc_n_typed_zeroed(interp, self->groups,
+ 1 + self->num_groups, self->num_groups, PackFile_Annotations_Group *);
else
self->groups = mem_gc_allocate_n_typed(interp,
1 + self->num_groups, PackFile_Annotations_Group *);
Modified: branches/pcc_hackathon_6Mar10/src/pmc.c
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/pmc.c Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/src/pmc.c Sun Mar 21 10:14:48 2010 (r45083)
@@ -582,7 +582,8 @@
PMC *const classobj = interp->vtables[base_type]->pmc_class;
if (!PMC_IS_NULL(classobj) && PObj_is_class_TEST(classobj)) {
- PMC * const initial = Parrot_pmc_new(interp, Parrot_get_ctx_HLL_type(interp, enum_class_Integer));
+ PMC * const initial =
+ Parrot_pmc_new(interp, Parrot_get_ctx_HLL_type(interp, enum_class_Integer));
VTABLE_set_integer_native(interp, initial, init);
VTABLE_instantiate(interp, classobj, initial);
/* XXX Falls through to end of function without returning */
Deleted: branches/pcc_hackathon_6Mar10/src/pmc/cpointer.pmc
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/pmc/cpointer.pmc Sun Mar 21 10:14:48 2010 (r45082)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,511 +0,0 @@
-/*
-Copyright (C) 2008-2009, Parrot Foundation.
-$Id$
-
-=head1 NAME
-
-src/pmc/cpointer.pmc - CPointer
-
-=head1 DESCRIPTION
-
-The CPointer PMC creates a PMC abstraction for a typed C pointer. It is
-particularly used by the C<CallSignature> PMC, for the return values of a
-C-level PCC invocation using a C<CallSignature> to pass the arguments and fetch
-the results.
-
-=head2 Attributes
-
-A CPointer PMC has two attributes:
-
-=over 4
-
-=item pointer
-
-A C<void *> pointer to an integer, number, string, or PMC.
-
-=item sig
-
-A string signature for the pointer. The possible signature values follow the
-standard defined for PCC.
-
- I a Parrot integer (INTVAL)
- N a Parrot number (FLOATVAL)
- S a Parrot string (STRING *)
- P a Parrot object (PMC *)
-
-=back
-
-
-=head2 Vtable Functions
-
-These are the vtable functions for the CPointer class.
-
-=over 4
-
-=cut
-
-*/
-
-pmclass CPointer auto_attrs {
- ATTR void *pointer; /* The stored pointer. */
- ATTR STRING *sig; /* A string signature for the pointer. */
-
-/*
-
-=item C<void init()>
-
-Initializes the pointer object.
-
-=cut
-
-*/
-
- VTABLE void init() {
- SET_ATTR_pointer(INTERP, SELF, NULL);
- SET_ATTR_sig(INTERP, SELF, NULL);
-
- PObj_custom_mark_SET(SELF);
- }
-
-/*
-
-=item C<void mark()>
-
-Marks the signature as live. Also marks a STRING or PMC pointed to by the
-pointer.
-
-=cut
-
-*/
-
- VTABLE void mark() {
- STRING *sig;
- GET_ATTR_sig(INTERP, SELF, sig);
- if (sig) {
- void *pointer;
- GET_ATTR_pointer(INTERP, SELF, pointer);
- Parrot_gc_mark_STRING_alive(interp, sig);
- }
- }
-
-/*
-
-=item C<PMC *clone()>
-
-Creates and returns a clone of the pointer.
-
-=cut
-
-*/
-
- VTABLE PMC *clone() {
- PMC * const dest = Parrot_pmc_new_noinit(INTERP, SELF->vtable->base_type);
- void *ptr;
- STRING *sig;
-
- GET_ATTR_pointer(INTERP, SELF, ptr);
- SET_ATTR_pointer(INTERP, dest, ptr);
-
- GET_ATTR_sig(INTERP, SELF, sig);
- SET_ATTR_sig(INTERP, dest, sig);
-
- PObj_custom_mark_SET(dest);
- return dest;
- }
-
-/*
-
-=item C<void *get_pointer()>
-
-Returns the pointer.
-
-=cut
-
-*/
-
- VTABLE void *get_pointer() {
- Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
- return data->pointer;
- }
-
-/*
-
-=item C<void set_pointer(void *)>
-
-Sets the pointer.
-
-=cut
-
-*/
-
- VTABLE void set_pointer(void *value) {
- Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
- data->pointer = value;
- }
-
-/*
-
-=item C<STRING *get_string_keyed_str(STRING *key)>
-
-Returns the string signature.
-
-=cut
-
-*/
-
- VTABLE STRING *get_string_keyed_str(STRING *key) {
- Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
- UNUSED(key)
-
- return data->sig;
- }
-
-/*
-
-=item C<void set_string_keyed_str(STRING *key, STRING *value)>
-
-Sets the string signature.
-
-=cut
-
-*/
-
- VTABLE void set_string_keyed_str(STRING *key, STRING *value) {
- Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
- UNUSED(key)
-
- data->sig = value;
- }
-
-/*
-
-=item C<INTVAL get_integer()>
-
-Returns the integer value that the pointer points to (if the pointer is to an
-integer or PMC).
-
-=cut
-
-*/
-
- VTABLE INTVAL get_integer() {
- Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
-
- if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "I"))) {
- INTVAL * const int_pointer = (INTVAL *) data->pointer;
- return *int_pointer;
- }
- else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "N"))) {
- FLOATVAL * const num_pointer = (FLOATVAL *) data->pointer;
- return (INTVAL)*num_pointer;
- }
- else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "S"))) {
- STRING ** const str_pointer = (STRING **) data->pointer;
- return Parrot_str_to_int(INTERP, *str_pointer);
- }
- else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "P"))) {
- PMC ** const pmc_pointer = (PMC **) data->pointer;
- return VTABLE_get_integer(INTERP, *pmc_pointer);
- }
- else {
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
- "Unable to fetch value, broken signature!");
- }
- }
-
-/*
-
-=item C<void set_integer_native(INTVAL value)>
-
-Sets the integer value that the pointer points to (if the pointer is to an
-integer or PMC).
-
-=cut
-
-*/
-
- VTABLE void set_integer_native(INTVAL value) {
- Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
-
- if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "I"))) {
- INTVAL * const int_pointer = (INTVAL *) data->pointer;
- *int_pointer = value;
- }
- else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "N"))) {
- FLOATVAL * const num_pointer = (FLOATVAL *) data->pointer;
- *num_pointer = value;
- }
- else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "S"))) {
- STRING ** const str_pointer = (STRING **) data->pointer;
- *str_pointer = Parrot_str_from_int(INTERP, value);
- }
- else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "P"))) {
- PMC ** const pmc_pointer = (PMC **) data->pointer;
- *pmc_pointer = get_integer_pmc(INTERP, value);
- }
- else {
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
- "Unable to set value, broken signature!");
- }
- }
-
-/*
-
-=item C<FLOATVAL get_number()>
-
-Returns the floating point value that the pointer points to (if the pointer is
-to a number or PMC).
-
-=cut
-
-*/
-
- VTABLE FLOATVAL get_number() {
- Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
-
- if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "I"))) {
- INTVAL * const int_pointer = (INTVAL *) data->pointer;
- return (FLOATVAL)*int_pointer;
- }
- else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "N"))) {
- FLOATVAL * const num_pointer = (FLOATVAL *) data->pointer;
- return *num_pointer;
- }
- else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "S"))) {
- STRING ** const str_pointer = (STRING **) data->pointer;
- return Parrot_str_to_num(INTERP, *str_pointer);
- }
- else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "P"))) {
- PMC ** const pmc_pointer = (PMC **) data->pointer;
- return VTABLE_get_number(INTERP, *pmc_pointer);
- }
- else {
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
- "Unable to fetch value, broken signature!");
- }
- }
-
-/*
-
-=item C<void set_number_native(FLOATVAL value)>
-
-Sets the floating point value that the pointer points to (if the pointer is
-to a number or PMC).
-
-=cut
-
-*/
-
- VTABLE void set_number_native(FLOATVAL value) {
- Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
-
- if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "I"))) {
- INTVAL * const int_pointer = (INTVAL *) data->pointer;
- *int_pointer = (INTVAL)value;
- }
- else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "N"))) {
- FLOATVAL * const num_pointer = (FLOATVAL *) data->pointer;
- *num_pointer = value;
- }
- else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "S"))) {
- STRING ** const str_pointer = (STRING **) data->pointer;
- *str_pointer = Parrot_str_from_num(INTERP, value);
- }
- else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "P"))) {
- PMC ** const pmc_pointer = (PMC **) data->pointer;
- *pmc_pointer = get_number_pmc(INTERP, value);
- }
- else {
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
- "Unable to set value, broken signature!");
- }
- }
-
-/*
-
-=item C<STRING *get_string()>
-
-Returns the Parrot string value that the pointer points to (if the pointer is
-to a string or PMC).
-
-=cut
-
-*/
-
- VTABLE STRING *get_string() {
- Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
-
- if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "I"))) {
- INTVAL * const int_pointer = (INTVAL *) data->pointer;
- return Parrot_str_from_int(INTERP, *int_pointer);
- }
- else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "N"))) {
- FLOATVAL * const num_pointer = (FLOATVAL *) data->pointer;
- return Parrot_str_from_num(INTERP, *num_pointer);
- }
- else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "S"))) {
- STRING ** const str_pointer = (STRING **) data->pointer;
- return *str_pointer;
- }
- else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "P"))) {
- PMC ** const pmc_pointer = (PMC **) data->pointer;
- return VTABLE_get_string(INTERP, *pmc_pointer);
- }
- else {
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
- "Unable to fetch value, broken signature!");
- }
- }
-
-/*
-
-=item C<void set_string_native(STRING *value)>
-
-Sets the Parrot string value that the pointer points to (if the pointer is
-to a string or PMC).
-
-=cut
-
-*/
-
- VTABLE void set_string_native(STRING *value) {
- Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
-
- if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "I"))) {
- INTVAL * const int_pointer = (INTVAL *) data->pointer;
- *int_pointer = Parrot_str_to_int(INTERP, value);
- }
- else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "N"))) {
- FLOATVAL * const num_pointer = (FLOATVAL *) data->pointer;
- *num_pointer = Parrot_str_to_num(INTERP, value);
- }
- else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "S"))) {
- STRING ** const str_pointer = (STRING **) data->pointer;
- *str_pointer = value;
- }
- else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "P"))) {
- PMC ** const pmc_pointer = (PMC **) data->pointer;
- *pmc_pointer = get_string_pmc(INTERP, value);
- }
- else {
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
- "Unable to set value, broken signature!");
- }
- }
-
-/*
-
-=item C<PMC *get_pmc()>
-
-Returns the PMC value that the pointer points to (if the pointer is to a PMC).
-
-=cut
-
-*/
-
- VTABLE PMC *get_pmc() {
- const Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
-
- if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "I"))) {
- INTVAL * const int_pointer = (INTVAL *) data->pointer;
- return get_integer_pmc(INTERP, *int_pointer);
- }
- else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "N"))) {
- FLOATVAL * const num_pointer = (FLOATVAL *) data->pointer;
- return get_number_pmc(INTERP, *num_pointer);
- }
- else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "S"))) {
- STRING ** const str_pointer = (STRING **) data->pointer;
- return get_string_pmc(INTERP, *str_pointer);
- }
- else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "P"))) {
- PMC ** const pmc_pointer = (PMC **) data->pointer;
- return *pmc_pointer;
- }
- else {
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
- "Unable to fetch value, broken signature!");
- }
- }
-
-/*
-
-=item C<void set_pmc(PMC *value)>
-
-Sets the PMC value that the pointer points to (if the pointer is to a PMC).
-
-=cut
-
-*/
-
- VTABLE void set_pmc(PMC *value) {
- const Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
-
- if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "I"))) {
- INTVAL * const int_pointer = (INTVAL *) data->pointer;
- *int_pointer = VTABLE_get_integer(INTERP, value);
- }
- else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "N"))) {
- FLOATVAL * const num_pointer = (FLOATVAL *) data->pointer;
- *num_pointer = VTABLE_get_number(INTERP, value);
- }
- else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "S"))) {
- STRING ** const str_pointer = (STRING **) data->pointer;
- *str_pointer = VTABLE_get_string(INTERP, value);
- }
- else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "P"))) {
- PMC ** const pmc_pointer = (PMC **) data->pointer;
- *pmc_pointer = value;
- }
- else {
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
- "Unable to set value, broken signature!");
- }
- }
-
-/*
-
-=item C<INTVAL get_bool()>
-
-Returns whether the pointer is not C<NULL>.
-
-=cut
-
-*/
-
- VTABLE INTVAL get_bool() {
- const Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
- return (INTVAL)(data->pointer != NULL);
- }
-
-/*
-
-=item C<INTVAL is_same(PMC *pmc2)>
-
-Returns whether the pointer has the same value as C<*pmc2>.
-
-=cut
-
-*/
-
- VTABLE INTVAL is_same(PMC *pmc2) {
- const Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
- return (INTVAL)(SELF->vtable == pmc2->vtable &&
- data->pointer == VTABLE_get_pointer(interp, pmc2));
- }
-}
-
-/*
-
-=back
-
-=cut
-
-*/
-
-/*
- * Local variables:
- * c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */
Modified: branches/pcc_hackathon_6Mar10/src/pmc/exception.pmc
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/pmc/exception.pmc Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/src/pmc/exception.pmc Sun Mar 21 10:14:48 2010 (r45083)
@@ -733,7 +733,6 @@
METHOD backtrace() {
PMC *result = PMCNULL;
PMC *resume;
- PMC *cur_ctx;
Parrot_Continuation_attributes *cont;
/* Get starting context, then loop over them. */
@@ -745,6 +744,7 @@
Parrot_pcc_invoke_method_from_c_args(INTERP, cont->to_ctx, CONST_STRING(interp, "backtrace"), "P->P", resume, &result);
}
else {
+ PMC *cur_ctx;
/* No return continuation. Assuming we're being called */
cont = NULL;
GET_ATTR_thrower(interp, SELF, cur_ctx);
Modified: branches/pcc_hackathon_6Mar10/src/pmc/orderedhash.pmc
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/pmc/orderedhash.pmc Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/src/pmc/orderedhash.pmc Sun Mar 21 10:14:48 2010 (r45083)
@@ -382,7 +382,8 @@
}
VTABLE PMC *get_pmc_keyed_str(STRING *key) {
- PMC * const pkey = Parrot_pmc_new(interp, Parrot_get_ctx_HLL_type(interp, enum_class_String));
+ PMC * const pkey =
+ Parrot_pmc_new(interp, Parrot_get_ctx_HLL_type(interp, enum_class_String));
VTABLE_set_string_native(INTERP, pkey, key);
return STATICSELF.get_pmc_keyed(pkey);
}
Modified: branches/pcc_hackathon_6Mar10/src/pmc/parrotinterpreter.pmc
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/pmc/parrotinterpreter.pmc Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/src/pmc/parrotinterpreter.pmc Sun Mar 21 10:14:48 2010 (r45083)
@@ -441,7 +441,7 @@
*/
VTABLE PMC *get_pmc_keyed(PMC *key) {
- PMC *nextkey, *cont;
+ PMC *nextkey;
STRING *outer = NULL;
STRING *item = key_string(interp, key);
STRING *name = CONST_STRING(interp, "globals");
@@ -487,7 +487,7 @@
}
else {
for (; level; --level) {
- cont = Parrot_pcc_get_continuation(interp, ctx);
+ PMC * const cont = Parrot_pcc_get_continuation(interp, ctx);
if (PMC_IS_NULL(cont) || !PARROT_CONTINUATION(cont)->seg)
Parrot_ex_throw_from_c_args(interp, NULL,
@@ -712,7 +712,7 @@
VTABLE void thaw(PMC *info) {
if (!PMC_data(SELF)) {
- Parrot_ParrotInterpreter_attributes *attrs =
+ Parrot_ParrotInterpreter_attributes * const attrs =
mem_gc_allocate_zeroed_typed(INTERP, Parrot_ParrotInterpreter_attributes);
PMC_data(SELF) = attrs;
PObj_custom_destroy_SET(SELF);
@@ -746,22 +746,18 @@
}
if (!PMC_IS_NULL(lib_pmc)) {
- STRING *lib_name = VTABLE_get_string(INTERP, lib_pmc);
- PMC *ignored;
+ STRING * const lib_name = VTABLE_get_string(INTERP, lib_pmc);
if (!STRING_IS_EMPTY(lib_name)) {
- INTVAL id;
- ignored = Parrot_load_lib(INTERP, lib_name, NULL);
- id = Parrot_register_HLL_lib(INTERP, lib_name);
+ PMC * const ignored = Parrot_load_lib(INTERP, lib_name, NULL);
+ const INTVAL id = Parrot_register_HLL_lib(INTERP, lib_name);
UNUSED(id);
}
-
- UNUSED(ignored);
}
if (hll_id >= 0 && !PMC_IS_NULL(typemap)) {
- PMC *iter = VTABLE_get_iter(INTERP, typemap);
- INTVAL e = VTABLE_get_integer(INTERP, typemap);
+ PMC * const iter = VTABLE_get_iter(INTERP, typemap);
+ const INTVAL e = VTABLE_get_integer(INTERP, typemap);
INTVAL i;
for (i = 0; i < e; ++i) {
@@ -792,9 +788,9 @@
*/
METHOD hll_map(PMC *core_type, PMC *hll_type) {
- INTVAL core_type_id = VTABLE_type(INTERP, core_type);
- INTVAL hll_type_id = VTABLE_type(INTERP, hll_type);
- INTVAL hll_id = Parrot_pcc_get_HLL(interp, CURRENT_CONTEXT(interp));
+ const INTVAL core_type_id = VTABLE_type(INTERP, core_type);
+ const INTVAL hll_type_id = VTABLE_type(INTERP, hll_type);
+ const INTVAL hll_id = Parrot_pcc_get_HLL(interp, CURRENT_CONTEXT(interp));
Parrot_register_HLL_type(INTERP, hll_id, core_type_id, hll_type_id);
}
@@ -815,7 +811,7 @@
*/
METHOD stdhandle(INTVAL fileno, PMC *newhandle :optional) {
- PMC * handle = Parrot_io_stdhandle(interp, fileno, newhandle);
+ PMC * const handle = Parrot_io_stdhandle(interp, fileno, newhandle);
RETURN(PMC *handle);
}
Modified: branches/pcc_hackathon_6Mar10/src/pmc/scheduler.pmc
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/pmc/scheduler.pmc Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/src/pmc/scheduler.pmc Sun Mar 21 10:14:48 2010 (r45083)
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2001-2008, Parrot Foundation.
+Copyright (C) 2001-2010, Parrot Foundation.
$Id$
=head1 NAME
@@ -160,7 +160,7 @@
* deleted tasks. */
while (PMC_IS_NULL(task)
&& VTABLE_elements(INTERP, core_struct->task_index) > 0) {
- INTVAL tid = VTABLE_shift_integer(INTERP, core_struct->task_index);
+ const INTVAL tid = VTABLE_shift_integer(INTERP, core_struct->task_index);
if (tid > 0)
task = VTABLE_get_pmc_keyed_int(INTERP,
@@ -198,8 +198,9 @@
*/
VTABLE void delete_keyed_int(INTVAL key) {
- Parrot_Scheduler_attributes *core_struct = PARROT_SCHEDULER(SELF);
- STRING *task_id_str = Parrot_str_from_int(INTERP, key);
+ Parrot_Scheduler_attributes * const core_struct = PARROT_SCHEDULER(SELF);
+ STRING * const task_id_str = Parrot_str_from_int(INTERP, key);
+
VTABLE_delete_keyed_str(INTERP, core_struct->task_list, task_id_str);
SCHEDULER_cache_valid_CLEAR(SELF);
}
@@ -401,8 +402,8 @@
METHOD delete_handler(STRING *type :optional, INTVAL have_type :opt_flag) {
PMC *handlers;
INTVAL elements, index;
- STRING *except_str = CONST_STRING(INTERP, "exception");
- STRING *event_str = CONST_STRING(INTERP, "event");
+ STRING * const except_str = CONST_STRING(INTERP, "exception");
+ STRING * const event_str = CONST_STRING(INTERP, "event");
GET_ATTR_handlers(INTERP, SELF, handlers);
elements = VTABLE_elements(INTERP, handlers);
@@ -412,7 +413,7 @@
/* Loop from newest handler to oldest handler. */
for (index = 0; index < elements; ++index) {
- PMC *handler = VTABLE_get_pmc_keyed_int(INTERP, handlers, index);
+ const PMC * const handler = VTABLE_get_pmc_keyed_int(INTERP, handlers, index);
if (!PMC_IS_NULL(handler)) {
if (Parrot_str_equal(INTERP, type, except_str)
&& handler->vtable->base_type == enum_class_ExceptionHandler) {
@@ -465,11 +466,11 @@
/* Loop from newest handler to oldest handler. */
while (VTABLE_get_bool(interp, iter)) {
- PMC *handler = VTABLE_shift_pmc(INTERP, iter);
+ PMC * const handler = VTABLE_shift_pmc(INTERP, iter);
INTVAL valid_handler = 0;
if (!PMC_IS_NULL(handler)) {
- (INTVAL valid_handler) = PCCINVOKE(INTERP, handler, "can_handle", PMC *task);
+ (const INTVAL valid_handler) = PCCINVOKE(INTERP, handler, "can_handle", PMC *task);
if (valid_handler) {
if (task->vtable->base_type == enum_class_Exception)
VTABLE_set_integer_native(interp, handler, 1);
@@ -509,9 +510,9 @@
RETURN(INTVAL elements);
for (index = 0; index < elements; ++index) {
- PMC *handler = VTABLE_get_pmc_keyed_int(INTERP, handlers, index);
- STRING *exception = CONST_STRING(INTERP, "exception");
- STRING *event = CONST_STRING(INTERP, "event");
+ const PMC * const handler = VTABLE_get_pmc_keyed_int(INTERP, handlers, index);
+ STRING * const exception = CONST_STRING(INTERP, "exception");
+ STRING * const event = CONST_STRING(INTERP, "event");
if (!PMC_IS_NULL(handler)) {
if ((Parrot_str_equal(INTERP, type, exception)
Modified: branches/pcc_hackathon_6Mar10/src/runcore/cores.c
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/runcore/cores.c Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/src/runcore/cores.c Sun Mar 21 10:14:48 2010 (r45083)
@@ -998,10 +998,10 @@
void *pred_func;
opcode_t *pc = interp->code->base.data;
const size_t N = interp->code->base.size;
- size_t i, n_pics;
+ size_t i;
- void **temp = (void **)Parrot_memalign_if_possible(256,
- N * sizeof (void *));
+ void ** const temp =
+ (void **)Parrot_memalign_if_possible(256, N * sizeof (void *));
/* calc and remember pred_offset */
CONTEXT(interp)->pred_offset = pc - (opcode_t *)temp;
@@ -1015,7 +1015,7 @@
interp->op_lib->op_func_table)[CORE_OPS_prederef__];
}
- for (i = n_pics = 0; i < N;) {
+ for (i = 0; i < N;) {
op_info_t * const opinfo = &interp->op_info_table[*pc];
size_t n = opinfo->op_count;
Modified: branches/pcc_hackathon_6Mar10/src/runcore/profiling.c
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/runcore/profiling.c Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/src/runcore/profiling.c Sun Mar 21 10:14:48 2010 (r45083)
@@ -148,7 +148,7 @@
{
ASSERT_ARGS(init_profiling_core)
- char *profile_filename, *output_cstr, *filename_cstr, *annotations_cstr;
+ char *profile_filename, *output_cstr, *filename_cstr;
/* initialize the runcore struct */
runcore->runops = (Parrot_runcore_runops_fn_t) runops_profiling_core;
@@ -227,12 +227,14 @@
}
/* figure out if annotations are wanted */
- annotations_cstr = Parrot_getenv(interp, CONST_STRING(interp, "PARROT_PROFILING_ANNOTATIONS"));
-
- if (annotations_cstr) {
+ if (Parrot_getenv(interp, CONST_STRING(interp, "PARROT_PROFILING_ANNOTATIONS"))) {
Profiling_report_annotations_SET(runcore);
}
+ if (Parrot_getenv(interp, CONST_STRING(interp, "PARROT_PROFILING_CANONICAL_OUTPUT"))) {
+ Profiling_canonical_output_SET(runcore);
+ }
+
/* put profile_filename in the gc root set so it won't get collected */
Parrot_pmc_gc_register(interp, (PMC *) runcore->profile_filename);
@@ -395,8 +397,16 @@
pprof_data[PPROF_DATA_NAMESPACE] = (PPROF_DATA) full_ns_cstr;
pprof_data[PPROF_DATA_FILENAME] = (PPROF_DATA) filename_cstr;
- pprof_data[PPROF_DATA_SUB_ADDR] = (PPROF_DATA) preop_ctx->current_sub;
- pprof_data[PPROF_DATA_CTX_ADDR] = (PPROF_DATA) preop_ctx;
+
+ if (Profiling_canonical_output_TEST(runcore)) {
+ pprof_data[PPROF_DATA_SUB_ADDR] = (PPROF_DATA) 0x3;
+ pprof_data[PPROF_DATA_CTX_ADDR] = (PPROF_DATA) 0x3;
+ }
+ else {
+ pprof_data[PPROF_DATA_SUB_ADDR] = (PPROF_DATA) preop_ctx->current_sub;
+ pprof_data[PPROF_DATA_CTX_ADDR] = (PPROF_DATA) preop_ctx;
+ }
+
runcore->output_fn(runcore, pprof_data, PPROF_LINE_CONTEXT_SWITCH);
Parrot_str_free_cstring(full_ns_cstr);
@@ -443,8 +453,13 @@
}
}
+ if (Profiling_canonical_output_TEST(runcore)) {
+ pprof_data[PPROF_DATA_TIME] = 1;
+ }
+ else {
+ pprof_data[PPROF_DATA_TIME] = op_time;
+ }
pprof_data[PPROF_DATA_LINE] = preop_line;
- pprof_data[PPROF_DATA_TIME] = op_time;
pprof_data[PPROF_DATA_OPNAME] = (PPROF_DATA)(interp->op_info_table)[*preop_pc].name;
runcore->output_fn(runcore, pprof_data, PPROF_LINE_OP);
}
Modified: branches/pcc_hackathon_6Mar10/t/codingstd/c_parens.t
==============================================================================
--- branches/pcc_hackathon_6Mar10/t/codingstd/c_parens.t Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/t/codingstd/c_parens.t Sun Mar 21 10:14:48 2010 (r45083)
@@ -33,7 +33,7 @@
=cut
-my $keywords = join '|' => sort { length $a cmp length $b } qw/
+my $keywords = join '|' => sort { length $a <=> length $b } qw/
auto double int struct INTVAL
break else long switch UINTVAL
case enum register typedef FLOATVAL
Modified: branches/pcc_hackathon_6Mar10/t/codingstd/pdd_format.t
==============================================================================
--- branches/pcc_hackathon_6Mar10/t/codingstd/pdd_format.t Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/t/codingstd/pdd_format.t Sun Mar 21 10:14:48 2010 (r45083)
@@ -7,22 +7,20 @@
use Test::More tests => 1;
use Carp;
-use Cwd;
use Tie::File;
-my $cwd = cwd();
-my @pdddirs = (
- qq{$cwd/docs/pdds},
- qq{$cwd/docs/pdds/draft},
+my @pdddirs = qw(
+ ./docs/pdds
+ ./docs/pdds/draft
);
my @pddfiles = ();
foreach my $dir (@pdddirs) {
- opendir my $DIRH, $dir
- or croak "Unable to open directory handle: $!";
- my @pdds = map { qq|$dir/$_| } grep { m/^pdd\d{2,}_.*\.pod$/ }
- readdir $DIRH;
- closedir $DIRH or croak "Unable to close directory handle: $!";
+ die "Directory '$dir' is not found, or not a directory" if not -d $dir;
+
+ my @pdds = glob "$dir/pdd*.pod"
+ or warn "No PDD files found in directory '$dir'";
+
push @pddfiles, @pdds;
}
@@ -34,20 +32,14 @@
}
}
-my $errmsg = q{};
-if ( @diagnostics ) {
- $errmsg = join ("\n" => @diagnostics) . "\n";
+for my $msg (@diagnostics) {
+ diag($msg);
}
-
-$errmsg ? fail( qq{\n$errmsg} )
- : pass( q{All PDDs are formatted correctly} );
+cmp_ok( scalar(@diagnostics), '==', 0, 'PDDs are formatted correctly' );
sub check_pdd_formatting {
my $pdd = shift;
- my $base = $pdd;
- if ($pdd =~ m{((draft/)?[^/]+)$}) {
- $base = $1;
- }
+
my $diag = q{};
my @toolong = ();
my @sections_needed = qw(
@@ -57,7 +49,7 @@
Implementation
References
);
- my %sections_seen = map { $_, 0 } @sections_needed;
+ my %sections_seen;
my @lines;
tie @lines, 'Tie::File', $pdd
or croak "Unable to tie to $pdd: $!";
@@ -69,20 +61,20 @@
) {
push @toolong, ($i + 1);
}
- foreach my $need ( @sections_needed ) {
- $sections_seen{$need}++ if $lines[$i] =~ m{^=head2\s+$need};
+ if ( $lines[$i] =~ m{^=head2\s+(.+?)\s*$} ) {
+ $sections_seen{$1}++;
}
}
untie @lines or croak "Unable to untie from $pdd: $!";
if ( @toolong ) {
$diag .=
- qq{$base has } .
+ qq{$pdd has } .
scalar(@toolong) .
qq{ lines > 78 chars: @toolong\n};
}
- foreach my $need ( keys %sections_seen ) {
+ foreach my $need (@sections_needed) {
if ( ! $sections_seen{$need} ) {
- $diag .= qq{$base lacks 'head2' $need section\n};
+ $diag .= qq{$pdd lacks 'head2' $need section\n};
}
}
return $diag;
Modified: branches/pcc_hackathon_6Mar10/t/dynpmc/rational.t
==============================================================================
--- branches/pcc_hackathon_6Mar10/t/dynpmc/rational.t Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/t/dynpmc/rational.t Sun Mar 21 10:14:48 2010 (r45083)
@@ -1,15 +1,7 @@
-#! perl
+#! parrot
# Copyright (C) 2008-2010, Parrot Foundation.
# $Id$
-use strict;
-use warnings;
-use lib qw( . lib ../lib ../../lib );
-
-use Test::More;
-use Parrot::Test;
-use Parrot::Config;
-
=head1 NAME
t/dynpmc/rational.t - Rational PMC
@@ -24,210 +16,153 @@
=cut
-if ( $PConfig{gmp} ) { # If GMP is available, we check all functions.
- plan tests => 32;
-}
-else { # If GMP is not available, we only test the constructor and the
- plan tests => 2; # version-method that is used to detect presence of GMP at runtime.
-}
-
-pir_output_is(<<'CODE', <<'OUTPUT', "Initialization");
- .sub main :main
- loadlib $P1, 'rational'
- new $P1, 'Rational'
- say "ok"
- .end
-CODE
-ok
-OUTPUT
-
-if (! $PConfig{gmp}) { # If GMP is not available, this is the last test:
-pir_output_is(<<'CODE', <<'OUTPUT', "version-method");
- .sub main :main
- loadlib $P1, 'rational'
- new $P1, 'Rational'
- $S1 = $P1.'version'()
- say $S1
- .end
-CODE
-0.0.0
-OUTPUT
-exit;
-}
-
-# These tests are only run, if GMP is available.
-pir_output_is(<<'CODE', <<'OUTPUT', "version-method");
- .sub main :main
- loadlib $P1, 'rational'
- new $P1, 'Rational'
- $S1 = $P1.'version'()
- say "ok"
- .end
-CODE
-ok
-OUTPUT
-
-pir_output_is(<<'CODE', <<'OUTPUT', "Set and get native integer");
- .sub main :main
- loadlib $P1, 'rational'
- new $P1, 'Rational'
-
- $I1 = 42
- $P1 = $I1
- $I2 = $P1
-
- say $I2
- .end
-CODE
-42
-OUTPUT
-
-pir_output_is(<<'CODE', <<'OUTPUT', "Set and get native float");
- .sub main :main
- loadlib $P0, 'rational'
- new $P0, 'Rational'
+.sub main :main
+ .include 'test_more.pir'
+ .include 'iglobals.pasm'
+ .local pmc config_hash, interp
+
+ interp = getinterp
+ config_hash = interp[.IGLOBALS_CONFIG_HASH]
+ $S0 = config_hash['gmp']
+
+ unless $S0 goto no_gmp
+ plan(55)
+ goto gmp_tests
+
+ no_gmp:
+ # seems like plan(0) is not supported currently
+ plan(1)
+ ok(1,'GMP not found, skipping Rational tests')
+ .return()
+
+ # The following tests only run if GMP is installed
+ gmp_tests:
+ loadlib $P1, 'rational'
+ test_init()
+ test_version()
+ test_set_get_native_int()
+ test_set_get_native_float()
+ test_set_get_native_string()
+
+ test_set_get_int()
+ test_set_get_float()
+ test_set_get_string()
+
+ test_inc_dec()
+ test_add_int_inplace()
+ test_add_float_inplace()
+
+ test_add_int_pmc_inplace()
+ test_add_float_pmc_inplace()
+ test_add_rats_inplace()
+
+ test_subtract_int()
+ test_subtract_float()
+ test_subtract_int_pmc()
+ test_subtract_rats()
+
+ test_multiply_int()
+ test_multiply_float()
+ test_multiply_int_pmc()
+ test_multiply_float_pmc()
+ test_multiply_rats()
+
+ test_divide_int()
+ test_divide_float()
+ test_divide_int_pmc()
+ test_divide_float_pmc()
+ test_divide_rats()
+
+ test_neg()
+ test_abs()
+ test_cmp()
+ #test_equal_tt1517()
+.end
- $N0 = 11.1
- $P0 = $N0
- $N1 = $P0
+.sub test_neg
+ new $P2, 'Rational'
+ new $P3, 'Rational'
- say $N1
- .end
-CODE
-11.1
-OUTPUT
+ $P2 = "-3/2"
+ $P3 = -$P2
+ $P2 = -$P2
-pir_output_is(<<'CODE', <<'OUTPUT', "Set and get native string");
- .sub main :main
- loadlib $P1, 'rational'
- new $P1, 'Rational'
+ is($P2,'3/2','neg')
+ is($P3,'3/2','neg')
+.end
- $S1 = "7/4"
- $P1 = $S1
- $S2 = $P1
-
- say $S2
- .end
-CODE
-7/4
-OUTPUT
+.sub test_abs
+ new $P2, 'Rational'
+ new $P3, 'Rational'
-pir_output_is(<<'CODE', <<'OUTPUT', "Set and get Integer");
- .sub main :main
- loadlib $P1, 'rational'
- new $P1, 'Rational'
+ $P2 = "-3/2"
+ $P3 = abs $P2
+ abs $P2
+ is($P2,'3/2','abs')
+ is($P3,'3/2','abs')
+.end
- new $P2, 'Integer'
+.sub test_equal_tt1517
+ new $P2, 'Rational'
new $P3, 'Integer'
+ $P2 = "2/1"
+ $P3 = 2
+ if $P2 == $P3 goto pass
+ ok(0,'== on Rational and Integer PMC')
+ .return()
+ pass:
+ ok(1,'== on Rational and Integer PMC')
+.end
- $P2 = 7
- $P1 = $P2
- $P3 = $P1
-
- say $P3
- .end
-CODE
-7
-OUTPUT
-
-pir_output_is(<<'CODE', <<'OUTPUT', "Set and get Float");
- .sub main :main
- loadlib $P1, 'rational'
- new $P1, 'Rational'
-
- new $P2, 'Float'
- new $P3, 'Float'
-
- $P2 = 7.110000
- $P1 = $P2
- $P3 = $P1
-
- say $P3
- .end
-CODE
-7.11
-OUTPUT
-
-pir_output_is(<<'CODE', <<'OUTPUT', "Set and get String");
- .sub main :main
- loadlib $P1, 'rational'
- new $P1, 'Rational'
-
- new $P2, 'String'
- new $P3, 'String'
-
- $P2 = "7/4"
- $P1 = $P2
- $P3 = $P1
-
- say $P3
- .end
-CODE
-7/4
-OUTPUT
+.sub test_cmp
+ new $P2, 'Rational'
+ new $P3, 'Rational'
-pir_output_is(<<'CODE', <<'OUTPUT', "Increment and decrement");
- .sub main :main
- loadlib $P1, 'rational'
- new $P1, 'Rational'
+ $P2 = "3/2"
+ $P3 = "6/4"
- $P1 = "7/4"
- inc $P1
- print $P1
- print "\n"
+ if $P2 == $P3 goto EQ
+ goto NE
+ EQ:
+ ok(1,'== on Rational PMC')
+ goto END_EQ
+ NE:
+ ok(0,'== on Rational PMC')
+ END_EQ:
- dec $P1
- dec $P1
- say $P1
- .end
-CODE
-11/4
-3/4
-OUTPUT
+ $P3 = "7/4"
+ cmp $I1, $P2, $P3
+ cmp $I2, $P3, $P2
+ is($I1,-1,'cmp on Rational PMC')
+ is($I2,1,'cmp on Rational PMC')
+.end
-pir_output_is(<<'CODE', <<'OUTPUT', "Adding integers (+ inplace operation)");
- .sub main :main
- loadlib $P1, 'rational'
+.sub test_divide_int
new $P1, 'Rational'
new $P2, 'Rational'
$I1 = 7
$P1 = "3/2"
- $P2 = $P1 + $I1
- $P1 = $P1 + $I1
- $P1 = $P1 + $I1
-
- say $P1
- say $P2
- .end
-CODE
-31/2
-17/2
-OUTPUT
+ $P2 = $P1 / $I1
+ $P1 = $P1 / $I1
+ is($P1,'3/14','divide int')
+ is($P2,'3/14','divide int')
+.end
-pir_output_is(<<'CODE', <<'OUTPUT', "Adding floats (+ inplace operation)");
- .sub main :main
- loadlib $P1, 'rational'
+.sub test_divide_float
new $P1, 'Rational'
new $P2, 'Rational'
$N1 = 7.
$P1 = "3/2"
- $P2 = $P1 + $N1
- $P1 = $P1 + $N1
- $P1 = $P1 + $N1
+ $P2 = $P1 / $N1
+ $P1 = $P1 / $N1
+ is($P1,'3/14','divide float')
+ is($P2,'3/14','divide float')
- say $P1
- say $P2
- .end
-CODE
-31/2
-17/2
-OUTPUT
+.end
-pir_output_is(<<'CODE', <<'OUTPUT', "Adding Integers (+ inplace operation)");
- .sub main :main
- loadlib $P1, 'rational'
+.sub test_divide_int_pmc
new $P2, 'Rational'
new $P3, 'Rational'
new $P4, 'Integer'
@@ -235,20 +170,13 @@
$P4 = 7
$P2 = "3/2"
- $P3 = $P2 + $P4
- $P2 = $P2 + $P4
-
- say $P2
- say $P3
- .end
-CODE
-17/2
-17/2
-OUTPUT
+ $P3 = $P2 / $P4
+ $P2 = $P2 / $P4
+ is($P2,'3/14','divide Integer PMC')
+ is($P3,'3/14','divide Integer PMC')
+.end
-pir_output_is(<<'CODE', <<'OUTPUT', "Adding Floats (+ inplace operation)");
- .sub main :main
- loadlib $P1, 'rational'
+.sub test_divide_float_pmc
new $P2, 'Rational'
new $P3, 'Rational'
new $P4, 'Float'
@@ -256,20 +184,13 @@
$P4 = 7.
$P2 = "3/2"
- $P3 = $P2 + $P4
- $P2 = $P2 + $P4
-
- say $P2
- say $P3
- .end
-CODE
-17/2
-17/2
-OUTPUT
+ $P3 = $P2 / $P4
+ $P2 = $P2 / $P4
+ is($P2,'3/14','divide Float PMC')
+ is($P3,'3/14','divide Float PMC')
+.end
-pir_output_is(<<'CODE', <<'OUTPUT', "Adding Rationals (+inplace operation)");
- .sub main :main
- loadlib $P1, 'rational'
+.sub test_divide_rats
new $P1, 'Rational'
new $P2, 'Rational'
new $P3, 'Rational'
@@ -277,60 +198,37 @@
$P2 = "3/2"
$P3 = "5/2"
- $P1 = $P2 + $P3
- $P2 = $P2 + $P3
-
- say $P1
- say $P2
- .end
-CODE
-4
-4
-OUTPUT
+ $P1 = $P2 / $P3
+ $P2 = $P2 / $P3
+ is($P1,'3/5','divide Rational PMC')
+ is($P2,'3/5','divide Rational PMC')
+.end
-pir_output_is(<<'CODE', <<'OUTPUT', "Subtracting integers (+ inplace operation)");
- .sub main :main
- loadlib $P1, 'rational'
+.sub test_multiply_int
new $P1, 'Rational'
new $P2, 'Rational'
$I1 = 7
$P1 = "3/2"
- $P2 = $P1 - $I1
- $P1 = $P1 - $I1
- $P1 = $P1 - $I1
-
- say $P1
- say $P2
- .end
-CODE
--25/2
--11/2
-OUTPUT
+ $P2 = $P1 * $I1
+ $P1 = $P1 * $I1
+ is($P1,'21/2','multiply int')
+ is($P2,'21/2','multiply int')
+.end
-pir_output_is(<<'CODE', <<'OUTPUT', "Subtracting floats (+ inplace operation)");
- .sub main :main
- loadlib $P1, 'rational'
+.sub test_multiply_float
new $P1, 'Rational'
new $P2, 'Rational'
$N1 = 7.
$P1 = "3/2"
- $P2 = $P1 - $N1
- $P1 = $P1 - $N1
- $P1 = $P1 - $N1
-
- say $P1
- say $P2
- .end
-CODE
--25/2
--11/2
-OUTPUT
+ $P2 = $P1 * $N1
+ $P1 = $P1 * $N1
+ is($P1,'21/2','multiply float')
+ is($P2,'21/2','multiply float')
+.end
-pir_output_is(<<'CODE', <<'OUTPUT', "Subtracting Integers (+ inplace operation)");
- .sub main :main
- loadlib $P1, 'rational'
+.sub test_multiply_int_pmc
new $P2, 'Rational'
new $P3, 'Rational'
new $P4, 'Integer'
@@ -338,20 +236,13 @@
$P4 = 7
$P2 = "3/2"
- $P3 = $P2 - $P4
- $P2 = $P2 - $P4
-
- say $P2
- say $P3
- .end
-CODE
--11/2
--11/2
-OUTPUT
+ $P3 = $P2 * $P4
+ $P2 = $P2 * $P4
+ is($P2,'21/2','multiply Integer PMC')
+ is($P3,'21/2','multiply Integer PMC')
+.end
-pir_output_is(<<'CODE', <<'OUTPUT', "Subtracting Floats (+ inplace operation)");
- .sub main :main
- loadlib $P1, 'rational'
+.sub test_multiply_float_pmc
new $P2, 'Rational'
new $P3, 'Rational'
new $P4, 'Float'
@@ -359,20 +250,28 @@
$P4 = 7.
$P2 = "3/2"
- $P3 = $P2 - $P4
- $P2 = $P2 - $P4
+ $P3 = $P2 * $P4
+ $P2 = $P2 * $P4
+ is($P2,'21/2','multiply Float PMC')
+ is($P3,'21/2','multiply Float PMC')
- say $P2
- say $P3
- .end
-CODE
--11/2
--11/2
-OUTPUT
+.end
-pir_output_is(<<'CODE', <<'OUTPUT', "Subtracting Rationals (+inplace operation)");
- .sub main :main
- loadlib $P1, 'rational'
+.sub test_multiply_rats
+ new $P1, 'Rational'
+ new $P2, 'Rational'
+ new $P3, 'Rational'
+
+ $P2 = "3/2"
+ $P3 = "5/2"
+
+ $P1 = $P2 * $P3
+ $P2 = $P2 * $P3
+ is($P1,'15/4','multiply Rational PMC')
+ is($P2,'15/4','multiply Rational PMC')
+.end
+
+.sub test_subtract_rats
new $P1, 'Rational'
new $P2, 'Rational'
new $P3, 'Rational'
@@ -382,56 +281,38 @@
$P1 = $P2 - $P3
$P2 = $P2 - $P3
+ is($P1,-1,'subtract Rational inplace')
+ is($P2,-1,'subtract Rational inplace')
- say $P1
- say $P2
- .end
-CODE
--1
--1
-OUTPUT
+.end
-pir_output_is(<<'CODE', <<'OUTPUT', "Multiplying integers (+ inplace operation)");
- .sub main :main
- loadlib $P1, 'rational'
+.sub test_subtract_int
new $P1, 'Rational'
new $P2, 'Rational'
$I1 = 7
$P1 = "3/2"
- $P2 = $P1 * $I1
- $P1 = $P1 * $I1
-
- say $P1
- say $P2
- .end
-CODE
-21/2
-21/2
-OUTPUT
+ $P2 = $P1 - $I1
+ $P1 = $P1 - $I1
+ $P1 = $P1 - $I1
+ is($P1,'-25/2','subtract int inplace')
+ is($P2,'-11/2','subtract int inplace')
+.end
-pir_output_is(<<'CODE', <<'OUTPUT', "Multiplying floats (+ inplace operation)");
- .sub main :main
- loadlib $P1, 'rational'
+.sub test_subtract_float
new $P1, 'Rational'
new $P2, 'Rational'
$N1 = 7.
$P1 = "3/2"
- $P2 = $P1 * $N1
- $P1 = $P1 * $N1
-
- say $P1
- say $P2
- .end
-CODE
-21/2
-21/2
-OUTPUT
+ $P2 = $P1 - $N1
+ $P1 = $P1 - $N1
+ $P1 = $P1 - $N1
+ is($P1,'-25/2','subtract float inplace')
+ is($P2,'-11/2','subtract float inplace')
+.end
-pir_output_is(<<'CODE', <<'OUTPUT', "Multiplying Integers (+ inplace operation)");
- .sub main :main
- loadlib $P1, 'rational'
+.sub test_subtract_int_pmc
new $P2, 'Rational'
new $P3, 'Rational'
new $P4, 'Integer'
@@ -439,229 +320,166 @@
$P4 = 7
$P2 = "3/2"
- $P3 = $P2 * $P4
- $P2 = $P2 * $P4
-
- say $P2
- say $P3
- .end
-CODE
-21/2
-21/2
-OUTPUT
+ $P3 = $P2 - $P4
+ $P2 = $P2 - $P4
+ is($P2,'-11/2','subtract Integer PMC inplace')
+ is($P3,'-11/2','subtract Integer PMC inplace')
+.end
-pir_output_is(<<'CODE', <<'OUTPUT', "Multiplying Floats (+ inplace operation)");
- .sub main :main
- loadlib $P1, 'rational'
+.sub test_add_rats_inplace
+ new $P1, 'Rational'
new $P2, 'Rational'
new $P3, 'Rational'
- new $P4, 'Float'
-
- $P4 = 7.
$P2 = "3/2"
- $P3 = $P2 * $P4
- $P2 = $P2 * $P4
+ $P3 = "5/2"
- say $P2
- say $P3
- .end
-CODE
-21/2
-21/2
-OUTPUT
+ $P1 = $P2 + $P3
+ $P2 = $P2 + $P3
+ is($P1,4,'adding rationals inplace')
+ is($P2,4,'adding rationals inplace')
+.end
-pir_output_is(<<'CODE', <<'OUTPUT', "Multiplying Rationals (+ inplace operation)");
- .sub main :main
- loadlib $P1, 'rational'
- new $P1, 'Rational'
+.sub test_add_int_pmc_inplace
new $P2, 'Rational'
new $P3, 'Rational'
+ new $P4, 'Integer'
+
+ $P4 = 7
$P2 = "3/2"
- $P3 = "5/2"
+ $P3 = $P2 + $P4
+ $P2 = $P2 + $P4
+ is($P2,'17/2','add Integer PMCs inplace')
+ is($P3,'17/2','add Integer PMCs inplace')
+.end
- $P1 = $P2 * $P3
- $P2 = $P2 * $P3
+.sub test_add_float_pmc_inplace
+ new $P2, 'Rational'
+ new $P3, 'Rational'
+ new $P4, 'Float'
- say $P1
- say $P2
- .end
-CODE
-15/4
-15/4
-OUTPUT
+ $P4 = 7.
-pir_output_is(<<'CODE', <<'OUTPUT', "Dividing integers (+ inplace operation)");
- .sub main :main
- loadlib $P1, 'rational'
+ $P2 = "3/2"
+ $P3 = $P2 + $P4
+ $P2 = $P2 + $P4
+ is($P2,'17/2','add Float PMCs inplace')
+ is($P3,'17/2','add Float PMCs inplace')
+.end
+
+.sub test_add_int_inplace
new $P1, 'Rational'
new $P2, 'Rational'
$I1 = 7
$P1 = "3/2"
- $P2 = $P1 / $I1
- $P1 = $P1 / $I1
-
- say $P1
- say $P2
- .end
-CODE
-3/14
-3/14
-OUTPUT
+ $P2 = $P1 + $I1
+ $P1 = $P1 + $I1
+ $P1 = $P1 + $I1
+ is($P1,'31/2','add integers inplace')
+ is($P2,'17/2','add integers inplace')
+.end
-pir_output_is(<<'CODE', <<'OUTPUT', "Dividing floats (+ inplace operation)");
- .sub main :main
- loadlib $P1, 'rational'
+.sub test_add_float_inplace
new $P1, 'Rational'
new $P2, 'Rational'
$N1 = 7.
$P1 = "3/2"
- $P2 = $P1 / $N1
- $P1 = $P1 / $N1
-
- say $P1
- say $P2
- .end
-CODE
-3/14
-3/14
-OUTPUT
-
-pir_output_is(<<'CODE', <<'OUTPUT', "Dividing Integers (+ inplace operation)");
- .sub main :main
- loadlib $P1, 'rational'
- new $P2, 'Rational'
- new $P3, 'Rational'
- new $P4, 'Integer'
-
- $P4 = 7
-
- $P2 = "3/2"
- $P3 = $P2 / $P4
- $P2 = $P2 / $P4
+ $P2 = $P1 + $N1
+ $P1 = $P1 + $N1
+ $P1 = $P1 + $N1
+ is($P1,'31/2','add floats inplace')
+ is($P2,'17/2','add floats inplace')
+.end
- say $P2
- say $P3
- .end
-CODE
-3/14
-3/14
-OUTPUT
-pir_output_is(<<'CODE', <<'OUTPUT', "Dividing Floats (+ inplace operation)");
- .sub main :main
- loadlib $P1, 'rational'
- new $P2, 'Rational'
- new $P3, 'Rational'
- new $P4, 'Float'
+.sub test_init
+ new $P1, 'Rational'
+ ok($P1,'initialization')
+.end
- $P4 = 7.
+.sub test_version
+ new $P1, 'Rational'
+ $S1 = $P1.'version'()
+ ok($S1,'can get version number')
+.end
- $P2 = "3/2"
- $P3 = $P2 / $P4
- $P2 = $P2 / $P4
+.sub test_set_get_native_int
+ new $P1, 'Rational'
- say $P2
- say $P3
- .end
-CODE
-3/14
-3/14
-OUTPUT
+ $I1 = 42
+ $P1 = $I1
+ $I2 = $P1
+ is($I2,42,'set and get native int')
+.end
-pir_output_is(<<'CODE', <<'OUTPUT', "Dividing Rationals (+ inplace operation)");
- .sub main :main
- loadlib $P1, 'rational'
+.sub test_set_get_int
new $P1, 'Rational'
- new $P2, 'Rational'
- new $P3, 'Rational'
-
- $P2 = "3/2"
- $P3 = "5/2"
+ new $P2, 'Integer'
+ new $P3, 'Integer'
- $P1 = $P2 / $P3
- $P2 = $P2 / $P3
+ $P2 = 7
+ $P1 = $P2
+ $P3 = $P1
+ is($P3,7,'set and get int')
+.end
- say $P1
- say $P2
- .end
-CODE
-3/5
-3/5
-OUTPUT
-pir_output_is(<<'CODE', <<'OUTPUT', "Negating (+inplace operation)");
- .sub main :main
- loadlib $P1, 'rational'
- new $P2, 'Rational'
- new $P3, 'Rational'
+.sub test_set_get_float
+ new $P1, 'Rational'
- $P2 = "-3/2"
- $P3 = -$P2
- $P2 = -$P2
+ new $P2, 'Float'
+ new $P3, 'Float'
- say $P2
- say $P3
- .end
-CODE
-3/2
-3/2
-OUTPUT
+ $P2 = 7.110000
+ $P1 = $P2
+ $P3 = $P1
+ is($P3,7.11,'set and set float',0.0001)
+.end
-pir_output_is(<<'CODE', <<'OUTPUT', "Absolute value (+inplace operation)");
- .sub main :main
- loadlib $P1, 'rational'
- new $P2, 'Rational'
- new $P3, 'Rational'
+.sub test_inc_dec
+ new $P1, 'Rational'
- $P2 = "-3/2"
- $P3 = abs $P2
- abs $P2
+ $P1 = "7/4"
+ inc $P1
+ is($P1,'11/4','increment a rational')
+ dec $P1
+ dec $P1
+ is($P1,'3/4','decrement a rational')
+.end
- say $P2
- say $P3
- .end
-CODE
-3/2
-3/2
-OUTPUT
+.sub test_set_get_string
+ new $P1, 'Rational'
+ new $P2, 'String'
+ new $P3, 'String'
-pir_output_is(<<'CODE', <<'OUTPUT', "Comparing rationals to rationals");
- .sub main :main
- loadlib $P1, 'rational'
- new $P2, 'Rational'
- new $P3, 'Rational'
+ $P2 = "7/4"
+ $P1 = $P2
+ $P3 = $P1
+ is($P3,"7/4",'set and get string')
+.end
- $P2 = "3/2"
- $P3 = "6/4"
+.sub test_set_get_native_float
+ new $P0, 'Rational'
- if $P2 == $P3 goto EQ
- goto NE
- EQ:
- say "1"
- goto END_EQ
- NE:
- say "0"
- END_EQ:
+ $N0 = 11.1
+ $P0 = $N0
+ $N1 = $P0
+ is($N1,11.1,'set and get a native float')
+.end
- $P3 = "7/4"
- cmp $I1, $P2, $P3
- cmp $I2, $P3, $P2
+.sub test_set_get_native_string
+ new $P1, 'Rational'
- say $I1
- say $I2
- .end
-CODE
-1
--1
-1
-OUTPUT
+ $S1 = "7/4"
+ $P1 = $S1
+ $S2 = $P1
+ is($S2,'7/4','set and get native string')
+.end
# Local Variables:
-# mode: cperl
-# cperl-indent-level: 4
+# mode: pir
# fill-column: 100
# End:
-# vim: expandtab shiftwidth=4:
+# vim: expandtab shiftwidth=4 ft=pir:
Deleted: branches/pcc_hackathon_6Mar10/t/pmc/cpointer.t
==============================================================================
--- branches/pcc_hackathon_6Mar10/t/pmc/cpointer.t Sun Mar 21 10:14:48 2010 (r45082)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,37 +0,0 @@
-#! parrot
-# Copyright (C) 2006-2008, Parrot Foundation.
-# $Id$
-
-=head1 NAME
-
-t/pmc/cpointer.t - test CPointer PMC
-
-=head1 SYNOPSIS
-
- % prove t/pmc/cpointer.t
-
-=head1 DESCRIPTION
-
-Tests the CPointer PMC.
-
-=cut
-
-.sub main :main
- .include 'test_more.pir'
-
- plan(1)
-
- instantiate()
-.end
-
-
-.sub instantiate
- $P0 = new ['CPointer']
- ok(1, 'Instantiated CPointer')
-.end
-
-# Local Variables:
-# mode: pir
-# fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:
Modified: branches/pcc_hackathon_6Mar10/t/tools/ops2pm/05-renum_op_map_file.t
==============================================================================
--- branches/pcc_hackathon_6Mar10/t/tools/ops2pm/05-renum_op_map_file.t Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/t/tools/ops2pm/05-renum_op_map_file.t Sun Mar 21 10:14:48 2010 (r45083)
@@ -33,6 +33,8 @@
chdir $tdir or croak "Unable to change to testing directory: $!";
my $opsdir = File::Spec->catdir ( $tdir, 'src', 'ops' );
mkpath( [ $opsdir ], 0, 0755 ) or croak "Unable to make testing directory";
+ my $incpardir = File::Spec->catdir ( $tdir, 'include', 'parrot' );
+ mkpath( [ $incpardir ], 0, 0755 ) or croak "Unable to make testing directory";
##### Stage 1: Generate ops.num de novo #####
Modified: branches/pcc_hackathon_6Mar10/tools/dev/branch_status.pl
==============================================================================
--- branches/pcc_hackathon_6Mar10/tools/dev/branch_status.pl Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/tools/dev/branch_status.pl Sun Mar 21 10:14:48 2010 (r45083)
@@ -43,7 +43,7 @@
Branch Revisions Creator Authors Created
Updated Components Commits LastMergeRev
));
-}
+}
foreach my $branch (@branches) {
Modified: branches/pcc_hackathon_6Mar10/tools/dev/install_files.pl
==============================================================================
--- branches/pcc_hackathon_6Mar10/tools/dev/install_files.pl Sun Mar 21 09:39:49 2010 (r45082)
+++ branches/pcc_hackathon_6Mar10/tools/dev/install_files.pl Sun Mar 21 10:14:48 2010 (r45083)
@@ -159,9 +159,11 @@
my($filehash) = @_;
# For the time being this is hardcoded as being installed under
# libdir as it is typically done with automake installed packages.
- # If there is a use case to make this configurable we'll add a
- # seperate --pkgconfigdir option.
+ # If the --pkgconfigdir option is used, then the default value will
+ # be overwritten with the specified subdirectory under libdir.
$filehash->{DestDirs} = ['pkgconfig', $parrotdir];
+ $filehash->{DestDirs} = [$options{pkgconfigdir}]
+ if $options{pkgconfigdir};
return($filehash);
},
},
More information about the parrot-commits
mailing list