[svn:parrot] r47715 - in branches/gsoc_instrument: . compilers/data_json compilers/imcc compilers/pct compilers/pct/src/PAST compilers/pge compilers/pirc/src compilers/tge config/auto/sizes config/auto/zlib config/gen config/gen/makefiles docs docs/book/draft docs/book/pct docs/book/pir docs/dev docs/pdds docs/pdds/draft docs/project examples/embed examples/io examples/languages/abc examples/languages/squaak examples/pge examples/pir ext/Parrot-Embed/lib/Parrot ext/nqp-rx ext/nqp-rx/src/stage0 include/parrot include/parrot/oplib lib/Parrot lib/Parrot/Configure/Step lib/Parrot/Docs/Section ports/cygwin ports/debian ports/fedora/2.3.0 ports/suse/2.2.0 runtime/parrot/languages runtime/parrot/library runtime/parrot/library/LWP runtime/parrot/library/Math src src/call src/dynpmc src/gc src/interp src/io src/nci src/ops src/pmc src/runcore t/compilers/imcc/syn t/compilers/tge t/oo t/op t/pir t/pmc t/src t/steps/auto t/steps/gen t/steps/init/hints t/tools tools/build tools/ dev tools/util
khairul at svn.parrot.org
khairul at svn.parrot.org
Sat Jun 19 16:17:14 UTC 2010
Author: khairul
Date: Sat Jun 19 16:17:11 2010
New Revision: 47715
URL: https://trac.parrot.org/parrot/changeset/47715
Log:
sync with trunk
Added:
branches/gsoc_instrument/include/parrot/namespace.h
- copied unchanged from r47713, trunk/include/parrot/namespace.h
branches/gsoc_instrument/src/namespace.c
- copied unchanged from r47713, trunk/src/namespace.c
branches/gsoc_instrument/t/oo/objects.t
- copied unchanged from r47713, trunk/t/oo/objects.t
branches/gsoc_instrument/t/tools/parrot_config.t
- copied unchanged from r47713, trunk/t/tools/parrot_config.t
Deleted:
branches/gsoc_instrument/include/parrot/global.h
branches/gsoc_instrument/src/global.c
branches/gsoc_instrument/t/pmc/objects.t
Modified:
branches/gsoc_instrument/ (props changed)
branches/gsoc_instrument/.gitignore
branches/gsoc_instrument/CREDITS
branches/gsoc_instrument/ChangeLog
branches/gsoc_instrument/DEPRECATED.pod
branches/gsoc_instrument/MANIFEST
branches/gsoc_instrument/MANIFEST.generated
branches/gsoc_instrument/NEWS
branches/gsoc_instrument/README
branches/gsoc_instrument/VERSION
branches/gsoc_instrument/compilers/data_json/Rules.mak (props changed)
branches/gsoc_instrument/compilers/imcc/Rules.in (props changed)
branches/gsoc_instrument/compilers/imcc/pbc.c
branches/gsoc_instrument/compilers/pct/Rules.mak (props changed)
branches/gsoc_instrument/compilers/pct/src/PAST/Compiler.pir
branches/gsoc_instrument/compilers/pge/Rules.mak (props changed)
branches/gsoc_instrument/compilers/pirc/src/bcgen.c
branches/gsoc_instrument/compilers/tge/Rules.mak (props changed)
branches/gsoc_instrument/config/auto/sizes/intval_maxmin_c.in (props changed)
branches/gsoc_instrument/config/auto/zlib/ (props changed)
branches/gsoc_instrument/config/gen/config_pm.pm
branches/gsoc_instrument/config/gen/makefiles/root.in
branches/gsoc_instrument/docs/book/draft/README (props changed)
branches/gsoc_instrument/docs/book/draft/appa_glossary.pod (props changed)
branches/gsoc_instrument/docs/book/draft/appb_patch_submission.pod (props changed)
branches/gsoc_instrument/docs/book/draft/appc_command_line_options.pod (props changed)
branches/gsoc_instrument/docs/book/draft/appd_build_options.pod (props changed)
branches/gsoc_instrument/docs/book/draft/appe_source_code.pod (props changed)
branches/gsoc_instrument/docs/book/draft/ch01_introduction.pod (props changed)
branches/gsoc_instrument/docs/book/draft/ch02_getting_started.pod (props changed)
branches/gsoc_instrument/docs/book/draft/ch07_dynpmcs.pod (props changed)
branches/gsoc_instrument/docs/book/draft/ch08_dynops.pod (props changed)
branches/gsoc_instrument/docs/book/draft/ch10_opcode_reference.pod (props changed)
branches/gsoc_instrument/docs/book/draft/ch11_directive_reference.pod (props changed)
branches/gsoc_instrument/docs/book/draft/ch12_operator_reference.pod (props changed)
branches/gsoc_instrument/docs/book/draft/chXX_hlls.pod (props changed)
branches/gsoc_instrument/docs/book/draft/chXX_library.pod (props changed)
branches/gsoc_instrument/docs/book/draft/chXX_testing_and_debugging.pod (props changed)
branches/gsoc_instrument/docs/book/pct/ch01_introduction.pod (props changed)
branches/gsoc_instrument/docs/book/pct/ch02_getting_started.pod (props changed)
branches/gsoc_instrument/docs/book/pct/ch03_compiler_tools.pod (props changed)
branches/gsoc_instrument/docs/book/pct/ch04_pge.pod (props changed)
branches/gsoc_instrument/docs/book/pct/ch05_nqp.pod (props changed)
branches/gsoc_instrument/docs/book/pir/ch07_objects.pod
branches/gsoc_instrument/docs/dev/c_functions.pod (props changed)
branches/gsoc_instrument/docs/embed.pod
branches/gsoc_instrument/docs/parrothist.pod
branches/gsoc_instrument/docs/pdds/draft/pdd06_pasm.pod
branches/gsoc_instrument/docs/pdds/draft/pdd11_extending.pod
branches/gsoc_instrument/docs/pdds/pdd28_strings.pod
branches/gsoc_instrument/docs/pdds/pdd30_install.pod (props changed)
branches/gsoc_instrument/docs/project/release_manager_guide.pod
branches/gsoc_instrument/examples/embed/cotorra.c (props changed)
branches/gsoc_instrument/examples/io/http.pir
branches/gsoc_instrument/examples/io/httpd.pir
branches/gsoc_instrument/examples/languages/abc/ (props changed)
branches/gsoc_instrument/examples/languages/squaak/ (props changed)
branches/gsoc_instrument/examples/pge/demo.pir (props changed)
branches/gsoc_instrument/examples/pir/make_hello_pbc.pir
branches/gsoc_instrument/ext/Parrot-Embed/lib/Parrot/Embed.xs
branches/gsoc_instrument/ext/nqp-rx/Rules.mak (props changed)
branches/gsoc_instrument/ext/nqp-rx/src/stage0/nqp-setting.nqp
branches/gsoc_instrument/include/parrot/call.h (props changed)
branches/gsoc_instrument/include/parrot/gc_api.h (props changed)
branches/gsoc_instrument/include/parrot/interpreter.h
branches/gsoc_instrument/include/parrot/key.h
branches/gsoc_instrument/include/parrot/oplib.h
branches/gsoc_instrument/include/parrot/oplib/core_ops.h
branches/gsoc_instrument/include/parrot/packfile.h
branches/gsoc_instrument/include/parrot/parrot.h
branches/gsoc_instrument/include/parrot/runcore_api.h (props changed)
branches/gsoc_instrument/include/parrot/runcore_profiling.h (props changed)
branches/gsoc_instrument/include/parrot/runcore_trace.h (props changed)
branches/gsoc_instrument/lib/Parrot/Configure/Step/Test.pm (props changed)
branches/gsoc_instrument/lib/Parrot/Docs/Section/Parrot.pm
branches/gsoc_instrument/lib/Parrot/H2inc.pm (props changed)
branches/gsoc_instrument/ports/cygwin/README
branches/gsoc_instrument/ports/cygwin/parrot-1.0.0-1.cygport (props changed)
branches/gsoc_instrument/ports/debian/libparrot-dev.install.in (props changed)
branches/gsoc_instrument/ports/debian/libparrot.install.in (props changed)
branches/gsoc_instrument/ports/debian/parrot-doc.install.in (props changed)
branches/gsoc_instrument/ports/debian/parrot.install.in (props changed)
branches/gsoc_instrument/ports/fedora/2.3.0/ (props changed)
branches/gsoc_instrument/ports/suse/2.2.0/ (props changed)
branches/gsoc_instrument/runtime/parrot/languages/ (props changed)
branches/gsoc_instrument/runtime/parrot/library/LWP/UserAgent.pir
branches/gsoc_instrument/runtime/parrot/library/Math/Rand.pir (props changed)
branches/gsoc_instrument/runtime/parrot/library/Rules.mak (props changed)
branches/gsoc_instrument/src/call/ops.c (props changed)
branches/gsoc_instrument/src/call/pcc.c (props changed)
branches/gsoc_instrument/src/dynpmc/Defines.in
branches/gsoc_instrument/src/gc/alloc_memory.c (props changed)
branches/gsoc_instrument/src/gc/alloc_resources.c (props changed)
branches/gsoc_instrument/src/gc/api.c (props changed)
branches/gsoc_instrument/src/gc/gc_private.h
branches/gsoc_instrument/src/gc/malloc.c (props changed)
branches/gsoc_instrument/src/gc/malloc_trace.c (props changed)
branches/gsoc_instrument/src/gc/mark_sweep.c (props changed)
branches/gsoc_instrument/src/gc/system.c (props changed)
branches/gsoc_instrument/src/hll.c
branches/gsoc_instrument/src/interp/inter_cb.c (props changed)
branches/gsoc_instrument/src/interp/inter_create.c (props changed)
branches/gsoc_instrument/src/interp/inter_misc.c (props changed)
branches/gsoc_instrument/src/io/io_private.h
branches/gsoc_instrument/src/io/socket_unix.c
branches/gsoc_instrument/src/io/socket_win32.c
branches/gsoc_instrument/src/io/win32.c
branches/gsoc_instrument/src/key.c
branches/gsoc_instrument/src/multidispatch.c
branches/gsoc_instrument/src/nci/core_thunks.c
branches/gsoc_instrument/src/nci/extra_thunks.c
branches/gsoc_instrument/src/oo.c
branches/gsoc_instrument/src/ops/core_ops.c
branches/gsoc_instrument/src/ops/experimental.ops
branches/gsoc_instrument/src/ops/pmc.ops
branches/gsoc_instrument/src/ops/var.ops
branches/gsoc_instrument/src/packfile.c
branches/gsoc_instrument/src/pmc/arrayiterator.pmc
branches/gsoc_instrument/src/pmc/bytebuffer.pmc
branches/gsoc_instrument/src/pmc/capture.pmc
branches/gsoc_instrument/src/pmc/class.pmc
branches/gsoc_instrument/src/pmc/eval.pmc
branches/gsoc_instrument/src/pmc/hash.pmc
branches/gsoc_instrument/src/pmc/key.pmc
branches/gsoc_instrument/src/pmc/namespace.pmc
branches/gsoc_instrument/src/pmc/resizablepmcarray.pmc
branches/gsoc_instrument/src/pmc/role.pmc
branches/gsoc_instrument/src/pmc/string.pmc
branches/gsoc_instrument/src/pmc/stringhandle.pmc
branches/gsoc_instrument/src/pmc/stringiterator.pmc
branches/gsoc_instrument/src/pmc/timer.pmc
branches/gsoc_instrument/src/runcore/cores.c (props changed)
branches/gsoc_instrument/src/runcore/main.c (props changed)
branches/gsoc_instrument/src/runcore/profiling.c (props changed)
branches/gsoc_instrument/src/runcore/trace.c (props changed)
branches/gsoc_instrument/src/thread.c
branches/gsoc_instrument/t/compilers/imcc/syn/regressions.t
branches/gsoc_instrument/t/compilers/tge/NoneGrammar.tg (props changed)
branches/gsoc_instrument/t/oo/root_new.t (props changed)
branches/gsoc_instrument/t/oo/vtableoverride.t
branches/gsoc_instrument/t/op/sprintf2.t
branches/gsoc_instrument/t/pir/macro.t
branches/gsoc_instrument/t/pmc/arrayiterator.t
branches/gsoc_instrument/t/pmc/bytebuffer.t
branches/gsoc_instrument/t/pmc/eval.t
branches/gsoc_instrument/t/pmc/namespace-old.t (props changed)
branches/gsoc_instrument/t/pmc/schedulermessage.t
branches/gsoc_instrument/t/pmc/sockaddr.t
branches/gsoc_instrument/t/pmc/stringhandle.t
branches/gsoc_instrument/t/pmc/stringiterator.t
branches/gsoc_instrument/t/src/embed.t (contents, props changed)
branches/gsoc_instrument/t/src/extend.t
branches/gsoc_instrument/t/steps/auto/warnings-01.t
branches/gsoc_instrument/t/steps/gen/opengl-01.t
branches/gsoc_instrument/t/steps/init/hints/linux-01.t (props changed)
branches/gsoc_instrument/tools/build/h2inc.pl (props changed)
branches/gsoc_instrument/tools/dev/fetch_languages.pl (contents, props changed)
branches/gsoc_instrument/tools/dev/mk_gitignore.pl (props changed)
branches/gsoc_instrument/tools/dev/mk_inno.pl
branches/gsoc_instrument/tools/dev/mk_manifest_and_skip.pl
branches/gsoc_instrument/tools/dev/nci_thunk_gen.pir
branches/gsoc_instrument/tools/dev/pprof2cg.pl
branches/gsoc_instrument/tools/dev/vgp
branches/gsoc_instrument/tools/util/parrot-config.pir
branches/gsoc_instrument/tools/util/perlcritic-cage.conf (props changed)
branches/gsoc_instrument/tools/util/release.json
Modified: branches/gsoc_instrument/.gitignore
==============================================================================
--- branches/gsoc_instrument/.gitignore Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/.gitignore Sat Jun 19 16:17:11 2010 (r47715)
@@ -1,6 +1,6 @@
# ex: set ro:
-# $Id
-# generated by tools/dev/mk_manifest_and_skip.pl Mon May 17 15:32:39 2010 UT
+# $Id: MANIFEST.SKIP 47057 2010-05-27 15:39:08Z fperrad
+# generated by tools/dev/mk_manifest_and_skip.pl Thu May 27 15:25:37 2010 UT
#
# This file should contain a transcript of the svn:ignore properties
# of the directories in the Parrot subversion repository. (Needed for
@@ -47,6 +47,10 @@
libparrot.dll
miniparrot
myconfig
+ops2c
+ops2c.c
+ops2c.pbc
+ops2c.pir
parrot
parrot-nqp
parrot-nqp.c
@@ -102,6 +106,12 @@
compilers/imcc/imcparser.c
compilers/imcc/imcparser.h
compilers/imcc/imcparser.output
+# generated from svn:ignore of 'compilers/opsc/gen/Ops/'
+compilers/opsc/gen/Ops/*.pir
+# generated from svn:ignore of 'compilers/opsc/gen/Ops/Compiler/'
+compilers/opsc/gen/Ops/Compiler/*.pir
+# generated from svn:ignore of 'compilers/opsc/gen/Ops/Trans/'
+compilers/opsc/gen/Ops/Trans/*.pir
# generated from svn:ignore of 'compilers/pct/src/PAST/'
compilers/pct/src/PAST/*.pbc
# generated from svn:ignore of 'compilers/pct/src/PCT/'
@@ -235,6 +245,8 @@
ext/Parrot-Embed/lib/Parrot/*.obj
# generated from svn:ignore of 'ext/Parrot-Embed/t/'
ext/Parrot-Embed/t/*.pbc
+# generated from svn:ignore of 'ext/nqp-rx/src/stage0/'
+ext/nqp-rx/src/stage0/nqp-setting.pir
# generated from svn:ignore of 'include/parrot/'
include/parrot/*.tmp
include/parrot/config.h
@@ -248,11 +260,6 @@
include/parrot/platform_interface.h
include/parrot/platform_limits.h
include/parrot/vtable.h
-# generated from svn:ignore of 'include/parrot/oplib/'
-include/parrot/oplib/*_ops.h
-include/parrot/oplib/*_ops_cg*.h
-include/parrot/oplib/*_ops_switch.h
-include/parrot/oplib/ops.h
# generated from svn:ignore of 'include/pmc/'
include/pmc/*.h
# generated from svn:ignore of 'lib/'
@@ -314,6 +321,8 @@
runtime/parrot/library/Getopt/Obj.pbc
# generated from svn:ignore of 'runtime/parrot/library/HTTP/'
runtime/parrot/library/HTTP/*.pbc
+# generated from svn:ignore of 'runtime/parrot/library/LWP/'
+runtime/parrot/library/LWP/*.pbc
# generated from svn:ignore of 'runtime/parrot/library/MIME/'
runtime/parrot/library/MIME/*.pbc
# generated from svn:ignore of 'runtime/parrot/library/Math/'
@@ -582,6 +591,7 @@
# generated from svn:ignore of 't/tools/'
t/tools/*.pbc
t/tools/*.pir
+t/tools/*.stdout
t/tools/pdb.t.*
t/tools/pmc2c.*.c
t/tools/pmc2c.*.dump
Modified: branches/gsoc_instrument/CREDITS
==============================================================================
--- branches/gsoc_instrument/CREDITS Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/CREDITS Sat Jun 19 16:17:11 2010 (r47715)
@@ -402,7 +402,7 @@
N: Gerd Pokorra
E: pokorra at uni-siegen.de
-D: Release manager for 1.9.0 and 2.3.0
+D: Release manager for 1.9.0, 2.3.0 and 2.5.0
N: Goplat
D: Win98 and other fixes.
Modified: branches/gsoc_instrument/ChangeLog
==============================================================================
--- branches/gsoc_instrument/ChangeLog Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/ChangeLog Sat Jun 19 16:17:11 2010 (r47715)
@@ -1,8 +1,12 @@
#1 $Id$
+2010.06.15 Gerd
+ * Released 2.5.0
+ See NEWS for more.
+
2010.05.18 Whiteknight
- * Released 2.4.0
- See NEWS for more
+ * Released 2.4.0
+ See NEWS for more
2010.04.20 Gerd
* Released 2.3.0
@@ -157,7 +161,7 @@
See NEWS for more.
2007.3.10 coke
- * removed parakeet
+ * removed parakeet
2007.02.22 pmichaud
* Released 0.4.9
@@ -223,7 +227,7 @@
2006.07.20 audreyt
* --maintainer prerequesites are now bison 2.2+ and flex 2.5.3x
(or some such --leo)
- (at the moment code is checking for 2.0 -- ambs)
+ (at the moment code is checking for 2.0 -- ambs)
2006.07.17 chip
partial implementation of new pdd21:
@@ -236,7 +240,7 @@
See NEWS for more.
2006.06.03 leo
- * I and N registers are never cleared to 0 / 0.0 on subroutine entry
+ * I and N registers are never cleared to 0 / 0.0 on subroutine entry
2006.05.14 leo
* Released 0.4.4
@@ -250,7 +254,7 @@
See NEWS for more.
2006.03.06 leo
- * Shifted argument type bits left by 2 according to r11754
+ * Shifted argument type bits left by 2 according to r11754
change of docs/pdds/pdd03_calling_conventions.pod
* if you are creating PASM then code needs adjustment
@@ -353,7 +357,7 @@
* the usual bug fixes and improvements
2005-03-06 leo
- * Released 0.1.2
+ * Released 0.1.2
* big rewrite of string code, not yet finished but ...
* partial implementation of a generational garbage collector
* indirect register frame addressing
@@ -368,7 +372,7 @@
* and as always a lot more
2004-10-09 leo
- * Released 0.1.1
+ * Released 0.1.1
* Need Perl 5.6 now for building
* Basic AST support, PAST file parser, bits of code generation
* BigInt PMC using GMP
@@ -398,39 +402,39 @@
* ... and a lot more
2004-02-29 leo
- * Released 0.1.0
- * "Ladies and gentlemen, I give you... objects!"
- * Huge documentation overhaul
- * More supported platforms, s. PLATFORMS
- * Basic thread support for pthread based architectures
- * Basic event handling for timers and signals including:
- * PASM callbacks for NCI (native C) functions.
- * Improved platform configuration
- * COW stacks now working, stacks code redone
- * Structure handling vastly improved
- * Random PMC and rand primitives
- * Better subroutine call syntax in PIR
- * Make PIR subroutines compliant with pdd03
- * Improved profiling (DOD, GC timings)
- * Hash code improvements, incl. random key order support
- * Experimental freeze/thaw code for some PMC types
- * IO improvements for buffered layer and Win32
- * String iterators
- * String bitwise vtables
- * Many new opcodes
- * Support for JIT, where malloced memory isn't executable
- * Priority DOD scheme for objects that need timely destruction
- * Improved bytecode loading (e.g. onLoad functions)
- * Language updates: forth, Perl6/P6C, m4
- * Libraries: Getopt_Long, SDL, Dumper, Sort
- * new JAPH examples
- * Unified imcc and parrot test handling
- * Many new tests (make test reports 1386 tests)
- * Numerous bug fixes
+ * Released 0.1.0
+ * "Ladies and gentlemen, I give you... objects!"
+ * Huge documentation overhaul
+ * More supported platforms, s. PLATFORMS
+ * Basic thread support for pthread based architectures
+ * Basic event handling for timers and signals including:
+ * PASM callbacks for NCI (native C) functions.
+ * Improved platform configuration
+ * COW stacks now working, stacks code redone
+ * Structure handling vastly improved
+ * Random PMC and rand primitives
+ * Better subroutine call syntax in PIR
+ * Make PIR subroutines compliant with pdd03
+ * Improved profiling (DOD, GC timings)
+ * Hash code improvements, incl. random key order support
+ * Experimental freeze/thaw code for some PMC types
+ * IO improvements for buffered layer and Win32
+ * String iterators
+ * String bitwise vtables
+ * Many new opcodes
+ * Support for JIT, where malloced memory isn't executable
+ * Priority DOD scheme for objects that need timely destruction
+ * Improved bytecode loading (e.g. onLoad functions)
+ * Language updates: forth, Perl6/P6C, m4
+ * Libraries: Getopt_Long, SDL, Dumper, Sort
+ * new JAPH examples
+ * Unified imcc and parrot test handling
+ * Many new tests (make test reports 1386 tests)
+ * Numerous bug fixes
2003-10-31 leo
- * Released 0.0.13
+ * Released 0.0.13
* Yep thirteen - haunted by the ghost of 0.0.12
* Build imcc as parrot
* Objects more finished
@@ -453,7 +457,7 @@
* Many new tests and fixes
2003-10-22 melvin
- * imcc moved from parrot/languages/ to parrot/
+ * imcc moved from parrot/languages/ to parrot/
2003-09-20 sfink
@@ -493,7 +497,7 @@
2003-06-14 13:50 dan
* Moved the registers out of the context structure, since they
- really aren't context
+ really aren't context
* Changed the register stack frames to hold only 16 registers
rather than 32, added half-set push and pop ops, and reworked
the full set push/pops to do two half-set push/pops. Should
@@ -506,7 +510,7 @@
* Various files
Update Yet Another copyright statements to reflect the (no longer
- so) shiny new year.
+ so) shiny new year.
2003-03-11 22:06 chip
Modified: branches/gsoc_instrument/DEPRECATED.pod
==============================================================================
--- branches/gsoc_instrument/DEPRECATED.pod Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/DEPRECATED.pod Sat Jun 19 16:17:11 2010 (r47715)
@@ -156,15 +156,6 @@
for Sub, Exception, and related PMC types will instead be handled by
get_label and set_label.
-=item All bitwise ops [eligible in 2.1]
-
-All bitwise ops (all ops containing C<bitwise> in their names) will be provided
-by dynops. B<NOTE>: Before removing the bitwise ops, make sure that the
-equivalent dynops are available and that the major HLLs (Rakudo, Partcl, Lua,
-etc) have switched to using them.
-
-L<https://trac.parrot.org/parrot/ticket/1260>
-
=item get_results opcode order and features [eligible in 2.1]
get_results no longer used to fetch exception object.
@@ -319,6 +310,12 @@
L<https://trac.parrot.org/parrot/ticket/443>
+=item C<Parrot_find_global_s> and C<Parrot_store_global_s>
+
+This function is not used or tested anywhere.
+
+http://trac.parrot.org/parrot/ticket/1660
+
=item PMC Attributes Allocation Functions [experimental]
Parrot_gc_allocate_pmc_attributes
@@ -348,6 +345,12 @@
L<https://trac.parrot.org/parrot/ticket/1628>
+=item Parrot_get_runtime_prefix [eligible in 2.7]
+
+Use Parrot_get_runtime_path instead.
+
+L<https://trac.parrot.org/parrot/ticket/1191>
+
=back
=head1 Compiler tools
Modified: branches/gsoc_instrument/MANIFEST
==============================================================================
--- branches/gsoc_instrument/MANIFEST Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/MANIFEST Sat Jun 19 16:17:11 2010 (r47715)
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Wed Jun 9 14:23:50 2010 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Mon Jun 14 16:49:50 2010 UT
#
# See below for documentation on the format of this file.
#
@@ -960,7 +960,6 @@
include/parrot/exit.h [main]include
include/parrot/extend.h [main]include
include/parrot/gc_api.h [main]include
-include/parrot/global.h [main]include
include/parrot/global_setup.h [main]include
include/parrot/hash.h [main]include
include/parrot/hll.h [main]include
@@ -976,6 +975,7 @@
include/parrot/memory.h [main]include
include/parrot/misc.h [main]include
include/parrot/multidispatch.h [main]include
+include/parrot/namespace.h [main]include
include/parrot/nci.h [main]include
include/parrot/oo.h [main]include
include/parrot/oo_private.h [main]include
@@ -1300,7 +1300,6 @@
src/gc/malloc_trace.c []
src/gc/mark_sweep.c []
src/gc/system.c []
-src/global.c []
src/global_setup.c []
src/hash.c []
src/hll.c []
@@ -1326,6 +1325,7 @@
src/main.c []
src/misc.c []
src/multidispatch.c []
+src/namespace.c []
src/nci/api.c []
src/nci/core_thunks.c []
src/nci/core_thunks.nci []
@@ -1785,6 +1785,7 @@
t/oo/names.t [test]
t/oo/new-old.t [test]
t/oo/new.t [test]
+t/oo/objects.t [test]
t/oo/ops.t [test]
t/oo/proxy.t [test]
t/oo/root_new.t [test]
@@ -1910,7 +1911,6 @@
t/pmc/object-meths.t [test]
t/pmc/object-mro.t [test]
t/pmc/object.t [test]
-t/pmc/objects.t [test]
t/pmc/opcode.t [test]
t/pmc/oplib.t [test]
t/pmc/orderedhash.t [test]
@@ -2079,6 +2079,7 @@
t/tools/install/testlib/src/pmc/pmc_object.h [test]
t/tools/install/testlib/tools/build/ops2c.pl [test]
t/tools/install/testlib/vtable.dump [test]
+t/tools/parrot_config.t [test]
t/tools/parrot_debugger.t [test]
t/tools/pbc_disassemble.t [test]
t/tools/pbc_dump.t [test]
Modified: branches/gsoc_instrument/MANIFEST.generated
==============================================================================
--- branches/gsoc_instrument/MANIFEST.generated Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/MANIFEST.generated Sat Jun 19 16:17:11 2010 (r47715)
@@ -2,11 +2,11 @@
# See tools/dev/install_files.pl for documentation on the
# format of this file.
# Please re-sort this file after *EVERY* modification
-blib/lib/libparrot.2.4.0.dylib [main]lib
+blib/lib/libparrot.2.5.0.dylib [main]lib
blib/lib/libparrot.a [main]lib
blib/lib/libparrot.dylib [main]lib
blib/lib/libparrot.so [main]lib
-blib/lib/libparrot.so.2.4.0 [main]lib
+blib/lib/libparrot.so.2.5.0 [main]lib
compilers/data_json/data_json.pbc [data_json]
config/gen/call_list/opengl.in []
docs/ops/bit.pod [doc]
Modified: branches/gsoc_instrument/NEWS
==============================================================================
--- branches/gsoc_instrument/NEWS Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/NEWS Sat Jun 19 16:17:11 2010 (r47715)
@@ -1,42 +1,26 @@
# $Id$
New in 2.5.0
-- Platforms
- + EPEL (Extra Packages for Enterprise Linux) packages for RHEL6.beta are available
- + Building and testing on amd64/i386, with gcc/g++
- + Almost finished Parrot configure on RTEMS
-- Parrot starts to going Lorito
- Lorito is the code name for a set of planned refactors to the core opcodes.
- + The ops_pct branch has been merged into trunk. The "Stage 0" is done with it.
- for more Information about Lorito see:
- http://trac.parrot.org/parrot/wiki/Lorito
- http://trac.parrot.org/parrot/wiki/LoritoRoadmap
- Core
- + Added ByteBuffer PMC
- + Added a bunch of tests for Array PMCs
- + Modify some PMC vtable functions to reduce complexity, simplifying its coverage.
- + Deleted do-nothing custom mark in StringBuilder
- + Fixed ticket #389; subs are not entered into a namespace unless you declare them
+ + Added ByteBuffer PMC to allow direct byte manipulation
+ + Modified some PMC vtable functions to reduce complexity, simplifying coverage.
+ + Modified PAST to generate symbolic PASM constants in PIR output.
+ + General STRING API cleanups
+ + Increased test coverage of core PMCs
+ Fixed up 'exit' opcode, added CONTROL_EXIT exception type.
- + Modified PAST so that it can generate symbolic pasm constants in PIR output.
- + Fixed some substr-out-of-range errors in Regex.match
- + Various cleanups and some added functionality to NFG (Grapheme Normal Form).
- + Various parts of the STRING API are now more graceful
- + Improved implemented PAST::Pattern:
- Can match on types, children, attributes, based on iseq to a constant,
- based on true result from a closure and based on anything with an
- ACCEPTS method.
-- Tests
- + Fixed some tests that were failing because of dynops
- + Some tests for the instrument dynpmc are added
-- NQP
- + nqp-rx now supports multisubs and multimethods
+ + Experimental 'unroll' opcode renamed to 'finalize'
+- NQP-rx
+ + Added proper support for multisubs and multimethods
+ Fixed sigspace handling ** quantifier in regexes
+ Added \e strings
+ Added use of inversion lists for charclass lists in regexes
-- Languages
- + resurrected partcl
-- Miscellaneous
+- Platforms
+ + EPEL (Extra Packages for Enterprise Linux) packages for RHEL6.beta are available
+- Begin moving towards Lorito, the ops refactor to enable pervasive self-hosting and JIT compilation.
+ + All ops are now built with the self-hosted opsc compiler.
+ + For more Information about Lorito see:
+ http://trac.parrot.org/parrot/wiki/Lorito
+ http://trac.parrot.org/parrot/wiki/LoritoRoadmap
New in 2.4.0
- Core
Modified: branches/gsoc_instrument/README
==============================================================================
--- branches/gsoc_instrument/README Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/README Sat Jun 19 16:17:11 2010 (r47715)
@@ -1,4 +1,4 @@
-This is Parrot, version 2.4.0
+This is Parrot, version 2.5.0
------------------------------
Parrot is Copyright (C) 2001-2010, Parrot Foundation.
Modified: branches/gsoc_instrument/VERSION
==============================================================================
--- branches/gsoc_instrument/VERSION Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/VERSION Sat Jun 19 16:17:11 2010 (r47715)
@@ -1 +1 @@
-2.4.0
+2.5.0
Modified: branches/gsoc_instrument/compilers/imcc/pbc.c
==============================================================================
--- branches/gsoc_instrument/compilers/imcc/pbc.c Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/compilers/imcc/pbc.c Sat Jun 19 16:17:11 2010 (r47715)
@@ -1507,7 +1507,7 @@
else
sub->ns_entry_name = sub->name;
- Parrot_store_sub_in_namespace(interp, sub_pmc);
+ Parrot_ns_store_sub(interp, sub_pmc);
/*
* store the sub's strings
Modified: branches/gsoc_instrument/compilers/pct/src/PAST/Compiler.pir
==============================================================================
--- branches/gsoc_instrument/compilers/pct/src/PAST/Compiler.pir Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/compilers/pct/src/PAST/Compiler.pir Sat Jun 19 16:17:11 2010 (r47715)
@@ -109,7 +109,7 @@
piropsig['shl'] = 'PP+'
piropsig['shr'] = 'PP+'
piropsig['sleep'] = 'v+'
- piropsig['splice'] = 'PPii'
+ piropsig['splice'] = '0PPii'
piropsig['split'] = 'Pss'
piropsig['sub'] = 'PP+'
piropsig['substr'] = 'Ssii'
Modified: branches/gsoc_instrument/compilers/pirc/src/bcgen.c
==============================================================================
--- branches/gsoc_instrument/compilers/pirc/src/bcgen.c Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/compilers/pirc/src/bcgen.c Sat Jun 19 16:17:11 2010 (r47715)
@@ -1271,7 +1271,7 @@
* XXX must this be done always? (this w.r.t. the recent discussion about :vtable/:method
* and being :anon etc.
*/
- Parrot_store_sub_in_namespace(bc->interp, sub_pmc);
+ Parrot_ns_store_sub(bc->interp, sub_pmc);
subconst_index = add_pmc_const(bc, sub_pmc);
/* Add a new fixup entry in the fixup table for this sub. */
Modified: branches/gsoc_instrument/config/gen/config_pm.pm
==============================================================================
--- branches/gsoc_instrument/config/gen/config_pm.pm Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/config/gen/config_pm.pm Sat Jun 19 16:17:11 2010 (r47715)
@@ -119,7 +119,11 @@
# String
$v =~ s/(["\\])/\\$1/g;
$v =~ s/\n/\\n/g;
- print {$OUT} qq( set \$P0["$k"], "$v"\n);
+ my $charset = q{};
+ if ($v =~ /[^[:ascii:]]/) {
+ $charset = 'binary:';
+ }
+ print {$OUT} qq( set \$P0["$k"], $charset"$v"\n);
}
else {
# Null
Modified: branches/gsoc_instrument/config/gen/makefiles/root.in
==============================================================================
--- branches/gsoc_instrument/config/gen/makefiles/root.in Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/config/gen/makefiles/root.in Sat Jun 19 16:17:11 2010 (r47715)
@@ -397,7 +397,7 @@
$(INC_DIR)/vtables.h \
$(INC_DIR)/multidispatch.h \
$(INC_DIR)/library.h \
- $(INC_DIR)/global.h \
+ $(INC_DIR)/namespace.h \
$(INC_DIR)/stat.h \
$(INC_DIR)/hll.h \
$(INC_DIR)/pbcversion.h \
@@ -458,7 +458,6 @@
src/gc/gc_inf$(O) \
src/gc/mark_sweep$(O) \
src/gc/system$(O) \
- src/global$(O) \
src/global_setup$(O) \
src/hash$(O) \
src/hll$(O) \
@@ -475,6 +474,7 @@
src/longopt$(O) \
src/misc$(O) \
src/multidispatch$(O) \
+ src/namespace$(O) \
src/frame_builder$(O) \
src/nci/api$(O) \
src/nci/core_thunks$(O) \
@@ -642,9 +642,10 @@
$(LIBRARY_DIR)/Configure/genfile.pbc: $(DYNEXT_DIR)/sys_ops$(LOAD_EXT)
-$(LIBRARY_DIR)/HTTP/Message.pbc: $(DYNEXT_DIR)/sys_ops$(LOAD_EXT)
+# Message.pbc and distutils.pbc load io_ops to work around TT #1663
+638 $(LIBRARY_DIR)/HTTP/Message.pbc: $(DYNEXT_DIR)/sys_ops$(LOAD_EXT) $(DYNEXT_DIR)/io_ops$(LOAD_EXT)
-$(LIBRARY_DIR)/distutils.pbc: $(DYNEXT_DIR)/sys_ops$(LOAD_EXT)
+$(LIBRARY_DIR)/distutils.pbc: $(DYNEXT_DIR)/sys_ops$(LOAD_EXT) $(DYNEXT_DIR)/io_ops$(LOAD_EXT)
$(LIBRARY_DIR)/pcre.pbc: $(DYNEXT_DIR)/sys_ops$(LOAD_EXT)
@@ -668,7 +669,6 @@
src/debug.str \
src/dynext.str \
src/exceptions.str \
- src/global.str \
src/global_setup.str \
src/hll.str \
src/call/pcc.str \
@@ -680,6 +680,7 @@
src/key.str \
src/library.str \
src/multidispatch.str \
+ src/namespace.str \
src/frame_builder.str \
src/nci/api.str \
src/nci/core_thunks.str \
@@ -1281,7 +1282,7 @@
src/global_setup$(O) : $(PARROT_H_HEADERS) src/global_setup.str src/global_setup.c
-src/global$(O) : $(PARROT_H_HEADERS) src/global.str src/global.c \
+src/namespace$(O) : $(PARROT_H_HEADERS) src/namespace.str src/namespace.c \
include/pmc/pmc_sub.h
src/pmc$(O) : include/pmc/pmc_class.h src/pmc.c \
@@ -1826,7 +1827,7 @@
manifest_tests :
$(PERL) t/harness $(MANIFEST_TEST_FILES)
-examples_tests :
+examples_tests : test_prep
$(PERL) t/harness $(EXAMPLES_TEST_FILES)
# benchmark tests
Modified: branches/gsoc_instrument/docs/book/pir/ch07_objects.pod
==============================================================================
--- branches/gsoc_instrument/docs/book/pir/ch07_objects.pod Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/docs/book/pir/ch07_objects.pod Sat Jun 19 16:17:11 2010 (r47715)
@@ -94,6 +94,53 @@
=end PIR_FRAGMENT
+=head2 Instantiation
+
+With a created class, we can use the C<new> opcode to instantiate an object of
+that class in the same way we can instantiate a new PMC.
+
+=begin PIR_FRAGMENT
+
+ $P0 = newclass "Foo"
+ $P1 = new $P0
+
+=end PIR_FRAGMENT
+
+Or, if we don't have the class object handy, we can do it by name too:
+
+=begin PIR_FRAGMENT
+
+ $P1 = new "Foo"
+
+=end PIR_FRAGMENT
+
+PMCs have two VTABLE interface functions for dealing with instantiating a new
+object: C<init> and C<init_pmc>. The former is called when a new PMC is
+created, the later is called when a new PMC is created with an initialization
+argument.
+
+=begin PIR
+
+ .namespace ["Foo"]
+ .sub 'init' :vtable
+ say "Creating a new Foo"
+ .end
+
+ .sub 'init_pmc' :vtable
+ .param pmc args
+ print "Creating a new Foo with argument "
+ say args
+ .end
+
+ .namespace[]
+ .sub 'main' :main
+ $P1 = new ['Foo'] # init
+ $P2 = new ['Foo'], $P1 # init_pmc
+ .end
+
+=end PIR
+
+
=head2 Methods
X<methods>
@@ -346,7 +393,7 @@
Classes defined in PIR using the C<newclass> opcode are instances of the
C<Class> PMCX<Class PMC>. This PMC contains all the meta-information for
the class, such as attribute definitions, methods, vtable overrides, and
-its inheritance hierarchy. The opcode C<inspect>X<inspect opcode>
+its inheritance hierarchy. The opcode C<inspect>X<inspect opcode>
provides a way to peek behind the curtain of encapsulation to see what
makes a class tick. When called with no arguments, C<inspect> returns an
associative array containing data on all characteristics of the class
Modified: branches/gsoc_instrument/docs/embed.pod
==============================================================================
--- branches/gsoc_instrument/docs/embed.pod Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/docs/embed.pod Sat Jun 19 16:17:11 2010 (r47715)
@@ -288,12 +288,12 @@
=over 4
-=item C<Parrot_PMC Parrot_find_global_cur(PARROT_INTERP, Parrot_String name)>
+=item C<Parrot_PMC Parrot_ns_find_current_namespace_global(PARROT_INTERP, Parrot_String name)>
Find and return a global called C<name> in the current namespace. Returns
C<PMCNULL> if not found.
-=item C<Parrot_PMC Parrot_find_global_n(PARROT_INTERP, PMC namespace, Parrot_String name)>
+=item C<Parrot_PMC Parrot_ns_find_namespace_global(PARROT_INTERP, PMC namespace, Parrot_String name)>
Search the namespace PMC C<namespace> for an object with name C<globalname>.
Return the object, or NULL if not found.
@@ -303,7 +303,7 @@
Find and return a global called C<name> in the namespace C<namespace>. Returns
C<PMCNULL> if not found.
-=item C<void Parrot_store_global_n(PARROT_INTERP, PMC namespace, Parrot_String name, Parrot_PMC val)>
+=item C<void Parrot_ns_store_global(PARROT_INTERP, PMC namespace, Parrot_String name, Parrot_PMC val)>
Store the PMC C<val> into the namespace PMC C<namespace> with name C<globalname>.
@@ -467,7 +467,7 @@
/* find the subroutine named "foo" in the global namespace */
pstr = string_from_literal(interp, "foo");
- sub = Parrot_find_global_cur(interp, pstr);
+ sub = Parrot_ns_find_current_namespace_global(interp, pstr);
/* run foo(), which returns nothing */
Parrot_ext_call(interp, sub, "->");
@@ -709,13 +709,13 @@
=item C<Parrot_find_encoding_converter>
-=item C<Parrot_find_global_cur>
+=item C<Parrot_ns_find_current_namespace_global>
=item C<Parrot_find_global_k>
-=item C<Parrot_find_global_n>
+=item C<Parrot_ns_find_namespace_global>
-=item C<Parrot_find_global_op>
+=item C<Parrot_ns_find_global_from_op>
=item C<Parrot_find_global_s>
@@ -725,7 +725,7 @@
=item C<Parrot_find_method_with_cache>
-=item C<Parrot_find_name_op>
+=item C<Parrot_ns_find_named_item>
=item C<Parrot_float_rand>
@@ -761,7 +761,7 @@
=item C<Parrot_get_encoding>
-=item C<Parrot_get_global>
+=item C<Parrot_ns_get_global>
=item C<Parrot_get_HLL_id>
@@ -775,9 +775,9 @@
=item C<Parrot_get_namespace_autobase>
-=item C<Parrot_get_namespace_keyed>
+=item C<Parrot_ns_get_namespace_keyed>
-=item C<Parrot_get_namespace_keyed_str>
+=item C<Parrot_ns_get_namespace_keyed_str>
=item C<Parrot_get_numreg>
@@ -949,11 +949,11 @@
=item C<Parrot_make_default_encoding>
-=item C<Parrot_make_namespace_autobase>
+=item C<Parrot_ns_make_namespace_autobase>
-=item C<Parrot_make_namespace_keyed>
+=item C<Parrot_ns_make_namespace_keyed>
-=item C<Parrot_make_namespace_keyed_str>
+=item C<Parrot_ns_make_namespace_keyed_str>
=item C<Parrot_mmd_cache_create>
@@ -1105,12 +1105,6 @@
=item C<Parrot_PMC_get_integer_keyed_str>
-=item C<Parrot_PMC_get_intval>
-
-=item C<Parrot_PMC_get_intval_intkey>
-
-=item C<Parrot_PMC_get_intval_pmckey>
-
=item C<Parrot_PMC_get_iter>
=item C<Parrot_PMC_get_namespace>
@@ -1503,7 +1497,7 @@
=item C<Parrot_set_flag>
-=item C<Parrot_set_global>
+=item C<Parrot_ns_set_global>
=item C<Parrot_set_intreg>
@@ -1533,11 +1527,11 @@
=item C<Parrot_srand>
-=item C<Parrot_store_global_n>
+=item C<Parrot_ns_store_global>
=item C<Parrot_store_global_s>
-=item C<Parrot_store_sub_in_namespace>
+=item C<Parrot_ns_store_sub>
=item C<Parrot_str_boolean>
Modified: branches/gsoc_instrument/docs/parrothist.pod
==============================================================================
--- branches/gsoc_instrument/docs/parrothist.pod Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/docs/parrothist.pod Sat Jun 19 16:17:11 2010 (r47715)
@@ -109,5 +109,6 @@
Gerd 2.3.0 * 2010-Apr-20 "Samoan Lory"
Whiteknight 2.4.0 2010-May-18 "Sulfer Crest"
+ Gerd 2.5.0 2010-Jun-15 "Cheops"
=cut
Modified: branches/gsoc_instrument/docs/pdds/draft/pdd06_pasm.pod
==============================================================================
--- branches/gsoc_instrument/docs/pdds/draft/pdd06_pasm.pod Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/docs/pdds/draft/pdd06_pasm.pod Sat Jun 19 16:17:11 2010 (r47715)
@@ -18,9 +18,7 @@
language for it for those people who may need to generate bytecode directly,
rather than indirectly through a high-level language.
-{{ NOTE: out-of-date and incomplete. It seems that it would be more
-useful as a specification of the format of PASM than as a comprehensive
-listing of all opcodes. }}
+{{ NOTE: out-of-date and incomplete. }}
=head2 Questions
@@ -84,7 +82,9 @@
PC.
All registers have a type prefix of P, S, I, or N, for PMC, string, integer,
-and number respectively.
+and number respectively. While parrot bytecode does not have a fixed limit
+on the number of registers, PASM has an implementation limit on the number of
+addressable registers of each type, currently set at 100 (0-99).
=head2 Assembly Syntax
@@ -158,7 +158,7 @@
=head2 Opcode List
-In the following list, there may be multiple (but unlisted) versions of an
+There may be multiple (but unlisted) versions of an
opcode. If an opcode takes a register that might be keyed, the keyed version
of the opcode has a _k suffix. If an opcode might take multiple types of
registers for a single parameter, the opcode function really has a _x suffix,
@@ -184,831 +184,7 @@
either a register or constant of the appropriate type (PMC, string, integer,
or number)
-=head3 Control flow
-
-The control flow opcodes check conditions and manage program flow.
-
-=over 4
-
-=item if tx, ix
-
-Check register tx. If true, branch by X.
-
-=item unless tx, ix
-
-Check register tx. If false, branch by X.
-
-=item jump tx
-
-Jump to the address held in register x (Px, Sx, or Ix).
-
-=item branch tx
-
-Branch forward or backward by the amount in register x. (X may be either Ix,
-Nx, or Px) Branch offset may also be an integer constant.
-
-=back
-
-=head3 Data manipulation
-
-These ops handle manipulating the data in registers
-
-=over 4
-
-=item new Px, iy
-
-Create a new PMC of class y stored in PMC register x.
-
-=item destroy Px
-
-Destroy the PMC in register X, leaving it undef
-
-=item set tx, ty
-
-Copies y into x. Note that strings and PMCs are referred to by pointer, so if
-you do something like:
-
- set S0, S1
-
-this will copy the pointer in S1 into S0, leaving B<both> registers pointing
-at the same string.
-
-=item exchange tx, ty
-
-Exchange the contents of registers X and Y, which must be of the same type.
-(Generally cheaper than using the stack as an intermediary when setting up
-registers for function calls)
-
-=item assign Px, ty
-
-Takes the contents of Y and assigns them into the existing PMC in X.
-
-While set just copies pointers from one register to another, assign actually
-does a value assignment, as:
-
- $foo = $bar;
-
-X's assign vtable function is invoked and it does whatever is appropriate.
-
-=item clone Px, Py
-
-=item clone Sx, xy
-
-Performs a "deeper" copy of y into x, using the vtable appropriate to the
-class of Py if cloning a PMC.
-
-=item tostring Sx, ty, Iz
-
-Take the value in register y and convert it to a string of type z, storing the
-result in string register x.
-
-=item add tx, ty, tz *
-
-Add registers y and z and store the result in register x. (x = y + z) The
-registers must all be the same type, PMC, integer, or number.
-
-=item sub tx, ty, tz *
-
-Subtract register z from register y and store the result in register x. (x = y
-- z) The registers must all be the same type, PMC, integer, or number.
-
-=item mul tx, ty, tz *
-
-Multiply register y by register z and store the results in register x. The
-registers must be the same type.
-
-=item div tx, ty, tz *
-
-Divide register y by register z, and store the result in register x.
-
-=item inc tx, nn *
-
-Increment register x by nn. nn is an integer constant. If nn is omitted,
-increment is 1.
-
-=item dec tx, nn *
-
-Decrement register x by nn. nn is an integer constant. If nn is omitted,
-decrement by 1.
-
-=item length Ix, Sy
-
-Put the length of string y into integer register x.
-
-=item concat Sx, Sy
-
-Add string y to the end of string x.
-
-=item repeat Sx, Sy, iz
-
-Copies string y z times into string x.
-
-=back
-
-=head3 Transcendental operations
-
-These opcodes handle the transcendental math functions. The destination
-register here must always be either a numeric or a PMC register.
-
-=over 4
-
-=item sin nx, ty
-
-Return the sine of the number in Y
-
-=item cos nx, ty
-
-Return the cosine of the number in Y
-
-=item tan nx, ty
-
-Return the tangent of the number in Y
-
-=item sec nx, ty
-
-Return the secant of the number in Y
-
-=item atan nx, ty
-
-Return the arctangent of Y
-
-=item atan2 nx, ty
-
-Return the result of atan2 of Y
-
-=item asin nx, ty
-
-Return the arcsine of y
-
-=item acos nx, ty
-
-Return the arccosine of y
-
-=item asec nx, ty
-
-Return the arcsecant of y
-
-=item cosh nx, ty
-
-Return the hyperbolic cosine of y
-
-=item sinh nx, ty
-
-Return the hyperbolic sine of y
-
-=item tanh nx, ty
-
-Return the hyperbolic tangent of y
-
-=item sech nx, ty
-
-Return the hyperbolic secant of y
-
-=item log2 nx, ty
-
-Return the base 2 log of y
-
-=item log10 nx, ty
-
-Return the base 10 log of y
-
-=item ln Nx, ty
-
-Return the base e log of y
-
-=item log nx, ty, tz
-
-Return the base Z log of Y
-
-=item pow nx, ty, tz
-
-Return Y to the Z power
-
-=item exp nx, ty
-
-Return e to the Y power
-
-=back
-
-=head3 Register and stack ops
-
-These opcodes deal with registers and stacks
-
-=over 4
-
-=item clearp
-
-Clean out the current set of PMC registers, setting them to NULL
-
-=item cleari
-
-Clean out the current set of I registers, setting them to 0
-
-=item clears
-
-Clean out the current set of S registers, setting them to NULL
-
-=item clearn
-
-Clean out the current set of N registers, setting them to 0
-
-=item null tx
-
-Set register X to a null value; for S and P registers, this will be NULL,
-while for I and N registers it is 0
-
-=item save tx
-
-Push register or constant X onto the generic stack
-
-=item restore tx
-
-Restore register X from the generic stack by popping off the topmost entry.
-The type of this entry must match the register type.
-
-=item entrytype Ix, iy
-
-Put the type of generic stack entry Y into integer register X
-
-=item depth Ix
-
-Get the current depth of the generic stack
-
-=item lookback tx, iy
-
-Fetch the entry that's at position Y from the top of the generic stack. This
-does not remove an entry from the stack, merely fetches the entry off it.
-
-0 is the entry at the top of the stack, 1 is the entry immediately previous to
-that, and so on. Entry -1 is the very bottom-most entry in the stack. (While
-the stack may be a tree when looked at from the bottom up, you don't have
-access to any other branches when looking this way).
-
-=back
-
-=head3 Names, pads, and globals
-
-These operations are responsible for finding names in lexical or global
-scopes, as well as storing data into those slots. A static scope is captured
-by a scratchpad. The current dynamic scope is represented by the state of the
-lexical stack (which contains scratchpads). For more detail on these ops see
-the inline POD documentation in F<ops/var.ops>.
-
-=over 4
-
-=item store_lex sx, Py
-
-=item find_lex Px, sy
-
-Instructions for storing in, and retrieving from, the scratchpad associated
-with the current context.
-
-=item find_global Px, sy, sz
-
-Find the PMC for the global variable sy from the table sz and store it in
-register X
-
-{{ DEPRECATED: op find_global was deprecated }}
-
-=item find_global Px, sy
-
-Find the PMC for the global in the default table and put it in X.
-
-{{ DEPRECATED: op find_global was deprecated }}
-
-=item find_global_table Px, sy
-
-Find the global symbol table Y and store its PMC in X
-
-=item find_global_slot ix, Py, sz
-
-Find the slot in the global table Y for the global named Z, and store its slot
-in register X.
-
-=item fetch_global Px, Py, iz
-
-Fetch the global in slot Z of the symbol table pointed to by Y
-
-=item store_global Px, sy
-
-Store X in the default global symbol table with a name of Y.
-
-{{ DEPRECATED: op store_global was deprecated }}
-
-=back
-
-=head3 Exceptions
-
-These opcodes deal with exception handling at the lowest level. Exception
-handlers are dynamically scoped, and any exception handler set in a scope will
-be removed when that scope is exited.
-
-=over 4
-
-=item set_eh Px
-
-Sets an exception handler in place. The code referred to by register Px will
-get called if an exception is thrown while the exception handler is in scope.
-
-=item pop_eh
-
-Pop the most recently placed exception off the handler stack.
-
-=item throw Px
-
-Throw an exception represented by the object in PMC register x.
-
-=item rethrow Px
-
-Only valid inside an exception handler. Rethrow the exception represented by
-the object in PMC register x. This object may have been altered by the
-exception handler.
-
-=back
-
-=head3 Object things
-
-These opcodes deal with PMCs as objects, rather than as opaque data items.
-
-=over 4
-
-=item find_method Px, Py, tz
-
-Find the method Z for object Y, and return a PMC for it in X.
-
-=item callmethod Px, ty
-
-=item set_attribute Px, ty, tz
-
-=item can Ix, Py, sz
-
-Sets X to TRUE if object Y can perform method Z; otherwise, X is set to FALSE.
-
-=item does Ix, Py, sz
-
-Sets X to TRUE if object Y can implements interface Z; otherwise, X is set to
-FALSE.
-
-=item isa Px, ty
-
-=back
-
-=head3 Module handling
-
-These opcodes deal with loading in bytecode or executable code libraries, and
-fetching info about those libraries. This is all dealing with precompiled
-bytecode or shared libraries.
-
-=over 4
-
-=item load_bytecode sx
-
-Load in the bytecode in file X. Search the library path if need be.
-
-=item load_opcode_lib sx, iy
-
-Load in the opcode library X, starting at opcode number Y. Search the path if
-needed.
-
-=item load_string_lib sx
-
-Load in the string handling library named X
-
-=item get_op_count sx
-
-Return the number of opcodes in opcode library X
-
-=item get_string_name sx
-
-Get the name of the string encoding that the library X handles
-
-=item find_string_lib sx, sy
-
-Find the string library that handles strings of type Y. Return its name in X.
-
-=back
-
-=head3 I/O operations
-
-Reads and writes read and write records, for some value of record.
-
-=over 4
-
-=item new_fh px
-
-Create a new filehandle px
-
-=item open px, sy
-
-Open the file Y on filehandle X
-
-=item read px, py, pz
-
-Issue a read on the filehandle in y, and put the result in PMC X. PMC Z is the
-sync object.
-
-=item write px, sy, pz
-
-Write the string Y to filehandle X. PMC Z is the sync object.
-
-=item wait px
-
-Wait for the I/O operation represented by sync object X to finish
-
-=item readw px, py
-
-Read from filehandle Y and put the results in PMC X. Blocks until the read
-completes.
-
-=item writew px, sy
-
-Write string Y to filehandle X, waiting for the write to complete.
-
-=item seek px, ty
-
-Seek filehandle X to position Y.
-
-=item tell tx, py
-
-Return the current position of filehandle Y and put it in X. Returns -1 for
-filehandles where this can't be determined. (Such as stream connections)
-
-=item status px, py, tz
-
-Get informational item Z for filehandle Y and put the result in X. This
-fetches things like the number of entries in the IO pipe, number of
-outstanding I/O ops, number of ops on the filehandle, and so forth.
-
-=back
-
-=head3 Threading ops
-
-=over 4
-
-=item lock Px
-
-Take out a high-level lock on the PMC in register X
-
-=item unlock Px
-
-Unlock the PMC in register X
-
-=item pushunlock Px
-
-Push an unlock request on the stack
-
-=back
-
-=head3 Interpreter ops
-
-=over 4
-
-=item newinterp Px, flags
-
-Create a new interpreter in X, using the passed flags.
-
-=item runinterp Px, iy
-
-Jump into interpreter X and run the code starting at offset Y from the current
-location. (This is temporary until we get something better)
-
-=item callout Pw, Px, sy, pz
-
-Call routine Y in interpreter x, passing it the list of parameters Z. W is a
-synchronization object returned. It can be waited on like the sync objects
-returned from async I/O routines.
-
-=item interpinfo Ix, iy
-
-Get information item Y and put it in register X. Currently defined are:
-
-=over 4
-
-=item 1 TOTAL_MEM_ALLOC
-
-The total amount of system memory allocated for later parceling out to
-Buffers. Doesn't include any housekeeping memory, memory for Buffer or PMC
-structs, or things of that nature.
-
-=item 2 GC_MARK_RUNS
-
-The total number of garbage collection mark runs that have been made.
-
-=item 3 GC_COLLECT_RUNS
-
-The total number of garbage collection sweep runs that have been made.
-
-=item 4 ACTIVE_PMCS
-
-The number of PMCs considered active. This means the GC scan hasn't noted
-them as dead.
-
-=item 5 ACTIVE_BUFFERS
-
-The number of Buffers (usually STRINGs but could be other things) considered
-active.
-
-=item 6 TOTAL_PMCS
-
-The total number of PMCs the interpreter has available. Includes both active
-and free PMCs
-
-=item 7 TOTAL_BUFFERS
-
-The total number of Buffer structs the interpreter has available.
-
-=item 8 HEADERS_ALLOC_SINCE_COLLECT
-
-The number of new Buffer header block allocations that have been made since
-the last GC mark run. (Buffers, when allocated, are allocated in chunks)
-
-=item 9 MEM_ALLOCS_SINCE_COLLECT
-
-The number of times we've requested a block of memory from the system for
-allocation to Buffers since the last time we compacted the memory heap.
-
-=back
-
-=back
-
-=head3 Garbage collection
-
-=over 4
-
-=item sweep
-
-Fire off a dead object sweep
-
-=item collect
-
-Fire off a garbage collection sweep
-
-=item pausecollect
-
-Pause the garbage collector. No collections will be done for this interpreter
-until the collector is unpaused.
-
-=item resumecollect
-
-Unpause the collector. This doesn't necessarily do a GC run, merely allows the
-interpreter to fire one off when it deems it necessary.
-
-=back
-
-=head3 Key operations
-
-Keys are used to get access to individual elements of an aggregate variable.
-This is done to allow for opaque, packed, and multidimensional aggregate
-types.
-
-A key entry may be an integer, string, or PMC. Integers are used for array
-lookups, strings for hash lookups, and PMCs for either.
-
-=over 4
-
-=item new_key Sx
-
-Create a new key structure and put a pointer to it in register X.
-
-=item clone_key Sx, ky
-
-Make a copy of the key Y and put a pointer to it in register X. Y may be
-either an S register or a constant.
-
-=item size_key Sx, iy
-
-Make the key structure X large enough to hold Y key entries
-
-=item key_size Ix, ky
-
-Put the number of elements in key Y into integer register X.
-
-=item toss_key Sx
-
-Nuke key X. Throws the structure away and invalidates the register.
-
-=item ke_type Ix, ky, iz
-
-Put the type of key Y's entry Z in register X. Current values are 0, 1, and 2
-for Integer, String, and PMC, respectively.
-
-=item ke_value tx, ky, iz
-
-Put the value from key Y, entry Z into register X.
-
-=item chop_key Sx
-
-Toss the topmost entry from key X.
-
-=item inc_key Sx, iy
-
-Increment entry Y of key X by one.
-
-=item set_key Sw, [isp]x, iy[, iz]
-
-Set key W, offset Y, to value X. If X is a PMC, then the fourth operand must
-be specified. It can have a value of 0, 1, or 2, corresponding to integer,
-string, or object. Aggregates use this to figure out how to treat the key
-entry.
-
-=back
-
-=head3 Properties
-
-Properties are a sort of runtime note attached to a PMC. Any PMC can have
-properties on it. Properties live in a flat namespace, and they are not in any
-way associated with the class of the PMC that they are attached to.
-
-Properties may be used for runtime notes on variables, or other metadata that
-may change. They are not for object attributes.
-
-=over 4
-
-=item setprop Px, sy, Pz
-
-Set the property named Y of PMC X to the PMC in Z
-
-=item getprop Px, sy, Pz
-
-Get the property named Y from PMC Z and put the result in register X. Returns
-a NULL if the property doesn't exist.
-
-=item delprop Px, sy
-
-Delete the property Y from PMC X
-
-=item prophash Px, Py
-
-Fetch the properties from Y, put them in a Hash, and put the Hash in X.
-
-=back
-
-=head3 Symbolic support for HLLs
-
-=over 4
-
-=item setline ix
-
-Sets the 'current line' marker.
-
-=item setfile sx
-
-Sets the 'current file' marker.
-
-=item setpackage sx
-
-Sets the 'current package' marker.
-
-=item getline ix
-
-Fetches the 'current line' marker.
-
-=item getfile sx
-
-Fetches the 'current file' marker.
-
-=item getpackage sx
-
-Fetches the 'current package' marker.
-
-=back
-
-=head3 Foreign library access
-
-These are the ops we use to load in and interface to non-parrot libraries.
-
-=over 4
-
-=item loadlib Px, Sy
-
-Load in the library whose name is specified by y, and put a handle to it into
-P register x.
-
-=item dlfunc Pw, Px, Sy, Sz
-
-Find a routine named Y, in library X (which you did, of course, open with
-loadlib), and put a sub PMC onto W for it. You can call this sub as if it were
-any other parrot subroutine.
-
-Z has the function signature, which tells Parrot how to build the interface
-from parrot (and parrot's calling conventions) to the calling conventions of
-the library routine. Yes, this does mean that you must know the function
-signature, but if you don't know that why the heck would you be invoking the
-function, right?
-
-The signature is a series of 1 or more characters, representing the types for
-the call. The first character is the return type, while the rest are the
-parameters. The types are:
-
-=over 4
-
-=item v
-
-Void. As a return type indicates that there I<is> no return type. As a
-parameter indicates that there are no parameters. Can't be mixed with other
-parameter types.
-
-=item c
-
-Char. This is an integer type, taken from (or put into) an I register.
-
-=item s
-
-short. An integer type, taken from 0 or put into an I register
-
-=item i
-
-int. An integer type.
-
-=item l
-
-long. An integer type. You know the drill.
-
-=item f
-
-float. F register denizen.
-
-=item d
-
-double. F register, double-precision floating point type
-
-=item p
-
-PMC thingie. A generic pointer, taken from or stuck into a PMC's data pointer.
-If this is a return type, parrot will create a new UnManagedStruct PMC type,
-which is just a generic "pointer so some damn thing or other" PMC type which
-Parrot does I<no> management of.
-
-=item t
-
-string pointer. Taken from, or stuck into, a string register. (Converted to a
-null-terminated C string before passing in)
-
-=back
-
-So the signature for, for example, this SDL routine:
-
- int SDL_BlitSurface(SDL_Surface *src,
- SDL_Rect *srcrect,
- SDL_Surface *dst,
- SDL_Rect *dstrect);
-
-would be C<ipppp>, since it returns an integer and takes four pointers.
-Presumably previous calls would have set those pointers up properly.
-
-Do note that parrot makes no guarantees as to the behaviour of the libraries,
-and currently does no type checking on the input parameters. We will fix that
-later.
-
-The generated routine follows the calling conventions in PDD03. Note that int,
-string, pmc, and float parameters are counted separately. So if you have a
-signature of C<ippiidd> the return goes into I5, and the parameters come from
-P5, P6, I5, I6, N5, and N6, respectively. A signature of C<ipdiidp> has the
-identical same set of registers used (and in the same order).
-
-=item invoke
-
-Invoke a subroutine in P0. Presumes that all the registers are set up right
-for the call. The invoked subroutine I<must> preserve any registers that are
-not explicitly return parameters or calling convention metadata parameters.
-(Such as the number of I reg parameters, for example)
-
-=back
-
-=head3 Runtime compilation
-
-These opcodes deal with runtime creation of bytecode and compilation of source
-code.
-
-=over 4
-
-=item compile Px, Py, Sz
-
-Compile source string Z, with compiler unit Y, and stick a handle to a
-subroutine for the resulting bytecode segment (already loaded into the current
-interpreter) into X.
-
-Y is a assembler/compiler object of some sort, as registered with the
-B<compreg> opcode or the Parrot_compreg function. This will be something like
-"Perl5", "Perl6", "Perl5RE", "Perl6RE", "Python", "Ruby"... you get the
-picture.
-
-Imcc registers "PASM" and "PIR" compilers automatically.
-
-This is a high-level op, with the assumption that the resulting sub will be
-called. It's the equivalent of perl 5's string eval, except for the actual
-execution of the resulting code.
-
-=item compreg Px, Sy
-
-Get a compiler for source type Y.
-
-=item compreg Sx, Py
-
-Register the sub Y as a parser/compiler function named X. It will be called
-whenever anyone invokes the compile op with the name X.
-
-=back
+L<docs/ops> for a list of current parrot opcodes,
=head2 References
Modified: branches/gsoc_instrument/docs/pdds/draft/pdd11_extending.pod
==============================================================================
--- branches/gsoc_instrument/docs/pdds/draft/pdd11_extending.pod Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/docs/pdds/draft/pdd11_extending.pod Sat Jun 19 16:17:11 2010 (r47715)
@@ -73,13 +73,13 @@
A keyed version of C<Parrot_PMC_get_pointer>. Returns the pointer value of
whatever is stored at the element of the PMC indexed by C<key>.
-=item C<Parrot_PMC_get_intval(interp, pmc)>
+=item C<Parrot_PMC_get_integer(interp, pmc)>
Returns the integer value of the PMC.
-=item C<Parrot_PMC_get_intval_intkey(interp, pmc, Parrot_Int key)>
+=item C<Parrot_PMC_get_integer_keyed_int(interp, pmc, Parrot_Int key)>
-A keyed version of C<Parrot_PMC_get_intval>. Returns the integer value of
+A keyed version of C<Parrot_PMC_get_integer>. Returns the integer value of
whatever is stored at the element of the PMC indexed by C<key>.
=item C<Parrot_PMC_get_numval(interp, pmc)>
Modified: branches/gsoc_instrument/docs/pdds/pdd28_strings.pod
==============================================================================
--- branches/gsoc_instrument/docs/pdds/pdd28_strings.pod Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/docs/pdds/pdd28_strings.pod Sat Jun 19 16:17:11 2010 (r47715)
@@ -583,7 +583,7 @@
=head4 string_make
A crippled version of a string initializer, now replaced with the full version
-C<Parrot_string_new_init>.
+C<Parrot_str_new_init>.
=head4 string_capacity
Modified: branches/gsoc_instrument/docs/project/release_manager_guide.pod
==============================================================================
--- branches/gsoc_instrument/docs/project/release_manager_guide.pod Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/docs/project/release_manager_guide.pod Sat Jun 19 16:17:11 2010 (r47715)
@@ -118,10 +118,23 @@
=item f
+In the two files F<src/ops/core_ops.c> and F<include/parrot/oplib/core_ops.h>
+is the function C<Parrot_DynOp_core_a_b_c>, which has a name that includes
+the version number. a_b_c is the version number. You have to update this
+version number on two places in the file F<src/ops/core_ops.c>.
+In the file F<include/parrot/oplib/core_ops.h> you have to change this line:
+
+ op_lib_t *Parrot_DynOp_core_a_b_c(PARROT_INTERP, long init);
+
+Ignore the warning to not edit this files. It is necessary to edit this files,
+so that "make" builds with the increased version number.
+
+=item g
+
Configure parrot and run C<make distro_tests>, and either fix
what those tests complain about, or fix them so they don't complain.
-=item g
+=item h
If this is a developer release, or there have been no new entries to the
F<PBC_COMPAT> file, skip this step.
@@ -142,7 +155,7 @@
built for this to work, and that this script will reconfigure and rebuild
Parrot with various primitive size options.
-=item h
+=item i
Make sure everything works:
@@ -394,7 +407,6 @@
visible at
L<http://www.google.com/calendar/render?cid=ldhctdamsgfg5a1cord52po9h8@group.calendar.google.com>.
- - Jun 15, 2010 - 2.5 - gerd
- Jul 20, 2010 - 2.6* - coke
- Aug 17, 2010 - 2.7 - ??
- Sep 21, 2010 - 2.8 - gerd
Modified: branches/gsoc_instrument/examples/io/http.pir
==============================================================================
--- branches/gsoc_instrument/examples/io/http.pir Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/examples/io/http.pir Sat Jun 19 16:17:11 2010 (r47715)
@@ -13,9 +13,7 @@
HTTP client, connects to WWW port and grabs a page (L<http://www.ibm.com>).
-You should be running the echo service on your box (port 7). Be sure to
-set C<PARROT_NET_DEVEL> to 1 in F<io/io_private.h> and rebuld Parrot or
-the network layer won't exist.
+You should be running the echo service on your box (port 7).
=cut
Modified: branches/gsoc_instrument/examples/io/httpd.pir
==============================================================================
--- branches/gsoc_instrument/examples/io/httpd.pir Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/examples/io/httpd.pir Sat Jun 19 16:17:11 2010 (r47715)
@@ -270,7 +270,6 @@
ERR_NO_SOCKET:
print "Could not open socket.\n"
- print "Did you enable PARROT_NET_DEVEL in include/io_private.h?\n"
end
ERR_bind:
print "bind failed\n"
Modified: branches/gsoc_instrument/examples/pir/make_hello_pbc.pir
==============================================================================
--- branches/gsoc_instrument/examples/pir/make_hello_pbc.pir Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/examples/pir/make_hello_pbc.pir Sat Jun 19 16:17:11 2010 (r47715)
@@ -78,7 +78,7 @@
$P1 = new 'PackfileFixupEntry'
$P1 = 'hello'
- $P1.'set_type'(2)
+ $P1.'set_type'(1)
$P1 = 5 # offset
pffixup[0] = $P1
Modified: branches/gsoc_instrument/ext/Parrot-Embed/lib/Parrot/Embed.xs
==============================================================================
--- branches/gsoc_instrument/ext/Parrot-Embed/lib/Parrot/Embed.xs Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/ext/Parrot-Embed/lib/Parrot/Embed.xs Sat Jun 19 16:17:11 2010 (r47715)
@@ -153,26 +153,26 @@
ns_str += 2;
if (!ns)
- ns = Parrot_find_global_cur(real_interp,
+ ns = Parrot_ns_find_current_namespace_global(real_interp,
Parrot_str_new_constant(real_interp, prev));
else
- ns = Parrot_find_global_n(real_interp, ns,
+ ns = Parrot_ns_find_namespace_global(real_interp, ns,
Parrot_str_new_constant(real_interp, prev));
prev = ns_str;
}
if (!ns)
- ns = Parrot_find_global_cur(real_interp,
+ ns = Parrot_ns_find_current_namespace_global(real_interp,
Parrot_str_new_constant(real_interp, prev));
else
- ns = Parrot_find_global_n(real_interp, ns,
+ ns = Parrot_ns_find_namespace_global(real_interp, ns,
Parrot_str_new_constant(real_interp, prev));
- pmc = Parrot_find_global_n(real_interp, ns, p_global);
+ pmc = Parrot_ns_find_namespace_global(real_interp, ns, p_global);
Safefree(ns_copy);
}
else
- pmc = Parrot_find_global_cur( real_interp, p_global );
+ pmc = Parrot_ns_find_current_namespace_global( real_interp, p_global );
RETVAL = make_pmc( aTHX_ ST(0), pmc );
OUTPUT:
Modified: branches/gsoc_instrument/ext/nqp-rx/src/stage0/nqp-setting.nqp
==============================================================================
--- branches/gsoc_instrument/ext/nqp-rx/src/stage0/nqp-setting.nqp Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/ext/nqp-rx/src/stage0/nqp-setting.nqp Sat Jun 19 16:17:11 2010 (r47715)
@@ -210,11 +210,11 @@
=begin item slurp
Returns the contents of C<$filename> as a single string.
-=end
+=end item
our sub slurp ($filename) {
- my $handle := FileHandle.new();
- $handle.open($file, 'r');
+ my $handle := pir::new__Ps('FileHandle');
+ $handle.open($filename, 'r');
my $contents := $handle.readall;
$handle.close();
$contents;
@@ -226,7 +226,7 @@
=end item
our sub spew($filename, $contents) {
- my $handle := FileHandle.new();
+ my $handle := pir::new__Ps('FileHandle');
$handle.open($filename, 'w');
$handle.print($contents);
$handle.close();
Deleted: branches/gsoc_instrument/include/parrot/global.h
==============================================================================
--- branches/gsoc_instrument/include/parrot/global.h Sat Jun 19 16:17:11 2010 (r47714)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,204 +0,0 @@
-/* global.h
- * Copyright (C) 2004, Parrot Foundation.
- * SVN Info
- * $Id$
- * Overview:
- * Contains accessor functions for globals
- * Data Structure and Algorithms:
- * History:
- * Notes:
- * References:
- */
-
-#ifndef PARROT_GLOBAL_H_GUARD
-#define PARROT_GLOBAL_H_GUARD
-
-/* HEADERIZER BEGIN: src/global.c */
-/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC * Parrot_find_global_cur(PARROT_INTERP,
- ARGIN_NULLOK(STRING *globalname))
- __attribute__nonnull__(1);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC * Parrot_find_global_n(PARROT_INTERP,
- ARGIN_NULLOK(PMC *ns),
- ARGIN_NULLOK(STRING *globalname))
- __attribute__nonnull__(1);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-PMC * Parrot_find_global_op(PARROT_INTERP,
- ARGIN(PMC *ns),
- ARGIN_NULLOK(STRING *globalname),
- ARGIN_NULLOK(void *next))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC * Parrot_find_global_s(PARROT_INTERP,
- ARGIN_NULLOK(STRING *str_key),
- ARGIN_NULLOK(STRING *globalname))
- __attribute__nonnull__(1);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC * Parrot_find_name_op(PARROT_INTERP,
- ARGIN(STRING *name),
- SHIM(void *next))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC * Parrot_get_global(PARROT_INTERP,
- ARGIN_NULLOK(PMC *ns),
- ARGIN_NULLOK(STRING *globalname))
- __attribute__nonnull__(1);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC * Parrot_get_namespace_keyed(PARROT_INTERP,
- ARGIN(PMC *base_ns),
- ARGIN(PMC *pmc_key))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC * Parrot_get_namespace_keyed_str(PARROT_INTERP,
- ARGIN(PMC *base_ns),
- ARGIN_NULLOK(STRING *str_key))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC * Parrot_make_namespace_autobase(PARROT_INTERP, ARGIN_NULLOK(PMC *key))
- __attribute__nonnull__(1);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC * Parrot_make_namespace_keyed(PARROT_INTERP,
- ARGIN(PMC *base_ns),
- ARGIN(PMC *pmc_key))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC * Parrot_make_namespace_keyed_str(PARROT_INTERP,
- ARGIN(PMC *base_ns),
- ARGIN(STRING *str_key))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC * Parrot_ns_get_name(PARROT_INTERP, ARGIN(PMC *_namespace))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
-PARROT_EXPORT
-void Parrot_set_global(PARROT_INTERP,
- ARGIN_NULLOK(PMC *ns),
- ARGIN_NULLOK(STRING *globalname),
- ARGIN_NULLOK(PMC *val))
- __attribute__nonnull__(1);
-
-PARROT_EXPORT
-void Parrot_store_global_n(PARROT_INTERP,
- ARGIN_NULLOK(PMC *ns),
- ARGIN_NULLOK(STRING *globalname),
- ARGIN_NULLOK(PMC *val))
- __attribute__nonnull__(1);
-
-PARROT_EXPORT
-void Parrot_store_global_s(PARROT_INTERP,
- ARGIN_NULLOK(STRING *str_key),
- ARGIN_NULLOK(STRING *globalname),
- ARGIN_NULLOK(PMC *val))
- __attribute__nonnull__(1);
-
-PARROT_EXPORT
-void Parrot_store_sub_in_namespace(PARROT_INTERP, ARGIN(PMC *sub_pmc))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
-#define ASSERT_ARGS_Parrot_find_global_cur __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_Parrot_find_global_n __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_Parrot_find_global_op __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(ns))
-#define ASSERT_ARGS_Parrot_find_global_s __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_Parrot_find_name_op __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(name))
-#define ASSERT_ARGS_Parrot_get_global __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_Parrot_get_namespace_keyed __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(base_ns) \
- , PARROT_ASSERT_ARG(pmc_key))
-#define ASSERT_ARGS_Parrot_get_namespace_keyed_str \
- __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(base_ns))
-#define ASSERT_ARGS_Parrot_make_namespace_autobase \
- __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_Parrot_make_namespace_keyed __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(base_ns) \
- , PARROT_ASSERT_ARG(pmc_key))
-#define ASSERT_ARGS_Parrot_make_namespace_keyed_str \
- __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(base_ns) \
- , PARROT_ASSERT_ARG(str_key))
-#define ASSERT_ARGS_Parrot_ns_get_name __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(_namespace))
-#define ASSERT_ARGS_Parrot_set_global __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_Parrot_store_global_n __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_Parrot_store_global_s __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_Parrot_store_sub_in_namespace __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(sub_pmc))
-/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
-/* HEADERIZER END: src/global.c */
-
-#endif /* PARROT_GLOBAL_H_GUARD */
-
-/*
- * Local variables:
- * c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */
-
Modified: branches/gsoc_instrument/include/parrot/interpreter.h
==============================================================================
--- branches/gsoc_instrument/include/parrot/interpreter.h Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/include/parrot/interpreter.h Sat Jun 19 16:17:11 2010 (r47715)
@@ -24,7 +24,7 @@
PARROT_IS_THREAD = 0x1000, /* interpreter is a thread */
PARROT_THR_COPY_INTERP = 0x2000, /* thread start copies interp state */
- PARROT_THR_THREAD_POOL = 0x4000, /* type3 threads */
+ PARROT_THR_THREAD_POOL = 0x4000 /* type3 threads */
} Parrot_Interp_flag;
/* &end_gen */
Modified: branches/gsoc_instrument/include/parrot/key.h
==============================================================================
--- branches/gsoc_instrument/include/parrot/key.h Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/include/parrot/key.h Sat Jun 19 16:17:11 2010 (r47715)
@@ -88,13 +88,6 @@
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
PARROT_WARN_UNUSED_RESULT
-PMC * key_new_pmc(PARROT_INTERP, ARGIN(PMC *value))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
-PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
-PARROT_WARN_UNUSED_RESULT
PMC * key_new_string(PARROT_INTERP, ARGIN(STRING *value))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
@@ -132,13 +125,6 @@
FUNC_MODIFIES(*key);
PARROT_EXPORT
-void key_set_pmc(PARROT_INTERP, ARGMOD(PMC *key), ARGIN(PMC *value))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3)
- FUNC_MODIFIES(*key);
-
-PARROT_EXPORT
void key_set_register(PARROT_INTERP,
ARGMOD(PMC *key),
INTVAL value,
@@ -190,9 +176,6 @@
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_key_new_number __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_key_new_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(value))
#define ASSERT_ARGS_key_new_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(value))
@@ -211,10 +194,6 @@
#define ASSERT_ARGS_key_set_number __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(key))
-#define ASSERT_ARGS_key_set_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(key) \
- , PARROT_ASSERT_ARG(value))
#define ASSERT_ARGS_key_set_register __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(key))
Copied: branches/gsoc_instrument/include/parrot/namespace.h (from r47713, trunk/include/parrot/namespace.h)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/gsoc_instrument/include/parrot/namespace.h Sat Jun 19 16:17:11 2010 (r47715, copy of r47713, trunk/include/parrot/namespace.h)
@@ -0,0 +1,208 @@
+/* namespace.h
+ * Copyright (C) 2004-2010, Parrot Foundation.
+ * SVN Info
+ * $Id$
+ * Overview:
+ * Contains accessor functions for globals
+ * Data Structure and Algorithms:
+ * History:
+ * Notes:
+ * References:
+ */
+
+#ifndef PARROT_GLOBAL_H_GUARD
+#define PARROT_GLOBAL_H_GUARD
+
+/* HEADERIZER BEGIN: src/namespace.c */
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC * Parrot_find_global_s(PARROT_INTERP,
+ ARGIN_NULLOK(STRING *str_key),
+ ARGIN_NULLOK(STRING *globalname))
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC * Parrot_ns_find_current_namespace_global(PARROT_INTERP,
+ ARGIN_NULLOK(STRING *globalname))
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CANNOT_RETURN_NULL
+PMC * Parrot_ns_find_global_from_op(PARROT_INTERP,
+ ARGIN(PMC *ns),
+ ARGIN_NULLOK(STRING *globalname),
+ ARGIN_NULLOK(void *next))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC * Parrot_ns_find_named_item(PARROT_INTERP,
+ ARGIN(STRING *name),
+ SHIM(void *next))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC * Parrot_ns_find_namespace_global(PARROT_INTERP,
+ ARGIN_NULLOK(PMC *ns),
+ ARGIN_NULLOK(STRING *globalname))
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC * Parrot_ns_get_global(PARROT_INTERP,
+ ARGIN_NULLOK(PMC *ns),
+ ARGIN_NULLOK(STRING *globalname))
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC * Parrot_ns_get_name(PARROT_INTERP, ARGIN(PMC *_namespace))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC * Parrot_ns_get_namespace_keyed(PARROT_INTERP,
+ ARGIN(PMC *base_ns),
+ ARGIN(PMC *pmc_key))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC * Parrot_ns_get_namespace_keyed_str(PARROT_INTERP,
+ ARGIN(PMC *base_ns),
+ ARGIN_NULLOK(STRING *str_key))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC * Parrot_ns_make_namespace_autobase(PARROT_INTERP,
+ ARGIN_NULLOK(PMC *key))
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC * Parrot_ns_make_namespace_keyed(PARROT_INTERP,
+ ARGIN(PMC *base_ns),
+ ARGIN(PMC *pmc_key))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC * Parrot_ns_make_namespace_keyed_str(PARROT_INTERP,
+ ARGIN(PMC *base_ns),
+ ARGIN(STRING *str_key))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
+PARROT_EXPORT
+void Parrot_ns_set_global(PARROT_INTERP,
+ ARGIN_NULLOK(PMC *ns),
+ ARGIN_NULLOK(STRING *globalname),
+ ARGIN_NULLOK(PMC *val))
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
+void Parrot_ns_store_global(PARROT_INTERP,
+ ARGIN_NULLOK(PMC *ns),
+ ARGIN_NULLOK(STRING *globalname),
+ ARGIN_NULLOK(PMC *val))
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
+void Parrot_ns_store_sub(PARROT_INTERP, ARGIN(PMC *sub_pmc))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_EXPORT
+void Parrot_store_global_s(PARROT_INTERP,
+ ARGIN_NULLOK(STRING *str_key),
+ ARGIN_NULLOK(STRING *globalname),
+ ARGIN_NULLOK(PMC *val))
+ __attribute__nonnull__(1);
+
+#define ASSERT_ARGS_Parrot_find_global_s __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_ns_find_current_namespace_global \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_ns_find_global_from_op __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(ns))
+#define ASSERT_ARGS_Parrot_ns_find_named_item __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(name))
+#define ASSERT_ARGS_Parrot_ns_find_namespace_global \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_ns_get_global __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_ns_get_name __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(_namespace))
+#define ASSERT_ARGS_Parrot_ns_get_namespace_keyed __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(base_ns) \
+ , PARROT_ASSERT_ARG(pmc_key))
+#define ASSERT_ARGS_Parrot_ns_get_namespace_keyed_str \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(base_ns))
+#define ASSERT_ARGS_Parrot_ns_make_namespace_autobase \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_ns_make_namespace_keyed \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(base_ns) \
+ , PARROT_ASSERT_ARG(pmc_key))
+#define ASSERT_ARGS_Parrot_ns_make_namespace_keyed_str \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(base_ns) \
+ , PARROT_ASSERT_ARG(str_key))
+#define ASSERT_ARGS_Parrot_ns_set_global __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_ns_store_global __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_ns_store_sub __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(sub_pmc))
+#define ASSERT_ARGS_Parrot_store_global_s __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+/* HEADERIZER END: src/namespace.c */
+
+#endif /* PARROT_GLOBAL_H_GUARD */
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
+
Modified: branches/gsoc_instrument/include/parrot/oplib.h
==============================================================================
--- branches/gsoc_instrument/include/parrot/oplib.h Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/include/parrot/oplib.h Sat Jun 19 16:17:11 2010 (r47715)
@@ -50,7 +50,7 @@
CORE_OPS_check_events, /* explicit event check */
CORE_OPS_check_events__, /* inserted into op dispatch when an event
got scheduled */
- CORE_OPS_wrapper__, /* inserted by dynop_register for new ops */
+ CORE_OPS_wrapper__ /* inserted by dynop_register for new ops */
/* 2 more reserved */
} special_core_ops_enum;
Modified: branches/gsoc_instrument/include/parrot/oplib/core_ops.h
==============================================================================
--- branches/gsoc_instrument/include/parrot/oplib/core_ops.h Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/include/parrot/oplib/core_ops.h Sat Jun 19 16:17:11 2010 (r47715)
@@ -20,7 +20,7 @@
#include "parrot/oplib.h"
#include "parrot/runcore_api.h"
- op_lib_t *Parrot_DynOp_core_2_4_0(PARROT_INTERP, long init);
+ op_lib_t *Parrot_DynOp_core_2_5_0(PARROT_INTERP, long init);
opcode_t * Parrot_end(opcode_t *, PARROT_INTERP);
opcode_t * Parrot_noop(opcode_t *, PARROT_INTERP);
Modified: branches/gsoc_instrument/include/parrot/packfile.h
==============================================================================
--- branches/gsoc_instrument/include/parrot/packfile.h Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/include/parrot/packfile.h Sat Jun 19 16:17:11 2010 (r47715)
@@ -91,6 +91,42 @@
#endif
/*
+** Enumerated constants
+** Changes here require update PBC_COMPAT
+** The prefered way to eliminate a value is just to stop using it without
+** renumbering others, that helps to keep backward compatibility.
+*/
+
+/* Packfile segment types */
+
+/* &gen_from_enum(packfile_segments.pasm) */
+
+typedef enum {
+ PF_DIR_SEG = 0,
+ PF_UNKNOWN_SEG = 1,
+ PF_FIXUP_SEG = 2,
+ PF_CONST_SEG = 3,
+ PF_BYTEC_SEG = 4,
+ PF_DEBUG_SEG = 5,
+ PF_ANNOTATIONS_SEG = 6,
+
+ PF_MAX_SEG = 7
+} pack_file_types;
+
+/* &end_gen */
+
+#define PF_DIR_FORMAT 1
+
+/* Fixup types */
+
+typedef enum {
+ enum_fixup_none = 0,
+ enum_fixup_sub = 1,
+ enum_fixup_MAXUSEDVALUE = enum_fixup_sub
+} enum_fixup_t;
+
+
+/*
** Structure Definitions:
*/
@@ -174,24 +210,6 @@
PackFile_Segment_dump_func_t dump;
} PackFile_funcs;
-/* &gen_from_enum(packfile_segments.pasm) */
-
-typedef enum {
- PF_DIR_SEG = 0,
- PF_UNKNOWN_SEG = 1,
- PF_FIXUP_SEG = 2,
- PF_CONST_SEG = 3,
- PF_BYTEC_SEG = 4,
- PF_DEBUG_SEG = 5,
- PF_ANNOTATIONS_SEG = 6,
-
- PF_MAX_SEG = 7
-} pack_file_types;
-
-/* &end_gen */
-
-#define PF_DIR_FORMAT 1
-
typedef struct PackFile_Segment {
struct PackFile * pf;
struct PackFile_Directory * dir;
@@ -220,11 +238,6 @@
opcode_t offset; /* location of the item */
} PackFile_FixupEntry;
-typedef enum {
- enum_fixup_none,
- enum_fixup_sub
-} enum_fixup_t;
-
typedef struct PackFile_FixupTable {
PackFile_Segment base;
opcode_t fixup_count;
Modified: branches/gsoc_instrument/include/parrot/parrot.h
==============================================================================
--- branches/gsoc_instrument/include/parrot/parrot.h Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/include/parrot/parrot.h Sat Jun 19 16:17:11 2010 (r47715)
@@ -284,7 +284,7 @@
#include "parrot/vtables.h"
#include "parrot/multidispatch.h"
#include "parrot/library.h"
-#include "parrot/global.h"
+#include "parrot/namespace.h"
#include "parrot/stat.h"
#include "parrot/hll.h"
#include "parrot/pbcversion.h"
Modified: branches/gsoc_instrument/lib/Parrot/Docs/Section/Parrot.pm
==============================================================================
--- branches/gsoc_instrument/lib/Parrot/Docs/Section/Parrot.pm Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/lib/Parrot/Docs/Section/Parrot.pm Sat Jun 19 16:17:11 2010 (r47715)
@@ -31,17 +31,10 @@
use Parrot::Distribution;
use Parrot::Docs::Section::Developer;
-#use Parrot::Docs::Section::Examples;
use Parrot::Docs::Section::PMCs;
-#use Parrot::Docs::Section::C;
use Parrot::Docs::Section::Ops;
-#use Parrot::Docs::Section::IMCC;
-#use Parrot::Docs::Section::Perl;
-#use Parrot::Docs::Section::Libs;
use Parrot::Docs::Section::Tools;
use Parrot::Docs::Section::Compilers;
-#use Parrot::Docs::Section::Config;
-#use Parrot::Docs::Section::Tests;
use Parrot::Docs::Section::PDDs;
use Parrot::Docs::Section::PCT_Tutorial;
@@ -74,7 +67,6 @@
'',
$self->new_item( 'Running Parrot', 'docs/running.pod'),
$self->new_item( 'Testing Parrot', 'docs/tests.pod'),
-# Parrot::Docs::Section::Examples->new,
$self->new_item( 'Developer FAQ', 'docs/gettingstarted.pod'),
$self->new_item( 'Submitting Bug Reports & Patches', 'docs/submissions.pod' ),
),
@@ -122,13 +114,6 @@
$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,
-# Parrot::Docs::Section::Libs->new,
-# Parrot::Docs::Section::Tests->new,
-# Parrot::Docs::Section::Config->new,
);
}
@@ -167,38 +152,6 @@
=back
-=head1 SEE ALSO
-
-=over 4
-
-=item C<Parrot::Docs::Section::Info>
-
-=item C<Parrot::Docs::Section::Docs>
-
-=item C<Parrot::Docs::Section::Examples>
-
-=item C<Parrot::Docs::Section::PMCs>
-
-=item C<Parrot::Docs::Section::C>
-
-=item C<Parrot::Docs::Section::Ops>
-
-=item C<Parrot::Docs::Section::IMCC>
-
-=item C<Parrot::Docs::Section::Perl>
-
-=item C<Parrot::Docs::Section::Libs>
-
-=item C<Parrot::Docs::Section::Tools>
-
-=item C<Parrot::Docs::Section::Compilers>
-
-=item C<Parrot::Docs::Section::Config>
-
-=item C<Parrot::Docs::Section::Tests>
-
-=back
-
=cut
1;
Modified: branches/gsoc_instrument/ports/cygwin/README
==============================================================================
--- branches/gsoc_instrument/ports/cygwin/README Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/ports/cygwin/README Sat Jun 19 16:17:11 2010 (r47715)
@@ -1,7 +1,7 @@
parrot
----------------------------------
Parrot is a virtual machine designed to efficiently compile and
-execute bytecode for interpreted languages. Parrot is a target for Perl 6
+execute bytecode for interpreted languages. Parrot is a target for Perl 6
and a lot of other languages.
Runtime requirements:
@@ -11,7 +11,7 @@
w32api pcre libpq5 openssl
Build requirements:
- readline libncurses-devel libicu-devel libgmp-devel libgdbm-devel perl
+ readline libncurses-devel libicu-devel libgmp-devel libgdbm-devel perl
make gcc
Optional build requirements:
@@ -40,7 +40,7 @@
/usr/src/parrot-devel-<VER>-<REL>.tar.bz2
/usr/src/parrot-docs-<VER>-<REL>.tar.bz2
-Or use 'cygport parrot-<VER>-<REL>.cygport prep' to get a patched
+Or use 'cygport parrot-<VER>-<REL>.cygport prep' to get a patched
source directory.
-------------------------------------------------------------------------------
@@ -657,7 +657,6 @@
/usr/include/parrot/1.0.0/parrot/extend.h
/usr/include/parrot/1.0.0/parrot/extend_vtable.h
/usr/include/parrot/1.0.0/parrot/feature.h
- /usr/include/parrot/1.0.0/parrot/global.h
/usr/include/parrot/1.0.0/parrot/global_setup.h
/usr/include/parrot/1.0.0/parrot/has_header.h
/usr/include/parrot/1.0.0/parrot/hash.h
@@ -676,6 +675,7 @@
/usr/include/parrot/1.0.0/parrot/memory.h
/usr/include/parrot/1.0.0/parrot/misc.h
/usr/include/parrot/1.0.0/parrot/mmd.h
+ /usr/include/parrot/1.0.0/parrot/namespace.h
/usr/include/parrot/1.0.0/parrot/nci.h
/usr/include/parrot/1.0.0/parrot/oo.h
/usr/include/parrot/1.0.0/parrot/oo_private.h
@@ -1877,7 +1877,7 @@
----- version parrot-1.0.0-1 -----
* cygwin 1.7, gcc-4.3 only
* renamed libparrot-devel to parrot-devel
-* removed libparrot1
+* removed libparrot1
* new parrot-docs for make html
* library.c patch to allow library/*.pbc
* removed pbc_info
@@ -1910,21 +1910,21 @@
----- version parrot-0.7.0-1 -----
* removed /usr/runtime and its preremove and postinstall scripts
-* added parrot_exists_check to .cygport. Already installed parrot
+* added parrot_exists_check to .cygport. Already installed parrot
still not supported, despite my #39742 patch
* other minor .cygport improvements: export PATH in seperate lines to fix check
-* new patches:
+* new patches:
[perl #39742] [BUG] installed conflict
[perl #58034] [TODO] config_args
[perl #56996] [TODO] FHS runtime paths
-* enhanced patch:
+* enhanced patch:
[perl #56554] [TODO] make install -C languages
* upstream fixed patches:
[perl #56544] [PATCH] install_files.pl
[perl #56998] [TODO] rename cygwin dll to cygparrot$MAJOR_$MINOR_$PATCH.dll
[perl #57006] [PATCH] add cygwin opengl config quirks
[perl #57296] [TODO] make install -C languages
-* fixed pipp, perl6, pheme, tcl installables. added pcbc's to library
+* fixed pipp, perl6, pheme, tcl installables. added pcbc's to library
----- version parrot-0.6.4-2 -----
* fixed invalid parrot languages and perl6 paths referencing the build_dir
@@ -1933,7 +1933,7 @@
* added myconfig parrotbug VERSION to /usr/lib/parrot
* moved language dll's to parrot-languages
* added more sublanguage exe's: bfc, bfco
-* added usr/lib/parrot/include/config.fpmc usr/lib/parrot/include/interpinfo.pasm
+* added usr/lib/parrot/include/config.fpmc usr/lib/parrot/include/interpinfo.pasm
to parrot
----- version parrot-0.6.4-1 -----
@@ -1951,11 +1951,11 @@
[perl #57114] [PATCH] urm RealBin issue
----- version parrot-0.6.3-1 -----
-* first port, with the help from #parrot, fedora spec,
+* first port, with the help from #parrot, fedora spec,
gentoo ebuild and freebsd ports.
* the php implementation plumhead is still named plumhead.
will be renamed to pipp from the next release 0.6.4 on.
Cygwin port maintained by: Reini Urban <rurban at x-ray.at>
-Please address all questions to the Cygwin mailing list
+Please address all questions to the Cygwin mailing list
at <cygwin at cygwin.com>
Modified: branches/gsoc_instrument/runtime/parrot/library/LWP/UserAgent.pir
==============================================================================
--- branches/gsoc_instrument/runtime/parrot/library/LWP/UserAgent.pir Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/runtime/parrot/library/LWP/UserAgent.pir Sat Jun 19 16:17:11 2010 (r47715)
@@ -17,7 +17,6 @@
=cut
.namespace ['LWP';'UserAgent']
-.loadlib 'io_ops'
.sub '' :init :load :anon
load_bytecode 'URI.pbc'
@@ -287,17 +286,19 @@
.sub 'progress' :method
.param string status
.param pmc msg
+ .local pmc stderr
+ stderr = getstderr
$P0 = getattribute self, 'show_progress'
if null $P0 goto L1
unless $P0 goto L1
unless status == 'begin' goto L2
- printerr "** "
+ print stderr, "** "
$P0 = getattribute msg, 'method'
- printerr $P0
- printerr " "
+ print stderr, $P0
+ print stderr, " "
$P0 = getattribute msg, 'uri'
- printerr $P0
- printerr " ==> "
+ print stderr, $P0
+ print stderr, " ==> "
$N1 = time
$P0 = box $N1
setattribute self, 'progress_start', $P0
@@ -316,15 +317,15 @@
setattribute self, 'progress_lastp', $P0
setattribute self, 'progress_ani', $P0
$S0 = msg.'status_line'()
- printerr $S0
+ print stderr, $S0
$N0 =$N2 - $N1
$I0 = $N0
unless $I0 goto L4
- printerr " ("
- printerr $I0
- printerr "s)"
+ print stderr, " ("
+ print stderr, $I0
+ print stderr, "s)"
L4:
- printerr "\n"
+ print stderr, "\n"
goto L1
L3:
unless status == 'tick' goto L5
@@ -333,8 +334,8 @@
$P0 %= 4
$P1 = split '', '-\|/'
$S0 = $P1[$P0]
- printerr $S0
- printerr "\b"
+ print stderr, $S0
+ print stderr, "\b"
goto L1
L5:
$N0 = status
@@ -347,8 +348,8 @@
$S0 = $P0
if $S0 == $S1 goto L1
set $P0, $S1
- printerr $S1
- printerr "\b\b\b\b"
+ print stderr, $S1
+ print stderr, "\b\b\b\b"
L1:
.end
Modified: branches/gsoc_instrument/src/dynpmc/Defines.in
==============================================================================
--- branches/gsoc_instrument/src/dynpmc/Defines.in Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/dynpmc/Defines.in Sat Jun 19 16:17:11 2010 (r47715)
@@ -50,7 +50,6 @@
include/parrot/extend_vtable.h \
include/parrot/feature.h \
include/parrot/gc_api.h \
- include/parrot/global.h \
include/parrot/global_setup.h \
include/parrot/has_header.h \
include/parrot/hash.h \
@@ -63,6 +62,7 @@
include/parrot/memory.h \
include/parrot/misc.h \
include/parrot/multidispatch.h \
+ include/parrot/namespace.h \
include/parrot/nci.h \
include/parrot/oo.h \
include/parrot/op.h \
Modified: branches/gsoc_instrument/src/gc/gc_private.h
==============================================================================
--- branches/gsoc_instrument/src/gc/gc_private.h Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/gc/gc_private.h Sat Jun 19 16:17:11 2010 (r47715)
@@ -85,7 +85,7 @@
typedef enum _gc_sys_type_enum {
MS, /*mark and sweep*/
- INF /*infinite memory core*/
+ INF /*infinite memory core*/
} gc_sys_type_enum;
/* how often to skip a full GC when this pool has nothing free */
Deleted: branches/gsoc_instrument/src/global.c
==============================================================================
--- branches/gsoc_instrument/src/global.c Sat Jun 19 16:17:11 2010 (r47714)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,854 +0,0 @@
-/*
-Copyright (C) 2004-2009, Parrot Foundation.
-$Id$
-
-=head1 NAME
-
-src/global.c
-
-=head1 DESCRIPTION
-
-Access to global PMCs
-
-=head1 FUNCTIONS
-
-=over 4
-
-=cut
-
-*/
-
-#include "parrot/parrot.h"
-#include "global.str"
-#include "pmc/pmc_sub.h"
-#include "pmc/pmc_callcontext.h"
-
-/* HEADERIZER HFILE: include/parrot/global.h */
-/* HEADERIZER BEGIN: static */
-/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PMC * get_namespace_pmc(PARROT_INTERP, ARGIN(PMC *sub_pmc))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PMC * internal_ns_keyed(PARROT_INTERP,
- ARGIN(PMC *base_ns),
- ARGIN(PMC *pmc_key),
- int flags)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3);
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PMC * internal_ns_keyed_key(PARROT_INTERP,
- ARGIN(PMC *ns),
- ARGIN(PMC *key),
- int flags)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3);
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PMC * internal_ns_keyed_str(PARROT_INTERP,
- ARGIN(PMC *base_ns),
- ARGIN(STRING *key),
- int flags)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3);
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PMC * internal_ns_maybe_create(PARROT_INTERP,
- ARGIN(PMC *ns),
- ARGIN(STRING *key),
- int flags)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3);
-
-static void store_sub_in_multi(PARROT_INTERP,
- ARGIN(PMC *sub_pmc),
- ARGIN(PMC *ns))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3);
-
-#define ASSERT_ARGS_get_namespace_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(sub_pmc))
-#define ASSERT_ARGS_internal_ns_keyed __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(base_ns) \
- , PARROT_ASSERT_ARG(pmc_key))
-#define ASSERT_ARGS_internal_ns_keyed_key __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(ns) \
- , PARROT_ASSERT_ARG(key))
-#define ASSERT_ARGS_internal_ns_keyed_str __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(base_ns) \
- , PARROT_ASSERT_ARG(key))
-#define ASSERT_ARGS_internal_ns_maybe_create __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(ns) \
- , PARROT_ASSERT_ARG(key))
-#define ASSERT_ARGS_store_sub_in_multi __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(sub_pmc) \
- , PARROT_ASSERT_ARG(ns))
-/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
-/* HEADERIZER END: static */
-
-#define DEBUG_GLOBAL 0
-
-/* flags for internal_ns_keyed */
-#define INTERN_NS_CREAT 1 /* I'm a fan of the classics */
-
-/*
-
-=item C<static PMC * internal_ns_keyed_str(PARROT_INTERP, PMC *base_ns, STRING
-*key, int flags)>
-
-Internal function to do keyed namespace lookup relative to a given namespace
-PMC. Understands STRINGs.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PMC *
-internal_ns_keyed_str(PARROT_INTERP, ARGIN(PMC *base_ns),
- ARGIN(STRING *key), int flags)
-{
- ASSERT_ARGS(internal_ns_keyed_str)
- PMC * const ns = VTABLE_get_pmc_keyed_str(interp, base_ns, key);
-
- if (!PMC_IS_NULL(ns) && VTABLE_isa(interp, ns, CONST_STRING(interp, "NameSpace")))
- return ns;
-
- return internal_ns_maybe_create(interp, base_ns, key, flags);
-}
-
-/*
-
-=item C<static PMC * internal_ns_keyed_key(PARROT_INTERP, PMC *ns, PMC *key, int
-flags)>
-
-Internal function to do keyed namespace lookup relative to a given namespace
-PMC. Understands Key PMCs. Used from C<internal_ns_keyed>.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PMC *
-internal_ns_keyed_key(PARROT_INTERP, ARGIN(PMC *ns), ARGIN(PMC *key), int flags)
-{
- ASSERT_ARGS(internal_ns_keyed_key)
- while (key) {
- STRING * const part = VTABLE_get_string(interp, key);
- PMC *sub_ns = VTABLE_get_pmc_keyed_str(interp, ns, part);
-
- if (PMC_IS_NULL(sub_ns) || !VTABLE_isa(interp, sub_ns, CONST_STRING(interp, "NameSpace"))) {
- sub_ns = internal_ns_maybe_create(interp, ns, part, flags);
-
- if (PMC_IS_NULL(sub_ns))
- return PMCNULL;
- }
-
- ns = sub_ns;
- key = VTABLE_shift_pmc(interp, key);
- }
-
- return ns;
-}
-
-/*
-
-=item C<static PMC * internal_ns_keyed(PARROT_INTERP, PMC *base_ns, PMC
-*pmc_key, int flags)>
-
-internal_ns_keyed: Internal function to do keyed namespace lookup relative to a
-given namespace PMC. Understands String, Key, and array PMCs containing
-strings.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PMC *
-internal_ns_keyed(PARROT_INTERP, ARGIN(PMC *base_ns), ARGIN(PMC *pmc_key), int flags)
-{
- ASSERT_ARGS(internal_ns_keyed)
-
- if (VTABLE_isa(interp, pmc_key, CONST_STRING(interp, "String"))) {
- STRING * const str_key = VTABLE_get_string(interp, pmc_key);
- return internal_ns_keyed_str(interp, base_ns, str_key, flags);
- }
- else if (pmc_key->vtable->base_type == enum_class_Key)
- return internal_ns_keyed_key(interp, base_ns, pmc_key, flags);
- else {
- /* array of strings */
- STRING * const isans = CONST_STRING(interp, "NameSpace");
- const INTVAL n = VTABLE_elements(interp, pmc_key);
- INTVAL i;
- PMC *ns = base_ns;
-
- for (i = 0; i < n; ++i) {
- STRING * const part = VTABLE_get_string_keyed_int(interp, pmc_key, i);
- PMC *sub_ns = VTABLE_get_pmc_keyed_str(interp, ns, part);
-
- if (PMC_IS_NULL(sub_ns) || !VTABLE_isa(interp, sub_ns, isans)) {
- sub_ns = internal_ns_maybe_create(interp, ns, part, flags);
- if (PMC_IS_NULL(sub_ns))
- return PMCNULL;
- }
- ns = sub_ns;
- }
- return ns;
- }
-}
-
-/*
-
-=item C<static PMC * internal_ns_maybe_create(PARROT_INTERP, PMC *ns, STRING
-*key, int flags)>
-
-Given the a namespace PMC, a STRING containing a name, and flags from
-C<internal_ns_keyed> or C<internal_ns_keyed_str>, creates and returns a new
-namespace with the given name in the given namespace. This is an internal
-function only.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PMC *
-internal_ns_maybe_create(PARROT_INTERP, ARGIN(PMC *ns), ARGIN(STRING *key), int flags)
-{
- ASSERT_ARGS(internal_ns_maybe_create)
- PMC *sub_ns;
-
- /* TT #1220 - stop depending on typed namespace */
- if (!(flags & INTERN_NS_CREAT))
- return PMCNULL;
-
- /* TT #1221 - match HLL of enclosing namespace? */
- sub_ns = Parrot_pmc_new(interp, Parrot_get_ctx_HLL_type(interp,
- enum_class_NameSpace));
-
- if (PMC_IS_NULL(sub_ns))
- return PMCNULL;
-
- VTABLE_set_pmc_keyed_str(interp, ns, key, sub_ns);
-
- return sub_ns;
-}
-
-
-/*
-
-=item C<PMC * Parrot_get_namespace_keyed(PARROT_INTERP, PMC *base_ns, PMC
-*pmc_key)>
-
-Find the namespace relative to the namespace C<base_ns> with the key
-C<pmc_key>, which may be a String, a Key, or an array of strings. Return
-the namespace, or NULL if not found.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC *
-Parrot_get_namespace_keyed(PARROT_INTERP, ARGIN(PMC *base_ns), ARGIN(PMC *pmc_key))
-{
- ASSERT_ARGS(Parrot_get_namespace_keyed)
- return internal_ns_keyed(interp, base_ns, pmc_key, 0);
-}
-
-/*
-
-=item C<PMC * Parrot_get_namespace_keyed_str(PARROT_INTERP, PMC *base_ns, STRING
-*str_key)>
-
-Find the namespace relative to the namespace C<base_ns> with the string key
-C<str_key>. Return the namespace, or NULL if not found.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC *
-Parrot_get_namespace_keyed_str(PARROT_INTERP, ARGIN(PMC *base_ns),
- ARGIN_NULLOK(STRING *str_key))
-{
- ASSERT_ARGS(Parrot_get_namespace_keyed_str)
- return internal_ns_keyed_str(interp, base_ns, str_key, 0);
-}
-
-/*
-
-=item C<PMC * Parrot_make_namespace_keyed(PARROT_INTERP, PMC *base_ns, PMC
-*pmc_key)>
-
-Find, or create if necessary, the namespace relative to the namespace
-C<base_ns> with the key C<pmc_key>, which may be a String, a Key, or an
-array of strings. Return the namespace. Errors will result in exceptions.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC *
-Parrot_make_namespace_keyed(PARROT_INTERP, ARGIN(PMC *base_ns),
- ARGIN(PMC *pmc_key))
-{
- ASSERT_ARGS(Parrot_make_namespace_keyed)
- return internal_ns_keyed(interp, base_ns, pmc_key, INTERN_NS_CREAT);
-}
-
-/*
-
-=item C<PMC * Parrot_make_namespace_keyed_str(PARROT_INTERP, PMC *base_ns,
-STRING *str_key)>
-
-Find, or create if necessary, the namespace relative to the namespace
-C<base_ns> with the string key C<str_key>. Return the namespace. Errors
-will result in exceptions.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC *
-Parrot_make_namespace_keyed_str(PARROT_INTERP, ARGIN(PMC *base_ns),
- ARGIN(STRING *str_key))
-{
- ASSERT_ARGS(Parrot_make_namespace_keyed_str)
- return internal_ns_keyed_str(interp, base_ns, str_key, INTERN_NS_CREAT);
-}
-
-
-/*
-
-=item C<PMC * Parrot_make_namespace_autobase(PARROT_INTERP, PMC *key)>
-
-Find, or create if necessary, a namespace with the key C<key>, which may be a
-String, a Key, or an array of strings. If it is a String, then the lookup is
-relative to the current namespace. Otherwise, it is relative to the current HLL
-root namespace. Return the namespace. Errors will result in exceptions.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC *
-Parrot_make_namespace_autobase(PARROT_INTERP, ARGIN_NULLOK(PMC *key))
-{
- ASSERT_ARGS(Parrot_make_namespace_autobase)
- PMC *base_ns;
- if (VTABLE_isa(interp, key, CONST_STRING(interp, "String")))
- base_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- else
- base_ns = VTABLE_get_pmc_keyed_int(interp, interp->HLL_namespace,
- Parrot_pcc_get_HLL(interp, CURRENT_CONTEXT(interp)));
- return Parrot_make_namespace_keyed(interp, base_ns, key);
-}
-
-/*
-
-=item C<PMC * Parrot_ns_get_name(PARROT_INTERP, PMC *_namespace)>
-
-Retrieve an array of names from a namespace object.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC *
-Parrot_ns_get_name(PARROT_INTERP, ARGIN(PMC *_namespace))
-{
- ASSERT_ARGS(Parrot_ns_get_name)
- PMC *names;
- Parrot_pcc_invoke_method_from_c_args(interp, _namespace, CONST_STRING(interp, "get_name"), "->P", &names);
- return names;
-}
-
-/*
-
-=item C<PMC * Parrot_get_global(PARROT_INTERP, PMC *ns, STRING *globalname)>
-
-Parrot_get_global allows a null namespace without throwing an exception; it
-simply returns PMCNULL in that case.
-
-NOTE: At present the use of the {get, set}_global functions is mandatory due to the
- wacky namespace typing of the default Parrot namespace. Eventually it will be
- safe to just use the standard hash interface (if desired).
-
-Look up the global named C<globalname> in the namespace C<ns>. Return the
-global, or return PMCNULL if C<ns> is null or if the global is not found.
-
-KLUDGE ALERT: Currently prefers non-namespaces in case of collision.
-
-=cut
-
-*/
-
-
-/*
- * {get, set}_global.
- *
- * Parrot_get_global allows a null namespace without throwing an exception; it
- * simply returns PMCNULL in that case.
- *
- * NOTE: At present the use of the {get, set}_global functions is mandatory due to the
- * wacky namespace typing of the default Parrot namespace. Eventually it will be
- * safe to just use the standard hash interface (if desired).
- */
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC *
-Parrot_get_global(PARROT_INTERP, ARGIN_NULLOK(PMC *ns), ARGIN_NULLOK(STRING *globalname))
-{
- ASSERT_ARGS(Parrot_get_global)
- if (PMC_IS_NULL(ns))
- return PMCNULL;
-
- return (PMC *)VTABLE_get_pointer_keyed_str(interp, ns, globalname);
-}
-
-/*
-
-=item C<void Parrot_set_global(PARROT_INTERP, PMC *ns, STRING *globalname, PMC
-*val)>
-
-Set the global named C<globalname> in the namespace C<ns> to the value C<val>.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-void
-Parrot_set_global(PARROT_INTERP, ARGIN_NULLOK(PMC *ns),
- ARGIN_NULLOK(STRING *globalname), ARGIN_NULLOK(PMC *val))
-{
- ASSERT_ARGS(Parrot_set_global)
- VTABLE_set_pmc_keyed_str(interp, ns, globalname, val);
-}
-
-
-/*
-
-=item C<PMC * Parrot_find_global_n(PARROT_INTERP, PMC *ns, STRING *globalname)>
-
-Search the namespace PMC C<ns> for an object with name C<globalname>.
-Return the object, or NULL if not found.
-
-TT #1222 - For now this function prefers non-namespaces, it will eventually
-entirely use the untyped interface.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC *
-Parrot_find_global_n(PARROT_INTERP, ARGIN_NULLOK(PMC *ns), ARGIN_NULLOK(STRING *globalname))
-{
- ASSERT_ARGS(Parrot_find_global_n)
- PMC *res;
-
-#if DEBUG_GLOBAL
- if (globalname)
- Parrot_io_printf(interp, "find_global name '%Ss'\n", globalname);
-#endif
-
- if (PMC_IS_NULL(ns))
- res = PMCNULL;
- else {
- /*
- * TT #1219 - we should be able to use 'get_pmc_keyed' here,
- * but we can't because Parrot's default namespaces are not
- * fully typed and there's a pseudo-typed interface that
- * distinguishes 'get_pmc_keyed' from 'get_pointer_keyed';
- * the former is for NS and the latter is for non-NS.
- */
- res = (PMC *)VTABLE_get_pointer_keyed_str(interp, ns, globalname);
- }
-
- return PMC_IS_NULL(res) ? NULL : res;
-}
-
-/*
-
-=item C<PMC * Parrot_find_global_cur(PARROT_INTERP, STRING *globalname)>
-
-Finds and returns the data time named C<globalname> in the current namespace.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC *
-Parrot_find_global_cur(PARROT_INTERP, ARGIN_NULLOK(STRING *globalname))
-{
- ASSERT_ARGS(Parrot_find_global_cur)
- PMC * const ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- return Parrot_find_global_n(interp, ns, globalname);
-}
-
-/*
-
-=item C<PMC * Parrot_find_global_s(PARROT_INTERP, STRING *str_key, STRING
-*globalname)>
-
-Search the namespace designated by C<str_key>, or the HLL root if
-C<str_key> is NULL, for an object with name C<globalname>. Return the
-object, or NULL if not found.
-
-TT #1222 - For now this function prefers non-namespaces, it will eventually
-entirely use the untyped interface.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC *
-Parrot_find_global_s(PARROT_INTERP, ARGIN_NULLOK(STRING *str_key),
- ARGIN_NULLOK(STRING *globalname))
-{
- ASSERT_ARGS(Parrot_find_global_s)
- PMC *const ns =
- Parrot_get_namespace_keyed_str(interp,
- Parrot_get_ctx_HLL_namespace(interp),
- str_key);
- return Parrot_find_global_n(interp, ns, globalname);
-}
-
-/*
-
-=item C<void Parrot_store_global_n(PARROT_INTERP, PMC *ns, STRING *globalname,
-PMC *val)>
-
-Store the PMC C<val> into the namespace PMC C<ns> with name C<globalname>.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-void
-Parrot_store_global_n(PARROT_INTERP, ARGIN_NULLOK(PMC *ns),
- ARGIN_NULLOK(STRING *globalname), ARGIN_NULLOK(PMC *val))
-{
- ASSERT_ARGS(Parrot_store_global_n)
-#if DEBUG_GLOBAL
- if (globalname)
- Parrot_io_printf(interp, "store_global name '%Ss'\n", globalname);
-#endif
-
- if (PMC_IS_NULL(ns))
- return;
-
- VTABLE_set_pmc_keyed_str(interp, ns, globalname, val);
-}
-
-/*
-
-=item C<void Parrot_store_global_s(PARROT_INTERP, STRING *str_key, STRING
-*globalname, PMC *val)>
-
-Store the PMC C<val> into the namespace designated by C<str_key>, or
-the HLL root if C<str_key> is NULL, with the name C<globalname>.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-void
-Parrot_store_global_s(PARROT_INTERP, ARGIN_NULLOK(STRING *str_key),
- ARGIN_NULLOK(STRING *globalname), ARGIN_NULLOK(PMC *val))
-{
- ASSERT_ARGS(Parrot_store_global_s)
- PMC * const ns = Parrot_make_namespace_keyed_str(interp,
- Parrot_get_ctx_HLL_namespace(interp),
- str_key);
-
- Parrot_store_global_n(interp, ns, globalname, val);
-
- /* TT #1225 - method cache invalidation should be a namespace function */
- Parrot_invalidate_method_cache(interp, str_key);
-}
-
-
-/*
-
-=item C<PMC * Parrot_find_global_op(PARROT_INTERP, PMC *ns, STRING *globalname,
-void *next)>
-
-If the global exists in the given namespace PMC, return it. If not, return
-PMCNULL.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-PMC *
-Parrot_find_global_op(PARROT_INTERP, ARGIN(PMC *ns),
- ARGIN_NULLOK(STRING *globalname), ARGIN_NULLOK(void *next))
-{
- ASSERT_ARGS(Parrot_find_global_op)
- PMC *res;
-
- if (STRING_IS_NULL(globalname))
- Parrot_ex_throw_from_c_args(interp, next, EXCEPTION_GLOBAL_NOT_FOUND,
- "Tried to get null global");
-
- res = Parrot_find_global_n(interp, ns, globalname);
- if (!res)
- res = PMCNULL;
-
- return res;
-}
-
-
-/*
-
-=item C<PMC * Parrot_find_name_op(PARROT_INTERP, STRING *name, void *next)>
-
-TT #1223 - THIS IS BROKEN - it doesn't walk up the scopes yet
-
-Find the given C<name> in lexicals, then the current namespace, then the HLL
-root namespace, and finally Parrot builtins. If the name isn't found
-anywhere, return PMCNULL.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC *
-Parrot_find_name_op(PARROT_INTERP, ARGIN(STRING *name), SHIM(void *next))
-{
- ASSERT_ARGS(Parrot_find_name_op)
- PMC * const ctx = CURRENT_CONTEXT(interp);
- PMC * const lex_pad = Parrot_find_pad(interp, name, ctx);
- PMC *g;
-
- if (PMC_IS_NULL(lex_pad))
- g = PMCNULL;
- else
- g = VTABLE_get_pmc_keyed_str(interp, lex_pad, name);
-
- /* TT #1223 - walk up the scopes! duh!! */
-
- if (PMC_IS_NULL(g))
- g = Parrot_find_global_cur(interp, name);
-
- if (PMC_IS_NULL(g))
- g = Parrot_find_global_n(interp, Parrot_get_ctx_HLL_namespace(interp), name);
-
- if (PMC_IS_NULL(g))
- return PMCNULL;
- else
- return g;
-}
-
-/*
-
-=item C<static PMC * get_namespace_pmc(PARROT_INTERP, PMC *sub_pmc)>
-
-Return the namespace PMC associated with the PMC C<sub>. If C<sub> is NULL,
-return the Associated HLL namespace PMC instead.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PMC *
-get_namespace_pmc(PARROT_INTERP, ARGIN(PMC *sub_pmc))
-{
- ASSERT_ARGS(get_namespace_pmc)
- Parrot_Sub_attributes *sub;
- PMC *nsname, *nsroot;
-
- PMC_get_sub(interp, sub_pmc, sub);
- nsname = sub->namespace_name;
- nsroot = Parrot_get_HLL_namespace(interp, sub->HLL_id);
-
- /* If we have a NULL, return the HLL namespace */
- if (PMC_IS_NULL(nsname))
- return nsroot;
- /* If we have a String, do a string lookup */
- else if (nsname->vtable->base_type == enum_class_String)
- return Parrot_make_namespace_keyed_str(interp, nsroot,
- VTABLE_get_string(interp, nsname));
- /* Otherwise, do a PMC lookup */
- else
- return Parrot_make_namespace_keyed(interp, nsroot, nsname);
-}
-
-/*
-
-=item C<static void store_sub_in_multi(PARROT_INTERP, PMC *sub_pmc, PMC *ns)>
-
-Adds the sub C<sub> into a mulisub of the same name in the namespace C<ns>.
-If no multisub by that name currently exists, we create one.
-
-=cut
-
-*/
-
-static void
-store_sub_in_multi(PARROT_INTERP, ARGIN(PMC *sub_pmc), ARGIN(PMC *ns))
-{
- ASSERT_ARGS(store_sub_in_multi)
- Parrot_Sub_attributes *sub;
- STRING *ns_entry_name;
- PMC *multisub;
-
- PMC_get_sub(interp, sub_pmc, sub);
- ns_entry_name = sub->ns_entry_name;
- multisub = VTABLE_get_pmc_keyed_str(interp, ns, ns_entry_name);
-
- /* is there an existing MultiSub PMC? or do we need to create one? */
- if (PMC_IS_NULL(multisub)) {
- multisub = Parrot_pmc_new(interp, Parrot_get_ctx_HLL_type(interp, enum_class_MultiSub));
- /* we have to push the sub onto the MultiSub before we try to store
- it because storing requires information from the sub */
- VTABLE_push_pmc(interp, multisub, sub_pmc);
- VTABLE_set_pmc_keyed_str(interp, ns, ns_entry_name, multisub);
- }
- else
- VTABLE_push_pmc(interp, multisub, sub_pmc);
-}
-
-/*
-
-=item C<void Parrot_store_sub_in_namespace(PARROT_INTERP, PMC *sub_pmc)>
-
-Adds the PMC C<sub> into the current namespace. Adds the sub to a multi of the
-same name if it's defined as a multi.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-void
-Parrot_store_sub_in_namespace(PARROT_INTERP, ARGIN(PMC *sub_pmc))
-{
- ASSERT_ARGS(Parrot_store_sub_in_namespace)
- const INTVAL cur_id = Parrot_pcc_get_HLL(interp, CURRENT_CONTEXT(interp));
-
- PMC *ns;
- Parrot_Sub_attributes *sub;
-
- /* PF structures aren't fully constructed yet */
- Parrot_block_GC_mark(interp);
-
- /* store relative to HLL namespace */
- PMC_get_sub(interp, sub_pmc, sub);
- Parrot_pcc_set_HLL(interp, CURRENT_CONTEXT(interp), sub->HLL_id);
-
- ns = get_namespace_pmc(interp, sub_pmc);
-
- /* attach a namespace to the sub for lookups */
- sub->namespace_stash = ns;
-
- /* store a :multi sub */
- if (!PMC_IS_NULL(sub->multi_signature))
- store_sub_in_multi(interp, sub_pmc, ns);
-
- /* store other subs (as long as they're not :anon) */
- else if (!(PObj_get_FLAGS(sub_pmc) & SUB_FLAG_PF_ANON)
- || sub->vtable_index != -1) {
- STRING * const ns_entry_name = sub->ns_entry_name;
- PMC * const nsname = sub->namespace_name;
-
- Parrot_store_global_n(interp, ns, ns_entry_name, sub_pmc);
-
- /* TT #1224:
- TEMPORARY HACK - cache invalidation should be a namespace function */
- if (!PMC_IS_NULL(nsname)) {
- STRING * const nsname_s = VTABLE_get_string(interp, nsname);
- Parrot_invalidate_method_cache(interp, nsname_s);
- }
- }
-
- /* restore HLL_id */
- Parrot_pcc_set_HLL(interp, CURRENT_CONTEXT(interp), cur_id);
- Parrot_unblock_GC_mark(interp);
-}
-
-/*
-
-=back
-
-=head1 SEE ALSO
-
-F<include/parrot/global.h>
-
-=cut
-
-*/
-
-
-/*
- * Local variables:
- * c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */
Modified: branches/gsoc_instrument/src/hll.c
==============================================================================
--- branches/gsoc_instrument/src/hll.c Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/hll.c Sat Jun 19 16:17:11 2010 (r47715)
@@ -167,7 +167,7 @@
* ns_hash to another type, if mappings provide one
* XXX - FIXME
*/
- ns_hash = Parrot_make_namespace_keyed_str(interp, interp->root_namespace,
+ ns_hash = Parrot_ns_make_namespace_keyed_str(interp, interp->root_namespace,
hll_name);
/* cache HLL's toplevel namespace */
@@ -500,7 +500,7 @@
* here because the typemap already exists, but it is not currently
* done for consistency.
*/
- ns_hash = Parrot_make_namespace_keyed_str(interp,
+ ns_hash = Parrot_ns_make_namespace_keyed_str(interp,
interp->root_namespace, hll_name);
VTABLE_set_pmc_keyed_int(interp, interp->HLL_namespace,
Modified: branches/gsoc_instrument/src/io/io_private.h
==============================================================================
--- branches/gsoc_instrument/src/io/io_private.h Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/io/io_private.h Sat Jun 19 16:17:11 2010 (r47715)
@@ -27,23 +27,19 @@
#define PARROT_IN_IO 1
#define PARROT_ASYNC_DEVEL 0
-#define PARROT_NET_DEVEL 1
#include <parrot/io.h>
-#if PARROT_NET_DEVEL
/* XXX: Parrot config is currently not probing for all headers so
* I'm sticking here rather than parrot.h
*/
-# ifdef UNIX
-# include <sys/socket.h>
-# endif
-
-# ifdef WIN32
-# include <winsock.h>
-# endif
+#ifdef UNIX
+# include <sys/socket.h>
+#endif
-#endif /* PARROT_NET_DEVEL */
+#ifdef WIN32
+# include <winsock.h>
+#endif
/* IO object flags */
#define PIO_F_READ 00000001
Modified: branches/gsoc_instrument/src/io/socket_unix.c
==============================================================================
--- branches/gsoc_instrument/src/io/socket_unix.c Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/io/socket_unix.c Sat Jun 19 16:17:11 2010 (r47715)
@@ -67,8 +67,6 @@
=head2 Networking
-Define C<PARROT_NET_DEVEL> to enable networking.
-
These could be native extensions but they probably should be here if we
wish to make them integrated with the async IO system.
@@ -110,8 +108,6 @@
}
-# if PARROT_NET_DEVEL
-
/*
=item C<INTVAL Parrot_io_socket_unix(PARROT_INTERP, PMC *s, int fam, int type,
@@ -314,13 +310,13 @@
switch (errno) {
case EINTR:
goto AGAIN;
-# ifdef EWOULDBLOCK
+# ifdef EWOULDBLOCK
case EWOULDBLOCK:
goto AGAIN;
-# else
+# else
case EAGAIN:
goto AGAIN;
-# endif
+# endif
case EPIPE:
/* XXX why close it here and not below */
close(io->os_handle);
@@ -363,13 +359,13 @@
switch (errno) {
case EINTR:
goto AGAIN;
-# ifdef EWOULDBLOCK
+# ifdef EWOULDBLOCK
case EWOULDBLOCK:
goto AGAIN;
-# else
+# else
case EAGAIN:
goto AGAIN;
-# endif
+# endif
case ECONNRESET:
/* XXX why close it on err return result is -1 anyway */
close(io->os_handle);
@@ -457,12 +453,12 @@
const int family = AF_INET;
struct sockaddr_in * const sa = (struct sockaddr_in*)VTABLE_get_pointer(interp, sockaddr);
-# ifdef PARROT_DEF_INET_ATON
+# ifdef PARROT_DEF_INET_ATON
if (inet_aton(host, &sa->sin_addr) != 0) {
-# else
+# else
/* positive retval is success */
if (inet_pton(family, host, &sa->sin_addr) > 0) {
-# endif
+# endif
/* Success converting numeric IP */
}
else {
@@ -482,7 +478,6 @@
sa->sin_family = family;
sa->sin_port = htons(port);
}
-# endif
#endif /* PIO_OS_UNIX */
Modified: branches/gsoc_instrument/src/io/socket_win32.c
==============================================================================
--- branches/gsoc_instrument/src/io/socket_win32.c Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/io/socket_win32.c Sat Jun 19 16:17:11 2010 (r47715)
@@ -51,13 +51,11 @@
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
-# if PARROT_NET_DEVEL
-
/* Helper macros to get sockaddr_in */
-# define SOCKADDR_LOCAL(p) ((struct sockaddr_in*)VTABLE_get_pointer(interp, \
- PARROT_SOCKET((p))->local))
-# define SOCKADDR_REMOTE(p) ((struct sockaddr_in*)VTABLE_get_pointer(interp, \
- PARROT_SOCKET((p))->remote))
+# define SOCKADDR_LOCAL(p) ((struct sockaddr_in*)VTABLE_get_pointer(interp, \
+ PARROT_SOCKET((p))->local))
+# define SOCKADDR_REMOTE(p) ((struct sockaddr_in*)VTABLE_get_pointer(interp, \
+ PARROT_SOCKET((p))->remote))
/*
@@ -262,13 +260,13 @@
switch (errno) {
case WSAEINTR:
goto AGAIN;
-# ifdef WSAEWOULDBLOCK
+# ifdef WSAEWOULDBLOCK
case WSAEWOULDBLOCK:
goto AGAIN;
-# else
+# else
case WSAEAGAIN:
goto AGAIN;
-# endif
+# endif
case EPIPE:
/* XXX why close it here and not below */
close((int)io->os_handle);
@@ -311,13 +309,13 @@
switch (errno) {
case EINTR:
goto AGAIN;
-# ifdef WSAEWOULDBLOCK
+# ifdef WSAEWOULDBLOCK
case WSAEWOULDBLOCK:
goto AGAIN;
-# else
+# else
case WSAEAGAIN:
goto AGAIN;
-# endif
+# endif
case WSAECONNRESET:
/* XXX why close it on err return result is -1 anyway */
close((int)io->os_handle);
@@ -452,8 +450,6 @@
return sockaddr;
}
-# endif /* PARROT_NET_DEVEL */
-
#endif /* PIO_OS_WIN32 */
/*
Modified: branches/gsoc_instrument/src/io/win32.c
==============================================================================
--- branches/gsoc_instrument/src/io/win32.c Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/io/win32.c Sat Jun 19 16:17:11 2010 (r47715)
@@ -134,10 +134,8 @@
{
ASSERT_ARGS(Parrot_io_init_win32)
HANDLE h;
-# if PARROT_NET_DEVEL
struct WSAData sockinfo;
int ret;
-# endif
if ((h = GetStdHandle(STD_INPUT_HANDLE)) != INVALID_HANDLE_VALUE) {
_PIO_STDIN(interp) = Parrot_io_fdopen_win32(interp, PMCNULL, h, PIO_F_READ);
@@ -157,7 +155,6 @@
else {
_PIO_STDERR(interp) = PMCNULL;
}
-# if PARROT_NET_DEVEL
/* Start Winsock
* no idea where or whether destroy it
*/
@@ -167,7 +164,6 @@
WSAGetLastError());
return -4;
}
-# endif
return 0;
}
Modified: branches/gsoc_instrument/src/key.c
==============================================================================
--- branches/gsoc_instrument/src/key.c Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/key.c Sat Jun 19 16:17:11 2010 (r47715)
@@ -146,31 +146,6 @@
return key_new_string(interp, Parrot_str_new(interp, value, 0));
}
-
-/*
-
-=item C<PMC * key_new_pmc(PARROT_INTERP, PMC *value)>
-
-Returns a new PMC C<Key> PMC with value C<value>.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
-PARROT_WARN_UNUSED_RESULT
-PMC *
-key_new_pmc(PARROT_INTERP, ARGIN(PMC *value))
-{
- ASSERT_ARGS(key_new_pmc)
- PMC * const key = Parrot_pmc_new(interp, enum_class_Key);
-
- PObj_get_FLAGS(key) |= KEY_pmc_FLAG;
- Parrot_ex_throw_from_c_args(interp, NULL, 1, "this is broken - see slice.pmc");
-}
-
-
/*
=item C<void key_set_integer(PARROT_INTERP, PMC *key, INTVAL value)>
@@ -263,33 +238,6 @@
return;
}
-
-/*
-
-=item C<void key_set_pmc(PARROT_INTERP, PMC *key, PMC *value)>
-
-Set the PMC C<value> in C<key>.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-void
-key_set_pmc(PARROT_INTERP, ARGMOD(PMC *key), ARGIN(PMC *value))
-{
- ASSERT_ARGS(key_set_pmc)
- PObj_get_FLAGS(key) &= ~KEY_type_FLAGS;
- PObj_get_FLAGS(key) |= KEY_pmc_FLAG;
-
- /*
- * XXX leo
- * what for is this indirection?
- */
- Parrot_ex_throw_from_c_args(interp, NULL, 1, "this is broken - see slice.pmc");
-}
-
-
/*
=item C<INTVAL key_type(PARROT_INTERP, const PMC *key)>
Modified: branches/gsoc_instrument/src/multidispatch.c
==============================================================================
--- branches/gsoc_instrument/src/multidispatch.c Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/multidispatch.c Sat Jun 19 16:17:11 2010 (r47715)
@@ -329,9 +329,9 @@
{
ASSERT_ARGS(Parrot_mmd_find_multi_from_long_sig)
STRING * const multi_str = CONST_STRING(interp, "MULTI");
- PMC * const ns = Parrot_make_namespace_keyed_str(interp,
+ PMC * const ns = Parrot_ns_make_namespace_keyed_str(interp,
interp->root_namespace, multi_str);
- PMC * const multi_sub = Parrot_get_global(interp, ns, name);
+ PMC * const multi_sub = Parrot_ns_get_global(interp, ns, name);
if (PMC_IS_NULL(multi_sub)) {
return PMCNULL;
@@ -844,7 +844,7 @@
if (PMC_IS_NULL(ns))
return;
- multi_sub = Parrot_get_global(interp, ns, name);
+ multi_sub = Parrot_ns_get_global(interp, ns, name);
if (PMC_IS_NULL(multi_sub))
return;
@@ -868,9 +868,9 @@
{
ASSERT_ARGS(mmd_search_global)
STRING * const multi_str = CONST_STRING(interp, "MULTI");
- PMC * const ns = Parrot_get_namespace_keyed_str(interp,
+ PMC * const ns = Parrot_ns_get_namespace_keyed_str(interp,
interp->root_namespace, multi_str);
- PMC *multi_sub = Parrot_get_global(interp, ns, name);
+ PMC *multi_sub = Parrot_ns_get_global(interp, ns, name);
if (PMC_IS_NULL(multi_sub))
return;
@@ -896,13 +896,13 @@
{
ASSERT_ARGS(mmd_add_multi_global)
STRING * const multi_str = CONST_STRING(interp, "MULTI");
- PMC * const ns = Parrot_make_namespace_keyed_str(interp,
+ PMC * const ns = Parrot_ns_make_namespace_keyed_str(interp,
interp->root_namespace, multi_str);
- PMC *multi_sub = Parrot_get_global(interp, ns, sub_name);
+ PMC *multi_sub = Parrot_ns_get_global(interp, ns, sub_name);
if (PMC_IS_NULL(multi_sub)) {
multi_sub = Parrot_pmc_new_constant(interp, enum_class_MultiSub);
- Parrot_set_global(interp, ns, sub_name, multi_sub);
+ Parrot_ns_set_global(interp, ns, sub_name, multi_sub);
}
PARROT_ASSERT(multi_sub->vtable->base_type == enum_class_MultiSub);
@@ -930,12 +930,12 @@
PMC * const hll_ns = VTABLE_get_pmc_keyed_int(interp,
interp->HLL_namespace,
Parrot_pcc_get_HLL(interp, CURRENT_CONTEXT(interp)));
- PMC * const ns = Parrot_make_namespace_keyed_str(interp, hll_ns, ns_name);
- PMC *multi_sub = Parrot_get_global(interp, ns, sub_name);
+ PMC * const ns = Parrot_ns_make_namespace_keyed_str(interp, hll_ns, ns_name);
+ PMC *multi_sub = Parrot_ns_get_global(interp, ns, sub_name);
if (PMC_IS_NULL(multi_sub)) {
multi_sub = Parrot_pmc_new_constant(interp, enum_class_MultiSub);
- Parrot_set_global(interp, ns, sub_name, multi_sub);
+ Parrot_ns_set_global(interp, ns, sub_name, multi_sub);
}
PARROT_ASSERT(multi_sub->vtable->base_type == enum_class_MultiSub);
Copied: branches/gsoc_instrument/src/namespace.c (from r47713, trunk/src/namespace.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/gsoc_instrument/src/namespace.c Sat Jun 19 16:17:11 2010 (r47715, copy of r47713, trunk/src/namespace.c)
@@ -0,0 +1,842 @@
+/*
+Copyright (C) 2004-2009, Parrot Foundation.
+$Id$
+
+=head1 NAME
+
+src/namespace.c
+
+=head1 DESCRIPTION
+
+Common routines for storing and finding elements in namespaces
+
+=cut
+
+*/
+
+#include "parrot/parrot.h"
+#include "namespace.str"
+#include "pmc/pmc_sub.h"
+#include "pmc/pmc_callcontext.h"
+
+/* HEADERIZER HFILE: include/parrot/namespace.h */
+/* HEADERIZER BEGIN: static */
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+static PMC * get_namespace_pmc(PARROT_INTERP, ARGIN(PMC *sub_pmc))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+static PMC * internal_ns_keyed(PARROT_INTERP,
+ ARGIN(PMC *base_ns),
+ ARGIN(PMC *pmc_key),
+ int flags)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+static PMC * internal_ns_keyed_key(PARROT_INTERP,
+ ARGIN(PMC *ns),
+ ARGIN(PMC *key),
+ int flags)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+static PMC * internal_ns_keyed_str(PARROT_INTERP,
+ ARGIN(PMC *base_ns),
+ ARGIN(STRING *key),
+ int flags)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+static PMC * internal_ns_maybe_create(PARROT_INTERP,
+ ARGIN(PMC *ns),
+ ARGIN(STRING *key),
+ int flags)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
+static void store_sub_in_multi(PARROT_INTERP,
+ ARGIN(PMC *sub_pmc),
+ ARGIN(PMC *ns))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
+#define ASSERT_ARGS_get_namespace_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(sub_pmc))
+#define ASSERT_ARGS_internal_ns_keyed __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(base_ns) \
+ , PARROT_ASSERT_ARG(pmc_key))
+#define ASSERT_ARGS_internal_ns_keyed_key __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(ns) \
+ , PARROT_ASSERT_ARG(key))
+#define ASSERT_ARGS_internal_ns_keyed_str __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(base_ns) \
+ , PARROT_ASSERT_ARG(key))
+#define ASSERT_ARGS_internal_ns_maybe_create __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(ns) \
+ , PARROT_ASSERT_ARG(key))
+#define ASSERT_ARGS_store_sub_in_multi __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(sub_pmc) \
+ , PARROT_ASSERT_ARG(ns))
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+/* HEADERIZER END: static */
+
+/* flags for internal_ns_keyed */
+#define INTERN_NS_CREAT 1 /* I'm a fan of the classics */
+
+/*
+
+=head1 Internal Static Functions
+
+=over 4
+
+=item C<static PMC * internal_ns_keyed_str(PARROT_INTERP, PMC *base_ns, STRING
+*key, int flags)>
+
+Looks up a nested NameSpace PMC starting from C<base_ns> and doing a relative
+lookup. C<key> is a STRING containing the name of the NameSpace to look up.
+Flags can be 0 or INTERN_NS_CREAT. In the former case, PMCNULL is returned
+if the namespace is not found. In the later, a new namespace with the given
+is created and returned if it is not found.
+
+=cut
+
+*/
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+static PMC *
+internal_ns_keyed_str(PARROT_INTERP, ARGIN(PMC *base_ns),
+ ARGIN(STRING *key), int flags)
+{
+ ASSERT_ARGS(internal_ns_keyed_str)
+ PMC * const ns = VTABLE_get_pmc_keyed_str(interp, base_ns, key);
+
+ if (!PMC_IS_NULL(ns) && VTABLE_isa(interp, ns, CONST_STRING(interp, "NameSpace")))
+ return ns;
+
+ return internal_ns_maybe_create(interp, base_ns, key, flags);
+}
+
+/*
+
+=item C<static PMC * internal_ns_keyed_key(PARROT_INTERP, PMC *ns, PMC *key, int
+flags)>
+
+Internal function to do keyed namespace lookup relative to a given namespace
+PMC. The namespace to find is located by C<key> relative to C<ns>. C<flags>
+determines what happens when an existing namespace is not found. 0 means
+PMCNULL is returned, INTERN_NS_CREAT means a new namespace is created.
+
+=cut
+
+*/
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+static PMC *
+internal_ns_keyed_key(PARROT_INTERP, ARGIN(PMC *ns), ARGIN(PMC *key), int flags)
+{
+ ASSERT_ARGS(internal_ns_keyed_key)
+ while (key) {
+ STRING * const part = VTABLE_get_string(interp, key);
+ PMC *sub_ns = VTABLE_get_pmc_keyed_str(interp, ns, part);
+
+ if (PMC_IS_NULL(sub_ns) || !VTABLE_isa(interp, sub_ns, CONST_STRING(interp, "NameSpace"))) {
+ sub_ns = internal_ns_maybe_create(interp, ns, part, flags);
+
+ if (PMC_IS_NULL(sub_ns))
+ return PMCNULL;
+ }
+
+ ns = sub_ns;
+ key = VTABLE_shift_pmc(interp, key);
+ }
+
+ return ns;
+}
+
+/*
+
+=item C<static PMC * internal_ns_keyed(PARROT_INTERP, PMC *base_ns, PMC
+*pmc_key, int flags)>
+
+Search for a namespace PMC starting from a base namespace C<base_ns> and
+following C<pmc_key> to the nested namespace. C<pmc_key> can be a String,
+a Key, or an array of strings (such as an ResizableStringArray, or a
+ResizablePMCArray that contains Strings). Flags determines what we do if the
+requested namespace is not found: 0 means we return PMCNULL, INTERN_NS_CREAT
+means we create the new namespace and return it.
+
+=cut
+
+*/
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+static PMC *
+internal_ns_keyed(PARROT_INTERP, ARGIN(PMC *base_ns), ARGIN(PMC *pmc_key), int flags)
+{
+ ASSERT_ARGS(internal_ns_keyed)
+
+ if (VTABLE_isa(interp, pmc_key, CONST_STRING(interp, "String"))) {
+ STRING * const str_key = VTABLE_get_string(interp, pmc_key);
+ return internal_ns_keyed_str(interp, base_ns, str_key, flags);
+ }
+ else if (PMC_IS_TYPE(pmc_key, Key))
+ return internal_ns_keyed_key(interp, base_ns, pmc_key, flags);
+ else {
+ /* array of strings */
+ STRING * const isans = CONST_STRING(interp, "NameSpace");
+ const INTVAL n = VTABLE_elements(interp, pmc_key);
+ INTVAL i;
+ PMC *ns = base_ns;
+
+ for (i = 0; i < n; ++i) {
+ STRING * const part = VTABLE_get_string_keyed_int(interp, pmc_key, i);
+ PMC *sub_ns = VTABLE_get_pmc_keyed_str(interp, ns, part);
+
+ if (PMC_IS_NULL(sub_ns) || !VTABLE_isa(interp, sub_ns, isans)) {
+ sub_ns = internal_ns_maybe_create(interp, ns, part, flags);
+ if (PMC_IS_NULL(sub_ns))
+ return PMCNULL;
+ }
+ ns = sub_ns;
+ }
+ return ns;
+ }
+}
+
+/*
+
+=item C<static PMC * internal_ns_maybe_create(PARROT_INTERP, PMC *ns, STRING
+*key, int flags)>
+
+Given a namespace PMC C<ns>, a STRING C<key> containing a name, and flags from
+C<internal_ns_keyed> or C<internal_ns_keyed_str>, creates and returns a new
+namespace with the given name as a child of the given namespace. This is an
+internal function only.
+
+=cut
+
+*/
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+static PMC *
+internal_ns_maybe_create(PARROT_INTERP, ARGIN(PMC *ns), ARGIN(STRING *key), int flags)
+{
+ ASSERT_ARGS(internal_ns_maybe_create)
+
+ /* TT #1220 - stop depending on typed namespace */
+ if (!(flags & INTERN_NS_CREAT))
+ return PMCNULL;
+ else {
+ const INTVAL type_id = Parrot_get_ctx_HLL_type(interp, enum_class_NameSpace);
+ /* TT #1221 - match HLL of enclosing namespace? */
+ PMC * const sub_ns = Parrot_pmc_new(interp, type_id);
+
+ if (PMC_IS_NULL(sub_ns))
+ return PMCNULL;
+
+ VTABLE_set_pmc_keyed_str(interp, ns, key, sub_ns);
+ return sub_ns;
+ }
+}
+
+/*
+
+=item C<static PMC * get_namespace_pmc(PARROT_INTERP, PMC *sub_pmc)>
+
+Return the namespace PMC associated with the PMC C<sub>. If there is no
+NameSpace associated with the sub, return it's HLL NameSpace PMC instead.
+
+=cut
+
+*/
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+static PMC *
+get_namespace_pmc(PARROT_INTERP, ARGIN(PMC *sub_pmc))
+{
+ ASSERT_ARGS(get_namespace_pmc)
+ Parrot_Sub_attributes *sub;
+ PMC *nsname, *nsroot;
+
+ PMC_get_sub(interp, sub_pmc, sub);
+ nsname = sub->namespace_name;
+ nsroot = Parrot_get_HLL_namespace(interp, sub->HLL_id);
+
+ /* If we have a NULL, return the HLL namespace */
+ if (PMC_IS_NULL(nsname))
+ return nsroot;
+ /* If we have a String, do a string lookup */
+ else if (nsname->vtable->base_type == enum_class_String)
+ return Parrot_ns_make_namespace_keyed_str(interp, nsroot,
+ VTABLE_get_string(interp, nsname));
+ /* Otherwise, do a PMC lookup */
+ else
+ return Parrot_ns_make_namespace_keyed(interp, nsroot, nsname);
+}
+
+/*
+
+=item C<static void store_sub_in_multi(PARROT_INTERP, PMC *sub_pmc, PMC *ns)>
+
+Adds the sub C<sub> into a multisub of the same name in the namespace C<ns>.
+If no multisub by that name currently exists, we create one.
+
+=cut
+
+*/
+
+static void
+store_sub_in_multi(PARROT_INTERP, ARGIN(PMC *sub_pmc), ARGIN(PMC *ns))
+{
+ ASSERT_ARGS(store_sub_in_multi)
+ Parrot_Sub_attributes *sub;
+ STRING *ns_entry_name;
+ PMC *multisub;
+
+ PMC_get_sub(interp, sub_pmc, sub);
+ ns_entry_name = sub->ns_entry_name;
+ multisub = VTABLE_get_pmc_keyed_str(interp, ns, ns_entry_name);
+
+ /* is there an existing MultiSub PMC? or do we need to create one? */
+ if (PMC_IS_NULL(multisub)) {
+ multisub = Parrot_pmc_new(interp, Parrot_get_ctx_HLL_type(interp, enum_class_MultiSub));
+ /* we have to push the sub onto the MultiSub before we try to store
+ it because storing requires information from the sub */
+ VTABLE_push_pmc(interp, multisub, sub_pmc);
+ VTABLE_set_pmc_keyed_str(interp, ns, ns_entry_name, multisub);
+ }
+ else
+ VTABLE_push_pmc(interp, multisub, sub_pmc);
+}
+
+/*
+
+=back
+
+=head1 NameSpace API Functions
+
+=over 4
+
+=item C<PMC * Parrot_ns_get_namespace_keyed(PARROT_INTERP, PMC *base_ns, PMC
+*pmc_key)>
+
+Find the namespace relative to the namespace C<base_ns> with the key
+C<pmc_key>, which may be a String, a Key, or an array of strings. Return
+the namespace, or NULL if not found.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC *
+Parrot_ns_get_namespace_keyed(PARROT_INTERP, ARGIN(PMC *base_ns), ARGIN(PMC *pmc_key))
+{
+ ASSERT_ARGS(Parrot_ns_get_namespace_keyed)
+ return internal_ns_keyed(interp, base_ns, pmc_key, 0);
+}
+
+/*
+
+=item C<PMC * Parrot_ns_get_namespace_keyed_str(PARROT_INTERP, PMC *base_ns,
+STRING *str_key)>
+
+Find the namespace relative to the namespace C<base_ns> with the string key
+C<str_key>. Return the namespace, or NULL if not found.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC *
+Parrot_ns_get_namespace_keyed_str(PARROT_INTERP, ARGIN(PMC *base_ns),
+ ARGIN_NULLOK(STRING *str_key))
+{
+ ASSERT_ARGS(Parrot_ns_get_namespace_keyed_str)
+ return internal_ns_keyed_str(interp, base_ns, str_key, 0);
+}
+
+/*
+
+=item C<PMC * Parrot_ns_make_namespace_keyed(PARROT_INTERP, PMC *base_ns, PMC
+*pmc_key)>
+
+Find, or create if necessary, the namespace relative to the namespace
+C<base_ns> with the key C<pmc_key>, which may be a String, a Key, or an
+array of strings. Return the namespace. Errors will result in exceptions.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC *
+Parrot_ns_make_namespace_keyed(PARROT_INTERP, ARGIN(PMC *base_ns),
+ ARGIN(PMC *pmc_key))
+{
+ ASSERT_ARGS(Parrot_ns_make_namespace_keyed)
+ return internal_ns_keyed(interp, base_ns, pmc_key, INTERN_NS_CREAT);
+}
+
+/*
+
+=item C<PMC * Parrot_ns_make_namespace_keyed_str(PARROT_INTERP, PMC *base_ns,
+STRING *str_key)>
+
+Find, or create if necessary, the namespace relative to the namespace
+C<base_ns> with the string key C<str_key>. Return the namespace. Errors
+will result in exceptions.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC *
+Parrot_ns_make_namespace_keyed_str(PARROT_INTERP, ARGIN(PMC *base_ns),
+ ARGIN(STRING *str_key))
+{
+ ASSERT_ARGS(Parrot_ns_make_namespace_keyed_str)
+ return internal_ns_keyed_str(interp, base_ns, str_key, INTERN_NS_CREAT);
+}
+
+/*
+
+=item C<PMC * Parrot_ns_make_namespace_autobase(PARROT_INTERP, PMC *key)>
+
+Find, or create if necessary, a namespace with the key C<key>, which may be a
+String, a Key, or an array of strings. If it is a String, then the lookup is
+relative to the current namespace. Otherwise, it is relative to the current HLL
+root namespace. Return the namespace. Errors will result in exceptions.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC *
+Parrot_ns_make_namespace_autobase(PARROT_INTERP, ARGIN_NULLOK(PMC *key))
+{
+ ASSERT_ARGS(Parrot_ns_make_namespace_autobase)
+ PMC *base_ns;
+ if (VTABLE_isa(interp, key, CONST_STRING(interp, "String")))
+ base_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
+ else
+ base_ns = VTABLE_get_pmc_keyed_int(interp, interp->HLL_namespace,
+ Parrot_pcc_get_HLL(interp, CURRENT_CONTEXT(interp)));
+ return Parrot_ns_make_namespace_keyed(interp, base_ns, key);
+}
+
+/*
+
+=item C<PMC * Parrot_ns_get_name(PARROT_INTERP, PMC *_namespace)>
+
+Get the name of the namespace, as a ResizableStringArray. For instance, the
+namespace Foo:Bar:Baz would return an RSA with three elements.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC *
+Parrot_ns_get_name(PARROT_INTERP, ARGIN(PMC *_namespace))
+{
+ ASSERT_ARGS(Parrot_ns_get_name)
+ PMC *names;
+ STRING * const get_name = CONST_STRING(interp, "get_name");
+ Parrot_pcc_invoke_method_from_c_args(interp, _namespace, get_name, "->P", &names);
+ return names;
+}
+
+/*
+
+=item C<PMC * Parrot_ns_get_global(PARROT_INTERP, PMC *ns, STRING *globalname)>
+
+Look up the global named C<globalname> in the namespace C<ns>. Return the
+global, or return PMCNULL if C<ns> is null or if the global is not found.
+
+Parrot_ns_get_global allows a null namespace without throwing an exception; it
+simply returns PMCNULL in that case.
+
+NOTE: At present the use of the {get, set}_global functions is mandatory due
+ to the wacky namespace typing of the default Parrot namespace.
+ Eventually it will be safe to just use the standard hash interface
+ (if desired).
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC *
+Parrot_ns_get_global(PARROT_INTERP, ARGIN_NULLOK(PMC *ns), ARGIN_NULLOK(STRING *globalname))
+{
+ ASSERT_ARGS(Parrot_ns_get_global)
+ if (PMC_IS_NULL(ns))
+ return PMCNULL;
+
+ return (PMC *)VTABLE_get_pointer_keyed_str(interp, ns, globalname);
+}
+
+/*
+
+=item C<void Parrot_ns_set_global(PARROT_INTERP, PMC *ns, STRING *globalname,
+PMC *val)>
+
+Set the global named C<globalname> in the namespace C<ns> to the value C<val>.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+void
+Parrot_ns_set_global(PARROT_INTERP, ARGIN_NULLOK(PMC *ns),
+ ARGIN_NULLOK(STRING *globalname), ARGIN_NULLOK(PMC *val))
+{
+ ASSERT_ARGS(Parrot_ns_set_global)
+ VTABLE_set_pmc_keyed_str(interp, ns, globalname, val);
+}
+
+
+/*
+
+=item C<PMC * Parrot_ns_find_namespace_global(PARROT_INTERP, PMC *ns, STRING
+*globalname)>
+
+Search the namespace PMC C<ns> for an object with name C<globalname>.
+Return the object, or NULL if not found.
+
+TT #1222 - For now this function prefers non-namespaces, it will eventually
+entirely use the untyped interface.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC *
+Parrot_ns_find_namespace_global(PARROT_INTERP,
+ ARGIN_NULLOK(PMC *ns), ARGIN_NULLOK(STRING *globalname))
+{
+ ASSERT_ARGS(Parrot_ns_find_namespace_global)
+ PMC *res;
+
+ if (PMC_IS_NULL(ns))
+ res = PMCNULL;
+ else {
+ /*
+ * TT #1219 - we should be able to use 'get_pmc_keyed' here,
+ * but we can't because Parrot's default namespaces are not
+ * fully typed and there's a pseudo-typed interface that
+ * distinguishes 'get_pmc_keyed' from 'get_pointer_keyed';
+ * the former is for NS and the latter is for non-NS.
+ */
+ res = (PMC *)VTABLE_get_pointer_keyed_str(interp, ns, globalname);
+ }
+
+ return PMC_IS_NULL(res) ? NULL : res;
+}
+
+/*
+
+=item C<PMC * Parrot_ns_find_current_namespace_global(PARROT_INTERP, STRING
+*globalname)>
+
+Finds and returns the data time named C<globalname> in the current namespace.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC *
+Parrot_ns_find_current_namespace_global(PARROT_INTERP, ARGIN_NULLOK(STRING *globalname))
+{
+ ASSERT_ARGS(Parrot_ns_find_current_namespace_global)
+ PMC * const ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
+ return Parrot_ns_find_namespace_global(interp, ns, globalname);
+}
+
+/*
+
+=item C<PMC * Parrot_find_global_s(PARROT_INTERP, STRING *str_key, STRING
+*globalname)>
+
+Search the namespace designated by C<str_key>, or the HLL root if
+C<str_key> is NULL, for an object with name C<globalname>. Return the
+object, or NULL if not found.
+
+TT #1222 - For now this function prefers non-namespaces, it will eventually
+entirely use the untyped interface.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC *
+Parrot_find_global_s(PARROT_INTERP, ARGIN_NULLOK(STRING *str_key),
+ ARGIN_NULLOK(STRING *globalname))
+{
+ ASSERT_ARGS(Parrot_find_global_s)
+ PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
+ PMC * const ns = Parrot_ns_get_namespace_keyed_str(interp, hll_ns, str_key);
+ return Parrot_ns_find_namespace_global(interp, ns, globalname);
+}
+
+/*
+
+=item C<void Parrot_ns_store_global(PARROT_INTERP, PMC *ns, STRING *globalname,
+PMC *val)>
+
+Store the PMC C<val> into the namespace PMC C<ns> with name C<globalname>. If
+the namespace is null, do nothing.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+void
+Parrot_ns_store_global(PARROT_INTERP, ARGIN_NULLOK(PMC *ns),
+ ARGIN_NULLOK(STRING *globalname), ARGIN_NULLOK(PMC *val))
+{
+ ASSERT_ARGS(Parrot_ns_store_global)
+
+ if (PMC_IS_NULL(ns))
+ return;
+
+ VTABLE_set_pmc_keyed_str(interp, ns, globalname, val);
+}
+
+/*
+
+=item C<void Parrot_store_global_s(PARROT_INTERP, STRING *str_key, STRING
+*globalname, PMC *val)>
+
+Store the PMC C<val> into the namespace designated by C<str_key>, or
+the HLL root if C<str_key> is NULL, with the name C<globalname>.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+void
+Parrot_store_global_s(PARROT_INTERP, ARGIN_NULLOK(STRING *str_key),
+ ARGIN_NULLOK(STRING *globalname), ARGIN_NULLOK(PMC *val))
+{
+ ASSERT_ARGS(Parrot_store_global_s)
+ PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
+ PMC * const ns = Parrot_ns_make_namespace_keyed_str(interp, hll_ns, str_key);
+ Parrot_ns_store_global(interp, ns, globalname, val);
+
+ /* TT #1225 - method cache invalidation should be a namespace function */
+ Parrot_invalidate_method_cache(interp, str_key);
+}
+
+
+/*
+
+=item C<PMC * Parrot_ns_find_global_from_op(PARROT_INTERP, PMC *ns, STRING
+*globalname, void *next)>
+
+If the global exists in the given namespace PMC, return it. If not, return
+PMCNULL. Throw an exception if a NULL name is passed.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CANNOT_RETURN_NULL
+PMC *
+Parrot_ns_find_global_from_op(PARROT_INTERP, ARGIN(PMC *ns),
+ ARGIN_NULLOK(STRING *globalname), ARGIN_NULLOK(void *next))
+{
+ ASSERT_ARGS(Parrot_ns_find_global_from_op)
+ if (STRING_IS_NULL(globalname))
+ Parrot_ex_throw_from_c_args(interp, next, EXCEPTION_GLOBAL_NOT_FOUND,
+ "Tried to get null global");
+ else {
+ PMC * const res = Parrot_ns_find_namespace_global(interp, ns, globalname);
+ if (!res)
+ return PMCNULL;
+ return res;
+ }
+}
+
+
+/*
+
+=item C<PMC * Parrot_ns_find_named_item(PARROT_INTERP, STRING *name, void
+*next)>
+
+TT #1223 - THIS IS BROKEN - it doesn't walk up the scopes yet
+
+Find the given C<name> in lexicals, then the current namespace, then the HLL
+root namespace, and finally Parrot builtins. If the name isn't found
+anywhere, return PMCNULL.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC *
+Parrot_ns_find_named_item(PARROT_INTERP, ARGIN(STRING *name), SHIM(void *next))
+{
+ ASSERT_ARGS(Parrot_ns_find_named_item)
+ PMC * const ctx = CURRENT_CONTEXT(interp);
+ PMC * const lex_pad = Parrot_find_pad(interp, name, ctx);
+ PMC * g = PMCNULL;
+
+ if (!PMC_IS_NULL(lex_pad)) {
+ g = VTABLE_get_pmc_keyed_str(interp, lex_pad, name);
+
+ /* TT #1223 - walk up the scopes! duh!! */
+ if (!PMC_IS_NULL(g))
+ return g;
+ }
+
+ g = Parrot_ns_find_current_namespace_global(interp, name);
+ if (!PMC_IS_NULL(g))
+ return g;
+
+ g = Parrot_ns_find_namespace_global(interp, Parrot_get_ctx_HLL_namespace(interp), name);
+ if (!PMC_IS_NULL(g))
+ return g;
+ return PMCNULL;
+}
+
+/*
+
+=item C<void Parrot_ns_store_sub(PARROT_INTERP, PMC *sub_pmc)>
+
+Adds the PMC C<sub> into the current namespace. Adds the sub to a multi of the
+same name if it's defined as a multi.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+void
+Parrot_ns_store_sub(PARROT_INTERP, ARGIN(PMC *sub_pmc))
+{
+ ASSERT_ARGS(Parrot_ns_store_sub)
+ const INTVAL cur_id = Parrot_pcc_get_HLL(interp, CURRENT_CONTEXT(interp));
+
+ PMC *ns;
+ Parrot_Sub_attributes *sub;
+
+ /* PF structures aren't fully constructed yet */
+ Parrot_block_GC_mark(interp);
+
+ /* store relative to HLL namespace */
+ PMC_get_sub(interp, sub_pmc, sub);
+ Parrot_pcc_set_HLL(interp, CURRENT_CONTEXT(interp), sub->HLL_id);
+
+ ns = get_namespace_pmc(interp, sub_pmc);
+
+ /* attach a namespace to the sub for lookups */
+ sub->namespace_stash = ns;
+
+ /* store a :multi sub */
+ if (!PMC_IS_NULL(sub->multi_signature))
+ store_sub_in_multi(interp, sub_pmc, ns);
+
+ /* store other subs (as long as they're not :anon) */
+ else if (!(PObj_get_FLAGS(sub_pmc) & SUB_FLAG_PF_ANON)
+ || sub->vtable_index != -1) {
+ STRING * const ns_entry_name = sub->ns_entry_name;
+ PMC * const nsname = sub->namespace_name;
+
+ Parrot_ns_store_global(interp, ns, ns_entry_name, sub_pmc);
+
+ /* TT #1224:
+ TEMPORARY HACK - cache invalidation should be a namespace function
+ */
+ if (!PMC_IS_NULL(nsname)) {
+ STRING * const nsname_s = VTABLE_get_string(interp, nsname);
+ Parrot_invalidate_method_cache(interp, nsname_s);
+ }
+ }
+
+ /* restore HLL_id */
+ Parrot_pcc_set_HLL(interp, CURRENT_CONTEXT(interp), cur_id);
+ Parrot_unblock_GC_mark(interp);
+}
+
+/*
+
+=back
+
+=head1 SEE ALSO
+
+F<include/parrot/namespace.h>
+
+=cut
+
+*/
+
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
Modified: branches/gsoc_instrument/src/nci/core_thunks.c
==============================================================================
--- branches/gsoc_instrument/src/nci/core_thunks.c Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/nci/core_thunks.c Sat Jun 19 16:17:11 2010 (r47715)
@@ -125,7 +125,7 @@
char *t_1; STRING *ts_1;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "S", &ts_1);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (PMC *)(*fn_pointer)(interp, t_1);
@@ -868,7 +868,7 @@
char *t_2; STRING *ts_2;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PS", &t_1, &ts_2);
- t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;
+ t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (int)(*fn_pointer)(interp, t_1, t_2);
Modified: branches/gsoc_instrument/src/nci/extra_thunks.c
==============================================================================
--- branches/gsoc_instrument/src/nci/extra_thunks.c Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/nci/extra_thunks.c Sat Jun 19 16:17:11 2010 (r47715)
@@ -195,7 +195,7 @@
PMC *t_1;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "SP", &ts_0, &t_1);
- t_0 = ts_0 ? Parrot_str_to_cstring(interp, ts_0) : (char *)NULL;
+ t_0 = STRING_IS_NULL(ts_0) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_0);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (int)(*fn_pointer)(t_0, PMC_IS_NULL((PMC*)t_1) ? (void *)NULL : VTABLE_get_pointer(interp, t_1));
@@ -296,7 +296,7 @@
INTVAL t_3;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PSI", &t_1, &ts_2, &t_3);
- t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;
+ t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (char *)(*fn_pointer)(interp, PMC_IS_NULL((PMC*)t_1) ? (void *)NULL : VTABLE_get_pointer(interp, t_1), t_2, t_3);
@@ -346,7 +346,7 @@
char *t_1; STRING *ts_1;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PS", &t_0, &ts_1);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (char *)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1);
@@ -392,7 +392,7 @@
char *t_2; STRING *ts_2;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PIS", &t_0, &t_1, &ts_2);
- t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;
+ t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2);
@@ -417,7 +417,7 @@
char *t_2; STRING *ts_2;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PSS", &t_0, &ts_1, &ts_2);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2);
@@ -445,7 +445,7 @@
char *t_6; STRING *ts_6;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "SIIIPS", &ts_1, &t_2, &t_3, &t_4, &t_5, &ts_6);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;t_6 = ts_6 ? Parrot_str_to_cstring(interp, ts_6) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);t_6 = STRING_IS_NULL(ts_6) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_6);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
(*fn_pointer)(interp, t_1, t_2, t_3, t_4, PMC_IS_NULL((PMC*)t_5) ? (void *)NULL : VTABLE_get_pointer(interp, t_5), t_6);
@@ -476,7 +476,7 @@
PMC * t_4;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "SSPP", &ts_1, &ts_2, &t_3, &t_4);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (void *)(*fn_pointer)(interp, t_1, t_2, t_3, t_4);
@@ -507,7 +507,7 @@
INTVAL t_3;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "SPI", &ts_1, &t_2, &t_3);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (PMC *)(*fn_pointer)(interp, t_1, PMC_IS_NULL((PMC*)t_2) ? (void *)NULL : VTABLE_get_pointer(interp, t_2), t_3);
@@ -585,7 +585,7 @@
char *t_1; STRING *ts_1;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PS", &t_0, &ts_1);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1);
@@ -608,7 +608,7 @@
char *t_2; STRING *ts_2;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PS", &t_1, &ts_2);
- t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;
+ t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
(*fn_pointer)(interp, PMC_IS_NULL((PMC*)t_1) ? (void *)NULL : VTABLE_get_pointer(interp, t_1), t_2);
@@ -1369,7 +1369,7 @@
INTVAL t_3;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PSII", &t_0, &ts_1, &t_2, &t_3);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (int)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2, t_3);
@@ -1424,7 +1424,7 @@
INTVAL t_3;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PSSI", &t_0, &ts_1, &ts_2, &t_3);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (char *)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2, t_3);
@@ -1452,7 +1452,7 @@
INTVAL t_2;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PSI", &t_0, &ts_1, &t_2);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (char *)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2);
@@ -1481,7 +1481,7 @@
INTVAL t_4;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PSSSI", &t_0, &ts_1, &ts_2, &ts_3, &t_4);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;t_3 = ts_3 ? Parrot_str_to_cstring(interp, ts_3) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);t_3 = STRING_IS_NULL(ts_3) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_3);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (char *)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2, t_3, t_4);
@@ -1642,7 +1642,7 @@
char *t_1; STRING *ts_1;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "SS", &ts_0, &ts_1);
- t_0 = ts_0 ? Parrot_str_to_cstring(interp, ts_0) : (char *)NULL;t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;
+ t_0 = STRING_IS_NULL(ts_0) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_0);t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (char *)(*fn_pointer)(t_0, t_1);
@@ -1666,7 +1666,7 @@
char *t_2; STRING *ts_2;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PiS", &t_1, &ts_2);
- t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;
+ t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (INTVAL)(*fn_pointer)(interp, t_1, t_2);
@@ -2027,7 +2027,7 @@
INTVAL t_3;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "ISSI", &t_0, &ts_1, &ts_2, &t_3);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (long)(*fn_pointer)(t_0, t_1, t_2, t_3);
@@ -2223,7 +2223,7 @@
char *t_5; STRING *ts_5;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PSSSSS", &t_0, &ts_1, &ts_2, &ts_3, &ts_4, &ts_5);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;t_3 = ts_3 ? Parrot_str_to_cstring(interp, ts_3) : (char *)NULL;t_4 = ts_4 ? Parrot_str_to_cstring(interp, ts_4) : (char *)NULL;t_5 = ts_5 ? Parrot_str_to_cstring(interp, ts_5) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);t_3 = STRING_IS_NULL(ts_3) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_3);t_4 = STRING_IS_NULL(ts_4) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_4);t_5 = STRING_IS_NULL(ts_5) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_5);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (int)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2, t_3, t_4, t_5);
@@ -2252,7 +2252,7 @@
char *t_3; STRING *ts_3;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PSSS", &t_0, &ts_1, &ts_2, &ts_3);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;t_3 = ts_3 ? Parrot_str_to_cstring(interp, ts_3) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);t_3 = STRING_IS_NULL(ts_3) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_3);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (char)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2, t_3);
@@ -2284,7 +2284,7 @@
INTVAL t_7;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PSSSSISI", &t_0, &ts_1, &ts_2, &ts_3, &ts_4, &t_5, &ts_6, &t_7);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;t_3 = ts_3 ? Parrot_str_to_cstring(interp, ts_3) : (char *)NULL;t_4 = ts_4 ? Parrot_str_to_cstring(interp, ts_4) : (char *)NULL;t_6 = ts_6 ? Parrot_str_to_cstring(interp, ts_6) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);t_3 = STRING_IS_NULL(ts_3) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_3);t_4 = STRING_IS_NULL(ts_4) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_4);t_6 = STRING_IS_NULL(ts_6) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_6);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (void *)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2, t_3, t_4, t_5, t_6, t_7);
@@ -2317,7 +2317,7 @@
char *t_1; STRING *ts_1;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PS", &t_0, &ts_1);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (int)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1);
@@ -2341,7 +2341,7 @@
INTVAL t_2;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PSI", &t_0, &ts_1, &t_2);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (int)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2);
@@ -2431,7 +2431,7 @@
char *t_1; STRING *ts_1;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PS", &t_0, &ts_1);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (void *)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1);
@@ -2460,7 +2460,7 @@
char *t_2; STRING *ts_2;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PSS", &t_0, &ts_1, &ts_2);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (void *)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2);
@@ -2489,7 +2489,7 @@
char *t_2; STRING *ts_2;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PIS", &t_0, &t_1, &ts_2);
- t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;
+ t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (int)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2);
@@ -2542,7 +2542,7 @@
INTVAL t_2;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "SSI", &ts_0, &ts_1, &t_2);
- t_0 = ts_0 ? Parrot_str_to_cstring(interp, ts_0) : (char *)NULL;t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;
+ t_0 = STRING_IS_NULL(ts_0) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_0);t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (long)(*fn_pointer)(t_0, t_1, t_2);
@@ -2568,7 +2568,7 @@
INTVAL t_3;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PSSI", &t_0, &ts_1, &ts_2, &t_3);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (long)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2, t_3);
@@ -2592,7 +2592,7 @@
char *t_0; STRING *ts_0;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "S", &ts_0);
- t_0 = ts_0 ? Parrot_str_to_cstring(interp, ts_0) : (char *)NULL;
+ t_0 = STRING_IS_NULL(ts_0) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_0);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
(*fn_pointer)(t_0);
@@ -2621,7 +2621,7 @@
INTVAL t_7;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PSSSSISI", &t_0, &ts_1, &ts_2, &ts_3, &ts_4, &t_5, &ts_6, &t_7);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;t_3 = ts_3 ? Parrot_str_to_cstring(interp, ts_3) : (char *)NULL;t_4 = ts_4 ? Parrot_str_to_cstring(interp, ts_4) : (char *)NULL;t_6 = ts_6 ? Parrot_str_to_cstring(interp, ts_6) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);t_3 = STRING_IS_NULL(ts_3) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_3);t_4 = STRING_IS_NULL(ts_4) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_4);t_6 = STRING_IS_NULL(ts_6) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_6);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (void *)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2, t_3, t_4, t_5, t_6, t_7);
@@ -2658,7 +2658,7 @@
PMC * t_4;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "SISPP", &ts_0, &t_1, &ts_2, &t_3, &t_4);
- t_0 = ts_0 ? Parrot_str_to_cstring(interp, ts_0) : (char *)NULL;t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *) NULL;i_3 = VTABLE_get_integer(interp, t_3);
+ t_0 = STRING_IS_NULL(ts_0) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_0);t_2 = STRING_IS_NULL(ts_2) ? (char *) NULL : Parrot_str_to_cstring(interp, ts_2);i_3 = VTABLE_get_integer(interp, t_3);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (void *)(*fn_pointer)(t_0, t_1, &t_2, &i_3, t_4);
@@ -2692,7 +2692,7 @@
PMC * t_4;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "SIPPP", &ts_0, &t_1, &t_2, &t_3, &t_4);
- t_0 = ts_0 ? Parrot_str_to_cstring(interp, ts_0) : (char *)NULL;i_3 = VTABLE_get_integer(interp, t_3);
+ t_0 = STRING_IS_NULL(ts_0) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_0);i_3 = VTABLE_get_integer(interp, t_3);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (void *)(*fn_pointer)(t_0, t_1, PMC_IS_NULL((PMC*)t_2) ? (void *)NULL : VTABLE_get_pointer(interp, t_2), &i_3, t_4);
@@ -2728,7 +2728,7 @@
INTVAL t_7;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PPSIIIPI", &t_0, &t_1, &ts_2, &t_3, &t_4, &t_5, &t_6, &t_7);
- t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;
+ t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (int)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2, t_3, t_4, t_5, PMC_IS_NULL((PMC*)t_6) ? (void *)NULL : VTABLE_get_pointer(interp, t_6), t_7);
@@ -2761,7 +2761,7 @@
INTVAL t_5;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "SPIISI", &ts_0, &t_1, &t_2, &t_3, &t_4, &t_5);
- t_0 = ts_0 ? Parrot_str_to_cstring(interp, ts_0) : (char *)NULL;
+ t_0 = STRING_IS_NULL(ts_0) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_0);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (int)(*fn_pointer)(t_0, PMC_IS_NULL((PMC*)t_1) ? (void *)NULL : VTABLE_get_pointer(interp, t_1), t_2, t_3, Buffer_bufstart(t_4), t_5);
@@ -2795,7 +2795,7 @@
INTVAL t_7;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PSIPPPPI", &t_0, &ts_1, &t_2, &t_3, &t_4, &t_5, &t_6, &t_7);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (void *)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2, PMC_IS_NULL((PMC*)t_3) ? (void *)NULL : VTABLE_get_pointer(interp, t_3), PMC_IS_NULL((PMC*)t_4) ? (void *)NULL : VTABLE_get_pointer(interp, t_4), PMC_IS_NULL((PMC*)t_5) ? (void *)NULL : VTABLE_get_pointer(interp, t_5), PMC_IS_NULL((PMC*)t_6) ? (void *)NULL : VTABLE_get_pointer(interp, t_6), t_7);
@@ -2870,7 +2870,7 @@
PMC *t_4;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PSSIP", &t_0, &ts_1, &ts_2, &t_3, &t_4);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (void *)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2, t_3, PMC_IS_NULL((PMC*)t_4) ? (void *)NULL : VTABLE_get_pointer(interp, t_4));
@@ -2906,7 +2906,7 @@
INTVAL t_6;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PSIPPPI", &t_0, &ts_1, &t_2, &t_3, &t_4, &t_5, &t_6);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (void *)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2, PMC_IS_NULL((PMC*)t_3) ? (void *)NULL : VTABLE_get_pointer(interp, t_3), PMC_IS_NULL((PMC*)t_4) ? (void *)NULL : VTABLE_get_pointer(interp, t_4), PMC_IS_NULL((PMC*)t_5) ? (void *)NULL : VTABLE_get_pointer(interp, t_5), t_6);
@@ -3052,7 +3052,7 @@
INTVAL t_2;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PSI", &t_0, &ts_1, &t_2);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (void *)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2);
@@ -3108,7 +3108,7 @@
INTVAL t_3;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PSII", &t_0, &ts_1, &t_2, &t_3);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (void *)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2, t_3);
@@ -3138,7 +3138,7 @@
INTVAL t_1;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "SI", &ts_0, &t_1);
- t_0 = ts_0 ? Parrot_str_to_cstring(interp, ts_0) : (char *)NULL;
+ t_0 = STRING_IS_NULL(ts_0) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_0);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (void *)(*fn_pointer)(t_0, t_1);
@@ -3167,7 +3167,7 @@
PMC *t_2;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PSP", &t_0, &ts_1, &t_2);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (void *)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, PMC_IS_NULL((PMC*)t_2) ? (void *)NULL : VTABLE_get_pointer(interp, t_2));
@@ -3197,7 +3197,7 @@
PMC *t_3; int i_3;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PSPP", &t_0, &ts_1, &t_2, &t_3);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;i_2 = VTABLE_get_integer(interp, t_2);i_3 = VTABLE_get_integer(interp, t_3);
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);i_2 = VTABLE_get_integer(interp, t_2);i_3 = VTABLE_get_integer(interp, t_3);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (int)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, &i_2, &i_3);
@@ -3643,7 +3643,7 @@
char *t_2; STRING *ts_2;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "IIS", &t_0, &t_1, &ts_2);
- t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;
+ t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (int)(*fn_pointer)(t_0, t_1, t_2);
@@ -3669,7 +3669,7 @@
INTVAL t_3;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "IISI", &t_0, &t_1, &ts_2, &t_3);
- t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;
+ t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (int)(*fn_pointer)(t_0, t_1, t_2, t_3);
@@ -3722,7 +3722,7 @@
INTVAL t_2;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "ISI", &t_0, &ts_1, &t_2);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (int)(*fn_pointer)(t_0, t_1, t_2);
@@ -4253,7 +4253,7 @@
char *t_3; STRING *ts_3;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PIIS", &t_0, &t_1, &t_2, &ts_3);
- t_3 = ts_3 ? Parrot_str_to_cstring(interp, ts_3) : (char *)NULL;
+ t_3 = STRING_IS_NULL(ts_3) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_3);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (int)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2, t_3);
@@ -4281,7 +4281,7 @@
INTVAL t_4;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PIISI", &t_0, &t_1, &t_2, &ts_3, &t_4);
- t_3 = ts_3 ? Parrot_str_to_cstring(interp, ts_3) : (char *)NULL;
+ t_3 = STRING_IS_NULL(ts_3) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_3);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (int)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2, t_3, t_4);
@@ -4615,7 +4615,7 @@
INTVAL t_2;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PSI", &t_0, &ts_1, &t_2);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (int)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2);
@@ -4641,7 +4641,7 @@
INTVAL t_3;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PISI", &t_0, &t_1, &ts_2, &t_3);
- t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;
+ t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (int)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2, t_3);
@@ -4813,7 +4813,7 @@
char *t_0; STRING *ts_0;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "S", &ts_0);
- t_0 = ts_0 ? Parrot_str_to_cstring(interp, ts_0) : (char *)NULL;
+ t_0 = STRING_IS_NULL(ts_0) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_0);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (int)(*fn_pointer)(t_0);
@@ -4835,7 +4835,7 @@
INTVAL t_1;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "SI", &ts_0, &t_1);
- t_0 = ts_0 ? Parrot_str_to_cstring(interp, ts_0) : (char *)NULL;
+ t_0 = STRING_IS_NULL(ts_0) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_0);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (int)(*fn_pointer)(t_0, t_1);
@@ -5097,7 +5097,7 @@
char *t_0; STRING *ts_0;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "S", &ts_0);
- t_0 = ts_0 ? Parrot_str_to_cstring(interp, ts_0) : (char *) NULL;
+ t_0 = STRING_IS_NULL(ts_0) ? (char *) NULL : Parrot_str_to_cstring(interp, ts_0);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (void *)(*fn_pointer)(&t_0);
@@ -5149,7 +5149,7 @@
char *t_1; STRING *ts_1;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "S", &ts_1);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (void *)(*fn_pointer)(interp, t_1);
@@ -5402,7 +5402,7 @@
char *t_0; STRING *ts_0;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "S", &ts_0);
- t_0 = ts_0 ? Parrot_str_to_cstring(interp, ts_0) : (char *)NULL;
+ t_0 = STRING_IS_NULL(ts_0) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_0);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (void *)(*fn_pointer)(t_0);
@@ -5430,7 +5430,7 @@
PMC *t_2;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "SPP", &ts_0, &t_1, &t_2);
- t_0 = ts_0 ? Parrot_str_to_cstring(interp, ts_0) : (char *)NULL;
+ t_0 = STRING_IS_NULL(ts_0) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_0);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (void *)(*fn_pointer)(t_0, PMC_IS_NULL((PMC*)t_1) ? (void *)NULL : VTABLE_get_pointer(interp, t_1), PMC_IS_NULL((PMC*)t_2) ? (void *)NULL : VTABLE_get_pointer(interp, t_2));
@@ -5464,7 +5464,7 @@
char *t_6; STRING *ts_6;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "SSSSSSS", &ts_0, &ts_1, &ts_2, &ts_3, &ts_4, &ts_5, &ts_6);
- t_0 = ts_0 ? Parrot_str_to_cstring(interp, ts_0) : (char *)NULL;t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;t_3 = ts_3 ? Parrot_str_to_cstring(interp, ts_3) : (char *)NULL;t_4 = ts_4 ? Parrot_str_to_cstring(interp, ts_4) : (char *)NULL;t_5 = ts_5 ? Parrot_str_to_cstring(interp, ts_5) : (char *)NULL;t_6 = ts_6 ? Parrot_str_to_cstring(interp, ts_6) : (char *)NULL;
+ t_0 = STRING_IS_NULL(ts_0) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_0);t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);t_3 = STRING_IS_NULL(ts_3) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_3);t_4 = STRING_IS_NULL(ts_4) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_4);t_5 = STRING_IS_NULL(ts_5) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_5);t_6 = STRING_IS_NULL(ts_6) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_6);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (void *)(*fn_pointer)(t_0, t_1, t_2, t_3, t_4, t_5, t_6);
@@ -5636,7 +5636,7 @@
char *t_0; STRING *ts_0;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "S", &ts_0);
- t_0 = ts_0 ? Parrot_str_to_cstring(interp, ts_0) : (char *)NULL;
+ t_0 = STRING_IS_NULL(ts_0) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_0);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (char *)(*fn_pointer)(t_0);
@@ -5661,7 +5661,7 @@
PMC *t_2; long i_2;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "SIP", &ts_0, &t_1, &t_2);
- t_0 = ts_0 ? Parrot_str_to_cstring(interp, ts_0) : (char *)NULL;i_2 = VTABLE_get_integer(interp, t_2);
+ t_0 = STRING_IS_NULL(ts_0) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_0);i_2 = VTABLE_get_integer(interp, t_2);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (char *)(*fn_pointer)(t_0, t_1, &i_2);
@@ -5687,7 +5687,7 @@
PMC *t_1; long i_1;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "SP", &ts_0, &t_1);
- t_0 = ts_0 ? Parrot_str_to_cstring(interp, ts_0) : (char *)NULL;i_1 = VTABLE_get_integer(interp, t_1);
+ t_0 = STRING_IS_NULL(ts_0) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_0);i_1 = VTABLE_get_integer(interp, t_1);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (char *)(*fn_pointer)(t_0, &i_1);
@@ -5851,7 +5851,7 @@
char *t_0; STRING *ts_0;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "S", &ts_0);
- t_0 = ts_0 ? Parrot_str_to_cstring(interp, ts_0) : (char *) NULL;
+ t_0 = STRING_IS_NULL(ts_0) ? (char *) NULL : Parrot_str_to_cstring(interp, ts_0);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (char *)(*fn_pointer)(&t_0);
@@ -6062,7 +6062,7 @@
char *t_2; STRING *ts_2;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PiS", &t_1, &ts_2);
- t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;
+ t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (int)(*fn_pointer)(interp, t_1, t_2);
@@ -6085,7 +6085,7 @@
char *t_1; STRING *ts_1;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "S", &ts_1);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (int)(*fn_pointer)(interp, t_1);
@@ -6385,7 +6385,7 @@
char *t_2; STRING *ts_2;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PPS", &t_0, &t_1, &ts_2);
- t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;
+ t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (int)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), PMC_IS_NULL((PMC*)t_1) ? (void *)NULL : VTABLE_get_pointer(interp, t_1), t_2);
@@ -6608,7 +6608,7 @@
PMC *t_1; void *v_1;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "SP", &ts_0, &t_1);
- t_0 = ts_0 ? Parrot_str_to_cstring(interp, ts_0) : (char *)NULL;v_1 = VTABLE_get_pointer(interp, t_1);
+ t_0 = STRING_IS_NULL(ts_0) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_0);v_1 = VTABLE_get_pointer(interp, t_1);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (int)(*fn_pointer)(t_0, &v_1);
@@ -6634,7 +6634,7 @@
PMC *t_4;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PSIPP", &t_0, &ts_1, &t_2, &t_3, &t_4);
- t_1 = ts_1 ? Parrot_str_to_cstring(interp, ts_1) : (char *)NULL;v_3 = VTABLE_get_pointer(interp, t_3);
+ t_1 = STRING_IS_NULL(ts_1) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_1);v_3 = VTABLE_get_pointer(interp, t_3);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (int)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2, &v_3, PMC_IS_NULL((PMC*)t_4) ? (void *)NULL : VTABLE_get_pointer(interp, t_4));
@@ -6688,7 +6688,7 @@
INTVAL t_4;
UNUSED(return_data); /* Potentially unused, at least */
Parrot_pcc_fill_params_from_c_args(interp, call_object, "PISII", &t_0, &t_1, &ts_2, &t_3, &t_4);
- t_2 = ts_2 ? Parrot_str_to_cstring(interp, ts_2) : (char *)NULL;
+ t_2 = STRING_IS_NULL(ts_2) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_2);
GETATTR_NCI_orig_func(interp, nci, orig_func);
fn_pointer = (func_t)D2FPTR(orig_func);
return_data = (int)(*fn_pointer)(PMC_IS_NULL((PMC*)t_0) ? (void *)NULL : VTABLE_get_pointer(interp, t_0), t_1, t_2, t_3, t_4);
Modified: branches/gsoc_instrument/src/oo.c
==============================================================================
--- branches/gsoc_instrument/src/oo.c Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/oo.c Sat Jun 19 16:17:11 2010 (r47715)
@@ -190,7 +190,7 @@
PMC * const hll_ns = VTABLE_get_pmc_keyed_int(interp,
interp->HLL_namespace,
Parrot_pcc_get_HLL(interp, CURRENT_CONTEXT(interp)));
- PMC * const ns = Parrot_get_namespace_keyed(interp,
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp,
hll_ns, key);
if (!PMC_IS_NULL(ns))
@@ -334,9 +334,9 @@
return type_class;
}
else {
- PMC * const parrot_hll = Parrot_get_namespace_keyed_str(interp, interp->root_namespace, CONST_STRING(interp, "parrot"));
+ PMC * const parrot_hll = Parrot_ns_get_namespace_keyed_str(interp, interp->root_namespace, CONST_STRING(interp, "parrot"));
PMC * const pmc_ns =
- Parrot_make_namespace_keyed_str(interp, parrot_hll,
+ Parrot_ns_make_namespace_keyed_str(interp, parrot_hll,
interp->vtables[type]->whoami);
PMC * proxy = VTABLE_get_class(interp, pmc_ns);
@@ -375,7 +375,7 @@
/* First check in current HLL namespace */
PMC * const hll_ns = VTABLE_get_pmc_keyed_int(interp, interp->HLL_namespace,
Parrot_pcc_get_HLL(interp, CURRENT_CONTEXT(interp)));
- PMC * const ns = Parrot_get_namespace_keyed_str(interp, hll_ns, name);
+ PMC * const ns = Parrot_ns_get_namespace_keyed_str(interp, hll_ns, name);
PMC * const _class = PMC_IS_NULL(ns)
? PMCNULL : VTABLE_get_class(interp, ns);
Modified: branches/gsoc_instrument/src/ops/core_ops.c
==============================================================================
--- branches/gsoc_instrument/src/ops/core_ops.c Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/ops/core_ops.c Sat Jun 19 16:17:11 2010 (r47715)
@@ -19803,7 +19803,7 @@
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const key = PREG(2);
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, key);
PMC * classobj = PMCNULL;
if (!PMC_IS_NULL(ns))
@@ -19823,7 +19823,7 @@
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const key = CONST(2)->u.key;
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, key);
PMC * classobj = PMCNULL;
if (!PMC_IS_NULL(ns))
@@ -19843,7 +19843,7 @@
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const key = PREG(2);
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, key);
PMC * classobj = PMCNULL;
if (!PMC_IS_NULL(ns))
@@ -19863,7 +19863,7 @@
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const key = CONST(2)->u.key;
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, key);
PMC * classobj = PMCNULL;
if (!PMC_IS_NULL(ns))
@@ -19883,7 +19883,7 @@
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const key = PREG(2);
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, key);
PMC * classobj = PMCNULL;
if (!PMC_IS_NULL(ns))
@@ -19903,7 +19903,7 @@
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const key = CONST(2)->u.key;
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, key);
PMC * classobj = PMCNULL;
if (!PMC_IS_NULL(ns))
@@ -22823,7 +22823,7 @@
Parrot_get_namespace_p_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- PMC * const ns = Parrot_get_namespace_keyed(interp, cur_ns, PREG(2));
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, cur_ns, PREG(2));
PREG(1) = PMC_IS_NULL(ns) ? PMCNULL : ns;
@@ -22833,7 +22833,7 @@
Parrot_get_namespace_p_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- PMC * const ns = Parrot_get_namespace_keyed(interp, cur_ns, CONST(2)->u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, cur_ns, CONST(2)->u.key);
PREG(1) = PMC_IS_NULL(ns) ? PMCNULL : ns;
@@ -22854,7 +22854,7 @@
if (PMC_IS_NULL(hll_ns))
PREG(1) = PMCNULL;
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, hll_ns, PREG(2));
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, hll_ns, PREG(2));
PREG(1) = ns;
}
@@ -22867,7 +22867,7 @@
if (PMC_IS_NULL(hll_ns))
PREG(1) = PMCNULL;
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, hll_ns, CONST(2)->u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, hll_ns, CONST(2)->u.key);
PREG(1) = ns;
}
@@ -22888,7 +22888,7 @@
if (PMC_IS_NULL(root_ns))
PREG(1) = PMCNULL;
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, PREG(2));
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, PREG(2));
PREG(1) = ns;
}
@@ -22901,7 +22901,7 @@
if (PMC_IS_NULL(root_ns))
PREG(1) = PMCNULL;
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, CONST(2)->u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, CONST(2)->u.key);
PREG(1) = ns;
}
@@ -22911,7 +22911,7 @@
Parrot_get_global_p_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- PREG(1) = Parrot_find_global_op(interp, cur_ns, SREG(2),cur_opcode + 3);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, cur_ns, SREG(2),cur_opcode + 3);
return (opcode_t *)cur_opcode + 3;}
@@ -22919,7 +22919,7 @@
Parrot_get_global_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- PREG(1) = Parrot_find_global_op(interp, cur_ns, CONST(2)->u.string,cur_opcode + 3);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, cur_ns, CONST(2)->u.string,cur_opcode + 3);
return (opcode_t *)cur_opcode + 3;}
@@ -22931,11 +22931,11 @@
PREG(1) = PMCNULL;
}
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, cur_ns, PREG(2));
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, cur_ns, PREG(2));
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_find_global_op(interp, ns, SREG(3),cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, SREG(3),cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -22948,11 +22948,11 @@
PREG(1) = PMCNULL;
}
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, cur_ns, CONST(2)->u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, cur_ns, CONST(2)->u.key);
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_find_global_op(interp, ns, SREG(3),cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, SREG(3),cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -22965,11 +22965,11 @@
PREG(1) = PMCNULL;
}
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, cur_ns, PREG(2));
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, cur_ns, PREG(2));
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_find_global_op(interp, ns, CONST(3)->u.string,cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, CONST(3)->u.string,cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -22982,11 +22982,11 @@
PREG(1) = PMCNULL;
}
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, cur_ns, CONST(2)->u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, cur_ns, CONST(2)->u.key);
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_find_global_op(interp, ns, CONST(3)->u.string,cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, CONST(3)->u.string,cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -22995,7 +22995,7 @@
Parrot_get_hll_global_p_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- PREG(1) = Parrot_find_global_op(interp, hll_ns, SREG(2),cur_opcode + 3);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, hll_ns, SREG(2),cur_opcode + 3);
return (opcode_t *)cur_opcode + 3;}
@@ -23003,7 +23003,7 @@
Parrot_get_hll_global_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- PREG(1) = Parrot_find_global_op(interp, hll_ns, CONST(2)->u.string,cur_opcode + 3);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, hll_ns, CONST(2)->u.string,cur_opcode + 3);
return (opcode_t *)cur_opcode + 3;}
@@ -23015,11 +23015,11 @@
PREG(1) = hll_ns;
}
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, hll_ns, PREG(2));
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, hll_ns, PREG(2));
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_find_global_op(interp, ns, SREG(3),cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, SREG(3),cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -23032,11 +23032,11 @@
PREG(1) = hll_ns;
}
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, hll_ns, CONST(2)->u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, hll_ns, CONST(2)->u.key);
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_find_global_op(interp, ns, SREG(3),cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, SREG(3),cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -23049,11 +23049,11 @@
PREG(1) = hll_ns;
}
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, hll_ns, PREG(2));
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, hll_ns, PREG(2));
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_find_global_op(interp, ns, CONST(3)->u.string,cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, CONST(3)->u.string,cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -23066,11 +23066,11 @@
PREG(1) = hll_ns;
}
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, hll_ns, CONST(2)->u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, hll_ns, CONST(2)->u.key);
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_find_global_op(interp, ns, CONST(3)->u.string,cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, CONST(3)->u.string,cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -23079,7 +23079,7 @@
Parrot_get_root_global_p_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const root_ns = interp->root_namespace;
- PREG(1) = Parrot_find_global_op(interp, root_ns, SREG(2),cur_opcode + 3);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, root_ns, SREG(2),cur_opcode + 3);
return (opcode_t *)cur_opcode + 3;}
@@ -23087,7 +23087,7 @@
Parrot_get_root_global_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const root_ns = interp->root_namespace;
- PREG(1) = Parrot_find_global_op(interp, root_ns, CONST(2)->u.string,cur_opcode + 3);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, root_ns, CONST(2)->u.string,cur_opcode + 3);
return (opcode_t *)cur_opcode + 3;}
@@ -23098,11 +23098,11 @@
if (PMC_IS_NULL(root_ns))
PREG(1) = PMCNULL;
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, PREG(2));
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, PREG(2));
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_find_global_op(interp, ns, SREG(3),cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, SREG(3),cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -23114,11 +23114,11 @@
if (PMC_IS_NULL(root_ns))
PREG(1) = PMCNULL;
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, CONST(2)->u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, CONST(2)->u.key);
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_find_global_op(interp, ns, SREG(3),cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, SREG(3),cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -23130,11 +23130,11 @@
if (PMC_IS_NULL(root_ns))
PREG(1) = PMCNULL;
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, PREG(2));
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, PREG(2));
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_find_global_op(interp, ns, CONST(3)->u.string,cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, CONST(3)->u.string,cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -23146,11 +23146,11 @@
if (PMC_IS_NULL(root_ns))
PREG(1) = PMCNULL;
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, CONST(2)->u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, CONST(2)->u.key);
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_find_global_op(interp, ns, CONST(3)->u.string,cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, CONST(3)->u.string,cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -23159,7 +23159,7 @@
Parrot_set_global_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- Parrot_set_global(interp, cur_ns, SREG(1), PREG(2));
+ Parrot_ns_set_global(interp, cur_ns, SREG(1), PREG(2));
return (opcode_t *)cur_opcode + 3;}
@@ -23167,7 +23167,7 @@
Parrot_set_global_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- Parrot_set_global(interp, cur_ns, CONST(1)->u.string, PREG(2));
+ Parrot_ns_set_global(interp, cur_ns, CONST(1)->u.string, PREG(2));
return (opcode_t *)cur_opcode + 3;}
@@ -23175,9 +23175,9 @@
Parrot_set_global_p_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- PMC * const ns = Parrot_make_namespace_keyed(interp, cur_ns, PREG(1));
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, cur_ns, PREG(1));
- Parrot_set_global(interp, ns, SREG(2), PREG(3));
+ Parrot_ns_set_global(interp, ns, SREG(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23185,9 +23185,9 @@
Parrot_set_global_pc_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- PMC * const ns = Parrot_make_namespace_keyed(interp, cur_ns, CONST(1)->u.key);
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, cur_ns, CONST(1)->u.key);
- Parrot_set_global(interp, ns, SREG(2), PREG(3));
+ Parrot_ns_set_global(interp, ns, SREG(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23195,9 +23195,9 @@
Parrot_set_global_p_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- PMC * const ns = Parrot_make_namespace_keyed(interp, cur_ns, PREG(1));
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, cur_ns, PREG(1));
- Parrot_set_global(interp, ns, CONST(2)->u.string, PREG(3));
+ Parrot_ns_set_global(interp, ns, CONST(2)->u.string, PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23205,9 +23205,9 @@
Parrot_set_global_pc_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- PMC * const ns = Parrot_make_namespace_keyed(interp, cur_ns, CONST(1)->u.key);
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, cur_ns, CONST(1)->u.key);
- Parrot_set_global(interp, ns, CONST(2)->u.string, PREG(3));
+ Parrot_ns_set_global(interp, ns, CONST(2)->u.string, PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23215,7 +23215,7 @@
Parrot_set_hll_global_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- Parrot_set_global(interp, hll_ns, SREG(1), PREG(2));
+ Parrot_ns_set_global(interp, hll_ns, SREG(1), PREG(2));
return (opcode_t *)cur_opcode + 3;}
@@ -23223,7 +23223,7 @@
Parrot_set_hll_global_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- Parrot_set_global(interp, hll_ns, CONST(1)->u.string, PREG(2));
+ Parrot_ns_set_global(interp, hll_ns, CONST(1)->u.string, PREG(2));
return (opcode_t *)cur_opcode + 3;}
@@ -23231,9 +23231,9 @@
Parrot_set_hll_global_p_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- PMC * const ns = Parrot_make_namespace_keyed(interp, hll_ns, PREG(1));
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, hll_ns, PREG(1));
- Parrot_set_global(interp, ns, SREG(2), PREG(3));
+ Parrot_ns_set_global(interp, ns, SREG(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23241,9 +23241,9 @@
Parrot_set_hll_global_pc_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- PMC * const ns = Parrot_make_namespace_keyed(interp, hll_ns, CONST(1)->u.key);
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, hll_ns, CONST(1)->u.key);
- Parrot_set_global(interp, ns, SREG(2), PREG(3));
+ Parrot_ns_set_global(interp, ns, SREG(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23251,9 +23251,9 @@
Parrot_set_hll_global_p_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- PMC * const ns = Parrot_make_namespace_keyed(interp, hll_ns, PREG(1));
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, hll_ns, PREG(1));
- Parrot_set_global(interp, ns, CONST(2)->u.string, PREG(3));
+ Parrot_ns_set_global(interp, ns, CONST(2)->u.string, PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23261,9 +23261,9 @@
Parrot_set_hll_global_pc_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- PMC * const ns = Parrot_make_namespace_keyed(interp, hll_ns, CONST(1)->u.key);
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, hll_ns, CONST(1)->u.key);
- Parrot_set_global(interp, ns, CONST(2)->u.string, PREG(3));
+ Parrot_ns_set_global(interp, ns, CONST(2)->u.string, PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23271,7 +23271,7 @@
Parrot_set_root_global_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const root_ns = interp->root_namespace;
- Parrot_set_global(interp, root_ns, SREG(1), PREG(2));
+ Parrot_ns_set_global(interp, root_ns, SREG(1), PREG(2));
return (opcode_t *)cur_opcode + 3;}
@@ -23279,7 +23279,7 @@
Parrot_set_root_global_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const root_ns = interp->root_namespace;
- Parrot_set_global(interp, root_ns, CONST(1)->u.string, PREG(2));
+ Parrot_ns_set_global(interp, root_ns, CONST(1)->u.string, PREG(2));
return (opcode_t *)cur_opcode + 3;}
@@ -23287,9 +23287,9 @@
Parrot_set_root_global_p_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_make_namespace_keyed(interp, root_ns, PREG(1));
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, root_ns, PREG(1));
- Parrot_set_global(interp, ns, SREG(2), PREG(3));
+ Parrot_ns_set_global(interp, ns, SREG(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23297,9 +23297,9 @@
Parrot_set_root_global_pc_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_make_namespace_keyed(interp, root_ns, CONST(1)->u.key);
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, root_ns, CONST(1)->u.key);
- Parrot_set_global(interp, ns, SREG(2), PREG(3));
+ Parrot_ns_set_global(interp, ns, SREG(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23307,9 +23307,9 @@
Parrot_set_root_global_p_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_make_namespace_keyed(interp, root_ns, PREG(1));
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, root_ns, PREG(1));
- Parrot_set_global(interp, ns, CONST(2)->u.string, PREG(3));
+ Parrot_ns_set_global(interp, ns, CONST(2)->u.string, PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23317,9 +23317,9 @@
Parrot_set_root_global_pc_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_make_namespace_keyed(interp, root_ns, CONST(1)->u.key);
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, root_ns, CONST(1)->u.key);
- Parrot_set_global(interp, ns, CONST(2)->u.string, PREG(3));
+ Parrot_ns_set_global(interp, ns, CONST(2)->u.string, PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23332,7 +23332,7 @@
"Tried to find null name");return (opcode_t *)handler;
}
- PREG(1) = Parrot_find_name_op(interp, SREG(2),cur_opcode + 3);
+ PREG(1) = Parrot_ns_find_named_item(interp, SREG(2),cur_opcode + 3);
return (opcode_t *)cur_opcode + 3;}
@@ -23345,7 +23345,7 @@
"Tried to find null name");return (opcode_t *)handler;
}
- PREG(1) = Parrot_find_name_op(interp, CONST(2)->u.string,cur_opcode + 3);
+ PREG(1) = Parrot_ns_find_named_item(interp, CONST(2)->u.string,cur_opcode + 3);
return (opcode_t *)cur_opcode + 3;}
@@ -23353,7 +23353,7 @@
Parrot_find_sub_not_null_p_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
opcode_t *dest =cur_opcode + 3;
- PMC *sub = Parrot_find_name_op(interp, SREG(2), dest);
+ PMC *sub = Parrot_ns_find_named_item(interp, SREG(2), dest);
if (PMC_IS_NULL(sub)) {
opcode_t *handler;
@@ -23371,7 +23371,7 @@
Parrot_find_sub_not_null_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
opcode_t *dest =cur_opcode + 3;
- PMC *sub = Parrot_find_name_op(interp, CONST(2)->u.string, dest);
+ PMC *sub = Parrot_ns_find_named_item(interp, CONST(2)->u.string, dest);
if (PMC_IS_NULL(sub)) {
opcode_t *handler;
@@ -24779,7 +24779,7 @@
/* if it's clearly a PIR-level PMC */
if (type > enum_class_core_max) {
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, name_key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, name_key);
PMC * const _class = Parrot_oo_get_class(interp, ns);
if (!PMC_IS_NULL(_class)) {
PMC *initial = Parrot_pmc_new(interp,
@@ -24813,7 +24813,7 @@
/* if it's clearly a PIR-level PMC */
if (type > enum_class_core_max) {
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, name_key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, name_key);
PMC * const _class = Parrot_oo_get_class(interp, ns);
if (!PMC_IS_NULL(_class)) {
PMC *initial = Parrot_pmc_new(interp,
@@ -24847,7 +24847,7 @@
/* if it's clearly a PIR-level PMC */
if (type > enum_class_core_max) {
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, name_key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, name_key);
PMC * const _class = Parrot_oo_get_class(interp, ns);
if (!PMC_IS_NULL(_class)) {
PMC *initial = Parrot_pmc_new(interp,
@@ -24881,7 +24881,7 @@
/* if it's clearly a PIR-level PMC */
if (type > enum_class_core_max) {
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, name_key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, name_key);
PMC * const _class = Parrot_oo_get_class(interp, ns);
if (!PMC_IS_NULL(_class)) {
PMC *initial = Parrot_pmc_new(interp,
@@ -25032,7 +25032,7 @@
1083, /* op_count */
core_op_info_table, /* op_info_table */
core_op_func_table, /* op_func_table */
- get_op /* op_code() */
+ get_op /* op_code() */
};
/*
@@ -25138,7 +25138,7 @@
}
}
op_lib_t *
-Parrot_DynOp_core_2_4_0(PARROT_INTERP, long init) {
+Parrot_DynOp_core_2_5_0(PARROT_INTERP, long init) {
/* initialize and return op_lib ptr */
if (init == 1) {
@@ -25167,7 +25167,7 @@
{
PMC *const lib = Parrot_pmc_new(interp, enum_class_ParrotLibrary);
- ((Parrot_ParrotLibrary_attributes*)PMC_data(lib))->oplib_init = (void *) Parrot_DynOp_core_2_4_0;
+ ((Parrot_ParrotLibrary_attributes*)PMC_data(lib))->oplib_init = (void *) Parrot_DynOp_core_2_5_0;
dynop_register(interp, lib);
return lib;
}
Modified: branches/gsoc_instrument/src/ops/experimental.ops
==============================================================================
--- branches/gsoc_instrument/src/ops/experimental.ops Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/ops/experimental.ops Sat Jun 19 16:17:11 2010 (r47715)
@@ -325,7 +325,7 @@
/* if it's clearly a PIR-level PMC */
if (type > enum_class_core_max) {
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, name_key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, name_key);
PMC * const _class = Parrot_oo_get_class(interp, ns);
if (!PMC_IS_NULL(_class)) {
PMC *initial = Parrot_pmc_new(interp,
Modified: branches/gsoc_instrument/src/ops/pmc.ops
==============================================================================
--- branches/gsoc_instrument/src/ops/pmc.ops Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/ops/pmc.ops Sat Jun 19 16:17:11 2010 (r47715)
@@ -146,7 +146,7 @@
op root_new(out PMC, in PMC) {
PMC * const key = $2;
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, key);
PMC * classobj = PMCNULL;
if (!PMC_IS_NULL(ns))
@@ -164,7 +164,7 @@
op root_new(out PMC, in PMC, in PMC) {
PMC * const key = $2;
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, key);
PMC * classobj = PMCNULL;
if (!PMC_IS_NULL(ns))
Modified: branches/gsoc_instrument/src/ops/var.ops
==============================================================================
--- branches/gsoc_instrument/src/ops/var.ops Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/ops/var.ops Sat Jun 19 16:17:11 2010 (r47715)
@@ -192,7 +192,7 @@
op get_namespace(out PMC, in PMC) {
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- PMC * const ns = Parrot_get_namespace_keyed(interp, cur_ns, $2);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, cur_ns, $2);
$1 = PMC_IS_NULL(ns) ? PMCNULL : ns;
}
@@ -219,7 +219,7 @@
if (PMC_IS_NULL(hll_ns))
$1 = PMCNULL;
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, hll_ns, $2);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, hll_ns, $2);
$1 = ns;
}
}
@@ -245,7 +245,7 @@
if (PMC_IS_NULL(root_ns))
$1 = PMCNULL;
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, $2);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, $2);
$1 = ns;
}
}
@@ -275,7 +275,7 @@
op get_global(out PMC, in STR) {
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- $1 = Parrot_find_global_op(interp, cur_ns, $2, expr NEXT());
+ $1 = Parrot_ns_find_global_from_op(interp, cur_ns, $2, expr NEXT());
}
op get_global(out PMC, in PMC, in STR) {
@@ -284,11 +284,11 @@
$1 = PMCNULL;
}
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, cur_ns, $2);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, cur_ns, $2);
if (PMC_IS_NULL(ns))
$1 = PMCNULL;
else
- $1 = Parrot_find_global_op(interp, ns, $3, expr NEXT());
+ $1 = Parrot_ns_find_global_from_op(interp, ns, $3, expr NEXT());
}
}
@@ -307,7 +307,7 @@
op get_hll_global(out PMC, in STR) {
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- $1 = Parrot_find_global_op(interp, hll_ns, $2, expr NEXT());
+ $1 = Parrot_ns_find_global_from_op(interp, hll_ns, $2, expr NEXT());
}
op get_hll_global(out PMC, in PMC, in STR) {
@@ -316,11 +316,11 @@
$1 = hll_ns;
}
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, hll_ns, $2);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, hll_ns, $2);
if (PMC_IS_NULL(ns))
$1 = PMCNULL;
else
- $1 = Parrot_find_global_op(interp, ns, $3, expr NEXT());
+ $1 = Parrot_ns_find_global_from_op(interp, ns, $3, expr NEXT());
}
}
@@ -339,7 +339,7 @@
op get_root_global(out PMC, in STR) {
PMC * const root_ns = interp->root_namespace;
- $1 = Parrot_find_global_op(interp, root_ns, $2, expr NEXT());
+ $1 = Parrot_ns_find_global_from_op(interp, root_ns, $2, expr NEXT());
}
op get_root_global(out PMC, in PMC, in STR) {
@@ -347,11 +347,11 @@
if (PMC_IS_NULL(root_ns))
$1 = PMCNULL;
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, $2);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, $2);
if (PMC_IS_NULL(ns))
$1 = PMCNULL;
else
- $1 = Parrot_find_global_op(interp, ns, $3, expr NEXT());
+ $1 = Parrot_ns_find_global_from_op(interp, ns, $3, expr NEXT());
}
}
@@ -379,14 +379,14 @@
op set_global(in STR, invar PMC) {
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- Parrot_set_global(interp, cur_ns, $1, $2);
+ Parrot_ns_set_global(interp, cur_ns, $1, $2);
}
op set_global(in PMC, in STR, invar PMC) {
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- PMC * const ns = Parrot_make_namespace_keyed(interp, cur_ns, $1);
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, cur_ns, $1);
- Parrot_set_global(interp, ns, $2, $3);
+ Parrot_ns_set_global(interp, ns, $2, $3);
}
=item B<set_hll_global>(in STR, invar PMC)
@@ -403,14 +403,14 @@
op set_hll_global(in STR, invar PMC) {
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- Parrot_set_global(interp, hll_ns, $1, $2);
+ Parrot_ns_set_global(interp, hll_ns, $1, $2);
}
op set_hll_global(in PMC, in STR, invar PMC) {
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- PMC * const ns = Parrot_make_namespace_keyed(interp, hll_ns, $1);
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, hll_ns, $1);
- Parrot_set_global(interp, ns, $2, $3);
+ Parrot_ns_set_global(interp, ns, $2, $3);
}
=item B<set_root_global>(in STR, invar PMC)
@@ -427,14 +427,14 @@
op set_root_global(in STR, invar PMC) {
PMC * const root_ns = interp->root_namespace;
- Parrot_set_global(interp, root_ns, $1, $2);
+ Parrot_ns_set_global(interp, root_ns, $1, $2);
}
op set_root_global(in PMC, in STR, invar PMC) {
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_make_namespace_keyed(interp, root_ns, $1);
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, root_ns, $1);
- Parrot_set_global(interp, ns, $2, $3);
+ Parrot_ns_set_global(interp, ns, $2, $3);
}
=back
@@ -470,7 +470,7 @@
goto ADDRESS(handler);
}
- $1 = Parrot_find_name_op(interp, $2, expr NEXT());
+ $1 = Parrot_ns_find_named_item(interp, $2, expr NEXT());
}
=item B<find_sub_not_null>(out PMC, in STR)
@@ -482,7 +482,7 @@
inline op find_sub_not_null(out PMC, in STR) :base_core {
opcode_t *dest = expr NEXT();
- PMC *sub = Parrot_find_name_op(interp, $2, dest);
+ PMC *sub = Parrot_ns_find_named_item(interp, $2, dest);
if (PMC_IS_NULL(sub)) {
opcode_t *handler;
Modified: branches/gsoc_instrument/src/packfile.c
==============================================================================
--- branches/gsoc_instrument/src/packfile.c Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/packfile.c Sat Jun 19 16:17:11 2010 (r47715)
@@ -3129,7 +3129,7 @@
/* Vtable overrides and methods were already cloned, so don't reclone them. */
if (new_sub->vtable_index == -1
&& !(old_sub->comp_flags & SUB_COMP_FLAG_METHOD))
- Parrot_store_sub_in_namespace(interp, new_sub_pmc);
+ Parrot_ns_store_sub(interp, new_sub_pmc);
ret->u.key = new_sub_pmc;
@@ -3987,7 +3987,7 @@
/* finally place the sub into some namespace stash
* XXX place this code in Sub.thaw ? */
if (VTABLE_isa(interp, pmc, _sub))
- Parrot_store_sub_in_namespace(interp, pmc);
+ Parrot_ns_store_sub(interp, pmc);
/* restore code */
interp->code = cs_save;
Modified: branches/gsoc_instrument/src/pmc/arrayiterator.pmc
==============================================================================
--- branches/gsoc_instrument/src/pmc/arrayiterator.pmc Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/pmc/arrayiterator.pmc Sat Jun 19 16:17:11 2010 (r47715)
@@ -43,7 +43,7 @@
TODO: Discuss idea of having separate get_iter/get_reverse_iter VTABLEs
to avoid this caveat.
-=head1 Methods
+=head1 Vtable functions
=over 4
@@ -53,6 +53,15 @@
/* HEADERIZER HFILE: none */
/* HEADERIZER BEGIN: static */
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+
+PARROT_DOES_NOT_RETURN
+static void out_of_bounds(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
+#define ASSERT_ARGS_out_of_bounds __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
pmclass ArrayIterator extends Iterator no_ro auto_attrs {
@@ -199,24 +208,25 @@
VTABLE void set_integer_native(INTVAL value) {
PMC *array;
+ INTVAL element;
+ GET_ATTR_array(INTERP, SELF, array);
+ element = VTABLE_elements(INTERP, array);
- if (value == ITERATE_FROM_START) {
- GET_ATTR_array(INTERP, SELF, array);
+ switch (value) {
+ case ITERATE_FROM_START:
SET_ATTR_reverse(INTERP, SELF, 0);
SET_ATTR_pos(INTERP, SELF, 0);
- SET_ATTR_length(INTERP, SELF, VTABLE_elements(INTERP, array));
- }
- else if (value == ITERATE_FROM_END) {
- INTVAL element;
- GET_ATTR_array(INTERP, SELF, array);
- element = VTABLE_elements(INTERP, array);
+ SET_ATTR_length(INTERP, SELF, element);
+ break;
+ case ITERATE_FROM_END:
SET_ATTR_reverse(INTERP, SELF, 1);
SET_ATTR_length(INTERP, SELF, element);
SET_ATTR_pos(INTERP, SELF, element);
- }
- else
+ break;
+ default:
Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
"Wrong direction for ArrayIterator");
+ }
}
/*
@@ -254,8 +264,7 @@
GET_ATTR_length(INTERP, SELF, length);
if (pos >= length)
- Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_OUT_OF_BOUNDS,
- "StopIteration");
+ out_of_bounds(INTERP);
GET_ATTR_array(INTERP, SELF, array);
SET_ATTR_pos(INTERP, SELF, pos+1);
@@ -278,8 +287,7 @@
GET_ATTR_pos(INTERP, SELF, pos);
if (!STATICSELF.get_bool())
- Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_OUT_OF_BOUNDS,
- "StopIteration");
+ out_of_bounds(INTERP);
GET_ATTR_array(INTERP, SELF, array);
SET_ATTR_pos(INTERP, SELF, pos+1);
@@ -303,8 +311,7 @@
GET_ATTR_pos(INTERP, SELF, pos);
if (!STATICSELF.get_bool())
- Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_OUT_OF_BOUNDS,
- "StopIteration");
+ out_of_bounds(INTERP);
GET_ATTR_array(INTERP, SELF, array);
SET_ATTR_pos(INTERP, SELF, pos+1);
@@ -331,8 +338,7 @@
if (!STATICSELF.get_bool())
- Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_OUT_OF_BOUNDS,
- "StopIteration");
+ out_of_bounds(INTERP);
GET_ATTR_array(INTERP, SELF, array);
SET_ATTR_pos(INTERP, SELF, pos+1);
@@ -360,8 +366,7 @@
if (!STATICSELF.get_bool())
- Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_OUT_OF_BOUNDS,
- "StopIteration");
+ out_of_bounds(INTERP);
GET_ATTR_array(INTERP, SELF, array);
SET_ATTR_pos(INTERP, SELF, --pos);
@@ -384,8 +389,7 @@
GET_ATTR_pos(INTERP, SELF, pos);
if (!STATICSELF.get_bool())
- Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_OUT_OF_BOUNDS,
- "StopIteration");
+ out_of_bounds(INTERP);
GET_ATTR_array(INTERP, SELF, array);
SET_ATTR_pos(INTERP, SELF, --pos);
@@ -409,8 +413,7 @@
GET_ATTR_pos(INTERP, SELF, pos);
if (!STATICSELF.get_bool())
- Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_OUT_OF_BOUNDS,
- "StopIteration");
+ out_of_bounds(INTERP);
GET_ATTR_array(INTERP, SELF, array);
SET_ATTR_pos(INTERP, SELF, --pos);
@@ -436,8 +439,7 @@
GET_ATTR_pos(INTERP, SELF, pos);
if (!STATICSELF.get_bool())
- Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_OUT_OF_BOUNDS,
- "StopIteration");
+ out_of_bounds(INTERP);
GET_ATTR_array(INTERP, SELF, array);
SET_ATTR_pos(INTERP, SELF, --pos);
@@ -646,6 +648,32 @@
}
}
+
+/*
+
+=back
+
+=head1 Auxiliar functions
+
+=over 4
+
+=item C<static void out_of_bounds(PARROT_INTERP)>
+
+Throw out-of-bounds exception.
+
+=cut
+
+*/
+
+PARROT_DOES_NOT_RETURN
+static void
+out_of_bounds(PARROT_INTERP)
+{
+ ASSERT_ARGS(out_of_bounds)
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_OUT_OF_BOUNDS,
+ "StopIteration");
+}
+
/*
=back
Modified: branches/gsoc_instrument/src/pmc/bytebuffer.pmc
==============================================================================
--- branches/gsoc_instrument/src/pmc/bytebuffer.pmc Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/pmc/bytebuffer.pmc Sat Jun 19 16:17:11 2010 (r47715)
@@ -160,7 +160,8 @@
=item C<void set_integer_keyed_int()>
-Set the value of the byte at position.
+Set the value of the byte at position, resizing the buffer if the position
+is out of current size.
=cut
@@ -211,6 +212,23 @@
/*
+=item C<void push_integer(INTVAL value)>
+
+Extends the buffer by adding a byte of value C<value> to the end.
+
+=cut
+
+*/
+
+ VTABLE void push_integer(INTVAL value) {
+ INTVAL size;
+
+ GET_ATTR_size(INTERP, SELF, size);
+ SELF.set_integer_keyed_int(size, value);
+ }
+
+/*
+
=item C<PMC *get_iter()>
Return a new Iterator for this PMC.
Modified: branches/gsoc_instrument/src/pmc/capture.pmc
==============================================================================
--- branches/gsoc_instrument/src/pmc/capture.pmc Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/pmc/capture.pmc Sat Jun 19 16:17:11 2010 (r47715)
@@ -855,8 +855,8 @@
PMC *ns = INTERP->root_namespace;
STRING *attribute = CONST_STRING(INTERP, "proxy");
- ns = Parrot_get_namespace_keyed_str(INTERP, ns, CONST_STRING(INTERP, "parrot"));
- ns = Parrot_get_namespace_keyed_str(INTERP, ns, CONST_STRING(INTERP, "Capture"));
+ ns = Parrot_ns_get_namespace_keyed_str(INTERP, ns, CONST_STRING(INTERP, "parrot"));
+ ns = Parrot_ns_get_namespace_keyed_str(INTERP, ns, CONST_STRING(INTERP, "Capture"));
classobj = Parrot_oo_get_class(INTERP, ns);
capt = VTABLE_get_attr_keyed(INTERP, SELF, classobj, attribute);
}
Modified: branches/gsoc_instrument/src/pmc/class.pmc
==============================================================================
--- branches/gsoc_instrument/src/pmc/class.pmc Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/pmc/class.pmc Sat Jun 19 16:17:11 2010 (r47715)
@@ -284,7 +284,7 @@
else {
PMC * const hll_ns = VTABLE_get_pmc_keyed_int(interp,
interp->HLL_namespace, Parrot_pcc_get_HLL(interp, CURRENT_CONTEXT(interp)));
- new_namespace = Parrot_make_namespace_keyed(interp, hll_ns, name_arg);
+ new_namespace = Parrot_ns_make_namespace_keyed(interp, hll_ns, name_arg);
}
if (PMC_IS_NULL(new_namespace))
@@ -1589,13 +1589,13 @@
STRING * const semicolon_str = CONST_STRING(INTERP, ";");
PMC * const namespace_array =
Parrot_str_split(INTERP, semicolon_str, serial_namespace);
- PMC *ns = Parrot_get_namespace_keyed(INTERP,
+ PMC *ns = Parrot_ns_get_namespace_keyed(INTERP,
INTERP->root_namespace, namespace_array);
/* If the namespace doesn't exist, we create it, and initialize
* ourselves in it */
if (PMC_IS_NULL(ns)) {
- ns = Parrot_make_namespace_keyed(INTERP,
+ ns = Parrot_ns_make_namespace_keyed(INTERP,
INTERP->root_namespace, namespace_array);
SELF.init_pmc(ns);
}
Modified: branches/gsoc_instrument/src/pmc/eval.pmc
==============================================================================
--- branches/gsoc_instrument/src/pmc/eval.pmc Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/pmc/eval.pmc Sat Jun 19 16:17:11 2010 (r47715)
@@ -57,30 +57,25 @@
{
ASSERT_ARGS(clear_fixups)
- INTVAL i;
- PackFile_ByteCode * const seg = sub_data->seg;
- PackFile_FixupTable *ft;
- PackFile_ConstTable *ct;
-
- if (!seg)
- return;
-
- ft = seg->fixups;
- if (!ft)
- return;
-
- ct = seg->const_table;
- if (!ct)
- return;
+ PackFile_ByteCode * const seg = sub_data->seg;
- for (i = 0; i < ft->fixup_count; ++i) {
- PackFile_FixupEntry * const e = ft->fixups + i;
-
- if (e->type == enum_fixup_sub) {
- opcode_t ci = e->offset;
-
- ct->constants[ci]->u.key = NULL;
- e->type = 0;
+ if (seg) {
+ PackFile_FixupTable * const ft = seg->fixups;
+ if (ft) {
+ PackFile_ConstTable * const ct = seg->const_table;
+ if (ct) {
+ INTVAL i;
+ for (i = 0; i < ft->fixup_count; ++i) {
+ PackFile_FixupEntry * const e = ft->fixups + i;
+
+ if (e->type == enum_fixup_sub) {
+ opcode_t ci = e->offset;
+
+ ct->constants[ci]->u.key = NULL;
+ e->type = 0;
+ }
+ }
+ }
}
}
}
@@ -92,34 +87,29 @@
{
ASSERT_ARGS(get_sub)
- INTVAL i, n;
Parrot_Sub_attributes *sub;
PackFile_ByteCode *seg;
- PackFile_FixupTable *ft;
- PackFile_ConstTable *ct;
PMC_get_sub(interp, self, sub);
seg = sub->seg;
- if (!seg)
- return PMCNULL;
-
- ft = seg->fixups;
- if (!ft)
- return PMCNULL;
-
- ct = seg->const_table;
- if (!ct)
- return PMCNULL;
-
- for (i = n = 0; i < ft->fixup_count; ++i) {
- const PackFile_FixupEntry * const e = ft->fixups + i;
-
- if (e->type == enum_fixup_sub) {
- opcode_t ci = e->offset;
-
- if (n++ == idx)
- return ct->constants[ci]->u.key;
+ if (seg) {
+ PackFile_FixupTable * const ft = seg->fixups;
+ if (ft) {
+ PackFile_ConstTable * const ct = seg->const_table;
+ if (ct) {
+ INTVAL i, n;
+ for (i = n = 0; i < ft->fixup_count; ++i) {
+ const PackFile_FixupEntry * const e = ft->fixups + i;
+
+ if (e->type == enum_fixup_sub) {
+ opcode_t ci = e->offset;
+
+ if (n++ == idx)
+ return ct->constants[ci]->u.key;
+ }
+ }
+ }
}
}
@@ -133,32 +123,27 @@
Parrot_Sub_attributes *sub;
PackFile_ByteCode *seg;
- PackFile_FixupTable *ft;
- PackFile_ConstTable *ct;
- INTVAL i;
PMC_get_sub(interp, self, sub);
seg = sub->seg;
- if (!seg)
- return;
-
- ft = seg->fixups;
- if (!ft)
- return;
-
- ct = seg->const_table;
- if (!ct)
- return;
-
- for (i = 0; i < ft->fixup_count; ++i) {
- const PackFile_FixupEntry * const e = ft->fixups + i;
-
- if (e->type == enum_fixup_sub) {
- opcode_t ci = e->offset;
- PMC *sub = ct->constants[ci]->u.key;
-
- Parrot_gc_mark_PMC_alive(interp, sub);
+ if (seg) {
+ PackFile_FixupTable * const ft = seg->fixups;
+ if (ft) {
+ PackFile_ConstTable * const ct = seg->const_table;
+ if (ct) {
+ INTVAL i;
+ for (i = 0; i < ft->fixup_count; ++i) {
+ const PackFile_FixupEntry * const e = ft->fixups + i;
+
+ if (e->type == enum_fixup_sub) {
+ opcode_t ci = e->offset;
+ PMC *sub = ct->constants[ci]->u.key;
+
+ Parrot_gc_mark_PMC_alive(interp, sub);
+ }
+ }
+ }
}
}
}
@@ -411,26 +396,24 @@
}
VTABLE INTVAL elements() {
- INTVAL i, n;
+ INTVAL n = 0;
Parrot_Sub_attributes *sub;
- PackFile_ByteCode *seg;
- PackFile_FixupTable *ft;
+ PackFile_ByteCode *seg;
PMC_get_sub(INTERP, SELF, sub);
seg = sub->seg;
- if (!seg)
- return 0;
-
- ft = seg->fixups;
- if (!ft)
- return 0;
-
- for (i = n = 0; i < ft->fixup_count; ++i) {
- const PackFile_FixupEntry * const e = ft->fixups + i;
-
- if (e->type == enum_fixup_sub)
- ++n;
+ if (seg) {
+ PackFile_FixupTable *const ft = seg->fixups;
+ if (ft) {
+ INTVAL i;
+ for (i = n = 0; i < ft->fixup_count; ++i) {
+ const PackFile_FixupEntry * const e = ft->fixups + i;
+
+ if (e->type == enum_fixup_sub)
+ ++n;
+ }
+ }
}
return n;
Modified: branches/gsoc_instrument/src/pmc/hash.pmc
==============================================================================
--- branches/gsoc_instrument/src/pmc/hash.pmc Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/pmc/hash.pmc Sat Jun 19 16:17:11 2010 (r47715)
@@ -1080,26 +1080,6 @@
/*
-=item C<PMC *slice(PMC *key)>
-
-Return a new iterator for the slice PMC C<key>
-
-=cut
-
-*/
-
- VTABLE PMC *slice(PMC *key, INTVAL f) {
- if (f == 0) {
- return SELF.get_iter();
- }
-
- Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_OUT_OF_BOUNDS,
- "Hash: Unknown slice type");
- }
-
-
-/*
-
=item C<void visit(PMC *info)>
Used during archiving to visit the elements in the hash.
Modified: branches/gsoc_instrument/src/pmc/key.pmc
==============================================================================
--- branches/gsoc_instrument/src/pmc/key.pmc Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/pmc/key.pmc Sat Jun 19 16:17:11 2010 (r47715)
@@ -78,11 +78,8 @@
break;
case KEY_pmc_FLAG:
case KEY_pmc_FLAG | KEY_register_FLAG:
- {
- PMC * const p = key_pmc(INTERP, key);
- key_set_pmc(INTERP, dkey, VTABLE_clone(INTERP, p));
- }
- break;
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
+ "this is broken - see TT #1683");
default:
break;
}
@@ -223,7 +220,8 @@
*/
VTABLE void set_pmc(PMC *value) {
- key_set_pmc(INTERP, SELF, value);
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
+ "this is broken - see TT #1683");
}
/*
Modified: branches/gsoc_instrument/src/pmc/namespace.pmc
==============================================================================
--- branches/gsoc_instrument/src/pmc/namespace.pmc Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/pmc/namespace.pmc Sat Jun 19 16:17:11 2010 (r47715)
@@ -456,11 +456,11 @@
key = VTABLE_shift_pmc(INTERP, key);
if (!key) {
- Parrot_set_global(INTERP, ns, part, value);
+ Parrot_ns_set_global(INTERP, ns, part, value);
return;
}
- ns = Parrot_make_namespace_keyed_str(INTERP, ns, part);
+ ns = Parrot_ns_make_namespace_keyed_str(INTERP, ns, part);
}
}
@@ -471,11 +471,11 @@
STRING * const part = VTABLE_get_string_keyed_int(INTERP, key, i);
if ((i + 1) >= elements) { /* Last entry in the array */
- Parrot_set_global(INTERP, ns, part, value);
+ Parrot_ns_set_global(INTERP, ns, part, value);
return;
}
- ns = Parrot_make_namespace_keyed_str(INTERP, ns, part);
+ ns = Parrot_ns_make_namespace_keyed_str(INTERP, ns, part);
}
}
@@ -515,7 +515,7 @@
if (!key)
return VTABLE_get_pmc_keyed_str(INTERP, ns, part);
- ns = Parrot_get_namespace_keyed_str(INTERP, ns, part);
+ ns = Parrot_ns_get_namespace_keyed_str(INTERP, ns, part);
if (PMC_IS_NULL(ns))
return PMCNULL;
@@ -531,14 +531,14 @@
/* What to do here? Throw an exception or something? */
break;
}
- ns = Parrot_get_namespace_keyed_str(INTERP, ns, name);
+ ns = Parrot_ns_get_namespace_keyed_str(INTERP, ns, name);
++i;
}
return ns;
}
else {
STRING * const name = VTABLE_get_string(INTERP, key);
- ns = Parrot_get_namespace_keyed_str(INTERP, ns, name);
+ ns = Parrot_ns_get_namespace_keyed_str(INTERP, ns, name);
return ns;
}
/* If we get the wrong type, should we throw an exception?
@@ -605,7 +605,7 @@
if (!key)
return VTABLE_get_pointer_keyed_str(INTERP, ns, part);
- ns = Parrot_get_namespace_keyed_str(INTERP, ns, part);
+ ns = Parrot_ns_get_namespace_keyed_str(INTERP, ns, part);
if (PMC_IS_NULL(ns))
return PMCNULL;
@@ -621,7 +621,7 @@
if ((i + 1) >= elements)
return VTABLE_get_pointer_keyed_str(INTERP, ns, part);
- ns = Parrot_get_namespace_keyed_str(INTERP, ns, part);
+ ns = Parrot_ns_get_namespace_keyed_str(INTERP, ns, part);
if (PMC_IS_NULL(ns))
return PMCNULL;
@@ -729,9 +729,9 @@
*/
METHOD make_namespace(PMC *key) {
- PMC *ns = Parrot_get_namespace_keyed(INTERP, SELF, key);
+ PMC *ns = Parrot_ns_get_namespace_keyed(INTERP, SELF, key);
if (PMC_IS_NULL(ns)) {
- ns = Parrot_make_namespace_keyed(INTERP, SELF, key);
+ ns = Parrot_ns_make_namespace_keyed(INTERP, SELF, key);
}
RETURN(PMC *ns);
}
Modified: branches/gsoc_instrument/src/pmc/resizablepmcarray.pmc
==============================================================================
--- branches/gsoc_instrument/src/pmc/resizablepmcarray.pmc Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/pmc/resizablepmcarray.pmc Sat Jun 19 16:17:11 2010 (r47715)
@@ -27,6 +27,16 @@
/* HEADERIZER BEGIN: static */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+PARROT_INLINE
+static void do_shift(ARGIN(PMC *arr))
+ __attribute__nonnull__(1);
+
+PARROT_INLINE
+static void do_unshift(PARROT_INTERP, ARGIN(PMC *arr), ARGIN(PMC *val))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
PARROT_DOES_NOT_RETURN
static void throw_pop_empty(PARROT_INTERP)
__attribute__nonnull__(1);
@@ -35,6 +45,12 @@
static void throw_shift_empty(PARROT_INTERP)
__attribute__nonnull__(1);
+#define ASSERT_ARGS_do_shift __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(arr))
+#define ASSERT_ARGS_do_unshift __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(arr) \
+ , PARROT_ASSERT_ARG(val))
#define ASSERT_ARGS_throw_pop_empty __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_throw_shift_empty __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -42,6 +58,34 @@
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
+PARROT_INLINE
+static void
+do_shift(ARGIN(PMC *arr))
+{
+ ASSERT_ARGS(do_shift)
+ INTVAL size = PMC_size(arr);
+ PMC **item = PMC_array(arr);
+
+ PMC_size(arr) = --size;
+ mem_sys_memmove(item, item + 1, size * sizeof (PMC *));
+ item[size] = PMCNULL;
+}
+
+PARROT_INLINE
+static void
+do_unshift(PARROT_INTERP, ARGIN(PMC *arr), ARGIN(PMC *val))
+{
+ ASSERT_ARGS(do_unshift)
+ const INTVAL size = PMC_size(arr);
+ PMC **item;
+
+ VTABLE_set_integer_native(interp, arr, size + 1);
+ item = PMC_array(arr);
+ mem_sys_memmove(item + 1, item, size * sizeof (PMC *));
+ item[0] = val;
+}
+
+
pmclass ResizablePMCArray extends FixedPMCArray auto_attrs provides array {
ATTR INTVAL resize_threshold; /* max size before array needs resizing */
@@ -143,82 +187,50 @@
*/
VTABLE FLOATVAL shift_float() {
- INTVAL size = PMC_size(SELF);
- PMC *data;
- PMC **item;
- FLOATVAL value;
+ INTVAL size = PMC_size(SELF);
+ FLOATVAL value;
if (0 == size)
throw_shift_empty(INTERP);
- item = PMC_array(SELF);
- data = item[0];
- value = VTABLE_get_number(INTERP, data);
- PMC_size(SELF) = --size;
-
- mem_sys_memmove(item, item + 1, size * sizeof (PMC *));
-
- item[size] = PMCNULL;
-
+ value = VTABLE_get_number(INTERP, PMC_array(SELF)[0]);
+ do_shift(SELF);
return value;
}
VTABLE INTVAL shift_integer() {
- INTVAL size = PMC_size(SELF);
- PMC *data;
- PMC **item;
- INTVAL value;
+ INTVAL size = PMC_size(SELF);
+ INTVAL value;
if (0 == size)
throw_shift_empty(INTERP);
- item = PMC_array(SELF);
- data = item[0];
- value = VTABLE_get_integer(INTERP, data);
- PMC_size(SELF) = --size;
-
- mem_sys_memmove(item, item + 1, size * sizeof (PMC*));
- item[size] = PMCNULL;
-
+ value = VTABLE_get_integer(INTERP, PMC_array(SELF)[0]);
+ do_shift(SELF);
return value;
}
VTABLE PMC *shift_pmc() {
- INTVAL size = PMC_size(SELF);
- PMC *data;
- PMC **item;
+ INTVAL size = PMC_size(SELF);
+ PMC *data;
if (0 == size)
throw_shift_empty(INTERP);
- item = PMC_array(SELF);
- data = item[0];
- PMC_size(SELF) = --size;
-
- mem_sys_memmove(item, item + 1, size * sizeof (PMC *));
- item[size] = PMCNULL;
-
+ data = PMC_array(SELF)[0];
+ do_shift(SELF);
return data;
}
VTABLE STRING *shift_string() {
INTVAL size = PMC_size(SELF);
- PMC *data;
- PMC **item;
STRING *value;
if (0 == size)
throw_shift_empty(INTERP);
- item = PMC_array(SELF);
- data = item[0];
- value = VTABLE_get_string(INTERP, data);
- PMC_size(SELF) = --size;
-
- mem_sys_memmove(item, item + 1, size * sizeof (PMC *));
-
- item[size] = PMCNULL;
-
+ value = VTABLE_get_string(INTERP, PMC_array(SELF)[0]);
+ do_shift(SELF);
return value;
}
@@ -515,79 +527,27 @@
VTABLE void unshift_float(FLOATVAL value) {
- const INTVAL size = PMC_size(SELF);
- PMC * const val = Parrot_pmc_new(INTERP, enum_class_Float);
- PMC **data;
- INTVAL i;
-
+ PMC * const val = Parrot_pmc_new(INTERP, enum_class_Float);
VTABLE_set_number_native(INTERP, val, value);
- SELF.set_integer_native(size + 1);
-
- data = PMC_array(SELF);
-
- for (i = size; i; --i)
- data[i] = data[i - 1];
-
- data[0] = val;
-
- return;
+ do_unshift(INTERP, SELF, val);
}
VTABLE void unshift_integer(INTVAL value) {
- const INTVAL size = PMC_size(SELF);
- PMC * const val = Parrot_pmc_new_init_int(INTERP, enum_class_Integer, value);
- PMC **data;
- INTVAL i;
-
- SELF.set_integer_native(size + 1);
-
- data = PMC_array(SELF);
-
- for (i = size; i; --i)
- data[i] = data[i - 1];
-
- data[0] = val;
-
- return;
+ PMC * const val = Parrot_pmc_new_init_int(INTERP, enum_class_Integer, value);
+ do_unshift(INTERP, SELF, val);
}
VTABLE void unshift_pmc(PMC *value) {
- const INTVAL size = PMC_size(SELF);
- PMC **data;
- INTVAL i;
-
- SELF.set_integer_native(size + 1);
-
- data = PMC_array(SELF);
-
- for (i = size; i; --i)
- data[i] = data[i - 1];
-
- data[0] = value;
-
- return;
+ do_unshift(INTERP, SELF, value);
}
VTABLE void unshift_string(STRING *value) {
- const INTVAL size = PMC_size(SELF);
- PMC * const val = Parrot_pmc_new(INTERP, enum_class_String);
- PMC **data;
- INTVAL i;
-
+ PMC * const val = Parrot_pmc_new(INTERP, enum_class_String);
VTABLE_set_string_native(INTERP, val, value);
- SELF.set_integer_native(size + 1);
-
- data = PMC_array(SELF);
-
- for (i = size; i; --i)
- data[i] = data[i - 1];
-
- data[0] = val;
-
- return;
+ do_unshift(INTERP, SELF, val);
}
/*
@@ -790,6 +750,14 @@
=over 4
+=item C<static void do_shift(PMC *arr)>
+
+Common part for shift operations.
+
+=item C<static void do_unshift(PARROT_INTERP, PMC *arr, PMC *val)>
+
+Common part for unshift operations.
+
=item C<static void throw_shift_empty(PARROT_INTERP)>
=item C<static void throw_pop_empty(PARROT_INTERP)>
Modified: branches/gsoc_instrument/src/pmc/role.pmc
==============================================================================
--- branches/gsoc_instrument/src/pmc/role.pmc Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/pmc/role.pmc Sat Jun 19 16:17:11 2010 (r47715)
@@ -101,7 +101,7 @@
* to look one up with and do so. */
PMC *_namespace = VTABLE_get_pmc_keyed_str(interp, info, namespace_str);
if (!VTABLE_isa(interp, _namespace, ns_string))
- _namespace = Parrot_make_namespace_autobase(interp, _namespace);
+ _namespace = Parrot_ns_make_namespace_autobase(interp, _namespace);
/* If we get something null back it's an error; otherwise, store it. */
if (!PMC_IS_NULL(_namespace))
@@ -121,7 +121,7 @@
/* Namespace is nested in the current namespace and with the name of
* the role. */
- role->_namespace = Parrot_make_namespace_keyed_str(interp,
+ role->_namespace = Parrot_ns_make_namespace_keyed_str(interp,
Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp)), role->name);
}
@@ -131,7 +131,7 @@
* to look one up with and do so. */
PMC *_namespace = VTABLE_get_pmc_keyed_str(interp, info, namespace_str);
if (!VTABLE_isa(interp, _namespace, ns_string))
- _namespace = Parrot_make_namespace_autobase(interp, _namespace);
+ _namespace = Parrot_ns_make_namespace_autobase(interp, _namespace);
/* If we get something null back it's an error; otherwise, store it. */
if (PMC_IS_NULL(_namespace))
Modified: branches/gsoc_instrument/src/pmc/string.pmc
==============================================================================
--- branches/gsoc_instrument/src/pmc/string.pmc Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/pmc/string.pmc Sat Jun 19 16:17:11 2010 (r47715)
@@ -56,10 +56,6 @@
VTABLE void mark() {
STRING *str_val;
-
- if (!PMC_data(SELF))
- return;
-
GET_ATTR_str_val(INTERP, SELF, str_val);
Parrot_gc_mark_STRING_alive(INTERP, str_val);
}
Modified: branches/gsoc_instrument/src/pmc/stringhandle.pmc
==============================================================================
--- branches/gsoc_instrument/src/pmc/stringhandle.pmc Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/pmc/stringhandle.pmc Sat Jun 19 16:17:11 2010 (r47715)
@@ -109,12 +109,9 @@
PMC * const copy = Parrot_pmc_new(INTERP, enum_class_StringHandle);
Parrot_StringHandle_attributes * const data_struct = PARROT_STRINGHANDLE(copy);
- if (old_struct->stringhandle != NULL)
- data_struct->stringhandle = old_struct->stringhandle;
- if (old_struct->mode != NULL)
- data_struct->mode = old_struct->mode;
- if (old_struct->encoding != NULL)
- data_struct->encoding = old_struct->encoding;
+ data_struct->stringhandle = old_struct->stringhandle;
+ data_struct->mode = old_struct->mode;
+ data_struct->encoding = old_struct->encoding;
data_struct->flags = old_struct->flags;
return copy;
Modified: branches/gsoc_instrument/src/pmc/stringiterator.pmc
==============================================================================
--- branches/gsoc_instrument/src/pmc/stringiterator.pmc Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/pmc/stringiterator.pmc Sat Jun 19 16:17:11 2010 (r47715)
@@ -139,19 +139,21 @@
VTABLE void set_integer_native(INTVAL value) {
Parrot_StringIterator_attributes * const attrs =
PARROT_STRINGITERATOR(SELF);
- if (value == ITERATE_FROM_START) {
+ switch (value) {
+ case ITERATE_FROM_START:
attrs->reverse = 0;
attrs->pos = 0;
attrs->length = VTABLE_elements(INTERP, attrs->string);
- }
- else if (value == ITERATE_FROM_END) {
+ break;
+ case ITERATE_FROM_END:
attrs->reverse = 1;
attrs->pos = attrs->length
= VTABLE_elements(INTERP, attrs->string);
- }
- else
+ break;
+ default:
Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
"Wrong direction for StringIterator");
+ }
}
/*
Modified: branches/gsoc_instrument/src/pmc/timer.pmc
==============================================================================
--- branches/gsoc_instrument/src/pmc/timer.pmc Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/pmc/timer.pmc Sat Jun 19 16:17:11 2010 (r47715)
@@ -105,7 +105,7 @@
=item C<void init_pmc(PMC *init)>
-See F<docs/pdds/pdd02_vtables.pod> for initializers.
+Takes an even-length collection of keys and values.
=cut
Modified: branches/gsoc_instrument/src/thread.c
==============================================================================
--- branches/gsoc_instrument/src/thread.c Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/src/thread.c Sat Jun 19 16:17:11 2010 (r47715)
@@ -197,7 +197,7 @@
/* Skip vtable overrides and methods. */
if (ret_val_sub->vtable_index == -1
&& !(ret_val_sub->comp_flags & SUB_COMP_FLAG_METHOD)) {
- Parrot_store_sub_in_namespace(interp, ret_val);
+ Parrot_ns_store_sub(interp, ret_val);
}
}
else {
Modified: branches/gsoc_instrument/t/compilers/imcc/syn/regressions.t
==============================================================================
--- branches/gsoc_instrument/t/compilers/imcc/syn/regressions.t Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/t/compilers/imcc/syn/regressions.t Sat Jun 19 16:17:11 2010 (r47715)
@@ -6,7 +6,7 @@
use warnings;
use lib qw( . lib ../lib ../../lib );
use Test::More;
-use Parrot::Test tests => 22;
+use Parrot::Test tests => 21;
pir_error_output_like( <<'CODE', <<'OUT', 'invalid get_results syntax');
.sub main :main
@@ -191,19 +191,6 @@
3
OUT
-TODO: {
- local $TODO = "works in PIR, not PASM";
-
-pasm_output_is( <<"CODE", <<'OUT', 'long register numbers in PASM (TT #1025)');
- new P$register, 'Integer'
- assign P$register, 3
- say P$register
-CODE
-3
-OUT
-
-}
-
pir_error_output_like( <<'CODE', <<'OUT', 'die in immediate, TT #629');
.sub 'foo' :immediate
die 'no'
Copied: branches/gsoc_instrument/t/oo/objects.t (from r47713, trunk/t/oo/objects.t)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/gsoc_instrument/t/oo/objects.t Sat Jun 19 16:17:11 2010 (r47715, copy of r47713, trunk/t/oo/objects.t)
@@ -0,0 +1,1791 @@
+#!./parrot
+# Copyright (C) 2001-2010, Parrot Foundation.
+# $Id$
+
+=head1 NAME
+
+t/oo/objects.t - Objects
+
+=head1 SYNOPSIS
+
+ % prove t/oo/objects.t
+
+=head1 DESCRIPTION
+
+Tests the object/class subsystem.
+
+=cut
+
+.sub main :main
+ .include 'test_more.pir'
+ .include "iglobals.pasm"
+ .include "interpinfo.pasm"
+
+ plan(194)
+
+ get_classname_from_class()
+ test_get_class()
+ test_isa()
+ does_scalar()
+ does_array()
+ new_object()
+ new_object__isa_test()
+ new_object__classname()
+ isa_subclass()
+ isa_subclass__objects()
+ test_addmethod()
+ test_addattribute()
+ addattribute_subclass()
+ addattribute_subclass__same_name()
+ set_and_get_object_attribs()
+ set_and_get_multiple_object_attribs()
+ attribute_values_are_specific_to_objects()
+ attribute_values_and_subclassing()
+ attribute_values_and_subclassing_2()
+ PMC_as_classes__overridden_mmd_methods()
+ typeof_class()
+ typeof_objects()
+ multiple_inheritance__with_attributes()
+ attributes_two_levels_of_inheritance()
+ class_op_test()
+ anon_subclass_has_no_name()
+ get_attrib_by_name()
+ get_attrib_by_name_subclass()
+ set_attrib_by_name_subclass()
+ PMC_as_classes()
+ PMC_as_classes__subclass()
+ PMC_as_classes__instantiate()
+ PMC_as_classes__methods()
+ PMC_as_classes__mmd_methods()
+ PMC_as_classes__derived_1()
+ PMC_as_classes__derived_2()
+ PMC_as_classes__derived_3()
+ subclassing_Class()
+ namespace_vs_name()
+ multiple_anon_classes()
+ subclassed_Integer_bug()
+ equality_of_subclassed_Integer()
+ short_name_attributes()
+ init_with_and_without_arg()
+ newclass_bracket_parsing()
+ verify_namespace_types()
+ verify_data_type()
+ new_keyed()
+ new_keyed_2()
+ new_keyed_3()
+ subclass_keyed()
+ test_class_name_multipart_name()
+ test_get_class_multipart_name()
+ isa_bug()
+ new_nested_ordering()
+ vtable_override_once_removed()
+ vtable_fails_for_subclasses_of_core_classes()
+ super___init_called_twice()
+ using_class_object_from_typeof_op_with_new()
+ setting_non_existent_attribute()
+ setting_non_existent_attribute_by_name()
+ getting_null_attribute()
+ getting_non_existent_attribute()
+ addparent_exceptions_1()
+ addparent_exceptions_2()
+ subclassing_a_non_existent_class()
+ anon_subclass_of_non_existent_class()
+ addattribute_duplicate()
+ wrong_way_to_create_new_objects()
+ attribute_values__subclassing_access_meths()
+ attribute_values__inherited_access_meths()
+
+ # END_OF_TESTS
+.end
+
+.sub get_classname_from_class
+ newclass $P1, "Foo5"
+ set $S0, $P1
+ is( $S0, "Foo5", "got classname Foo5" )
+
+ subclass $P2, $P1, "Bar5"
+ set $S1, $P2
+ is( $S1, "Bar5", "got subclass Bar5" )
+
+ subclass $P3, "Foo5", "Baz5"
+ set $S2, $P3
+ is( $S2, "Baz5", "got subclass Baz5" )
+.end
+
+.sub test_get_class
+ newclass $P1, "Foo6"
+ get_class $P2, "Foo6"
+ set $S2, $P2
+ is( $S2, "Foo6", 'get_class for Foo6' )
+
+ subclass $P3, $P1, "FooBar6"
+ get_class $P4, "FooBar6"
+ set $S4, $P4
+ is( $S4, 'FooBar6', 'get_class for FooBar6' )
+
+ get_class $P3, "NoSuch6"
+ isnull $I0, $P3
+ ok( $I0, "no class for 'NoSuch6'" )
+.end
+
+.sub test_isa
+ new $P1, ['Boolean']
+
+ isa $I0, $P1, "Boolean"
+ is( $I0, 1, 'Boolean isa Boolean' )
+
+ isa $I0, $P1, "Bool"
+ is( $I0, 0, 'Boolean !isa Bool' )
+
+ isa $I0, $P1, "scalar"
+ is( $I0, 1, 'Boolean isa scalar' )
+
+ isa $I0, $P1, "calar"
+ is( $I0, 0, 'Boolean !isa calar' )
+
+ isa $I0, $P1, "Integer"
+ is( $I0, 1, 'Boolean isa Integer' )
+
+ isa $I0, $P1, "Integ"
+ is( $I0, 0, 'Boolean !isa Integ' )
+
+ isa $I0, $P1, "eger"
+ is( $I0, 0, 'Boolean !isa eger' )
+
+ isa $I0, $P1, " "
+ is( $I0, 0, 'Boolean !isa " "' )
+
+ isa $I0, $P1, ""
+ is( $I0, 0, 'Boolean !isa ""' )
+
+ null $S0
+ isa $I0, $P1, $S0
+ is( $I0, 0, 'Boolean !isa null $S0' )
+
+ set $S0, "scalar"
+ isa $I0, $P1, $S0
+ is( $I0, 1, 'Boolean isa scalar $S0' )
+.end
+
+.sub does_scalar
+ new $P1, ['Boolean']
+
+ does $I0, $P1, "Boolean"
+ is( $I0, 0, 'Boolean !does Boolean' )
+
+ does $I0, $P1, "Bool"
+ is( $I0, 0, 'Boolean !does Bool' )
+
+ does $I0, $P1, "scalar"
+ is( $I0, 1, 'Boolean does scalar' )
+.end
+
+.sub does_array
+ new $P1, ['OrderedHash']
+
+ does $I0, $P1, "Boolean"
+ is( $I0, 0, 'OrderedHash !does Boolean' )
+
+ does $I0, $P1, "Bool"
+ is( $I0, 0, 'OrderedHash !does Bool' )
+
+ does $I0, $P1, "hash"
+ is( $I0, 1, 'OrderedHash does hash' )
+
+ does $I0, $P1, "array"
+ is( $I0, 1, 'OrderedHash does array' )
+.end
+
+.sub new_object
+ newclass $P1, "Foo7"
+ new $P2, "Foo7"
+ ok( 1, 'created new object from Foo7 class' )
+.end
+
+.sub new_object__isa_test
+ newclass $P1, "Foo8"
+ new $P2, $P1
+ ok( 1, 'created new object from Foo8 class' )
+
+ isa $I0, $P2, "Foo8"
+ ok( $I0, 'new object isa Foo8' )
+.end
+
+.sub new_object__classname
+ newclass $P1, "Foo9"
+ new $P2, $P1
+ set $S0, $P1 # class
+ is( $S0, "Foo9", 'new object from Foo9 class as a string is Foo9' )
+
+ typeof $S0, $P2 # object
+ is( $S0, 'Foo9', 'typeof obj is Foo9' )
+
+ class $P3, $P1
+ set $S0, $P1 # class
+ is( $S0, 'Foo9', 'class of obj is Foo9' )
+
+ typeof $S0, $P2 # object
+ is( $S0, 'Foo9', 'typeof obj is Foo9' )
+
+.end
+
+.sub isa_subclass
+ newclass $P1, "Foo10"
+ subclass $P2, $P1, "Bar10"
+
+ isa_ok( $P2, "Foo10", 'newclass isa Foo10' )
+ isa_ok( $P2, "Bar10", 'new subclass isa Bar10' )
+ isa_ok( $P2, "Foo10", 'new subclass isa parent' )
+ isa_ok( $P2, "Class", 'new subclass isa Class' )
+
+ isa $I0, $P2, "Object"
+ is( $I0, 0, 'new subclass !isa Object' )
+.end
+
+.sub isa_subclass__objects
+ newclass $P3, "Foo30"
+ subclass $P4, $P3, "Bar30"
+ $P1 = $P3.'new'()
+ $P2 = $P4.'new'()
+
+ isa_ok( $P1, "Foo30", 'obj isa its class' )
+ isa_ok( $P2, "Bar30", 'obj isa its class' )
+ isa_ok( $P2, "Foo30", 'obj isa its parent class' )
+ isa_ok( $P2, "Object", 'obj isa Object' )
+ isa_ok( $P2, "Class", 'obj isa Class' )
+.end
+
+.sub test_addmethod
+ newclass $P0, 'Foo31'
+ $P2 = get_hll_global 'sayFoo31'
+
+ # add a method BEFORE creating a Foo object
+ addmethod $P0, 'foo31', $P2
+ $P1 = new 'Foo31'
+ $P1.'foo31'()
+
+ # get a method from some other namespace
+ $P2 = get_hll_global ['Bar31'], 'sayBar31'
+
+ # add a method AFTER creating the object
+ addmethod $P0, 'bar31', $P2
+ $P1.'bar31'()
+.end
+
+.sub sayFoo31
+ ok( 1, 'called method added before creating obj' )
+.end
+
+.namespace ['Bar31']
+.sub sayBar31
+ ok( 1, 'called method added after created obj' )
+.end
+
+.namespace [] # Reset to root namespace for next test
+
+.sub test_addattribute
+ newclass $P1, "Foo11"
+
+ addattribute $P1, "foo_i"
+ ok( 1, 'addattribute did not blow up' )
+
+ set $S0, $P1
+ is( $S0, "Foo11", '$P1 is still the same class as PMC' )
+
+ # Check that we can add multiple attributes
+ set $I0, 0
+l1:
+ set $S0, $I0
+ addattribute $P1, $S0
+ inc $I0
+ lt $I0, 1000, l1
+ ok( 1, 'addattribute 1000x without blow up' )
+.end
+
+.sub addattribute_subclass
+ newclass $P1, "Foo12"
+ addattribute $P1, "foo_i"
+ ok( 1, 'addattribute to Foo12' )
+
+ subclass $P2, $P1, "Bar12"
+ addattribute $P2, "bar_i"
+ ok( 1, 'addattribute to subclass of Foo12' )
+.end
+
+.sub addattribute_subclass__same_name
+ newclass $P1, "Foo32"
+ addattribute $P1, "i"
+ addattribute $P1, "j"
+
+ subclass $P2, $P1, "Bar32"
+ addattribute $P2, "j"
+ addattribute $P2, "k"
+
+ ok( 1, 'created class and subclass and added attributes' )
+
+ .local pmc o
+ o = $P2.'new'()
+ $P0 = getattribute o, 'i'
+ is( $P0, 'Foo32.i', 'parent attrib initialized in init' )
+ $P0 = getattribute o, ['Foo32'], 'j'
+ is( $P0, 'Foo32.j', 'parent attrib initialized in init' )
+ $P0 = getattribute o, ['Bar32'], 'j'
+ is( $P0, 'Bar32.j', 'subclass attrib initialized in init' )
+ $P0 = getattribute o, 'k'
+ is( $P0, 'Bar32.k', 'subclass attrib initialized in init' )
+
+ $P0 = getattribute o, 'i'
+ is( $P0, 'Foo32.i', 'parent attrib init-ed' )
+ $P0 = getattribute o, ['Foo32'], "j"
+ is( $P0, 'Foo32.j', 'parent attrib init-ed' )
+ $P0 = getattribute o, 'j'
+ is( $P0, 'Bar32.j', 'subclass attrib returned over parent' )
+ $P0 = getattribute o, 'k'
+ is( $P0, 'Bar32.k', 'subclass attrib init-ed' )
+.end
+
+.namespace ['Bar32']
+
+.sub init :vtable :method
+ $P0 = new ['String']
+ $P0 = 'Foo32.i'
+ setattribute self, ['Foo32'], "i", $P0
+ $P0 = new ['String']
+ $P0 = 'Foo32.j'
+ setattribute self, ["Foo32"], "j", $P0
+ $P0 = new ['String']
+ $P0 = 'Bar32.j'
+ setattribute self, ["Bar32"], "j", $P0
+ $P0 = new ['String']
+ $P0 = 'Bar32.k'
+ setattribute self, ["Bar32"], "k", $P0
+.end
+
+.namespace [] # Reset to root namespace for next test
+
+.sub set_and_get_object_attribs
+ newclass $P1, "Foo13"
+ addattribute $P1, "i"
+ new $P2, $P1
+
+ new $P3, ['Integer']
+ set $P3, 1024
+ setattribute $P2, "i", $P3
+
+ new $P4, ['Integer']
+ getattribute $P4, $P2, "i"
+
+ is( $P4, 1024, 'set/get Integer attribute' )
+.end
+
+.sub set_and_get_multiple_object_attribs
+ newclass $P1, "Foo14"
+ addattribute $P1, "i"
+ addattribute $P1, "j"
+ new $P2, "Foo14"
+
+ new $P3, ['Integer']
+ set $P3, 4201
+ new $P4, ['Hash']
+ set $P4["Key"], "Value"
+
+ setattribute $P2, "i", $P3
+ setattribute $P2, "j", $P4
+
+ getattribute $P5, $P2, "i"
+ is( $P5, '4201', 'set/get Integer attribute' )
+
+ getattribute $P6, $P2, "j"
+ set $S0, $P6["Key"]
+ is( $S0, 'Value', 'set/get Hash attribute on same obj' )
+.end
+
+.sub attribute_values_are_specific_to_objects
+ newclass $P1, "Foo15"
+ addattribute $P1, "i"
+ new $P2, $P1
+ new $P3, $P1
+
+ new $P4, ['Integer']
+ set $P4, 100
+ setattribute $P2, "i", $P4
+ new $P5, ['String']
+ set $P5, "One hundred"
+ setattribute $P3, "i", $P5
+
+ getattribute $P6, $P2, "i"
+ is( $P6, 100, 'attribute value on 1st object is specific to obj' )
+
+ getattribute $P6, $P3, "i"
+ is( $P6, 'One hundred', 'attribute value on 2nd obj is specific to obj' )
+.end
+
+.sub attribute_values_and_subclassing
+ newclass $P1, "Foo16"
+ addattribute $P1, "i"
+ addattribute $P1, "j"
+ subclass $P2, $P1, "Bar16"
+ addattribute $P2, "k"
+ addattribute $P2, "l"
+
+ new $P2, "Bar16"
+ new $P3, "Bar16"
+
+ # Note that setattribute holds the actual PMC, not a copy, so
+ # in this test both attributes get the PMC from $P4, and should
+ # both have the same value, despite the C<inc>.
+ new $P4, ['Integer']
+ set $P4, 10
+ setattribute $P2, "i", $P4
+ inc $P4
+ setattribute $P2, "j", $P4
+
+ new $P5, ['Integer']
+ set $P5, 100
+ setattribute $P3, "i", $P5
+ inc $P5
+ setattribute $P3, "j", $P5
+
+ getattribute $P6, $P2, "i"
+ is( $P6, 11, 'setattrib with a PMC holds actual PMC not copy' )
+
+ getattribute $P6, $P2, "j"
+ is( $P6, 11, '...so changes to the PMC appear through the attrib' )
+
+ getattribute $P6, $P3, "i"
+ is( $P6, 101, '...and second test on new objects' )
+
+ getattribute $P6, $P3, "j"
+ is( $P6, 101, '...should have same result' )
+.end
+
+.sub attribute_values_and_subclassing_2
+ newclass $P1, "Foo17"
+ # must add attributes before object instantiation
+ addattribute $P1, ".i"
+ addattribute $P1, ".j"
+
+ subclass $P2, $P1, "Bar17"
+ addattribute $P2, ".k"
+ addattribute $P2, ".l"
+
+ # subclass is preferred for the SI case over
+ # newclass $P2, "Bar"
+ # addattrib ...
+ # addparent $P2, $P1
+ # which is suitable for adding multiple parents to one class
+
+ # instantiate a Bar object
+ new $P3, "Bar17"
+
+ # Set the attribute values
+ new $P10, ['String'] # set attribute values
+ set $P10, "i" # attribute slots have reference semantics
+ setattribute $P3, ".i", $P10 # so always put new PMCs in
+ # if you have unique values
+ new $P10, ['String']
+ set $P10, "j"
+ setattribute $P3, ".j", $P10
+
+ new $P10, ['String']
+ set $P10, "k"
+ setattribute $P3, ".k", $P10
+
+ new $P10, ['String']
+ set $P10, "l"
+ setattribute $P3, ".l", $P10
+
+ # retrieve attribs
+ getattribute $P11, $P3, ".i"
+ is( $P11, "i", 'string attribute get/set on parent' )
+
+ getattribute $P11, $P3, ".j"
+ is( $P11, "j", 'string attribute get/set on parent' )
+
+ getattribute $P11, $P3, ".k"
+ is( $P11, "k", 'string attribute get/set on subclass' )
+
+ getattribute $P11, $P3, ".l"
+ is( $P11, "l", 'string attribute get/set on subclass' )
+.end
+
+.sub PMC_as_classes__overridden_mmd_methods
+ .local pmc myint, i, j, k
+
+ get_class $P0, "Integer"
+ subclass myint, $P0, "MyInt1"
+
+ i = new 'MyInt1'
+ j = new 'MyInt1'
+ k = new 'MyInt1'
+ i = 6
+ j = 7
+ k = i + j
+
+ is( k, 13, 'added two MyInt1' )
+
+ j = new ['Integer']
+ j = 100
+ k = i + j
+
+ is( k, 106, 'added MyInt1 and an Integer' )
+.end
+
+.namespace ["MyInt1"]
+
+.sub add :multi(MyInt1, MyInt1, MyInt1)
+ .param pmc self
+ .param pmc right
+ .param pmc dest
+ ok( 1, 'in the add method' )
+ $P0 = getattribute self, ['Integer'], "proxy"
+ $I0 = $P0
+ $I1 = right
+ $I2 = $I0 + $I1
+ dest = $I2
+ .return(dest)
+.end
+
+.namespace [] # Reset to root namespace for next test
+
+.sub typeof_class
+ newclass $P0, "Foo21"
+ typeof $S0, $P0
+ is( $S0, "Class", 'typeof for a Class PMC is "Class"' )
+.end
+
+.sub typeof_objects
+ newclass $P0, "A"
+ newclass $P1, "B"
+
+ new $P0, ['A']
+ new $P1, ['B']
+
+ typeof $S0, $P0
+ typeof $S1, $P1
+
+ is( $S0, 'A', 'typeof object of class A is "A"' )
+ is( $S1, 'B', 'typeof object of class B is "B"' )
+.end
+
+.sub multiple_inheritance__with_attributes
+ newclass $P1, "Star"
+ addattribute $P1, "Spectral Type"
+
+ newclass $P2, "Company"
+ addattribute $P2, "Annual Profit"
+
+ subclass $P3, $P1, "Sun"
+ addparent $P3, $P2
+
+ new $P4, ['Sun']
+
+ new $P5, ['String']
+ set $P5, "G"
+ setattribute $P4, "Spectral Type", $P5
+
+ new $P6, ['String']
+ set $P6, "$100,000,000"
+ setattribute $P4, "Annual Profit", $P6
+
+ getattribute $P7, $P4, "Spectral Type"
+ is( $P7, 'G', 'direct parents attribute' )
+
+ getattribute $P8, $P4, "Annual Profit"
+ is( $P8, '$100,000,000', "addparent's attribute" )
+.end
+
+.sub attributes_two_levels_of_inheritance
+ newclass $P0, "Astronomical Object"
+ addattribute $P0, "Location"
+
+ subclass $P1, $P0, "Star2"
+ addattribute $P1, "Spectral Type"
+
+ newclass $P2, "Sun2"
+ addparent $P2, $P1
+ addparent $P2, $P0
+
+ new $P4, "Sun2"
+
+ new $P5, ['String']
+ set $P5, "Taurus"
+ setattribute $P4, "Location", $P5
+ getattribute $P6, $P4, "Location"
+ is( $P6, 'Taurus', 'attributes with two levels of inheritance' )
+.end
+
+.sub class_op_test
+ newclass $P0, "City1"
+ new $P1, "City1"
+
+ class $P2, $P1
+ set $S0, $P2
+ is( $S0, 'City1', 'class op works' )
+.end
+
+.sub anon_subclass_has_no_name
+ newclass $P0, "City2"
+ subclass $P1, $P0
+ set $S0, $P1
+ is( $S0, '', 'anonymous subclass has no name' )
+.end
+
+.sub get_attrib_by_name
+ newclass $P1, "Foo18"
+ addattribute $P1, "i"
+ new $P2, "Foo18"
+ new $P3, ['String']
+ set $P3, "ok"
+ setattribute $P2, "i", $P3
+
+ getattribute $P4, $P2, ["Foo18"], "i"
+ is( $P4, 'ok', 'get attrib by name' )
+.end
+
+.sub get_attrib_by_name_subclass
+ newclass $P0, "Bar19"
+ addattribute $P0, "j"
+
+ subclass $P1, $P0, "Foo19"
+ addattribute $P1, "i"
+
+ new $P2, "Foo19"
+
+ new $P3, ['String']
+ set $P3, "foo i"
+ setattribute $P2, "i", $P3
+
+ new $P3, ['String']
+ set $P3, "bar j"
+ setattribute $P2, "j", $P3
+
+ getattribute $P4, $P2, ["Foo19"], "i"
+ is( $P4, 'foo i', 'attribute from subclass get by name' )
+
+ getattribute $P4, $P2, ["Bar19"], "j"
+ is( $P4, 'bar j', 'attribute from parent class get by name' )
+.end
+
+.sub set_attrib_by_name_subclass
+ newclass $P0, "Bar20"
+ addattribute $P0, "j"
+
+ subclass $P1, $P0, "Foo20"
+ addattribute $P1, "i"
+
+ new $P2, "Foo20"
+
+ new $P3, ['String']
+ set $P3, "foo i"
+ setattribute $P2, ["Foo20"], "i", $P3
+
+ new $P3, ['String']
+ set $P3, "bar j"
+ setattribute $P2, ["Bar20"], "j", $P3
+
+ getattribute $P4, $P2, "i"
+ is( $P4, 'foo i', 'attribute from subclass set by name' )
+
+ getattribute $P4, $P2, "j"
+ is( $P4, 'bar j', 'attribute from parent class set by name' )
+.end
+
+.sub PMC_as_classes
+ get_class $P0, "Integer"
+ ok( 1, "get_class of Integer did't croak" )
+
+ get_class $P0, "Integer"
+ ok( 1, "get_class of Integer did't croak second time" )
+
+ typeof $S0, $P0
+ is( $S0, 'PMCProxy', 'typeof PMCProxy' )
+.end
+
+.sub PMC_as_classes__subclass
+ .local pmc MyInt3
+ get_class $P0, "Integer"
+ ok( 1, "get_class on Integer didn't blow up" )
+
+ subclass MyInt3, $P0, "MyInt3"
+ ok( 1, "subclassing didn't blow up" )
+
+ $S0 = typeof MyInt3
+ is( $S0, 'Class', 'new subclass is typeof Class' )
+
+ $I0 = isa MyInt3, "MyInt3"
+ ok( $I0, 'new subclass isa MyInt' )
+
+ $I0 = isa MyInt3, "Integer"
+ ok( $I0, 'new subclass isa parent class' )
+.end
+
+.sub PMC_as_classes__instantiate
+ .local pmc MyInt4
+ get_class $P0, "Integer"
+ ok( 1, 'able to get_class of Integer' )
+
+ subclass MyInt4, $P0, "MyInt4"
+ addattribute MyInt4, ".i"
+ ok( 1, 'able to addattribute to subclass' )
+
+ .local pmc i
+ i = new "MyInt4"
+ ok( 1, 'able to instantiate obj of subclass w/ attribute' )
+.end
+
+.sub PMC_as_classes__methods
+ .local pmc MyInt5
+ get_class $P0, "Integer"
+
+ subclass MyInt5, $P0, "MyInt5"
+ addattribute MyInt5, "intval"
+
+ .local pmc i, i2
+ i = new "MyInt5"
+ i2 = new ['Integer']
+ i2 = 43
+
+ i = 42 # set_integer is inherited from Integer
+ ok( 1, 'able to assign int to MyInt' )
+
+ $I0 = i # get_integer is overridden below
+ is( $I0, 42, 'get_integer is overridden for MyInt5' )
+
+ $S0 = i # get_string is overridden below
+ is( $S0, 'MyInt5(42)', 'get_string is overridden for MyInt5' )
+.end
+
+.namespace ["MyInt5"]
+
+.sub set_integer_native :vtable :method
+ .param int new_value
+ $P1 = new ['Integer']
+ $P1 = new_value
+ setattribute self, "intval", $P1
+.end
+
+.sub get_integer :vtable :method
+ $P0 = getattribute self, "intval"
+ $I0 = $P0
+ .return ($I0)
+.end
+
+.sub get_string :vtable :method
+ $P0 = getattribute self, "intval"
+ $I0 = $P0
+ $S1 = $I0
+ $S0 = "MyInt5("
+ $S0 .= $S1
+ $S0 .= ")"
+ .return ($S0)
+.end
+
+.namespace [] # Reset to root namespace for next test
+
+.sub PMC_as_classes__mmd_methods
+ .local pmc MyInt6
+ get_class $P0, "Integer"
+ subclass MyInt6, $P0, "MyInt6"
+ .local pmc i
+ .local pmc j
+ .local pmc k
+ i = new "MyInt6"
+ j = new "MyInt6"
+ k = new "MyInt6"
+ i = 6
+ j = 7
+ k = i * j
+ $I0 = k
+ is( $I0, 42, 'MyInt6 defaults to Integer class for mult' )
+
+ $S0 = k # get_string is overridden below
+ is( $S0, 'MyInt6(42)', 'get_string is overridden for MyInt6' )
+.end
+
+.namespace ["MyInt6"]
+
+.sub get_string :vtable :method
+ $I0 = self # get_integer is not overridden
+ $S1 = $I0
+ $S0 = "MyInt6("
+ $S0 .= $S1
+ $S0 .= ")"
+ .return ($S0)
+.end
+
+.namespace [] # Reset to root namespace for next test
+
+.sub PMC_as_classes__derived_1
+ .local pmc MyInt8
+ .local pmc MyInt8_2
+ get_class $P0, "Integer"
+
+ subclass MyInt8, $P0, "MyInt8"
+ addattribute MyInt8, 'intval'
+ get_class $P1, "MyInt8"
+ subclass MyInt8_2, $P1, "MyInt8_2"
+
+ .local pmc i
+ i = new "MyInt8_2"
+ $I0 = isa i, "Integer"
+ ok( $I0, 'obj isa grandparent (Integer)' )
+
+ $I0 = isa i, "MyInt8"
+ ok( $I0, 'obj isa parent (MyInt8)' )
+
+ $I0 = isa i, "MyInt8_2"
+ ok( $I0, 'obj isa its class (MyInt8_2)' )
+
+ i = 42 # set_integer is overridden below
+ $I0 = i # get_integer is overridden below
+ is( $I0, 42, 'set/get_integer overridden' )
+
+ $S0 = i # get_string is overridden below
+ is( $S0, 'MyInt8_2(42)', 'set/get_string overridden' )
+.end
+
+.namespace ["MyInt8"]
+.sub 'set_integer_native' :vtable :method
+ .param int val
+ $P1 = new ['Integer']
+ $P1 = val
+ setattribute self, "intval", $P1
+ .return ()
+.end
+.sub get_integer :vtable :method
+ $P0 = getattribute self, 'intval'
+ $I0 = $P0
+ .return ($I0)
+.end
+.sub get_string :vtable :method
+ $P0 = getattribute self, 'intval'
+ $I0 = $P0
+ $S1 = $I0
+ $S0 = typeof self
+ $S0 .= "("
+ $S0 .= $S1
+ $S0 .= ")"
+ .return ($S0)
+.end
+
+.namespace [] # Reset to root namespace for next test
+
+.sub PMC_as_classes__derived_2
+ .local pmc MyInt9
+ .local pmc MyInt9_2
+ get_class $P0, "Integer"
+
+ subclass MyInt9, $P0, "MyInt9"
+ addattribute MyInt9, 'intval'
+ get_class $P1, "MyInt9"
+ subclass MyInt9_2, $P1, "MyInt9_2"
+
+ .local pmc i
+ i = new "MyInt9_2"
+ $I0 = isa i, "Integer"
+ ok( $I0, 'obj isa grandparent (Integer)' )
+ $I0 = isa i, "MyInt9"
+ ok( $I0, 'obj isa parent (MyInt9)' )
+ $I0 = isa i, "MyInt9_2"
+ ok( $I0, 'obj isa its class (MyInt9_2)' )
+
+ i = 42 # set_integer is overridden below
+ $I0 = i # get_integer is overridden below
+ is( $I0, 43, 'set/get_integer overridden' )
+
+ $S0 = i # get_string is overridden below
+ is( $S0, 'MyInt9_2(42)', 'set/get_string overridden' )
+.end
+
+.namespace ["MyInt9_2"]
+# subclassing methods from MyInt9 is ok
+# this one changes the value a bit
+.sub get_integer :vtable :method
+ $P0 = getattribute self, 'intval'
+ $I0 = $P0
+ inc $I0 # <<<<<
+ .return ($I0)
+.end
+.namespace ["MyInt9"]
+.sub 'set_integer_native' :vtable :method
+ .param int val
+ $P1 = new ['Integer']
+ $P1 = val
+ setattribute self, "intval", $P1
+ .return ()
+.end
+.sub get_integer :vtable :method
+ $P0 = getattribute self, 'intval'
+ $I0 = $P0
+ .return ($I0)
+.end
+.sub get_string :vtable :method
+ $P0 = getattribute self, 'intval'
+ $I0 = $P0
+ $S1 = $I0
+ $S0 = typeof self
+ $S0 .= "("
+ $S0 .= $S1
+ $S0 .= ")"
+ .return ($S0)
+.end
+
+.namespace [] # Reset to root namespace for next test
+
+.sub PMC_as_classes__derived_3
+ .local pmc MyInt10
+ .local pmc MyInt10_2
+ get_class $P0, "Integer"
+
+ subclass MyInt10, $P0, "MyInt10"
+ addattribute MyInt10, 'intval'
+ get_class $P1, "MyInt10"
+ subclass MyInt10_2, $P1, "MyInt10_2"
+
+ .local pmc i
+ i = new "MyInt10_2"
+ $I0 = isa i, "Integer"
+ ok( $I0, 'obj isa grandparent (Integer)' )
+ $I0 = isa i, "MyInt10"
+ ok( $I0, 'obj isa parent (MyInt10)' )
+ $I0 = isa i, "MyInt10_2"
+ ok( $I0, 'obj isa its class (MyInt102)' )
+
+ i = 42 # set_integer is overridden below
+ $I0 = i # get_integer is overridden below
+ is( $I0, 42, 'set/get_integer overridden' )
+
+ $S0 = i # get_string is overridden below
+ is( $S0, 'MyInt10_2(42)', 'set/get_string overridden' )
+.end
+
+.namespace ["MyInt10_2"]
+.sub get_integer :vtable :method
+ $P0 = getattribute self, 'intval'
+ $I0 = $P0
+ .return ($I0)
+.end
+.sub get_string :vtable :method
+ $P0 = getattribute self, 'intval'
+ $I0 = $P0
+ $S1 = $I0
+ $S0 = typeof self
+ $S0 .= "("
+ $S0 .= $S1
+ $S0 .= ")"
+ .return ($S0)
+.end
+.namespace ['MyInt10']
+.sub 'set_integer_native' :vtable :method
+ .param int val
+ $P1 = new ['Integer']
+ $P1 = val
+ setattribute self, "intval", $P1
+ .return ()
+.end
+
+.namespace [] # Reset to root namespace for next test
+
+.sub subclassing_Class
+ .local pmc cl
+ .local pmc parent
+ parent = get_class "Class"
+ cl = subclass parent, "Foo33"
+ ok( 1, 'able to subclass Class' )
+
+ .local pmc o
+ o = new "Foo33"
+ ok( 1, 'able to instantiate subclass of Class' )
+
+ $S0 = typeof o
+ is( $S0, 'Foo33', 'object returns correct class' )
+.end
+
+.sub namespace_vs_name
+ .local pmc o, cl, f
+ newclass cl, "Foo34"
+ o = new "Foo34"
+ is( o, 'Foo34::get_string', 'found Foo34 namespace' )
+
+ o = Foo34()
+ is( o, 'Foo34', 'found global Foo34' )
+
+ f = get_global "Foo34"
+ o = f()
+ is( o, 'Foo34', 'found global Foo34 explicitly' )
+
+ f = get_global ["Foo34"], "Foo34"
+ o = f()
+ is( o, 'Foo34::Foo34', 'found method in Foo34 namespace' )
+.end
+
+.sub Foo34
+ .return("Foo34")
+.end
+
+.namespace [ "Foo34" ]
+
+.sub get_string :vtable :method
+ .return("Foo34::get_string")
+.end
+
+.sub Foo34
+ .return("Foo34::Foo34")
+.end
+
+.namespace [] # Reset to root namespace for next test
+
+.sub multiple_anon_classes
+ newclass $P0, "City3"
+ subclass $P1, $P0
+ newclass $P2, "State3"
+ subclass $P3, $P2
+ ok( 1, "multiple anon classes didn't croak (bug #33103)" )
+.end
+
+.sub subclassed_Integer_bug
+ .local pmc class
+ .local pmc a
+ .local pmc b
+
+ subclass class, "Integer", "LispInteger1"
+
+ a = new "LispInteger1"
+ b = new "LispInteger1"
+
+ a = 1
+ b = 1
+
+ set $S0, a
+ is( $S0, '1', 'subclassed Integer is 1' )
+ set $S0, b
+ is( $S0, '1', 'subclassed Integer is 1' )
+
+ a = a * b
+ set $S0, a
+ is( $S0, '1', 'multip and reasign to subclassed Integer is 1' )
+.end
+
+.sub equality_of_subclassed_Integer
+ .local pmc class
+ class = subclass "Integer", "LispInteger2"
+
+ .local pmc a
+ a = new 'LispInteger2'
+ a = 123
+
+ .local pmc b
+ b = new 'LispInteger2'
+ b = 123
+
+ $I0 = a == b
+ ok( $I0, '123 is equal to 123' )
+
+.end
+
+.sub short_name_attributes
+ newclass $P1, "Foo22"
+ addattribute $P1, "i"
+ addattribute $P1, "j"
+
+ subclass $P2, $P1, "Bar22"
+ addattribute $P2, "k"
+ addattribute $P2, "l"
+
+ new $P2, "Bar22"
+
+ # set a bunch of attribs
+ new $P4, ['Integer']
+ set $P4, 10
+ setattribute $P2, "i", $P4
+
+ new $P4, ['Integer']
+ set $P4, 11
+ setattribute $P2, "j", $P4
+
+ new $P4, ['Integer']
+ set $P4, 20
+ setattribute $P2, "k", $P4
+
+ new $P4, ['Integer']
+ set $P4, 21
+ setattribute $P2, "l", $P4
+
+ getattribute $P6, $P2, "i"
+ is( $P6, 10, '"i" getattribute on parent class attrib' )
+ getattribute $P6, $P2, "j"
+ is( $P6, 11, '"j" getattribute on parent class attrib' )
+
+ getattribute $P6, $P2, "k"
+ is( $P6, 20, '"k" getattribute on subclass attrib' )
+ getattribute $P6, $P2, "l"
+ is( $P6, 21, '"l" getattribute on subclass attrib' )
+
+ getattribute $P6, $P2, ["Foo22"], "i"
+ is( $P6, 10, '["Foo22"], "i" getattribute on parent class attrib' )
+ getattribute $P6, $P2, ["Bar22"], "k"
+ is( $P6, 20, '["Bar22"], "k" getattribute on subclass attrib' )
+.end
+
+.sub init_with_and_without_arg
+ .local pmc cl, o, h, a
+ cl = newclass "Foo35"
+ addattribute cl, "a"
+ o = cl.'new'()
+ a = getattribute o, "a"
+ is( a, 'ok 1', 'init without an arg' )
+
+ h = new ['Hash']
+ $P0 = new ['String']
+ $P0 = "ok 2"
+ h['a'] = $P0
+ o = new cl, h
+ a = getattribute o, "a"
+ is( a, 'ok 2', 'init with an arg' )
+.end
+
+.namespace ["Foo35"]
+.sub init_pmc :vtable :method
+ .param pmc args
+ $P0 = args['a']
+ setattribute self, 'a', $P0
+ .return()
+.end
+.sub init :vtable :method
+ $P0 = new ['String']
+ $P0 = "ok 1"
+ setattribute self, 'a', $P0
+.end
+
+.namespace [] # Reset to root namespace for next test
+
+.sub newclass_bracket_parsing
+ newclass $P0, ['Foo23';'Bar23']
+ ok( 1, 'newclass created with brackets' )
+.end
+
+.sub verify_namespace_types
+ newclass $P0, ['Foo24';'Bar24']
+ getinterp $P0
+ set $P1, $P0[.IGLOBALS_CLASSNAME_HASH]
+ typeof $S0, $P1
+ is( $S0, 'NameSpace', 'namespace verified' )
+
+ set $P2, $P1['Foo24']
+ typeof $S0, $P2
+ is( $S0, 'NameSpace', 'namespace verified' )
+.end
+
+.sub verify_data_type
+ newclass $P0, ['Foo25';'Bar25']
+ getinterp $P0
+ set $P1, $P0[.IGLOBALS_CLASSNAME_HASH]
+ set $P2, $P1['Foo25']
+ set $P3, $P2['Bar25']
+
+ set $I0, $P3
+ isgt $I0, $I0, 0
+ ok( $I0, 'verified datatype > 0' )
+.end
+
+# Puts init in a namespace
+.sub new_keyed
+ .local pmc cl, o, p
+ cl = newclass ['Foo36';'Bar36']
+ addattribute cl, "init_check"
+ o = cl.'new'()
+ ok( 1, 'obj successfully created' )
+
+ p = getattribute o, "init_check"
+ is( p, 999, "overridden init called")
+.end
+
+.namespace ['Foo36';'Bar36']
+
+.sub init :vtable :method
+ .local pmc p
+ p = new ['Integer']
+ p = 999
+ setattribute self, "init_check", p
+.end
+
+.namespace [] # revert to root for next test
+
+.sub new_keyed_2
+ .local pmc c1, c2, o1, o2
+ c1 = newclass ['Foo37';'Bar37']
+ c2 = newclass ['Foo37';'Fuz37']
+ o1 = c1.'new'()
+ o2 = c2.'new'()
+ ok( 1, 'objects created successfully' )
+.end
+
+.namespace ['Foo37';'Bar37']
+
+.sub init :vtable :method
+ ok( 1, '__init Bar37' )
+.end
+
+.namespace ['Foo37';'Fuz37']
+
+.sub init :vtable :method
+ ok( 1, '__init Fuz37' )
+.end
+
+.namespace [] # revert to root for next test
+
+.sub new_keyed_3
+ .local pmc c1, c2, c3, o1, o2, o3
+ c1 = newclass ['Foo38';'Bar38']
+ c2 = newclass ['Foo38';'Buz38']
+ c3 = newclass 'Foo38'
+ o1 = new ['Foo38';'Bar38']
+ o2 = new ['Foo38';'Buz38']
+ o3 = new 'Foo38'
+ ok( 1, 'objects created successfully' )
+.end
+
+.namespace ['Foo38';'Bar38']
+
+.sub init :vtable :method
+ ok( 1, '__init Bar38' )
+.end
+
+.namespace ['Foo38';'Buz38']
+
+.sub init :vtable :method
+ ok( 1, '__init Buz38' )
+.end
+
+.namespace ['Foo38']
+
+.sub init :vtable :method
+ ok( 1, '__init Foo38' )
+.end
+
+.namespace [] # revert to root for next test
+
+.sub subclass_keyed
+ .local pmc base, o1, o2
+ base = subclass 'Hash', ['Perl6-3'; 'PAST'; 'Node']
+ addattribute base, '$.source' # original source
+ addattribute base, '$.pos' # offset position
+
+ $P0 = subclass base, ['Perl6-3'; 'PAST'; 'Sub']
+ $P0 = subclass base, ['Perl6-3'; 'PAST'; 'Stmt']
+ ok( 1, 'ok 1\n' )
+
+ o1 = new ['Perl6-3'; 'PAST'; 'Sub']
+ o2 = new ['Perl6-3'; 'PAST'; 'Stmt']
+ ok( 1, 'objects created successfully' )
+.end
+
+.namespace ['Perl6-3'; 'PAST'; 'Stmt']
+
+.sub init :vtable :method
+ ok( 1, '__init Stmt' )
+.end
+
+.namespace ['Perl6-3'; 'PAST'; 'Sub']
+
+.sub init :vtable :method
+ ok( 1, '__init Sub' )
+.end
+
+.namespace [] # revert to root for next test
+
+.sub test_class_name_multipart_name
+ .local pmc base, o1
+ base = subclass 'Hash', ['Perl6'; 'PAST'; 'Node']
+ o1 = new base
+ $S0 = typeof o1
+ is( $S0, "Perl6;PAST;Node", "typeof returns object's class name" )
+.end
+
+.sub test_get_class_multipart_name
+ .local pmc base, o1
+ base = subclass 'Hash', ['Perl6a'; 'PAST'; 'Node']
+ $P0 = get_class ['Perl6a'; 'PAST'; 'Node']
+ o1 = new $P0
+ $S0 = typeof o1
+ is( $S0, 'Perl6a;PAST;Node', 'typeof returns objects created from get_class' )
+.end
+
+.sub isa_bug
+ .local pmc base, o1, o2
+ base = subclass 'Hash', ['Perl6b'; 'PAST'; 'Node']
+ $P0 = new [ 'Perl6b'; 'PAST'; 'Node' ]
+
+ $I0 = isa $P0, [ 'Perl6b'; 'PAST'; 'Node']
+ is( $I0, 1, 'obj isa the full class name' )
+
+ $I0 = isa $P0, 'Hash'
+ is( $I0, 1, 'obj isa the parent class' )
+
+ $I0 = isa $P0, 'Perl6b'
+ is( $I0, 0, 'obj !isa the first part of the class name' )
+.end
+
+.sub new_nested_ordering
+ .local pmc c1, c2, o
+ c1 = newclass ['Foo39']
+ c2 = newclass ['Foo39';'Bar39']
+ o = c2.'new'()
+ ok( 1, 'objects created successfully' )
+.end
+
+.namespace ['Foo39']
+
+.sub init :vtable :method
+ ok( 0, '__init Foo39' ) # shouldn't be called
+.end
+
+.namespace ['Foo39';'Bar39']
+
+.sub init :vtable :method
+ ok( 1, '__init Bar39' ) # should be called
+.end
+
+.namespace [] # revert to root for next test
+
+.sub vtable_override_once_removed
+ .local pmc base
+ $P0 = get_class 'Integer'
+ base = subclass $P0, 'Foo40' # create subclass 'Foo40'
+ addattribute base, '@!capt'
+
+ $P0 = subclass 'Foo40', 'Bar40' # create subclass 'Bar40'
+ $P1 = new 'Bar40' # create an instance of 'Bar40'
+
+ $S1 = $P1 # get its string representation
+ is( $S1, 'ok bar', 'get_string overridden' )
+.end
+
+.namespace [ 'Bar40' ]
+
+.sub 'get_string' :vtable :method
+ $S0 = 'ok bar'
+ .return ($S0)
+.end
+
+.namespace [] # revert to root for next test
+
+.sub vtable_fails_for_subclasses_of_core_classes
+ $P0 = subclass 'Hash', 'Foo41'
+ $P0 = subclass 'Hash', 'Bar41'
+
+ $P1 = new 'Foo41'
+ $S1 = $P1
+ is( $S1, 'Hello world', 'get_string :vtable :method' )
+
+ $P1 = new 'Bar41'
+ $S1 = $P1
+ is( $S1, 'Hello world', 'get_string :method :vtable' )
+.end
+
+.namespace [ 'Foo41' ]
+
+.sub 'get_string' :vtable :method
+ .return('Hello world')
+.end
+
+.namespace [ 'Bar41' ]
+
+.sub 'get_string' :method :vtable
+ .return('Hello world')
+.end
+
+.namespace [] # revert to root for next test
+
+.sub super___init_called_twice
+ $P0 = newclass 'Foo42'
+ $P1 = subclass $P0, 'Bar42'
+ addattribute $P1, 'i'
+
+ $P2 = $P1.'new'()
+.end
+
+.namespace [ 'Foo42' ]
+
+.sub 'init' :vtable :method
+ $P0 = getattribute self, 'i'
+ isnull $I1, $P0
+ ok( $I1, 'should be null' )
+
+ $P1 = new ['Integer']
+ setattribute self, "i", $P1 # i won't be null if init called again
+ .return ()
+.end
+
+.namespace [] # revert to root for next test
+
+.sub using_class_object_from_typeof_op_with_new
+ $P0 = newclass [ "Monkey" ; "Banana" ]
+ $P0 = $P0.'new'()
+ $S0 = $P0."ook"()
+ is( $S0, "Ook!", 'obj created from .new() class method' )
+
+ $P2 = typeof $P0
+ $P3 = new $P2
+ $S0 = $P3."ook"()
+ is( $S0, "Ook!", 'obj created from "new" called on result of typeof' )
+.end
+
+.namespace [ "Monkey" ; "Banana" ]
+.sub ook :method
+ $S1 = "Ook!"
+ .return ($S1)
+.end
+
+.namespace [] # revert to root for next test
+
+.macro exception_is ( M )
+ .local pmc exception
+ .local string message
+ .get_results (exception)
+
+ message = exception['message']
+ is( message, .M, .M )
+.endm
+
+.sub setting_non_existent_attribute
+ newclass $P1, "Foo45"
+ new $P2, $P1
+
+ new $P3, ['Integer']
+ push_eh handler
+ setattribute $P2, "bar", $P3
+ pop_eh
+ ok(0, "'No such attribute' exception not thrown")
+ goto end
+handler:
+ .exception_is( "No such attribute 'bar'" )
+end:
+.end
+
+.sub setting_non_existent_attribute_by_name
+ newclass $P1, "Foo47"
+ new $P2, $P1
+
+ new $P3, ['Integer']
+ push_eh handler
+ setattribute $P2, ["Foo47"], "no_such", $P3
+ pop_eh
+ ok(0, "'No such attribute' exception not thrown")
+ goto end
+handler:
+ .exception_is( "No such attribute 'no_such' in class 'Foo47'" )
+end:
+.end
+
+.sub getting_null_attribute
+ newclass $P1, "Foo51"
+ addattribute $P1, "i"
+ new $P2, "Foo51"
+
+ getattribute $P3, $P2, "i"
+ isnull $I0, $P3
+ is($I0, 1, "null attribute is null")
+.end
+
+.sub getting_non_existent_attribute
+ newclass $P1, "Foo52"
+ $P2 = $P1.'new'()
+
+ push_eh handler
+ getattribute $P3, $P2, "bar"
+ pop_eh
+ ok(0, "'No such attribute' exception not thrown")
+ goto end
+handler:
+ .exception_is( "No such attribute 'bar'" )
+end:
+.end
+
+.sub addparent_exceptions_1
+ newclass $P0, "Astronomical Object 2"
+ new $P1, ['String']
+ set $P1, "Not a class"
+ push_eh handler
+ addparent $P0, $P1
+ pop_eh
+ ok(0, "'Parent isn\'t a Class' exception not thrown")
+ goto end
+handler:
+ .exception_is( "Parent isn't a Class." )
+end:
+.end
+
+.sub addparent_exceptions_2
+ new $P0, ['Hash']
+ newclass $P1, "Trashcan"
+ push_eh handler
+ addparent $P0, $P1
+ pop_eh
+ ok(0, "'Only classes can be subclassed' exception not thrown")
+ goto end
+handler:
+ .exception_is( "Only classes can be subclassed" )
+end:
+.end
+
+.sub subclassing_a_non_existent_class
+ push_eh handler
+ subclass $P1, "Character", "Nemo"
+ pop_eh
+ ok(0, "nonexistent class exception not thrown")
+ goto end
+handler:
+ .exception_is( "Class 'Character' doesn't exist" )
+end:
+.end
+
+.sub anon_subclass_of_non_existent_class
+ push_eh handler
+ subclass $P1, "Character"
+ pop_eh
+ ok(0, "nonexistent class exception not thrown")
+ goto end
+handler:
+ .exception_is( "Class 'Character' doesn't exist" )
+end:
+.end
+
+.sub addattribute_duplicate
+ newclass $P1, "Foo53"
+ addattribute $P1, "i"
+ addattribute $P1, "j"
+ push_eh handler
+ addattribute $P1, "i"
+ pop_eh
+ ok(0, "attribute already exists exception not thrown")
+ goto end
+handler:
+ .exception_is( "Attribute 'i' already exists in 'Foo53'." )
+end:
+.end
+
+.sub wrong_way_to_create_new_objects
+ push_eh handler
+ new $P0, ['Object']
+ pop_eh
+ ok(0, "object instantiation exception not thrown")
+ goto end
+handler:
+ .exception_is( "Object must be created by a class." )
+end:
+.end
+
+.sub attribute_values__subclassing_access_meths
+ newclass $P1, "Foo54"
+ # must add attributes before object instantiation
+ addattribute $P1, "i"
+ addattribute $P1, "j"
+ # define attrib access functions in Foo54 namespace
+ get_global $P5, "Foo54__set"
+ addmethod $P1, "Foo54__set", $P5
+ get_global $P5, "Foo54__get"
+ addmethod $P1, "Foo54__get", $P5
+
+ subclass $P2, $P1, "Bar54"
+ addattribute $P2, "k"
+ addattribute $P2, "l"
+ get_global $P5, "Bar54__set"
+ addmethod $P2, "Bar54__set", $P5
+ get_global $P5, "Bar54__get"
+ addmethod $P2, "Bar54__get", $P5
+
+ # instantiate a Bar54 object
+ new $P13, "Bar54"
+
+ # Foo54 and Bar54 have attribute accessor methods
+ new $P5, ['String'] # set attribute values
+ set $P5, "i" # attribute slots have reference semantics
+ set_args "0,0", $P5, "i"
+ callmethodcc $P13, "Foo54__set"
+ get_results ""
+
+ new $P5, ['String']
+ set $P5, "j"
+ set_args "0,0", $P5, "j"
+ callmethodcc $P13,"Foo54__set"
+ get_results ""
+
+ new $P5, ['String']
+ set $P5, "k"
+ set_args "0,0", $P5, "k"
+ callmethodcc $P13,"Bar54__set"
+ get_results ""
+
+ new $P5, ['String']
+ set $P5, "l"
+ set_args "0,0", $P5, "l"
+ callmethodcc $P13,"Bar54__set"
+ get_results ""
+
+ # now retrieve attributes
+ set_args "0", "i"
+ callmethodcc $P13,"Foo54__get"
+ get_results "0", $P5
+ is( $P5, "i", 'got attrib i from Bar54->Foo54__get' )
+
+ set_args "0", "j"
+ callmethodcc $P13,"Foo54__get"
+ get_results "0", $P5
+ is( $P5, "j", 'got attrib j from Bar54->Foo54__get' )
+
+ set_args "0", "k"
+ callmethodcc $P13,"Bar54__get"
+ get_results "0", $P5
+ is( $P5, "k", 'got attrib k from Bar54->Bar54__get' )
+
+ set_args "0", "l"
+ callmethodcc $P13,"Bar54__get"
+ get_results "0", $P5
+ is( $P5, "l", 'got attrib l from Bar54->Bar54__get' )
+.end
+
+# set(obj: Pvalue, Iattr_idx)
+.sub Foo54__set
+ get_params "0,0", $P5, $S4
+ ok( 1, "in Foo54__set" )
+ interpinfo $P2, .INTERPINFO_CURRENT_OBJECT
+ setattribute $P2, $S4, $P5
+ set_returns ""
+ returncc
+.end
+
+# Pattr = get(obj: Iattr_idx)
+.sub Foo54__get
+ get_params "0", $S4
+ ok( 1, "in Foo54__get" )
+ interpinfo $P2, .INTERPINFO_CURRENT_OBJECT
+ getattribute $P5, $P2, $S4
+ set_returns "0", $P5
+ returncc
+.end
+
+.sub Bar54__set
+ get_params "0,0", $P5, $S4
+ interpinfo $P2, .INTERPINFO_CURRENT_OBJECT
+ ok( 1, "in Bar54__set" )
+ setattribute $P2, $S4, $P5
+ set_returns ""
+ returncc
+.end
+
+.sub Bar54__get
+ get_params "0", $S4
+ ok( 1, "in Bar54__get" )
+ interpinfo $P2, .INTERPINFO_CURRENT_OBJECT
+ getattribute $P5, $P2, $S4
+ set_returns "0", $P5
+ returncc
+.end
+
+.sub attribute_values__inherited_access_meths
+ newclass $P1, "Foo56"
+ # must add attributes before object instantiation
+ addattribute $P1, "i"
+ addattribute $P1, "j"
+ # define attrib access functions
+ get_global $P5, "set"
+ addmethod $P1, "set", $P5
+ get_global $P5, "get"
+ addmethod $P1, "get", $P5
+
+ subclass $P2, $P1, "Bar56"
+ addattribute $P2, "k"
+ addattribute $P2, "l"
+ addattribute $P2, "m"
+
+ # subclass is preferred for the SI case over
+ # newclass $P2, "Bar56"
+ # addattrib ...
+ # addparent $P2, $P1
+ # which is suitable for adding multiple parents to one class
+
+ # instantiate a Bar56 object
+ new $P2, "Bar56"
+
+ # Foo56 and Bar56 have attribute accessor methods
+ new $P5, ['String'] # set attribute values
+ set $P5, "i" # attribute slots have reference semantics
+ set_args "0,0,0", $P5, "Foo56", "i"
+ callmethodcc $P2, "set"
+
+ new $P5, ['String']
+ set $P5, "j"
+ set_args "0,0,0", $P5, "Foo56", "j"
+ callmethodcc $P2, "set"
+
+ new $P5, ['String']
+ set $P5, "k"
+ set_args "0,0,0", $P5, "Bar56", "k"
+ callmethodcc $P2, "set"
+
+ new $P5, ['String']
+ set $P5, "l"
+ set_args "0,0,0", $P5, "Bar56", "l"
+ callmethodcc $P2, "set"
+
+ new $P5, ['String']
+ set $P5, "m"
+ set_args "0,0,0", $P5, "Bar56", "m"
+ callmethodcc $P2, "set"
+
+ # now retrieve attributes
+ set_args "0,0", "Foo56", "i"
+ callmethodcc $P2, "get"
+ get_results "0", $P5
+ is( $P5, 'i', 'got attrib i from subclass through parent method' )
+
+ set_args "0,0", "Foo56", "j"
+ callmethodcc $P2, "get"
+ get_results "0", $P5
+ is( $P5, "j", 'got attrib i from subclass through parent method' )
+
+ set_args "0,0", "Bar56", "k"
+ callmethodcc $P2, "get"
+ get_results "0", $P5
+ is( $P5, "k", 'got attrib i from subclass through parent method' )
+
+ set_args "0,0", "Bar56", "l"
+ callmethodcc $P2, "get"
+ get_results "0", $P5
+ is( $P5, "l", 'got attrib i from subclass through parent method' )
+
+ set_args "0,0", "Bar56", "m"
+ callmethodcc $P2, "get"
+ get_results "0", $P5
+ is( $P5, "m", 'got attrib i from subclass through parent method' )
+.end
+
+# Foo56 provides accessor functions which Bar56 inherits
+# they take an additional classname argument SClass
+
+# set(obj: Pvalue, SClass, Sattr)
+.sub set
+ get_params "0,0,0", $P5, $S4, $S5
+ interpinfo $P2, .INTERPINFO_CURRENT_OBJECT
+ setattribute $P2, $S5, $P5
+ set_returns ""
+ returncc
+.end
+
+# Pattr = get(obj: SClass, Sattr)
+.sub get
+ get_params "0,0", $S4, $S5
+ interpinfo $P2, .INTERPINFO_CURRENT_OBJECT
+ getattribute $P5, $P2, $S5
+ set_returns "0", $P5
+ returncc
+.end
+
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
Modified: branches/gsoc_instrument/t/oo/vtableoverride.t
==============================================================================
--- branches/gsoc_instrument/t/oo/vtableoverride.t Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/t/oo/vtableoverride.t Sat Jun 19 16:17:11 2010 (r47715)
@@ -120,7 +120,7 @@
$P1 = new $P0
$P2 = $P1[0]
$I0 = isnull $P2
- ok($I0, "Override get_pmc_keyed_int without .return")
+ ok($I0, "Override get_pmc_keyed_int without .return - TT #1593")
.end
.namespace [ 'MyObject' ]
Modified: branches/gsoc_instrument/t/op/sprintf2.t
==============================================================================
--- branches/gsoc_instrument/t/op/sprintf2.t Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/t/op/sprintf2.t Sat Jun 19 16:17:11 2010 (r47715)
@@ -12,7 +12,7 @@
=head1 DESCRIPTION
-Executes sprintf tests that were generated by tools/dev/sprintf2.pl
+Executes sprintf tests.
=cut
Modified: branches/gsoc_instrument/t/pir/macro.t
==============================================================================
--- branches/gsoc_instrument/t/pir/macro.t Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/t/pir/macro.t Sat Jun 19 16:17:11 2010 (r47715)
@@ -21,14 +21,13 @@
.endm
.macro bar(x)
- ok(x, 'basic macro with argument')
+ ok(.x, 'basic macro with argument')
.endm
.macro_const PI_APPROX 4
.sub main :main
.include 'test_more.pir'
- .local int x
plan(3)
.foo()
.bar(42)
Modified: branches/gsoc_instrument/t/pmc/arrayiterator.t
==============================================================================
--- branches/gsoc_instrument/t/pmc/arrayiterator.t Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/t/pmc/arrayiterator.t Sat Jun 19 16:17:11 2010 (r47715)
@@ -19,15 +19,17 @@
.namespace []
.include 'iterator.pasm'
+.include 'except_types.pasm'
.sub main :main
.include 'test_more.pir'
- plan(21)
+ plan(22)
iterate_forward() # 8 tests
iterate_backward() # 6 tests
iterate_backward_string() # 6 test
+ iterate_wrong() # 1 test
iterator_init() # 1 test
.end
@@ -54,13 +56,38 @@
nok(it, "Iterator is finished after second shift")
is($P0, 42, "2nd element has correct value")
- $I0 = 1
- push_eh fail
+ .local int result
+ .local pmc ehandler
+ result = 0
+ ehandler = new ['ExceptionHandler']
+ ehandler.'handle_types'(.EXCEPTION_OUT_OF_BOUNDS)
+ push_eh ehandler
+
+ set_addr ehandler, handlep
$P0 = shift it
- $I0 = 0
+ goto fail
+handlep:
+ finalize ehandler
+ set_addr ehandler, handlei
+ $I0 = shift it
+ goto fail
+handlei:
+ finalize ehandler
+ set_addr ehandler, handlen
+ $N0 = shift it
+ goto fail
+handlen:
+ finalize ehandler
+ set_addr ehandler, handles
+ $S0 = shift it
+ goto fail
+handles:
+ finalize ehandler
+
+ result = 1
fail:
pop_eh
- ok($I0, "Shifting from finished iterator throws exception")
+ ok(result, "Shifting from finished iterator throws out of bounds exception")
.end
@@ -116,6 +143,26 @@
ok($I0, "Shifting from finished iterator throws exception - string")
.end
+.sub 'iterate_wrong'
+ .local pmc foo, it, ex
+ .local int r
+
+ foo = new ['FixedIntegerArray'], 1
+
+ it = iter foo
+ push_eh catch_wrong
+ it = 42 # Let's hope we'll never have such direction
+ r = 0
+ goto dotest
+catch_wrong:
+ .get_results(ex)
+ finalize ex
+ r = 1
+dotest:
+ pop_eh
+ ok(r, "Caught wrong direction")
+.end
+
.sub 'iterator_init'
.local pmc it, e
.local string msg
Modified: branches/gsoc_instrument/t/pmc/bytebuffer.t
==============================================================================
--- branches/gsoc_instrument/t/pmc/bytebuffer.t Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/t/pmc/bytebuffer.t Sat Jun 19 16:17:11 2010 (r47715)
@@ -21,12 +21,13 @@
.sub 'main' :main
.include 'test_more.pir'
- plan(24)
+ plan(26)
test_init()
test_set_string()
test_set_byte()
test_get_string()
+ test_push()
test_alloc()
test_iterate()
test_invalid()
@@ -177,6 +178,22 @@
end:
.end
+.sub test_push
+ .local pmc bb
+ .local int c, n, m
+ bb = new ['ByteBuffer']
+ bb = 'hell'
+ n = elements bb
+ inc n
+ c = ord 'o'
+ push bb, c
+ m = elements bb
+ is(n, m, "push increments size")
+ .local string s
+ s = bb.'get_string_as'(ascii:"")
+ is(s, 'hello', "push gives expected string result")
+.end
+
.sub test_alloc
# Exercise buffer reallocation building a utf16 string with the
# codepoints 32-8192
Modified: branches/gsoc_instrument/t/pmc/eval.t
==============================================================================
--- branches/gsoc_instrument/t/pmc/eval.t Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/t/pmc/eval.t Sat Jun 19 16:17:11 2010 (r47715)
@@ -46,11 +46,15 @@
compreg P1, "PASM"
set_args "0", S5
invokecc P1
+ get_results "0", P2
+ elements I0, P2
+ say I0
get_global P0, "_foo"
invokecc P0
print "back\n"
end
CODE
+1
foo
back
OUTPUT
Deleted: branches/gsoc_instrument/t/pmc/objects.t
==============================================================================
--- branches/gsoc_instrument/t/pmc/objects.t Sat Jun 19 16:17:11 2010 (r47714)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,1791 +0,0 @@
-#!./parrot
-# Copyright (C) 2001-2010, Parrot Foundation.
-# $Id$
-
-=head1 NAME
-
-t/pmc/objects.t - Objects
-
-=head1 SYNOPSIS
-
- % prove t/pmc/objects.t
-
-=head1 DESCRIPTION
-
-Tests the object/class subsystem.
-
-=cut
-
-.sub main :main
- .include 'test_more.pir'
- .include "iglobals.pasm"
- .include "interpinfo.pasm"
-
- plan(194)
-
- get_classname_from_class()
- test_get_class()
- test_isa()
- does_scalar()
- does_array()
- new_object()
- new_object__isa_test()
- new_object__classname()
- isa_subclass()
- isa_subclass__objects()
- test_addmethod()
- test_addattribute()
- addattribute_subclass()
- addattribute_subclass__same_name()
- set_and_get_object_attribs()
- set_and_get_multiple_object_attribs()
- attribute_values_are_specific_to_objects()
- attribute_values_and_subclassing()
- attribute_values_and_subclassing_2()
- PMC_as_classes__overridden_mmd_methods()
- typeof_class()
- typeof_objects()
- multiple_inheritance__with_attributes()
- attributes_two_levels_of_inheritance()
- class_op_test()
- anon_subclass_has_no_name()
- get_attrib_by_name()
- get_attrib_by_name_subclass()
- set_attrib_by_name_subclass()
- PMC_as_classes()
- PMC_as_classes__subclass()
- PMC_as_classes__instantiate()
- PMC_as_classes__methods()
- PMC_as_classes__mmd_methods()
- PMC_as_classes__derived_1()
- PMC_as_classes__derived_2()
- PMC_as_classes__derived_3()
- subclassing_Class()
- namespace_vs_name()
- multiple_anon_classes()
- subclassed_Integer_bug()
- equality_of_subclassed_Integer()
- short_name_attributes()
- init_with_and_without_arg()
- newclass_bracket_parsing()
- verify_namespace_types()
- verify_data_type()
- new_keyed()
- new_keyed_2()
- new_keyed_3()
- subclass_keyed()
- test_class_name_multipart_name()
- test_get_class_multipart_name()
- isa_bug()
- new_nested_ordering()
- vtable_override_once_removed()
- vtable_fails_for_subclasses_of_core_classes()
- super___init_called_twice()
- using_class_object_from_typeof_op_with_new()
- setting_non_existent_attribute()
- setting_non_existent_attribute_by_name()
- getting_null_attribute()
- getting_non_existent_attribute()
- addparent_exceptions_1()
- addparent_exceptions_2()
- subclassing_a_non_existent_class()
- anon_subclass_of_non_existent_class()
- addattribute_duplicate()
- wrong_way_to_create_new_objects()
- attribute_values__subclassing_access_meths()
- attribute_values__inherited_access_meths()
-
- # END_OF_TESTS
-.end
-
-.sub get_classname_from_class
- newclass $P1, "Foo5"
- set $S0, $P1
- is( $S0, "Foo5", "got classname Foo5" )
-
- subclass $P2, $P1, "Bar5"
- set $S1, $P2
- is( $S1, "Bar5", "got subclass Bar5" )
-
- subclass $P3, "Foo5", "Baz5"
- set $S2, $P3
- is( $S2, "Baz5", "got subclass Baz5" )
-.end
-
-.sub test_get_class
- newclass $P1, "Foo6"
- get_class $P2, "Foo6"
- set $S2, $P2
- is( $S2, "Foo6", 'get_class for Foo6' )
-
- subclass $P3, $P1, "FooBar6"
- get_class $P4, "FooBar6"
- set $S4, $P4
- is( $S4, 'FooBar6', 'get_class for FooBar6' )
-
- get_class $P3, "NoSuch6"
- isnull $I0, $P3
- ok( $I0, "no class for 'NoSuch6'" )
-.end
-
-.sub test_isa
- new $P1, ['Boolean']
-
- isa $I0, $P1, "Boolean"
- is( $I0, 1, 'Boolean isa Boolean' )
-
- isa $I0, $P1, "Bool"
- is( $I0, 0, 'Boolean !isa Bool' )
-
- isa $I0, $P1, "scalar"
- is( $I0, 1, 'Boolean isa scalar' )
-
- isa $I0, $P1, "calar"
- is( $I0, 0, 'Boolean !isa calar' )
-
- isa $I0, $P1, "Integer"
- is( $I0, 1, 'Boolean isa Integer' )
-
- isa $I0, $P1, "Integ"
- is( $I0, 0, 'Boolean !isa Integ' )
-
- isa $I0, $P1, "eger"
- is( $I0, 0, 'Boolean !isa eger' )
-
- isa $I0, $P1, " "
- is( $I0, 0, 'Boolean !isa " "' )
-
- isa $I0, $P1, ""
- is( $I0, 0, 'Boolean !isa ""' )
-
- null $S0
- isa $I0, $P1, $S0
- is( $I0, 0, 'Boolean !isa null $S0' )
-
- set $S0, "scalar"
- isa $I0, $P1, $S0
- is( $I0, 1, 'Boolean isa scalar $S0' )
-.end
-
-.sub does_scalar
- new $P1, ['Boolean']
-
- does $I0, $P1, "Boolean"
- is( $I0, 0, 'Boolean !does Boolean' )
-
- does $I0, $P1, "Bool"
- is( $I0, 0, 'Boolean !does Bool' )
-
- does $I0, $P1, "scalar"
- is( $I0, 1, 'Boolean does scalar' )
-.end
-
-.sub does_array
- new $P1, ['OrderedHash']
-
- does $I0, $P1, "Boolean"
- is( $I0, 0, 'OrderedHash !does Boolean' )
-
- does $I0, $P1, "Bool"
- is( $I0, 0, 'OrderedHash !does Bool' )
-
- does $I0, $P1, "hash"
- is( $I0, 1, 'OrderedHash does hash' )
-
- does $I0, $P1, "array"
- is( $I0, 1, 'OrderedHash does array' )
-.end
-
-.sub new_object
- newclass $P1, "Foo7"
- new $P2, "Foo7"
- ok( 1, 'created new object from Foo7 class' )
-.end
-
-.sub new_object__isa_test
- newclass $P1, "Foo8"
- new $P2, $P1
- ok( 1, 'created new object from Foo8 class' )
-
- isa $I0, $P2, "Foo8"
- ok( $I0, 'new object isa Foo8' )
-.end
-
-.sub new_object__classname
- newclass $P1, "Foo9"
- new $P2, $P1
- set $S0, $P1 # class
- is( $S0, "Foo9", 'new object from Foo9 class as a string is Foo9' )
-
- typeof $S0, $P2 # object
- is( $S0, 'Foo9', 'typeof obj is Foo9' )
-
- class $P3, $P1
- set $S0, $P1 # class
- is( $S0, 'Foo9', 'class of obj is Foo9' )
-
- typeof $S0, $P2 # object
- is( $S0, 'Foo9', 'typeof obj is Foo9' )
-
-.end
-
-.sub isa_subclass
- newclass $P1, "Foo10"
- subclass $P2, $P1, "Bar10"
-
- isa_ok( $P2, "Foo10", 'newclass isa Foo10' )
- isa_ok( $P2, "Bar10", 'new subclass isa Bar10' )
- isa_ok( $P2, "Foo10", 'new subclass isa parent' )
- isa_ok( $P2, "Class", 'new subclass isa Class' )
-
- isa $I0, $P2, "Object"
- is( $I0, 0, 'new subclass !isa Object' )
-.end
-
-.sub isa_subclass__objects
- newclass $P3, "Foo30"
- subclass $P4, $P3, "Bar30"
- $P1 = $P3.'new'()
- $P2 = $P4.'new'()
-
- isa_ok( $P1, "Foo30", 'obj isa its class' )
- isa_ok( $P2, "Bar30", 'obj isa its class' )
- isa_ok( $P2, "Foo30", 'obj isa its parent class' )
- isa_ok( $P2, "Object", 'obj isa Object' )
- isa_ok( $P2, "Class", 'obj isa Class' )
-.end
-
-.sub test_addmethod
- newclass $P0, 'Foo31'
- $P2 = get_hll_global 'sayFoo31'
-
- # add a method BEFORE creating a Foo object
- addmethod $P0, 'foo31', $P2
- $P1 = new 'Foo31'
- $P1.'foo31'()
-
- # get a method from some other namespace
- $P2 = get_hll_global ['Bar31'], 'sayBar31'
-
- # add a method AFTER creating the object
- addmethod $P0, 'bar31', $P2
- $P1.'bar31'()
-.end
-
-.sub sayFoo31
- ok( 1, 'called method added before creating obj' )
-.end
-
-.namespace ['Bar31']
-.sub sayBar31
- ok( 1, 'called method added after created obj' )
-.end
-
-.namespace [] # Reset to root namespace for next test
-
-.sub test_addattribute
- newclass $P1, "Foo11"
-
- addattribute $P1, "foo_i"
- ok( 1, 'addattribute did not blow up' )
-
- set $S0, $P1
- is( $S0, "Foo11", '$P1 is still the same class as PMC' )
-
- # Check that we can add multiple attributes
- set $I0, 0
-l1:
- set $S0, $I0
- addattribute $P1, $S0
- inc $I0
- lt $I0, 1000, l1
- ok( 1, 'addattribute 1000x without blow up' )
-.end
-
-.sub addattribute_subclass
- newclass $P1, "Foo12"
- addattribute $P1, "foo_i"
- ok( 1, 'addattribute to Foo12' )
-
- subclass $P2, $P1, "Bar12"
- addattribute $P2, "bar_i"
- ok( 1, 'addattribute to subclass of Foo12' )
-.end
-
-.sub addattribute_subclass__same_name
- newclass $P1, "Foo32"
- addattribute $P1, "i"
- addattribute $P1, "j"
-
- subclass $P2, $P1, "Bar32"
- addattribute $P2, "j"
- addattribute $P2, "k"
-
- ok( 1, 'created class and subclass and added attributes' )
-
- .local pmc o
- o = $P2.'new'()
- $P0 = getattribute o, 'i'
- is( $P0, 'Foo32.i', 'parent attrib initialized in init' )
- $P0 = getattribute o, ['Foo32'], 'j'
- is( $P0, 'Foo32.j', 'parent attrib initialized in init' )
- $P0 = getattribute o, ['Bar32'], 'j'
- is( $P0, 'Bar32.j', 'subclass attrib initialized in init' )
- $P0 = getattribute o, 'k'
- is( $P0, 'Bar32.k', 'subclass attrib initialized in init' )
-
- $P0 = getattribute o, 'i'
- is( $P0, 'Foo32.i', 'parent attrib init-ed' )
- $P0 = getattribute o, ['Foo32'], "j"
- is( $P0, 'Foo32.j', 'parent attrib init-ed' )
- $P0 = getattribute o, 'j'
- is( $P0, 'Bar32.j', 'subclass attrib returned over parent' )
- $P0 = getattribute o, 'k'
- is( $P0, 'Bar32.k', 'subclass attrib init-ed' )
-.end
-
-.namespace ['Bar32']
-
-.sub init :vtable :method
- $P0 = new ['String']
- $P0 = 'Foo32.i'
- setattribute self, ['Foo32'], "i", $P0
- $P0 = new ['String']
- $P0 = 'Foo32.j'
- setattribute self, ["Foo32"], "j", $P0
- $P0 = new ['String']
- $P0 = 'Bar32.j'
- setattribute self, ["Bar32"], "j", $P0
- $P0 = new ['String']
- $P0 = 'Bar32.k'
- setattribute self, ["Bar32"], "k", $P0
-.end
-
-.namespace [] # Reset to root namespace for next test
-
-.sub set_and_get_object_attribs
- newclass $P1, "Foo13"
- addattribute $P1, "i"
- new $P2, $P1
-
- new $P3, ['Integer']
- set $P3, 1024
- setattribute $P2, "i", $P3
-
- new $P4, ['Integer']
- getattribute $P4, $P2, "i"
-
- is( $P4, 1024, 'set/get Integer attribute' )
-.end
-
-.sub set_and_get_multiple_object_attribs
- newclass $P1, "Foo14"
- addattribute $P1, "i"
- addattribute $P1, "j"
- new $P2, "Foo14"
-
- new $P3, ['Integer']
- set $P3, 4201
- new $P4, ['Hash']
- set $P4["Key"], "Value"
-
- setattribute $P2, "i", $P3
- setattribute $P2, "j", $P4
-
- getattribute $P5, $P2, "i"
- is( $P5, '4201', 'set/get Integer attribute' )
-
- getattribute $P6, $P2, "j"
- set $S0, $P6["Key"]
- is( $S0, 'Value', 'set/get Hash attribute on same obj' )
-.end
-
-.sub attribute_values_are_specific_to_objects
- newclass $P1, "Foo15"
- addattribute $P1, "i"
- new $P2, $P1
- new $P3, $P1
-
- new $P4, ['Integer']
- set $P4, 100
- setattribute $P2, "i", $P4
- new $P5, ['String']
- set $P5, "One hundred"
- setattribute $P3, "i", $P5
-
- getattribute $P6, $P2, "i"
- is( $P6, 100, 'attribute value on 1st object is specific to obj' )
-
- getattribute $P6, $P3, "i"
- is( $P6, 'One hundred', 'attribute value on 2nd obj is specific to obj' )
-.end
-
-.sub attribute_values_and_subclassing
- newclass $P1, "Foo16"
- addattribute $P1, "i"
- addattribute $P1, "j"
- subclass $P2, $P1, "Bar16"
- addattribute $P2, "k"
- addattribute $P2, "l"
-
- new $P2, "Bar16"
- new $P3, "Bar16"
-
- # Note that setattribute holds the actual PMC, not a copy, so
- # in this test both attributes get the PMC from $P4, and should
- # both have the same value, despite the C<inc>.
- new $P4, ['Integer']
- set $P4, 10
- setattribute $P2, "i", $P4
- inc $P4
- setattribute $P2, "j", $P4
-
- new $P5, ['Integer']
- set $P5, 100
- setattribute $P3, "i", $P5
- inc $P5
- setattribute $P3, "j", $P5
-
- getattribute $P6, $P2, "i"
- is( $P6, 11, 'setattrib with a PMC holds actual PMC not copy' )
-
- getattribute $P6, $P2, "j"
- is( $P6, 11, '...so changes to the PMC appear through the attrib' )
-
- getattribute $P6, $P3, "i"
- is( $P6, 101, '...and second test on new objects' )
-
- getattribute $P6, $P3, "j"
- is( $P6, 101, '...should have same result' )
-.end
-
-.sub attribute_values_and_subclassing_2
- newclass $P1, "Foo17"
- # must add attributes before object instantiation
- addattribute $P1, ".i"
- addattribute $P1, ".j"
-
- subclass $P2, $P1, "Bar17"
- addattribute $P2, ".k"
- addattribute $P2, ".l"
-
- # subclass is preferred for the SI case over
- # newclass $P2, "Bar"
- # addattrib ...
- # addparent $P2, $P1
- # which is suitable for adding multiple parents to one class
-
- # instantiate a Bar object
- new $P3, "Bar17"
-
- # Set the attribute values
- new $P10, ['String'] # set attribute values
- set $P10, "i" # attribute slots have reference semantics
- setattribute $P3, ".i", $P10 # so always put new PMCs in
- # if you have unique values
- new $P10, ['String']
- set $P10, "j"
- setattribute $P3, ".j", $P10
-
- new $P10, ['String']
- set $P10, "k"
- setattribute $P3, ".k", $P10
-
- new $P10, ['String']
- set $P10, "l"
- setattribute $P3, ".l", $P10
-
- # retrieve attribs
- getattribute $P11, $P3, ".i"
- is( $P11, "i", 'string attribute get/set on parent' )
-
- getattribute $P11, $P3, ".j"
- is( $P11, "j", 'string attribute get/set on parent' )
-
- getattribute $P11, $P3, ".k"
- is( $P11, "k", 'string attribute get/set on subclass' )
-
- getattribute $P11, $P3, ".l"
- is( $P11, "l", 'string attribute get/set on subclass' )
-.end
-
-.sub PMC_as_classes__overridden_mmd_methods
- .local pmc myint, i, j, k
-
- get_class $P0, "Integer"
- subclass myint, $P0, "MyInt1"
-
- i = new 'MyInt1'
- j = new 'MyInt1'
- k = new 'MyInt1'
- i = 6
- j = 7
- k = i + j
-
- is( k, 13, 'added two MyInt1' )
-
- j = new ['Integer']
- j = 100
- k = i + j
-
- is( k, 106, 'added MyInt1 and an Integer' )
-.end
-
-.namespace ["MyInt1"]
-
-.sub add :multi(MyInt1, MyInt1, MyInt1)
- .param pmc self
- .param pmc right
- .param pmc dest
- ok( 1, 'in the add method' )
- $P0 = getattribute self, ['Integer'], "proxy"
- $I0 = $P0
- $I1 = right
- $I2 = $I0 + $I1
- dest = $I2
- .return(dest)
-.end
-
-.namespace [] # Reset to root namespace for next test
-
-.sub typeof_class
- newclass $P0, "Foo21"
- typeof $S0, $P0
- is( $S0, "Class", 'typeof for a Class PMC is "Class"' )
-.end
-
-.sub typeof_objects
- newclass $P0, "A"
- newclass $P1, "B"
-
- new $P0, ['A']
- new $P1, ['B']
-
- typeof $S0, $P0
- typeof $S1, $P1
-
- is( $S0, 'A', 'typeof object of class A is "A"' )
- is( $S1, 'B', 'typeof object of class B is "B"' )
-.end
-
-.sub multiple_inheritance__with_attributes
- newclass $P1, "Star"
- addattribute $P1, "Spectral Type"
-
- newclass $P2, "Company"
- addattribute $P2, "Annual Profit"
-
- subclass $P3, $P1, "Sun"
- addparent $P3, $P2
-
- new $P4, ['Sun']
-
- new $P5, ['String']
- set $P5, "G"
- setattribute $P4, "Spectral Type", $P5
-
- new $P6, ['String']
- set $P6, "$100,000,000"
- setattribute $P4, "Annual Profit", $P6
-
- getattribute $P7, $P4, "Spectral Type"
- is( $P7, 'G', 'direct parents attribute' )
-
- getattribute $P8, $P4, "Annual Profit"
- is( $P8, '$100,000,000', "addparent's attribute" )
-.end
-
-.sub attributes_two_levels_of_inheritance
- newclass $P0, "Astronomical Object"
- addattribute $P0, "Location"
-
- subclass $P1, $P0, "Star2"
- addattribute $P1, "Spectral Type"
-
- newclass $P2, "Sun2"
- addparent $P2, $P1
- addparent $P2, $P0
-
- new $P4, "Sun2"
-
- new $P5, ['String']
- set $P5, "Taurus"
- setattribute $P4, "Location", $P5
- getattribute $P6, $P4, "Location"
- is( $P6, 'Taurus', 'attributes with two levels of inheritance' )
-.end
-
-.sub class_op_test
- newclass $P0, "City1"
- new $P1, "City1"
-
- class $P2, $P1
- set $S0, $P2
- is( $S0, 'City1', 'class op works' )
-.end
-
-.sub anon_subclass_has_no_name
- newclass $P0, "City2"
- subclass $P1, $P0
- set $S0, $P1
- is( $S0, '', 'anonymous subclass has no name' )
-.end
-
-.sub get_attrib_by_name
- newclass $P1, "Foo18"
- addattribute $P1, "i"
- new $P2, "Foo18"
- new $P3, ['String']
- set $P3, "ok"
- setattribute $P2, "i", $P3
-
- getattribute $P4, $P2, ["Foo18"], "i"
- is( $P4, 'ok', 'get attrib by name' )
-.end
-
-.sub get_attrib_by_name_subclass
- newclass $P0, "Bar19"
- addattribute $P0, "j"
-
- subclass $P1, $P0, "Foo19"
- addattribute $P1, "i"
-
- new $P2, "Foo19"
-
- new $P3, ['String']
- set $P3, "foo i"
- setattribute $P2, "i", $P3
-
- new $P3, ['String']
- set $P3, "bar j"
- setattribute $P2, "j", $P3
-
- getattribute $P4, $P2, ["Foo19"], "i"
- is( $P4, 'foo i', 'attribute from subclass get by name' )
-
- getattribute $P4, $P2, ["Bar19"], "j"
- is( $P4, 'bar j', 'attribute from parent class get by name' )
-.end
-
-.sub set_attrib_by_name_subclass
- newclass $P0, "Bar20"
- addattribute $P0, "j"
-
- subclass $P1, $P0, "Foo20"
- addattribute $P1, "i"
-
- new $P2, "Foo20"
-
- new $P3, ['String']
- set $P3, "foo i"
- setattribute $P2, ["Foo20"], "i", $P3
-
- new $P3, ['String']
- set $P3, "bar j"
- setattribute $P2, ["Bar20"], "j", $P3
-
- getattribute $P4, $P2, "i"
- is( $P4, 'foo i', 'attribute from subclass set by name' )
-
- getattribute $P4, $P2, "j"
- is( $P4, 'bar j', 'attribute from parent class set by name' )
-.end
-
-.sub PMC_as_classes
- get_class $P0, "Integer"
- ok( 1, "get_class of Integer did't croak" )
-
- get_class $P0, "Integer"
- ok( 1, "get_class of Integer did't croak second time" )
-
- typeof $S0, $P0
- is( $S0, 'PMCProxy', 'typeof PMCProxy' )
-.end
-
-.sub PMC_as_classes__subclass
- .local pmc MyInt3
- get_class $P0, "Integer"
- ok( 1, "get_class on Integer didn't blow up" )
-
- subclass MyInt3, $P0, "MyInt3"
- ok( 1, "subclassing didn't blow up" )
-
- $S0 = typeof MyInt3
- is( $S0, 'Class', 'new subclass is typeof Class' )
-
- $I0 = isa MyInt3, "MyInt3"
- ok( $I0, 'new subclass isa MyInt' )
-
- $I0 = isa MyInt3, "Integer"
- ok( $I0, 'new subclass isa parent class' )
-.end
-
-.sub PMC_as_classes__instantiate
- .local pmc MyInt4
- get_class $P0, "Integer"
- ok( 1, 'able to get_class of Integer' )
-
- subclass MyInt4, $P0, "MyInt4"
- addattribute MyInt4, ".i"
- ok( 1, 'able to addattribute to subclass' )
-
- .local pmc i
- i = new "MyInt4"
- ok( 1, 'able to instantiate obj of subclass w/ attribute' )
-.end
-
-.sub PMC_as_classes__methods
- .local pmc MyInt5
- get_class $P0, "Integer"
-
- subclass MyInt5, $P0, "MyInt5"
- addattribute MyInt5, "intval"
-
- .local pmc i, i2
- i = new "MyInt5"
- i2 = new ['Integer']
- i2 = 43
-
- i = 42 # set_integer is inherited from Integer
- ok( 1, 'able to assign int to MyInt' )
-
- $I0 = i # get_integer is overridden below
- is( $I0, 42, 'get_integer is overridden for MyInt5' )
-
- $S0 = i # get_string is overridden below
- is( $S0, 'MyInt5(42)', 'get_string is overridden for MyInt5' )
-.end
-
-.namespace ["MyInt5"]
-
-.sub set_integer_native :vtable :method
- .param int new_value
- $P1 = new ['Integer']
- $P1 = new_value
- setattribute self, "intval", $P1
-.end
-
-.sub get_integer :vtable :method
- $P0 = getattribute self, "intval"
- $I0 = $P0
- .return ($I0)
-.end
-
-.sub get_string :vtable :method
- $P0 = getattribute self, "intval"
- $I0 = $P0
- $S1 = $I0
- $S0 = "MyInt5("
- $S0 .= $S1
- $S0 .= ")"
- .return ($S0)
-.end
-
-.namespace [] # Reset to root namespace for next test
-
-.sub PMC_as_classes__mmd_methods
- .local pmc MyInt6
- get_class $P0, "Integer"
- subclass MyInt6, $P0, "MyInt6"
- .local pmc i
- .local pmc j
- .local pmc k
- i = new "MyInt6"
- j = new "MyInt6"
- k = new "MyInt6"
- i = 6
- j = 7
- k = i * j
- $I0 = k
- is( $I0, 42, 'MyInt6 defaults to Integer class for mult' )
-
- $S0 = k # get_string is overridden below
- is( $S0, 'MyInt6(42)', 'get_string is overridden for MyInt6' )
-.end
-
-.namespace ["MyInt6"]
-
-.sub get_string :vtable :method
- $I0 = self # get_integer is not overridden
- $S1 = $I0
- $S0 = "MyInt6("
- $S0 .= $S1
- $S0 .= ")"
- .return ($S0)
-.end
-
-.namespace [] # Reset to root namespace for next test
-
-.sub PMC_as_classes__derived_1
- .local pmc MyInt8
- .local pmc MyInt8_2
- get_class $P0, "Integer"
-
- subclass MyInt8, $P0, "MyInt8"
- addattribute MyInt8, 'intval'
- get_class $P1, "MyInt8"
- subclass MyInt8_2, $P1, "MyInt8_2"
-
- .local pmc i
- i = new "MyInt8_2"
- $I0 = isa i, "Integer"
- ok( $I0, 'obj isa grandparent (Integer)' )
-
- $I0 = isa i, "MyInt8"
- ok( $I0, 'obj isa parent (MyInt8)' )
-
- $I0 = isa i, "MyInt8_2"
- ok( $I0, 'obj isa its class (MyInt8_2)' )
-
- i = 42 # set_integer is overridden below
- $I0 = i # get_integer is overridden below
- is( $I0, 42, 'set/get_integer overridden' )
-
- $S0 = i # get_string is overridden below
- is( $S0, 'MyInt8_2(42)', 'set/get_string overridden' )
-.end
-
-.namespace ["MyInt8"]
-.sub 'set_integer_native' :vtable :method
- .param int val
- $P1 = new ['Integer']
- $P1 = val
- setattribute self, "intval", $P1
- .return ()
-.end
-.sub get_integer :vtable :method
- $P0 = getattribute self, 'intval'
- $I0 = $P0
- .return ($I0)
-.end
-.sub get_string :vtable :method
- $P0 = getattribute self, 'intval'
- $I0 = $P0
- $S1 = $I0
- $S0 = typeof self
- $S0 .= "("
- $S0 .= $S1
- $S0 .= ")"
- .return ($S0)
-.end
-
-.namespace [] # Reset to root namespace for next test
-
-.sub PMC_as_classes__derived_2
- .local pmc MyInt9
- .local pmc MyInt9_2
- get_class $P0, "Integer"
-
- subclass MyInt9, $P0, "MyInt9"
- addattribute MyInt9, 'intval'
- get_class $P1, "MyInt9"
- subclass MyInt9_2, $P1, "MyInt9_2"
-
- .local pmc i
- i = new "MyInt9_2"
- $I0 = isa i, "Integer"
- ok( $I0, 'obj isa grandparent (Integer)' )
- $I0 = isa i, "MyInt9"
- ok( $I0, 'obj isa parent (MyInt9)' )
- $I0 = isa i, "MyInt9_2"
- ok( $I0, 'obj isa its class (MyInt9_2)' )
-
- i = 42 # set_integer is overridden below
- $I0 = i # get_integer is overridden below
- is( $I0, 43, 'set/get_integer overridden' )
-
- $S0 = i # get_string is overridden below
- is( $S0, 'MyInt9_2(42)', 'set/get_string overridden' )
-.end
-
-.namespace ["MyInt9_2"]
-# subclassing methods from MyInt9 is ok
-# this one changes the value a bit
-.sub get_integer :vtable :method
- $P0 = getattribute self, 'intval'
- $I0 = $P0
- inc $I0 # <<<<<
- .return ($I0)
-.end
-.namespace ["MyInt9"]
-.sub 'set_integer_native' :vtable :method
- .param int val
- $P1 = new ['Integer']
- $P1 = val
- setattribute self, "intval", $P1
- .return ()
-.end
-.sub get_integer :vtable :method
- $P0 = getattribute self, 'intval'
- $I0 = $P0
- .return ($I0)
-.end
-.sub get_string :vtable :method
- $P0 = getattribute self, 'intval'
- $I0 = $P0
- $S1 = $I0
- $S0 = typeof self
- $S0 .= "("
- $S0 .= $S1
- $S0 .= ")"
- .return ($S0)
-.end
-
-.namespace [] # Reset to root namespace for next test
-
-.sub PMC_as_classes__derived_3
- .local pmc MyInt10
- .local pmc MyInt10_2
- get_class $P0, "Integer"
-
- subclass MyInt10, $P0, "MyInt10"
- addattribute MyInt10, 'intval'
- get_class $P1, "MyInt10"
- subclass MyInt10_2, $P1, "MyInt10_2"
-
- .local pmc i
- i = new "MyInt10_2"
- $I0 = isa i, "Integer"
- ok( $I0, 'obj isa grandparent (Integer)' )
- $I0 = isa i, "MyInt10"
- ok( $I0, 'obj isa parent (MyInt10)' )
- $I0 = isa i, "MyInt10_2"
- ok( $I0, 'obj isa its class (MyInt102)' )
-
- i = 42 # set_integer is overridden below
- $I0 = i # get_integer is overridden below
- is( $I0, 42, 'set/get_integer overridden' )
-
- $S0 = i # get_string is overridden below
- is( $S0, 'MyInt10_2(42)', 'set/get_string overridden' )
-.end
-
-.namespace ["MyInt10_2"]
-.sub get_integer :vtable :method
- $P0 = getattribute self, 'intval'
- $I0 = $P0
- .return ($I0)
-.end
-.sub get_string :vtable :method
- $P0 = getattribute self, 'intval'
- $I0 = $P0
- $S1 = $I0
- $S0 = typeof self
- $S0 .= "("
- $S0 .= $S1
- $S0 .= ")"
- .return ($S0)
-.end
-.namespace ['MyInt10']
-.sub 'set_integer_native' :vtable :method
- .param int val
- $P1 = new ['Integer']
- $P1 = val
- setattribute self, "intval", $P1
- .return ()
-.end
-
-.namespace [] # Reset to root namespace for next test
-
-.sub subclassing_Class
- .local pmc cl
- .local pmc parent
- parent = get_class "Class"
- cl = subclass parent, "Foo33"
- ok( 1, 'able to subclass Class' )
-
- .local pmc o
- o = new "Foo33"
- ok( 1, 'able to instantiate subclass of Class' )
-
- $S0 = typeof o
- is( $S0, 'Foo33', 'object returns correct class' )
-.end
-
-.sub namespace_vs_name
- .local pmc o, cl, f
- newclass cl, "Foo34"
- o = new "Foo34"
- is( o, 'Foo34::get_string', 'found Foo34 namespace' )
-
- o = Foo34()
- is( o, 'Foo34', 'found global Foo34' )
-
- f = get_global "Foo34"
- o = f()
- is( o, 'Foo34', 'found global Foo34 explicitly' )
-
- f = get_global ["Foo34"], "Foo34"
- o = f()
- is( o, 'Foo34::Foo34', 'found method in Foo34 namespace' )
-.end
-
-.sub Foo34
- .return("Foo34")
-.end
-
-.namespace [ "Foo34" ]
-
-.sub get_string :vtable :method
- .return("Foo34::get_string")
-.end
-
-.sub Foo34
- .return("Foo34::Foo34")
-.end
-
-.namespace [] # Reset to root namespace for next test
-
-.sub multiple_anon_classes
- newclass $P0, "City3"
- subclass $P1, $P0
- newclass $P2, "State3"
- subclass $P3, $P2
- ok( 1, "multiple anon classes didn't croak (bug #33103)" )
-.end
-
-.sub subclassed_Integer_bug
- .local pmc class
- .local pmc a
- .local pmc b
-
- subclass class, "Integer", "LispInteger1"
-
- a = new "LispInteger1"
- b = new "LispInteger1"
-
- a = 1
- b = 1
-
- set $S0, a
- is( $S0, '1', 'subclassed Integer is 1' )
- set $S0, b
- is( $S0, '1', 'subclassed Integer is 1' )
-
- a = a * b
- set $S0, a
- is( $S0, '1', 'multip and reasign to subclassed Integer is 1' )
-.end
-
-.sub equality_of_subclassed_Integer
- .local pmc class
- class = subclass "Integer", "LispInteger2"
-
- .local pmc a
- a = new 'LispInteger2'
- a = 123
-
- .local pmc b
- b = new 'LispInteger2'
- b = 123
-
- $I0 = a == b
- ok( $I0, '123 is equal to 123' )
-
-.end
-
-.sub short_name_attributes
- newclass $P1, "Foo22"
- addattribute $P1, "i"
- addattribute $P1, "j"
-
- subclass $P2, $P1, "Bar22"
- addattribute $P2, "k"
- addattribute $P2, "l"
-
- new $P2, "Bar22"
-
- # set a bunch of attribs
- new $P4, ['Integer']
- set $P4, 10
- setattribute $P2, "i", $P4
-
- new $P4, ['Integer']
- set $P4, 11
- setattribute $P2, "j", $P4
-
- new $P4, ['Integer']
- set $P4, 20
- setattribute $P2, "k", $P4
-
- new $P4, ['Integer']
- set $P4, 21
- setattribute $P2, "l", $P4
-
- getattribute $P6, $P2, "i"
- is( $P6, 10, '"i" getattribute on parent class attrib' )
- getattribute $P6, $P2, "j"
- is( $P6, 11, '"j" getattribute on parent class attrib' )
-
- getattribute $P6, $P2, "k"
- is( $P6, 20, '"k" getattribute on subclass attrib' )
- getattribute $P6, $P2, "l"
- is( $P6, 21, '"l" getattribute on subclass attrib' )
-
- getattribute $P6, $P2, ["Foo22"], "i"
- is( $P6, 10, '["Foo22"], "i" getattribute on parent class attrib' )
- getattribute $P6, $P2, ["Bar22"], "k"
- is( $P6, 20, '["Bar22"], "k" getattribute on subclass attrib' )
-.end
-
-.sub init_with_and_without_arg
- .local pmc cl, o, h, a
- cl = newclass "Foo35"
- addattribute cl, "a"
- o = cl.'new'()
- a = getattribute o, "a"
- is( a, 'ok 1', 'init without an arg' )
-
- h = new ['Hash']
- $P0 = new ['String']
- $P0 = "ok 2"
- h['a'] = $P0
- o = new cl, h
- a = getattribute o, "a"
- is( a, 'ok 2', 'init with an arg' )
-.end
-
-.namespace ["Foo35"]
-.sub init_pmc :vtable :method
- .param pmc args
- $P0 = args['a']
- setattribute self, 'a', $P0
- .return()
-.end
-.sub init :vtable :method
- $P0 = new ['String']
- $P0 = "ok 1"
- setattribute self, 'a', $P0
-.end
-
-.namespace [] # Reset to root namespace for next test
-
-.sub newclass_bracket_parsing
- newclass $P0, ['Foo23';'Bar23']
- ok( 1, 'newclass created with brackets' )
-.end
-
-.sub verify_namespace_types
- newclass $P0, ['Foo24';'Bar24']
- getinterp $P0
- set $P1, $P0[.IGLOBALS_CLASSNAME_HASH]
- typeof $S0, $P1
- is( $S0, 'NameSpace', 'namespace verified' )
-
- set $P2, $P1['Foo24']
- typeof $S0, $P2
- is( $S0, 'NameSpace', 'namespace verified' )
-.end
-
-.sub verify_data_type
- newclass $P0, ['Foo25';'Bar25']
- getinterp $P0
- set $P1, $P0[.IGLOBALS_CLASSNAME_HASH]
- set $P2, $P1['Foo25']
- set $P3, $P2['Bar25']
-
- set $I0, $P3
- isgt $I0, $I0, 0
- ok( $I0, 'verified datatype > 0' )
-.end
-
-# Puts init in a namespace
-.sub new_keyed
- .local pmc cl, o, p
- cl = newclass ['Foo36';'Bar36']
- addattribute cl, "init_check"
- o = cl.'new'()
- ok( 1, 'obj successfully created' )
-
- p = getattribute o, "init_check"
- is( p, 999, "overridden init called")
-.end
-
-.namespace ['Foo36';'Bar36']
-
-.sub init :vtable :method
- .local pmc p
- p = new ['Integer']
- p = 999
- setattribute self, "init_check", p
-.end
-
-.namespace [] # revert to root for next test
-
-.sub new_keyed_2
- .local pmc c1, c2, o1, o2
- c1 = newclass ['Foo37';'Bar37']
- c2 = newclass ['Foo37';'Fuz37']
- o1 = c1.'new'()
- o2 = c2.'new'()
- ok( 1, 'objects created successfully' )
-.end
-
-.namespace ['Foo37';'Bar37']
-
-.sub init :vtable :method
- ok( 1, '__init Bar37' )
-.end
-
-.namespace ['Foo37';'Fuz37']
-
-.sub init :vtable :method
- ok( 1, '__init Fuz37' )
-.end
-
-.namespace [] # revert to root for next test
-
-.sub new_keyed_3
- .local pmc c1, c2, c3, o1, o2, o3
- c1 = newclass ['Foo38';'Bar38']
- c2 = newclass ['Foo38';'Buz38']
- c3 = newclass 'Foo38'
- o1 = new ['Foo38';'Bar38']
- o2 = new ['Foo38';'Buz38']
- o3 = new 'Foo38'
- ok( 1, 'objects created successfully' )
-.end
-
-.namespace ['Foo38';'Bar38']
-
-.sub init :vtable :method
- ok( 1, '__init Bar38' )
-.end
-
-.namespace ['Foo38';'Buz38']
-
-.sub init :vtable :method
- ok( 1, '__init Buz38' )
-.end
-
-.namespace ['Foo38']
-
-.sub init :vtable :method
- ok( 1, '__init Foo38' )
-.end
-
-.namespace [] # revert to root for next test
-
-.sub subclass_keyed
- .local pmc base, o1, o2
- base = subclass 'Hash', ['Perl6-3'; 'PAST'; 'Node']
- addattribute base, '$.source' # original source
- addattribute base, '$.pos' # offset position
-
- $P0 = subclass base, ['Perl6-3'; 'PAST'; 'Sub']
- $P0 = subclass base, ['Perl6-3'; 'PAST'; 'Stmt']
- ok( 1, 'ok 1\n' )
-
- o1 = new ['Perl6-3'; 'PAST'; 'Sub']
- o2 = new ['Perl6-3'; 'PAST'; 'Stmt']
- ok( 1, 'objects created successfully' )
-.end
-
-.namespace ['Perl6-3'; 'PAST'; 'Stmt']
-
-.sub init :vtable :method
- ok( 1, '__init Stmt' )
-.end
-
-.namespace ['Perl6-3'; 'PAST'; 'Sub']
-
-.sub init :vtable :method
- ok( 1, '__init Sub' )
-.end
-
-.namespace [] # revert to root for next test
-
-.sub test_class_name_multipart_name
- .local pmc base, o1
- base = subclass 'Hash', ['Perl6'; 'PAST'; 'Node']
- o1 = new base
- $S0 = typeof o1
- is( $S0, "Perl6;PAST;Node", "typeof returns object's class name" )
-.end
-
-.sub test_get_class_multipart_name
- .local pmc base, o1
- base = subclass 'Hash', ['Perl6a'; 'PAST'; 'Node']
- $P0 = get_class ['Perl6a'; 'PAST'; 'Node']
- o1 = new $P0
- $S0 = typeof o1
- is( $S0, 'Perl6a;PAST;Node', 'typeof returns objects created from get_class' )
-.end
-
-.sub isa_bug
- .local pmc base, o1, o2
- base = subclass 'Hash', ['Perl6b'; 'PAST'; 'Node']
- $P0 = new [ 'Perl6b'; 'PAST'; 'Node' ]
-
- $I0 = isa $P0, [ 'Perl6b'; 'PAST'; 'Node']
- is( $I0, 1, 'obj isa the full class name' )
-
- $I0 = isa $P0, 'Hash'
- is( $I0, 1, 'obj isa the parent class' )
-
- $I0 = isa $P0, 'Perl6b'
- is( $I0, 0, 'obj !isa the first part of the class name' )
-.end
-
-.sub new_nested_ordering
- .local pmc c1, c2, o
- c1 = newclass ['Foo39']
- c2 = newclass ['Foo39';'Bar39']
- o = c2.'new'()
- ok( 1, 'objects created successfully' )
-.end
-
-.namespace ['Foo39']
-
-.sub init :vtable :method
- ok( 0, '__init Foo39' ) # shouldn't be called
-.end
-
-.namespace ['Foo39';'Bar39']
-
-.sub init :vtable :method
- ok( 1, '__init Bar39' ) # should be called
-.end
-
-.namespace [] # revert to root for next test
-
-.sub vtable_override_once_removed
- .local pmc base
- $P0 = get_class 'Integer'
- base = subclass $P0, 'Foo40' # create subclass 'Foo40'
- addattribute base, '@!capt'
-
- $P0 = subclass 'Foo40', 'Bar40' # create subclass 'Bar40'
- $P1 = new 'Bar40' # create an instance of 'Bar40'
-
- $S1 = $P1 # get its string representation
- is( $S1, 'ok bar', 'get_string overridden' )
-.end
-
-.namespace [ 'Bar40' ]
-
-.sub 'get_string' :vtable :method
- $S0 = 'ok bar'
- .return ($S0)
-.end
-
-.namespace [] # revert to root for next test
-
-.sub vtable_fails_for_subclasses_of_core_classes
- $P0 = subclass 'Hash', 'Foo41'
- $P0 = subclass 'Hash', 'Bar41'
-
- $P1 = new 'Foo41'
- $S1 = $P1
- is( $S1, 'Hello world', 'get_string :vtable :method' )
-
- $P1 = new 'Bar41'
- $S1 = $P1
- is( $S1, 'Hello world', 'get_string :method :vtable' )
-.end
-
-.namespace [ 'Foo41' ]
-
-.sub 'get_string' :vtable :method
- .return('Hello world')
-.end
-
-.namespace [ 'Bar41' ]
-
-.sub 'get_string' :method :vtable
- .return('Hello world')
-.end
-
-.namespace [] # revert to root for next test
-
-.sub super___init_called_twice
- $P0 = newclass 'Foo42'
- $P1 = subclass $P0, 'Bar42'
- addattribute $P1, 'i'
-
- $P2 = $P1.'new'()
-.end
-
-.namespace [ 'Foo42' ]
-
-.sub 'init' :vtable :method
- $P0 = getattribute self, 'i'
- isnull $I1, $P0
- ok( $I1, 'should be null' )
-
- $P1 = new ['Integer']
- setattribute self, "i", $P1 # i won't be null if init called again
- .return ()
-.end
-
-.namespace [] # revert to root for next test
-
-.sub using_class_object_from_typeof_op_with_new
- $P0 = newclass [ "Monkey" ; "Banana" ]
- $P0 = $P0.'new'()
- $S0 = $P0."ook"()
- is( $S0, "Ook!", 'obj created from .new() class method' )
-
- $P2 = typeof $P0
- $P3 = new $P2
- $S0 = $P3."ook"()
- is( $S0, "Ook!", 'obj created from "new" called on result of typeof' )
-.end
-
-.namespace [ "Monkey" ; "Banana" ]
-.sub ook :method
- $S1 = "Ook!"
- .return ($S1)
-.end
-
-.namespace [] # revert to root for next test
-
-.macro exception_is ( M )
- .local pmc exception
- .local string message
- .get_results (exception)
-
- message = exception['message']
- is( message, .M, .M )
-.endm
-
-.sub setting_non_existent_attribute
- newclass $P1, "Foo45"
- new $P2, $P1
-
- new $P3, ['Integer']
- push_eh handler
- setattribute $P2, "bar", $P3
- pop_eh
- ok(0, "'No such attribute' exception not thrown")
- goto end
-handler:
- .exception_is( "No such attribute 'bar'" )
-end:
-.end
-
-.sub setting_non_existent_attribute_by_name
- newclass $P1, "Foo47"
- new $P2, $P1
-
- new $P3, ['Integer']
- push_eh handler
- setattribute $P2, ["Foo47"], "no_such", $P3
- pop_eh
- ok(0, "'No such attribute' exception not thrown")
- goto end
-handler:
- .exception_is( "No such attribute 'no_such' in class 'Foo47'" )
-end:
-.end
-
-.sub getting_null_attribute
- newclass $P1, "Foo51"
- addattribute $P1, "i"
- new $P2, "Foo51"
-
- getattribute $P3, $P2, "i"
- isnull $I0, $P3
- is($I0, 1, "null attribute is null")
-.end
-
-.sub getting_non_existent_attribute
- newclass $P1, "Foo52"
- $P2 = $P1.'new'()
-
- push_eh handler
- getattribute $P3, $P2, "bar"
- pop_eh
- ok(0, "'No such attribute' exception not thrown")
- goto end
-handler:
- .exception_is( "No such attribute 'bar'" )
-end:
-.end
-
-.sub addparent_exceptions_1
- newclass $P0, "Astronomical Object 2"
- new $P1, ['String']
- set $P1, "Not a class"
- push_eh handler
- addparent $P0, $P1
- pop_eh
- ok(0, "'Parent isn\'t a Class' exception not thrown")
- goto end
-handler:
- .exception_is( "Parent isn't a Class." )
-end:
-.end
-
-.sub addparent_exceptions_2
- new $P0, ['Hash']
- newclass $P1, "Trashcan"
- push_eh handler
- addparent $P0, $P1
- pop_eh
- ok(0, "'Only classes can be subclassed' exception not thrown")
- goto end
-handler:
- .exception_is( "Only classes can be subclassed" )
-end:
-.end
-
-.sub subclassing_a_non_existent_class
- push_eh handler
- subclass $P1, "Character", "Nemo"
- pop_eh
- ok(0, "nonexistent class exception not thrown")
- goto end
-handler:
- .exception_is( "Class 'Character' doesn't exist" )
-end:
-.end
-
-.sub anon_subclass_of_non_existent_class
- push_eh handler
- subclass $P1, "Character"
- pop_eh
- ok(0, "nonexistent class exception not thrown")
- goto end
-handler:
- .exception_is( "Class 'Character' doesn't exist" )
-end:
-.end
-
-.sub addattribute_duplicate
- newclass $P1, "Foo53"
- addattribute $P1, "i"
- addattribute $P1, "j"
- push_eh handler
- addattribute $P1, "i"
- pop_eh
- ok(0, "attribute already exists exception not thrown")
- goto end
-handler:
- .exception_is( "Attribute 'i' already exists in 'Foo53'." )
-end:
-.end
-
-.sub wrong_way_to_create_new_objects
- push_eh handler
- new $P0, ['Object']
- pop_eh
- ok(0, "object instantiation exception not thrown")
- goto end
-handler:
- .exception_is( "Object must be created by a class." )
-end:
-.end
-
-.sub attribute_values__subclassing_access_meths
- newclass $P1, "Foo54"
- # must add attributes before object instantiation
- addattribute $P1, "i"
- addattribute $P1, "j"
- # define attrib access functions in Foo54 namespace
- get_global $P5, "Foo54__set"
- addmethod $P1, "Foo54__set", $P5
- get_global $P5, "Foo54__get"
- addmethod $P1, "Foo54__get", $P5
-
- subclass $P2, $P1, "Bar54"
- addattribute $P2, "k"
- addattribute $P2, "l"
- get_global $P5, "Bar54__set"
- addmethod $P2, "Bar54__set", $P5
- get_global $P5, "Bar54__get"
- addmethod $P2, "Bar54__get", $P5
-
- # instantiate a Bar54 object
- new $P13, "Bar54"
-
- # Foo54 and Bar54 have attribute accessor methods
- new $P5, ['String'] # set attribute values
- set $P5, "i" # attribute slots have reference semantics
- set_args "0,0", $P5, "i"
- callmethodcc $P13, "Foo54__set"
- get_results ""
-
- new $P5, ['String']
- set $P5, "j"
- set_args "0,0", $P5, "j"
- callmethodcc $P13,"Foo54__set"
- get_results ""
-
- new $P5, ['String']
- set $P5, "k"
- set_args "0,0", $P5, "k"
- callmethodcc $P13,"Bar54__set"
- get_results ""
-
- new $P5, ['String']
- set $P5, "l"
- set_args "0,0", $P5, "l"
- callmethodcc $P13,"Bar54__set"
- get_results ""
-
- # now retrieve attributes
- set_args "0", "i"
- callmethodcc $P13,"Foo54__get"
- get_results "0", $P5
- is( $P5, "i", 'got attrib i from Bar54->Foo54__get' )
-
- set_args "0", "j"
- callmethodcc $P13,"Foo54__get"
- get_results "0", $P5
- is( $P5, "j", 'got attrib j from Bar54->Foo54__get' )
-
- set_args "0", "k"
- callmethodcc $P13,"Bar54__get"
- get_results "0", $P5
- is( $P5, "k", 'got attrib k from Bar54->Bar54__get' )
-
- set_args "0", "l"
- callmethodcc $P13,"Bar54__get"
- get_results "0", $P5
- is( $P5, "l", 'got attrib l from Bar54->Bar54__get' )
-.end
-
-# set(obj: Pvalue, Iattr_idx)
-.sub Foo54__set
- get_params "0,0", $P5, $S4
- ok( 1, "in Foo54__set" )
- interpinfo $P2, .INTERPINFO_CURRENT_OBJECT
- setattribute $P2, $S4, $P5
- set_returns ""
- returncc
-.end
-
-# Pattr = get(obj: Iattr_idx)
-.sub Foo54__get
- get_params "0", $S4
- ok( 1, "in Foo54__get" )
- interpinfo $P2, .INTERPINFO_CURRENT_OBJECT
- getattribute $P5, $P2, $S4
- set_returns "0", $P5
- returncc
-.end
-
-.sub Bar54__set
- get_params "0,0", $P5, $S4
- interpinfo $P2, .INTERPINFO_CURRENT_OBJECT
- ok( 1, "in Bar54__set" )
- setattribute $P2, $S4, $P5
- set_returns ""
- returncc
-.end
-
-.sub Bar54__get
- get_params "0", $S4
- ok( 1, "in Bar54__get" )
- interpinfo $P2, .INTERPINFO_CURRENT_OBJECT
- getattribute $P5, $P2, $S4
- set_returns "0", $P5
- returncc
-.end
-
-.sub attribute_values__inherited_access_meths
- newclass $P1, "Foo56"
- # must add attributes before object instantiation
- addattribute $P1, "i"
- addattribute $P1, "j"
- # define attrib access functions
- get_global $P5, "set"
- addmethod $P1, "set", $P5
- get_global $P5, "get"
- addmethod $P1, "get", $P5
-
- subclass $P2, $P1, "Bar56"
- addattribute $P2, "k"
- addattribute $P2, "l"
- addattribute $P2, "m"
-
- # subclass is preferred for the SI case over
- # newclass $P2, "Bar56"
- # addattrib ...
- # addparent $P2, $P1
- # which is suitable for adding multiple parents to one class
-
- # instantiate a Bar56 object
- new $P2, "Bar56"
-
- # Foo56 and Bar56 have attribute accessor methods
- new $P5, ['String'] # set attribute values
- set $P5, "i" # attribute slots have reference semantics
- set_args "0,0,0", $P5, "Foo56", "i"
- callmethodcc $P2, "set"
-
- new $P5, ['String']
- set $P5, "j"
- set_args "0,0,0", $P5, "Foo56", "j"
- callmethodcc $P2, "set"
-
- new $P5, ['String']
- set $P5, "k"
- set_args "0,0,0", $P5, "Bar56", "k"
- callmethodcc $P2, "set"
-
- new $P5, ['String']
- set $P5, "l"
- set_args "0,0,0", $P5, "Bar56", "l"
- callmethodcc $P2, "set"
-
- new $P5, ['String']
- set $P5, "m"
- set_args "0,0,0", $P5, "Bar56", "m"
- callmethodcc $P2, "set"
-
- # now retrieve attributes
- set_args "0,0", "Foo56", "i"
- callmethodcc $P2, "get"
- get_results "0", $P5
- is( $P5, 'i', 'got attrib i from subclass through parent method' )
-
- set_args "0,0", "Foo56", "j"
- callmethodcc $P2, "get"
- get_results "0", $P5
- is( $P5, "j", 'got attrib i from subclass through parent method' )
-
- set_args "0,0", "Bar56", "k"
- callmethodcc $P2, "get"
- get_results "0", $P5
- is( $P5, "k", 'got attrib i from subclass through parent method' )
-
- set_args "0,0", "Bar56", "l"
- callmethodcc $P2, "get"
- get_results "0", $P5
- is( $P5, "l", 'got attrib i from subclass through parent method' )
-
- set_args "0,0", "Bar56", "m"
- callmethodcc $P2, "get"
- get_results "0", $P5
- is( $P5, "m", 'got attrib i from subclass through parent method' )
-.end
-
-# Foo56 provides accessor functions which Bar56 inherits
-# they take an additional classname argument SClass
-
-# set(obj: Pvalue, SClass, Sattr)
-.sub set
- get_params "0,0,0", $P5, $S4, $S5
- interpinfo $P2, .INTERPINFO_CURRENT_OBJECT
- setattribute $P2, $S5, $P5
- set_returns ""
- returncc
-.end
-
-# Pattr = get(obj: SClass, Sattr)
-.sub get
- get_params "0,0", $S4, $S5
- interpinfo $P2, .INTERPINFO_CURRENT_OBJECT
- getattribute $P5, $P2, $S5
- set_returns "0", $P5
- returncc
-.end
-
-
-# Local Variables:
-# mode: pir
-# fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:
Modified: branches/gsoc_instrument/t/pmc/schedulermessage.t
==============================================================================
--- branches/gsoc_instrument/t/pmc/schedulermessage.t Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/t/pmc/schedulermessage.t Sat Jun 19 16:17:11 2010 (r47715)
@@ -1,5 +1,5 @@
#!./parrot
-# Copyright (C) 2008, Parrot Foundation.
+# Copyright (C) 2008-2010, Parrot Foundation.
# $Id$
=head1 NAME
@@ -69,6 +69,10 @@
$P1 = new ['SchedulerMessage'], $P0
+ # Make sure the mark vtable function is exercised.
+ null $P0
+ sweep 1
+
$S0 = $P1
is($S0, "nine", "hash-initialized message has correct type")
Modified: branches/gsoc_instrument/t/pmc/sockaddr.t
==============================================================================
--- branches/gsoc_instrument/t/pmc/sockaddr.t Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/t/pmc/sockaddr.t Sat Jun 19 16:17:11 2010 (r47715)
@@ -1,5 +1,5 @@
#!./parrot
-# Copyright (C) 2006-2008, Parrot Foundation.
+# Copyright (C) 2006-2010, Parrot Foundation.
# $Id$
=head1 NAME
@@ -19,7 +19,7 @@
.sub main :main
.include 'test_more.pir'
- plan(4)
+ plan(5)
new $P0, ['Socket']
ok(1, 'Instantiated a Socket PMC')
@@ -30,8 +30,13 @@
$I0 = isnull $P0
$I0 = not $I0
ok($I0, 'Sockaddr PMC created')
+
$S0 = typeof $P1
is($S0, 'Sockaddr', 'PMC has correct type')
+
+ $P2 = clone $P1
+ $S2 = typeof $P2
+ is($S2, 'Sockaddr', 'PMC clone has correct type')
.end
# Local Variables:
Modified: branches/gsoc_instrument/t/pmc/stringhandle.t
==============================================================================
--- branches/gsoc_instrument/t/pmc/stringhandle.t Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/t/pmc/stringhandle.t Sat Jun 19 16:17:11 2010 (r47715)
@@ -7,7 +7,7 @@
use lib qw( . lib ../lib ../../lib );
use Test::More;
-use Parrot::Test tests => 19;
+use Parrot::Test tests => 24;
=head1 NAME
@@ -69,6 +69,48 @@
ok 7 - $P7.open($S1, $S2) # new file, write mode succeeds
OUT
+pir_output_is( <<'CODE', <<'OUT', 'get_bool' );
+.sub test :main
+ .local pmc sh
+ .local int b
+ sh = new ['StringHandle']
+ b = 0
+ unless sh goto b_false
+ b = 1
+ b_false:
+ say b
+ sh.'open'('mockname', 'w')
+ sh.'print'('Some content')
+ sh.'close'()
+ sh.'open'()
+ b = 0
+ unless sh goto b_true
+ b = 1
+ b_true:
+ say b
+.end
+CODE
+0
+1
+OUT
+
+# StringHandle doesn't use file descriptor, get_fd always return -1
+pir_output_is( <<'CODE', <<'OUT', 'get_fd method' );
+.sub test :main
+ .local pmc sh
+ .local int fd
+ sh = new ['StringHandle']
+ fd = sh.'get_fd'()
+ say fd
+ sh.'open'('mockname', 'r')
+ fd = sh.'get_fd'()
+ say fd
+.end
+CODE
+-1
+-1
+OUT
+
SKIP: {
skip 'no asynch calls yet' => 1;
@@ -206,6 +248,44 @@
ok 6 - read string back from file
OUT
+pir_output_is( <<'CODE', <<'OUT', 'puts' );
+.include 'except_types.pasm'
+.sub 'test' :main
+ .local pmc sh, eh
+ .local int result
+ sh = new ['StringHandle']
+ eh = new ['ExceptionHandler']
+ eh.'handle_types'(.EXCEPTION_PIO_ERROR)
+ push_eh eh
+
+ # puts to SH not opened
+ result = 0
+ set_addr eh, handle1
+ sh.'puts'('something')
+ result = 1
+ goto done1
+handle1:
+ finalize eh
+done1:
+ say result
+
+ # puts to SH opened for reading
+ result = 0
+ set_addr eh, handle2
+ sh.'open'('mockname', 'r')
+ sh.'puts'('something')
+ result = 1
+ goto done2
+handle2:
+ finalize eh
+done2:
+ say result
+.end
+CODE
+0
+0
+OUT
+
# L<PDD22/I\/O PMC API/=item print.*=item readline>
pir_output_is( <<"CODE", <<'OUT', 'readline - synchronous' );
.sub 'test' :main
@@ -520,6 +600,25 @@
ok
OUTPUT
+pir_output_is( <<"CODE", <<"OUTPUT", "readall - stringhandle with null content" );
+.sub main :main
+ .local pmc sh
+ .local string s
+ sh = new ['StringHandle']
+ sh.'open'('mockname', 'r')
+ # Open sets content to an empty string, flush resets is to null
+ # and that is the case we are testing here.
+ # Also, ensures coverage of the flush method.
+ sh.'flush'()
+ s = sh.'readall'()
+ print '['
+ print s
+ say ']'
+.end
+CODE
+[]
+OUTPUT
+
pir_output_is( <<"CODE", <<"OUTPUT", "readall() - opened stringhandle" );
.sub main :main
\$S0 = <<"EOS"
@@ -544,6 +643,22 @@
ok
OUTPUT
+pir_output_is( <<'CODE', <<"OUTPUT", "is_closed" );
+.sub main
+ .local pmc sh
+ .local int i
+ sh = new ['StringHandle']
+ i = sh.'is_closed'()
+ say i
+ sh.'open'("foo", "w")
+ i = sh.'is_closed'()
+ say i
+.end
+CODE
+1
+0
+OUTPUT
+
pir_output_is( <<"CODE", <<"OUTPUT", "readall() - utf8 on closed stringhandle" );
.sub 'main'
.local pmc ifh
Modified: branches/gsoc_instrument/t/pmc/stringiterator.t
==============================================================================
--- branches/gsoc_instrument/t/pmc/stringiterator.t Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/t/pmc/stringiterator.t Sat Jun 19 16:17:11 2010 (r47715)
@@ -21,13 +21,50 @@
.sub main :main
.include 'test_more.pir'
- plan(18)
+ plan(24)
- iterate_forward() # 10 tests
+ test_clone()
+ test_elements()
+ iterate_forward() # 11 tests
iterate_backward() # 8 tests
+ iterate_wrong() # 1 test
+ iterate_out() # 1 test
.end
+.sub 'test_clone'
+ .local pmc s, it, itc
+ .local int nit, nitc
+
+ s = new ['String']
+ s = 'somestring'
+ it = iter s
+ # Get a clone and make sure both the original and the clone
+ # gets marked.
+ sweep 1
+ nit = elements it
+ itc = clone it
+ sweep 1
+ nitc = elements itc
+ is(nit, nitc, "clone has same length as original")
+.end
+
+.sub test_elements
+ .local string s
+ .local pmc ps, it
+ .local int ns, nit
+
+ s = 'someotherstring'
+ ps = new ['String']
+ ps = s
+ it = iter ps
+ ns = length s
+ nit = elements it
+ is(ns, nit, "iter elements is equal to string length")
+ nit = it
+ is(ns, nit, "iter get_integer is equal to string length")
+.end
+
.sub 'iterate_forward'
.local pmc s, it
@@ -47,6 +84,9 @@
ok(it, "Can shift 1st character")
is($S0, 'b', "With correct value")
+ $S0 = it[0]
+ is($S0, 'a', "can get string keyed int correct value")
+
$S0 = shift it
ok(it, "Can shift 2nd character")
is($S0, 'a', "With correct value")
@@ -96,6 +136,78 @@
ok($I0, "Shifting from finished iterator throws exception")
.end
+.sub 'iterate_wrong'
+ .local pmc s, it, ex
+ .local int r
+
+ s = new ['String']
+ s = 'BAZ'
+
+ it = iter s
+ push_eh catch_wrong
+ it = 42 # Let's hope we'll never have such direction
+ r = 0
+ goto dotest
+catch_wrong:
+ .get_results(ex)
+ finalize ex
+ pop_eh
+ r = 1
+dotest:
+ ok(r, "Caught wrong direction")
+.end
+
+# out of bounds conditions not covered by previous tests
+.sub 'iterate_out'
+ .local pmc s, it, eh
+ s = new ['String']
+ s = 'hi'
+ it = iter s
+ .local string rs
+ rs = shift it
+ rs = shift it
+ eh = new ['ExceptionHandler']
+ push_eh eh
+
+ # shift string
+ set_addr eh, catch1
+ rs = shift it
+ goto fail
+catch1:
+ finalize eh
+
+ # shift integer
+ set_addr eh, catch2
+ .local int ri
+ ri = shift it
+ goto fail
+catch2:
+ finalize eh
+
+t3:
+ # pop string
+ set_addr eh, catch3
+ .local int ri
+ rs = pop it
+ goto fail
+catch3:
+ finalize eh
+
+ # pop integer
+ set_addr eh, catch4
+ .local int ri
+ ri = pop it
+ goto fail
+catch4:
+ finalize eh
+
+ ok(1, "Caught out of bounds iterations")
+ goto end
+fail:
+ ok(0, "Out of bounds iteration should throw")
+end:
+.end
+
# Local Variables:
# mode: pir
# fill-column: 100
Modified: branches/gsoc_instrument/t/src/embed.t
==============================================================================
--- branches/gsoc_instrument/t/src/embed.t Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/t/src/embed.t Sat Jun 19 16:17:11 2010 (r47715)
@@ -451,7 +451,7 @@
/* locate function to run */
smain = Parrot_str_new_constant(interp, "main");
- entry = Parrot_find_global_cur(interp, smain);
+ entry = Parrot_ns_find_current_namespace_global(interp, smain);
/* location of the entry */
interp->current_cont = new_ret_continuation_pmc(interp, NULL);
@@ -516,7 +516,7 @@
/* locate function to run */
smain = Parrot_str_new_constant(interp, "main");
- entry = Parrot_find_global_cur(interp, smain);
+ entry = Parrot_ns_find_current_namespace_global(interp, smain);
/* location of the entry */
interp->current_cont = new_ret_continuation_pmc(interp, NULL);
@@ -607,7 +607,7 @@
/* locate function to run */
smain = Parrot_str_new_constant(interp, "main");
- entry = Parrot_find_global_cur(interp, smain);
+ entry = Parrot_ns_find_current_namespace_global(interp, smain);
/* location of the entry */
interp->current_cont = new_ret_continuation_pmc(interp, NULL);
@@ -698,7 +698,7 @@
/* locate function to run */
smain = Parrot_str_new_constant(interp, "main");
- entry = Parrot_find_global_cur(interp, smain);
+ entry = Parrot_ns_find_current_namespace_global(interp, smain);
/* location of the entry */
interp->current_cont = new_ret_continuation_pmc(interp, NULL);
@@ -788,7 +788,7 @@
/* locate function to run */
smain = Parrot_str_new_constant(interp, "main");
- entry = Parrot_find_global_cur(interp, smain);
+ entry = Parrot_ns_find_current_namespace_global(interp, smain);
/* location of the entry */
interp->current_cont = new_ret_continuation_pmc(interp, NULL);
Modified: branches/gsoc_instrument/t/src/extend.t
==============================================================================
--- branches/gsoc_instrument/t/src/extend.t Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/t/src/extend.t Sat Jun 19 16:17:11 2010 (r47715)
@@ -382,7 +382,7 @@
PMC *sub, *arg;
Parrot_pbc_load(interp, pf);
- sub = Parrot_find_global_cur(interp, name);
+ sub = Parrot_ns_find_current_namespace_global(interp, name);
Parrot_ext_call(interp, sub, "->");
Parrot_eprintf(interp, "back\\n");
@@ -390,7 +390,7 @@
Parrot_io_flush(interp, Parrot_io_STDERR(interp));
name = Parrot_str_new_constant(interp, "_sub2");
- sub = Parrot_find_global_cur(interp, name);
+ sub = Parrot_ns_find_current_namespace_global(interp, name);
arg = Parrot_pmc_new(interp, enum_class_String);
Parrot_PMC_set_string_native(interp, arg,
@@ -440,7 +440,7 @@
PMC *sub, *arg;
Parrot_pbc_load(interp, pf);
- sub = Parrot_find_global_cur(interp, name);
+ sub = Parrot_ns_find_current_namespace_global(interp, name);
Parrot_ext_call(interp, sub, "->");
Parrot_eprintf(interp, "back\\n");
@@ -448,7 +448,7 @@
Parrot_io_flush(interp, Parrot_io_STDERR(interp));
name = Parrot_str_new_constant(interp, "_sub2");
- sub = Parrot_find_global_cur(interp, name);
+ sub = Parrot_ns_find_current_namespace_global(interp, name);
arg = Parrot_pmc_new(interp, enum_class_String);
Parrot_PMC_set_string_native(interp, arg,
@@ -517,7 +517,7 @@
Parrot_Int result;
Parrot_pbc_load(interp, pf);
- sub = Parrot_find_global_cur(interp, name);
+ sub = Parrot_ns_find_current_namespace_global(interp, name);
arg = Parrot_pmc_new(interp, enum_class_String);
Parrot_PMC_set_string_native(interp, arg,
@@ -584,7 +584,7 @@
Parrot_runloop jump_point;
Parrot_pbc_load(interp, pf);
- sub = Parrot_find_global_cur(interp, name);
+ sub = Parrot_ns_find_current_namespace_global(interp, name);
if (setjmp(jump_point.resume)) {
Parrot_eprintf(interp, "caught\\n");
@@ -714,7 +714,7 @@
}
foo_name = Parrot_str_new_constant( interp, "foo" );
- sub = Parrot_find_global_cur( interp, foo_name );
+ sub = Parrot_ns_find_current_namespace_global( interp, foo_name );
Parrot_ext_call(interp, sub, "->");
@@ -746,7 +746,7 @@
pf = Parrot_pbc_read( interp, "$temp_pbc", 0 );
Parrot_pbc_load( interp, pf );
- sub = Parrot_find_global_cur( interp, Parrot_str_new_constant( interp, "add" ) );
+ sub = Parrot_ns_find_current_namespace_global( interp, Parrot_str_new_constant( interp, "add" ) );
Parrot_ext_call(interp, sub, "II->I", 100, 200, &result);
printf( "Result is %d.\\n", result );
@@ -778,7 +778,7 @@
pf = Parrot_pbc_read( interp, "$temp_pbc", 0 );
Parrot_pbc_load( interp, pf );
- sub = Parrot_find_global_cur( interp, Parrot_str_new_constant( interp, "add" ) );
+ sub = Parrot_ns_find_current_namespace_global( interp, Parrot_str_new_constant( interp, "add" ) );
Parrot_ext_call( interp, sub, "II->I", 100, 200, &result );
printf( "Result is %d.\\n", result );
Modified: branches/gsoc_instrument/t/steps/auto/warnings-01.t
==============================================================================
--- branches/gsoc_instrument/t/steps/auto/warnings-01.t Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/t/steps/auto/warnings-01.t Sat Jun 19 16:17:11 2010 (r47715)
@@ -5,7 +5,7 @@
use strict;
use warnings;
-use Test::More qw(no_plan); # tests => 26;
+use Test::More tests => 18;
use Carp;
use lib qw( lib t/configure/testlib );
use_ok('config::auto::warnings');
Modified: branches/gsoc_instrument/t/steps/gen/opengl-01.t
==============================================================================
--- branches/gsoc_instrument/t/steps/gen/opengl-01.t Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/t/steps/gen/opengl-01.t Sat Jun 19 16:17:11 2010 (r47715)
@@ -28,6 +28,8 @@
my $conf = Parrot::Configure::Step::Test->new;
$conf->include_config_results( $args );
+my $real_opengl_status = $conf->data->get('has_opengl');
+
my ($pkg, $step, $result);
my $serialized = $conf->pcfreeze();
@@ -42,68 +44,78 @@
ok($result, "runstep() returned true value");
is($step->result(), q{skipped}, "Got expected result when no 'has_opengl'" );
-$conf->replenish($serialized);
-
-########### verbose ###########
-
-($args, $step_list_ref) = process_options( {
- argv => [ q{--verbose} ],
- mode => q{configure},
-} );
-
-$conf->add_steps($pkg);
-$conf->options->set( %{$args} );
-$step = test_step_constructor_and_description($conf);
-{
- my ($stdout, $stderr);
- capture(
- sub { $result = $step->runstep($conf); },
- \$stdout,
- \$stderr,
- );
- ok($result, "runstep() returned true value");
- like( $stdout,
- qr/Checking for OpenGL headers using the following globs/s,
- "Got expected verbose output"
- );
- like( $stdout,
- qr/Found the following OpenGL headers/s,
- "Got expected verbose output"
- );
- like( $stdout,
- qr/PASS\s+FAIL\s+IGNORE\s+HEADER/s,
- "Got expected verbose output"
- );
- like( $stdout,
- qr/unique signatures successfully translated/s,
- "Got expected verbose output"
- );
-}
-
-$conf->replenish($serialized);
-
-########### extra verbose ###########
-
-($args, $step_list_ref) = process_options( {
- argv => [ q{--verbose=3} ],
- mode => q{configure},
-} );
-
-$conf->add_steps($pkg);
-$conf->options->set( %{$args} );
-$step = test_step_constructor_and_description($conf);
-{
- my ($stdout, $stderr);
- capture(
- sub { $result = $step->runstep($conf); },
- \$stdout,
- \$stderr,
- );
- ok($result, "runstep() returned true value");
- like( $stdout,
- qr/COUNT\s+NCI SIGNATURE/s,
- "Got expected verbose output"
- );
+SKIP: {
+ skip 'opengl not detected',
+ 13 unless $real_opengl_status;
+
+ # The complex nature of gen::opengl::runstep() makes it difficult to write
+ # tests that will DTRT when OpenGL is not really present on this machine.
+ # In particular, tests for verbose output will fail when
+ # $real_opengl_status is false. So we'll SKIP.
+
+ $conf->replenish($serialized);
+
+ ########### verbose ###########
+
+ ($args, $step_list_ref) = process_options( {
+ argv => [ q{--verbose} ],
+ mode => q{configure},
+ } );
+
+ $conf->add_steps($pkg);
+ $conf->options->set( %{$args} );
+ $step = test_step_constructor_and_description($conf);
+ {
+ my ($stdout, $stderr);
+ capture(
+ sub { $result = $step->runstep($conf); },
+ \$stdout,
+ \$stderr,
+ );
+ ok($result, "runstep() returned true value");
+ like( $stdout,
+ qr/Checking for OpenGL headers using the following globs/s,
+ "Got expected verbose output"
+ );
+ like( $stdout,
+ qr/Found the following OpenGL headers/s,
+ "Got expected verbose output"
+ );
+ like( $stdout,
+ qr/PASS\s+FAIL\s+IGNORE\s+HEADER/s,
+ "Got expected verbose output"
+ );
+ like( $stdout,
+ qr/unique signatures successfully translated/s,
+ "Got expected verbose output"
+ );
+ }
+
+ $conf->replenish($serialized);
+
+ ########### extra verbose ###########
+
+ ($args, $step_list_ref) = process_options( {
+ argv => [ q{--verbose=3} ],
+ mode => q{configure},
+ } );
+
+ $conf->add_steps($pkg);
+ $conf->options->set( %{$args} );
+ $step = test_step_constructor_and_description($conf);
+ {
+ my ($stdout, $stderr);
+ capture(
+ sub { $result = $step->runstep($conf); },
+ \$stdout,
+ \$stderr,
+ );
+ ok($result, "runstep() returned true value");
+ like( $stdout,
+ qr/COUNT\s+NCI SIGNATURE/s,
+ "Got expected verbose output"
+ );
+ }
}
pass("Completed all tests in $0");
Copied: branches/gsoc_instrument/t/tools/parrot_config.t (from r47713, trunk/t/tools/parrot_config.t)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/gsoc_instrument/t/tools/parrot_config.t Sat Jun 19 16:17:11 2010 (r47715, copy of r47713, trunk/t/tools/parrot_config.t)
@@ -0,0 +1,84 @@
+#! perl
+# Copyright (C) 2010, Parrot Foundation.
+# $Id$
+
+=head1 NAME
+
+t/tools/parrot_config.t - test parrot_config
+
+=head1 SYNOPSIS
+
+ % prove t/tools/parrot_config.t - test parrot_config
+
+=head1 DESCRIPTION
+
+Tests the C<parrot_config> tool.
+
+=cut
+
+use strict;
+use warnings;
+use lib qw(lib);
+
+use Test::More;
+use IO::File ();
+use Parrot::Config;
+use Parrot::Test;
+use File::Spec;
+
+my ($path, $exefile);
+
+BEGIN {
+ $path = File::Spec->catfile( ".", "parrot_config" );
+ $exefile = $path . $PConfig{exe};
+ unless ( -f $exefile ) {
+ plan skip_all => "$exefile hasn't been built yet.";
+ exit(0);
+ }
+ plan tests => 3;
+}
+
+config_output_like(
+ 'pmc_names',
+ qr/\bHash\b/,
+ 'parrot_config basic sanity'
+);
+
+config_output_like(
+ 'non_existant_key',
+ qr/no such key: 'non_existant_key'/,
+ 'missing keys'
+);
+
+config_output_like(
+ 'slash has_icu',
+ qr/slash \s+ => \s+ '.' \n has_icu \s+ => \s+ '.'/x,
+ 'multiple keys'
+);
+
+=head1 HELPER SUBROUTINES
+
+=head2 dump_output_like
+
+ config_output_like($keys, /regexp/, $description);
+
+Runs parrot_config with $keys as the argument and verifies the output.
+
+=cut
+
+sub config_output_like {
+ my ($options, $snippet, $desc) = @_;
+
+ my $out = `$exefile $options`;
+
+ like( $out, $snippet, $desc );
+
+ return;
+}
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
Modified: branches/gsoc_instrument/tools/dev/fetch_languages.pl
==============================================================================
--- branches/gsoc_instrument/tools/dev/fetch_languages.pl Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/tools/dev/fetch_languages.pl Sat Jun 19 16:17:11 2010 (r47715)
@@ -229,8 +229,8 @@
{
name => 'pir',
- scm => 'SVN',
- repository => 'https://svn.parrot.org/languages/pir/trunk'
+ scm => 'GIT',
+ repository => 'http://github.com/bacek/pir.git'
},
{
Modified: branches/gsoc_instrument/tools/dev/mk_inno.pl
==============================================================================
--- branches/gsoc_instrument/tools/dev/mk_inno.pl Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/tools/dev/mk_inno.pl Sat Jun 19 16:17:11 2010 (r47715)
@@ -34,6 +34,7 @@
} if ($PConfig{has_icu});
my %dll = (
+ gccversion => [ 'libgcc_s_sjlj-1.dll' ],
HAS_GETTEXT => [ 'libintl3.dll', 'libiconv2.dll' ],
HAS_PCRE => [ 'pcre3.dll' ],
HAS_READLINE => [ 'readline5.dll' ],
Modified: branches/gsoc_instrument/tools/dev/mk_manifest_and_skip.pl
==============================================================================
--- branches/gsoc_instrument/tools/dev/mk_manifest_and_skip.pl Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/tools/dev/mk_manifest_and_skip.pl Sat Jun 19 16:17:11 2010 (r47715)
@@ -12,7 +12,6 @@
if (-e '.git') {
print "Sorry, this script is not compatible with git-svn\n";
- print "Patches Welcome!\n";
exit 1;
}
Modified: branches/gsoc_instrument/tools/dev/nci_thunk_gen.pir
==============================================================================
--- branches/gsoc_instrument/tools/dev/nci_thunk_gen.pir Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/tools/dev/nci_thunk_gen.pir Sat Jun 19 16:17:11 2010 (r47715)
@@ -859,7 +859,7 @@
"sig_char": "S",
"temp_tmpl": "char *t_%i; STRING *ts_%i",
"fill_params_tmpl": ", &ts_%i",
- "preamble_tmpl": "t_%i = ts_%i ? Parrot_str_to_cstring(interp, ts_%i) : (char *)NULL;",
+ "preamble_tmpl": "t_%i = STRING_IS_NULL(ts_%i) ? (char *)NULL : Parrot_str_to_cstring(interp, ts_%i);",
"postamble_tmpl": "if (t_%i) Parrot_str_free_cstring(t_%i);" },
"v": { "as_proto": "void",
"return_type": "void *",
@@ -887,7 +887,7 @@
"sig_char": "S",
"fill_params_tmpl": ", &ts_%i",
"temp_tmpl": "char *t_%i; STRING *ts_%i",
- "preamble_tmpl": "t_%i = ts_%i ? Parrot_str_to_cstring(interp, ts_%i) : (char *) NULL;",
+ "preamble_tmpl": "t_%i = STRING_IS_NULL(ts_%i) ? (char *) NULL : Parrot_str_to_cstring(interp, ts_%i);",
"call_param_tmpl": "&t_%i",
"postamble_tmpl": "if (t_%i) Parrot_str_free_cstring(t_%i);" },
"2": { "as_proto": "short *",
Modified: branches/gsoc_instrument/tools/dev/pprof2cg.pl
==============================================================================
--- branches/gsoc_instrument/tools/dev/pprof2cg.pl Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/tools/dev/pprof2cg.pl Sat Jun 19 16:17:11 2010 (r47715)
@@ -43,7 +43,7 @@
=cut
-main(\@ARGV);
+main(@ARGV);
=head1 INTERNAL DATA STRUCTURES
@@ -117,9 +117,11 @@
=cut
sub main {
- my $argv = shift;
+ my $filename = shift;
my $stats = {};
- my $filename = $argv->[0];
+
+ die "Usage: $0 filename\n"
+ unless defined $filename;
$stats->{global_stats}{total_time} = 0;
@@ -129,8 +131,6 @@
close($in_fh) or die "couldn't close $filename: $!";
- #print_stats($stats);
-
unless ($filename =~ s/pprof/out/) {
$filename = "$filename.out";
}
Modified: branches/gsoc_instrument/tools/dev/vgp
==============================================================================
--- branches/gsoc_instrument/tools/dev/vgp Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/tools/dev/vgp Sat Jun 19 16:17:11 2010 (r47715)
@@ -1,2 +1,2 @@
#! /bin/sh
-valgrind --suppressions=tools/dev/parrot.supp --num-callers=500 --leak-check=full --leak-resolution=high --show-reachable=yes ./parrot --leak-test $@
+valgrind --suppressions=tools/dev/parrot.supp --num-callers=50 --leak-check=full --leak-resolution=high --show-reachable=yes ./parrot --leak-test $@
Modified: branches/gsoc_instrument/tools/util/parrot-config.pir
==============================================================================
--- branches/gsoc_instrument/tools/util/parrot-config.pir Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/tools/util/parrot-config.pir Sat Jun 19 16:17:11 2010 (r47715)
@@ -92,7 +92,7 @@
.include 'stdio.pasm'
$P1 = $P0.'stdhandle'(.PIO_STDERR_FILENO)
$P1.'print'($S0)
- $P1.'print'(" [ <config-key> | --dump | --help ]\n")
+ $P1.'print'(" [ <config-key> [ <config-key> ... ] | --dump | --help ]\n")
exit 1
.end
Modified: branches/gsoc_instrument/tools/util/release.json
==============================================================================
--- branches/gsoc_instrument/tools/util/release.json Sat Jun 19 16:04:40 2010 (r47714)
+++ branches/gsoc_instrument/tools/util/release.json Sat Jun 19 16:17:11 2010 (r47715)
@@ -1,9 +1,9 @@
{
- "release.version" : "2.4.0",
- "release.name" : "Sulfur Crest",
+ "release.version" : "2.5.0",
+ "release.name" : "Cheops",
"release.day" : "Tuesday",
- "release.date" : "18 May 2010",
- "release.nextdate" : "15 June 2010",
+ "release.date" : "15 June 2010",
+ "release.nextdate" : "20 July 2010",
"web.root" : "http://parrot.org/",
"web.source" : "download",
@@ -11,13 +11,12 @@
"web.repository" : "https://svn.parrot.org/parrot/trunk/",
"bugday.day" : "Saturday",
- "bugday.date" : "12 June 2010",
+ "bugday.date" : "17 July 2010",
"wiki.root" : "https://trac.parrot.org/parrot/wiki/",
- "wiki.bugday" : "bug_day_2010_06_12",
+ "wiki.bugday" : "bug_day_2010_07_17",
- "cpan.search" : "http://search.cpan.org/dist/parrot",
- "ftp.path" : "ftp://ftp.parrot.org/pub/parrot/releases/devel/2.4.0/",
+ "ftp.path" : "ftp://ftp.parrot.org/pub/parrot/releases/devel/2.5.0/",
"subversion.root" : "http://subversion.apache.org/",
"svk.root" : "http://svk.bestpractical.com/"
}
More information about the parrot-commits
mailing list