[svn:parrot] r40561 - in branches/auto_attrs: . compilers/tge config/auto/sizes docs/book/draft docs/book/pct docs/dev docs/pdds docs/user/pir editor examples/benchmarks examples/embed examples/languages/abc examples/languages/squaak examples/opengl examples/pge examples/pir/befunge examples/sdl/tetris include/parrot lib/Parrot/Docs/Section ports/cpan ports/cygwin ports/debian ports/fedora ports/mandriva ports/suse runtime/parrot/languages runtime/parrot/library/Math src/call src/dynoplibs src/dynpmc src/gc src/interp src/pmc src/runcore t/compilers/tge t/dynoplibs t/native_pbc t/oo t/op t/pmc t/src tools/dev tools/util
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Sat Aug 15 12:05:32 UTC 2009
Author: NotFound
Date: Sat Aug 15 12:05:28 2009
New Revision: 40561
URL: https://trac.parrot.org/parrot/changeset/40561
Log:
merge from trunk r40560
Added:
branches/auto_attrs/examples/benchmarks/rand.pir
- copied unchanged from r40560, trunk/examples/benchmarks/rand.pir
branches/auto_attrs/ports/fedora/parrot-1.x.0.patch
- copied unchanged from r40560, trunk/ports/fedora/parrot-1.x.0.patch
Deleted:
branches/auto_attrs/src/pmc/random.pmc
branches/auto_attrs/t/pmc/random.t
Modified:
branches/auto_attrs/ (props changed)
branches/auto_attrs/DEPRECATED.pod
branches/auto_attrs/MANIFEST
branches/auto_attrs/PBC_COMPAT
branches/auto_attrs/compilers/tge/TGE.pir
branches/auto_attrs/config/auto/sizes/intval_maxmin_c.in (props changed)
branches/auto_attrs/docs/book/draft/README (props changed)
branches/auto_attrs/docs/book/draft/appa_glossary.pod (props changed)
branches/auto_attrs/docs/book/draft/appb_patch_submission.pod (props changed)
branches/auto_attrs/docs/book/draft/appc_command_line_options.pod (props changed)
branches/auto_attrs/docs/book/draft/appd_build_options.pod (props changed)
branches/auto_attrs/docs/book/draft/appe_source_code.pod (props changed)
branches/auto_attrs/docs/book/draft/ch01_introduction.pod (props changed)
branches/auto_attrs/docs/book/draft/ch02_getting_started.pod (props changed)
branches/auto_attrs/docs/book/draft/ch07_dynpmcs.pod (props changed)
branches/auto_attrs/docs/book/draft/ch08_dynops.pod (props changed)
branches/auto_attrs/docs/book/draft/ch10_opcode_reference.pod (props changed)
branches/auto_attrs/docs/book/draft/ch11_directive_reference.pod (props changed)
branches/auto_attrs/docs/book/draft/ch12_operator_reference.pod (props changed)
branches/auto_attrs/docs/book/draft/chXX_hlls.pod (props changed)
branches/auto_attrs/docs/book/draft/chXX_library.pod (props changed)
branches/auto_attrs/docs/book/draft/chXX_testing_and_debugging.pod (props changed)
branches/auto_attrs/docs/book/pct/ch01_introduction.pod (props changed)
branches/auto_attrs/docs/book/pct/ch02_getting_started.pod (props changed)
branches/auto_attrs/docs/book/pct/ch03_compiler_tools.pod (contents, props changed)
branches/auto_attrs/docs/book/pct/ch04_pge.pod (props changed)
branches/auto_attrs/docs/book/pct/ch05_nqp.pod (contents, props changed)
branches/auto_attrs/docs/dev/c_functions.pod (props changed)
branches/auto_attrs/docs/pdds/pdd17_pmc.pod
branches/auto_attrs/docs/pdds/pdd30_install.pod (props changed)
branches/auto_attrs/docs/user/pir/pmcs.pod
branches/auto_attrs/editor/pir-mode.el
branches/auto_attrs/examples/embed/cotorra.c (props changed)
branches/auto_attrs/examples/languages/abc/ (props changed)
branches/auto_attrs/examples/languages/squaak/ (props changed)
branches/auto_attrs/examples/opengl/shapes.pir
branches/auto_attrs/examples/pge/demo.pir (props changed)
branches/auto_attrs/examples/pir/befunge/flow.pir
branches/auto_attrs/examples/sdl/tetris/board.pir
branches/auto_attrs/include/parrot/call.h (props changed)
branches/auto_attrs/include/parrot/gc_api.h (props changed)
branches/auto_attrs/include/parrot/runcore_api.h (props changed)
branches/auto_attrs/include/parrot/runcore_trace.h (props changed)
branches/auto_attrs/lib/Parrot/Docs/Section/Parrot.pm
branches/auto_attrs/ports/cpan/pause_guide.pod (props changed)
branches/auto_attrs/ports/cygwin/parrot-1.0.0-1.cygport (props changed)
branches/auto_attrs/ports/debian/libparrot-dev.install.in (props changed)
branches/auto_attrs/ports/debian/libparrot.install.in (props changed)
branches/auto_attrs/ports/debian/parrot-doc.install.in (props changed)
branches/auto_attrs/ports/debian/parrot.install.in (props changed)
branches/auto_attrs/ports/fedora/parrot.spec.fedora (contents, props changed)
branches/auto_attrs/ports/mandriva/parrot.spec.mandriva (props changed)
branches/auto_attrs/ports/suse/parrot.spec.suse (props changed)
branches/auto_attrs/runtime/parrot/languages/ (props changed)
branches/auto_attrs/runtime/parrot/library/Math/Rand.pir (props changed)
branches/auto_attrs/src/call/ops.c (props changed)
branches/auto_attrs/src/call/pcc.c (props changed)
branches/auto_attrs/src/dynoplibs/math.ops (contents, props changed)
branches/auto_attrs/src/dynpmc/gdbmhash.pmc
branches/auto_attrs/src/gc/alloc_memory.c (props changed)
branches/auto_attrs/src/gc/alloc_register.c (props changed)
branches/auto_attrs/src/gc/alloc_resources.c (contents, props changed)
branches/auto_attrs/src/gc/api.c (props changed)
branches/auto_attrs/src/gc/gc_ms.c
branches/auto_attrs/src/gc/gc_private.h
branches/auto_attrs/src/gc/generational_ms.c (props changed)
branches/auto_attrs/src/gc/incremental_ms.c (props changed)
branches/auto_attrs/src/gc/malloc.c (props changed)
branches/auto_attrs/src/gc/malloc_trace.c (props changed)
branches/auto_attrs/src/gc/mark_sweep.c (contents, props changed)
branches/auto_attrs/src/gc/system.c (props changed)
branches/auto_attrs/src/interp/inter_cb.c (props changed)
branches/auto_attrs/src/interp/inter_create.c (props changed)
branches/auto_attrs/src/interp/inter_misc.c (props changed)
branches/auto_attrs/src/pmc/array.pmc
branches/auto_attrs/src/pmc/lexinfo.pmc
branches/auto_attrs/src/pmc/parrotinterpreter.pmc
branches/auto_attrs/src/pmc/parrotthread.pmc
branches/auto_attrs/src/runcore/cores.c (props changed)
branches/auto_attrs/src/runcore/main.c (props changed)
branches/auto_attrs/src/runcore/trace.c (props changed)
branches/auto_attrs/t/compilers/tge/NoneGrammar.tg (props changed)
branches/auto_attrs/t/dynoplibs/math.t (contents, props changed)
branches/auto_attrs/t/native_pbc/annotations.pbc
branches/auto_attrs/t/native_pbc/integer_1.pbc
branches/auto_attrs/t/native_pbc/number_1.pbc
branches/auto_attrs/t/native_pbc/number_2.pbc
branches/auto_attrs/t/native_pbc/string_1.pbc
branches/auto_attrs/t/oo/root_new.t (props changed)
branches/auto_attrs/t/op/gc.t
branches/auto_attrs/t/pmc/pmc.t
branches/auto_attrs/t/src/embed.t (props changed)
branches/auto_attrs/tools/dev/fetch_languages.pl (props changed)
branches/auto_attrs/tools/dev/mk_gitignore.pl (props changed)
branches/auto_attrs/tools/util/perlcritic-cage.conf (props changed)
Modified: branches/auto_attrs/DEPRECATED.pod
==============================================================================
--- branches/auto_attrs/DEPRECATED.pod Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/DEPRECATED.pod Sat Aug 15 12:05:28 2009 (r40561)
@@ -37,10 +37,6 @@
=over 4
-=item random [eligible in 1.1]
-
-L<https://trac.parrot.org/parrot/ticket/189>
-
=item moved to dynpmc [eligible in 1.1]
AddrRegistry, CodeString, Env, Eval, File, OS, PCCMETHOD_Test, StringHandle,
Modified: branches/auto_attrs/MANIFEST
==============================================================================
--- branches/auto_attrs/MANIFEST Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/MANIFEST Sat Aug 15 12:05:28 2009 (r40561)
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Thu Aug 13 02:35:20 2009 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sat Aug 15 07:51:12 2009 UT
#
# See below for documentation on the format of this file.
#
@@ -626,6 +626,7 @@
examples/benchmarks/primes2.rb [examples]
examples/benchmarks/primes2_i.pir [examples]
examples/benchmarks/primes_i.pasm [examples]
+examples/benchmarks/rand.pir [examples]
examples/benchmarks/stress.pasm [examples]
examples/benchmarks/stress.pl [examples]
examples/benchmarks/stress.rb [examples]
@@ -1247,8 +1248,8 @@
src/debug.c []
src/dynext.c []
src/dynoplibs/README []doc
-src/dynoplibs/obscure.ops []
src/dynoplibs/math.ops []
+src/dynoplibs/obscure.ops []
src/dynpmc/README.pod []doc
src/dynpmc/dynlexpad.pmc [devel]src
src/dynpmc/ext.pir []
@@ -1444,7 +1445,6 @@
src/pmc/pmc.num []
src/pmc/pmcproxy.pmc [devel]src
src/pmc/pointer.pmc [devel]src
-src/pmc/random.pmc [devel]src
src/pmc/resizablebooleanarray.pmc [devel]src
src/pmc/resizablefloatarray.pmc [devel]src
src/pmc/resizableintegerarray.pmc [devel]src
@@ -1674,8 +1674,8 @@
t/distro/file_metadata.t [test]
t/distro/manifest.t [test]
t/distro/meta_yml.t [test]
-t/dynoplibs/obscure.t [test]
t/dynoplibs/math.t [test]
+t/dynoplibs/obscure.t [test]
t/dynpmc/dynlexpad.t [test]
t/dynpmc/foo.t [test]
t/dynpmc/foo2.t [test]
@@ -1909,7 +1909,6 @@
t/pmc/pmcproxy.t [test]
t/pmc/pointer.t [test]
t/pmc/prop.t [test]
-t/pmc/random.t [test]
t/pmc/resizablebooleanarray.t [test]
t/pmc/resizablefloatarray.t [test]
t/pmc/resizableintegerarray.t [test]
Modified: branches/auto_attrs/PBC_COMPAT
==============================================================================
--- branches/auto_attrs/PBC_COMPAT Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/PBC_COMPAT Sat Aug 15 12:05:28 2009 (r40561)
@@ -27,6 +27,7 @@
# please insert tab separated entries at the top of the list
+5.2 2009.08.06 dukeleto remove Random PMC
5.1 2009.08.06 cotto remove branch_cs opcode
5.0 2009.07.21 cotto released 1.4.0
4.0 2009.03.17 allison released 1.0.0
Modified: branches/auto_attrs/compilers/tge/TGE.pir
==============================================================================
--- branches/auto_attrs/compilers/tge/TGE.pir Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/compilers/tge/TGE.pir Sat Aug 15 12:05:28 2009 (r40561)
@@ -113,6 +113,46 @@
.end
+.namespace [ 'PGE';'Match' ]
+
+=over 4
+
+=item C<find_key([ key1, key2, ... ])>
+
+Find the first of C<key1>, C<key2>, etc. in the current
+Match object, and return it. Returns '' if none of
+the specified keys are found. If no keys are specified,
+then simply return the first key found.
+
+=back
+
+=cut
+
+.sub 'find_key' :method
+ .param pmc keys :slurpy
+ if null keys goto first_key
+ unless keys goto first_key
+ loop:
+ unless keys goto not_found
+ $S0 = shift keys
+ $I0 = exists self[$S0]
+ unless $I0 goto loop
+ .return ($S0)
+ first_key:
+ $P0 = self.'hash'()
+ $P1 = iter $P0
+ unless $P1 goto not_found
+ next:
+ $S0 = shift $P1
+ $P2 = $P0[$S0]
+ $I0 = isa $P2, 'Capture'
+ unless $I0 goto next
+ .return ($S0)
+ not_found:
+ .return ('')
+.end
+
+
# Local Variables:
# mode: pir
# fill-column: 100
Modified: branches/auto_attrs/docs/book/pct/ch03_compiler_tools.pod
==============================================================================
--- branches/auto_attrs/docs/book/pct/ch03_compiler_tools.pod Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/docs/book/pct/ch03_compiler_tools.pod Sat Aug 15 12:05:28 2009 (r40561)
@@ -30,7 +30,7 @@
executing the new Perl 6 language, when specifications for that were first
starting to be drafted. However, as time went on it was decided that Parrot
would benefit from having a clean abstraction layer between it's internals
-and the Perl 6 language syntax. Thisclean abstraction layer brough with it
+and the Perl 6 language syntax. This clean abstraction layer brough with it
the side effect that Parrot could be used to host a wide variety of dynamic
languages, not just Perl 6. And beyond just hosting them, it could
facilitate their advancement, interaction, and code sharing.
@@ -65,7 +65,7 @@
=over 4
-=item* Write Once and Share
+=item * Write Once and Share
All HLLs on Parrot ultimately compile down to Parrot's platform-independent
bytecode which Parrot can execute natively. This means at the lowest level
@@ -76,7 +76,7 @@
of these things into a web application you are writing in PHP? Parrot
supports this and more.
-=item* Native Library Support
+=item * Native Library Support
Parrot has a robust system for interfacing with external native code
libraries, such as those commonly written in C, C++, Fortran and other
@@ -125,17 +125,17 @@
=over 4
-=item* Not Quite Perl (NQP)
+=item * Not Quite Perl (NQP)
NQP a subset of the Perl 6 language that requires no runtime library to
execute.
-=item* Perl Grammar Engine (PGE)
+=item * Perl Grammar Engine (PGE)
PGE is an implementation of Perl 6's powerful regular expression and grammar
tools.
-=item* HLLCompiler
+=item * HLLCompiler
The HLLCompiler compiler helps to manage and encapsulate the compilation
process. An HLLCompiler object, once created, enables the user to use the
Modified: branches/auto_attrs/docs/book/pct/ch05_nqp.pod
==============================================================================
--- branches/auto_attrs/docs/book/pct/ch05_nqp.pod Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/docs/book/pct/ch05_nqp.pod Sat Aug 15 12:05:28 2009 (r40561)
@@ -27,7 +27,7 @@
able to leverage their existing skills for writing compilers.
In PGE, at the time of a match the grammar we can invoke an action using the
-special <code>{*}</code> symbol. In general, these action methods are
+special C<{*}> symbol. In general, these action methods are
written in NQP, although it is possible for them to be written in PIR N<In
fact, this is how the NQP compiler itself is written>. We won't discuss the
PIR case here because it's uncommon and needlessly difficult. NQP is the
Modified: branches/auto_attrs/docs/pdds/pdd17_pmc.pod
==============================================================================
--- branches/auto_attrs/docs/pdds/pdd17_pmc.pod Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/docs/pdds/pdd17_pmc.pod Sat Aug 15 12:05:28 2009 (r40561)
@@ -1703,11 +1703,6 @@
to reference that PMC rather than calling the assign v-table call on the PMC
in that register. This is not the same behaviour as the Ref PMC.
-=item Random
-
-A singleton PMC that generates a random number. {{ NOTE: Why do we have
-this? }}
-
=item Exception
The base class for all exceptions. Currently based on
Modified: branches/auto_attrs/docs/user/pir/pmcs.pod
==============================================================================
--- branches/auto_attrs/docs/user/pir/pmcs.pod Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/docs/user/pir/pmcs.pod Sat Aug 15 12:05:28 2009 (r40561)
@@ -60,7 +60,6 @@
Iterator iterate over aggregates such as arrays or hashes
Array A generic, resizable array
Hash A generic, resizable hash
- Random Obtain a random number
String Similar to a string register but in PMC form
Integer Similar to an int register but in PMC form
Float Similar to a num register but in PMC form
@@ -304,23 +303,7 @@
A good place to start is the docs directory in the Parrot
distribution (parrot/docs)
-=head3 Example 7: Output random numbers
-
-=begin PIR
-
- .sub _ :main
- $P0 = new 'Random'
- $N0 = $P0
- print $N0
- print "\n"
- $N0 = $P0
- print $N0
- print "\n"
- .end
-
-=end PIR
-
-=head3 Example 8: Triggering an exception
+=head3 Example 7: Triggering an exception
=begin PIR
@@ -332,7 +315,7 @@
=end PIR
-=head3 Example 9: Setting a timer
+=head3 Example 8: Setting a timer
=begin PIR
Modified: branches/auto_attrs/editor/pir-mode.el
==============================================================================
--- branches/auto_attrs/editor/pir-mode.el Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/editor/pir-mode.el Sat Aug 15 12:05:28 2009 (r40561)
@@ -1,5 +1,5 @@
;;; pir-mode.el --- pir-mode.el --- editing IMCC source files under Emacs
-
+;;; $Id $
;;; Commentary:
;; This package provides Emacs support for PIR.
@@ -153,7 +153,7 @@
"ManagedStruct" "MultiSub" "NCI" "NameSpace" "Null"
"OS" "Object" "OrderedHash" "PMCProxy" "ParrotClass"
"ParrotIO" "ParrotInterpreter" "ParrotLibrary" "ParrotObject"
- "ParrotRunningThread" "ParrotThread" "Pointer" "Random"
+ "ParrotRunningThread" "ParrotThread" "Pointer"
"ResizableBooleanArray" "ResizableFloatArray" "ResizableIntegerArray"
"ResizablePMCArray" "ResizableStringArray" "RetContinuation"
"Role" "Scalar" "String" "Sub" "Super"
Copied: branches/auto_attrs/examples/benchmarks/rand.pir (from r40560, trunk/examples/benchmarks/rand.pir)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/auto_attrs/examples/benchmarks/rand.pir Sat Aug 15 12:05:28 2009 (r40561, copy of r40560, trunk/examples/benchmarks/rand.pir)
@@ -0,0 +1,187 @@
+# Copyright (C) 2009, Parrot Foundation.
+# $Id$
+
+=head1 NAME
+
+examples/benchmarks/rand.pir - rand dynop benchmark
+
+=head1 SYNOPSIS
+
+ % time ./parrot examples/benchmarks/rand.pir [count]
+
+=head1 DESCRIPTION
+
+Times the computation of C<count> (default 1e8) random numbers using
+the C<rand> dynop.
+
+=cut
+
+.loadlib 'math_ops'
+
+.sub _main
+ .param pmc argv
+
+ .local int count
+ count = 1e8
+
+ .local int argc
+ argc = argv
+ if argc <= 1 goto no_arg
+ $S0 = argv[1]
+ count = $S0
+no_arg:
+
+ count /= 8
+
+ .local num t0, t1, t2, t3, t4, t5, t6
+ .local num r_num, min_num, max_num
+ .local int r_int, min_int, max_int
+ .local int i
+
+ min_num = 1.0
+ max_num = 20.0
+ min_int = 1
+ max_int = 20
+
+ .local num tn0, tn1, tnull
+ tn0 = time
+ i = count
+ null_loop_top:
+ dec i
+ if i > 0 goto null_loop_top
+ tn1 = time
+ tnull = tn1 - tn0
+
+ t0 = time
+ i = count
+ t0_top:
+ r_num = rand
+ r_num = rand
+ r_num = rand
+ r_num = rand
+ r_num = rand
+ r_num = rand
+ r_num = rand
+ r_num = rand
+ dec i
+ if i > 0 goto t0_top
+
+ t1 = time
+ i = count
+ t1_top:
+ r_int = rand
+ r_int = rand
+ r_int = rand
+ r_int = rand
+ r_int = rand
+ r_int = rand
+ r_int = rand
+ r_int = rand
+ dec i
+ if i > 0 goto t1_top
+
+ t2 = time
+ i = count
+ t2_top:
+ r_num = rand max_num
+ r_num = rand max_num
+ r_num = rand max_num
+ r_num = rand max_num
+ r_num = rand max_num
+ r_num = rand max_num
+ r_num = rand max_num
+ r_num = rand max_num
+ dec i
+ if i > 0 goto t2_top
+
+ t3 = time
+ i = count
+ t3_top:
+ r_int = rand max_int
+ r_int = rand max_int
+ r_int = rand max_int
+ r_int = rand max_int
+ r_int = rand max_int
+ r_int = rand max_int
+ r_int = rand max_int
+ r_int = rand max_int
+ dec i
+ if i > 0 goto t3_top
+
+ t4 = time
+ i = count
+ t4_top:
+ r_num = rand min_num, max_num
+ r_num = rand min_num, max_num
+ r_num = rand min_num, max_num
+ r_num = rand min_num, max_num
+ r_num = rand min_num, max_num
+ r_num = rand min_num, max_num
+ r_num = rand min_num, max_num
+ r_num = rand min_num, max_num
+ dec i
+ if i > 0 goto t4_top
+
+ t5 = time
+ i = count
+ t5_top:
+ r_int = rand min_int, max_int
+ r_int = rand min_int, max_int
+ r_int = rand min_int, max_int
+ r_int = rand min_int, max_int
+ r_int = rand min_int, max_int
+ r_int = rand min_int, max_int
+ r_int = rand min_int, max_int
+ r_int = rand min_int, max_int
+ dec i
+ if i > 0 goto t5_top
+
+ t6 = time
+
+ report('null loop ', tn0, tn1, 0, count)
+
+ count *= 8
+
+ report('num ', t0, t1, tnull, count)
+ report('int ', t1, t2, tnull, count)
+ report('num_max ', t2, t3, tnull, count)
+ report('int_max ', t3, t4, tnull, count)
+ report('num_min_max', t4, t5, tnull, count)
+ report('int_min_max', t5, t6, tnull, count)
+.end
+
+.sub report
+ .param string name
+ .param num start
+ .param num end
+ .param num null_time
+ .param int count
+
+ .local num run_time
+ run_time = end - start
+ run_time -= null_time
+ if run_time > 0 goto time_ok
+ run_time = .000001
+ time_ok:
+
+ .local num per_second
+ .local int ps
+ per_second = count / run_time
+ ps = per_second
+
+ print name
+ print ': '
+ print ps
+ print ' per second ('
+ print count
+ print ' / '
+ print run_time
+ print " seconds)\n"
+.end
+
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
Modified: branches/auto_attrs/examples/opengl/shapes.pir
==============================================================================
--- branches/auto_attrs/examples/opengl/shapes.pir Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/examples/opengl/shapes.pir Sat Aug 15 12:05:28 2009 (r40561)
@@ -24,6 +24,7 @@
=cut
+.loadlib 'math_ops'
.include 'datatypes.pasm'
.include 'opengl_defines.pasm'
@@ -396,31 +397,26 @@
vy = 0.135
vz = 0.0
- .local pmc random
- .local num rand
- random = new 'Random'
- rand = random
- rand *= .1
- x += rand
- rand = random
- rand *= .1
- y += rand
- rand = random
- rand *= .1
- z += rand
-
- rand = random
- rand -= .5
- rand *= .01
- vx += rand
- rand = random
- rand -= .5
- rand *= .01
- vy += rand
- rand = random
- rand -= .5
- rand *= .01
- vz += rand
+ .local num random
+ random = rand 0, 0.1
+ x += random
+ random = rand 0, 0.1
+ y += random
+ random = rand 0, 0.1
+ z += random
+
+ rand random
+ random -= .5
+ random *= .01
+ vx += random
+ random = random
+ random -= .5
+ random *= .01
+ vy += random
+ random = random
+ random -= .5
+ random *= .01
+ vz += random
.local pmc pos
pos = new 'FixedFloatArray'
@@ -457,12 +453,9 @@
.local int count
count = pfx_pos
if count > 1000 goto update_particles
- .local pmc random
- .local num rand
- random = new 'Random'
- rand = random
- rand *= 4
- if rand > dt goto update_particles
+ .local num random
+ random = rand 0, 4
+ if random > dt goto update_particles
new_particle(count, pfx_pos, pfx_vel)
# Update all particles
Modified: branches/auto_attrs/examples/pir/befunge/flow.pir
==============================================================================
--- branches/auto_attrs/examples/pir/befunge/flow.pir Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/examples/pir/befunge/flow.pir Sat Aug 15 12:05:28 2009 (r40561)
@@ -3,6 +3,8 @@
# ** direction changing
+.loadlib 'math_ops'
+
#
# flow__go_east()
#
@@ -69,10 +71,7 @@
# no return value
#
.sub "flow__go_away"
- $P0 = new 'Random'
- $N0 = $P0
- $N0 = $N0 * 4
- $I0 = $N0
+ rand $I0, 0, 4
$P0 = get_global "status"
$P0["dir"] = $I0
set_global "status", $P0
Modified: branches/auto_attrs/examples/sdl/tetris/board.pir
==============================================================================
--- branches/auto_attrs/examples/sdl/tetris/board.pir Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/examples/sdl/tetris/board.pir Sat Aug 15 12:05:28 2009 (r40561)
@@ -18,6 +18,7 @@
=cut
.namespace ["Tetris::Board"]
+.loadlib 'math_ops'
.sub __onload :load
$P0 = get_class "Tetris::Board"
@@ -885,8 +886,7 @@
$I0 = blocks
# get a random block id
- $P0 = new 'Random'
- $N0 = $P0
+ rand $N0
$N0 = $N0 * $I0
id = $N0
Modified: branches/auto_attrs/lib/Parrot/Docs/Section/Parrot.pm
==============================================================================
--- branches/auto_attrs/lib/Parrot/Docs/Section/Parrot.pm Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/lib/Parrot/Docs/Section/Parrot.pm Sat Aug 15 12:05:28 2009 (r40561)
@@ -60,7 +60,7 @@
'Introduction',
'',
$self->new_item( 'Introduction to Parrot', 'docs/intro.pod'),
- $self->new_item( 'Getting Started', 'docs/book/draft/ch02_getting_started.pod'),
+ $self->new_item( 'Getting Started', 'docs/book/pct/ch02_getting_started.pod'),
$self->new_item( 'Navigating the Docs', 'docs/parrot.pod'),
$self->new_item( 'Roles & Responsibilities', 'docs/project/roles_responsibilities.pod'),
$self->new_item( 'Release History', 'docs/parrothist.pod'),
@@ -80,9 +80,9 @@
$self->new_group(
'Implementing Languages on Parrot',
'',
- $self->new_item( 'Parrot Compiler Tools', 'docs/book/draft/ch04_compiler_tools.pod'),
- $self->new_item( 'Parrot Grammar Engine', 'docs/book/draft/ch05_pge.pod'),
- $self->new_item( 'Not Quite Perl', 'docs/book/draft/ch06_nqp.pod'),
+ $self->new_item( 'Parrot Compiler Tools', 'docs/book/pct/ch03_compiler_tools.pod'),
+ $self->new_item( 'Parrot Grammar Engine', 'docs/book/pct/ch04_pge.pod'),
+ $self->new_item( 'Not Quite Perl', 'docs/book/pct/ch05_nqp.pod'),
$self->new_item( 'Compiler FAQ', 'docs/compiler_faq.pod'),
),
$self->new_group(
@@ -111,6 +111,16 @@
$self->new_item( 'Chapter 9 Exceptions', 'docs/book/pir/ch09_exceptions.pod'),
),
+ $self->new_group(
+ 'PCT Book',
+ '',
+ $self->new_item( 'Chapter 1 Introduction', 'docs/book/pct/ch01_introduction.pod'),
+ $self->new_item( 'Chapter 2 Getting Started', 'docs/book/pct/ch02_getting_started.pod'),
+ $self->new_item( 'Chapter 3 Compiler Tools', 'docs/book/pct/ch03_compiler_tools.pod'),
+ $self->new_item( 'Chapter 4 Grammar Engine', 'docs/book/pct/ch04_pge.pod'),
+ $self->new_item( 'Chapter 5 Grammar Actions', 'docs/book/pct/ch05_nqp.pod'),
+ ),
+
# Parrot::Docs::Section::C->new,
# Parrot::Docs::Section::IMCC->new,
# Parrot::Docs::Section::Perl->new,
Copied: branches/auto_attrs/ports/fedora/parrot-1.x.0.patch (from r40560, trunk/ports/fedora/parrot-1.x.0.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/auto_attrs/ports/fedora/parrot-1.x.0.patch Sat Aug 15 12:05:28 2009 (r40561, copy of r40560, trunk/ports/fedora/parrot-1.x.0.patch)
@@ -0,0 +1,38 @@
+--- tools/dev/install_files.pl 2009-07-13 10:26:40.000000000 +0200
++++ tools/dev/install_files.pl 2009-07-13 13:37:49.000000000 +0200
+@@ -163,7 +163,7 @@
+ # 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.
+- $filehash->{DestDirs} = ['pkgconfig', $parrotdir];
++ $filehash->{DestDirs} = ['pkgconfig'];
+ return($filehash);
+ },
+ },
+--- config/gen/makefiles/parrot_pc.in 2009-06-06 16:33:32.000000000 +0200
++++ config/gen/makefiles/parrot_pc.in.new 2009-07-13 23:09:45.000000000 +0200
+@@ -7,4 +7,4 @@
+ Description: virtual machine to execute bytecode for interpreted languages
+ Version: @VERSION@
+ Libs: -L${libdir} -lparrot @icu_shared@ @libs@
+-Cflags: -I${includedir}
++Cflags: -I${includedir}@versiondir@
+--- lib/Parrot/Install.pm 2009-06-01 09:29:57.000000000 +0200
++++ lib/Parrot/Install.pm 2009-06-03 08:41:22.000000000 +0200
+@@ -220,6 +220,16 @@
+ else {
+ next unless -e $src;
+ next if $^O eq 'cygwin' and -e "$src.exe"; # stat works, copy not
++ if (-l $src) {
++ # check if the system supports symbolic linking
++ use Config;
++ if ($Config{d_symlink} && $Config{d_readlink}) {
++ # copy as symbolic link
++ symlink(readlink($src), $dest);
++ print "$dest\n";
++ next;
++ }
++ }
+ copy( $src, $dest ) or die "Error: couldn't copy $src to $dest: $!\n";
+ print "$dest\n";
+ }
Modified: branches/auto_attrs/ports/fedora/parrot.spec.fedora
==============================================================================
--- branches/auto_attrs/ports/fedora/parrot.spec.fedora Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/ports/fedora/parrot.spec.fedora Sat Aug 15 12:05:28 2009 (r40561)
@@ -1,19 +1,25 @@
Name: parrot
-Version: 1.0.0
-Release: 6%{?dist}
+Version: 1.4.0
+Release: 9%{?dist}
Summary: Parrot is a virtual machine
License: Artistic 2.0
Group: Development/Libraries
URL: http://www.parrot.org/
Source0: ftp://ftp.parrot.org/pub/parrot/releases/stable/%{version}/parrot-%{version}.tar.gz
-# Without Patch0 %{_libdir}/libparrot.so would not be a symbolic link to
+
+Patch0: parrot-1.x.0.patch
+# patches file: tools/dev/install_files.pl
+# It is responsible to have no subdirectory under pkgconfig.
+#
+# patches file: config/gen/makefiles/parrot_pc.in
+# So "pkg-config parrot --cflags" works correct
+#
+# see for upstream: https://trac.parrot.org/parrot/ticket/509
+# patched file: lib/Parrot/Install.pm
+# is to have the symlink: libparrot.so -> libparrot.so.%{version}
+# Without this %{_libdir}/libparrot.so would not be a symbolic link to
# %{_libdir}/libparrot.so.%{version}
-# Symlink: libparrot.so -> libparrot.so.%{version}
-# See for upstream: https://trac.parrot.org/parrot/ticket/509
-# Extended for the package to have no subdirectory under pkgconfig
-Patch0: parrot-install_files.patch
-Patch1: parrot-1.0.0-rpath-removal.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: readline-devel
@@ -25,6 +31,7 @@
BuildRequires: perl(Test::Simple)
BuildRequires: ctags
BuildRequires: openssl-devel
+BuildRequires: flex
%package docs
@@ -32,6 +39,9 @@
Group: Documentation
Requires: perl(strict)
Requires: perl(warnings)
+BuildArch: noarch
+
+#--
%package devel
Summary: Parrot Virtual Machine development headers and libraries
@@ -39,47 +49,56 @@
Requires: %{name} = %{version}-%{release}
Requires: pkgconfig
+#--
+
%package tools
Summary: Parrot Virtual Machine development for languages
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: perl(Pod::Simple)
-Requires: perl(File::Which) = 0.05
+Requires: perl(File::Which) >= 0.05
+Requires: perl(Parrot::OpLib::core)
# It is necessary to have installed the package "perl-Perl-Critic" to install
# the parrot-tools
Provides: perl(Parrot::Pmc2c::MethodEmitter) = %{version}
Provides: perl(Parrot::Pmc2c::PCCMETHOD_BITS) = %{version}
Provides: perl(Parrot::Pmc2c::PMCEmitter) = %{version}
+Provides: perl(Parrot::OpLib::core) = %{version}
+
%description
Parrot is a virtual machine designed to efficiently compile and execute
bytecode for dynamic languages. Parrot is the target for Rakudo Perl 6,
as well as variety of other languages.
+#--
+
%description docs
Documentation in text-, POD- and HTML-format (docs/html-subdirectory) and also
examples about the Parrot Virtual Machine.
+#--
+
%description devel
Parrot Virtual Machine development headers and libraries.
+#--
+
%description tools
Parrot Virtual Machine development files for building languages.
+
%prep
%setup -q
%patch0 -p0
-%patch1 -b .rpatch
-%{__perl} -pi -e 's,"lib/,"%{_lib}/, if (/CONST_STRING\(interp,/)' \
- src/library.c
-%{__perl} -pi -e "s,'/usr/lib','%{_libdir}',;s,runtime/lib/,runtime/%{_lib}/," \
- tools/dev/install_files.pl
+%{__perl} -pi -e "s,'/usr/lib','%{_libdir}'," tools/dev/install_files.pl
cat << \EOF > %{name}-prov
#!/bin/sh
-%{__perl_provides} $* | %{__sed} -e '/perl(A)/d' -e '/perl(B)/d' -e '/perl(DB)/d'
+%{__perl_provides} $* | %{__sed} -e '/perl(A)/d' -e '/perl(B)/d' \
+ -e '/perl(DB)/d' -e '/perl(Parrot::OpLib::core)/d'
EOF
%global __perl_provides %{_builddir}/%{name}-%{version}/%{name}-prov
@@ -88,6 +107,13 @@
%build
%ifarch %{ix86} x86_64
+ RPM_OPT_FLAGS="$RPM_OPT_FLAGS -maccumulate-outgoing-args"
+%else
+# The PowerPC-architecture do not build with the '-maccumulate-outgoing-args'
+# option.
+ RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
+%endif
+
%{__perl} Configure.pl \
--prefix=%{_usr} \
--libdir=%{_libdir} \
@@ -96,18 +122,12 @@
--mandir=%{_mandir} \
--cc="%{__cc}" \
--cxx=%{__cxx} \
- --optimize="$RPM_OPT_FLAGS -maccumulate-outgoing-args" \
+ --optimize="$RPM_OPT_FLAGS" \
--parrot_is_shared \
+ --disable-rpath \
--lex=%{_bindir}/flex \
--yacc=%{_bindir}/yacc \
--libs='-lcurses -lm'
-%else
-# PowerPC, not all options work with the PowerPC-architecture, I do not test
-# which is not working (Gerd)
-%{__perl} Configure.pl \
- --prefix=%{_usr} \
- --libdir=%{_libdir}
-%endif
# The LDD_LIBRARY_PATH hack is needed for "miniparrot"
# to find his parrot-library in "blib/lib"
@@ -157,14 +177,13 @@
find %{RPM_PAR_LIB_DIR}tools/dev -type f -name "pbc_to_exe.pir" \
-exec %{__sed} -i -e '1 s&#! parrot&#!/usr/bin/parrot&' {} \; \
-exec chmod 755 {} \;
-# This module is only needed for building and should not be installed (I think)
-# module "Parrot::OpLib::core"
-rm -rf %{RPM_PAR_LIB_DIR}tools/lib/Parrot/OpLib
# Remove doc-files with zero-length
find docs/html -type f -size 0 -exec rm -f {} \;
# Set path for installed programs in docs package
+find examples/json -type f -name "*.pir" \
+ -exec %{__sed} -i -e '1 s&#!../../parrot&#!/usr/bin/parrot&' {} \;
find examples -type f -name "*.pl" \
-exec %{__sed} -i -e '1 s&#! perl&#!/usr/bin/perl&' {} \;
find examples -wholename 'examples/pir/befunge/t/basic.t' \
@@ -189,22 +208,21 @@
find examples/languages -type f -name harness \
-exec %{__sed} -i -e '1 s&#! perl&#!/usr/bin/perl&' {} \;
-for file in docs/book/ch09_pct.pod docs/memory_internals.pod; do
+for file in docs/book/draft/ch05_pge.pod docs/memory_internals.pod; do
%{__mv} $file timestamp
iconv -f ISO-8859-1 -t UTF-8 -o $file timestamp
touch -r timestamp $file
done
%{__rm} -f timestamp
-# These files *probably* aren't needed.
-rm -rf $RPM_BUILD_ROOT%{_usr}/config \
- $RPM_BUILD_ROOT%{_includedir}/src \
- $RPM_BUILD_ROOT%{_usr}/src
%check
+# 'make fulltest' is done by default; it take a lot of time
export LD_LIBRARY_PATH=$( pwd )/blib/lib
-make test
-%{?_with_fulltest: make fulltest}
+FULL='full'
+%{?_without_fulltest: FULL=''}
+%{?!_without_tests: make ${FULL}test}
+
%clean
rm -rf $RPM_BUILD_ROOT
@@ -217,10 +235,7 @@
%defattr(-,root,root,-)
%doc ChangeLog CREDITS NEWS PBC_COMPAT PLATFORMS README
%doc RESPONSIBLE_PARTIES TODO LICENSE
-%exclude %{_bindir}/parrot_config
-%exclude %{_bindir}/parrot_debugger
-%exclude %{_bindir}/pbc_*
-%{_bindir}/*
+%{_bindir}/parrot
%{_libdir}/parrot/
%exclude %{_libdir}/parrot/%{version}/tools
%exclude %{_libdir}/parrot/%{version}/VERSION
@@ -235,12 +250,13 @@
%{_bindir}/parrot_config
%{_bindir}/parrot_debugger
%{_bindir}/pbc_disassemble
+%{_bindir}/pbc_info
%{_bindir}/pbc_merge
%{_bindir}/pbc_to_exe
%{_bindir}/pbc_dump
%{_includedir}/parrot
%{_libdir}/libparrot.so
-%{_libdir}/libparrot.a
+%exclude %{_libdir}/libparrot.a
%{_libdir}/pkgconfig/*
%files tools
@@ -248,18 +264,27 @@
# Files for building languages
%{_libdir}/parrot/%{version}/tools/*
%{_libdir}/parrot/%{version}/VERSION
-
+%{_usr}/src/parrot/*
%changelog
-* Thu Apr 23 2009 Gerd Pokorra <gp at zimt.uni-siegen.de> 1.0.0-6
+* Sat Aug 1 2009 Gerd Pokorra <gp at zimt.uni-siegen.de> 1.4.0-9
+- ppc test included again
+- include the necessary module Parrot::Oplib::core
+- change the place of header files to /usr/include/parrrot/<version>
+- install the files /usr/src/parrot/*
+
+* Sat Jul 25 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.4.0-4
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
+
+* Tue Jul 21 2009 Gerd Pokorra <gp at zimt.uni-siegen.de> 1.4.0-1
+- add the new disable-rpath configure option
+
+* Wed Mar 25 2009 Gerd Pokorra <gp at zimt.uni-siegen.de> 1.0.0-6
- add a list of changes from Lubomir Rintel
-- add patch to remove rpath
- add filtering Provides
- change requires for docs-subpackage
- enable test suite
-
-* Wed Mar 25 2009 Gerd Pokorra <gp at zimt.uni-siegen.de> 1.0.0-5
- change the group of the subpackage "-docs" to Documentation
- put the main-documentation from the docs-package to the main package
- LICENSE file added
@@ -270,6 +295,7 @@
- define RPM_PAR_LIB_DIR added
- add subpackage "tools"
- exclude tools directory from main-package
+- added make html
* Sun Mar 22 2009 Fabien Georget <fabien.georget at gmail.com> 1.0.0-4
- add tools
@@ -278,10 +304,6 @@
- Removed wrong prefix from pkgconfig per Christoph Wickert
- Changed i386 to ix86 per Christoph Wickert
-* Sun Mar 22 2009 David Fetter <david at fetter.org> 1.0.0-2
-- Changed hard-coded path requirement to perl.
-
-
* Tue Mar 17 2009 Allison Randal <allison at parrot.org> 1.0.0
- updated to 1.0.0
@@ -290,91 +312,31 @@
- added parrot_utils to devel
- fixed Source0 url
-* Tue Jan 23 2009 Gerd Pokorra <gp at zimt.uni-siegen.de> 0.9.0
-- added make html
-- make reallyinstall => make install
-
-* Tue Jan 20 2009 chromatic <chromatic at wgz.org> 0.9.0
-- updated to 0.9.0
-
* Tue Dec 16 2008 Whiteknight <wknight8111 at gmail.com> 0.8.2
- updated to 0.8.2
-* Tue Nov 18 2008 chromatic <chromatic at parrot.org> 0.8.1
-- updated to 0.8.1
-
-* Tue Oct 21 2008 particle <particle at parrot.org> 0.8.0
-- updated to 0.8.0
-
-* Tue Sep 16 2008 pmichaud <pmichaud at pobox.com> 0.7.1
-- updated to 0.7.1
-
-* Wed Sep 3 2008 chromatic <chromatic at wgz.org> 0.7.0
-- install parrot_config (not parrot-config)
-
-* Tue Jun 17 2008 Nuno Carvalho <smash at cpan.org> 0.6.3
-- updated to 0.6.3
-
-* Tue May 20 2008 chromatic <chromatic at wgz.org>> 0.6.2
-- updated to 0.6.2
-
-* Mon Apr 28 2008 chromatic <chromatic at wgz.org> 0.6.1
-- minor fixes; tested with Fedora 7, 8, and 9-beta
-
* Tue Mar 18 2008 Bernhard Schmalhofer <Bernhard.Schmalhofer at gmx.de> 0.6.0
- Update to 0.5.3.
* Wed Feb 20 2008 Patrick Michaud <pmichaud at pobox.com> 0.5.3
- Update to 0.5.3.
-* Tue Jan 15 2008 Bob Rogers <rogers at rgrjr.dyndns.org> 0.5.2
-- Update to 0.5.2.
-
-* Tue Dec 18 2007 Jonathan Worthington <jnthn at jnthn.net> 0.5.1
-- Update to 0.5.1.
-
-* Tue Nov 20 2007 chromatic <chromatic at wgz.org> 0.5.0
-- Update to 0.5.0.
-
-* Fri May 25 2007 David Fetter <david at fetter.org> 0.4.12-1
-- Update to 0.4.12.
-
-* Wed Apr 18 2007 Steven Pritchard <steve at kspei.com> 0.4.11-1
-- Update to 0.4.11.
-
-* Wed Mar 21 2007 Steven Pritchard <steve at kspei.com> 0.4.10-1
-- Update to 0.4.10.
-
* Sat Mar 10 2007 Steven Pritchard <steve at kspei.com> 0.4.9-1
- Update to 0.4.9.
-- BR ncurses-devel.
+- BuildRequires ncurses-devel.
- For some reason now I need to force -lm too.
- Remove some files/directories that shouldn't be included.
-
-* Wed Jan 17 2007 Steven Pritchard <steve at kspei.com> 0.4.8-1
-- Attempt update to 0.4.8.
-
-* Fri Jun 30 2006 Steven Pritchard <steve at kspei.com> 0.4.5-5
- Override lib_dir and make various substitutions to try to fix multilib.
- Remove rpath use from Makefile.
- Fix a pod error in src/ops/experimental.ops.
- Enable "make test" since t/doc/pod.t won't fail now.
-
-* Wed Jun 28 2006 Steven Pritchard <steve at kspei.com> 0.4.5-4
- Force permissions on shared libraries so rpmbuild strips them.
-
-* Wed Jun 28 2006 Steven Pritchard <steve at kspei.com> 0.4.5-3
- Fix URL, description, summary, etc.
- Add post/postun.
- Move parrot-config to the devel sub-package.
- Force permissions on the doc directories.
-
-* Tue Jun 27 2006 Steven Pritchard <steve at kspei.com> 0.4.5-2
- Add -lcurses to get readline detection to work.
-- BR libicu-devel.
-
-* Tue Jun 27 2006 Steven Pritchard <steve at kspei.com> 0.4.5-1
-- Initial packaging attempt.
+- Add BuildRequires libicu-devel.
* Tue Mar 18 2003 Steve Fink <sfink at foxglove.localdomain> 0.0.11
- first .spec file created
Modified: branches/auto_attrs/src/dynoplibs/math.ops
==============================================================================
--- branches/auto_attrs/src/dynoplibs/math.ops Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/src/dynoplibs/math.ops Sat Aug 15 12:05:28 2009 (r40561)
@@ -37,6 +37,16 @@
$1 = Parrot_float_rand(0);
}
+=item B<rand>(out INT)
+
+Set $1 to a random integer between C<[-2^31, 2^31)> .
+
+=cut
+
+inline op rand(out INT) {
+ $1 = Parrot_int_rand(0);
+}
+
=item B<rand>(out NUM, in NUM)
Set $1 to a random floating point number between 0 and and $2, inclusive.
@@ -47,6 +57,16 @@
$1 = $2 * Parrot_float_rand(0);
}
+=item B<rand>(out INT, in INT)
+
+Set $1 to a integer between 0 and and $2, inclusive.
+
+=cut
+
+inline op rand(out INT, in INT) {
+ $1 = Parrot_range_rand(0, $2, 0);
+}
+
=item B<rand>(out NUM, in NUM, in NUM)
Set $1 to a random floating point number between $2 and and $3, inclusive.
@@ -57,6 +77,36 @@
$1 = $2 + ($3 - $2) * Parrot_float_rand(0);
}
+=item B<srand>(in NUM)
+
+Set the random number seed to $1. $1 is casted to an INTVAL.
+
+=cut
+
+inline op srand(in NUM) {
+ Parrot_srand((INTVAL)$1);
+}
+
+=item B<srand>(in INT)
+
+Set the random number seed to $1.
+
+=cut
+
+inline op srand(in INT) {
+ Parrot_srand((INTVAL)$1);
+}
+
+=item B<rand>(out INT, in INT, in INT)
+
+Set $1 to a integer between $2 and and $3, inclusive.
+
+=cut
+
+inline op rand(out INT, in INT, in INT) {
+ $1 = Parrot_range_rand($2, $3, 0);
+}
+
=back
=head1 COPYRIGHT
Modified: branches/auto_attrs/src/dynpmc/gdbmhash.pmc
==============================================================================
--- branches/auto_attrs/src/dynpmc/gdbmhash.pmc Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/src/dynpmc/gdbmhash.pmc Sat Aug 15 12:05:28 2009 (r40561)
@@ -92,13 +92,11 @@
*/
VTABLE void class_init() {
- if (pass) {
#ifdef WIN32
- /* RT #46393: What if libgdbm.so cannot be loaded */
- /* Parrot_load_lib(interp, slib, NULL); */
- STRING *slib = CONST_STRING(interp, "gdbm3");
+ /* RT #46393: What if libgdbm.so cannot be loaded */
+ /* Parrot_load_lib(interp, slib, NULL); */
+ STRING *slib = CONST_STRING(interp, "gdbm3");
#endif
- }
}
VTABLE void init() {
Modified: branches/auto_attrs/src/gc/alloc_resources.c
==============================================================================
--- branches/auto_attrs/src/gc/alloc_resources.c Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/src/gc/alloc_resources.c Sat Aug 15 12:05:28 2009 (r40561)
@@ -402,8 +402,9 @@
cur_buffer_arena = cur_buffer_arena->prev) {
Buffer *b = (Buffer *)ARENA_to_PObj(cur_buffer_arena->start_objects);
UINTVAL i;
+ const size_t objects_end = cur_buffer_arena->used;
- for (i = cur_buffer_arena->used; i; --i) {
+ for (i = objects_end; i; --i) {
INTVAL *ref_count = NULL;
/* ! (on_free_list | constant | external | sysmem) */
Modified: branches/auto_attrs/src/gc/gc_ms.c
==============================================================================
--- branches/auto_attrs/src/gc/gc_ms.c Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/src/gc/gc_ms.c Sat Aug 15 12:05:28 2009 (r40561)
@@ -123,16 +123,6 @@
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
-/* the percent of used Arena items at which to trace next time through */
-#define GC_DEBUG_REPLENISH_LEVEL_FACTOR 0.0
-#define GC_DEBUG_UNITS_PER_ALLOC_GROWTH_FACTOR 1
-#define REPLENISH_LEVEL_FACTOR 0.3
-
-/* this factor is totally arbitrary, but gives good timings for stress.pasm */
-#define UNITS_PER_ALLOC_GROWTH_FACTOR 1.75
-
-#define POOL_MAX_BYTES 65536 * 128
-
/*
=head2 Primary MS Functions
@@ -429,6 +419,25 @@
PObj *ptr;
PObj *free_list = (PObj *)pool->free_list;
+#if GC_USE_LAZY_ALLOCATOR
+ if (!free_list && !pool->newfree) {
+ (*pool->more_objects)(interp, pool);
+ free_list = (PObj *)pool->free_list;
+ }
+ if (!free_list) {
+ Small_Object_Arena * const arena = pool->last_Arena;
+ ptr = (PObj *)pool->newfree;
+ pool->newfree = (void *)((char *)pool->newfree + pool->object_size);
+ arena->used++;
+ if (pool->newfree >= pool->newlast)
+ pool->newfree = NULL;
+ PARROT_ASSERT(ptr < pool->newlast);
+ }
+ else {
+ ptr = free_list;
+ pool->free_list = ((GC_MS_PObj_Wrapper*)ptr)->next_ptr;
+ }
+#else
/* if we don't have any objects */
if (!free_list) {
(*pool->more_objects)(interp, pool);
@@ -437,6 +446,7 @@
ptr = free_list;
pool->free_list = ((GC_MS_PObj_Wrapper*)ptr)->next_ptr;
+#endif
PObj_flags_SETTO(ptr, 0);
@@ -568,15 +578,35 @@
PMC_EXT *ptr;
PMC_EXT *free_list = (PMC_EXT *)pool->free_list;
+#if GC_USE_LAZY_ALLOCATOR
+ if (!free_list && !pool->newfree) {
+ (*pool->more_objects)(interp, pool);
+ free_list = (PObj *)pool->free_list;
+ }
+ if (!free_list) {
+ Small_Object_Arena * const arena = pool->last_Arena;
+ ptr = (PMC_EXT *)pool->newfree;
+ pool->newfree = (void *)((char *)pool->newfree + pool->object_size);
+ if (pool->newfree >= pool->newlast)
+ pool->newfree = NULL;
+ arena->used++;
+ PARROT_ASSERT(ptr < pool->newlast);
+ }
+ else {
+ ptr = free_list;
+ pool->free_list = ptr->_next_for_GC;
+ ptr->_next_for_GC = NULL;
+ }
+#else
/* if we don't have any objects */
if (!free_list) {
(*pool->more_objects)(interp, pool);
free_list = (PMC_EXT *)pool->free_list;
}
-
ptr = free_list;
pool->free_list = ptr->_next_for_GC;
ptr->_next_for_GC = NULL;
+#endif
--pool->num_free_objects;
Modified: branches/auto_attrs/src/gc/gc_private.h
==============================================================================
--- branches/auto_attrs/src/gc/gc_private.h Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/src/gc/gc_private.h Sat Aug 15 12:05:28 2009 (r40561)
@@ -36,10 +36,40 @@
#endif /* __ia64__ */
+/* the percent of used Arena items at which to trace next time through */
+#define GC_DEBUG_REPLENISH_LEVEL_FACTOR 0.0
+#define GC_DEBUG_UNITS_PER_ALLOC_GROWTH_FACTOR 1
+#define REPLENISH_LEVEL_FACTOR 0.3
+
+/* this factor is totally arbitrary, but gives good timings for stress.pasm */
+#define UNITS_PER_ALLOC_GROWTH_FACTOR 1.75
+
+#define POOL_MAX_BYTES 65536 * 128
+
+#ifndef GC_IS_MALLOC
+# define PMC_HEADERS_PER_ALLOC 10240 / sizeof (PMC)
+# define BUFFER_HEADERS_PER_ALLOC 5120 / sizeof (Buffer)
+# define STRING_HEADERS_PER_ALLOC 5120 / sizeof (STRING)
+#else /* GC_IS_MALLOC */
+# define PMC_HEADERS_PER_ALLOC 10240 / sizeof (PMC)
+# define BUFFER_HEADERS_PER_ALLOC 10240 / sizeof (Buffer)
+# define STRING_HEADERS_PER_ALLOC 10240 / sizeof (STRING)
+#endif /* GC_IS_MALLOC */
+
+#define CONSTANT_PMC_HEADERS_PER_ALLOC 64
+#define GET_SIZED_POOL_IDX(x) ((x) / sizeof (void *))
+
+
/* these values are used for the attribute allocator */
#define GC_ATTRIB_POOLS_HEADROOM 8
#define GC_FIXED_SIZE_POOL_SIZE 4096
+/* Use the lazy allocator. Since it amortizes arena allocation costs, turn
+ this on at the same time that you increase the size of allocated arenas.
+ increase *_HEADERS_PER_ALLOC and GC_FIXED_SIZE_POOL_SIZE to be large
+ enough to satisfy most startup costs. */
+#define GC_USE_LAZY_ALLOCATOR 0
+
/* We're using this here to add an additional pointer to a PObj without
having to actually add an entire pointer to every PObj-alike structure
in Parrot. Astute observers may notice that if the PObj is comprised of
@@ -124,8 +154,6 @@
#endif /* PARROT_GC_GMS */
-#define GC_USE_LAZY_ALLOCATOR 1
-
typedef struct PMC_Attribute_Pool {
size_t attr_size;
size_t total_objects;
@@ -165,6 +193,10 @@
size_t start_arena_memory;
size_t end_arena_memory;
PARROT_OBSERVER const char *name;
+#if GC_USE_LAZY_ALLOCATOR
+ void *newfree;
+ void *newlast;
+#endif
#if PARROT_GC_GMS
struct _gc_gms_hdr marker; /* limit of list */
struct _gc_gms_hdr *black; /* alive */
Modified: branches/auto_attrs/src/gc/mark_sweep.c
==============================================================================
--- branches/auto_attrs/src/gc/mark_sweep.c Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/src/gc/mark_sweep.c Sat Aug 15 12:05:28 2009 (r40561)
@@ -303,11 +303,12 @@
/* Run through all the buffer header pools and mark */
for (cur_arena = pool->last_Arena; cur_arena; cur_arena = cur_arena->prev) {
+ const size_t objects_end = cur_arena->used;
Buffer *b = (Buffer *)cur_arena->start_objects;
UINTVAL i;
/* loop only while there are objects in the arena */
- for (i = cur_arena->total_objects; i; i--) {
+ for (i = objects_end; i; i--) {
if (PObj_on_free_list_TEST(b))
; /* if it's on free list, do nothing */
@@ -614,16 +615,24 @@
const UINTVAL num_objects = pool->objects_per_alloc;
pool->total_objects += num_objects;
- arena->used = num_objects;
-
- /* Move all the new objects into the free list */
object = (void *)arena->start_objects;
-
+#if GC_USE_LAZY_ALLOCATOR
+ /* Don't move anything onto the free list. Set the pointers and do it
+ lazily when we allocate. */
+ {
+ const size_t total_size = num_objects * pool->object_size;
+ pool->newfree = arena->start_objects;
+ pool->newlast = (void*)((char*)object + total_size);
+ arena->used = 0;
+ }
+#else
+ /* Move all the new objects into the free list */
+ arena->used = num_objects;
for (i = 0; i < num_objects; i++) {
pool->add_free_object(interp, pool, object);
object = (void *)((char *)object + pool->object_size);
}
-
+#endif
pool->num_free_objects += num_objects;
}
@@ -722,21 +731,6 @@
}
}
-#ifndef GC_IS_MALLOC
-# define PMC_HEADERS_PER_ALLOC 10240 / sizeof (PMC)
-# define BUFFER_HEADERS_PER_ALLOC 5120 / sizeof (Buffer)
-# define STRING_HEADERS_PER_ALLOC 5120 / sizeof (STRING)
-#else /* GC_IS_MALLOC */
-# define PMC_HEADERS_PER_ALLOC 10240 / sizeof (PMC)
-# define BUFFER_HEADERS_PER_ALLOC 10240 / sizeof (Buffer)
-# define STRING_HEADERS_PER_ALLOC 10240 / sizeof (STRING)
-#endif /* GC_IS_MALLOC */
-
-#define CONSTANT_PMC_HEADERS_PER_ALLOC 64
-#define GET_SIZED_POOL_IDX(x) ((x) / sizeof (void *))
-
-
-
/*
=back
@@ -868,6 +862,10 @@
pool->mem_pool = NULL;
pool->object_size = object_size;
pool->objects_per_alloc = objects_per_alloc;
+#if GC_USE_LAZY_ALLOCATOR
+ pool->newfree = NULL;
+ pool->newlast = NULL;
+#endif
return pool;
}
Modified: branches/auto_attrs/src/pmc/array.pmc
==============================================================================
--- branches/auto_attrs/src/pmc/array.pmc Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/src/pmc/array.pmc Sat Aug 15 12:05:28 2009 (r40561)
@@ -108,20 +108,6 @@
=over 4
-=item C<void class_init()>
-
-Class initialization. Creates the required memory pools.
-
-=cut
-
-*/
-
- void class_init() {
-
- }
-
-/*
-
=item C<void init()>
Initializes the PMC by calling the underlying C<list_new()> function.
Modified: branches/auto_attrs/src/pmc/lexinfo.pmc
==============================================================================
--- branches/auto_attrs/src/pmc/lexinfo.pmc Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/src/pmc/lexinfo.pmc Sat Aug 15 12:05:28 2009 (r40561)
@@ -49,8 +49,7 @@
void class_init() {
/* there is no pmclass const_pmc flag yet */
- if (pass == 1)
- interp->vtables[entry]->flags |= VTABLE_IS_CONST_PMC_FLAG;
+ interp->vtables[entry]->flags |= VTABLE_IS_CONST_PMC_FLAG;
}
Modified: branches/auto_attrs/src/pmc/parrotinterpreter.pmc
==============================================================================
--- branches/auto_attrs/src/pmc/parrotinterpreter.pmc Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/src/pmc/parrotinterpreter.pmc Sat Aug 15 12:05:28 2009 (r40561)
@@ -209,15 +209,13 @@
void class_init() {
const int typ = enum_class_ParrotInterpreter;
- if (pass) {
- /* TODO unify and fix signatures */
- register_nci_method(INTERP, typ,
- F2DPTR(pt_thread_yield), "yield", "v");
-
- /* misc functions */
- register_nci_method(INTERP, typ,
- F2DPTR(recursion_limit), "recursion_limit", "iJOi");
- }
+ /* TODO unify and fix signatures */
+ register_nci_method(INTERP, typ,
+ F2DPTR(pt_thread_yield), "yield", "v");
+
+ /* misc functions */
+ register_nci_method(INTERP, typ,
+ F2DPTR(recursion_limit), "recursion_limit", "iJOi");
}
/*
Modified: branches/auto_attrs/src/pmc/parrotthread.pmc
==============================================================================
--- branches/auto_attrs/src/pmc/parrotthread.pmc Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/src/pmc/parrotthread.pmc Sat Aug 15 12:05:28 2009 (r40561)
@@ -103,14 +103,12 @@
void class_init() {
const int typ = enum_class_ParrotThread;
- if (pass) {
- register_nci_method(INTERP, typ,
- F2DPTR(do_thread_run), "run", "IJOIP@");
-
- /* XXX appropriate name given that this won't clone globals? */
- register_nci_method(INTERP, typ,
- F2DPTR(do_thread_run_clone_default), "run_clone", "IJOP@");
- }
+ register_nci_method(INTERP, typ,
+ F2DPTR(do_thread_run), "run", "IJOIP@");
+
+ /* XXX appropriate name given that this won't clone globals? */
+ register_nci_method(INTERP, typ,
+ F2DPTR(do_thread_run_clone_default), "run_clone", "IJOP@");
}
/*
Deleted: branches/auto_attrs/src/pmc/random.pmc
==============================================================================
--- branches/auto_attrs/src/pmc/random.pmc Sat Aug 15 12:05:28 2009 (r40560)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,145 +0,0 @@
-/*
-Copyright (C) 2001-2007, Parrot Foundation.
-$Id$
-
-=head1 NAME
-
-src/pmc/random.pmc - Random Numbers
-
-=head1 DESCRIPTION
-
-These are the vtable functions for the Random base class.
-
-This is a singleton (monadic) class - only one instance exists.
-
-=head2 Methods
-
-=over 4
-
-=cut
-
-*/
-
-static PMC *Rand_PMC;
-
-pmclass Random singleton {
-
-/*
-
-=item C<void class_init()>
-
-Class initialization. Clears the singleton PMC.
-
-=cut
-
-*/
-
- void class_init() {
- Rand_PMC = NULL;
- }
-
-/*
-
-=item C<void *get_pointer()>
-
-=cut
-
-*/
-
- VTABLE void *get_pointer() {
- return Rand_PMC;
- }
-
-/*
-
-=item C<void set_pointer(void *ptr)>
-
-These two functions are part of the singleton creation interface. For more
-information see F<src/pmc.c>.
-
-=cut
-
-*/
-
- VTABLE void set_pointer(void *ptr) {
- PARROT_ASSERT(!Rand_PMC);
- Rand_PMC = (PMC *)ptr;
- }
-
-/*
-
-=item C<void set_integer_native(INTVAL seed)>
-
-Sets the random number seed to C<seed>.
-
-=cut
-
-*/
-
- VTABLE void set_integer_native(INTVAL seed) {
- Parrot_srand(seed);
- }
-
-/*
-
-=item C<INTVAL get_integer()>
-
-Returns a random integer in the range C<-2^31..2^31>.
-
-=cut
-
-*/
-
- VTABLE INTVAL get_integer() {
- return Parrot_int_rand(0);
- }
-
-/*
-
-=item C<INTVAL get_integer_keyed_int(INTVAL max)>
-
-Returns a random integer in the range C<0..max>.
-
-=cut
-
-*/
-
- VTABLE INTVAL get_integer_keyed_int(INTVAL max) {
- return Parrot_range_rand(0, max, 0);
- }
-
-/*
-
-=item C<FLOATVAL get_number()>
-
-Returns a random floating-point number in the range C<0.0..1.0>.
-
-=cut
-
-*/
-
- VTABLE FLOATVAL get_number() {
- return Parrot_float_rand(0);
- }
-
-}
-
-/*
-
-=back
-
-=head1 HISTORY
-
-2003.12.10 first rev by leo.
-
-=cut
-
-*/
-
-
-/*
- * Local variables:
- * c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */
Modified: branches/auto_attrs/t/dynoplibs/math.t
==============================================================================
--- branches/auto_attrs/t/dynoplibs/math.t Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/t/dynoplibs/math.t Sat Aug 15 12:05:28 2009 (r40561)
@@ -19,14 +19,54 @@
.loadlib 'math_ops'
.sub main :main
.include 'test_more.pir'
- plan(7)
+ .include 'fp_equality.pasm'
+ plan(20)
ok(1, "load math_ops")
- basic_test_1_arg()
- basic_test_2_arg()
- basic_test_3_arg()
+ rand $I0
+ test_2_arg_int()
+ test_3_arg_int()
+ test_1_arg_num()
+ test_2_arg_num()
+ test_3_arg_num()
+ test_srand()
+ test_local_nums()
+ test_local_nums_2_arg()
+ test_local_ints()
.end
-.sub basic_test_1_arg
+.sub test_2_arg_int
+ rand $I0, 5
+ lt $I0, 0, fail1
+ ok(1, 'rand returns a number greater than or equal to 0')
+ goto upper
+fail1:
+ ok(0, 'rand returns a number greater than or equal to 0')
+upper:
+ gt $I0, 5, fail2
+ ok(1, 'rand returns a number less than or equal to 5')
+ goto finish
+fail2:
+ ok(0, 'rand returns a number less than or equal to 5')
+finish:
+.end
+
+.sub test_3_arg_int
+ rand $I0, 5, 25
+ lt $I0, 5, fail1
+ ok(1, 'rand returns a number greater than or equal to 5')
+ goto upper
+fail1:
+ ok(0, 'rand returns a number greater than or equal to 5')
+upper:
+ gt $I0, 25, fail2
+ ok(1, 'rand returns a number less than or equal to 25')
+ goto finish
+fail2:
+ ok(0, 'rand returns a number less than or equal to 25')
+finish:
+.end
+
+.sub test_1_arg_num
rand $N0
lt $N0, 0, fail1
ok(1, 'rand returns a number greater than or equal to 0')
@@ -42,7 +82,7 @@
finish:
.end
-.sub basic_test_2_arg
+.sub test_2_arg_num
rand $N0, 5
lt $N0, 0, fail1
ok(1, 'rand returns a number greater than or equal to 0')
@@ -58,7 +98,7 @@
finish:
.end
-.sub basic_test_3_arg
+.sub test_3_arg_num
rand $N0, 5, 25
lt $N0, 5, fail1
ok(1, 'rand returns a number greater than or equal to 5')
@@ -74,6 +114,70 @@
finish:
.end
+.sub test_srand
+ srand 42
+ ok(1, 'call srand with int')
+ srand 42.0
+ ok(1, 'call srand with num')
+ rand $N0
+ srand 5
+ rand $N2
+ srand 42.0
+ rand $N1
+ .fp_eq_ok($N0, $N1, 'having the same seed generates the same numbers')
+.end
+
+.sub test_local_nums_2_arg
+ .local num foo, bar
+ foo = rand 5.0, 25.0
+ lt foo, 5, fail1
+ ok(1, 'rand returns a number greater than or equal to 5')
+ goto upper
+fail1:
+ ok(0, 'rand returns a number greater than or equal to 5')
+upper:
+ gt foo, 25, fail2
+ ok(1, 'rand returns a number less than or equal to 25')
+ goto finish
+fail2:
+ ok(0, 'rand returns a number less than or equal to 25')
+finish:
+.end
+
+.sub test_local_nums
+ .local num foo, bar
+ foo = rand
+ lt foo, 0, fail1
+ ok(1, 'rand returns a number greater than or equal to 0')
+ goto upper
+fail1:
+ ok(0, 'rand returns a number greater than or equal to 0')
+upper:
+ gt foo, 1, fail2
+ ok(1, 'rand returns a number less than or equal to 1')
+ goto finish
+fail2:
+ ok(0, 'rand returns a number less than or equal to 1')
+finish:
+.end
+
+.sub test_local_ints
+ .local int foo, bar
+ foo = rand 5, 25
+ lt foo, 5, fail1
+ ok(1, 'rand returns a number greater than or equal to 5')
+ goto upper
+fail1:
+ ok(0, 'rand returns a number greater than or equal to 5')
+upper:
+ gt foo, 25, fail2
+ ok(1, 'rand returns a number less than or equal to 25')
+ goto finish
+fail2:
+ ok(0, 'rand returns a number less than or equal to 25')
+finish:
+.end
+
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
Modified: branches/auto_attrs/t/native_pbc/annotations.pbc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: branches/auto_attrs/t/native_pbc/integer_1.pbc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: branches/auto_attrs/t/native_pbc/number_1.pbc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: branches/auto_attrs/t/native_pbc/number_2.pbc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: branches/auto_attrs/t/native_pbc/string_1.pbc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: branches/auto_attrs/t/op/gc.t
==============================================================================
--- branches/auto_attrs/t/op/gc.t Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/t/op/gc.t Sat Aug 15 12:05:28 2009 (r40561)
@@ -123,6 +123,9 @@
1
OUTPUT
+{
+local $TODO = 'this tests singletons but was tied to the now-gone Random PMC';
+
pasm_output_is( <<'CODE', <<OUTPUT, "vanishing slingleton PMC" );
_main:
.const 'Sub' P0 = "_rand"
@@ -152,6 +155,7 @@
CODE
ok
OUTPUT
+}
pir_output_is( <<'CODE', <<OUTPUT, "vanishing return continuation in method calls" );
.sub main :main
Modified: branches/auto_attrs/t/pmc/pmc.t
==============================================================================
--- branches/auto_attrs/t/pmc/pmc.t Sat Aug 15 11:00:49 2009 (r40560)
+++ branches/auto_attrs/t/pmc/pmc.t Sat Aug 15 12:05:28 2009 (r40561)
@@ -142,9 +142,9 @@
ok 2
OUTPUT
-pasm_output_is( <<'CODE', <<'OUTPUT', "Random PMCs are singletons" );
- new P0, ['Random']
- new P1, ['Random']
+pasm_output_is( <<'CODE', <<'OUTPUT', "Env PMCs are singletons" );
+ new P0, ['Env']
+ new P1, ['Env']
eq_addr P0, P1, ok
print "not the same "
ok: print "ok\n"
Deleted: branches/auto_attrs/t/pmc/random.t
==============================================================================
--- branches/auto_attrs/t/pmc/random.t Sat Aug 15 12:05:28 2009 (r40560)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,34 +0,0 @@
-#! parrot
-# Copyright (C) 2001-2008, Parrot Foundation.
-# $Id$
-
-=head1 NAME
-
-t/pmc/random.t - Random numbers
-
-=head1 SYNOPSIS
-
- % prove t/pmc/random.t
-
-=head1 DESCRIPTION
-
-Tests random number generation
-
-=cut
-
-.sub main :main
- .include 'test_more.pir'
-
- plan(2)
-
- new $P0, ['Random']
- ok(1, 'Instantiated Random PMC')
- set $I0, $P0
- ok(1, 'Got (unknown) random int')
-.end
-
-# Local Variables:
-# mode: pir
-# fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:
More information about the parrot-commits
mailing list