[svn:parrot] r46871 - in branches/ops_pct: . editor ext/nqp-rx/src/stage0 t/library tools/util
bacek at svn.parrot.org
bacek at svn.parrot.org
Sat May 22 01:54:20 UTC 2010
Author: bacek
Date: Sat May 22 01:54:19 2010
New Revision: 46871
URL: https://trac.parrot.org/parrot/changeset/46871
Log:
Resync with trunk manually.
Added:
branches/ops_pct/editor/mk_skeleton.pir
branches/ops_pct/t/library/test_builder_done_testing.t
branches/ops_pct/tools/util/inc_ver.pir
Modified:
branches/ops_pct/MANIFEST.generated
branches/ops_pct/ext/nqp-rx/src/stage0/Regex-s0.pir
branches/ops_pct/ext/nqp-rx/src/stage0/nqp-setting.nqp
Modified: branches/ops_pct/MANIFEST.generated
==============================================================================
--- branches/ops_pct/MANIFEST.generated Sat May 22 01:52:55 2010 (r46870)
+++ branches/ops_pct/MANIFEST.generated Sat May 22 01:54:19 2010 (r46871)
@@ -146,7 +146,6 @@
installable_pbc_merge.exe [main]bin
installable_pbc_to_exe [main]bin
installable_pbc_to_exe.exe [main]bin
-installable_tapir.exe [main]bin
lib/Parrot/Config/Generated.pm [devel]lib
lib/Parrot/PMC.pm [devel]lib
lib/Parrot/Pmc2c/PCCMETHOD_BITS.pm [devel]lib
Added: branches/ops_pct/editor/mk_skeleton.pir
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/ops_pct/editor/mk_skeleton.pir Sat May 22 01:54:19 2010 (r46871)
@@ -0,0 +1,38 @@
+# Copyright (C) 2010, Parrot Foundation.
+# $Id$
+
+# Generate a skeleton PIR file that adheres to parrot developer standards.
+# intended for people who hack on parrot itself, not users of parrot.
+
+.include 'tm.pasm'
+
+.sub 'main' :main
+ .local pmc timeArray
+ .local int epoch, year
+ epoch = time
+ timeArray = decodetime epoch
+ year = timeArray[.TM_YEAR]
+
+ # split up to avoid various svn/codingstd issues.
+ print '# Copyright (C) '
+ print year
+ say ' Parrot Foundation.'
+ print '# $'
+ say 'Id: $'
+ say ''
+ say ".sub 'main' :main"
+ say ' # For Parrot developers.'
+ say '.end'
+ say ''
+ say '# Local Variables:'
+ say '# mode: pir'
+ say '# fill-column: 100'
+ say '# End:'
+ say '# vim: expandtab shiftwidth=4 ft=pir:'
+.end
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
Modified: branches/ops_pct/ext/nqp-rx/src/stage0/Regex-s0.pir
==============================================================================
--- branches/ops_pct/ext/nqp-rx/src/stage0/Regex-s0.pir Sat May 22 01:52:55 2010 (r46870)
+++ branches/ops_pct/ext/nqp-rx/src/stage0/Regex-s0.pir Sat May 22 01:54:19 2010 (r46871)
@@ -1921,7 +1921,7 @@
# vim: expandtab shiftwidth=4 ft=pir:
### .include 'src/PAST/Regex.pir'
-# $Id$
+# $Id: Regex.pir 41578 2009-09-30 14:45:23Z pmichaud $
=head1 NAME
Modified: branches/ops_pct/ext/nqp-rx/src/stage0/nqp-setting.nqp
==============================================================================
--- branches/ops_pct/ext/nqp-rx/src/stage0/nqp-setting.nqp Sat May 22 01:52:55 2010 (r46870)
+++ branches/ops_pct/ext/nqp-rx/src/stage0/nqp-setting.nqp Sat May 22 01:54:19 2010 (r46871)
@@ -1,5 +1,6 @@
+#! nqp
-# This file automatically generated by build/gen_setting.pl.
+# This file automatically generated by build/gen_setting.pl in the nqp-rx project.
# From src/setting/ResizablePMCArray.pm
@@ -49,9 +50,9 @@
}
-sub join ($separator, *@values) { @values.join($separator); }
-sub map (&code, *@values) { @values.map(&code); }
-sub list (*@values) { @values; }
+our sub join ($separator, *@values) { @values.join($separator); }
+our sub map (&code, *@values) { @values.map(&code); }
+our sub list (*@values) { @values; }
# vim: ft=perl6
# From src/setting/Hash.pm
@@ -133,7 +134,7 @@
Construct a hash from named arguments.
=end item
-sub hash(*%h) { %h }
+our sub hash(*%h) { %h }
# vim: ft=perl6
# From src/setting/Regex.pm
@@ -151,7 +152,7 @@
given, then return an array of all non-overlapping matches.
=end item
-sub match ($text, $regex, :$global?) {
+our sub match ($text, $regex, :$global?) {
my $match := $text ~~ $regex;
if $global {
my @matches;
@@ -173,26 +174,25 @@
perform the replacement on all matches of C<$text>.
=end item
-sub subst ($text, $regex, $repl, :$global?) {
+our sub subst ($text, $regex, $repl, :$global?) {
my @matches := $global ?? match($text, $regex, :global)
!! [ $text ~~ $regex ];
my $is_code := pir::isa($repl, 'Sub');
my $offset := 0;
- my @pieces;
+ my $result := pir::new__Ps('StringBuilder');
for @matches -> $match {
- my $repl_string := $is_code ?? $repl($match) !! $repl;
- @pieces.push( pir::substr($text, $offset, $match.from - $offset))
+ pir::push($result, pir::substr($text, $offset, $match.from - $offset))
if $match.from > $offset;
- @pieces.push($repl_string);
+ pir::push($result, $is_code ?? $repl($match) !! $repl);
$offset := $match.to;
}
my $chars := pir::length($text);
- @pieces.push(pir::substr($text, $offset, $chars))
+ pir::push($result, pir::substr($text, $offset, $chars))
if $chars > $offset;
- @pieces.join('');
+ ~$result;
}
# vim: ft=perl6
@@ -210,7 +210,7 @@
Returns the contents of C<$filename> as a single string.
=end
-sub slurp ($filename) {
+our sub slurp ($filename) {
my $handle := pir::open__Pss($file, 'r');
my $contents := $handle.readall;
pir::close($handle);
@@ -222,7 +222,7 @@
Write the string value of C<$contents> to C<$filename>.
=end item
-sub spew($filename, $contents) {
+our sub spew($filename, $contents) {
my $handle := pir::open__Pss($filename, 'w');
$handle.print($contents);
pir::close($handle);
Added: branches/ops_pct/t/library/test_builder_done_testing.t
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/ops_pct/t/library/test_builder_done_testing.t Sat May 22 01:54:19 2010 (r46871)
@@ -0,0 +1,53 @@
+#!./parrot
+# Copyright (C) 2005-2008, Parrot Foundation.
+# $Id$
+
+.sub _main :main
+ load_bytecode 'Test/Builder/Tester.pbc'
+
+ .local pmc tb_args
+ tb_args = new 'Hash'
+
+ .local pmc test
+ test = new [ 'Test'; 'Builder' ], tb_args
+
+ .local pmc plan
+ .local pmc test_pass
+ .local pmc test_fail
+ .local pmc test_out
+ .local pmc test_diag
+ .local pmc test_test
+ plan = get_global [ 'Test'; 'Builder'; 'Tester' ], 'plan'
+ test_pass = get_global [ 'Test'; 'Builder'; 'Tester' ], 'test_pass'
+ test_fail = get_global [ 'Test'; 'Builder'; 'Tester' ], 'test_fail'
+ test_out = get_global [ 'Test'; 'Builder'; 'Tester' ], 'test_out'
+ test_diag = get_global [ 'Test'; 'Builder'; 'Tester' ], 'test_diag'
+ test_test = get_global [ 'Test'; 'Builder'; 'Tester' ], 'test_test'
+
+ plan( 4 )
+
+ test_out( 'ok 1 - hi' )
+ test.'ok'( 1, 'hi' )
+ test_test( 'passing test')
+
+ test_out( 'not ok 2 - bye' )
+ test.'ok'( 0, 'bye' )
+ test_test( 'failing test')
+
+ test_out( "\n1..2" )
+ test.'done_testing'()
+ test_test( 'Simple done_testing works' )
+
+ test_out( "1..3" )
+ test_out( "Expected 3 but ran 2" )
+ test.'done_testing'(3)
+ test_test( 'done_testing with bad plan works' )
+
+ test.'finish'()
+.end
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
Added: branches/ops_pct/tools/util/inc_ver.pir
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/ops_pct/tools/util/inc_ver.pir Sat May 22 01:54:19 2010 (r46871)
@@ -0,0 +1,45 @@
+#!/usr/bin/env parrot
+# Copyright (C) 2010, Parrot Foundation.
+# $Id$
+
+.sub 'main' :main
+ .local string version_file_name
+ version_file_name = 'VERSION'
+ # read the version
+ $P0 = open version_file_name, 'r'
+ $S0 = readline $P0
+ close $P0
+
+ print 'version: '
+ print $S0
+
+ # split the version
+ $P0 = split '.', $S0
+
+ # increment version
+ $I0 = $P0[1]
+ inc $I0
+ if $I0 != 12 goto NOT_NILL
+ $I0 = $P0[0]
+ inc $I0
+ $P0[0] = $I0
+ $I0 = 0
+NOT_NILL:
+ $P0[1] = $I0
+
+ # join the version
+ $S0 = join '.', $P0
+
+ print 'new version: '
+ print $S0
+
+ $P0 = open version_file_name, 'w'
+ print $P0, $S0
+ close $P0
+.end
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
More information about the parrot-commits
mailing list